summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS36
-rw-r--r--COPYING674
-rw-r--r--ChangeLog330
-rw-r--r--INSTALL370
-rw-r--r--Makefile.am91
-rw-r--r--Makefile.in934
-rw-r--r--NEWS37
-rw-r--r--README115
-rw-r--r--THANKS15
-rw-r--r--TODO5
-rw-r--r--VERSION75
-rw-r--r--aclocal.m41056
-rw-r--r--agen5/Makefile.am174
-rw-r--r--agen5/Makefile.in1013
-rw-r--r--agen5/ag-text.c736
-rw-r--r--agen5/ag-text.h856
-rw-r--r--agen5/agCgi.c172
-rw-r--r--agen5/agDep.c447
-rw-r--r--agen5/agInit.c684
-rw-r--r--agen5/agShell.c695
-rw-r--r--agen5/agUtils.c564
-rw-r--r--agen5/autogen.1559
-rw-r--r--agen5/autogen.c657
-rw-r--r--agen5/autogen.h570
-rw-r--r--agen5/bootstrap.dir148
-rw-r--r--agen5/cgi-fsm.c323
-rw-r--r--agen5/cgi-fsm.h91
-rw-r--r--agen5/cgi.def55
-rw-r--r--agen5/defDirect.c1048
-rw-r--r--agen5/defFind.c944
-rw-r--r--agen5/defLex.c678
-rw-r--r--agen5/defLoad.c486
-rw-r--r--agen5/defParse-fsm.c389
-rw-r--r--agen5/defParse-fsm.h92
-rw-r--r--agen5/defParse.def109
-rw-r--r--agen5/defParse.x245
-rw-r--r--agen5/directive.h125
-rw-r--r--agen5/directive.tpl141
-rw-r--r--agen5/expExtract.c360
-rw-r--r--agen5/expFormat.c874
-rw-r--r--agen5/expGperf.c156
-rw-r--r--agen5/expGuile.c522
-rw-r--r--agen5/expMake.c429
-rw-r--r--agen5/expOutput.c934
-rw-r--r--agen5/expPrint.c344
-rw-r--r--agen5/expState.c819
-rw-r--r--agen5/expString.c1132
-rw-r--r--agen5/expr.h160
-rw-r--r--agen5/expr.ini270
-rw-r--r--agen5/fmemopen.c743
-rw-r--r--agen5/fsm-macro.tlib402
-rw-r--r--agen5/fsm-trans.tlib359
-rw-r--r--agen5/fsm.tpl207
-rw-r--r--agen5/funcCase.c1390
-rw-r--r--agen5/funcDef.c899
-rw-r--r--agen5/funcEval.c651
-rw-r--r--agen5/funcFor.c918
-rw-r--r--agen5/funcIf.c514
-rw-r--r--agen5/functions.c539
-rw-r--r--agen5/functions.h325
-rw-r--r--agen5/guile-iface.def183
-rw-r--r--agen5/guile-iface.h95
-rw-r--r--agen5/guile-iface.tpl116
-rw-r--r--agen5/invoke-autogen.texi872
-rw-r--r--agen5/loadPseudo.c497
-rw-r--r--agen5/mk-stamps.sh298
-rw-r--r--agen5/opts.c1491
-rw-r--r--agen5/opts.def998
-rw-r--r--agen5/opts.h305
-rw-r--r--agen5/proto.h300
-rw-r--r--agen5/pseudo-fsm.h227
-rw-r--r--agen5/pseudo.def69
-rw-r--r--agen5/schemedef.scm388
-rw-r--r--agen5/scmStrings.c203
-rw-r--r--agen5/snarf.tpl316
-rw-r--r--agen5/test/Makefile.am71
-rw-r--r--agen5/test/Makefile.in581
-rwxr-xr-xagen5/test/alist.test79
-rwxr-xr-xagen5/test/case.test136
-rwxr-xr-xagen5/test/columns.test56
-rwxr-xr-xagen5/test/daemon.test127
-rwxr-xr-xagen5/test/debug.test175
-rwxr-xr-xagen5/test/define.test160
-rwxr-xr-xagen5/test/defref.test124
-rwxr-xr-xagen5/test/directives.test148
-rwxr-xr-xagen5/test/dynref.test82
-rwxr-xr-xagen5/test/endmac.test73
-rwxr-xr-xagen5/test/error.test250
-rwxr-xr-xagen5/test/expr.test107
-rwxr-xr-xagen5/test/extract.test80
-rwxr-xr-xagen5/test/for.test112
-rwxr-xr-xagen5/test/forfrom.test79
-rwxr-xr-xagen5/test/forin.test86
-rwxr-xr-xagen5/test/format.test96
-rwxr-xr-xagen5/test/get.test95
-rwxr-xr-xagen5/test/gperf.test95
-rwxr-xr-xagen5/test/heredef.test102
-rwxr-xr-xagen5/test/html.test130
-rwxr-xr-xagen5/test/in.test95
-rwxr-xr-xagen5/test/include.test80
-rwxr-xr-xagen5/test/leave.test105
-rwxr-xr-xagen5/test/license.test114
-rwxr-xr-xagen5/test/line.test68
-rwxr-xr-xagen5/test/loop.test78
-rwxr-xr-xagen5/test/make.test91
-rwxr-xr-xagen5/test/match.test72
-rwxr-xr-xagen5/test/opts.test91
-rwxr-xr-xagen5/test/output.test120
-rwxr-xr-xagen5/test/pseudo.test103
-rwxr-xr-xagen5/test/reorder.test107
-rwxr-xr-xagen5/test/shell.test165
-rwxr-xr-xagen5/test/snarf.test267
-rwxr-xr-xagen5/test/stack.test93
-rwxr-xr-xagen5/test/stress.test68
-rwxr-xr-xagen5/test/string.test247
-rwxr-xr-xagen5/test/strtable.test97
-rwxr-xr-xagen5/test/strxform.test87
-rwxr-xr-xagen5/test/suffix.test90
-rwxr-xr-xagen5/test/time.test64
-rw-r--r--agen5/tpLoad.c560
-rw-r--r--agen5/tpParse.c400
-rw-r--r--agen5/tpProcess.c413
-rw-r--r--autoopts/Makefile.am207
-rw-r--r--autoopts/Makefile.in1193
-rw-r--r--autoopts/ag-char-map.h510
-rw-r--r--autoopts/alias.c108
-rw-r--r--autoopts/ao-strs.c323
-rw-r--r--autoopts/ao-strs.def429
-rw-r--r--autoopts/ao-strs.h250
-rw-r--r--autoopts/ao_string_tokenize.386
-rw-r--r--autoopts/autogen.map81
-rw-r--r--autoopts/autoopts-config.1161
-rw-r--r--autoopts/autoopts-config.in114
-rw-r--r--autoopts/autoopts.c729
-rw-r--r--autoopts/autoopts.h335
-rw-r--r--autoopts/autoopts.m4225
-rw-r--r--autoopts/autoopts/options.h1110
-rw-r--r--autoopts/autoopts/usage-txt.h435
-rw-r--r--autoopts/boolean.c97
-rw-r--r--autoopts/bootstrap.dir232
-rw-r--r--autoopts/check.c166
-rw-r--r--autoopts/configFileLoad.350
-rw-r--r--autoopts/configfile.c1433
-rw-r--r--autoopts/cook.c311
-rw-r--r--autoopts/enum.c546
-rw-r--r--autoopts/env.c264
-rw-r--r--autoopts/file.c208
-rw-r--r--autoopts/find.c579
-rw-r--r--autoopts/funcs.def1620
-rw-r--r--autoopts/genshell.c452
-rw-r--r--autoopts/genshell.def79
-rw-r--r--autoopts/genshell.h184
-rw-r--r--autoopts/gettext.h288
-rw-r--r--autoopts/install-hook.sh124
-rw-r--r--autoopts/load.c519
-rw-r--r--autoopts/makeshell.c873
-rw-r--r--autoopts/mk-autoopts-pc.in78
-rwxr-xr-xautoopts/mk-tpl-config.sh140
-rw-r--r--autoopts/nested.c849
-rw-r--r--autoopts/numeric.c165
-rw-r--r--autoopts/optionFileLoad.352
-rw-r--r--autoopts/optionFindNextValue.350
-rw-r--r--autoopts/optionFindValue.346
-rw-r--r--autoopts/optionFree.331
-rw-r--r--autoopts/optionGetValue.347
-rw-r--r--autoopts/optionLoadLine.345
-rw-r--r--autoopts/optionNextValue.347
-rw-r--r--autoopts/optionOnlyUsage.331
-rw-r--r--autoopts/optionProcess.355
-rw-r--r--autoopts/optionRestore.335
-rw-r--r--autoopts/optionSaveFile.344
-rw-r--r--autoopts/optionSaveState.341
-rw-r--r--autoopts/optionUnloadNested.328
-rw-r--r--autoopts/optionVersion.327
-rw-r--r--autoopts/parse-duration.c601
-rw-r--r--autoopts/parse-duration.h90
-rw-r--r--autoopts/pgusage.c132
-rw-r--r--autoopts/po/usage-txt.pot474
-rw-r--r--autoopts/project.h50
-rw-r--r--autoopts/proto.h130
-rw-r--r--autoopts/putshell.c361
-rw-r--r--autoopts/reset.c138
-rw-r--r--autoopts/restore.c228
-rw-r--r--autoopts/save.c768
-rw-r--r--autoopts/sort.c336
-rw-r--r--autoopts/stack.c269
-rw-r--r--autoopts/strequate.332
-rw-r--r--autoopts/streqvcmp.339
-rw-r--r--autoopts/streqvcmp.c267
-rw-r--r--autoopts/streqvmap.348
-rw-r--r--autoopts/strneqvcmp.343
-rw-r--r--autoopts/strtransform.337
-rw-r--r--autoopts/test/Makefile.am53
-rw-r--r--autoopts/test/Makefile.in560
-rwxr-xr-xautoopts/test/alias.test120
-rwxr-xr-xautoopts/test/argument.test209
-rwxr-xr-xautoopts/test/cfg-edit.test330
-rwxr-xr-xautoopts/test/cond.test194
-rwxr-xr-xautoopts/test/config.test201
-rw-r--r--autoopts/test/defs.in351
-rwxr-xr-xautoopts/test/doc.test848
-rwxr-xr-xautoopts/test/enums.test309
-rwxr-xr-xautoopts/test/equiv.test274
-rwxr-xr-xautoopts/test/errors.test232
-rwxr-xr-xautoopts/test/getopt.test668
-rwxr-xr-xautoopts/test/handler.test254
-rwxr-xr-xautoopts/test/immediate.test121
-rwxr-xr-xautoopts/test/keyword.test449
-rwxr-xr-xautoopts/test/library.test170
-rwxr-xr-xautoopts/test/main.test127
-rwxr-xr-xautoopts/test/nested.test266
-rwxr-xr-xautoopts/test/nls.test156
-rwxr-xr-xautoopts/test/rc.test240
-rwxr-xr-xautoopts/test/shell.test457
-rw-r--r--autoopts/test/stdopts.def109
-rwxr-xr-xautoopts/test/stdopts.test161
-rwxr-xr-xautoopts/test/time.test101
-rwxr-xr-xautoopts/test/usage.test656
-rwxr-xr-xautoopts/test/vendor.test174
-rwxr-xr-xautoopts/test/vers.test107
-rw-r--r--autoopts/text_mmap.c370
-rw-r--r--autoopts/time.c143
-rw-r--r--autoopts/tokenize.c333
-rw-r--r--autoopts/tpl/aginfo.tpl10
-rw-r--r--autoopts/tpl/aginfo3.tpl128
-rw-r--r--autoopts/tpl/agman-cmd.tpl123
-rw-r--r--autoopts/tpl/agman.tlib81
-rw-r--r--autoopts/tpl/agman1.tpl10
-rw-r--r--autoopts/tpl/agman3.tpl142
-rw-r--r--autoopts/tpl/agmdoc-cmd.tpl115
-rw-r--r--autoopts/tpl/agpl.lic19
-rw-r--r--autoopts/tpl/agtexi-cmd.tpl894
-rw-r--r--autoopts/tpl/bits.tpl721
-rw-r--r--autoopts/tpl/cmd-doc.tlib1001
-rw-r--r--autoopts/tpl/def2pot.tpl131
-rw-r--r--autoopts/tpl/getopt.tpl517
-rw-r--r--autoopts/tpl/gpl.lic20
-rw-r--r--autoopts/tpl/gplv2.lic19
-rw-r--r--autoopts/tpl/lgpl.lic20
-rwxr-xr-xautoopts/tpl/man2mdoc.pl279
-rwxr-xr-xautoopts/tpl/man2texi.sh29
-rw-r--r--autoopts/tpl/mbsd.lic31
-rwxr-xr-xautoopts/tpl/mdoc2man.sh298
-rwxr-xr-xautoopts/tpl/mdoc2texi.pl345
-rw-r--r--autoopts/tpl/optcode.tlib819
-rw-r--r--autoopts/tpl/opthead.tlib601
-rw-r--r--autoopts/tpl/options.tpl57
-rw-r--r--autoopts/tpl/optlib.tlib1260
-rw-r--r--autoopts/tpl/optmain.tlib1255
-rw-r--r--autoopts/tpl/rc-sample.tpl126
-rw-r--r--autoopts/tpl/stdoptions.def345
-rw-r--r--autoopts/tpl/strings.tpl174
-rwxr-xr-xautoopts/tpl/texi2man.sh76
-rwxr-xr-xautoopts/tpl/texi2mdoc.sh196
-rw-r--r--autoopts/tpl/tpl-config-tlib.in84
-rw-r--r--autoopts/tpl/usage-txt.tpl199
-rw-r--r--autoopts/tpl/usage.tlib207
-rw-r--r--autoopts/usage.c1053
-rw-r--r--autoopts/value-type.c123
-rw-r--r--autoopts/value-type.h25
-rw-r--r--autoopts/version.c214
-rw-r--r--autoopts/xat-attribute.c114
-rw-r--r--autoopts/xat-attribute.h22
-rw-r--r--columns/Makefile.am70
-rw-r--r--columns/Makefile.in739
-rw-r--r--columns/columns.c769
-rw-r--r--columns/opts.c1055
-rw-r--r--columns/opts.def357
-rw-r--r--columns/opts.h239
-rw-r--r--compat/Makefile.am52
-rw-r--r--compat/Makefile.in463
-rw-r--r--compat/bootstrap.dir24
-rw-r--r--compat/chmod.c4
-rw-r--r--compat/compat.h403
-rw-r--r--compat/pathfind.c335
-rw-r--r--compat/snprintf.c60
-rw-r--r--compat/strchr.c60
-rw-r--r--compat/strdup.c19
-rw-r--r--compat/strftime.c1049
-rw-r--r--compat/strsignal.c121
-rw-r--r--compat/strsignal.def151
-rw-r--r--compat/strsignal.h110
-rw-r--r--compat/strsignal.tpl126
-rw-r--r--compat/unlocked-io.h136
-rw-r--r--compat/windows-config.h156
-rw-r--r--config-h.in565
-rw-r--r--config/ag_macros.m4634
-rw-r--r--config/bootstrap194
-rw-r--r--config/bootstrap.local223
-rw-r--r--config/bootstrap.shlib268
-rwxr-xr-xconfig/compile342
-rwxr-xr-xconfig/config.guess1530
-rwxr-xr-xconfig/config.sub1782
-rw-r--r--config/confmacs.tlib674
-rw-r--r--config/conftest.tpl133
-rwxr-xr-xconfig/depcomp707
-rw-r--r--config/extensions.m4118
-rwxr-xr-xconfig/gendocs.sh385
-rw-r--r--config/gnulib-cache.m451
-rw-r--r--config/gnulib-comp.m4207
-rwxr-xr-xconfig/install-sh527
-rw-r--r--config/libopts.m4442
-rw-r--r--config/liboptschk.m429
-rw-r--r--config/libtool.m47982
-rw-r--r--config/ltmain.sh9655
-rw-r--r--config/ltoptions.m4384
-rw-r--r--config/ltsugar.m4123
-rw-r--r--config/ltversion.m423
-rw-r--r--config/lt~obsolete.m498
-rwxr-xr-xconfig/missing380
-rw-r--r--config/mk-shdefs.in108
-rw-r--r--config/onceonly.m4104
-rw-r--r--config/snprintfv.m498
-rw-r--r--config/texinfo.tex10013
-rw-r--r--config/unlocked-io.m441
-rwxr-xr-xconfigure19443
-rw-r--r--configure.ac255
-rw-r--r--doc/Makefile.am68
-rw-r--r--doc/Makefile.in774
-rw-r--r--doc/agdoc.texi13607
-rw-r--r--doc/auto-opts.tpl473
-rw-r--r--doc/auto_gen-tpl.in637
-rw-r--r--doc/autogen-intro.texi788
-rw-r--r--doc/autogen-texi.txt5768
-rw-r--r--doc/autogen.info502
-rw-r--r--doc/autogen.info-17460
-rw-r--r--doc/autogen.info-27195
-rw-r--r--doc/autogen.texi7
-rw-r--r--doc/fdl.texi452
-rw-r--r--doc/gendocs_template89
-rw-r--r--doc/invoke-autogen.texi872
-rw-r--r--doc/invoke-columns.texi418
-rw-r--r--doc/invoke-getdefs.texi599
-rw-r--r--doc/invoke-snprintfv.texi74
-rw-r--r--doc/invoke-xml2ag.texi470
-rw-r--r--doc/libopts.texi901
-rwxr-xr-xdoc/mk-agen-texi.sh303
-rw-r--r--doc/snprintfv.texi74
-rw-r--r--getdefs/Makefile.am93
-rw-r--r--getdefs/Makefile.in891
-rw-r--r--getdefs/gdemit.c602
-rw-r--r--getdefs/gdinit.c490
-rw-r--r--getdefs/getdefs.c1196
-rw-r--r--getdefs/getdefs.h120
-rw-r--r--getdefs/opts.def466
-rw-r--r--getdefs/proto.h46
-rw-r--r--getdefs/test/Makefile.am41
-rw-r--r--getdefs/test/Makefile.in551
-rwxr-xr-xgetdefs/test/cfg.test115
-rw-r--r--getdefs/test/defs86
-rwxr-xr-xgetdefs/test/index.test130
-rwxr-xr-xgetdefs/test/option.test107
-rwxr-xr-xgetdefs/test/subblock.test105
-rw-r--r--pkg/Makefile.am52
-rw-r--r--pkg/Makefile.in466
-rw-r--r--pkg/gnudir.tpl142
-rw-r--r--pkg/gnudoc.tpl147
-rw-r--r--pkg/libopts/COPYING.gplv3674
-rw-r--r--pkg/libopts/COPYING.lgplv3165
-rw-r--r--pkg/libopts/COPYING.mbsd26
-rw-r--r--pkg/libopts/README122
-rw-r--r--pkg/libopts/libopts-add.m4141
-rw-r--r--pkg/libopts/mklibsrc.sh132
-rw-r--r--pkg/lsm.tpl70
-rw-r--r--pkg/mkpkg.linux93
-rw-r--r--pkg/mkpkg.sh47
-rw-r--r--pkg/mkpkg.sun152
-rw-r--r--pkg/pkg-env.in47
-rw-r--r--pkg/spec.tpl151
-rw-r--r--snprintfv/AUTHORS8
-rw-r--r--snprintfv/Makefile.am48
-rw-r--r--snprintfv/Makefile.in590
-rw-r--r--snprintfv/README30
-rw-r--r--snprintfv/THANKS13
-rw-r--r--snprintfv/compat.h315
-rw-r--r--snprintfv/custom.c182
-rw-r--r--snprintfv/filament.c232
-rw-r--r--snprintfv/filament.h257
-rw-r--r--snprintfv/filament.in197
-rw-r--r--snprintfv/filament.stamp0
-rw-r--r--snprintfv/format.c1275
-rw-r--r--snprintfv/mem.c82
-rw-r--r--snprintfv/mem.h120
-rw-r--r--snprintfv/printf.c1568
-rw-r--r--snprintfv/printf.h846
-rw-r--r--snprintfv/printf.in318
-rw-r--r--snprintfv/printf.stamp0
-rw-r--r--snprintfv/stream.c226
-rw-r--r--snprintfv/stream.h192
-rw-r--r--snprintfv/stream.in96
-rw-r--r--snprintfv/stream.stamp0
-rw-r--r--xml2ag/Makefile.am92
-rw-r--r--xml2ag/Makefile.in892
-rw-r--r--xml2ag/fork.c303
-rw-r--r--xml2ag/fork.tpl223
-rw-r--r--xml2ag/test/Makefile.am43
-rw-r--r--xml2ag/test/Makefile.in551
-rwxr-xr-xxml2ag/test/convert.test100
-rw-r--r--xml2ag/xml2ag.c478
-rw-r--r--xml2ag/xmlopts.def180
400 files changed, 205234 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..594d24f
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,36 @@
+Original authors are also attributed in each source file...
+
+Bruce Korb:
+
+agen5/*, getdefs/*, autoopts/*, columns/*, rehacked compat/pathfind.c
+to be SVR4 compatible. reworked compat/strsignal to use a shell script
+to extract the local information and generate a static version. (It
+uses autogen, so a generated version must be distributed also. :)
+
+Bruce Korb and Gary V. Vaughan:
+In the directory config, regcomp.m4 and bootstrap.
+
+Gary V. Vaughan:
+changes throughout to aid portability of C code.
+wrote the autoconf files, Makefile.am and configure.in.
+in the directory config; ctime.m4, make.m4 and release.
+in the directory compat; basename.c, dirname.c, compat.h,
+ pathfind.c, libgen.h
+in the directory tests; almost *.test
+snprintfv/*
+
+Greg Harvey:
+agen5/schemedef.scm, enabling Scheme syntax definitions
+
+Brian Fox, Chet Ramey:
+sections of files borrowed from bash-2.0 incorporated into
+compat/compat.h; (posixstat.h, posixjmp.h)
+
+Fred Fish, Gary V. Vaughan and Bruce Korb:
+in the directory compat; strsignal.c
+
+James R. Van Zandt:
+The Debianization of AutoGen
+
+Daniel Schregenberger <npfdd@gmx.net>
+More GNU-ish usage text for AutoOpts.
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..60cedd1
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,330 @@
+2012-08-11 Bruce Korb <bkorb@gnu.org>
+
+ * autoopts/tpl/agtexi-cmd.tpl: Fix up "help" option name in texi doc.
+ * autoopts/ao-strs.def: remove stray newline
+ * autoopts/autogen.map: add lead option line skip characters
+ * autoopts/load.c (loadOptionLine): use it
+ * autoopts/test/shell.test: adjust
+ * autoopts/tpl/opthead.tlib (gettext): ensure it is declared
+ * autoopts/tpl/optmain.tlib (fserr_fmt): not always static.
+ * autoopts/tpl/strings.tpl: justify and sort the define list
+ * compat/compat.h (strsignal) check that HAVE_RAW_DECL_STRSIGNAL
+ is also not declared before declaring strsignal.
+ * config/confmacs.tlib: AC_TRY_RUN is obsolete
+ * config/libopts.def: AC_ERROR is obsolete
+ * doc/autogen-texi.txt (config-header): doc it
+
+2012-08-04 Bruce Korb <bkorb@gnu.org>
+ Leo Davis <ldavis@speechfxinc.com>
+
+ * autoopts/tpl/usage.tlib: capture both stdout and stderr while
+ building the sample program. Print on error, discard on success.
+
+2012-07-27 Leo Davis <ldavis@speechfxinc.com>
+
+ * autoopts/install-hook.sh: correct spelling of "defs" file and
+ redirect unwanted stdout output.
+ * pkg/spec.tpl: handle the case where the "nobody" shell is
+ /bin/false.
+ * autoopts/test/enums.test: the "columns" program may not
+ pre-exist.
+ * autoopts/tpl/optcode.tlib: likewise
+
+2012-07-18 Bruce Korb <bkorb@gnu.org>
+
+ * agen5/tpLoad.c (find_file): split out expand_dir function
+ (expand_dir): new
+ * autoopts/configfile.c (handle_cfg): code flow annotations
+ (parse_attrs): likewise
+ * autoopts/env.c (do_env_opt): handle disable options differently.
+ * autoopts/find.c (optionVendorOption): fix error handling
+ (opt_find_long): handle invalid option name
+ * autoopts/makeshell.c (optionParseShell): free memory after use
+ (open_out): break out code for loading the previous iteration's
+ output to preserve any hand editing. Also, open the file first
+ and ask questions about it later.
+ * autoopts/mk-tpl-config.sh: use sh as the cat shell, not cat itself
+ * autoopts/tpl/agtexi-cmd.tpl: export the program name so that
+ some translator scripts can know it.
+ * autoopts/tpl/mdoc2texi.pl: rewrite
+
+2012-07-01 Bruce Korb <bkorb@gnu.org>
+
+ * agen5/test/make.test: evade a problem with one platform wherein
+ ``(set! txt (string-expr)) txt'' does not work.
+ * agen5/tpLoad.c (find_file): Put the referring file name directory
+ at the end of the search, instead of the start.
+ * agen5/test/include.test: adjust test
+ * autoopts/tpl/agtexi-cmd.tpl (AG_DEF_PROG_NAME): export the
+ program-name as this environment value.
+ * autoopts/tpl/mdoc2texi.pl: clean up and rig to handle some more
+ macros.
+ * agen5/scmStrings.c (ag_scm2zchars): format string for ancient Guile
+ * autoopts/mk-tpl-config.sh: correct method of making cat shells.
+
+2012-06-18 Bruce Korb <bkorb@gnu.org>
+
+ 5.16.1 release
+
+ * autoopts/test/enums.test: warning patrol
+ * compat/windows-config.h: licensing fix
+
+2012-06-10 Bruce Korb <bkorb@gnu.org>
+
+ * Makefile.am: private rules for Doxygen documentation
+ * agen5/functions.c (mLoad_Unknown): Where the start of the name
+ being scanned cannot be determined. Do not pretend like you can.
+ * autoopts/autogen.map: fix the license
+
+2012-05-12 Bruce Korb <bkorb@gnu.org>
+
+ * config/mk-shdefs.in: new script to create a "config/shdefs" file
+ * autoopts/test/defs.in: use this file for configured values
+ * autoopts/test/Makefile.am: source config/shdefs file
+ * config/bootstrap.shlib: make default values
+ * agen5/mk-stamps.sh: use configured defs
+ * autoopts/mk-tpl-config.sh: likewise
+ * agen5/test/shell.test: likewise
+ * agen5/test/string.test: likewise
+ * autoopts/install-hook.sh: likewise
+ * autoopts/test/alias.test: likewise
+ * autoopts/test/argument.test: likewise
+ * autoopts/test/doc.test: likewise
+ * autoopts/test/getopt.test: likewise
+ * autoopts/test/shell.test: likewise
+ * autoopts/tpl/cmd-doc.tlib: likewise
+ * autoopts/tpl/optmain.tlib: likewise
+ * autoopts/tpl/strings.tpl: likewise
+ * doc/mk-agen-texi-in: likewise
+ * autoopts/tpl/tpl-config-tlib.in: use them to configure templates
+ * pkg/spec.tpl: don't package files we don't have.
+ * autoopts/tpl/texi2mdoc.sh: remove alternation from sed expr
+ * config/misc.def: include libdir with -Wl,-R output
+ * doc/mk-agen-texi.sh: new file renamed from *-in file.
+ It sources config/shdefs instead of being configured
+ * doc/Makefile.am: adjust what gets distributed
+
+2012-05-05 Bruce Korb <bkorb@gnu.org>
+
+ 5.16 release
+
+ * autoopts/test/handler.test: adjustment
+ * autoopts/tpl/optcode.tlib: doxygenate
+ * autoopts/tpl/optmain.tlib: fix doxygen comment
+ * autoopts/tpl/texi2man.sh: handle sed-s that do not do alternation
+ * autoopts/tpl/texi2mdoc.sh: likewise
+ * autoopts/test/defs.in: pass through OBJEXT
+ * autoopts/tpl/usage.tlib: use it to look for a .o file instead of
+ an archive file. --disable-static will not produce such a file.
+ * configure.ac (ENABLE_STATIC): new substitution
+ * autoopts/aoconf.tpl: disable static_libs when disabled
+ * autoopts/test/defs.in: link against libopts*.${OBJEXT}. libopts.a
+ may not get built.
+
+2012-04-29 Bruce Korb <bkorb@gnu.org>
+
+ * autoopts/tpl/getopt.tpl (optionUsage): do not declare optionUsage.
+ * autoopts/tpl/optcode.tlib (usage-proc): likewise
+ * autoopts/tpl/optmain.tlib (doUsageOpt): call usage proc directly,
+ whether it is optionUsage or user specified.
+ (vusage_message): likewise
+ * autoopts/test/handler.test: adjust
+ * doc/autogen-texi.txt (@item usage): doc it properly
+ * autoopts/tpl/cmd-doc.tlib (get-cvt): accept an alternate text arg
+ and use this capability for the exit-desc attribute.
+ * autoopts/tpl/texi2man.sh (bold): add new entries
+ * autoopts/tpl/texi2mdoc.sh: likewise
+
+2012-04-28 Bruce Korb <bkorb@gnu.org>
+
+ * agen5/funcCase.c (mLoad_Select): split function
+ (selection_type_complete): new function
+ * autoopts/tpl/optcode.tlib (optionAlias): remove duplicate def.
+ * autoopts/tpl/opthead.tlib (die): add prototypes for new functions
+ * autoopts/tpl/optmain.tlib (die): add code for die, vdie and fserr.
+
+2012-04-15 Bruce Korb <bkorb@gnu.org>
+
+ * autoopts/tpl/def2pot.tpl: clean up
+ * autoopts/test/doc.test: test pot template, too.
+ * autoopts/tpl/optcode.tlib: "no-xlate = anything" attribute
+ * autoopts/tpl/opthead.tlib: likewise
+ * agen5/opts.def: specify "no-xlate = anything".
+
+2012-04-14 Bruce Korb <bkorb@gnu.org>
+
+ * config/libopts.def (AC_CHECK_HEADERS): check for stdbool, too.
+ * config/misc.def (AC_CHECK_HEADERS): stdbool not needed here now
+ * getdefs/getdefs.c (main): guard chmod() call with HAVE_CHMOD
+ instead of HAVE_FCHMOD
+ * config/bootstrap.local: remove building of fmemopen.c to agen5 dir.
+ * agen5/bootstrap.dir: rebuild fmemopen.c when needed
+ * agen5/mk-stamps.sh: always remove log files on success
+ * autoopts/Makefile.am (libopts_la_LIBADD): include libintl
+ * columns/bootstrap.dir: remove log files on success
+ * mkconfig.sh: Avoid unnecessary work and get VERSION from VERSION file.
+ Do not save the version stamp.
+ * noag-boot.sh: regenerated from mkconfig.sh
+ * autoopts/tpl/cmd-doc.tlib: remove backslash duplication
+ * autoopts/tpl/def2pot.tpl: remove texi-isms from translatable text
+ * autoopts/tpl/optlib.tlib: fix sed expression for removing texi-isms
+ * autoopts/test/doc.test: test doc changes
+
+2012-04-08 Bruce Korb <bkorb@gnu.org>
+
+ * compat/chmod.c: new (no-op) compatibility function for Windows-32
+ * config/libopts.def: check for fchmod, fstat and chmod functions, too.
+ * agen5/agInit.c (initialize): new variation required for Guile 2.0.
+ * autoopts/test/doc.test: new test for man/mdoc/texi templates.
+
+2012-04-01 Bruce Korb <bkorb@gnu.org>
+
+ * autoopts/tpl/agtexi-cmd.tpl: omit texi doc for options with emtpy
+ "doc" clauses.
+ * agen5/bootstrap.dir: remove code used also in "make"
+ * agen5/mk-stamps.sh: removed to here
+ * autoopts/env.c (doPrognameEnv): warning patrol
+ * autoopts/usage.c (set_usage_flags): warning patrol
+ * agen5/autogen.h: new globals for detecting block enclosures for
+ break/continue/return macros
+ * agen5/funcDef.c (mFunc_Define): extract code that invokes "gen_block"
+ to a separate function where long jumps can be handled better
+ (mLoad_Define): indicate that a new template is being loaded so that
+ "return" can function properly.
+ * agen5/funcFor.c (for_by_step): call gen_block wrapper to handle
+ long jump returns
+ (for_each): likewise
+ (mFunc_For): extract some convolutions into new procedures
+ * agen5/funcIf.c (mFunc_While): fake up a for loop context and call
+ the same gen_block wrapper to handle long jumps
+ * agen5/functions.c (mFunc_Break): handle next and continue
+ (call_gen_block): handle long jump returns for looping macros
+ (mFunc_Return): handle "return" for INCLUDE and INVOKE macros
+ (gen_new_block): gen_block wrapper for INCLUDE and INVOKE.
+ (mLoad_Skip): loading procedure for break and continue
+ * agen5/functions.tpl (handler-proc): may now specify the handler to use
+ * agen5/test/debug.test: adjust for new macro numbers
+ * agen5/test/leave.test: test this stuff.
+
+2012-03-31 Bruce Korb <bkorb@gnu.org>
+
+ * agen5/Makefile.am: Remove lists of generated things and derive them
+ from the script that has to know about them: bootstrap.dir
+ * agen5/ag-text.def: make the touchback silent and fix the format numbers
+ * agen5/agDep.c (wrap_up_depends): use the fixed format correctly
+ * agen5/bootstrap.dir: edit Makefile.am, too
+ * agen5/fsm-macro.tlib: use the built-in temp directory
+ * agen5/fsm-trans.tlib: likewise
+ * config/bootstrap.shlib (make_opts) cleanup for dependency generation
+ (make_proto): likewise
+ * doc/auto_gen-tpl.in: remove use of ADDON_MENU
+ * doc/mk-agen-texi-in: stop providing ADDON_MENU
+
+2012-03-18 Bruce Korb <bkorb@gnu.org>
+
+ * agen5/ag-text.def: correct which file is to be removed
+ * agen5/agDep.c: prefer memcpy to strcpy
+ (tidy_dep_file): prefer fchmod to chmod
+ * agen5/expOutput.c (make_writable): obsolete
+ * agen5/expString.c (stringify_for_sh): remove unused parameter
+ * agen5/funcFor.c (call_gen_block): new function to ensure longjmp works
+ * autoopts/test/defs.in (CFLAGS): -Werror may be suffixed. Remove all.
+ (clean_help): no need for "egrep -v" when sed can do the job
+ * autoopts/load.c (add_env_val): no need to fix -Werror here
+ * autoopts/tpl/opt*: remove texi-isms from help text.
+ * autoopts/usage.c (prt_extd_usage): arg types param is not used.
+ (prt_one_vendor): thus, here, too.
+ (prt_vendor_opts): and here as well.
+ * doc/mk-agen-texi-in: -Werror removal needed here, too.
+ * everywhere: warning cleanups & de-camelization
+
+2012-03-11 Bruce Korb <bkorb@gnu.org>
+
+ * agen5/funcCase.c (ag_scm_string_eqv_p): compare booleans, too
+ * autoopts/tpl/agtexi-cmd.tpl: if documentation "flags" are
+ specified, use them for node sectioning for groups of options.
+ * agen5/opts.def: reorganize to use above properly
+ * autoopts/tpl/optlib.tlib: fill "descrip" option attributes to
+ 72 columns.
+
+2012-03-04 Bruce Korb <bkorb@gnu.org>
+
+ * agen5/agDep.c (start_dep_file): handle temp suffix here so it can
+ be done consistently. Also, only list program name in comment once.
+ (tidy_dep_file) check for target == dep file after moving dep file.
+ (wrap_up_depends): emit cleanup rules on request
+ * agen5/ag-text.def (DEP_FILE_CLOBBER_FMT): cleanup format
+ * agen5/*: replace AG_BOOL with stdbool definitions
+ * autoopts/autogen.map (inversion): new char class
+ * autoopts/enum.c (find_name): use it. Set error message format
+ pointer when a too-large number is used for an enum.
+ * autoopts/usage-txt.def (TooLarge): new error message
+ * autoopts/test/keyword.test: test ~0/-1
+ * autoopts/test/vendor.test: adjust for stdbool
+ * autoopts/tpl/cmd-doc.tlib (get-cvt): function for converting
+ texi-isms to man page/mdoc page isms for descrip and doc attributes
+ * autoopts/tpl/optlib.tlib (get-text): function for stripping
+ texi-isms entirely for use in help text.
+ * compat/compat.h (stdbool.h): new accommodation
+ * config/bootstrap.shlib (run_ag): use -MP option
+ * config/misc.def: check stdbool.h header
+ * autoopts/tpl/aginfo.tpl: disable
+ * autoopts/tpl/agman1.tpl: disable
+ * agen5/defLex.c (build_here_str): stop stripping tabs with backslash
+ tab, and skip the backslash, too.
+ * agen5/ag-text.def (DEP_FILE_WRAP_FMT): use it.
+ * everywhere: use global replacement tools to de-camelize many variables.
+
+2012-02-25 Bruce Korb <bkorb@gnu.org>
+
+ 5.15 release
+
+ * autoopts/tpl/optcode.tlib: make sure config header is included
+ before any system headers.
+ * autoopts/tpl/optmain.tlib: remove system header includes
+ * autoopts/tpl/optlib.tlib: remove texi-isms from any "descrip"
+ attributes.
+ * autoopts/tpl/texi2man.sh (command, option): add to bolded text
+ * autoopts/tpl/texi2mdoc.sh: likewise
+ * config/confmacs.tlib (affirmed): new conditional that defaults
+ to disabled instead of enabled.
+ * pkg/libopts/libopts-add.m4: default to *not* installing the
+ external-project-built libopts library
+ * autoopts/numeric.c (optionShowRange): value is long int, not str.
+ * autoopts/usage-txt.def (rangeerr): fix format, too
+
+2012-02-18 Bruce Korb <bkorb@gnu.org>
+
+ * autoopts/test/alias.test: fully test "aliases" attribute.
+ * autoopts/tpl/opt*.t*: allow empty homerc value to enable
+ command line options witout automatically looking up config files.
+ Also, add Doxygen comments to much of the generated code.
+ * autoopts/tpl/strings.tpl: allow the specification of leader and
+ trailer code for the emitted header.
+ * config/misc.def: remove some antiquated testing
+
+2012-02-12 Bruce Korb <bkorb@gnu.org>
+
+ * autoopts/tpl/agtexi-cmd.tpl: cleanups
+ * autoopts/tpl/man2texi.sh: convert \fI to @i and \fB to @var
+ * compat/compat.h: sys/wait.h may not exist. likewise u_int.
+ * config/libopts.def: test for u_int type
+ * doc/auto-opts.tpl: improve debuggability
+ * everywhere: remove all residual "u_int" types.
+
+2012-01-28 Bruce Korb <bkorb@gnu.org>
+
+ * everywhere: redate copyrights
+ * everywhere: use static char const tables where feasible.
+ * autoopts/nested.c (optionLoadNested): deallocate empty result and
+ return NULL when no entries have been found. Set errno to ENOMSG.
+ * add-on/char-mapper: clean up way for defining static scope
+ * autoopts/autogen.map: use defined method for static scoping.
+ (set-separator): new character class
+ * autoopts/ao-strs.def: new file for autoopts strings
+ * ChangeLog.10: give it a hunk of this file
+ * autoopts/tpl/agtexi-cmd.tpl: emit the doc-section text, too.
+
+2011-12-29 Bruce Korb <bkorb@gnu.org>
+
+ 5.14 release
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..6e90e07
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,370 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation,
+Inc.
+
+ Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved. This file is offered as-is,
+without warranty of any kind.
+
+Basic Installation
+==================
+
+ Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package. Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below. The lack of an optional feature in a given package is not
+necessarily a bug. More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+ The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system.
+
+ Running `configure' might take a while. While running, it prints
+ some messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package, generally using the just-built uninstalled binaries.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation. When installing into a prefix owned by root, it is
+ recommended that the package be configured and built as a regular
+ user, and only the `make install' phase executed with root
+ privileges.
+
+ 5. Optionally, type `make installcheck' to repeat any self-tests, but
+ this time using the binaries in their final installed location.
+ This target does not install anything. Running this target as a
+ regular user, particularly if the prior `make install' required
+ root privileges, verifies that the installation completed
+ correctly.
+
+ 6. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+ 7. Often, you can also type `make uninstall' to remove the installed
+ files again. In practice, not all packages have tested that
+ uninstallation works correctly, even though it is required by the
+ GNU Coding Standards.
+
+ 8. Some packages, particularly those that use Automake, provide `make
+ distcheck', which can by used by developers to test that all other
+ targets like `make install' and `make uninstall' work correctly.
+ This target is generally not run by end users.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you can use GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'. This
+is known as a "VPATH" build.
+
+ With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory. After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+ On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor. Like
+this:
+
+ ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CPP="gcc -E" CXXCPP="g++ -E"
+
+ This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+ By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them. In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+ The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+ The first method involves providing an override variable for each
+affected directory. For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'. Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated. The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+ The second method involves providing the `DESTDIR' variable. For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names. The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters. On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+ Some packages offer the ability to configure how verbose the
+execution of `make' will be. For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
+Particular systems
+==================
+
+ On HP-UX, the default C compiler is not ANSI C compatible. If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+ ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+ HP-UX `make' updates targets which have the same time stamps as
+their prerequisites, which makes it generally unusable when shipped
+generated files such as `configure' are involved. Use GNU `make'
+instead.
+
+ On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file. The option `-nodtk' can be used as
+a workaround. If GNU CC is not installed, it is therefore recommended
+to try
+
+ ./configure CC="cc"
+
+and if that doesn't work, try
+
+ ./configure CC="cc -nodtk"
+
+ On Solaris, don't put `/usr/ucb' early in your `PATH'. This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+ On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'. It is recommended to use the following options:
+
+ ./configure --prefix=/boot/common
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on. Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS
+ KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+ Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf limitation. Until the limitation is lifted, you can use
+this workaround:
+
+ CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+ Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+ Print a summary of the options unique to this package's
+ `configure', and exit. The `short' variant lists options used
+ only in the top level, while the `recursive' variant lists options
+ also present in any nested packages.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--prefix=DIR'
+ Use DIR as the installation prefix. *note Installation Names::
+ for more details, including other options available for fine-tuning
+ the installation locations.
+
+`--no-create'
+`-n'
+ Run the configure checks, but stop before creating any output
+ files.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..651ecea
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,91 @@
+## -*- Mode: Makefile -*-
+## Makefile.am --- process this file with automake to produce Makefile.in
+##
+## Time-stamp: "2012-06-10 13:55:27 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ACLOCAL_AMFLAGS = -I config
+
+SUBDIRS = compat snprintfv autoopts agen5
+
+if DO_SHELL_CMDS
+if HAVE_XML_LIB
+SUBDIRS += columns getdefs xml2ag doc pkg
+else
+SUBDIRS += columns getdefs pkg
+endif
+else
+
+## Without shell commands, you cannot build docs or packages and the
+## columns and getdefs commands are unworkable.
+##
+if HAVE_XML_LIB
+SUBDIRS += xml2ag
+endif
+endif
+
+pkgdata_DATA = config/conftest.tpl config/confmacs.tlib config/liboptschk.m4
+misc_extra = \
+ VERSION config/bootstrap \
+ config/bootstrap.local config/bootstrap.shlib \
+ config/ag_macros.m4 config/extensions.m4 \
+ config/gnulib-cache.m4 config/gnulib-comp.m4 \
+ config/libopts.m4 config/liboptschk.m4 \
+ config/snprintfv.m4 config/unlocked-io.m4 \
+ autoopts/parse-duration.c autoopts/parse-duration.h
+EXTRA_DIST = $(misc_extra) $(pkgdata_DATA)
+DISTCLEANFILES = stamp-h
+
+distcleancheck_listfiles = \
+ find -type f -exec 'test -f $(srcdir)/{} || echo {} ;'
+
+configure : VERSION
+
+pkg : package
+package :
+ cd pkg && $(MAKE) $@ pkgtype="$(pkgtype)"
+
+docs : gnudocs doxydocs
+gnudoc : gnudocs
+gnudocs :
+ cd doc && $(MAKE) gnudocs
+
+doxydocs :
+ test -f Doxyfile || cp ~/.Doxyfile ./Doxyfile ; \
+ doxygen
+
+usage-txt.po: gettext
+gettext :
+ cd autoopts && $(MAKE) usage-txt.po
+
+all : config/shdefs
+config/shdefs: config/mk-shdefs
+ $(SHELL) $< $@
+
+if HAVE_XML_LIB
+release : distcheck
+else
+release :
+ echo "Distributions cannot be made with a partial build" >&2
+ exit 1
+endif
+
+.NOTPARALLEL:
+.PHONY: pkg package docs gnudoc gnudocs
+
+## Makefile.am ends here
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..34535cd
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,934 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+@DO_SHELL_CMDS_TRUE@@HAVE_XML_LIB_TRUE@am__append_1 = columns getdefs xml2ag doc pkg
+@DO_SHELL_CMDS_TRUE@@HAVE_XML_LIB_FALSE@am__append_2 = columns getdefs pkg
+@DO_SHELL_CMDS_FALSE@@HAVE_XML_LIB_TRUE@am__append_3 = xml2ag
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/config-h.in \
+ $(top_srcdir)/autoopts/tpl/tpl-config-tlib.in \
+ $(top_srcdir)/config/compile $(top_srcdir)/config/config.guess \
+ $(top_srcdir)/config/config.sub \
+ $(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
+ $(top_srcdir)/config/missing $(top_srcdir)/config/mk-shdefs.in \
+ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
+ THANKS TODO config/compile config/config.guess \
+ config/config.sub config/install-sh config/ltmain.sh \
+ config/missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = autoopts/tpl/tpl-config.tlib config/mk-shdefs
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(pkgdatadir)"
+DATA = $(pkgdata_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ cscope distdir dist dist-all distcheck
+ETAGS = etags
+CTAGS = ctags
+CSCOPE = cscope
+DIST_SUBDIRS = compat snprintfv autoopts agen5 columns getdefs xml2ag \
+ doc pkg
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ if test -d "$(distdir)"; then \
+ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -rf "$(distdir)" \
+ || { sleep 5 && rm -rf "$(distdir)"; }; \
+ else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz
+GZIP_ENV = --best
+DIST_TARGETS = dist-xz dist-gzip
+distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = @AGexe@
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = @CLexe@
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+ACLOCAL_AMFLAGS = -I config
+SUBDIRS = compat snprintfv autoopts agen5 $(am__append_1) \
+ $(am__append_2) $(am__append_3)
+pkgdata_DATA = config/conftest.tpl config/confmacs.tlib config/liboptschk.m4
+misc_extra = \
+ VERSION config/bootstrap \
+ config/bootstrap.local config/bootstrap.shlib \
+ config/ag_macros.m4 config/extensions.m4 \
+ config/gnulib-cache.m4 config/gnulib-comp.m4 \
+ config/libopts.m4 config/liboptschk.m4 \
+ config/snprintfv.m4 config/unlocked-io.m4 \
+ autoopts/parse-duration.c autoopts/parse-duration.h
+
+EXTRA_DIST = $(misc_extra) $(pkgdata_DATA)
+DISTCLEANFILES = stamp-h
+distcleancheck_listfiles = \
+ find -type f -exec 'test -f $(srcdir)/{} || echo {} ;'
+
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+am--refresh: Makefile
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+
+config.h: stamp-h1
+ @if test ! -f $@; then rm -f stamp-h1; else :; fi
+ @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
+
+stamp-h1: $(srcdir)/config-h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config-h.in: $(am__configure_deps)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+autoopts/tpl/tpl-config.tlib: $(top_builddir)/config.status $(top_srcdir)/autoopts/tpl/tpl-config-tlib.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+config/mk-shdefs: $(top_builddir)/config.status $(top_srcdir)/config/mk-shdefs.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool config.lt
+install-pkgdataDATA: $(pkgdata_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgdatadir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \
+ done
+
+uninstall-pkgdataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+cscopelist-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config-h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config-h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config-h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) config-h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscope: cscope.files
+ test ! -s cscope.files \
+ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+
+clean-cscope:
+ -rm -f cscope.files
+
+cscope.files: clean-cscope cscopelist-recursive cscopelist
+
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
+
+distdir: $(DISTFILES)
+ @case `sed 15q $(srcdir)/NEWS` in \
+ *"$(VERSION)"*) : ;; \
+ *) \
+ echo "NEWS not updated; not releasing" 1>&2; \
+ exit 1;; \
+ esac
+ $(am__remove_distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__post_remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+ $(am__post_remove_distdir)
+
+dist-lzip: distdir
+ tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+ $(am__post_remove_distdir)
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+ $(am__post_remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__post_remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__post_remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__post_remove_distdir)
+
+dist dist-all:
+ $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+ $(am__post_remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lz*) \
+ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod u+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(am__post_remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @test -n '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: trying to run $@ with an empty' \
+ '$$(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ $(am__cd) '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA) config.h
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(pkgdatadir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr \
+ distclean-libtool distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-pkgdataDATA
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-pkgdataDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
+ cscopelist-recursive ctags-recursive install-am install-strip \
+ tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am am--refresh check check-am clean clean-cscope \
+ clean-generic clean-libtool cscope cscopelist \
+ cscopelist-recursive ctags ctags-recursive dist dist-all \
+ dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ dist-xz \
+ dist-zip distcheck distclean distclean-generic distclean-hdr \
+ distclean-libtool distclean-tags distcleancheck distdir \
+ distuninstallcheck dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-pkgdataDATA install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-pkgdataDATA
+
+
+configure : VERSION
+
+pkg : package
+package :
+ cd pkg && $(MAKE) $@ pkgtype="$(pkgtype)"
+
+docs : gnudocs doxydocs
+gnudoc : gnudocs
+gnudocs :
+ cd doc && $(MAKE) gnudocs
+
+doxydocs :
+ test -f Doxyfile || cp ~/.Doxyfile ./Doxyfile ; \
+ doxygen
+
+usage-txt.po: gettext
+gettext :
+ cd autoopts && $(MAKE) usage-txt.po
+
+all : config/shdefs
+config/shdefs: config/mk-shdefs
+ $(SHELL) $< $@
+
+@HAVE_XML_LIB_TRUE@release : distcheck
+@HAVE_XML_LIB_FALSE@release :
+@HAVE_XML_LIB_FALSE@ echo "Distributions cannot be made with a partial build" >&2
+@HAVE_XML_LIB_FALSE@ exit 1
+
+.NOTPARALLEL:
+.PHONY: pkg package docs gnudoc gnudocs
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..e7eefd1
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,37 @@
+New in 5.16.2 - August 2012
+
+* Coverity cleanups
+* evade Guile issue on BSD platform.
+* avoid emitting non-error messages to stderr
+
+New in 5.16 May 2012
+
+* AutoGen now supports the "-MP" option. The "phony" rule generated
+ in the make dependency file will remove all generated files, except
+ for the dependency file itself. Please see the docs for "-MF".
+
+* "break", "continue", and "return" macros implemented.
+ "return" works in included templates and invoked macros (user defined
+ macros). "break" and "continue" work within "for" and "while"
+ loops, though they cannot be used to leave invoked or included
+ templates.
+
+* texi documentation generation has been much improved.
+ Please see the "Option Sectioning Comment" documentation.
+
+* configuring with --disable-static should now pass make check
+
+* AutoOpts supports a "die-code" attribute. It will generate code
+ for "die", "diev" and "fserr" functions that will print a farewell
+ message and die.
+
+* a keyword option value of "-1" or "~0" now means "largest value".
+
+* much improved .texi documentation templates.
+
+* de-tabbed "here strings" may have output lines prefixed with tabs
+ by backslash escaping the first tab to output.
+
+* -Werror may be appended by "=warn-group". That is accommodated now.
+
+* many warning fixes and CamelCase name removals
diff --git a/README b/README
new file mode 100644
index 0000000..a2ba45e
--- /dev/null
+++ b/README
@@ -0,0 +1,115 @@
+This is AutoGen, an automated text file generator. It was inspired out of
+frustration and hassle with maintaining syncronization between option flag
+lists, global variables and usage information. The desire for more than
+#define macros came about when it became apparent that macros alone were
+insufficient for reducing the maintenance into a single option list. The
+impetus to actually start something finally came when I had to maintain a
+large callout procedure table and associated lookup tables.
+
+Rev 1 of this utility was a set of #define macro expansions.
+Rev 2 was a shell script that sort-of did a prototype.
+ Much better than just #defines, but still clearly lacking.
+Rev 3 had a very kludgy macro definition syntax.
+Rev 4 a reworking and simplification of the declarations
+Rev 5 the addition of Guile expression processing
+
+Mailing lists can be found on SourceForge:
+
+ autogen-users@lists.sourceforge.net
+
+
+*** AutoGen requires: ***
+
+1. POSIX regular expression library. If not available by default, use
+ the --with-regex-* options to specify how to find, use and link to it.
+2. an ANSI C compiler
+3. The Guile version of a Scheme processing language.
+
+
+*** Installation note: ***
+
+AutoGen does *NOT* contain any compiled-in configuration information.
+Therefore, in order to use the templates that come bundled with it,
+you must tell AutoGen how to find those templates when you build
+applications that use those templates.
+
+1. by doing nothing. If you do not alter the default data directory,
+ AutoGen will search for templates in the directory ../share/autogen,
+ relative to the executable directory. That should generally work.
+
+2. You can tell AutoGen where to look with an environment variable:
+
+ export AUTOGEN_TEMPL_DIR=$prefix/share/autogen
+
+3. You can use an RC file:
+
+ autogen -L $prefix/share/autogen --save=$HOME/.autogenrc
+
+4. If you have an old Guile library, you will find that its error reporting
+ does not work so well. Consequently, you will see "make check" failures
+ in the output text where you would expect to find file name and line
+ number references for the invalid input. Please upgrade your Guile lib.
+
+5. You can build and install AutoGen, ensuring you have the
+ automake/autoconf/libtool-s needed, and then editing
+ agen5/opts.def thus:
+
+ echo "homerc = $prefix/share/autogen;" >> agen5/opts.def
+
+and then rebuilding AutoGen. However, if you do this latter
+"fix", you will have an immobile product. I hate that, others
+like it. It is, however, up to you.
+
+
+*** Build note: ***
+
+Sometimes, configure believes it has done a good job when it really hasn't.
+It is possible to configure a system in such a way that the Guile headers and
+libguile are linked against correctly, but the loader cannot find
+libguile.so.xxx. This is because GCC will silently find the library for
+linking, but not set the library dependencies correctly. The consequence is
+that the configure script believes that standard links will produce working
+executables. It won't. The simplest solution is:
+
+ .../configure --disable-shared
+
+the best solution is to examine the output of ``guile-config link'',
+duplicate the ``-L/path/to/lib'' argument, but changing the "-L" to
+"-R" or "-Wl,-rpath," or "-rpath" or whatever it happens to be that
+works for your platform, and hand that off to configure as the argument
+to ``--with-libguile-link''. "libtool" won't fix it and it's too hard
+for me. Sorry. Anyway, for example, assume:
+
+ guile-config link
+
+produces:
+
+ -L/opt/sfw/lib -lguile -lm
+
+now run configure as follows:
+
+ .../configure \
+ --with-libguile-link='-L/opt/sfw/lib -lguile -lm -R/opt/sfw/lib'
+
+Isn't that special?
+
+
+*** Bootstrap note: ***
+
+I have some private tools referenced in the various bootstrap scripts.
+Unless you have these tools, bootstrap won't work for you. I intend
+to fix this as time permits. Meanwhile, there is also a tarball in CVS
+of all the bootstrap-generated files:
+ noag-boot.sh
+
+*** Licensing: ***
+
+ autogen is under GPL, but that does not cause the output produced by
+ autogen to be under GPL. The reason is that the output contains next to
+ nothing that comes directly from autogen's source code. Thus, the output
+ is not a "derivative work" of autogen (in the sense of U.S.@: copyright
+ law). The output is primarily a derivative of the input templates.
+
+ On the other hand, the output produced by autogen contains essentially all
+ of the input template. Therefore the output is under the same license,
+ with the same copyright holder, as the input that was passed to autogen.
diff --git a/THANKS b/THANKS
new file mode 100644
index 0000000..cbfe214
--- /dev/null
+++ b/THANKS
@@ -0,0 +1,15 @@
+AutoGen would not be what it is without the invaluable help of
+many people:
+
+Everybody who was kind enough to spend time testing it,
+using it with the GCC fixincludes and reporting bugs.
+
+The following people made especially gracious contributions of their
+time and energy in helping to track down bugs, port to new systems,
+and generally assist in the maintainership process:
+
+Gary V. Vaughan <gary@gnu.org>
+Robert Lipe <robertlipe@usa.net>
+Alexandre Oliva <oliva@dcc.unicamp.br>
+James R. Van Zandt <jrv@vanzandt.mv.com>
+Thomas Steudten <Steudten@users.sourceforge.net>
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..1140ae8
--- /dev/null
+++ b/TODO
@@ -0,0 +1,5 @@
+# -*- Mode: Outline -*-
+
+* It should be possible to adjust AutoGen to use xpath naming.
+ http://www.w3.org/TR/xpath
+ http://www.w3schools.com/xpath/xpath_syntax.asp
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..6064ab5
--- /dev/null
+++ b/VERSION
@@ -0,0 +1,75 @@
+#! /bin/echo this_should_be_sourced
+# -*- Mode: sh -*-
+# VERSION --- Set version info for GNU-ish tool use
+#
+# Time-stamp: "2012-08-11 08:31:30 bkorb"
+
+MAINTAINER='Bruce Korb <bkorb@gnu.org>'
+
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AG_MAJOR_VERSION=5
+AG_MINOR_VERSION=16
+AG_REVISION=$AG_MAJOR_VERSION.$AG_MINOR_VERSION
+AG_PATCHLEVEL=".2"
+AG_VERSION=$AG_REVISION$AG_PATCHLEVEL
+
+# Making releases:
+# AG_PATCHLEVEL=""
+# AG_MINOR_VERSION += 1 (OR AG_MINOR_VERSION = 0 && AG_MAJOR_VERSION += 1)
+#
+# AutoOpts versioning:
+#
+# AO_CURRENT represents the number of visible changes to the interface
+# AO_REVISION represents the number of times the library has been
+# modified with an unchanged interface.
+# AO_AGE represents the number of older revisions the current library
+# is capable of handling.
+#
+AO_LIBRARY=libopts.la
+AO_CURRENT=36
+AO_REVISION=5
+AO_AGE=11
+
+# For automake
+#
+VERSION=${AG_VERSION}
+PACKAGE='GNU AutoGen'
+EADDR=autogen-users@lists.sourceforge.net
+
+# Display version numbers banner for my sanity!
+#
+AO_SOVERS=${AO_CURRENT}:${AO_REVISION}:${AO_AGE}
+AO_SONAME=${AO_LIBRARY}-${AO_SOVERS}
+w=`expr \( ${COLUMNS:-80} - 1 \) / 2`
+h=`expr $w \* 2`
+h=`printf "*%${h}s" '' | sed 's/ /-*/g'`
+ag=`echo AUTOGEN | sed 's/\(.\)/\1 /g;s/ *$//'`
+ag_off=`printf "$ag"|wc -c`
+ag_off=`expr $w - \( $ag_off / 2 \)`
+ag=`printf "%${ag_off}s${ag}" ""`
+
+cat <<EOF
+$h
+
+${ag}
+
+`printf "%-${w}s %${w}s\n" "$PACKAGE-$VERSION" "${AO_SONAME}" || :`
+$h
+EOF
+
+# VERSION ends here
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..e409992
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,1056 @@
+# generated automatically by aclocal 1.12.2 -*- Autoconf -*-
+
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
+
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.12'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version. Point them to the right macro.
+m4_if([$1], [1.12.2], [],
+ [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.12.2])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is '.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 10
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 17
+
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
+ [$1], [CXX], [depcc="$CXX" am_compiler_list=],
+ [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
+ [$1], [UPC], [depcc="$UPC" am_compiler_list=],
+ [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+ [--enable-dependency-tracking],
+ [do not reject slow dependency extractors])
+AS_HELP_STRING(
+ [--disable-dependency-tracking],
+ [speeds up one-time build])])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named 'Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running 'make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each '.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+AC_DEFUN([AM_WITH_DMALLOC],
+[AC_MSG_CHECKING([if malloc debugging is wanted])
+AC_ARG_WITH([dmalloc],
+[AS_HELP_STRING([--with-dmalloc],
+ [use dmalloc, as in http://www.dmalloc.com])],
+[if test "$withval" = yes; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([WITH_DMALLOC], [1],
+ [Define if using the dmalloc debugging malloc package])
+ LIBS="$LIBS -ldmalloc"
+ LDFLAGS="$LDFLAGS -g"
+else
+ AC_MSG_RESULT([no])
+fi], [AC_MSG_RESULT([no])])
+])
+
+AU_DEFUN([fp_WITH_DMALLOC], [AM_WITH_DMALLOC])
+
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 19
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.62])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[AC_DIAGNOSE([obsolete],
+[$0: two- and three-arguments forms are deprecated. For more info, see:
+http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(
+ m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+ [ok:ok],,
+ [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES([CC])],
+ [m4_define([AC_PROG_CC],
+ m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES([CXX])],
+ [m4_define([AC_PROG_CXX],
+ m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_AM_DEPENDENCIES([OBJC])],
+ [m4_define([AC_PROG_OBJC],
+ m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+dnl Support for Objective C++ was only introduced in Autoconf 2.65,
+dnl but we still cater to Autoconf 2.62.
+m4_ifdef([AC_PROG_OBJCXX],
+[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+ [_AM_DEPENDENCIES([OBJCXX])],
+ [m4_define([AC_PROG_OBJCXX],
+ m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+AC_SUBST([install_sh])])
+
+# Copyright (C) 2003-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# AM_PROG_CC_C_O
+# --------------
+# Like AC_PROG_CC_C_O, but changed for automake.
+AC_DEFUN([AM_PROG_CC_C_O],
+[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+dnl Make sure AC_PROG_CC is never called again, or it will override our
+dnl setting of CC.
+m4_define([AC_PROG_CC],
+ [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN(['missing' script is too old or missing])
+fi
+])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# --------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+ alias in your environment])
+ fi
+ if test "$[2]" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+ [AC_MSG_CHECKING([that generated files are newer than configure])
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor 'install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in "make install-strip", and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+m4_if([$1], [v7],
+ [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of '-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([config/ag_macros.m4])
+m4_include([config/extensions.m4])
+m4_include([config/libopts.m4])
+m4_include([config/libtool.m4])
+m4_include([config/ltoptions.m4])
+m4_include([config/ltsugar.m4])
+m4_include([config/ltversion.m4])
+m4_include([config/lt~obsolete.m4])
+m4_include([config/onceonly.m4])
+m4_include([config/snprintfv.m4])
+m4_include([config/unlocked-io.m4])
diff --git a/agen5/Makefile.am b/agen5/Makefile.am
new file mode 100644
index 0000000..4adc1da
--- /dev/null
+++ b/agen5/Makefile.am
@@ -0,0 +1,174 @@
+## -*- Mode: Makefile -*-
+##
+## Makefile.am -- process this file with automake to produce Makefile.in
+##
+## Time-stamp: "2012-04-01 05:21:26 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+SUBDIRS = test
+INCLUDES = @INCLIST@
+FSMTPL = fsm.tpl fsm-macro.tlib fsm-trans.tlib
+TEMPLATES = directive.tpl snarf.tpl $(FSMTPL)
+DEFINITIONS = cgi.def opts.def pseudo.def defParse.def
+GEN_CSRC = opts.h directive.h expr.ini expr.h proto.h pseudo-fsm.h
+pkgdata_DATA = $(FSMTPL)
+man_MANS = autogen.1
+DISTCLEANFILES = stamp-* ag.c
+bin_PROGRAMS = autogen
+
+# The list of source files with AutoGen functions
+#
+FUNCLIST = \
+ funcCase.c funcDef.c funcEval.c funcFor.c funcIf.c functions.c
+
+# The list of source files with Guile expression functions defined
+#
+EXPRLIST = \
+ expExtract.c expFormat.c expGperf.c expGuile.c expMake.c \
+ expOutput.c expPrint.c expState.c expString.c agShell.c \
+ $(FUNCLIST)
+
+FSMLIST = cgi-fsm.c defParse-fsm.c
+csrc = \
+ autogen.c ag-text.c $(FSMLIST) $(EXPRLIST) agCgi.c \
+ agDep.c agInit.c agUtils.c defDirect.c defFind.c \
+ defLex.c defLoad.c fmemopen.c loadPseudo.c opts.c \
+ scmStrings.c tpLoad.c tpParse.c tpProcess.c
+
+hsrc = ag-text.h autogen.h defParse-fsm.h functions.h cgi-fsm.h guile-iface.h
+
+EXTRA_DIST = $(csrc) $(hsrc) $(DEFINITIONS) $(TEMPLATES) $(man_MANS) \
+ defParse.x bootstrap.dir schemedef.scm \
+ guile-iface.def guile-iface.tpl \
+ invoke-autogen.texi mk-stamps.sh
+
+LO_LIB = $(top_builddir)/autoopts/libopts.la
+SNV_LIB = $(top_builddir)/snprintfv/libsnprintfv.la
+
+nodist_autogen_SOURCES = ag.c
+autogen_SOURCES = $(GEN_CSRC)
+autogen_LDADD = $(LO_LIB) $(SNV_LIB) $(LIBGUILE_LIBS)
+autogen_LDFLAGS = $(DYNAMIC_AG)
+autogen_CFLAGS = $(LIBGUILE_CFLAGS)
+
+AM_YFLAGS = -d
+
+ag.c : Makefile
+ exec > $@ ; \
+ echo '#undef PKGDATADIR' ; \
+ echo '#define PKGDATADIR "$(pkgdatadir)"' ; \
+ mk=`set -- $(MAKE) ; which $$1` ; \
+ echo 'static char const zMakeProg[] = "'$$mk'";' ; \
+ echo ; echo '#define DEFINING' ; \
+ echo '#include "autoopts/project.h"' ; \
+ echo '#include "autoopts/ag-char-map.h"' ; \
+ echo '#include "autogen.h"' ; \
+ for f in $(csrc) ; do echo "#include \"$$f\"" ; done
+
+STAMPENV = top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) \
+ srcdir=$(srcdir) AGexe=$(AGexe) GDexe=$(GDexe) CLexe=$(CLexe) \
+ DEPDIR="$(DEPDIR)"
+
+MAKE_STAMP = $(STAMPENV) $(POSIX_SHELL) $(srcdir)/bootstrap.dir $@
+
+../snprintfv/snprintfv.h :
+ @if [ ! -f ../snprintfv/snprintfv.h ] ; then cd ../snprintfv ; \
+ ln -s $(top_srcdir)/snprintfv/snprintfv/snprintfv.h . ; fi
+
+../snprintfv/libsnprintfv.la :
+ cd ../snprintfv ; $(MAKE) libsnprintfv.la
+
+.NOTPARALLEL:
+
+# start-generated-text
+
+list_stamps = \
+ stamp-opts stamp-proto stamp-parse stamp-cgi \
+ stamp-pseudo stamp-exprini stamp-directive stamp-texi \
+ stamp-ag_text stamp-fmem stamp-man stamp-func \
+ stamp-gver
+if AMDEP
+@am__include@ @am__quote@./$(DEPDIR)/stamp-opts.d@am__quote@
+@am__include@ @am__quote@./$(DEPDIR)/stamp-proto.d@am__quote@
+@am__include@ @am__quote@./$(DEPDIR)/stamp-parse.d@am__quote@
+@am__include@ @am__quote@./$(DEPDIR)/stamp-cgi.d@am__quote@
+@am__include@ @am__quote@./$(DEPDIR)/stamp-pseudo.d@am__quote@
+@am__include@ @am__quote@./$(DEPDIR)/stamp-exprini.d@am__quote@
+@am__include@ @am__quote@./$(DEPDIR)/stamp-directive.d@am__quote@
+@am__include@ @am__quote@./$(DEPDIR)/stamp-texi.d@am__quote@
+@am__include@ @am__quote@./$(DEPDIR)/stamp-ag_text.d@am__quote@
+@am__include@ @am__quote@./$(DEPDIR)/stamp-fmem.d@am__quote@
+@am__include@ @am__quote@./$(DEPDIR)/stamp-man.d@am__quote@
+@am__include@ @am__quote@./$(DEPDIR)/stamp-func.d@am__quote@
+@am__include@ @am__quote@./$(DEPDIR)/stamp-gver.d@am__quote@
+endif
+
+stamp-opts:
+ @target="$(AUTOGEN_stamp_opts_TList)" \
+ $(MAKE_STAMP)
+
+stamp-proto:
+ @target="$(AUTOGEN_stamp_proto_TList)" \
+ $(MAKE_STAMP)
+
+stamp-parse:
+ @target="$(AUTOGEN_stamp_parse_TList)" \
+ $(MAKE_STAMP)
+
+stamp-cgi:
+ @target="$(AUTOGEN_stamp_cgi_TList)" \
+ $(MAKE_STAMP)
+
+stamp-pseudo:
+ @target="$(AUTOGEN_stamp_pseudo_TList)" \
+ $(MAKE_STAMP)
+
+stamp-exprini:
+ @target="$(AUTOGEN_stamp_exprini_TList)" \
+ $(MAKE_STAMP)
+
+stamp-directive:
+ @target="$(AUTOGEN_stamp_directive_TList)" \
+ $(MAKE_STAMP)
+
+stamp-texi:
+ @target="$(AUTOGEN_stamp_texi_TList)" \
+ $(MAKE_STAMP)
+
+stamp-ag_text:
+ @target="$(AUTOGEN_stamp_ag_text_TList)" \
+ $(MAKE_STAMP)
+
+stamp-fmem:
+ @target="$(AUTOGEN_stamp_fmem_TList)" \
+ $(MAKE_STAMP)
+
+stamp-man:
+ @target="$(AUTOGEN_stamp_man_TList)" \
+ $(MAKE_STAMP)
+
+stamp-func:
+ @target="$(AUTOGEN_stamp_func_TList)" \
+ $(MAKE_STAMP)
+
+stamp-gver:
+ @target="$(AUTOGEN_stamp_gver_TList)" \
+ $(MAKE_STAMP)
+
+# end-generated-text
+# end of Makefile.am
diff --git a/agen5/Makefile.in b/agen5/Makefile.in
new file mode 100644
index 0000000..9070217
--- /dev/null
+++ b/agen5/Makefile.in
@@ -0,0 +1,1013 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+bin_PROGRAMS = autogen$(EXEEXT)
+subdir = agen5
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \
+ "$(DESTDIR)$(pkgdatadir)"
+PROGRAMS = $(bin_PROGRAMS)
+am__objects_1 =
+am_autogen_OBJECTS = $(am__objects_1)
+nodist_autogen_OBJECTS = autogen-ag.$(OBJEXT)
+autogen_OBJECTS = $(am_autogen_OBJECTS) $(nodist_autogen_OBJECTS)
+am__DEPENDENCIES_1 =
+autogen_DEPENDENCIES = $(LO_LIB) $(SNV_LIB) $(am__DEPENDENCIES_1)
+autogen_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(autogen_CFLAGS) $(CFLAGS) \
+ $(autogen_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(autogen_SOURCES) $(nodist_autogen_SOURCES)
+DIST_SOURCES = $(autogen_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+DATA = $(pkgdata_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = @AGexe@
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = @CLexe@
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = test
+INCLUDES = @INCLIST@
+FSMTPL = fsm.tpl fsm-macro.tlib fsm-trans.tlib
+TEMPLATES = directive.tpl snarf.tpl $(FSMTPL)
+DEFINITIONS = cgi.def opts.def pseudo.def defParse.def
+GEN_CSRC = opts.h directive.h expr.ini expr.h proto.h pseudo-fsm.h
+pkgdata_DATA = $(FSMTPL)
+man_MANS = autogen.1
+DISTCLEANFILES = stamp-* ag.c
+
+# The list of source files with AutoGen functions
+#
+FUNCLIST = \
+ funcCase.c funcDef.c funcEval.c funcFor.c funcIf.c functions.c
+
+
+# The list of source files with Guile expression functions defined
+#
+EXPRLIST = \
+ expExtract.c expFormat.c expGperf.c expGuile.c expMake.c \
+ expOutput.c expPrint.c expState.c expString.c agShell.c \
+ $(FUNCLIST)
+
+FSMLIST = cgi-fsm.c defParse-fsm.c
+csrc = \
+ autogen.c ag-text.c $(FSMLIST) $(EXPRLIST) agCgi.c \
+ agDep.c agInit.c agUtils.c defDirect.c defFind.c \
+ defLex.c defLoad.c fmemopen.c loadPseudo.c opts.c \
+ scmStrings.c tpLoad.c tpParse.c tpProcess.c
+
+hsrc = ag-text.h autogen.h defParse-fsm.h functions.h cgi-fsm.h guile-iface.h
+EXTRA_DIST = $(csrc) $(hsrc) $(DEFINITIONS) $(TEMPLATES) $(man_MANS) \
+ defParse.x bootstrap.dir schemedef.scm \
+ guile-iface.def guile-iface.tpl \
+ invoke-autogen.texi mk-stamps.sh
+
+LO_LIB = $(top_builddir)/autoopts/libopts.la
+SNV_LIB = $(top_builddir)/snprintfv/libsnprintfv.la
+nodist_autogen_SOURCES = ag.c
+autogen_SOURCES = $(GEN_CSRC)
+autogen_LDADD = $(LO_LIB) $(SNV_LIB) $(LIBGUILE_LIBS)
+autogen_LDFLAGS = $(DYNAMIC_AG)
+autogen_CFLAGS = $(LIBGUILE_CFLAGS)
+AM_YFLAGS = -d
+STAMPENV = top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) \
+ srcdir=$(srcdir) AGexe=$(AGexe) GDexe=$(GDexe) CLexe=$(CLexe) \
+ DEPDIR="$(DEPDIR)"
+
+MAKE_STAMP = $(STAMPENV) $(POSIX_SHELL) $(srcdir)/bootstrap.dir $@
+
+# start-generated-text
+list_stamps = \
+ stamp-opts stamp-proto stamp-parse stamp-cgi \
+ stamp-pseudo stamp-exprini stamp-directive stamp-texi \
+ stamp-ag_text stamp-fmem stamp-man stamp-func \
+ stamp-gver
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu agen5/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu agen5/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+autogen$(EXEEXT): $(autogen_OBJECTS) $(autogen_DEPENDENCIES) $(EXTRA_autogen_DEPENDENCIES)
+ @rm -f autogen$(EXEEXT)
+ $(autogen_LINK) $(autogen_OBJECTS) $(autogen_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/autogen-ag.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+autogen-ag.o: ag.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(autogen_CFLAGS) $(CFLAGS) -MT autogen-ag.o -MD -MP -MF $(DEPDIR)/autogen-ag.Tpo -c -o autogen-ag.o `test -f 'ag.c' || echo '$(srcdir)/'`ag.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/autogen-ag.Tpo $(DEPDIR)/autogen-ag.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ag.c' object='autogen-ag.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(autogen_CFLAGS) $(CFLAGS) -c -o autogen-ag.o `test -f 'ag.c' || echo '$(srcdir)/'`ag.c
+
+autogen-ag.obj: ag.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(autogen_CFLAGS) $(CFLAGS) -MT autogen-ag.obj -MD -MP -MF $(DEPDIR)/autogen-ag.Tpo -c -o autogen-ag.obj `if test -f 'ag.c'; then $(CYGPATH_W) 'ag.c'; else $(CYGPATH_W) '$(srcdir)/ag.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/autogen-ag.Tpo $(DEPDIR)/autogen-ag.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ag.c' object='autogen-ag.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(autogen_CFLAGS) $(CFLAGS) -c -o autogen-ag.obj `if test -f 'ag.c'; then $(CYGPATH_W) 'ag.c'; else $(CYGPATH_W) '$(srcdir)/ag.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-man1: $(man_MANS)
+ @$(NORMAL_INSTALL)
+ @list1=''; \
+ list2='$(man_MANS)'; \
+ test -n "$(man1dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.1[a-z]*$$/p'; \
+ fi; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man1dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.1[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+install-pkgdataDATA: $(pkgdata_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgdatadir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \
+ done
+
+uninstall-pkgdataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+cscopelist-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @list='$(MANS)'; if test -n "$$list"; then \
+ list=`for p in $$list; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+ if test -n "$$list" && \
+ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+ echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \
+ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
+ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+ echo " typically 'make maintainer-clean' will remove them" >&2; \
+ exit 1; \
+ else :; fi; \
+ else :; fi
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(PROGRAMS) $(MANS) $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(pkgdatadir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-man install-pkgdataDATA
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man: install-man1
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-man \
+ uninstall-pkgdataDATA
+
+uninstall-man: uninstall-man1
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \
+ cscopelist-recursive ctags-recursive install-am install-strip \
+ tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool cscopelist cscopelist-recursive \
+ ctags ctags-recursive distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-man1 install-pdf install-pdf-am install-pkgdataDATA \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-man uninstall-man1 \
+ uninstall-pkgdataDATA
+
+
+ag.c : Makefile
+ exec > $@ ; \
+ echo '#undef PKGDATADIR' ; \
+ echo '#define PKGDATADIR "$(pkgdatadir)"' ; \
+ mk=`set -- $(MAKE) ; which $$1` ; \
+ echo 'static char const zMakeProg[] = "'$$mk'";' ; \
+ echo ; echo '#define DEFINING' ; \
+ echo '#include "autoopts/project.h"' ; \
+ echo '#include "autoopts/ag-char-map.h"' ; \
+ echo '#include "autogen.h"' ; \
+ for f in $(csrc) ; do echo "#include \"$$f\"" ; done
+
+../snprintfv/snprintfv.h :
+ @if [ ! -f ../snprintfv/snprintfv.h ] ; then cd ../snprintfv ; \
+ ln -s $(top_srcdir)/snprintfv/snprintfv/snprintfv.h . ; fi
+
+../snprintfv/libsnprintfv.la :
+ cd ../snprintfv ; $(MAKE) libsnprintfv.la
+
+.NOTPARALLEL:
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-opts.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-proto.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-parse.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-cgi.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-pseudo.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-exprini.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-directive.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-texi.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-ag_text.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-fmem.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-man.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-func.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-gver.d@am__quote@
+
+stamp-opts:
+ @target="$(AUTOGEN_stamp_opts_TList)" \
+ $(MAKE_STAMP)
+
+stamp-proto:
+ @target="$(AUTOGEN_stamp_proto_TList)" \
+ $(MAKE_STAMP)
+
+stamp-parse:
+ @target="$(AUTOGEN_stamp_parse_TList)" \
+ $(MAKE_STAMP)
+
+stamp-cgi:
+ @target="$(AUTOGEN_stamp_cgi_TList)" \
+ $(MAKE_STAMP)
+
+stamp-pseudo:
+ @target="$(AUTOGEN_stamp_pseudo_TList)" \
+ $(MAKE_STAMP)
+
+stamp-exprini:
+ @target="$(AUTOGEN_stamp_exprini_TList)" \
+ $(MAKE_STAMP)
+
+stamp-directive:
+ @target="$(AUTOGEN_stamp_directive_TList)" \
+ $(MAKE_STAMP)
+
+stamp-texi:
+ @target="$(AUTOGEN_stamp_texi_TList)" \
+ $(MAKE_STAMP)
+
+stamp-ag_text:
+ @target="$(AUTOGEN_stamp_ag_text_TList)" \
+ $(MAKE_STAMP)
+
+stamp-fmem:
+ @target="$(AUTOGEN_stamp_fmem_TList)" \
+ $(MAKE_STAMP)
+
+stamp-man:
+ @target="$(AUTOGEN_stamp_man_TList)" \
+ $(MAKE_STAMP)
+
+stamp-func:
+ @target="$(AUTOGEN_stamp_func_TList)" \
+ $(MAKE_STAMP)
+
+stamp-gver:
+ @target="$(AUTOGEN_stamp_gver_TList)" \
+ $(MAKE_STAMP)
+
+# end-generated-text
+# end of Makefile.am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/agen5/ag-text.c b/agen5/ag-text.c
new file mode 100644
index 0000000..b157ad4
--- /dev/null
+++ b/agen5/ag-text.c
@@ -0,0 +1,736 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (ag-text.c)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:41 AM by AutoGen 5.16.2pre7
+ * From the definitions /old-home/bkorb/ag/ag/agen5/ag-text.def
+ * and the template file strings
+ *
+ * Copyright (C) 2011-2012 Bruce Korb, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the
+ * Modified (3 clause) Berkeley Software Distribution License
+ * <http://www.xfree86.org/3.3.6/COPYRIGHT2.html>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name ``Bruce Korb'' nor the name of any other
+ * contributor may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * strings IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bruce Korb OR ANY OTHER CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "ag-text.h"
+
+char const ag_text_strtable[15696] =
+/* 0 */ "ag-text.c\0"
+/* 10 */ "%s__\0"
+/* 15 */ "%s=1\0"
+/* 20 */ "ABEND-ing in %s state\n\0"
+/* 43 */ "processing template %s\n"
+ " on line %d\n"
+ " for function %s (%d)\n\0"
+/* 118 */ "ag-fprintf: 'port' is invalid\0"
+/* 148 */ "AUTOGEN_MAKE_DEP\0"
+/* 165 */ "autogen5\0"
+/* 174 */ "AutoGen aborting on signal %d (%s) in state %s\n\0"
+/* 222 */ "Scheme definition expression does not yield string:\n\0"
+/* 275 */ "Scheme Computed Definitions\0"
+/* 303 */ "(alist->autogen-def %s)\0"
+/* 327 */ "could not allocate for or formatting failed on:\n"
+ "%s\0"
+/* 378 */ "asprintfv returned 0x%08X\n\0"
+/* 405 */ "%s Error: Invalid input char '%c' in %s on line %d\n\0"
+/* 457 */ "Cannot %s from outside a loop\0"
+/* 487 */ "Could not resolve macro name: ``%s''\0"
+/* 524 */ "??? indecipherable error message ???\0"
+/* 561 */ "Ill formed name ``%s'' in %s line %d\n\0"
+/* 599 */ "Invalid regular expression: error %d (%s):\n"
+ "%s\0"
+/* 646 */ "** BOGUS **\0"
+/* 658 */ "break\0"
+/* 664 */ "%ld\0"
+/* 668 */ "fserr %d: cannot %s %s: %s\n\0"
+/* 697 */ "duplicate make target\0"
+/* 719 */ "unknown dependency type: %s\0"
+/* 748 */ "Content-type: text/plain\n\n"
+ "AutoGen form processing error:\n\0"
+/* 806 */ "CGI parsing error: %s\0"
+/* 829 */ "/tmp/cgi-stderr-XXXXXX\0"
+/* 852 */ "CLOSING SHELL SERVER - command failure:\n"
+ "\t%s\n\0"
+/* 897 */ "Bad regular expression\0"
+/* 920 */ "continue\0"
+/* 929 */ "\\n\"\n"
+ " \"\0"
+/* 942 */ "%s Error: %s in %s on line %d\n\0"
+/* 974 */ "from %s line %d\0"
+/* 990 */ "DEFINITIONS %s in %s line %d for %s:\n"
+ "\t%s\n\0"
+/* 1032 */ "block\0"
+/* 1038 */ "INVALID\0"
+/* 1046 */ "text\0"
+/* 1051 */ "unknown\0"
+/* 1059 */ " \\\n\0"
+/* 1063 */ "%s_%s\0"
+/* 1069 */ "\n"
+ ".PHONY : clean-%1$s\n\n"
+ "clean-%1$s :\n"
+ "\trm -f %3$s $(%2$s_TList)\n"
+ "\t@-touch -t 199912312359 %1$s\n\0"
+/* 1161 */ "\n"
+ "%2$s : $(%1$s_SList)\n\n"
+ "$(%1$s_TList) : %2$s\n"
+ "\t@:\n\0"
+/* 1210 */ " \\\n"
+ "\t%s\0"
+/* 1217 */ "\n\n"
+ "%s_SList =\0"
+/* 1230 */ "%s_TList =\0"
+/* 1241 */ "DEPENDENCIES_OUTPUT\0"
+/* 1261 */ "/dev/null\0"
+/* 1271 */ "baseless\0"
+/* 1280 */ "-\0"
+/* 1282 */ "=1\0"
+/* 1285 */ "$@\0"
+/* 1288 */ "$$/../share/autogen\0"
+/* 1308 */ "#assert yielded \"%s\":\n"
+ "\t`%s`\0"
+/* 1336 */ "\n"
+ "#\0"
+/* 1339 */ "'#elif' directive encountered out of context\n"
+ "\tin %s on line %d\n\0"
+/* 1403 */ "else\0"
+/* 1408 */ "endif\0"
+/* 1414 */ "endmac\0"
+/* 1421 */ "endshell\0"
+/* 1430 */ "#error directive -- in %s on line %d\n"
+ "\t%s\n\0"
+/* 1472 */ "WARNING: cannot find `%s' definitions file\n\0"
+/* 1517 */ "open\0"
+/* 1522 */ "read\0"
+/* 1527 */ "WARNING %d (%s): cannot stat `%s' for include\n\0"
+/* 1575 */ "def\0"
+/* 1579 */ "WARNING: `%s' must be regular file to include\n\0"
+/* 1627 */ "Definition error: in %s line %d, #endif not found\n\0"
+/* 1679 */ "Definition error: in %s line %d, #%s no matching start/if directive\n\0"
+/* 1749 */ "Computed Definitions\0"
+/* 1770 */ "\n"
+ "#endshell\0"
+/* 1781 */ "Missing #endshell after '#shell' in %s on line %d\n\0"
+/* 1832 */ "done_check done\n\0"
+/* 1849 */ "done_check re-done\n\0"
+/* 1869 */ "%s ERROR: Too many definition files\n\0"
+/* 1907 */ "%s.%s\0"
+/* 1913 */ "\n\n\0"
+/* 1916 */ "%soutput was abandoned\n\0"
+/* 1940 */ "%sBogus return from setjmp\n\0"
+/* 1968 */ "content-type: text/html\n\n\0"
+/* 1994 */ "* NONE *\0"
+/* 2003 */ "Starting stdout template\n\0"
+/* 2029 */ "stdout\0"
+/* 2036 */ "invalid chars in suffix format: %s\0"
+/* 2072 */ "Empty suffix format\0"
+/* 2092 */ "invalid emission port: %d\0"
+/* 2118 */ "*/\0"
+/* 2121 */ "Error in template %s, line %d\n"
+ "\t\0"
+/* 2153 */ "ERROR\0"
+/* 2159 */ "attempted to use block macro in eval expression\0"
+/* 2207 */ "PROGRAM ERROR: ambiguous expr code\0"
+/* 2243 */ "false\0"
+/* 2249 */ "exit_cleanup %s done\n"
+ "AutoGen %u exits\n\0"
+/* 2288 */ "exit_cleanup re-done\n\0"
+/* 2310 */ "no waiting\0"
+/* 2321 */ "(if (> (string-length shell-cleanup) 0) (shellf \"( (%s) & >/dev/null 2>&1 )\" shell-cleanup) )\0"
+/* 2415 */ "waited\0"
+/* 2422 */ "an unknown license\0"
+/* 2441 */ "%6$s%1$sDO NOT EDIT THIS FILE (%2$s)\n"
+ "%1$s\n"
+ "%1$sIt has been AutoGen-ed%3$s\n"
+ "%1$sFrom the definitions %4$s\n"
+ "%1$sand the template file %5$s\0"
+/* 2582 */ "%s -*- buffer-read-only: t -*- vi: set ro:\n"
+ "%s\n\0"
+/* 2629 */ "%6$s%1$sEDIT THIS FILE WITH CAUTION (%2$s)\n"
+ "%1$s\n"
+ "%1$sIt has been AutoGen-ed%3$s\n"
+ "%1$sFrom the definitions %4$s\n"
+ "%1$sand the template file %5$s\0"
+/* 2775 */ "DO NOT CHANGE THIS COMMENT\0"
+/* 2802 */ "END \0"
+/* 2808 */ "START\0"
+/* 2814 */ "# %2$d \"%1$s\"\0"
+/* 2828 */ "name not followed by '='\0"
+/* 2853 */ "no space separating entries\0"
+/* 2881 */ "WARNING: in %s on line %d unknown directive:\n"
+ "\t#%s\n\0"
+/* 2933 */ "failed\n\0"
+/* 2941 */ "SUCCESS\n\0"
+/* 2950 */ ".\0"
+/* 2952 */ "%s/%s\0"
+/* 2958 */ "find-file\0"
+/* 2968 */ "agpl\0"
+/* 2973 */ "read full file\0"
+/* 2988 */ "invalid license file: %s\0"
+/* 3013 */ "lgpl\0"
+/* 3018 */ "mbsd\0"
+/* 3023 */ "stat file\0"
+/* 3033 */ "lic\0"
+/* 3037 */ "WARNING: empty macro in %s line %d\n\0"
+/* 3073 */ "macros cannot nest\0"
+/* 3092 */ "macro has no end\0"
+/* 3109 */ "%d (%s) is an unknown macro function, or has no handler\0"
+/* 3165 */ "? Say, what ?\0"
+/* 3179 */ " -- DEBUG %s -- FOR index %d\0"
+/* 3210 */ " (%c)\0"
+/* 3216 */ "ELSE clause\0"
+/* 3228 */ "FOR x IN ... has no list\0"
+/* 3253 */ "_GUARD\0"
+/* 3260 */ "Failing Guile command: = = = = =\n\n"
+ "%s\n\n"
+ "=================================\n\0"
+/* 3334 */ "GUILE_WARN_DEPRECATED\0"
+/* 3356 */ "GUILE_WARN_DEPRECATED=no\0"
+/* 3381 */ "els\0"
+/* 3385 */ "the\0"
+/* 3389 */ "Invalid template file\0"
+/* 3411 */ "%s=%s\0"
+/* 3417 */ "SHELL\0"
+/* 3423 */ "lse\0"
+/* 3427 */ "ndif\0"
+/* 3432 */ "fdef \0"
+/* 3438 */ "fndef \0"
+/* 3445 */ "HEADER\0"
+/* 3452 */ "Unterminated HereString\0"
+/* 3476 */ "HereString mark 64 or more chars\0"
+/* 3509 */ "HereString missing the mark\0"
+/* 3537 */ "');\n"
+ "document.write('\" >%s</a>');\n"
+ "//-->\n"
+ "</script>\0"
+/* 3586 */ "<script language=\"JavaScript\" type=\"text/javascript\">\n"
+ "<!--\n"
+ "var one = 'm&#97;';\n"
+ "var two = 'i&#108;t';\n"
+ "document.write('<a href=\"' + one + two );\n"
+ "document.write('&#111;:\0"
+/* 3753 */ "&#%d;\0"
+/* 3759 */ "(debug-enable 'backtrace)\0"
+/* 3785 */ "(use-modules (%s)) (read-enable 'positions)\n"
+ "(add-hook! before-error-hook error-source-line)\n"
+ "(use-modules (ice-9 stack-catch))\0"
+/* 3911 */ "system vm trace\0"
+/* 3927 */ "ice-9 debug\0"
+/* 3939 */ "\\n\\\n\0"
+/* 3944 */ "LC_ALL=C\0"
+/* 3953 */ "Unknown macro or invalid context in %s line %d:\n"
+ "\t%s%s\0"
+/* 4007 */ "ESAC not found\0"
+/* 4022 */ "expressionless CASE\0"
+/* 4042 */ "DEFINE requires a name\0"
+/* 4065 */ "parse ended unexpectedly\0"
+/* 4090 */ "Invalid definition name\0"
+/* 4114 */ "`?' needs two expressions\0"
+/* 4140 */ "No space between expressions\0"
+/* 4169 */ "No text for unfound value\0"
+/* 4195 */ "Error %d (%s) reading %d bytes of %s\n\0"
+/* 4233 */ "read failure\0"
+/* 4246 */ "in\0"
+/* 4249 */ "invalid FOR loop variable\0"
+/* 4275 */ "FOR macro requires iterator name\0"
+/* 4308 */ "ENDFOR not found\0"
+/* 4325 */ "ENDIF not found\0"
+/* 4341 */ "The INCLUDE macro requires a file name\0"
+/* 4380 */ "Empty macro text\0"
+/* 4397 */ "Invalid selection clause\0"
+/* 4422 */ "ENDWHILE not found\0"
+/* 4441 */ "expressionless WHILE\0"
+/* 4462 */ "%s\n"
+ "%s\n"
+ "%s\0"
+/* 4471 */ "to port %s with %d type address\0"
+/* 4503 */ "@@ CGI Definitions @@\0"
+/* 4525 */ "GET\0"
+/* 4529 */ "invalid CGI request method: ''%s''\0"
+/* 4564 */ "No CGI data were received\0"
+/* 4590 */ "CGI text\0"
+/* 4599 */ "Template parse ended unexpectedly\0"
+/* 4633 */ "end of Guile/scheme expression not found\0"
+/* 4674 */ "Cannot expand directory name: '%s'\0"
+/* 4710 */ "map data file\0"
+/* 4724 */ "Could not open template '%s'\0"
+/* 4753 */ "not regular file\0"
+/* 4770 */ "agl\0"
+/* 4774 */ "tpl\0"
+/* 4778 */ "\n\n"
+ "* * * * LOG ENTRY %d * * * *\n\0"
+/* 4810 */ "(add-cleanup \"rm -rf ${gpdir}\")\0"
+/* 4842 */ " ; \\\n\0"
+/* 4848 */ "malloc of %zd bytes failed\n\0"
+/* 4876 */ "in-mem file\0"
+/* 4888 */ "mkstemp failed on `%s'\0"
+/* 4911 */ "#ifndef %1$s\n"
+ "#define %1$s 1\0"
+/* 4939 */ "(define header-file \"%s\") (define header-guard \"%s\")\0"
+/* 4992 */ "owner length\0"
+/* 5005 */ "prefix length\0"
+/* 5019 */ "program name length\0"
+/* 5039 */ "license name is not a string\0"
+/* 5068 */ "There is no %s license.\0"
+/* 5092 */ "Could not open license file '%s'\0"
+/* 5125 */ "<owner>\0"
+/* 5133 */ "<PFX>\0"
+/* 5139 */ "<program>\0"
+/* 5149 */ "%s may not exceed %d chars\n\0"
+/* 5177 */ "<years>\0"
+/* 5185 */ "\\%03o\0"
+/* 5191 */ "mk_tmp_dir ; echo ${tmp_dir}/ag-XXXXXX\0"
+/* 5230 */ "no macro arg name\0"
+/* 5248 */ "On macro argument # %d:\n"
+ "%s\n\0"
+/* 5276 */ "\n\0"
+/* 5278 */ "Invalid template file: %s\0"
+/* 5304 */ "expressionless IF\0"
+/* 5322 */ "no\0"
+/* 5325 */ "no template was specified\0"
+/* 5351 */ "ERROR: %s is not a string\n\0"
+/* 5378 */ "NULL file name\0"
+/* 5393 */ "Error %d (%s) opening `%s' for output\0"
+/* 5431 */ "Cannot format file name: \"%s\", %s, %s\0"
+/* 5470 */ "null\0"
+/* 5475 */ "open for output\0"
+/* 5491 */ "unlink\0"
+/* 5498 */ "* temp file *\0"
+/* 5512 */ "No output file specified to add to\0"
+/* 5547 */ "%s '%s'\n\0"
+/* 5556 */ "open 'wb+'\0"
+/* 5567 */ "failed to create temp file from %s\0"
+/* 5602 */ "ERROR: no output file was suspended as ``%s''\n\0"
+/* 5649 */ "ERROR: Cannot pop output with no output pushed\0"
+/* 5697 */ "freopen\0"
+/* 5705 */ "Autogen Definitions cgi;\n\0"
+/* 5731 */ "stdin\0"
+/* 5737 */ "dup2\0"
+/* 5742 */ "%s-in\0"
+/* 5748 */ "%s-out\0"
+/* 5755 */ "fork\0"
+/* 5760 */ "mkfifo\0"
+/* 5767 */ "poll\0"
+/* 5772 */ "write\0"
+/* 5778 */ "(prefix ...) failed\0"
+/* 5798 */ "The INVOKE macro requires a name\0"
+/* 5831 */ "The INVOKE macro name not space separated\0"
+/* 5873 */ "%s%s[%u] (%s) from %s/%d\n\0"
+/* 5899 */ " \0"
+/* 5932 */ "Starting %s template\n\0"
+/* 5954 */ "pseudo-macro\0"
+/* 5967 */ "start marker contained in end marker\0"
+/* 6004 */ "BROKEN FSM STATE\0"
+/* 6021 */ "start/end macro mark too long\0"
+/* 6051 */ "invalid edit mode marker\0"
+/* 6076 */ "need autogen5 marker\0"
+/* 6097 */ "need end marker\0"
+/* 6113 */ "need end of line\0"
+/* 6130 */ "need start marker\0"
+/* 6148 */ "need template marker\0"
+/* 6169 */ "broken pseudo-macro FSM\0"
+/* 6193 */ "end marker contained in start marker\0"
+/* 6230 */ "bad template marker in %s on line %d:\n"
+ "\t%s\0"
+/* 6272 */ "-*-\0"
+/* 6276 */ "*template file*\0"
+/* 6292 */ "@@ No-Definitions @@\0"
+/* 6313 */ "open non-regular file\0"
+/* 6335 */ "stat\0"
+/* 6340 */ "No definition data were read\0"
+/* 6369 */ "realloc of %zd bytes at 0x%p failed\n\0"
+/* 6406 */ "REQUEST_METHOD\0"
+/* 6421 */ "** EXACT **\0"
+/* 6433 */ "** INEXACT **\0"
+/* 6447 */ "** LIST **\0"
+/* 6458 */ "** Pair **\0"
+/* 6469 */ "** Procedure 0x%08lX **\0"
+/* 6493 */ "** UNKNOWN **\0"
+/* 6507 */ "** Vector **\0"
+/* 6520 */ "RETURN out of context\0"
+/* 6542 */ "Bad args to sprintf\0"
+/* 6562 */ "%s ERROR: %s processing printf format:\n"
+ "\t%s\n\0"
+/* 6607 */ "Scheme evaluation error. AutoGen ABEND-ing in template\n"
+ "\t%s on line %d\n\0"
+/* 6679 */ "scm_string_length returned wrong value: %d != %d\n\0"
+/* 6729 */ "\n"
+ "Guile/Scheme evaluation error in %s line %d: %s\n\0"
+/* 6780 */ "#f\0"
+/* 6783 */ "...\0"
+/* 6787 */ "ERROR: Cannot pop output with no output pushed\n\0"
+/* 6836 */ "re-read output\0"
+/* 6851 */ "(*)()\0"
+/* 6857 */ "#t\0"
+/* 6860 */ "cannot allocate path name\0"
+/* 6886 */ "(set! tmp-dir \"%1$s\")\n"
+ "(add-cleanup \"test \\\"${VERBOSE:-false}\\\" = true || rm -rf %1$s\")\0"
+/* 6973 */ "Warning: (set-writable) function in %s on line %d:\n"
+ "\toverridden by invocation option\n\0"
+/* 7058 */ "%s%s\0"
+/* 7063 */ "invalid alist to shellf\0"
+/* 7087 */ "cd %s\n"
+ "%s\n\n"
+ "echo\n"
+ "echo %s - %d\n\0"
+/* 7116 */ "Closing server: %s signal (%d) received\n\0"
+/* 7158 */ "\n"
+ "Last command issued:\n\0"
+/* 7181 */ "feof on data load\n\0"
+/* 7200 */ "fs err %d (%s) reading from server shell\n\0"
+/* 7242 */ "\n"
+ "Server Restart\n\0"
+/* 7259 */ "(result discarded)\n\0"
+/* 7279 */ "PS4=>${FUNCNAME:-ag}> \0"
+/* 7302 */ "set -x\n"
+ "trap\n"
+ "echo server setup done\n\0"
+/* 7338 */ "ShElL-OuTpUt-HaS-bEeN-cOmPlEtEd\0"
+/* 7370 */ "# %s\0"
+/* 7377 */ "# Makefile dependency file created by:\t\t-*- Mode: Makefile -*-\n"
+ "# %s\n"
+ "# with the following command line arguments:\n\0"
+/* 7491 */ "fopen for write\0"
+/* 7507 */ "'(\0"
+/* 7510 */ "strdup of %d byte string failed\n\0"
+/* 7543 */ "cannot map unprintable chars to C name chars\0"
+/* 7588 */ "ag_scm_string_to_c_name_x\0"
+/* 7614 */ "syscall\0"
+/* 7622 */ "\tfrom %s line %d\n\0"
+/* 7640 */ ".d-XXXXXX\0"
+/* 7650 */ "Server shell timed out 5 times\0"
+/* 7681 */ "Template macro %s invoked with %d args\n\0"
+/* 7721 */ "template\0"
+/* 7730 */ "Warning in template %s, line %d\n"
+ "\t%s\n\0"
+/* 7767 */ "add source dep: %s\n\0"
+/* 7788 */ "add target dep: %s\n\0"
+/* 7809 */ "Adding ``%s'' to environment\n\0"
+/* 7839 */ " '%s'\0"
+/* 7845 */ "eval for arg %d:\n"
+ "\t`%s'\n\0"
+/* 7869 */ "CASE string `%s' did not match\n\0"
+/* 7901 */ "CASE string `%s' %s matched `%s'\n\0"
+/* 7935 */ "CASE no match: `%s' %s vs. `%s'\n\0"
+/* 7968 */ "marker ``%s'' loaded\n\0"
+/* 7990 */ "Definition Load:\n\0"
+/* 8008 */ "eval from file %s line %d:\n"
+ "%s\n\0"
+/* 8039 */ " in \"%s\" -- \0"
+/* 8052 */ "FOR %s loop in %s on line %d begins:\n\0"
+/* 8090 */ "FOR %s repeated %d times\n\0"
+/* 8116 */ "FOR loop skipped - no definition for `%s'\n\0"
+/* 8159 */ "IF expression `%s' on line %d yielded true\n\0"
+/* 8203 */ "IF `%s' macro selected no clause\n\0"
+/* 8237 */ "Template %s included\n\0"
+/* 8259 */ "remapped to '%s' (%2X) in %s at line %d\n\0"
+/* 8300 */ "\tbased on %s\n\0"
+/* 8314 */ "Expr\0"
+/* 8319 */ "Invoke\0"
+/* 8326 */ "WHILE macro repeated %d times\n\0"
+/* 8357 */ "WHILE `%s' loop in %s on line %d begins:\n\0"
+/* 8399 */ "\texiting FOR %s from %d to %d by %d:\n"
+ "\tmore than %d iterations\n\0"
+/* 8462 */ "too many FOR iterations in %s line %d\n\0"
+/* 8501 */ "Defining macro %s from %s\n\0"
+/* 8528 */ "%-10s (%2X) in %s at line %d\n\0"
+/* 8558 */ "searching for `%s'\0"
+/* 8577 */ "%s %s to %s\n\0"
+/* 8590 */ "%s '%s' mode %s\n\0"
+/* 8607 */ "NOTE: skipping file '%s'\n\0"
+/* 8634 */ "%s -- temp file %s\n\0"
+/* 8654 */ "%s from %s to '%s'\n\0"
+/* 8674 */ "%s %s%s\n\0"
+/* 8683 */ "%s %s from '%s'\n\0"
+/* 8700 */ "remove source dep: %s\n\0"
+/* 8724 */ "remove target dep: %s\n\0"
+/* 8748 */ "Compiling ``%s'' with bits 0x%lX\n\0"
+/* 8782 */ "\n"
+ "Server First Start\n\0"
+/* 8803 */ "Server shell is pid %u\n\0"
+/* 8827 */ "\n"
+ "= = = RESULT %d bytes:\n"
+ "%s%s\n"
+ "= = = = = = = = = = = = = = =\n\0"
+/* 8887 */ "Server shell %s starts\n\0"
+/* 8911 */ "\n"
+ "AutoGen %u starts: %s\0"
+/* 8935 */ "%s %s as '%s'\n\0"
+/* 8950 */ "Trap state:\n"
+ "%s\n\0"
+/* 8966 */ "\tcode %lX -- %s\n\0"
+/* 8983 */ "0x%016llX <<== '%s'\n\0"
+/* 9004 */ "Server traps set\n\0"
+/* 9022 */ "true\0"
+/* 9027 */ "uname(2)\0"
+/* 9036 */ "invalid make dependency option: %s\0"
+/* 9072 */ "echo 'definition names looked up'\n"
+ "sed 's/[-^]/-/g'|sort -u -f\n"
+ "echo 'end of looked up definitions'\0"
+/* 9170 */ "%s\n\0"
+/* 9174 */ "Warning\0"
+/* 9182 */ "format\0"
+/* 9189 */ "yes\0"
+/* 9193 */ "'%s'\n\0"
+/* 9199 */ "%s: in %s on line %d\n"
+ "\ttoken in error: %s\n"
+ "\t[[...<error-text>]] %s\n\n"
+ "Likely causes: a mismatched quote, a value that needs quoting,\n"
+ "\t\tor a missing semi-colon\n\0"
+/* 9358 */ "%s: ''%s''\n\0"
+/* 9371 */ "unterminated quote in definition\0"
+/* 9404 */ "\0"
+/* 9405 */ "(use-modules (ice-9 common-list))\n"
+ "(define identifier?\n"
+ "(lambda (x) (or (string? x) (symbol? x))))\n"
+ "(define normalize-identifier\n"
+ "(lambda (x)\n"
+ "(if (string? x) (string->symbol x) x)))\n"
+ "(define coerce->string\n"
+ "(lambda (x)\n"
+ "(let ((char->string (lambda (x) (make-string 1 x)))\n"
+ "(coercable? (lambda (x)\n"
+ "(or (string? x) (boolean? x) (char? x)\n"
+ "(symbol? x) (list? x) (number? x)))))\n"
+ "(if (not (coercable? x))\n"
+ "(error \"Wrong type to coerce->string\" x))\n"
+ "(cond\n"
+ "((string? x) (string-append\n"
+ "(char->string #\\\") x (char->string #\\\")))\n"
+ "((boolean? x) (if x \"#t\" \"#f\"))\n"
+ "((char? x) (char->string x))\n"
+ "((number? x) (number->string x))\n"
+ "((symbol? x) (symbol->string x))\n"
+ "((list? x) (if (every coercable? x)\n"
+ "(apply string-append (map coerce->string x))))\n"
+ "))))\n"
+ "(define alist->autogen-def\n"
+ "(lambda (lst . recursive)\n"
+ "(if (null? recursive) (set! recursive #f)\n"
+ "(set! recursive #t))\n"
+ "(let ((res (if recursive \"{\\n\" \"\"))\n"
+ "(list-nnul? (lambda (x) (and (list? x) (not (null? x))))))\n"
+ "(do ((i lst (cdr i)))\n"
+ "((null? i) (if recursive\n"
+ "(string-append res \"}\")\n"
+ "res))\n"
+ "(let* ((kvpair (car i))\n"
+ "(value (cdr kvpair))\n"
+ "(value-is-alist (if (and (list-nnul? value)\n"
+ "(list-nnul? (car value))\n"
+ "(list-nnul? (caar value))\n"
+ "(identifier? (caaar value)))\n"
+ "#t #f)))\n"
+ "(set! res (string-append res\n"
+ "(coerce->string (normalize-identifier (car kvpair)))\n"
+ "\" = \"\n"
+ "(if value-is-alist\n"
+ "(alist->autogen-def (car value) 1)\n"
+ "(coerce->string (cdr kvpair)))\n"
+ "\";\\n\"\n"
+ ")))))))\n"
+ "(define shell-cleanup \"\")\n"
+ "(define add-cleanup (lambda (t)\n"
+ "(set! shell-cleanup (string-append shell-cleanup \"\\n\" t \"\\n\"))))\n"
+ "(define tmp-dir \"\")\n"
+ "(define header-file \"\")\n"
+ "(define header-guard \"\")\n"
+ "(define autogen-version \"5.16.2\")\n"
+ "(define c-file-line-fmt \"#line %2$d \\\"%1$s\\\"\\n\")\n"
+ "(define-macro (defined-as predicate symbol)\n"
+ "`(and (defined? ',symbol) (,predicate ,symbol)))\n"
+ "(define html-escape-encode (lambda (str)\n"
+ "(string-substitute str\n"
+ "'(\"&\" \"<\" \">\")\n"
+ "'(\"&amp;\" \"&lt;\" \"&gt;\"))))\n"
+ "(define stt-table (make-hash-table 31))\n"
+ "(define stt-curr stt-table)\n"
+ "(define stt-idx-tbl stt-table)\n"
+ "(define stt-idx 0)\n"
+ "(define string-table-new (lambda (st-name) (begin\n"
+ "(set! stt-curr (make-hash-table 31))\n"
+ "(hash-create-handle! stt-table st-name stt-curr)\n"
+ "(out-push-new)\n"
+ "(out-suspend st-name)\n"
+ "(set! stt-idx-tbl (make-hash-table 31))\n"
+ "(hash-create-handle! stt-curr \"string-indexes\" stt-idx-tbl)\n"
+ "(hash-create-handle! stt-curr \"current-index\" 0)\n"
+ "\"\"\n"
+ ")))\n"
+ "(define string-table-add (lambda (st-name str-val) (begin\n"
+ "(set! stt-curr (hash-ref stt-table st-name))\n"
+ "(set! stt-idx-tbl (hash-ref stt-curr \"string-indexes\"))\n"
+ "(set! stt-idx (hash-ref stt-idx-tbl str-val))\n"
+ "(if (not (number? stt-idx))\n"
+ "(begin\n"
+ "(set! stt-idx (hash-ref stt-curr \"current-index\"))\n"
+ "(ag-fprintf st-name \"/* %5d */ %s \\\"\\\\0\\\"\\n\"\n"
+ "stt-idx (c-string str-val))\n"
+ "(hash-create-handle! stt-idx-tbl str-val stt-idx)\n"
+ "(hash-set! stt-curr \"current-index\"\n"
+ "(+ stt-idx (string-length str-val) 1))\n"
+ "))\n"
+ "stt-idx\n"
+ ")))\n"
+ "(define string-table-add-ref (lambda (st-name str-val)\n"
+ "(string-append st-name \"+\"\n"
+ "(number->string (string-table-add st-name str-val)))))\n"
+ "(define emit-string-table (lambda (st-name) (begin\n"
+ "(set! stt-curr (hash-ref stt-table st-name))\n"
+ "(set! stt-idx (hash-ref stt-curr \"current-index\"))\n"
+ "(ag-fprintf 0 \"\\nstatic char const %s[%d] =\\n\" st-name stt-idx)\n"
+ "(out-resume st-name)\n"
+ "(emit (shell (string-append\n"
+ "\"sed 's/^ / /\n"
+ "$s/\\\" \\\"\\\\\\\\0\\\"/\\\";/\n"
+ "s/\\\" \\\"\\\\\\\\0/\\\\\\\\0/\n"
+ "' <<\\\\_EOF_\\n\"\n"
+ "(out-pop #t)\n"
+ "\"_EOF_\")))\n"
+ "(emit \"\\n\")\n"
+ ")))\n"
+ "(define string-table-size (lambda (st-name)\n"
+ "(hash-ref (hash-ref stt-table st-name) \"current-index\")))\n"
+ "(define gperf-code (lambda (gp-name) (shellf\n"
+ "\"sed -e '1,/^#line/d' \\\n"
+ "-e '/#include/d' \\\n"
+ "-e '/#line/d' \\\n"
+ "-e '/^[ \\t]*$/d' \\\n"
+ "-e 's/^const struct /static const struct /' \\\n"
+ "-e '/^int main(/,$d' ${gpdir}/%s.c\"\n"
+ "gp-name\n"
+ ")))\n"
+ "(define stack-join (lambda (j-str ag-name)\n"
+ "(join j-str (stack ag-name))))\0"
+/* 13165 */ "exec 8>&2 2>/dev/null\n\n"
+ "if test -n \"${ZSH_VERSION+set}\" && (emulate sh) 1>&2\n"
+ "then\n"
+ " emulate sh\n"
+ " NULLCMD=:\n\n"
+ "else case `set -o` in *posix*) set -o posix ;; esac\n"
+ "fi\n"
+ "trap_exit() {\n"
+ " case \"$1\" in\n"
+ " 0 | 10 | 15 )\n"
+ " exec 1>&- 2>&-\n"
+ " test -d \"${tmp_dir}\" && rm -rf \"${tmp_dir}\"\n"
+ " ;;\n\n"
+ " * )\n"
+ " exec 1>&8\n"
+ " echo \"trapped on signal ${1}\"\n"
+ " test -d \"${tmp_dir}\" && \\\n"
+ " echo \"temp directory has been retained: ${tmp_dir}\"\n"
+ " esac\n"
+ "}\n"
+ "for f in 0 1 2 5 6 7 10 13 14 15\n"
+ "do trap \"trap_exit ${f}\" $f ; done\n\n"
+ "test -n \"${CDPATH}\" && {\n"
+ " CDPATH=''\n"
+ " unset CDPATH\n"
+ "}\n"
+ "( exec 1>&2 ; unalias cd ) && unalias cd\n"
+ "die() {\n"
+ " echo \"Killing AutoGen ${AG_pid}\"\n"
+ " echo \"FAILURE REASON: $*\"\n"
+ " kill -15 ${AG_pid}\n"
+ " kill -1 ${AG_pid}\n"
+ " kill -2 ${AG_pid}\n"
+ " exit 1\n"
+ "} >&8\n"
+ "test -z \"${TMPDIR}\" && TMPDIR=/tmp\n"
+ "tmp_dir=''\n"
+ "mk_tmp_dir() {\n"
+ " test -d \"${tmp_dir}\" && return 0\n"
+ " tmp_dir=`\n"
+ " t=\\`mktemp -d ${TMPDIR}/.ag-XXXXXX\\`\n"
+ " test -d \"${t}\" || {\n"
+ " t=${TMPDIR}/.ag-$$\n"
+ " rm -rf ${t}\n"
+ " mkdir ${t} || die cannot mkdir ${t}\n"
+ " }\n"
+ " chmod 700 ${t} || die cannot chmod 700 ${t}\n"
+ " echo ${t}\n"
+ " ` 2>/dev/null\n"
+ "}\n"
+ "exec 2>&8\n"
+ "export AG_pid\n"
+ "AG_pid=\"%u\"\n"
+ "AGexe='%s'\0"
+/* 14344 */ "gperf --version > /dev/null 2>&1 || die 'no gperf program'\n"
+ "test -z ${gpdir} && {\n"
+ " gpdir=`mktemp -d ./.gperf.XXXXXX` 2>/dev/null\n"
+ " test -z \"${gpdir}\" && gpdir=.gperf.$$\n"
+ " test -d ${gpdir} || mkdir ${gpdir} || die \"cannot mkdir ${gpdir}\"\n"
+ "}\n"
+ "cd ${gpdir} || die cannot cd into ${gpdir}\n"
+ "gpdir=`pwd`\n"
+ "gperf_%2$s=${gpdir}/%2$s\n\n"
+ "{\n"
+ " cat << \\_EOF_\n"
+ "%%{\n"
+ "#include <stdio.h>\n"
+ "%%}\n"
+ "struct %2$s_index { char const * name; int const idx; };\n"
+ "%%%%\n"
+ "_EOF_\n\n"
+ " idx=1\n"
+ " while read f\n"
+ " do echo \"${f}, ${idx}\"\n"
+ " idx=`expr ${idx} + 1`\n"
+ " done << \\_EOLIST_\n"
+ "%3$s\n"
+ "_EOLIST_\n\n"
+ " cat << '_EOF_'\n"
+ "%%%%\n"
+ "int main(int argc, char** argv) {\n"
+ " char* pz = argv[1];\n"
+ " struct %2$s_index const * pI = %2$s_find( pz, strlen( pz ));\n"
+ " if (pI == NULL)\n"
+ " return 1;\n"
+ " printf( \"0x%%02X\\n\", pI->idx );\n"
+ " return 0;\n"
+ "}\n"
+ "_EOF_\n"
+ "} > %2$s.gperf\n\n"
+ "exec 2> %2$s.log\n"
+ "gperf --language=ANSI-C -H %2$s_hash -N %2$s_find \\\n"
+ " -C -E -I -t %2$s.gperf > %2$s-temp.c || \\\n"
+ " die \"gperf failed on ${gpdir}/%2$s.gperf\n"
+ " `cat %2$s.log`\"\n"
+ "egrep -v '^[^#].*_inline' %2$s-temp.c > %2$s.c\n"
+ "export CFLAGS=-g\n"
+ "%1$s %2$s 1>&2\n"
+ "test $? -eq 0 -a -x ${gperf_%2$s} || \\\n"
+ " die \"could not '%1$s %2$s' gperf program\n"
+ " `cat %2$s.log`\"\n"
+ "exec 2>&8\0"
+/* 15524 */ "test -n \"${gperf_%1$s}\" || \\\n"
+ " die 'no environment variable \"gperf_%1$s\"'\n"
+ "test -x \"${gperf_%1$s}\" || \\\n"
+ " die \"no gperf program named ${gperf_%1$s}\"\n"
+ "${gperf_%1$s} %2$s";
+
+/* end of ag-text.c */
diff --git a/agen5/ag-text.h b/agen5/ag-text.h
new file mode 100644
index 0000000..24c3daf
--- /dev/null
+++ b/agen5/ag-text.h
@@ -0,0 +1,856 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (ag-text.h)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:41 AM by AutoGen 5.16.2pre7
+ * From the definitions /old-home/bkorb/ag/ag/agen5/ag-text.def
+ * and the template file strings
+ *
+ * Copyright (C) 2011-2012 Bruce Korb, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the
+ * Modified (3 clause) Berkeley Software Distribution License
+ * <http://www.xfree86.org/3.3.6/COPYRIGHT2.html>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name ``Bruce Korb'' nor the name of any other
+ * contributor may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * strings IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bruce Korb OR ANY OTHER CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef STRINGS_AG_TEXT_H_GUARD
+#define STRINGS_AG_TEXT_H_GUARD 1
+/*
+ * 404 strings in ag_text_strtable string table
+ */
+#define ADD_ENV_VARS_SUFFIX_FMT (ag_text_strtable+10)
+#define ADD_ENV_VARS_SUFFIX_FMT_LEN 4
+#define ADD_SYS_ENV_VAL_FMT (ag_text_strtable+15)
+#define ADD_SYS_ENV_VAL_FMT_LEN 4
+#define AG_ABEND_STATE_FMT (ag_text_strtable+20)
+#define AG_ABEND_STATE_FMT_LEN 22
+#define AG_ABORT_LOC_FMT (ag_text_strtable+43)
+#define AG_ABORT_LOC_FMT_LEN 74
+#define AG_FPRINTF_BAD_PORT (ag_text_strtable+118)
+#define AG_FPRINTF_BAD_PORT_LEN 29
+#define AG_MAKE_DEP_NAME (ag_text_strtable+148)
+#define AG_MAKE_DEP_NAME_LEN 16
+#define AG_MARK (ag_text_strtable+165)
+#define AG_MARK_LEN 8
+#define AG_SIG_ABORT_FMT (ag_text_strtable+174)
+#define AG_SIG_ABORT_FMT_LEN 47
+#define AG_TEXT_STRTABLE_FILE (ag_text_strtable+0)
+#define AG_TEXT_STRTABLE_FILE_LEN 9
+#define ALIST_TO_AG_ERR (ag_text_strtable+222)
+#define ALIST_TO_AG_ERR_LEN 52
+#define ALIST_TO_AG_TEXT (ag_text_strtable+275)
+#define ALIST_TO_AG_TEXT_LEN 27
+#define ALIST_TO_AG_WRAP (ag_text_strtable+303)
+#define ALIST_TO_AG_WRAP_LEN 23
+#define APRF_ALLOCATE_FAIL (ag_text_strtable+327)
+#define APRF_ALLOCATE_FAIL_LEN 50
+#define ASPRINTFV_FAIL_FMT (ag_text_strtable+378)
+#define ASPRINTFV_FAIL_FMT_LEN 26
+#define ASSEMBLE_NAME_ERR (ag_text_strtable+405)
+#define ASSEMBLE_NAME_ERR_LEN 51
+#define BAD_BREAK_FMT (ag_text_strtable+457)
+#define BAD_BREAK_FMT_LEN 29
+#define BAD_MAC_NM_FMT (ag_text_strtable+487)
+#define BAD_MAC_NM_FMT_LEN 36
+#define BAD_MSG_STR (ag_text_strtable+524)
+#define BAD_MSG_STR_LEN 36
+#define BAD_NAME_FMT (ag_text_strtable+561)
+#define BAD_NAME_FMT_LEN 37
+#define BAD_RE_FMT (ag_text_strtable+599)
+#define BAD_RE_FMT_LEN 46
+#define BOGUS_TAG (ag_text_strtable+646)
+#define BOGUS_TAG_LEN 11
+#define BREAK_STR (ag_text_strtable+658)
+#define BREAK_STR_LEN 5
+#define BUILD_DEFS_LONG_FMT (ag_text_strtable+664)
+#define BUILD_DEFS_LONG_FMT_LEN 3
+#define CANNOT_FMT (ag_text_strtable+668)
+#define CANNOT_FMT_LEN 28
+#define CFGDEP_DUP_TARGET_MSG (ag_text_strtable+697)
+#define CFGDEP_DUP_TARGET_MSG_LEN 21
+#define CFGDEP_UNKNOWN_DEP_FMT (ag_text_strtable+719)
+#define CFGDEP_UNKNOWN_DEP_FMT_LEN 28
+#define CGI_ERR_MSG_FMT (ag_text_strtable+748)
+#define CGI_ERR_MSG_FMT_LEN 57
+#define CGI_PARSE_ERR_FMT (ag_text_strtable+806)
+#define CGI_PARSE_ERR_FMT_LEN 22
+#define CGI_TEMP_ERR_FILE_STR (ag_text_strtable+829)
+#define CGI_TEMP_ERR_FILE_STR_LEN 22
+#define CMD_FAIL_FMT (ag_text_strtable+852)
+#define CMD_FAIL_FMT_LEN 44
+#define COMPILE_RE_BAD (ag_text_strtable+897)
+#define COMPILE_RE_BAD_LEN 22
+#define CONTINUE_STR (ag_text_strtable+920)
+#define CONTINUE_STR_LEN 8
+#define C_STRING_NEWLINE (ag_text_strtable+929)
+#define C_STRING_NEWLINE_LEN 12
+#define DEF_ERR_FMT (ag_text_strtable+942)
+#define DEF_ERR_FMT_LEN 31
+#define DEF_FILE_LINE_FMT (ag_text_strtable+974)
+#define DEF_FILE_LINE_FMT_LEN 15
+#define DEF_NOTE_FMT (ag_text_strtable+990)
+#define DEF_NOTE_FMT_LEN 41
+#define DEF_TYPE_BLOCK (ag_text_strtable+1032)
+#define DEF_TYPE_BLOCK_LEN 5
+#define DEF_TYPE_INVALID (ag_text_strtable+1038)
+#define DEF_TYPE_INVALID_LEN 7
+#define DEF_TYPE_TEXT (ag_text_strtable+1046)
+#define DEF_TYPE_TEXT_LEN 4
+#define DEF_TYPE_UNKNOWN (ag_text_strtable+1051)
+#define DEF_TYPE_UNKNOWN_LEN 7
+#define DEP_FILE_CLEAN_FMT (ag_text_strtable+1069)
+#define DEP_FILE_CLEAN_FMT_LEN 91
+#define DEP_FILE_SPLICE_STR (ag_text_strtable+1059)
+#define DEP_FILE_SPLICE_STR_LEN 3
+#define DEP_FILE_TARG_FMT (ag_text_strtable+1063)
+#define DEP_FILE_TARG_FMT_LEN 5
+#define DEP_FILE_WRAP_FMT (ag_text_strtable+1161)
+#define DEP_FILE_WRAP_FMT_LEN 48
+#define DEP_List (ag_text_strtable+1210)
+#define DEP_List_LEN 6
+#define DEP_OUT_NAME (ag_text_strtable+1241)
+#define DEP_OUT_NAME_LEN 19
+#define DEP_SList (ag_text_strtable+1217)
+#define DEP_SList_LEN 12
+#define DEP_TList (ag_text_strtable+1230)
+#define DEP_TList_LEN 10
+#define DEV_NULL (ag_text_strtable+1261)
+#define DEV_NULL_LEN 9
+#define DFT_BASE_NAME (ag_text_strtable+1271)
+#define DFT_BASE_NAME_LEN 8
+#define DFT_DEF_INPUT_STR (ag_text_strtable+1280)
+#define DFT_DEF_INPUT_STR_LEN 1
+#define DFT_ENV_VAL (ag_text_strtable+1282)
+#define DFT_ENV_VAL_LEN 2
+#define DFT_TPL_DIR_DATA (ag_text_strtable+1285)
+#define DFT_TPL_DIR_DATA_LEN 2
+#define DFT_TPL_DIR_RELATIVE (ag_text_strtable+1288)
+#define DFT_TPL_DIR_RELATIVE_LEN 19
+#define DIRECT_ASSERT_FMT (ag_text_strtable+1308)
+#define DIRECT_ASSERT_FMT_LEN 27
+#define DIRECT_CK_LIST_MARK (ag_text_strtable+1336)
+#define DIRECT_CK_LIST_MARK_LEN 2
+#define DIRECT_ELIF_BAD_FMT (ag_text_strtable+1339)
+#define DIRECT_ELIF_BAD_FMT_LEN 63
+#define DIRECT_ELSE_BAD (ag_text_strtable+1403)
+#define DIRECT_ELSE_BAD_LEN 4
+#define DIRECT_ENDIF_BAD (ag_text_strtable+1408)
+#define DIRECT_ENDIF_BAD_LEN 5
+#define DIRECT_ENDMAC_BAD (ag_text_strtable+1414)
+#define DIRECT_ENDMAC_BAD_LEN 6
+#define DIRECT_ENDSHELL_BAD (ag_text_strtable+1421)
+#define DIRECT_ENDSHELL_BAD_LEN 8
+#define DIRECT_ERROR_FMT (ag_text_strtable+1430)
+#define DIRECT_ERROR_FMT_LEN 41
+#define DIRECT_INC_CANNOT_FIND (ag_text_strtable+1472)
+#define DIRECT_INC_CANNOT_FIND_LEN 44
+#define DIRECT_INC_CANNOT_OPEN (ag_text_strtable+1517)
+#define DIRECT_INC_CANNOT_OPEN_LEN 4
+#define DIRECT_INC_CANNOT_READ (ag_text_strtable+1522)
+#define DIRECT_INC_CANNOT_READ_LEN 4
+#define DIRECT_INC_CANNOT_STAT (ag_text_strtable+1527)
+#define DIRECT_INC_CANNOT_STAT_LEN 47
+#define DIRECT_INC_DEF_SFX (ag_text_strtable+1575)
+#define DIRECT_INC_DEF_SFX_LEN 3
+#define DIRECT_INC_NOT_REG (ag_text_strtable+1579)
+#define DIRECT_INC_NOT_REG_LEN 47
+#define DIRECT_NOENDIF_FMT (ag_text_strtable+1627)
+#define DIRECT_NOENDIF_FMT_LEN 51
+#define DIRECT_NOMATCH_FMT (ag_text_strtable+1679)
+#define DIRECT_NOMATCH_FMT_LEN 69
+#define DIRECT_SHELL_COMP_DEFS (ag_text_strtable+1749)
+#define DIRECT_SHELL_COMP_DEFS_LEN 20
+#define DIRECT_SHELL_END_SHELL (ag_text_strtable+1770)
+#define DIRECT_SHELL_END_SHELL_LEN 10
+#define DIRECT_SHELL_NOEND (ag_text_strtable+1781)
+#define DIRECT_SHELL_NOEND_LEN 50
+#define DONE_CHECK_DONE (ag_text_strtable+1832)
+#define DONE_CHECK_DONE_LEN 16
+#define DONE_CHECK_REDONE (ag_text_strtable+1849)
+#define DONE_CHECK_REDONE_LEN 19
+#define DOOPT_TOO_MANY_DEFS (ag_text_strtable+1869)
+#define DOOPT_TOO_MANY_DEFS_LEN 37
+#define DOT_SFX_FMT (ag_text_strtable+1907)
+#define DOT_SFX_FMT_LEN 5
+#define DOUBLE_NEWLINE (ag_text_strtable+1913)
+#define DOUBLE_NEWLINE_LEN 2
+#define DO_STDOUT_TPL_ABANDONED (ag_text_strtable+1916)
+#define DO_STDOUT_TPL_ABANDONED_LEN 23
+#define DO_STDOUT_TPL_BADR (ag_text_strtable+1940)
+#define DO_STDOUT_TPL_BADR_LEN 27
+#define DO_STDOUT_TPL_CONTENT (ag_text_strtable+1968)
+#define DO_STDOUT_TPL_CONTENT_LEN 25
+#define DO_STDOUT_TPL_NOSFX (ag_text_strtable+1994)
+#define DO_STDOUT_TPL_NOSFX_LEN 8
+#define DO_STDOUT_TPL_START_STD (ag_text_strtable+2003)
+#define DO_STDOUT_TPL_START_STD_LEN 25
+#define DO_STDOUT_TPL_STDOUT (ag_text_strtable+2029)
+#define DO_STDOUT_TPL_STDOUT_LEN 6
+#define DO_SUFFIX_BAD_CHARS (ag_text_strtable+2036)
+#define DO_SUFFIX_BAD_CHARS_LEN 35
+#define DO_SUFFIX_EMPTY (ag_text_strtable+2072)
+#define DO_SUFFIX_EMPTY_LEN 19
+#define EMIT_INVAL_PORT (ag_text_strtable+2092)
+#define EMIT_INVAL_PORT_LEN 25
+#define END_C_COMMENT (ag_text_strtable+2118)
+#define END_C_COMMENT_LEN 2
+#define ERROR_IN_TPL_FMT (ag_text_strtable+2121)
+#define ERROR_IN_TPL_FMT_LEN 31
+#define ERROR_STR (ag_text_strtable+2153)
+#define ERROR_STR_LEN 5
+#define EVAL_EXPR_BLOCK_IN_EVAL (ag_text_strtable+2159)
+#define EVAL_EXPR_BLOCK_IN_EVAL_LEN 47
+#define EVAL_EXPR_PROG_ERR (ag_text_strtable+2207)
+#define EVAL_EXPR_PROG_ERR_LEN 35
+#define EVAL_TRUE_FALSE_STR (ag_text_strtable+2243)
+#define EVAL_TRUE_FALSE_STR_LEN 5
+#define EXIT_CLEANUP_DONE_FMT (ag_text_strtable+2249)
+#define EXIT_CLEANUP_DONE_FMT_LEN 38
+#define EXIT_CLEANUP_MULLIGAN (ag_text_strtable+2288)
+#define EXIT_CLEANUP_MULLIGAN_LEN 21
+#define EXIT_CLEANUP_NOWAIT (ag_text_strtable+2310)
+#define EXIT_CLEANUP_NOWAIT_LEN 10
+#define EXIT_CLEANUP_STR (ag_text_strtable+2321)
+#define EXIT_CLEANUP_STR_LEN 93
+#define EXIT_CLEANUP_WAITED (ag_text_strtable+2415)
+#define EXIT_CLEANUP_WAITED_LEN 6
+#define EXP_FMT_BAD_LIC (ag_text_strtable+2422)
+#define EXP_FMT_BAD_LIC_LEN 18
+#define EXP_FMT_DNE (ag_text_strtable+2441)
+#define EXP_FMT_DNE1 (ag_text_strtable+2582)
+#define EXP_FMT_DNE1_LEN 46
+#define EXP_FMT_DNE2 (ag_text_strtable+2629)
+#define EXP_FMT_DNE2_LEN 145
+#define EXP_FMT_DNE_LEN 140
+#define EXTRACT_CAVEAT (ag_text_strtable+2775)
+#define EXTRACT_CAVEAT_LEN 26
+#define EXTRACT_END (ag_text_strtable+2802)
+#define EXTRACT_END_LEN 5
+#define EXTRACT_START (ag_text_strtable+2808)
+#define EXTRACT_START_LEN 5
+#define FALSE_NAME_STR (ag_text_strtable+2243)
+#define FALSE_NAME_STR_LEN 5
+#define FILE_LINE_FMT (ag_text_strtable+2814)
+#define FILE_LINE_FMT_LEN 13
+#define FILL_IN_VAL_NO_ASSIGN (ag_text_strtable+2828)
+#define FILL_IN_VAL_NO_ASSIGN_LEN 24
+#define FILL_IN_VAL_NO_SEP (ag_text_strtable+2853)
+#define FILL_IN_VAL_NO_SEP_LEN 27
+#define FIND_DIRECT_UNKNOWN (ag_text_strtable+2881)
+#define FIND_DIRECT_UNKNOWN_LEN 51
+#define FIND_ENT_FAIL (ag_text_strtable+2933)
+#define FIND_ENT_FAIL_LEN 7
+#define FIND_ENT_SUCC (ag_text_strtable+2941)
+#define FIND_ENT_SUCC_LEN 8
+#define FIND_FILE_CURDIR (ag_text_strtable+2950)
+#define FIND_FILE_CURDIR_LEN 1
+#define FIND_FILE_DIR_FMT (ag_text_strtable+2952)
+#define FIND_FILE_DIR_FMT_LEN 5
+#define FIND_FILE_NAME (ag_text_strtable+2958)
+#define FIND_FILE_NAME_LEN 9
+#define FIND_LIC_TEXT_AGPL (ag_text_strtable+2968)
+#define FIND_LIC_TEXT_AGPL_LEN 4
+#define FIND_LIC_TEXT_BAD_FILE (ag_text_strtable+2973)
+#define FIND_LIC_TEXT_BAD_FILE_LEN 14
+#define FIND_LIC_TEXT_INVAL (ag_text_strtable+2988)
+#define FIND_LIC_TEXT_INVAL_LEN 24
+#define FIND_LIC_TEXT_LGPL (ag_text_strtable+3013)
+#define FIND_LIC_TEXT_LGPL_LEN 4
+#define FIND_LIC_TEXT_MBSD (ag_text_strtable+3018)
+#define FIND_LIC_TEXT_MBSD_LEN 4
+#define FIND_LIC_TEXT_NO_LIC (ag_text_strtable+3023)
+#define FIND_LIC_TEXT_NO_LIC_LEN 9
+#define FIND_LIC_TEXT_OPEN (ag_text_strtable+1517)
+#define FIND_LIC_TEXT_OPEN_LEN 4
+#define FIND_LIC_TEXT_SFX (ag_text_strtable+3033)
+#define FIND_LIC_TEXT_SFX_LEN 3
+#define FIND_MAC_END_EMPTY (ag_text_strtable+3037)
+#define FIND_MAC_END_EMPTY_LEN 35
+#define FIND_MAC_END_NESTED (ag_text_strtable+3073)
+#define FIND_MAC_END_NESTED_LEN 18
+#define FIND_MAC_END_NOPE (ag_text_strtable+3092)
+#define FIND_MAC_END_NOPE_LEN 16
+#define FN_BOGUS_FMT (ag_text_strtable+3109)
+#define FN_BOGUS_FMT_LEN 55
+#define FN_BOGUS_HUH (ag_text_strtable+3165)
+#define FN_BOGUS_HUH_LEN 13
+#define FN_DEBUG (ag_text_strtable+3179)
+#define FN_DEBUG_GRAPHIC (ag_text_strtable+3210)
+#define FN_DEBUG_GRAPHIC_LEN 5
+#define FN_DEBUG_LEN 30
+#define FN_IF_ELSE (ag_text_strtable+3216)
+#define FN_IF_ELSE_LEN 11
+#define FOR_IN_LISTLESS (ag_text_strtable+3228)
+#define FOR_IN_LISTLESS_LEN 24
+#define GUARD_SFX (ag_text_strtable+3253)
+#define GUARD_SFX_LEN 6
+#define GUILE_CMD_FAIL_FMT (ag_text_strtable+3260)
+#define GUILE_CMD_FAIL_FMT_LEN 73
+#define GUILE_WARN_DEP_STR (ag_text_strtable+3334)
+#define GUILE_WARN_DEP_STR_LEN 21
+#define GUILE_WARN_NO_ENV (ag_text_strtable+3356)
+#define GUILE_WARN_NO_ENV_LEN 24
+#define HANDLE_EOL__ELS (ag_text_strtable+3381)
+#define HANDLE_EOL__ELS_LEN 3
+#define HANDLE_EOL__THE (ag_text_strtable+3385)
+#define HANDLE_EOL__THE_LEN 3
+#define HANDLE_HASH_BAD_TPL (ag_text_strtable+3389)
+#define HANDLE_HASH_BAD_TPL_LEN 21
+#define HANDLE_HASH_ENV_FMT (ag_text_strtable+3411)
+#define HANDLE_HASH_ENV_FMT_LEN 5
+#define HANDLE_HASH_SHELL (ag_text_strtable+3417)
+#define HANDLE_HASH_SHELL_LEN 5
+#define HANDLE_SED_ELSE (ag_text_strtable+3423)
+#define HANDLE_SED_ELSE_LEN 3
+#define HANDLE_SED_ENDIF (ag_text_strtable+3427)
+#define HANDLE_SED_ENDIF_LEN 4
+#define HANDLE_SED_IFDEF (ag_text_strtable+3432)
+#define HANDLE_SED_IFDEF_LEN 5
+#define HANDLE_SED_IFNDEF (ag_text_strtable+3438)
+#define HANDLE_SED_IFNDEF_LEN 6
+#define HEADER_STR (ag_text_strtable+3445)
+#define HEADER_STR_LEN 6
+#define HERE_ENDLESS_STR (ag_text_strtable+3452)
+#define HERE_ENDLESS_STR_LEN 23
+#define HERE_MARK_TOO_LONG (ag_text_strtable+3476)
+#define HERE_MARK_TOO_LONG_LEN 32
+#define HERE_MISS_MARK_STR (ag_text_strtable+3509)
+#define HERE_MISS_MARK_STR_LEN 27
+#define HIDE_EMAIL_END_FMT (ag_text_strtable+3537)
+#define HIDE_EMAIL_END_FMT_LEN 48
+#define HIDE_EMAIL_START_STR (ag_text_strtable+3586)
+#define HIDE_EMAIL_START_STR_LEN 166
+#define HTML_DEC_DIGIT (ag_text_strtable+3753)
+#define HTML_DEC_DIGIT_LEN 5
+#define INIT_SCM_DEBUG_FMT (ag_text_strtable+3759)
+#define INIT_SCM_DEBUG_FMT_LEN 25
+#define INIT_SCM_ERRS_FMT (ag_text_strtable+3785)
+#define INIT_SCM_ERRS_FMT_LEN 125
+#define KR_STRING_NEWLINE (ag_text_strtable+3939)
+#define KR_STRING_NEWLINE_LEN 4
+#define LC_ALL_IS_C (ag_text_strtable+3944)
+#define LC_ALL_IS_C_LEN 8
+#define LD_BOGUS_UNKNOWN (ag_text_strtable+3953)
+#define LD_BOGUS_UNKNOWN_LEN 53
+#define LD_CASE_NO_ESAC (ag_text_strtable+4007)
+#define LD_CASE_NO_ESAC_LEN 14
+#define LD_CASE_NO_EXPR (ag_text_strtable+4022)
+#define LD_CASE_NO_EXPR_LEN 19
+#define LD_DEF_NEED_NAME (ag_text_strtable+4042)
+#define LD_DEF_NEED_NAME_LEN 22
+#define LD_DEF_WOOPS (ag_text_strtable+4065)
+#define LD_DEF_WOOPS_LEN 24
+#define LD_EXPR_BAD_NAME (ag_text_strtable+4090)
+#define LD_EXPR_BAD_NAME_LEN 23
+#define LD_EXPR_NEED_TWO (ag_text_strtable+4114)
+#define LD_EXPR_NEED_TWO_LEN 25
+#define LD_EXPR_NO_SPACE (ag_text_strtable+4140)
+#define LD_EXPR_NO_SPACE_LEN 28
+#define LD_EXPR_NO_TEXT (ag_text_strtable+4169)
+#define LD_EXPR_NO_TEXT_LEN 25
+#define LD_EXTRACT_BAD_READ (ag_text_strtable+4195)
+#define LD_EXTRACT_BAD_READ_LEN 37
+#define LD_EXTRACT_READ_FAIL (ag_text_strtable+4233)
+#define LD_EXTRACT_READ_FAIL_LEN 12
+#define LD_FOR_IN (ag_text_strtable+4246)
+#define LD_FOR_INVALID_VAR (ag_text_strtable+4249)
+#define LD_FOR_INVALID_VAR_LEN 25
+#define LD_FOR_IN_LEN 2
+#define LD_FOR_NAMELESS (ag_text_strtable+4275)
+#define LD_FOR_NAMELESS_LEN 32
+#define LD_FOR_NO_ENDFOR (ag_text_strtable+4308)
+#define LD_FOR_NO_ENDFOR_LEN 16
+#define LD_IF_NO_ENDIF (ag_text_strtable+4325)
+#define LD_IF_NO_ENDIF_LEN 15
+#define LD_INC_NO_FNAME (ag_text_strtable+4341)
+#define LD_INC_NO_FNAME_LEN 38
+#define LD_SEL_EMPTY (ag_text_strtable+4380)
+#define LD_SEL_EMPTY_LEN 16
+#define LD_SEL_INVAL (ag_text_strtable+4397)
+#define LD_SEL_INVAL_LEN 24
+#define LD_UNKNOWN_INVAL_DEF (ag_text_strtable+4090)
+#define LD_UNKNOWN_INVAL_DEF_LEN 23
+#define LD_WHILE_NO_ENDWHILE (ag_text_strtable+4422)
+#define LD_WHILE_NO_ENDWHILE_LEN 18
+#define LD_WHILE_NO_EXPR (ag_text_strtable+4441)
+#define LD_WHILE_NO_EXPR_LEN 20
+#define LINE_CONCAT3_FMT (ag_text_strtable+4462)
+#define LINE_CONCAT3_FMT_LEN 8
+#define LISTEN_PORT_FMT (ag_text_strtable+4471)
+#define LISTEN_PORT_FMT_LEN 31
+#define LOAD_CGI_DEFS_MARKER (ag_text_strtable+4503)
+#define LOAD_CGI_DEFS_MARKER_LEN 21
+#define LOAD_CGI_GET_NAME (ag_text_strtable+4525)
+#define LOAD_CGI_GET_NAME_LEN 3
+#define LOAD_CGI_INVAL_REQ_FMT (ag_text_strtable+4529)
+#define LOAD_CGI_INVAL_REQ_FMT_LEN 34
+#define LOAD_CGI_NO_DATA_MSG (ag_text_strtable+4564)
+#define LOAD_CGI_NO_DATA_MSG_LEN 25
+#define LOAD_CGI_READ_NAME (ag_text_strtable+1522)
+#define LOAD_CGI_READ_NAME_LEN 4
+#define LOAD_CGI_READ_WHAT (ag_text_strtable+4590)
+#define LOAD_CGI_READ_WHAT_LEN 8
+#define LOAD_FILE_SHORT_NAME (ag_text_strtable+4674)
+#define LOAD_FILE_SHORT_NAME_LEN 35
+#define LOAD_MACS_BAD_PARSE (ag_text_strtable+4599)
+#define LOAD_MACS_BAD_PARSE_LEN 33
+#define LOAD_SCM_ENDLESS (ag_text_strtable+4633)
+#define LOAD_SCM_ENDLESS_LEN 40
+#define LOAD_TPL_CANNOT_MAP (ag_text_strtable+4710)
+#define LOAD_TPL_CANNOT_MAP_LEN 13
+#define LOAD_TPL_CANNOT_OPEN (ag_text_strtable+4724)
+#define LOAD_TPL_CANNOT_OPEN_LEN 28
+#define LOAD_TPL_CANNOT_STAT (ag_text_strtable+3023)
+#define LOAD_TPL_CANNOT_STAT_LEN 9
+#define LOAD_TPL_IRREGULAR (ag_text_strtable+4753)
+#define LOAD_TPL_IRREGULAR_LEN 16
+#define LOAD_TPL_SFX_AGL (ag_text_strtable+4770)
+#define LOAD_TPL_SFX_AGL_LEN 3
+#define LOAD_TPL_SFX_TPL (ag_text_strtable+4774)
+#define LOAD_TPL_SFX_TPL_LEN 3
+#define LOG_SEP_FMT (ag_text_strtable+4778)
+#define LOG_SEP_FMT_LEN 31
+#define MAKE_GPERF_CLEANUP (ag_text_strtable+4810)
+#define MAKE_GPERF_CLEANUP_LEN 31
+#define MAKE_SCRIPT_NL (ag_text_strtable+4842)
+#define MAKE_SCRIPT_NL_LEN 5
+#define MALLOC_FAIL_FMT (ag_text_strtable+4848)
+#define MALLOC_FAIL_FMT_LEN 27
+#define MEM_FILE_STR (ag_text_strtable+4876)
+#define MEM_FILE_STR_LEN 11
+#define MKSTEMP_FAIL_FMT (ag_text_strtable+4888)
+#define MKSTEMP_FAIL_FMT_LEN 22
+#define MK_GPERF_SCRIPT (ag_text_strtable+14344)
+#define MK_GPERF_SCRIPT_LEN 1179
+#define MK_HEAD_GUARD_GUARD (ag_text_strtable+4911)
+#define MK_HEAD_GUARD_GUARD_LEN 27
+#define MK_HEAD_GUARD_SCM (ag_text_strtable+4939)
+#define MK_HEAD_GUARD_SCM_LEN 52
+#define MK_LIC_BIG_OWN (ag_text_strtable+4992)
+#define MK_LIC_BIG_OWN_LEN 12
+#define MK_LIC_BIG_PFX (ag_text_strtable+5005)
+#define MK_LIC_BIG_PFX_LEN 13
+#define MK_LIC_BIG_PROG (ag_text_strtable+5019)
+#define MK_LIC_BIG_PROG_LEN 19
+#define MK_LIC_NOT_STR (ag_text_strtable+5039)
+#define MK_LIC_NOT_STR_LEN 28
+#define MK_LIC_NO_LIC (ag_text_strtable+5068)
+#define MK_LIC_NO_LIC_LEN 23
+#define MK_LIC_NO_OPEN (ag_text_strtable+5092)
+#define MK_LIC_NO_OPEN_LEN 32
+#define MK_LIC_OWN (ag_text_strtable+5125)
+#define MK_LIC_OWN_LEN 7
+#define MK_LIC_PFX (ag_text_strtable+5133)
+#define MK_LIC_PFX_LEN 5
+#define MK_LIC_PROG (ag_text_strtable+5139)
+#define MK_LIC_PROG_LEN 9
+#define MK_LIC_SFX (ag_text_strtable+3033)
+#define MK_LIC_SFX_LEN 3
+#define MK_LIC_TOO_BIG_FMT (ag_text_strtable+5149)
+#define MK_LIC_TOO_BIG_FMT_LEN 27
+#define MK_LIC_YRS (ag_text_strtable+5177)
+#define MK_LIC_YRS_LEN 7
+#define MK_STR_OCT_FMT (ag_text_strtable+5185)
+#define MK_STR_OCT_FMT_LEN 5
+#define MK_TMP_DIR_CMD (ag_text_strtable+5191)
+#define MK_TMP_DIR_CMD_LEN 38
+#define NAMED_VALUES_NO_NAME (ag_text_strtable+5230)
+#define NAMED_VALUES_NO_NAME_LEN 17
+#define NAMED_VALUES_WHERE (ag_text_strtable+5248)
+#define NAMED_VALUES_WHERE_LEN 27
+#define NEWLINE (ag_text_strtable+5276)
+#define NEWLINE_LEN 1
+#define NEXT_PM_TOKEN_INVALID (ag_text_strtable+5278)
+#define NEXT_PM_TOKEN_INVALID_LEN 25
+#define NOT_STR_FMT (ag_text_strtable+5351)
+#define NOT_STR_FMT_LEN 26
+#define NO_IF_EXPR (ag_text_strtable+5304)
+#define NO_IF_EXPR_LEN 17
+#define NO_NAME_STR (ag_text_strtable+5322)
+#define NO_NAME_STR_LEN 2
+#define NO_TEMPLATE_ERR_MSG (ag_text_strtable+5325)
+#define NO_TEMPLATE_ERR_MSG_LEN 25
+#define NULL_FILE_NAME_STR (ag_text_strtable+5378)
+#define NULL_FILE_NAME_STR_LEN 14
+#define OPEN_ERROR_FMT (ag_text_strtable+5393)
+#define OPEN_ERROR_FMT_LEN 37
+#define OPEN_OUTPUT_BAD_FMT (ag_text_strtable+5431)
+#define OPEN_OUTPUT_BAD_FMT_LEN 38
+#define OPEN_OUTPUT_NULL (ag_text_strtable+5470)
+#define OPEN_OUTPUT_NULL_LEN 4
+#define OUTPUT_NO_OPEN (ag_text_strtable+5475)
+#define OUTPUT_NO_OPEN_LEN 15
+#define OUTPUT_NO_UNLINK (ag_text_strtable+5491)
+#define OUTPUT_NO_UNLINK_LEN 6
+#define OUTPUT_TEMP_FILE (ag_text_strtable+5498)
+#define OUTPUT_TEMP_FILE_LEN 13
+#define OUT_ADD_INVALID (ag_text_strtable+5512)
+#define OUT_ADD_INVALID_LEN 34
+#define OUT_CLOSE_TRACE_WRAP (ag_text_strtable+5547)
+#define OUT_CLOSE_TRACE_WRAP_LEN 8
+#define OUT_PUSH_NEW_FAIL (ag_text_strtable+5556)
+#define OUT_PUSH_NEW_FAILED (ag_text_strtable+5567)
+#define OUT_PUSH_NEW_FAILED_LEN 34
+#define OUT_PUSH_NEW_FAIL_LEN 10
+#define OUT_RESUME_CANNOT (ag_text_strtable+5602)
+#define OUT_RESUME_CANNOT_LEN 46
+#define OUT_SUSPEND_CANNOT (ag_text_strtable+5649)
+#define OUT_SUSPEND_CANNOT_LEN 47
+#define OUT_SWITCH_FAIL (ag_text_strtable+5697)
+#define OUT_SWITCH_FAIL_LEN 7
+#define PARSE_INPUT_AG_DEF_STR (ag_text_strtable+5705)
+#define PARSE_INPUT_AG_DEF_STR_LEN 25
+#define PIPE_DEFS_STDIN_NAME (ag_text_strtable+5731)
+#define PIPE_DEFS_STDIN_NAME_LEN 5
+#define PIPE_DEFS_STDIN_STR (ag_text_strtable+1280)
+#define PIPE_DEFS_STDIN_STR_LEN 1
+#define PIPE_DUP2_NAME_STR (ag_text_strtable+5737)
+#define PIPE_DUP2_NAME_STR_LEN 4
+#define PIPE_FIFO_IN_NAME_FMT (ag_text_strtable+5742)
+#define PIPE_FIFO_IN_NAME_FMT_LEN 5
+#define PIPE_FIFO_OPEN (ag_text_strtable+1517)
+#define PIPE_FIFO_OPEN_LEN 4
+#define PIPE_FIFO_OUT_NAME_FMT (ag_text_strtable+5748)
+#define PIPE_FIFO_OUT_NAME_FMT_LEN 6
+#define PIPE_FORK_NAME (ag_text_strtable+5755)
+#define PIPE_FORK_NAME_LEN 4
+#define PIPE_MKFIFO_NAME (ag_text_strtable+5760)
+#define PIPE_MKFIFO_NAME_LEN 6
+#define PIPE_POLL_NAME_STR (ag_text_strtable+5767)
+#define PIPE_POLL_NAME_STR_LEN 4
+#define PIPE_WRITE_NAME_STR (ag_text_strtable+5772)
+#define PIPE_WRITE_NAME_STR_LEN 5
+#define PREFIX_FAIL (ag_text_strtable+5778)
+#define PREFIX_FAIL_LEN 19
+#define PREP_INVOKE_NO_NAME (ag_text_strtable+5798)
+#define PREP_INVOKE_NO_NAME_LEN 32
+#define PREP_INVOKE_NO_SEP (ag_text_strtable+5831)
+#define PREP_INVOKE_NO_SEP_LEN 41
+#define PRINT_DEF_SHOW_FMT (ag_text_strtable+5873)
+#define PRINT_DEF_SHOW_FMT_LEN 25
+#define PRINT_DEF_SPACES (ag_text_strtable+5899)
+#define PRINT_DEF_SPACES_LEN 32
+#define PROC_TPL_BOGUS_RET (ag_text_strtable+1940)
+#define PROC_TPL_BOGUS_RET_LEN 27
+#define PROC_TPL_START (ag_text_strtable+5932)
+#define PROC_TPL_START_LEN 21
+#define PSEUDO_MACRO_NAME_STR (ag_text_strtable+5954)
+#define PSEUDO_MACRO_NAME_STR_LEN 12
+#define PSEUDO_MAC_BAD_ENDER (ag_text_strtable+5967)
+#define PSEUDO_MAC_BAD_ENDER_LEN 36
+#define PSEUDO_MAC_BAD_FSM (ag_text_strtable+6004)
+#define PSEUDO_MAC_BAD_FSM_LEN 16
+#define PSEUDO_MAC_BAD_LENGTH (ag_text_strtable+6021)
+#define PSEUDO_MAC_BAD_LENGTH_LEN 29
+#define PSEUDO_MAC_BAD_MODE (ag_text_strtable+6051)
+#define PSEUDO_MAC_BAD_MODE_LEN 24
+#define PSEUDO_MAC_BAD_NOAG5 (ag_text_strtable+6076)
+#define PSEUDO_MAC_BAD_NOAG5_LEN 20
+#define PSEUDO_MAC_BAD_NOEND (ag_text_strtable+6097)
+#define PSEUDO_MAC_BAD_NOEND_LEN 15
+#define PSEUDO_MAC_BAD_NOEOL (ag_text_strtable+6113)
+#define PSEUDO_MAC_BAD_NOEOL_LEN 16
+#define PSEUDO_MAC_BAD_NOSTART (ag_text_strtable+6130)
+#define PSEUDO_MAC_BAD_NOSTART_LEN 17
+#define PSEUDO_MAC_BAD_NOTPL (ag_text_strtable+6148)
+#define PSEUDO_MAC_BAD_NOTPL_LEN 20
+#define PSEUDO_MAC_BAD_PSEUDO (ag_text_strtable+6169)
+#define PSEUDO_MAC_BAD_PSEUDO_LEN 23
+#define PSEUDO_MAC_BAD_STARTER (ag_text_strtable+6193)
+#define PSEUDO_MAC_BAD_STARTER_LEN 36
+#define PSEUDO_MAC_ERR_FMT (ag_text_strtable+6230)
+#define PSEUDO_MAC_ERR_FMT_LEN 41
+#define PSEUDO_MAC_MODE_MARK (ag_text_strtable+6272)
+#define PSEUDO_MAC_MODE_MARK_LEN 3
+#define PSEUDO_MAC_TPL_FILE (ag_text_strtable+6276)
+#define PSEUDO_MAC_TPL_FILE_LEN 15
+#define READY_INPUT_NODEF (ag_text_strtable+6292)
+#define READY_INPUT_NODEF_LEN 20
+#define READY_INPUT_NOT_REG (ag_text_strtable+6313)
+#define READY_INPUT_NOT_REG_LEN 21
+#define READY_INPUT_STAT (ag_text_strtable+6335)
+#define READY_INPUT_STAT_LEN 4
+#define READ_DEF_NO_DEFS (ag_text_strtable+6340)
+#define READ_DEF_NO_DEFS_LEN 28
+#define READ_DEF_OPEN (ag_text_strtable+1517)
+#define READ_DEF_OPEN_LEN 4
+#define READ_DEF_READ (ag_text_strtable+1522)
+#define READ_DEF_READ_LEN 4
+#define REALLOC_FAIL_FMT (ag_text_strtable+6369)
+#define REALLOC_FAIL_FMT_LEN 36
+#define REQUEST_METHOD (ag_text_strtable+6406)
+#define REQUEST_METHOD_LEN 14
+#define RESOLVE_SCM_EXACT (ag_text_strtable+6421)
+#define RESOLVE_SCM_EXACT_LEN 11
+#define RESOLVE_SCM_INEXACT (ag_text_strtable+6433)
+#define RESOLVE_SCM_INEXACT_LEN 13
+#define RESOLVE_SCM_LIST (ag_text_strtable+6447)
+#define RESOLVE_SCM_LIST_LEN 10
+#define RESOLVE_SCM_NUMBER (ag_text_strtable+664)
+#define RESOLVE_SCM_NUMBER_LEN 3
+#define RESOLVE_SCM_PAIR (ag_text_strtable+6458)
+#define RESOLVE_SCM_PAIR_LEN 10
+#define RESOLVE_SCM_PROC (ag_text_strtable+6469)
+#define RESOLVE_SCM_PROC_LEN 23
+#define RESOLVE_SCM_UNKNOWN (ag_text_strtable+6493)
+#define RESOLVE_SCM_UNKNOWN_LEN 13
+#define RESOLVE_SCM_VECTOR (ag_text_strtable+6507)
+#define RESOLVE_SCM_VECTOR_LEN 12
+#define RETURN_FROM_NOWHERE (ag_text_strtable+6520)
+#define RETURN_FROM_NOWHERE_LEN 21
+#define RUN_GPERF_CMD (ag_text_strtable+15524)
+#define RUN_GPERF_CMD_LEN 171
+#define RUN_PRINTF_HUH (ag_text_strtable+3165)
+#define RUN_PRINTF_HUH_LEN 13
+#define SAFE_PRINTF_BAD_ARGS (ag_text_strtable+6542)
+#define SAFE_PRINTF_BAD_ARGS_LEN 19
+#define SAFE_PRINTF_BAD_FMT (ag_text_strtable+6562)
+#define SAFE_PRINTF_BAD_FMT_LEN 44
+#define SCHEME_EVAL_ERR_FMT (ag_text_strtable+6607)
+#define SCHEME_EVAL_ERR_FMT_LEN 71
+#define SCHEME_INIT_DEBUG_1_6 (ag_text_strtable+3927)
+#define SCHEME_INIT_DEBUG_1_6_LEN 11
+#define SCHEME_INIT_DEBUG_2_0 (ag_text_strtable+3911)
+#define SCHEME_INIT_DEBUG_2_0_LEN 15
+#define SCHEME_INIT_TEXT (ag_text_strtable+9405)
+#define SCHEME_INIT_TEXT_LEN 3759
+#define SCM2ZCHARS_BAD_VAL (ag_text_strtable+6679)
+#define SCM2ZCHARS_BAD_VAL_LEN 49
+#define SCM_ERROR_FMT (ag_text_strtable+6729)
+#define SCM_ERROR_FMT_LEN 50
+#define SCM_FALSE_STR (ag_text_strtable+6780)
+#define SCM_FALSE_STR_LEN 2
+#define SCM_LIST_STR (ag_text_strtable+6783)
+#define SCM_LIST_STR_LEN 3
+#define SCM_OUT_POP_EMPTY (ag_text_strtable+6787)
+#define SCM_OUT_POP_EMPTY_LEN 48
+#define SCM_OUT_POP_NO_REREAD (ag_text_strtable+6836)
+#define SCM_OUT_POP_NO_REREAD_LEN 14
+#define SCM_PROC_CAST (ag_text_strtable+6851)
+#define SCM_PROC_CAST_LEN 5
+#define SCM_TRUE_STR (ag_text_strtable+6857)
+#define SCM_TRUE_STR_LEN 2
+#define SET_ORIG_DIR_NO_MEM_MSG (ag_text_strtable+6860)
+#define SET_ORIG_DIR_NO_MEM_MSG_LEN 25
+#define SET_TMP_DIR_CMD (ag_text_strtable+6886)
+#define SET_TMP_DIR_CMD_LEN 86
+#define SET_WRITE_WARN (ag_text_strtable+6973)
+#define SET_WRITE_WARN_LEN 84
+#define SFX_FMT (ag_text_strtable+7058)
+#define SFX_FMT_LEN 4
+#define SHELLF_BAD_ALIST_MSG (ag_text_strtable+7063)
+#define SHELLF_BAD_ALIST_MSG_LEN 23
+#define SHELL_CMD_FMT (ag_text_strtable+7087)
+#define SHELL_CMD_FMT_LEN 28
+#define SHELL_DIE_ON_SIGNAL_FMT (ag_text_strtable+7116)
+#define SHELL_DIE_ON_SIGNAL_FMT_LEN 41
+#define SHELL_INIT_STR (ag_text_strtable+13165)
+#define SHELL_INIT_STR_LEN 1178
+#define SHELL_LAST_CMD_MSG (ag_text_strtable+7158)
+#define SHELL_LAST_CMD_MSG_LEN 22
+#define SHELL_NO_END_MARK_MSG (ag_text_strtable+7181)
+#define SHELL_NO_END_MARK_MSG_LEN 18
+#define SHELL_READ_ERR_FMT (ag_text_strtable+7200)
+#define SHELL_READ_ERR_FMT_LEN 41
+#define SHELL_RESTART_MSG (ag_text_strtable+7242)
+#define SHELL_RESTART_MSG_LEN 16
+#define SHELL_RES_DISCARD_MSG (ag_text_strtable+7259)
+#define SHELL_RES_DISCARD_MSG_LEN 19
+#define SHELL_SET_PS4_FMT (ag_text_strtable+7279)
+#define SHELL_SET_PS4_FMT_LEN 22
+#define SHELL_UNK_LAST_CMD_MSG (ag_text_strtable+3165)
+#define SHELL_UNK_LAST_CMD_MSG_LEN 13
+#define SHELL_XTRACE_CMDS (ag_text_strtable+7302)
+#define SHELL_XTRACE_CMDS_LEN 35
+#define SH_DONE_MARK (ag_text_strtable+7338)
+#define SH_DONE_MARK_LEN 31
+#define START_DEP_ARG_FMT (ag_text_strtable+7370)
+#define START_DEP_ARG_FMT_LEN 6
+#define START_DEP_FILE_FMT (ag_text_strtable+7377)
+#define START_DEP_FILE_FMT_LEN 113
+#define START_DEP_FOPEN_MSG (ag_text_strtable+7491)
+#define START_DEP_FOPEN_MSG_LEN 15
+#define START_SCHEME_LIST (ag_text_strtable+7507)
+#define START_SCHEME_LIST_LEN 2
+#define STDIN_FILE_NAME (ag_text_strtable+5731)
+#define STDIN_FILE_NAME_LEN 5
+#define STRDUP_FAIL_FMT (ag_text_strtable+7510)
+#define STRDUP_FAIL_FMT_LEN 32
+#define STR_TO_C_MAP_FAIL (ag_text_strtable+7543)
+#define STR_TO_C_MAP_FAIL_LEN 44
+#define STR_TO_C_NAME (ag_text_strtable+7588)
+#define STR_TO_C_NAME_LEN 25
+#define SYSCALL_NAME (ag_text_strtable+7614)
+#define SYSCALL_NAME_LEN 7
+#define TAB_FILE_LINE_FMT (ag_text_strtable+7622)
+#define TAB_FILE_LINE_FMT_LEN 17
+#define TEMP_SUFFIX (ag_text_strtable+7640)
+#define TEMP_SUFFIX_LEN 9
+#define TOO_MANY_TIMEOUTS_MSG (ag_text_strtable+7650)
+#define TOO_MANY_TIMEOUTS_MSG_LEN 30
+#define TPL_FILE_LINE_FMT (ag_text_strtable+974)
+#define TPL_FILE_LINE_FMT_LEN 15
+#define TPL_FILE_NEXT_LINE_FMT (ag_text_strtable+2814)
+#define TPL_FILE_NEXT_LINE_FMT_LEN 13
+#define TPL_FILE_TPL (ag_text_strtable+4774)
+#define TPL_FILE_TPL_LEN 3
+#define TPL_INVOKED (ag_text_strtable+7681)
+#define TPL_INVOKED_LEN 39
+#define TPL_MARK (ag_text_strtable+7721)
+#define TPL_MARK_LEN 8
+#define TPL_WARN_FMT (ag_text_strtable+7730)
+#define TPL_WARN_FMT_LEN 36
+#define TRACE_ADD_SRC_FILE_FMT (ag_text_strtable+7767)
+#define TRACE_ADD_SRC_FILE_FMT_LEN 20
+#define TRACE_ADD_TARG_FILE_FMT (ag_text_strtable+7788)
+#define TRACE_ADD_TARG_FILE_FMT_LEN 20
+#define TRACE_ADD_TO_ENV_FMT (ag_text_strtable+7809)
+#define TRACE_ADD_TO_ENV_FMT_LEN 29
+#define TRACE_AG_ARG_FMT (ag_text_strtable+7839)
+#define TRACE_AG_ARG_FMT_LEN 5
+#define TRACE_BUILD_DEFS (ag_text_strtable+7845)
+#define TRACE_BUILD_DEFS_LEN 23
+#define TRACE_CASE_FAIL (ag_text_strtable+7869)
+#define TRACE_CASE_FAIL_LEN 31
+#define TRACE_CASE_MATCHED (ag_text_strtable+7901)
+#define TRACE_CASE_MATCHED_LEN 33
+#define TRACE_CASE_NOMATCH (ag_text_strtable+7935)
+#define TRACE_CASE_NOMATCH_LEN 32
+#define TRACE_COPY_MARK (ag_text_strtable+7968)
+#define TRACE_COPY_MARK_LEN 21
+#define TRACE_DEF_LOAD (ag_text_strtable+7990)
+#define TRACE_DEF_LOAD_LEN 17
+#define TRACE_EVAL_STRING (ag_text_strtable+8008)
+#define TRACE_EVAL_STRING_LEN 30
+#define TRACE_FIND_ENT (ag_text_strtable+8039)
+#define TRACE_FIND_ENT_LEN 12
+#define TRACE_FN_FOR (ag_text_strtable+8052)
+#define TRACE_FN_FOR_LEN 37
+#define TRACE_FN_FOR_REPEAT (ag_text_strtable+8090)
+#define TRACE_FN_FOR_REPEAT_LEN 25
+#define TRACE_FN_FOR_SKIP (ag_text_strtable+8116)
+#define TRACE_FN_FOR_SKIP_LEN 42
+#define TRACE_FN_IF (ag_text_strtable+8159)
+#define TRACE_FN_IF_LEN 43
+#define TRACE_FN_IF_NOTHING (ag_text_strtable+8203)
+#define TRACE_FN_IF_NOTHING_LEN 33
+#define TRACE_FN_INC_LINE (ag_text_strtable+7622)
+#define TRACE_FN_INC_LINE_LEN 17
+#define TRACE_FN_INC_TPL (ag_text_strtable+8237)
+#define TRACE_FN_INC_TPL_LEN 21
+#define TRACE_FN_REMAPPED (ag_text_strtable+8259)
+#define TRACE_FN_REMAPPED_LEN 40
+#define TRACE_FN_REMAP_BASE (ag_text_strtable+8300)
+#define TRACE_FN_REMAP_BASE_LEN 13
+#define TRACE_FN_REMAP_EXPR (ag_text_strtable+8314)
+#define TRACE_FN_REMAP_EXPR_LEN 4
+#define TRACE_FN_REMAP_INVOKE (ag_text_strtable+8319)
+#define TRACE_FN_REMAP_INVOKE_LEN 6
+#define TRACE_FN_WHILE_END (ag_text_strtable+8326)
+#define TRACE_FN_WHILE_END_LEN 30
+#define TRACE_FN_WHILE_START (ag_text_strtable+8357)
+#define TRACE_FN_WHILE_START_LEN 41
+#define TRACE_FOR_BY_STEP (ag_text_strtable+8399)
+#define TRACE_FOR_BY_STEP_LEN 62
+#define TRACE_FOR_STEP_TOO_FAR (ag_text_strtable+8462)
+#define TRACE_FOR_STEP_TOO_FAR_LEN 38
+#define TRACE_MACRO_DEF (ag_text_strtable+8501)
+#define TRACE_MACRO_DEF_LEN 26
+#define TRACE_MACRO_FMT (ag_text_strtable+8528)
+#define TRACE_MACRO_FMT_LEN 29
+#define TRACE_MATCH_VAL (ag_text_strtable+8558)
+#define TRACE_MATCH_VAL_LEN 18
+#define TRACE_MOVE_FMT (ag_text_strtable+8577)
+#define TRACE_MOVE_FMT_LEN 12
+#define TRACE_OPEN_OUT (ag_text_strtable+8590)
+#define TRACE_OPEN_OUT_LEN 16
+#define TRACE_OUT_DELETE (ag_text_strtable+8607)
+#define TRACE_OUT_DELETE_LEN 26
+#define TRACE_OUT_PUSH_NEW (ag_text_strtable+8634)
+#define TRACE_OUT_PUSH_NEW_LEN 19
+#define TRACE_OUT_SWITCH (ag_text_strtable+8654)
+#define TRACE_OUT_SWITCH_LEN 19
+#define TRACE_POP_FMT (ag_text_strtable+8674)
+#define TRACE_POP_FMT_LEN 8
+#define TRACE_RESUME (ag_text_strtable+8683)
+#define TRACE_RESUME_LEN 16
+#define TRACE_RM_SRC_FILE_FMT (ag_text_strtable+8700)
+#define TRACE_RM_SRC_FILE_FMT_LEN 23
+#define TRACE_RM_TARG_FILE_FMT (ag_text_strtable+8724)
+#define TRACE_RM_TARG_FILE_FMT_LEN 23
+#define TRACE_SEL_MATCH_FULL (ag_text_strtable+8748)
+#define TRACE_SEL_MATCH_FULL_LEN 33
+#define TRACE_SHELL_FIRST_START (ag_text_strtable+8782)
+#define TRACE_SHELL_FIRST_START_LEN 20
+#define TRACE_SHELL_PID_FMT (ag_text_strtable+8803)
+#define TRACE_SHELL_PID_FMT_LEN 23
+#define TRACE_SHELL_RESULT_MSG (ag_text_strtable+8827)
+#define TRACE_SHELL_RESULT_MSG_LEN 59
+#define TRACE_SHELL_STARTS_FMT (ag_text_strtable+8887)
+#define TRACE_SHELL_STARTS_FMT_LEN 23
+#define TRACE_START_FMT (ag_text_strtable+8911)
+#define TRACE_START_FMT_LEN 23
+#define TRACE_SUSPEND (ag_text_strtable+8935)
+#define TRACE_SUSPEND_LEN 14
+#define TRACE_TRAP_STATE_FMT (ag_text_strtable+8950)
+#define TRACE_TRAP_STATE_FMT_LEN 15
+#define TRACE_UNKNOWN_FMT (ag_text_strtable+8966)
+#define TRACE_UNKNOWN_FMT_LEN 16
+#define TRACE_VER_CONVERT (ag_text_strtable+8983)
+#define TRACE_VER_CONVERT_LEN 20
+#define TRACE_XTRACE_MSG (ag_text_strtable+9004)
+#define TRACE_XTRACE_MSG_LEN 17
+#define TRUE_NAME_STR (ag_text_strtable+9022)
+#define TRUE_NAME_STR_LEN 4
+#define UNAME_CALL_NAME (ag_text_strtable+9027)
+#define UNAME_CALL_NAME_LEN 8
+#define USAGE_INVAL_DEP_OPT_FMT (ag_text_strtable+9036)
+#define USAGE_INVAL_DEP_OPT_FMT_LEN 35
+#define USED_DEFINES_FMT (ag_text_strtable+9072)
+#define USED_DEFINES_FMT_LEN 97
+#define USED_DEFINES_LINE_FMT (ag_text_strtable+9170)
+#define USED_DEFINES_LINE_FMT_LEN 3
+#define WARN_STR (ag_text_strtable+9174)
+#define WARN_STR_LEN 7
+#define WORD_FORMAT (ag_text_strtable+9182)
+#define WORD_FORMAT_LEN 6
+#define YES_NAME_STR (ag_text_strtable+9189)
+#define YES_NAME_STR_LEN 3
+#define YYLEX_DF_STR (ag_text_strtable+9193)
+#define YYLEX_DF_STR_LEN 5
+#define YYLEX_ERR_FMT (ag_text_strtable+9199)
+#define YYLEX_ERR_FMT_LEN 158
+#define YYLEX_TOKEN_STR (ag_text_strtable+9358)
+#define YYLEX_TOKEN_STR_LEN 12
+#define YYLEX_UNENDING_QUOTE (ag_text_strtable+9371)
+#define YYLEX_UNENDING_QUOTE_LEN 32
+#define zNil (ag_text_strtable+9404)
+#define zNil_LEN 0
+extern char const ag_text_strtable[15696];
+
+#define SCHEME_INIT_TEXT_LINENO 506
+
+#endif /* STRINGS_AG_TEXT_H_GUARD */
diff --git a/agen5/agCgi.c b/agen5/agCgi.c
new file mode 100644
index 0000000..641988d
--- /dev/null
+++ b/agen5/agCgi.c
@@ -0,0 +1,172 @@
+
+/**
+ * @file agCgi.c
+ *
+ * Time-stamp: "2012-03-04 19:19:12 bkorb"
+ *
+ * This is a CGI wrapper for AutoGen. It will take POST-method
+ * name-value pairs and emit AutoGen definitions to a spawned
+ * AutoGen process.
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+typedef struct {
+ char const* pzName;
+ char* pzValue;
+} tNameMap;
+
+#define ENV_TABLE \
+ _ET_(SERVER_SOFTWARE) \
+ _ET_(SERVER_NAME) \
+ _ET_(GATEWAY_INTERFACE) \
+ _ET_(SERVER_PROTOCOL) \
+ _ET_(SERVER_PORT) \
+ _ET_(REQUEST_METHOD) \
+ _ET_(PATH_INFO) \
+ _ET_(PATH_TRANSLATED) \
+ _ET_(SCRIPT_NAME) \
+ _ET_(QUERY_STRING) \
+ _ET_(REMOTE_HOST) \
+ _ET_(REMOTE_ADDR) \
+ _ET_(AUTH_TYPE) \
+ _ET_(REMOTE_USER) \
+ _ET_(REMOTE_IDENT) \
+ _ET_(CONTENT_TYPE) \
+ _ET_(CONTENT_LENGTH) \
+ _ET_(HTTP_ACCEPT) \
+ _ET_(HTTP_USER_AGENT) \
+ _ET_(HTTP_REFERER)
+
+static tNameMap nameValueMap[] = {
+#define _ET_(n) { #n, NULL },
+ ENV_TABLE
+#undef _ET_
+ { NULL, NULL }
+};
+
+typedef enum {
+#define _ET_(n) n ## _IDX,
+ ENV_TABLE
+#undef _ET_
+ NAME_CT
+} tNameIdx;
+
+#define pzCgiMethod nameValueMap[ REQUEST_METHOD_IDX ].pzValue
+#define pzCgiQuery nameValueMap[ QUERY_STRING_IDX ].pzValue
+#define pzCgiLength nameValueMap[ CONTENT_LENGTH_IDX ].pzValue
+
+/* = = = START-STATIC-FORWARD = = = */
+static char*
+parseInput(char* pzSrc, int len);
+/* = = = END-STATIC-FORWARD = = = */
+
+LOCAL void
+loadCgi(void)
+{
+ /*
+ * Redirect stderr to a file. If it gets used, we must trap it
+ * and emit the content-type: preamble before actually emitting it.
+ * First, tho, do a simple stderr->stdout redirection just in case
+ * we stumble before we're done with this.
+ */
+ dup2(STDOUT_FILENO, STDERR_FILENO);
+ (void)fdopen(STDERR_FILENO, "w" FOPEN_BINARY_FLAG);
+ oops_pfx = CGI_ERR_MSG_FMT;
+ {
+ int tmpfd;
+ AGDUPSTR(cgi_stderr, CGI_TEMP_ERR_FILE_STR, "stderr file");
+ tmpfd = mkstemp(cgi_stderr);
+ if (tmpfd < 0)
+ AG_ABEND(aprf(MKSTEMP_FAIL_FMT, cgi_stderr));
+ dup2(tmpfd, STDERR_FILENO);
+ close(tmpfd);
+ }
+
+ /*
+ * Pull the CGI-relevant environment variables. Anything we don't find
+ * gets an empty string default.
+ */
+ {
+ tNameMap* pNM = nameValueMap;
+ tNameIdx ix = (tNameIdx)0;
+
+ do {
+ pNM->pzValue = getenv(pNM->pzName);
+ if (pNM->pzValue == NULL)
+ pNM->pzValue = (char*)zNil;
+ } while (pNM++, ++ix < NAME_CT);
+ }
+
+ base_ctx = (scan_ctx_t*)AGALOC(sizeof(scan_ctx_t), "CGI ctx");
+ memset((void*)base_ctx, 0, sizeof(scan_ctx_t));
+
+ {
+ size_t textLen = strtoul(pzCgiLength, NULL, 0);
+ char* pzText;
+
+ if (strcasecmp(pzCgiMethod, "POST") == 0) {
+ if (textLen == 0)
+ AG_ABEND(LOAD_CGI_NO_DATA_MSG);
+
+ pzText = AGALOC(textLen + 1, "CGI POST");
+ if (fread(pzText, (size_t)1, textLen, stdin) != textLen)
+ AG_CANT(LOAD_CGI_READ_NAME, LOAD_CGI_READ_WHAT);
+
+ pzText[ textLen ] = NUL;
+
+ base_ctx->scx_data = parseInput(pzText, (int)textLen);
+ AGFREE(pzText);
+
+ } else if (strcasecmp(pzCgiMethod, LOAD_CGI_GET_NAME) == 0) {
+ if (textLen == 0)
+ textLen = strlen(pzCgiQuery);
+ base_ctx->scx_data = parseInput(pzCgiQuery, (int)textLen);
+
+ } else {
+ AG_ABEND(aprf(LOAD_CGI_INVAL_REQ_FMT, pzCgiMethod));
+ /* NOTREACHED */
+#ifdef WARNING_WATCH
+ pzText = NULL;
+#endif
+ }
+ }
+
+ base_ctx->scx_line = 1;
+ base_ctx->scx_fname = LOAD_CGI_DEFS_MARKER;
+ base_ctx->scx_scan = base_ctx->scx_data;
+}
+
+
+static char*
+parseInput(char* pzSrc, int len)
+{
+# define defLen (sizeof("Autogen Definitions cgi;\n") - 1)
+ char* pzRes = AGALOC((len * 2) + defLen + 1, "CGI Definitions");
+
+ memcpy(pzRes, PARSE_INPUT_AG_DEF_STR, defLen);
+ (void)cgi_run_fsm(pzSrc, len, pzRes + defLen, len*2);
+ return AGREALOC(pzRes, strlen(pzRes)+1, "CGI input");
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/agCgi.c */
diff --git a/agen5/agDep.c b/agen5/agDep.c
new file mode 100644
index 0000000..06665d4
--- /dev/null
+++ b/agen5/agDep.c
@@ -0,0 +1,447 @@
+
+/**
+ * @file tpDep.c
+ *
+ * Time-stamp: "2012-04-07 09:01:06 bkorb"
+ *
+ * This module will load a template and return a template structure.
+ *
+ * This file is part of AutoGen.
+ * Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+typedef struct flist flist_t;
+struct flist {
+ flist_t * next;
+ char fname[1];
+};
+
+static flist_t * src_flist = NULL;
+static flist_t * targ_flist = NULL;
+
+/**
+ * Add a source file to the dependency list
+ *
+ * @param pz pointer to file name
+ */
+LOCAL void
+add_source_file(char const * pz)
+{
+ flist_t ** lp;
+
+ /*
+ * If a source is also a target, then we've created it.
+ * Do not list in source dependencies.
+ */
+ lp = &targ_flist;
+ while (*lp != NULL) {
+ if (strcmp(pz, (*lp)->fname) == 0)
+ return;
+ lp = &((*lp)->next);
+ }
+
+ /*
+ * No check for duplicate in source list. Add if not found.
+ */
+ lp = &src_flist;
+ while (*lp != NULL) {
+ if (strcmp(pz, (*lp)->fname) == 0)
+ return;
+ lp = &((*lp)->next);
+ }
+
+ {
+ size_t l = strlen(pz);
+ flist_t * p = AGALOC(sizeof(*p) + l, "sfile");
+ *lp = p;
+ p->next = NULL;
+ memcpy(p->fname, pz, l + 1);
+ if (OPT_VALUE_TRACE >= TRACE_SERVER_SHELL)
+ fprintf(trace_fp, TRACE_ADD_SRC_FILE_FMT, p->fname);
+ }
+}
+
+/**
+ * remove a source file from the dependency list
+ *
+ * @param pz pointer to file name
+ */
+LOCAL void
+rm_source_file(char const * pz)
+{
+ flist_t ** pp = &src_flist; //!< point to where to stash removed "next"
+ flist_t ** lp = &src_flist; //!< list scanning pointer
+
+ for (;;) {
+ if (*lp == NULL)
+ return;
+ if (strcmp(pz, (*lp)->fname) == 0)
+ break;
+ pp = lp;
+ lp = &((*lp)->next);
+ }
+ {
+ flist_t * p = *lp;
+ *pp = p->next;
+ if (OPT_VALUE_TRACE >= TRACE_SERVER_SHELL)
+ fprintf(trace_fp, TRACE_RM_SRC_FILE_FMT, p->fname);
+ AGFREE(p);
+ }
+}
+
+/**
+ * Add a target file to the dependency list. Avoid files in temp directories.
+ *
+ * @param pz pointer to file name
+ */
+LOCAL void
+add_target_file(char const * pz)
+{
+ flist_t ** lp;
+
+ /*
+ * Skip anything stashed in the temp directory.
+ */
+ if ( (temp_tpl_dir_len > 0)
+ && (strncmp(pz, pz_temp_tpl, temp_tpl_dir_len) == 0)
+ && (pz[temp_tpl_dir_len] == NUL))
+ return;
+
+ /*
+ * Target files override sources, just in case.
+ * (We sometimes extract from files we are about to replace.)
+ */
+ rm_source_file(pz);
+
+ /*
+ * avoid duplicates and add to end of list
+ */
+ lp = &targ_flist;
+ while (*lp != NULL) {
+ if (strcmp(pz, (*lp)->fname) == 0)
+ return;
+ lp = &((*lp)->next);
+ }
+
+ {
+ size_t l = strlen(pz);
+ flist_t * p = AGALOC(sizeof(*p) + l, "tfile");
+ *lp = p;
+ p->next = NULL;
+ memcpy(p->fname, pz, l + 1);
+ if (OPT_VALUE_TRACE >= TRACE_SERVER_SHELL)
+ fprintf(trace_fp, TRACE_ADD_TARG_FILE_FMT, p->fname);
+ }
+}
+
+/**
+ * Remove a target file from the dependency list
+ *
+ * @param pz pointer to file name
+ */
+LOCAL void
+rm_target_file(char const * pz)
+{
+ flist_t ** lp = &targ_flist; //!< list scanning pointer
+
+ for (;;) {
+ if (*lp == NULL)
+ return;
+ if (strcmp(pz, (*lp)->fname) == 0)
+ break;
+ lp = &((*lp)->next);
+ }
+ {
+ flist_t * p = *lp;
+ *lp = p->next;
+ if (OPT_VALUE_TRACE >= TRACE_SERVER_SHELL)
+ fprintf(trace_fp, TRACE_RM_TARG_FILE_FMT, p->fname);
+ AGFREE(p);
+ }
+}
+
+/**
+ * Create a dependency output file
+ */
+LOCAL void
+start_dep_file(void)
+{
+
+ /*
+ * Set dep_file to a temporary file name
+ */
+ {
+ char * tfile_name;
+ size_t dep_name_len;
+
+ if (dep_file == NULL) {
+ dep_name_len = strlen(OPT_ARG(BASE_NAME));
+ tfile_name = AGALOC(dep_name_len + TEMP_SUFFIX_LEN + 1, "dfileb");
+ memcpy(tfile_name, OPT_ARG(BASE_NAME), dep_name_len);
+ memcpy(tfile_name + dep_name_len, TEMP_SUFFIX,
+ TEMP_SUFFIX_LEN + 1);
+
+ } else {
+ dep_name_len = strlen(dep_file);
+ tfile_name = AGALOC(dep_name_len + TEMP_SUFFIX_LEN, "dfile");
+ memcpy(tfile_name, dep_file, dep_name_len);
+ memcpy(tfile_name + dep_name_len, TEMP_SUFFIX + 2,
+ TEMP_SUFFIX_LEN - 1);
+ }
+
+ if (dep_target == NULL) {
+ /*
+ * If there is no target name, then the target is our output file.
+ */
+ char * q = AGALOC(dep_name_len + 1, "t-name");
+ dep_target = q;
+ memcpy(q, tfile_name, dep_name_len);
+ q[dep_name_len] = NUL;
+ }
+
+ mkstemp(tfile_name);
+ dep_file = tfile_name;
+ }
+
+ /*
+ * Create the file and write the leader.
+ */
+ dep_fp = fopen(dep_file, "w");
+
+ if (dep_fp == NULL)
+ AG_CANT(START_DEP_FOPEN_MSG, dep_file);
+
+ fprintf(dep_fp, START_DEP_FILE_FMT, autogenOptions.pzProgPath);
+
+ {
+ int ac = autogenOptions.origArgCt - 1;
+ char ** av = autogenOptions.origArgVect + 1;
+
+ for (;;) {
+ char * arg = *(av++);
+ fprintf(dep_fp, START_DEP_ARG_FMT, arg);
+ if (--ac == 0) break;
+ fputs(DEP_FILE_SPLICE_STR, dep_fp);
+ }
+ fputs("\n", dep_fp);
+ }
+
+ {
+ char const * pnm = autogenOptions.pzPROGNAME;
+ char const * bnm = strchr(dep_target, '/');
+ char * pz;
+
+ if (bnm != NULL)
+ bnm++;
+ else
+ bnm = dep_target;
+
+ {
+ size_t sz = strlen(pnm) + strlen(bnm) + 2; // underscore + NUL
+
+ pz_targ_base = pz = AGALOC(sz, "t list");
+ sprintf(pz, DEP_FILE_TARG_FMT, pnm, bnm);
+ }
+
+ /*
+ * Now scan over the characters in "pz_targ_base". Anything that
+ * is not a legal name character gets replaced with an underscore.
+ */
+ for (;;) {
+ unsigned int ch = (unsigned int)*(pz++);
+ if (ch == NUL)
+ break;
+ if (! IS_ALPHANUMERIC_CHAR(ch))
+ pz[-1] = '_';
+ }
+ }
+}
+
+/**
+ * Set modification time and rename into result file name.
+ */
+static void
+tidy_dep_file(void)
+{
+ static mode_t const fil_mode =
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
+
+ /*
+ * Trim off the temporary suffix and rename the dependency file into
+ * place. We used a mkstemp name in case autogen failed.
+ */
+ do {
+ char * pze = strrchr(dep_file, '-');
+ char * pzn;
+ size_t len;
+
+ if (pze == NULL) break;
+
+ len = (pze - dep_file);
+ pzn = AGALOC(len + 1, "dep file");
+ memcpy(pzn, dep_file, len);
+ pzn[len] = NUL;
+
+ unlink(pzn);
+ rename(dep_file, pzn);
+ AGFREE(dep_file);
+ dep_file = pzn;
+ } while (false);
+
+#ifdef HAVE_FCHMOD
+ fchmod(fileno(dep_fp), fil_mode);
+ fclose(dep_fp);
+#else
+ fclose(dep_fp);
+ chmod(dep_file, fil_mode);
+#endif
+ dep_fp = NULL;
+
+ {
+ struct utimbuf tbuf = {
+ .actime = time(NULL),
+ .modtime = start_time
+ };
+
+ utime(dep_file, &tbuf);
+
+ /*
+ * If the target is not the dependency file, then ensure that the
+ * file exists and set its time to the same time. Ignore all errors.
+ */
+ if (strcmp(dep_file, dep_target) != 0) {
+ if (access(dep_target, R_OK) != 0)
+ close( open(dep_target, O_CREAT, fil_mode));
+
+ utime(dep_target, &tbuf);
+ AGFREE(dep_target);
+ }
+ }
+
+ AGFREE(dep_file);
+}
+
+/**
+ * Print out and free a list of files.
+ */
+static void
+print_list(flist_t * flist, char const * TMPDIR, size_t tmpdir_len)
+{
+ /*
+ * Omit temporary sources. They are identified several ways:
+ * 1. the file must be accessible
+ * 2. the file must not match our temporary file template
+ * 3. the file must not match TMPDIR from the environment
+ */
+ while (flist != NULL) {
+ flist_t * p = flist;
+
+ do {
+ if (access(p->fname, R_OK) != 0)
+ break; // no longer accessible
+
+ if ( (temp_tpl_dir_len > 0)
+ && (strncmp(pz_temp_tpl, p->fname, temp_tpl_dir_len) == 0)
+ && (p->fname[temp_tpl_dir_len] == DIRCH))
+ break; // autogen temp file
+
+ if ( (strncmp(TMPDIR, p->fname, tmpdir_len) == 0)
+ && (p->fname[tmpdir_len] == DIRCH) )
+ break; // TMPDIR directory file
+
+ fprintf(dep_fp, DEP_List, p->fname);
+ } while (false);
+
+ flist = p->next;
+ AGFREE(p);
+ }
+}
+
+/**
+ * Finish off the dependency file. Write out the lists of files,
+ * a rule to fulfill make's needs and, optionally, clean up rules.
+ * then close the file and tidy up.
+ */
+LOCAL void
+wrap_up_depends(void)
+{
+ char const * TMPDIR = getenv("TMPDIR");
+ size_t tmpdir_len;
+ if (TMPDIR != NULL) {
+ tmpdir_len = strlen(TMPDIR);
+ } else {
+ TMPDIR = "/tmp";
+ tmpdir_len = 4;
+ }
+
+ fprintf(dep_fp, DEP_TList, pz_targ_base);
+ print_list(targ_flist, TMPDIR, tmpdir_len);
+
+ fprintf(dep_fp, DEP_SList, pz_targ_base);
+ print_list(src_flist, TMPDIR, tmpdir_len);
+
+ targ_flist = src_flist = NULL;
+ fprintf(dep_fp, DEP_FILE_WRAP_FMT, pz_targ_base, dep_target);
+
+ if (dep_phonies) {
+ /*
+ * Remove the target file name IFF it is different from
+ * the dependency file name. The dependency file will not be
+ * removed, but it will be sent waaay back in time.
+ */
+ char * p, *q;
+ AGDUPSTR(p, dep_file, "xx");
+
+ q = p + strlen(p) - (TEMP_SUFFIX_LEN - 2);
+ if ((q > p) && (*q == '-'))
+ *q = NUL;
+ q = p;
+
+ /* DO NOT REMOVE DEPENDENCY FILE */
+ if (strcmp(dep_target, p) == 0)
+ p = (char *)zNil;
+ fprintf(dep_fp, DEP_FILE_CLEAN_FMT, dep_target, pz_targ_base, p);
+ AGFREE(q);
+ }
+
+#if 0
+ if (serv_id != NULLPROCESS) {
+ char * pz = shell_cmd("echo ${AG_Dep_File}");
+ if (*pz != NUL) {
+ /*
+ * The target we are crating will now depend upon the target
+ * created by the spawned autogen run. That spawned run script
+ * is responsible for ensuring that if there are multiple targets,
+ * then they are all chained together so we only worry about one.
+ */
+ static char const incfmt[] =
+ "\n%s : %s\ninclude %s\n";
+ static char const targ[] = ".targ";
+ size_t ln = strlen(pz);
+ char * pt = AGALOC(ln + sizeof(targ), targ);
+ if (strcmp(pz + ln - 4, ".dep") == 0)
+ ln -= 4;
+ memcpy(pt, pz, ln);
+ memcpy(pt + ln, targ, sizeof(targ));
+ fprintf(dep_fp, incfmt, dep_target, pt, pz);
+ AGFREE(pt);
+ }
+
+ AGFREE(pz);
+ }
+#endif
+ tidy_dep_file();
+}
diff --git a/agen5/agInit.c b/agen5/agInit.c
new file mode 100644
index 0000000..ac322bc
--- /dev/null
+++ b/agen5/agInit.c
@@ -0,0 +1,684 @@
+
+/**
+ * @file agInit.c
+ *
+ * Do all the initialization stuff. For daemon mode, only
+ * children will return.
+ *
+ * Time-stamp: "2012-04-14 08:54:02 bkorb"
+ *
+ * This file is part of AutoGen.
+ * Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static char const *
+make_quote_str(char const * str);
+
+static void
+dep_usage(char const * fmt, ...);
+
+static void
+add_sys_env(char * env_name);
+
+static void
+add_env_vars(void);
+/* = = = END-STATIC-FORWARD = = = */
+
+#ifdef DAEMON_ENABLED
+ static bool evalProto(char const ** ppzS, uint16_t* pProto);
+ static void spawnPipe(char const* pzFile);
+ static void spawnListens(char const * pzPort, sa_family_t af);
+ static void daemonize(char const *, char const *, char const *,
+ char const *);
+#endif
+
+#include "expr.ini"
+
+/**
+ * Various initializations.
+ *
+ * @param arg_ct the count of program arguments, plus 1.
+ * @param arg_vec the program name plus its arguments
+ */
+LOCAL void
+initialize(int arg_ct, char** arg_vec)
+{
+ ag_scribble_init();
+
+ /*
+ * Initialize all the Scheme functions.
+ */
+ ag_init();
+ last_scm_cmd = SCHEME_INIT_TEXT;
+ ag_scm_c_eval_string_from_file_line(
+ SCHEME_INIT_TEXT, AG_TEXT_STRTABLE_FILE, SCHEME_INIT_TEXT_LINENO);
+
+ {
+#if GUILE_VERSION > 200000
+ static char const * const module = SCHEME_INIT_DEBUG_2_0;
+#else
+ static char const * const module = SCHEME_INIT_DEBUG_1_6;
+#endif
+ char * p = aprf(INIT_SCM_ERRS_FMT, module);
+ last_scm_cmd = p;
+ ag_scm_c_eval_string_from_file_line(p, __FILE__, __LINE__);
+ AGFREE(p);
+ }
+
+ last_scm_cmd = NULL;
+ processing_state = PROC_STATE_OPTIONS;
+ add_env_vars();
+
+ process_ag_opts(arg_ct, arg_vec);
+ exit_code = AUTOGEN_EXIT_LOAD_ERROR;
+
+ if (OPT_VALUE_TRACE > TRACE_NOTHING)
+ SCM_EVAL_CONST(INIT_SCM_DEBUG_FMT);
+
+#ifdef DAEMON_ENABLED
+
+ if (! HAVE_OPT(DAEMON))
+ return;
+
+#ifdef DEBUG_ENABLED
+ {
+ static char const logf[] = "/tmp/ag-debug.txt";
+ daemonize("/", logf, logf, logf);
+ }
+#else
+ daemonize("/", DEV_NULL, DEV_NULL, DEV_NULL);
+#endif /* DEBUG_ENABLED */
+
+ {
+ sa_family_t af = AF_INET;
+ char const * pzS = OPT_ARG(DAEMON);
+
+ if (evalProto(&pzS, &af))
+ spawnListens(pzS, af);
+ else
+ spawnPipe(pzS);
+ }
+#endif /* DAEMON_ENABLED */
+}
+
+/**
+ * make a name resilient to machinations made by 'make'.
+ * Basically, dollar sign characters are doubled.
+ *
+ * @param str the input string
+ * @returns a newly allocated string with the '$' characters doubled
+ */
+static char const *
+make_quote_str(char const * str)
+{
+ size_t sz = strlen(str) + 1;
+ char const * scan = str;
+ char * res;
+
+ for (;;) {
+ char * p = strchr(scan, '$');
+ if (p == NULL)
+ break;
+ sz++;
+ scan = scan + 1;
+ }
+
+ res = AGALOC(sz, "q name");
+ scan = res;
+
+ for (;;) {
+ char * p = strchr(str, '$');
+
+ if (p == NULL)
+ break;
+ sz = (p - str) + 1;
+ memcpy(res, str, sz);
+ res += sz;
+ str += sz;
+ *(res++) = '$';
+ }
+
+ strcpy(res, str);
+ return scan;
+}
+
+/**
+ * Error in dependency specification
+ *
+ * @param fmt the error message format
+ */
+static void
+dep_usage(char const * fmt, ...)
+{
+ char * msg;
+
+ {
+ va_list ap;
+ va_start(ap, fmt);
+ (void)vasprintf(&msg, fmt, ap);
+ va_end(ap);
+ }
+
+ usage_message(USAGE_INVAL_DEP_OPT_FMT, msg);
+ /* NOTREACHED */
+}
+
+/**
+ * Configure a dependency option.
+ * Handles any of these letters: MFQTPGD as the first part of the option
+ * argument.
+ *
+ * @param opts the autogen options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+LOCAL void
+config_dep(tOptions * opts, tOptDesc * od)
+{
+ char const * opt_arg = od->optArg.argString;
+ (void)opts;
+
+ /*
+ * The option argument is optional. Make sure we have one.
+ */
+ if (opt_arg == NULL)
+ return;
+
+ while (*opt_arg == 'M') opt_arg++;
+ opt_arg = SPN_WHITESPACE_CHARS(opt_arg);
+
+ switch (*opt_arg) {
+ case 'F':
+ if (dep_file != NULL)
+ dep_usage(CFGDEP_DUP_TARGET_MSG);
+
+ opt_arg = SPN_WHITESPACE_CHARS(opt_arg + 1);
+ AGDUPSTR(dep_file, opt_arg, "f name");
+ break;
+
+ case 'Q':
+ case 'T':
+ {
+ bool quote_it = (*opt_arg == 'Q');
+
+ if (dep_target != NULL)
+ dep_usage(CFGDEP_DUP_TARGET_MSG);
+
+ opt_arg = SPN_WHITESPACE_CHARS(opt_arg + 1);
+ if (quote_it)
+ dep_target = make_quote_str(opt_arg);
+ else
+ AGDUPSTR(dep_target, opt_arg, "t name");
+ break;
+ }
+
+ case 'P':
+ dep_phonies = true;
+ break;
+
+ case 'D':
+ case 'G':
+ case NUL:
+ /*
+ * 'D' and 'G' make sense to GCC, not us. Ignore 'em. If we
+ * found a NUL byte, then act like we found -MM on the command line.
+ */
+ break;
+
+ default:
+ dep_usage(CFGDEP_UNKNOWN_DEP_FMT, opt_arg);
+ }
+}
+
+/**
+ * Add a system name to the environment. The input name is up-cased and
+ * made to conform to environment variable names. If not already in the
+ * environment, it is added with the string value "1".
+ *
+ * @param env_name in/out: system name to export
+ */
+static void
+add_sys_env(char * env_name)
+{
+ int i = 2;
+
+ for (;;) {
+ if (IS_UPPER_CASE_CHAR(env_name[i]))
+ env_name[i] = tolower(env_name[i]);
+ else if (! IS_ALPHANUMERIC_CHAR(env_name[i]))
+ env_name[i] = '_';
+
+ if (env_name[ ++i ] == NUL)
+ break;
+ }
+
+ /*
+ * If the user already has something in the environment, do not
+ * override it.
+ */
+ if (getenv(env_name) == NULL) {
+ char* pz;
+
+ if (OPT_VALUE_TRACE > TRACE_DEBUG_MESSAGE)
+ fprintf(trace_fp, TRACE_ADD_TO_ENV_FMT, env_name);
+
+ pz = aprf(ADD_SYS_ENV_VAL_FMT, env_name);
+ putenv(pz);
+ }
+}
+
+/**
+ * Define system environment variables. "__autogen__=1" is exported,
+ * along with various ones derivable from Solaris sysinfo(3p) or uname.
+ */
+static void
+add_env_vars(void)
+{
+ /*
+ * Set the last resort search directories first (lowest priority)
+ * The lowest of the low is the config time install data dir.
+ * Next is the *current* directory of this executable.
+ */
+ SET_OPT_TEMPL_DIRS(DFT_TPL_DIR_DATA);
+ SET_OPT_TEMPL_DIRS(DFT_TPL_DIR_RELATIVE);
+
+ {
+ char z[ SCRIBBLE_SIZE ] = "__autogen__";
+#if defined(HAVE_SOLARIS_SYSINFO)
+ static const int nm[] = {
+ SI_SYSNAME, SI_HOSTNAME, SI_ARCHITECTURE, SI_HW_PROVIDER,
+#ifdef SI_PLATFORM
+ SI_PLATFORM,
+#endif
+ SI_MACHINE };
+ int ix;
+ long sz;
+
+ add_sys_env(z);
+ for (ix = 0; ix < sizeof(nm)/sizeof(nm[0]); ix++) {
+ sz = sysinfo(nm[ix], z+2, sizeof(z) - 2);
+ if (sz > 0) {
+ sz += 2;
+ while (z[sz-1] == NUL) sz--;
+ strcpy(z + sz, ADD_ENV_VARS_SUFFIX_FMT+2);
+ add_sys_env(z);
+ }
+ }
+
+#elif defined(HAVE_UNAME_SYSCALL)
+ struct utsname unm;
+
+ add_sys_env(z);
+ if (uname(&unm) != 0)
+ AG_CANT(UNAME_CALL_NAME, SYSCALL_NAME);
+
+ sprintf(z+2, ADD_ENV_VARS_SUFFIX_FMT, unm.sysname);
+ add_sys_env(z);
+
+ sprintf(z+2, ADD_ENV_VARS_SUFFIX_FMT, unm.machine);
+ add_sys_env(z);
+
+ sprintf(z+2, ADD_ENV_VARS_SUFFIX_FMT, unm.nodename);
+ add_sys_env(z);
+#else
+
+ add_sys_env(z);
+#endif
+ }
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * T H E F O L L O W I N G I S D E A D C O D E
+ *
+ * Someday, I want to enable daemon code, but need lotsa time.....
+ *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#ifdef DAEMON_ENABLED
+
+ static bool
+evalProto(char const ** ppzS, uint16_t* pProto)
+{
+ char const * pzS = *ppzS;
+
+ if (IS_ALPHABETIC_CHAR(*pzS)) {
+ inet_family_map_t* pMap = inet_family_map;
+ do {
+ if (strncmp(pzS, pMap->pz_name, pMap->nm_len) == 0) {
+ *pProto = pMap->family;
+ *ppzS += pMap->nm_len;
+ return true;
+ }
+ } while ((++pMap)->pz_name != NULL);
+ }
+
+ return IS_DEC_DIGIT_CHAR(*pzS);
+}
+
+ LOCAL void
+handleSighup(int sig)
+{
+ redoOptions = true;
+}
+
+ static void
+spawnPipe(char const * pzFile)
+{
+# define S_IRW_ALL \
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH
+ fd_pair_t fdpair;
+ char* pzIn;
+ char* pzOut;
+
+ {
+ size_t len = 2 * (strlen(pzFile) + 5);
+ pzIn = AGALOC(len + 5, "fifo name");
+ pzOut = pzIn + sprintf(pzIn, PIPE_FIFO_IN_NAME_FMT, pzFile) + 1;
+ }
+
+ unlink(pzIn);
+ if ((mkfifo(pzIn, S_IRW_ALL) != 0) && (errno != EEXIST))
+ AG_CANT(PIPE_MKFIFO_NAME, pzIn);
+
+ (void)sprintf(pzOut, PIPE_FIFO_OUT_NAME_FMT, pzFile);
+ unlink(pzOut);
+ if ((mkfifo(pzOut, S_IRW_ALL) != 0) && (errno != EEXIST))
+ AG_CANT(PIPE_MKFIFO_NAME, pzOut);
+
+ fdpair.fd_read = open(pzIn, O_RDONLY);
+ if (fdpair.fd_read < 0)
+ AG_CANT(PIPE_FIFO_OPEN, pzIn);
+
+ {
+ struct pollfd polls[1];
+ polls[0].fd = fdpair.fd_read;
+ polls[0].events = POLLIN | POLLPRI;
+
+ for (;;) {
+ int ct = poll(polls, 1, -1);
+ struct strrecvfd recvfd;
+ pid_t child;
+
+ switch (ct) {
+ case -1:
+ if ((errno != EINTR) || (! redoOptions))
+ goto spawnpipe_finish;
+
+ optionRestore(&autogenOptions);
+ process_ag_opts(autogenOptions.origArgCt,
+ autogenOptions.origArgVect);
+ SET_OPT_DEFINITIONS(PIPE_DEFS_STDIN_STR);
+ break;
+
+ case 1:
+ if ((polls[0].revents & POLLIN) == 0)
+ continue;
+
+ child = fork();
+ switch (child) {
+ default:
+ waitpid(child, &ct, 0);
+ continue;
+
+ case -1:
+ AG_CANT(PIPE_FORK_NAME, zNil);
+
+ case 0:
+ }
+
+ if (dup2(fdpair.fd_read, STDIN_FILENO) != STDIN_FILENO)
+ AG_CANT(PIPE_DUP2_NAME_STR, PIPE_DEFS_STDIN_NAME);
+
+ fdpair.fd_write = open(pzOut, O_WRONLY);
+ if (fdpair.fd_write < 0)
+ AG_CANT(PIPE_FIFO_OPEN, pzOut);
+
+ polls[0].fd = fdpair.fd_write;
+ polls[0].events = POLLOUT;
+ if (poll(polls, 1, -1) != 1)
+ AG_CANT(PIPE_POLL_NAME_STR, PIPE_WRITE_NAME_STR);
+
+ if (dup2(fdpair.fd_write, STDOUT_FILENO) != STDOUT_FILENO)
+ AG_CANT(PIPE_DUP2_NAME_STR, pzOut);
+
+ return;
+ }
+ }
+ }
+
+ spawnpipe_finish:
+ unlink(pzIn);
+ unlink(pzOut);
+ AGFREE(pzIn);
+
+# undef S_IRW_ALL
+
+ exit(EXIT_SUCCESS);
+}
+
+
+ static void
+spawnListens(char const * pzPort, sa_family_t addr_family)
+{
+ int socket_fd = socket(addr_family, SOCK_STREAM, 0);
+ union {
+ struct sockaddr addr;
+ struct sockaddr_in in_addr;
+ struct sockaddr_un un_addr;
+ } sa;
+
+ uint32_t addr_len;
+
+ if (socket_fd < 0)
+ AG_CANT("socket", "AF_INET/SOCK_STREAM");
+
+ switch (addr_family) {
+
+ case AF_UNIX:
+ {
+ uint32_t p_len = strlen(pzPort);
+
+ if (p_len > sizeof(sa.un_addr.sun_path))
+ AG_ABEND(aprf("AF_UNIX path exceeds %d", p_len));
+ sa.un_addr.sun_family = AF_UNIX;
+ strncpy(sa.un_addr.sun_path, pzPort, p_len);
+ addr_len = sizeof(sa.un_addr) - sizeof(sa.un_addr.sun_path) + p_len;
+ }
+ break;
+
+ case AF_INET:
+ {
+ uint16_t port;
+ char* pz;
+
+ sa.in_addr.sin_family = AF_INET;
+ sa.in_addr.sin_addr.s_addr = INADDR_ANY;
+
+ errno = 0;
+ if ((unlink(pzPort) != 0) && (errno != ENOENT))
+ AG_CANT("unlink", pzPort);
+
+ port = (uint16_t)strtol(pzPort, &pz, 0);
+ if ((errno != 0) || (*pz != NUL))
+ AG_ABEND(aprf("Invalid port number: '%s'", pzPort));
+
+ sa.in_addr.sin_port = htons((short)port);
+ addr_len = sizeof(sa.in_addr);
+ }
+ break;
+
+ default:
+ AG_ABEND(aprf("The '%d' address family cannot be handled",
+ addr_family));
+ }
+
+ if (bind(socket_fd, &sa.addr, addr_len) < 0) {
+ char* pz = aprf(LISTEN_PORT_FMT, pzPort, addr_family);
+ AG_CANT("bind", pz);
+ }
+
+ if (fcntl(socket_fd, F_SETFL, O_NONBLOCK) < 0)
+ AG_CANT("socket-fcntl", "FNDELAY");
+
+ if (listen(socket_fd, 5) < 0)
+ AG_CANT("listen", aprf(LISTEN_PORT_FMT, pzPort));
+
+ for (;;) {
+ fd_set fds;
+ int max_fd = socket_fd;
+ int new_conns;
+
+ FD_ZERO(&fds);
+ FD_SET(socket_fd, &fds);
+
+ new_conns = select(max_fd, &fds, NULL, NULL, NULL);
+ if (new_conns < 0) {
+ if (errno == EINTR)
+ continue;
+
+ if (! redoOptions) {
+ unlink(pzPort);
+ exit(EXIT_SUCCESS);
+ }
+
+ optionRestore(&autogenOptions);
+ process_ag_opts(autogenOptions.origArgCt,
+ autogenOptions.origArgVect);
+ SET_OPT_DEFINITIONS("-");
+
+ continue;
+ }
+
+ if (new_conns > 0) {
+ switch (fork()) {
+ default: continue;
+ case -1:
+ AG_CANT("fork", zNil);
+
+ case 0: break;
+ }
+ break;
+ }
+ }
+
+ for (;;) {
+ static int try_ct = 0;
+ struct sockaddr addr;
+ socklen_t addr_len;
+ int fd = accept(socket_fd, &addr, &addr_len);
+ if (fd < 0)
+ switch (errno) {
+ case EINTR:
+ case EAGAIN:
+#if (EAGAIN != EWOULDBLOCK)
+ case EWOULDBLOCK:
+#endif
+ if (try_ct++ < 10000) {
+ sleep(1);
+ continue;
+ }
+ }
+ socket_fd = fd;
+ break;
+ }
+
+ if (dup2(socket_fd, STDOUT_FILENO) != STDOUT_FILENO)
+ AG_CANT("dup2", "out on socket_fd");
+ if (dup2(socket_fd, STDIN_FILENO) != STDIN_FILENO)
+ AG_CANT("dup2", "in on socket_fd");
+}
+
+
+ static void
+daemonize(char const * pzStdin, char const * pzStdout, char const * pzStderr,
+ char const * pzDaemonDir)
+{
+ static char const zNoFork[] = "Error %d while forking: %s\n";
+ /*
+ * Become a daemon process by exiting the current process
+ * and allowing the child to continue. Also, change stdin,
+ * stdout and stderr to point to /dev/null and change to
+ * the root directory ('/').
+ */
+ {
+ int ret = fork();
+
+ switch (ret) {
+ case -1:
+ fprintf(stderr, zNoFork, errno, strerror(errno));
+ default:
+ exit(ret);
+
+ case 0:
+ break;
+ }
+ }
+
+ /*
+ * Now, become a process group and session group leader.
+ */
+ if (setsid() == -1) {
+ fprintf(stderr, "Error %d setting session ID: %s\n",
+ errno, strerror(errno));
+ exit(99);
+ }
+
+ /*
+ * There is now no controlling terminal. However, if we open anything
+ * that resembles a terminal, it will become our controlling terminal.
+ * So, we will fork again and the child will not be a group leader and
+ * thus cannot gain a controlling terminal.
+ */
+ switch (fork()) {
+ case -1:
+ fprintf(stderr, zNoFork, errno, strerror(errno));
+ exit(99);
+
+ case 0:
+ break;
+
+ default:
+ exit(EXIT_SUCCESS); /* parent process - silently go away */
+ }
+
+ umask(0);
+ if (pzDaemonDir == (char*)NULL)
+ pzDaemonDir = "/";
+
+ chdir(pzDaemonDir);
+
+ /*
+ * Reopen the input, output and error files, unless we were told not to
+ */
+ if (pzStdin != (char*)NULL)
+ freopen(pzStdin, "r", stdin);
+
+ if (pzStdout != (char*)NULL)
+ freopen(pzStdout, "w", stdout);
+
+ if (pzStderr != (char*)NULL)
+ freopen(pzStderr, "w", stderr);
+
+ /* We are a daemon now */
+}
+#endif /* DAEMON_ENABLED */
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/agInit.c */
diff --git a/agen5/agShell.c b/agen5/agShell.c
new file mode 100644
index 0000000..80bcbdd
--- /dev/null
+++ b/agen5/agShell.c
@@ -0,0 +1,695 @@
+/**
+ * @file agShell.c
+ *
+ * Time-stamp: "2012-03-04 19:08:09 bkorb"
+ *
+ * Manage a server shell process
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+static char * cur_dir = NULL;
+
+/*=gfunc chdir
+ *
+ * what: Change current directory
+ *
+ * exparg: dir, new directory name
+ *
+ * doc: Sets the current directory for AutoGen. Shell commands will run
+ * from this directory as well. This is a wrapper around the Guile
+ * native function. It returns its directory name argument and
+ * fails the program on failure.
+=*/
+SCM
+ag_scm_chdir(SCM dir)
+{
+ static char const zChdirDir[] = "chdir directory";
+
+ scm_chdir(dir);
+
+ /*
+ * We're still here, so we have a valid argument.
+ */
+ if (cur_dir != NULL)
+ free(cur_dir);
+ {
+ char const * pz = ag_scm2zchars(dir, zChdirDir);
+ cur_dir = malloc(AG_SCM_STRLEN(dir) + 1);
+ strcpy((char*)cur_dir, pz);
+ }
+ return dir;
+}
+
+/*=gfunc shell
+ *
+ * what: invoke a shell script
+ * general_use:
+ *
+ * exparg: command, shell command - the result value is the stdout output.
+ *
+ * doc:
+ * Generate a string by writing the value to a server shell and reading the
+ * output back in. The template programmer is responsible for ensuring that
+ * it completes within 10 seconds. If it does not, the server will be
+ * killed, the output tossed and a new server started.
+ *
+ * Please note: This is the same server process used by the '#shell'
+ * definitions directive and backquoted @code{`} definitions. There may be
+ * left over state from previous shell expressions and the @code{`}
+ * processing in the declarations. However, a @code{cd} to the original
+ * directory is always issued before the new command is issued.
+ *
+ * Also note: When initializing, autogen will set the environment
+ * variable "AGexe" to the full path of the autogen executable.
+=*/
+SCM
+ag_scm_shell(SCM cmd)
+{
+#ifndef SHELL_ENABLED
+ return cmd;
+#else
+ if (! AG_SCM_STRING_P(cmd))
+ return SCM_UNDEFINED;
+ {
+ char* pz = shell_cmd(ag_scm2zchars(cmd, "command"));
+ cmd = AG_SCM_STR02SCM(pz);
+ AGFREE((void*)pz);
+ return cmd;
+ }
+#endif
+}
+
+/*=gfunc shellf
+ *
+ * what: format a string, run shell
+ * general_use:
+ *
+ * exparg: format, formatting string
+ * exparg: format-arg, list of arguments to formatting string, opt, list
+ *
+ * doc: Format a string using arguments from the alist,
+ * then send the result to the shell for interpretation.
+=*/
+SCM
+ag_scm_shellf(SCM fmt, SCM alist)
+{
+ int len = scm_ilength(alist);
+ char* pz;
+
+#ifdef DEBUG_ENABLED
+ if (len < 0)
+ AG_ABEND(SHELLF_BAD_ALIST_MSG);
+#endif
+
+ pz = ag_scm2zchars(fmt, "format");
+ fmt = run_printf(pz, len, alist);
+
+#ifdef SHELL_ENABLED
+ pz = shell_cmd(ag_scm2zchars(fmt, "shell script"));
+ fmt = AG_SCM_STR02SCM(pz);
+ AGFREE((void*)pz);
+#endif
+ return fmt;
+}
+
+#ifndef SHELL_ENABLED
+HIDE_FN(void closeServer(void) {;})
+
+HIDE_FN(char * shell_cmd(char const* pzCmd)) {
+ char* pz;
+ AGDUPSTR(pz, pzCmd, "dummy shell command");
+ return pz;
+}
+#else
+
+/*
+ * Dual pipe opening of a child process
+ */
+static fp_pair_t serv_pair = { NULL, NULL };
+static pid_t serv_id = NULLPROCESS;
+static bool was_close_err = false;
+static int log_ct = 0;
+static char const * last_cmd = NULL;
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+handle_signal(int signo);
+
+static void
+set_orig_dir(void);
+
+static bool
+send_cmd_ok(char const * cmd);
+
+static void
+start_server_cmd_trace(void);
+
+static void
+send_server_init_cmds(void);
+
+static void
+server_setup(void);
+
+static int
+chain_open(int in_fd, char const ** arg_v, pid_t * child_pid);
+
+static pid_t
+server_open(fd_pair_t * fd_pair, char const ** ppArgs);
+
+static pid_t
+server_fp_open(fp_pair_t * fp_pair, char const ** ppArgs);
+
+static inline void
+realloc_text(char ** p_txt, size_t * p_sz, size_t need_len);
+
+static char*
+load_data(void);
+/* = = = END-STATIC-FORWARD = = = */
+
+LOCAL void
+close_server_shell(void)
+{
+ if (serv_id == NULLPROCESS)
+ return;
+
+ (void)kill(serv_id, SIGTERM);
+#ifdef HAVE_USLEEP
+ usleep(100000); /* 1/10 of a second */
+#else
+ sleep(1);
+#endif
+ (void)kill(serv_id, SIGKILL);
+ serv_id = NULLPROCESS;
+
+ /*
+ * This guard should not be necessary. However, sometimes someone
+ * holds an allocation pthread lock when a seg fault occurrs. fclose
+ * needs that lock, so we hang waiting for it. Oops. So, when we
+ * are aborting, we just let the OS close these file descriptors.
+ */
+ if (processing_state != PROC_STATE_ABORTING) {
+ (void)fclose(serv_pair.fp_read);
+ /*
+ * This is _completely_ wrong, but sometimes there are data left
+ * hanging about that gets sucked up by the _next_ server shell
+ * process. That should never, ever be in any way possible, but
+ * it is the only explanation for a second server shell picking up
+ * the initialization string twice. It must be a broken timing
+ * issue in the Linux stdio code. I have no other explanation.
+ */
+ fflush(serv_pair.fp_write);
+ (void)fclose(serv_pair.fp_write);
+ }
+
+ serv_pair.fp_read = serv_pair.fp_write = NULL;
+}
+
+/**
+ * handle SIGALRM and SIGPIPE signals while waiting for server shell
+ * responses.
+ */
+static void
+handle_signal(int signo)
+{
+ static int timeout_limit = 5;
+ if ((signo == SIGALRM) && (--timeout_limit <= 0))
+ AG_ABEND(TOO_MANY_TIMEOUTS_MSG);
+
+ fprintf(trace_fp, SHELL_DIE_ON_SIGNAL_FMT, strsignal(signo), signo);
+ was_close_err = true;
+
+ (void)fputs(SHELL_LAST_CMD_MSG, trace_fp);
+ {
+ char const* pz = (last_cmd == NULL)
+ ? SHELL_UNK_LAST_CMD_MSG : last_cmd;
+ fprintf(trace_fp, SHELL_CMD_FMT, cur_dir, pz, SH_DONE_MARK, log_ct);
+ }
+ last_cmd = NULL;
+ close_server_shell();
+}
+
+/**
+ * first time starting a server shell, we get our current directory.
+ * That value is kept, but may be changed via a (chdir "...") scheme call.
+ */
+static void
+set_orig_dir(void)
+{
+ char * p = malloc(AG_PATH_MAX);
+ if (p == NULL)
+ AG_ABEND(SET_ORIG_DIR_NO_MEM_MSG);
+
+ cur_dir = getcwd(p, AG_PATH_MAX);
+
+ if (OPT_VALUE_TRACE >= TRACE_SERVER_SHELL)
+ fputs(TRACE_SHELL_FIRST_START, trace_fp);
+}
+
+/**
+ * Send a command string down to the server shell
+ */
+static bool
+send_cmd_ok(char const * cmd)
+{
+ last_cmd = cmd;
+ fprintf(serv_pair.fp_write, SHELL_CMD_FMT, cur_dir, last_cmd,
+ SH_DONE_MARK, ++log_ct);
+
+ if (OPT_VALUE_TRACE >= TRACE_SERVER_SHELL) {
+ fprintf(trace_fp, LOG_SEP_FMT, log_ct);
+ fprintf(trace_fp, SHELL_CMD_FMT, cur_dir, last_cmd,
+ SH_DONE_MARK, log_ct);
+ }
+
+ (void)fflush(serv_pair.fp_write);
+ if (was_close_err)
+ fprintf(trace_fp, CMD_FAIL_FMT, cmd);
+ return ! was_close_err;
+}
+
+/**
+ * Tracing level is TRACE_EVERYTHING, so send the server shell
+ * various commands to start "set -x" tracing and display the
+ * trap actions.
+ */
+static void
+start_server_cmd_trace(void)
+{
+ fputs(TRACE_XTRACE_MSG, trace_fp);
+ if (send_cmd_ok(SHELL_XTRACE_CMDS)) {
+ char * pz = load_data();
+ fputs(SHELL_RES_DISCARD_MSG, trace_fp);
+ fprintf(trace_fp, TRACE_TRAP_STATE_FMT, pz);
+ AGFREE((void*)pz);
+ }
+}
+
+/**
+ * Send down the initialization string with our PID in it, as well
+ * as the full path name of the autogen executable.
+ */
+static void
+send_server_init_cmds(void)
+{
+ was_close_err = false;
+
+ {
+ char * pzc = AGALOC(SHELL_INIT_STR_LEN
+ + 11 // log10(1 << 32) + 1
+ + strlen(autogenOptions.pzProgPath),
+ "server init");
+ sprintf(pzc, SHELL_INIT_STR, (unsigned int)getpid(),
+ autogenOptions.pzProgPath,
+ (dep_fp == NULL) ? "" : dep_file);
+
+ if (send_cmd_ok(pzc))
+ AGFREE((void*)load_data());
+ AGFREE(pzc);
+ }
+
+ if (OPT_VALUE_TRACE >= TRACE_SERVER_SHELL)
+ fputs(SHELL_RES_DISCARD_MSG, trace_fp);
+
+ if (OPT_VALUE_TRACE >= TRACE_EVERYTHING)
+ start_server_cmd_trace();
+}
+
+/**
+ * Perform various initializations required when starting
+ * a new server shell process.
+ */
+static void
+server_setup(void)
+{
+ if (cur_dir == NULL)
+ set_orig_dir();
+ else if (OPT_VALUE_TRACE >= TRACE_SERVER_SHELL)
+ fputs(SHELL_RESTART_MSG, trace_fp);
+
+ {
+ struct sigaction new_sa;
+ new_sa.sa_handler = handle_signal;
+ new_sa.sa_flags = 0;
+ (void)sigemptyset(&new_sa.sa_mask);
+ (void)sigaction(SIGPIPE, &new_sa, NULL);
+ (void)sigaction(SIGALRM, &new_sa, NULL);
+ }
+
+ send_server_init_cmds();
+
+ last_cmd = NULL;
+}
+
+/**
+ * Given an FD for an inferior process to use as stdin,
+ * start that process and return a NEW FD that that process
+ * will use for its stdout. Requires the argument vector
+ * for the new process and, optionally, a pointer to a place
+ * to store the child's process id.
+ *
+ * @param stdinFd the file descriptor for the process' stdin
+ * @param ppArgs The program and argument vector
+ * @param pChild where to stash the child process PID
+ *
+ * @returns the read end of a pipe the child process uses for stdout
+ */
+static int
+chain_open(int in_fd, char const ** arg_v, pid_t * child_pid)
+{
+ fd_pair_t out_pair = { -1, -1 };
+ pid_t ch_pid;
+ char const * shell;
+
+ /*
+ * If we did not get an arg list, use the default
+ */
+ if (arg_v == NULL)
+ arg_v = server_args;
+
+ /*
+ * If the arg list does not have a program,
+ * assume the zShellProg from the environment, or, failing
+ * that, then sh. Set argv[0] to whatever we decided on.
+ */
+ if (shell = *arg_v,
+ (shell == NULL) || (*shell == NUL))
+
+ *arg_v = shell = shell_program;
+
+ /*
+ * Create a pipe it will be the child process' stdout,
+ * and the parent will read from it.
+ */
+ if (pipe((int*)&out_pair) < 0) {
+ if (child_pid != NULL)
+ *child_pid = NOPROCESS;
+ return -1;
+ }
+
+ /*
+ * Make sure our standard streams are all flushed out before forking.
+ * (avoid duplicate output). Call fork() and see which process we become
+ */
+ fflush(stdout);
+ fflush(stderr);
+ if (trace_fp != stderr)
+ fflush(trace_fp);
+
+ ch_pid = fork();
+ switch (ch_pid) {
+ case NOPROCESS: /* parent - error in call */
+ close(in_fd);
+ close(out_pair.fd_read);
+ close(out_pair.fd_write);
+ if (child_pid != NULL)
+ *child_pid = NOPROCESS;
+ return -1;
+
+ default: /* parent - return opposite FD's */
+ if (child_pid != NULL)
+ *child_pid = ch_pid;
+
+ close(in_fd);
+ close(out_pair.fd_write);
+ if (OPT_VALUE_TRACE >= TRACE_SERVER_SHELL) {
+ fprintf(trace_fp, TRACE_SHELL_PID_FMT, (unsigned int)ch_pid);
+ fflush(trace_fp);
+ }
+
+ return out_pair.fd_read;
+
+ case NULLPROCESS: /* child - continue processing */
+ break;
+ }
+
+ /*
+ * Close the pipe end handed back to the parent process,
+ * plus stdin and stdout.
+ */
+ close(out_pair.fd_read);
+ close(STDIN_FILENO);
+ close(STDOUT_FILENO);
+
+ /*
+ * Set stdin/out to the fd passed in and the write end of our new pipe.
+ */
+ fcntl(out_pair.fd_write, F_DUPFD, STDOUT_FILENO);
+ fcntl(in_fd, F_DUPFD, STDIN_FILENO);
+
+ /*
+ * set stderr to our trace file (if not stderr).
+ */
+ if (trace_fp != stderr) {
+ close(STDERR_FILENO);
+ fcntl(fileno(trace_fp), F_DUPFD, STDERR_FILENO);
+ }
+
+ /*
+ * Make the output file unbuffered only.
+ * We do not want to wait for shell output buffering.
+ */
+ setvbuf(stdout, NULL, _IONBF, (size_t)0);
+
+ if (OPT_VALUE_TRACE >= TRACE_SERVER_SHELL) {
+ fprintf(trace_fp, TRACE_SHELL_STARTS_FMT, shell);
+
+ fflush(trace_fp);
+ }
+
+ execvp((char*)shell, (char**)arg_v);
+ AG_CANT("execvp", shell);
+ /* NOTREACHED */
+ return -1;
+}
+
+/**
+ * Given a pointer to an argument vector, start a process and
+ * place its stdin and stdout file descriptors into an fd pair
+ * structure. The "fd_write" connects to the inferior process
+ * stdin, and the "fd_read" connects to its stdout. The calling
+ * process should write to "fd_write" and read from "fd_read".
+ * The return value is the process id of the created process.
+ */
+static pid_t
+server_open(fd_pair_t * fd_pair, char const ** ppArgs)
+{
+ pid_t chId = NOPROCESS;
+
+ /*
+ * Create a bi-directional pipe. Writes on 0 arrive on 1
+ * and vice versa, so the parent and child processes will
+ * read and write to opposite FD's.
+ */
+ if (pipe((int*)fd_pair) < 0)
+ return NOPROCESS;
+
+ fd_pair->fd_read = chain_open(fd_pair->fd_read, ppArgs, &chId);
+ if (chId == NOPROCESS)
+ close(fd_pair->fd_write);
+
+ return chId;
+}
+
+
+/**
+ * Identical to "server_open()", except that the "fd"'s are "fdopen(3)"-ed
+ * into file pointers instead.
+ */
+static pid_t
+server_fp_open(fp_pair_t * fp_pair, char const ** ppArgs)
+{
+ fd_pair_t fd_pair;
+ pid_t chId = server_open(&fd_pair, ppArgs);
+
+ if (chId == NOPROCESS)
+ return chId;
+
+ fp_pair->fp_read = fdopen(fd_pair.fd_read, "r" FOPEN_BINARY_FLAG);
+ fp_pair->fp_write = fdopen(fd_pair.fd_write, "w" FOPEN_BINARY_FLAG);
+ return chId;
+}
+
+static inline void
+realloc_text(char ** p_txt, size_t * p_sz, size_t need_len)
+{
+ *p_sz = (*p_sz + need_len + 0xFFF) & ~0xFFF;
+ *p_txt = AGREALOC((void*)*p_txt, *p_sz, "expand text");
+}
+
+/**
+ * Read data from a file pointer (a pipe to a process in this context)
+ * until we either get EOF or we get a marker line back.
+ * The read data are stored in a malloc-ed string that is truncated
+ * to size at the end. Input is assumed to be an ASCII string.
+ */
+static char*
+load_data(void)
+{
+ char* text;
+ size_t text_sz = 4096;
+ size_t used_ct = 0;
+ char* scan;
+ char zLine[ 1024 ];
+ int retry_ct = 0;
+#define LOAD_RETRY_LIMIT 4
+
+ scan = text = AGALOC(text_sz, "Text Block");
+ *text = NUL;
+
+ for (;;) {
+ char * line_p;
+
+ /*
+ * Set a timeout so we do not wait forever. Sometimes we don't wait
+ * at all and we should. Retry in those cases (but not on EOF).
+ */
+ alarm((unsigned int)OPT_VALUE_TIMEOUT);
+ line_p = fgets(zLine, (int)sizeof(zLine), serv_pair.fp_read);
+ alarm(0);
+
+ if (line_p == NULL) {
+ /*
+ * Guard against a server timeout
+ */
+ if (serv_id == NULLPROCESS)
+ break;
+
+ if ((OPT_VALUE_TRACE >= TRACE_SERVER_SHELL) || (retry_ct++ > 0))
+ fprintf(trace_fp, SHELL_READ_ERR_FMT, errno, strerror(errno));
+
+ if (feof(serv_pair.fp_read) || (retry_ct > LOAD_RETRY_LIMIT))
+ break;
+
+ continue; /* no data - retry */
+ }
+
+ /*
+ * Check for magic character sequence indicating 'DONE'
+ */
+ if (strncmp(zLine, SH_DONE_MARK, SH_DONE_MARK_LEN) == 0)
+ break;
+
+ {
+ size_t llen = strlen(zLine);
+ if (text_sz <= used_ct + llen) {
+ realloc_text(&text, &text_sz, llen);
+ scan = text + used_ct;
+ }
+
+ memcpy(scan, zLine, llen);
+ used_ct += llen;
+ scan += llen;
+ }
+
+ /*
+ * Stop now if server timed out or if we are at EOF
+ */
+ if ((serv_id == NULLPROCESS) || feof(serv_pair.fp_read)) {
+ fputs(SHELL_NO_END_MARK_MSG, trace_fp);
+ break;
+ }
+ }
+
+ /*
+ * Trim off all trailing white space and shorten the buffer
+ * to the size actually used.
+ */
+ while ( (scan > text)
+ && IS_WHITESPACE_CHAR(scan[-1]))
+ scan--;
+ text_sz = (scan - text) + 1;
+ *scan = NUL;
+
+ if (OPT_VALUE_TRACE >= TRACE_SERVER_SHELL)
+ fprintf(trace_fp, TRACE_SHELL_RESULT_MSG,
+ (int)text_sz, text, zLine);
+
+ return AGREALOC((void*)text, text_sz, "resize output");
+#undef LOAD_RETRY_LIMIT
+}
+
+/**
+ * Run a semi-permanent server shell. The program will be the
+ * one named by the environment variable $SHELL, or default to "sh".
+ * If one of the commands we send to it takes too long or it dies,
+ * we will shoot it and restart one later.
+ *
+ * @param cmd the input command string
+ * @returns an allocated string, even if it is empty.
+ */
+LOCAL char *
+shell_cmd(char const * cmd)
+{
+ /*
+ * IF the shell server process is not running yet,
+ * THEN try to start it.
+ */
+ if (serv_id == NULLPROCESS) {
+ putenv((char *)SHELL_SET_PS4_FMT);
+ serv_id = server_fp_open(&serv_pair, server_args);
+ if (serv_id > 0)
+ server_setup();
+ }
+
+ /*
+ * IF it is still not running,
+ * THEN return the nil string.
+ */
+ if (serv_id <= 0) {
+ char* pz = (char*)AGALOC(1, "Text Block");
+
+ *pz = NUL;
+ return pz;
+ }
+
+ /*
+ * Make sure the process will pay attention to us,
+ * send the supplied command, and then
+ * have it output a special marker that we can find.
+ */
+ if (! send_cmd_ok(cmd))
+ return NULL;
+
+ /*
+ * Now try to read back all the data. If we fail due to either
+ * a sigpipe or sigalrm (timeout), we will return the nil string.
+ */
+ {
+ char* pz = load_data();
+ if (pz == NULL) {
+ fprintf(trace_fp, CMD_FAIL_FMT, cmd);
+ close_server_shell();
+ pz = (char*)AGALOC(1, "Text Block");
+
+ *pz = NUL;
+
+ } else if (was_close_err)
+ fprintf(trace_fp, CMD_FAIL_FMT, cmd);
+
+ last_cmd = NULL;
+ return pz;
+ }
+}
+
+#endif /* ! SHELL_ENABLED */
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/agShell.c */
diff --git a/agen5/agUtils.c b/agen5/agUtils.c
new file mode 100644
index 0000000..a774c09
--- /dev/null
+++ b/agen5/agUtils.c
@@ -0,0 +1,564 @@
+/**
+ * @file agUtils.c
+ *
+ * Various utilities for AutoGen.
+ *
+ * Time-stamp: "2012-03-10 13:11:54 bkorb"
+ *
+ * This file is part of AutoGen.
+ * Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+define_base_name(void);
+
+static void
+put_defines_into_env(void);
+
+static char const *
+skip_quote(char const * qstr);
+/* = = = END-STATIC-FORWARD = = = */
+
+/**
+ * Allocating printf function. It either works or kills the program.
+ * @param[in] pzFmt the input format
+ * @returns the allocated, formatted result string.
+ */
+LOCAL char *
+aprf(char const * pzFmt, ...)
+{
+ char* pz;
+ va_list ap;
+ va_start(ap, pzFmt);
+ (void)vasprintf(&pz, pzFmt, ap);
+ va_end(ap);
+
+ if (pz == NULL) {
+ char z[ 2 * SCRIBBLE_SIZE ];
+ snprintf(z, sizeof(z), APRF_ALLOCATE_FAIL, pzFmt);
+ AG_ABEND(z);
+ }
+ return pz;
+}
+
+/**
+ * Figure out what base name to use. --base-name was not specified.
+ * Base it on the definitions file, if available.
+ */
+static void
+define_base_name(void)
+{
+ char const * pz;
+ char* pzD;
+
+ if (! ENABLED_OPT(DEFINITIONS)) {
+ OPT_ARG(BASE_NAME) = DFT_BASE_NAME;
+ return;
+ }
+
+ pz = strrchr(OPT_ARG(DEFINITIONS), '/');
+ /*
+ * Point to the character after the last '/', or to the full
+ * definition file name, if there is no '/'.
+ */
+ pz = (pz == NULL) ? OPT_ARG(DEFINITIONS) : (pz + 1);
+
+ /*
+ * IF input is from stdin, then use "stdin"
+ */
+ if ((pz[0] == '-') && (pz[1] == NUL)) {
+ OPT_ARG(BASE_NAME) = STDIN_FILE_NAME;
+ return;
+ }
+
+ /*
+ * Otherwise, use the basename of the definitions file
+ */
+ OPT_ARG(BASE_NAME) = \
+ pzD = AGALOC(strlen(pz)+1, "derived base");
+
+ while ((*pz != NUL) && (*pz != '.')) *(pzD++) = *(pz++);
+ *pzD = NUL;
+}
+
+/**
+ * Put the -D option arguments into the environment.
+ * This makes them accessible to Guile/Scheme code, too.
+ */
+static void
+put_defines_into_env(void)
+{
+ int ct = STACKCT_OPT(DEFINE);
+ char const ** ppz = STACKLST_OPT(DEFINE);
+
+ do {
+ char const * pz = *(ppz++);
+ /*
+ * IF there is no associated value, THEN set it to '1'.
+ * There are weird problems with empty defines.
+ * FIXME: we loose track of this memory. Don't know what to do,
+ * really, there is no good recovery mechanism for environment
+ * data.
+ */
+ if (strchr(pz, '=') == NULL) {
+ size_t siz = strlen(pz)+3;
+ char* p = AGALOC(siz, "env define");
+
+ strcpy(p, pz);
+ strcpy(p+siz-3, DFT_ENV_VAL);
+ pz = p;
+ }
+
+ /*
+ * Now put it in the environment
+ */
+ putenv((char*)pz);
+ } while (--ct > 0);
+}
+
+/**
+ * Open trace output file.
+ *
+ * If the name starts with a pipe character (vertical bar), then
+ * use popen on the command. If it starts with ">>", then append
+ * to the file name that follows that.
+ *
+ * The trace output starts with the command and arguments used to
+ * start autogen.
+ *
+ * @param[in] av autogen's argument vector
+ * @param[in] odsc option descriptor with file name string argument
+ */
+LOCAL void
+open_trace_file(char ** av, tOptDesc * odsc)
+{
+ char const * fname = odsc->optArg.argString;
+
+ trace_is_to_pipe = (*fname == '|');
+ if (trace_is_to_pipe)
+ trace_fp = popen(++fname, "w");
+
+ else if ((fname[0] == '>') && (fname[1] == '>')) {
+ fname = SPN_WHITESPACE_CHARS(fname + 2);
+ trace_fp = fopen(fname, "a");
+ }
+
+ else
+ trace_fp = fopen(fname, "w");
+
+ if (trace_fp == NULL)
+ AG_ABEND(aprf(OPEN_ERROR_FMT, errno, strerror(errno), fname));
+
+#ifdef _IONBF
+ setvbuf(trace_fp, NULL, _IONBF, 0);
+#endif
+
+ fprintf(trace_fp, TRACE_START_FMT, (unsigned int)getpid(), *av);
+ while (*(++av) != NULL)
+ fprintf(trace_fp, TRACE_AG_ARG_FMT, *av);
+ putc(NL, trace_fp);
+}
+
+/**
+ * Check the environment for make dependency info. We look for
+ * AUTOGEN_MAKE_DEP, but if that is not found, we also look for
+ * DEPENDENCIES_OUTPUT. To do dependency tracking at all, we
+ * must find one of these environment variables and it must
+ *
+ * * be non-empty
+ * * not contain a variation on "no"
+ * * not contain a variation on "false"
+ *
+ * Furthermore, to specify a file name, the contents must not contain
+ * some variation on "yes" or "true".
+ */
+LOCAL void
+check_make_dep_env(void)
+{
+ bool have_opt_string = false;
+ bool set_opt = false;
+
+ char const * mdep = getenv(AG_MAKE_DEP_NAME);
+ if (mdep == NULL) {
+ mdep = getenv(DEP_OUT_NAME);
+ if (mdep == NULL)
+ return;
+ }
+ switch (*mdep) {
+ case NUL: break;
+ case '1':
+ set_opt = (mdep[0] == '1');
+ /* FALLTHROUGH */
+
+ case '0':
+ if (mdep[1] != NUL)
+ have_opt_string = true;
+ break;
+
+ case 'y':
+ case 'Y':
+ set_opt = true;
+ have_opt_string = (streqvcmp(mdep + 1, YES_NAME_STR+1) != 0);
+ break;
+
+ case 'n':
+ case 'N':
+ set_opt = \
+ have_opt_string = (streqvcmp(mdep + 1, NO_NAME_STR+1) != 0);
+ break;
+
+ case 't':
+ case 'T':
+ set_opt = true;
+ have_opt_string = (streqvcmp(mdep + 1, TRUE_NAME_STR+1) != 0);
+ break;
+
+ case 'f':
+ case 'F':
+ set_opt = \
+ have_opt_string = (streqvcmp(mdep + 1, FALSE_NAME_STR+1) != 0);
+ break;
+
+ default:
+ have_opt_string = \
+ set_opt = true;
+ }
+ if (! set_opt) return;
+ if (! have_opt_string) {
+ SET_OPT_MAKE_DEP("");
+ return;
+ }
+
+ {
+ char * pz = AGALOC(strlen(mdep) + 5, "mdep");
+ char * fp = pz;
+
+ *(pz++) = 'F';
+ for (;;) {
+ int ch = *(unsigned char *)(mdep++);
+ if (IS_END_TOKEN_CHAR(ch))
+ break;
+
+ *(pz++) = ch;
+ }
+ *pz = NUL;
+
+ SET_OPT_SAVE_OPTS(fp);
+ mdep = SPN_WHITESPACE_CHARS(mdep);
+ if (*mdep == NUL)
+ return;
+
+ pz = fp;
+ *(pz++) = 'T';
+ for (;;) {
+ int ch = *(unsigned char *)(mdep++);
+ if (IS_END_TOKEN_CHAR(ch))
+ break;
+
+ *(pz++) = ch;
+ }
+ *pz = NUL;
+ SET_OPT_SAVE_OPTS(fp);
+ AGFREE(fp);
+ }
+}
+
+LOCAL void
+process_ag_opts(int arg_ct, char ** arg_vec)
+{
+ /*
+ * Advance the argument counters and pointers past any
+ * command line options
+ */
+ {
+ int optCt = optionProcess(&autogenOptions, arg_ct, arg_vec);
+
+ /*
+ * Make sure we have a source file, even if it is "-" (stdin)
+ */
+ switch (arg_ct - optCt) {
+ case 1:
+ if (! HAVE_OPT(DEFINITIONS)) {
+ OPT_ARG(DEFINITIONS) = *(arg_vec + optCt);
+ break;
+ }
+ /* FALLTHROUGH */
+
+ default:
+ usage_message(DOOPT_TOO_MANY_DEFS, ag_pname);
+ /* NOTREACHED */
+
+ case 0:
+ if (! HAVE_OPT(DEFINITIONS))
+ OPT_ARG(DEFINITIONS) = DFT_DEF_INPUT_STR;
+ break;
+ }
+ }
+
+ if ((OPT_VALUE_TRACE > TRACE_NOTHING) && HAVE_OPT(TRACE_OUT))
+ open_trace_file(arg_vec, &DESC(TRACE_OUT));
+
+ start_time = time(NULL) - 1;
+
+ if (! HAVE_OPT(TIMEOUT))
+ OPT_ARG(TIMEOUT) = (char const *)AG_DEFAULT_TIMEOUT;
+
+ /*
+ * IF the definitions file has been disabled,
+ * THEN a template *must* have been specified.
+ */
+ if ( (! ENABLED_OPT(DEFINITIONS))
+ && (! HAVE_OPT(OVERRIDE_TPL)) )
+ AG_ABEND(NO_TEMPLATE_ERR_MSG);
+
+ /*
+ * IF we do not have a base-name option, then we compute some value
+ */
+ if (! HAVE_OPT(BASE_NAME))
+ define_base_name();
+
+ check_make_dep_env();
+
+ if (HAVE_OPT(MAKE_DEP))
+ start_dep_file();
+
+ strequate(OPT_ARG(EQUATE));
+
+ /*
+ * IF we have some defines to put in our environment, ...
+ */
+ if (HAVE_OPT(DEFINE))
+ put_defines_into_env();
+}
+
+/**
+ * look for a define string. It may be in our DEFINE option list
+ * (preferred result) or in the environment. Look up both.
+ *
+ * @param[in] de_name name to look for
+ * @param[in] check_env whether or not to look in environment
+ *
+ * @returns a pointer to the string, if found, or NULL.
+ */
+LOCAL char const *
+get_define_str(char const * de_name, bool check_env)
+{
+ char const ** ppz;
+ int ct;
+ if (HAVE_OPT(DEFINE)) {
+ ct = STACKCT_OPT( DEFINE);
+ ppz = STACKLST_OPT(DEFINE);
+
+ while (ct-- > 0) {
+ char const * pz = *(ppz++);
+ char * pzEq = strchr(pz, '=');
+ int res;
+
+ if (pzEq != NULL)
+ *pzEq = NUL;
+
+ res = strcmp(de_name, pz);
+ if (pzEq != NULL)
+ *pzEq = '=';
+
+ if (res == 0)
+ return (pzEq != NULL) ? pzEq+1 : zNil;
+ }
+ }
+ return check_env ? getenv(de_name) : NULL;
+}
+
+
+/**
+ * The following routine scans over quoted text, shifting it in the process
+ * and eliminating the starting quote, ending quote and any embedded
+ * backslashes. They may be used to embed the quote character in the quoted
+ * text. The quote character is whatever character the argument is pointing
+ * at when this procedure is called.
+ *
+ * @param[in,out] in_q input quoted string/output unquoted
+ * @returns the address of the byte after the original closing quote.
+ */
+LOCAL char *
+span_quote(char * in_q)
+{
+ char qc = *in_q; /* Save the quote character type */
+ char * dp = in_q++; /* Destination pointer */
+
+ while (*in_q != qc) {
+ switch (*dp++ = *in_q++) {
+ case NUL:
+ return in_q-1; /* Return address of terminating NUL */
+
+ case '\\':
+ if (qc != '\'') {
+ int ct = ao_string_cook_escape_char(in_q, dp-1, 0x7F);
+ if (dp[-1] == 0x7F) dp--;
+ in_q += ct;
+
+ } else {
+ switch (*in_q) {
+ case '\\':
+ case '\'':
+ case '#':
+ dp[-1] = *in_q++;
+ }
+ }
+ break;
+
+ default:
+ ;
+ }
+ }
+
+ *dp = NUL;
+ return in_q+1; /* Return addr of char after the terminating quote */
+}
+
+/**
+ * The following routine skips over quoted text. The quote character is
+ * whatever character the argument is pointing at when this procedure is
+ * called.
+ *
+ * @param[in] qstr input quoted string/output unquoted
+ * @returns the address of the byte after the original closing quote.
+ */
+static char const *
+skip_quote(char const * qstr)
+{
+ char qc = *qstr++; /* Save the quote character type */
+
+ while (*qstr != qc) {
+ switch (*qstr++) {
+ case NUL:
+ return qstr-1; /* Return address of terminating NUL */
+
+ case '\\':
+ if (qc == '\'') {
+ /*
+ * Single quoted strings process the backquote specially
+ * only in fron of these three characters:
+ */
+ switch (*qstr) {
+ case '\\':
+ case '\'':
+ case '#':
+ qstr++;
+ }
+
+ } else {
+ char p[10]; /* provide a scratch pad for escape processing */
+ int ct = ao_string_cook_escape_char(qstr, p, 0x7F);
+ qstr += ct;
+ } /* if (q == '\'') */
+ } /* switch (*qstr++) */
+ } /* while (*qstr != q) */
+
+ return qstr+1; /* Return addr of char after the terminating quote */
+}
+
+/**
+ * Skip over scheme expression. We need to find what follows it.
+ * Guile will carefully parse it later.
+ *
+ * @param[in] scan where to start search
+ * @param[in] end point beyond which not to go
+ * @returns character after closing parenthesis or "end",
+ * which ever comes first.
+ */
+LOCAL char const *
+skip_scheme(char const * scan, char const * end)
+{
+ int level = 0;
+
+ for (;;) {
+ scan = BRK_SCHEME_NOTE_CHARS(scan);
+ if (scan >= end)
+ return end;
+
+ switch (*(scan++)) {
+ case '(':
+ level++;
+ break;
+
+ case ')':
+ if (--level == 0)
+ return scan;
+ break;
+
+ case '"':
+ scan = skip_quote(scan-1);
+ }
+ }
+}
+
+
+LOCAL int
+count_nl(char const * pz)
+{
+ int ct = 0;
+ for (;;) {
+ char const * p = strchr(pz, NL);
+ if (p == NULL)
+ break;
+ ct++;
+ pz = p + 1;
+ }
+ return ct;
+}
+
+
+LOCAL char const *
+skip_expr(char const * pzSrc, size_t len)
+{
+ char const * pzEnd = pzSrc + len;
+
+ guess_again:
+
+ pzSrc = SPN_WHITESPACE_CHARS(pzSrc);
+ if (pzSrc >= pzEnd)
+ return pzEnd;
+ switch (*pzSrc) {
+ case ';':
+ pzSrc = strchr(pzSrc, NL);
+ if (pzSrc == NULL)
+ return pzEnd;
+ goto guess_again;
+
+ case '(':
+ return skip_scheme(pzSrc, pzEnd);
+
+ case '"':
+ case '\'':
+ case '`':
+ pzSrc = skip_quote(pzSrc);
+ return (pzSrc > pzEnd) ? pzEnd : pzSrc;
+
+ default:
+ break;
+ }
+
+ pzSrc = BRK_WHITESPACE_CHARS(pzSrc);
+ return (pzSrc > pzEnd) ? pzEnd : pzSrc;
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/agUtils.c */
diff --git a/agen5/autogen.1 b/agen5/autogen.1
new file mode 100644
index 0000000..ab9f82f
--- /dev/null
+++ b/agen5/autogen.1
@@ -0,0 +1,559 @@
+.TH autogen 1 "11 Aug 2012" "GNU AutoGen (5.16.2)" "User Commands"
+.\"
+.\" DO NOT EDIT THIS FILE (opts.man)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:41:44 AM by AutoGen 5.16.2pre7
+.\" From the definitions /old-home/bkorb/ag/ag/agen5/opts.def
+.\" and the template file agman-cmd
+.\"
+.SH NAME
+autogen \- The Automated Program Generator
+.SH SYNOPSIS
+.B autogen
+.\" Mixture of short (flag) options and long options
+.RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \-\-\fIopt\-name\fP " [[=| ]\fIvalue\fP]]..." [ <def-file> ]
+.PP
+AutoGen creates text files from templates using external definitions.
+.SH DESCRIPTION
+\fBAutoGen\fP is designed for generating program files that contain
+repetitive text with varied substitutions. The goal is to simplify the
+maintenance of programs that contain large amounts of repetitious text.
+This is especially valuable if there are several blocks of such text
+that must be kept synchronized.
+.sp
+One common example is the problem of maintaining the code required for
+processing program options. Processing options requires a minimum of
+four different constructs be kept in proper order in different places
+in your program. You need at least: The flag character in the flag
+string, code to process the flag when it is encountered, a global
+state variable or two, and a line in the usage text.
+You will need more things besides this if you choose to implement
+long option names, configuration file processing, environment variables
+and so on.
+.sp
+All of this can be done mechanically; with the proper templates
+and this program.
+.SH "OPTIONS"
+.SS "The following options select definitions, templates and scheme functions to use"
+.TP
+.BR \-L " \fIdir\fP, " \-\-templ\-dirs "=" \fIdir\fP
+Template search directory list.
+This option may appear an unlimited number of times.
+.sp
+Add a directory to the list of directories to search when opening
+a template, either as the primary template or an included one.
+The last entry has the highest priority in the search list.
+That is to say, they are searched in reverse order.
+.TP
+.BR \-T " \fItpl\-file\fP, " \-\-override\-tpl "=" \fItpl\-file\fP
+Override template file.
+This option may not be preset with environment variables
+or in initialization (rc) files.
+.sp
+Definition files specify the standard template that is to be expanded.
+This option will override that name and expand a different template.
+.TP
+.BR \-l " \fItpl\-file\fP, " \-\-lib\-template "=" \fItpl\-file\fP
+Library template file.
+This option may appear an unlimited number of times.
+.sp
+DEFINE macros are saved from this template file for use in processing
+the main macro file. Template text aside from the DEFINE macros is
+is ignored.
+.TP
+.BR \-\-definitions "=\fIfile\fP", " \fB\-\-no\-definitions\fP"
+Definitions input file.
+The \fIno\-definitions\fP form will disable the option.
+This option is enabled by default.
+This option may not be preset with environment variables
+or in initialization (rc) files.
+.sp
+Use this argument to specify the input definitions file with a
+command line option. If you do not specify this option, then
+there must be a command line argument that specifies the file,
+even if only to specify stdin with a hyphen (\fB\-\fP).
+Specify, \fB\-\-no\-definitions\fP when you wish to process
+a template without any active AutoGen definitions.
+.TP
+.BR \-S " \fIfile\fP, " \-\-load\-scheme "=" \fIfile\fP
+Scheme code file to load.
+.sp
+Use this option to pre\-load Scheme scripts into the Guile
+interpreter before template processing begins.
+Please note that the AutoGen specific functions are not loaded
+until after argument processing. So, though they may be specified
+in lambda functions you define, they may not be invoked until after
+option processing is complete.
+.TP
+.BR \-F " \fIfile\fP, " \-\-load\-functions "=" \fIfile\fP
+Load scheme function library.
+.sp
+This option is used to load Guile\-scheme functions. The automatically
+called initialization routine \fBscm_init\fP must be used to register
+these routines or data.
+.TP
+.BR \-\-shell "=\fIshell\fP"
+name or path name of shell to use.
+.sp
+By default, when AutoGen is built, the configuration is probed for a
+reasonable Bourne\-like shell to use for shell script processing. If
+a particular template needs an alternate shell, it must be specified
+with this option on the command line, with an environment variable
+(\fBSHELL\fP) or in the configuration/initialization file.
+.TP
+.BR \-m ", " \-\-no\-fmemopen
+Do not use in\-mem streams.
+.sp
+If the local C library supports "\fBfopencookie(3GNU)\fP", or
+"\fBfunopen(3BSD)\fP" then AutoGen prefers to use in\-memory stream
+buffer opens instead of anonymous files. This may lead to problems
+if there is a shortage of virtual memory. If, for a particular
+application, you run out of memory, then specify this option.
+This is unlikely in a modern 64\-bit virtual memory environment.
+.sp
+On platforms without these functions, the option is accepted
+but ignored. \fBfmemopen(POSIX)\fP is not adequate because
+its string buffer is not reallocatable. \fBopen_memstream(POSIX)\fP
+is \fIalso\fP not adequate because the stream is only opened for
+output. AutoGen needs a reallocatable buffer available for both
+reading and writing.
+.TP
+.BR \-\-equate "=\fIchar\-list\fP"
+characters considered equivalent.
+The default \fIchar\-list\fP for this option is:
+.ti +4
+ _\-^
+.sp
+This option will alter the list of characters considered equivalent.
+The default are the three characters, "_\-^". (The last is conventional
+on a Tandem/HP\-NonStop, and I used to do a lot of work on Tandems.)
+.SS "The following options modify how output is handled"
+.TP
+.BR \-b " \fIname\fP, " \-\-base\-name "=" \fIname\fP
+Base name for output file(s).
+This option may not be preset with environment variables
+or in initialization (rc) files.
+.sp
+A template may specify the exact name of the output file. Normally,
+it does not. Instead, the name is composed of the base name of the
+definitions file with suffixes appended. This option will override the
+base name derived from the definitions file name. This is required if
+there is no definitions file and advisable if definitions are being
+read from stdin. If the definitions are being read from standard in,
+the base name defaults to \fIstdin\fP. Any leading directory components
+in the name will be silently removed. If you wish the output file to
+appear in a particular directory, it is recommended that you "cd" into
+that directory first, or use directory names in the format specification
+for the output suffix lists, see: pseudo macro.
+.TP
+.BR \-\-source\-time, " \fB\-\-no\-source\-time\fP"
+set mod times to latest source.
+The \fIno\-source\-time\fP form will disable the option.
+.sp
+If you stamp your output files with the \fBDNE\fP macro output, then
+your output files will always be different, even if the content has
+not really changed. If you use this option, then the modification
+time of the output files will change only if the input files change.
+This will help reduce unneeded builds.
+.TP
+.BR \-\-writable, " \fB\-\-not\-writable\fP"
+Allow output files to be writable.
+The \fInot\-writable\fP form will disable the option.
+.sp
+This option will leave output files writable.
+Normally, output files are read\-only.
+.SS "The following options are often useful while debugging new templates"
+They specify limits that prevent the template from taking overly long
+or producing more output than expected.
+.sp
+.TP
+.BR \-\-loop\-limit "=\fIlim\fP"
+Limit on increment loops.
+This option takes an integer number as its argument.
+The value of \fIlim\fP is constrained to being:
+.in +4
+.nf
+.na
+exactly \-1, or
+in the range 1 through 0x1000000
+.fi
+.in -4
+The default \fIlim\fP for this option is:
+.ti +4
+ 256
+.sp
+This option prevents runaway loops. For example, if you accidentally
+specify, "FOR x (for\-from 1) (for\-to \-1) (for\-by 1)", it will take a
+long time to finish. If you do have more than 256 entries in tables,
+you will need to specify a new limit with this option.
+.TP
+.BR \-t " \fItime\-lim\fP, " \-\-timeout "=" \fItime\-lim\fP
+Time limit for server shell.
+This option takes an integer number as its argument.
+The value of \fItime\-lim\fP is constrained to being:
+.in +4
+.nf
+.na
+in the range 0 through 3600
+.fi
+.in -4
+.sp
+AutoGen works with a shell server process. Most normal commands will
+complete in less than 10 seconds. If, however, your commands need more
+time than this, use this option.
+.sp
+The valid range is 0 to 3600 seconds (1 hour).
+Zero will disable the server time limit.
+.TP
+.BR \-\-trace "=\fIlevel\fP"
+tracing level of detail.
+This option takes a keyword as its argument. The argument sets an enumeration value that can
+be tested by comparing them against the option value macro.
+The available keywords are:
+.in +4
+.nf
+.na
+nothing debug\-message server\-shell
+templates block\-macros expressions
+everything
+.fi
+or their numeric equivalent.
+.in -4
+.sp
+The default \fIlevel\fP for this option is:
+.ti +4
+ nothing
+.sp
+This option will cause AutoGen to display a trace of its template
+processing. There are six levels, each level including messages from
+the previous levels:
+.sp
+.sp
+.IR "nothing"
+Does no tracing at all (default)
+.sp
+.sp
+.IR "debug\-message"
+Print messages from the "DEBUG" AutoGen macro (see: DEBUG).
+.sp
+.sp
+.IR "server\-shell"
+Traces all input and output to the server shell. This includes a shell
+"independent" initialization script about 30 lines long. Its output is
+discarded and not inserted into any template.
+.sp
+.sp
+.IR "templates"
+Traces the invocation of \fBDEFINE\fPd macros and \fBINCLUDE\fPs
+.sp
+.sp
+.IR "block\-macros"
+Traces all block macros. The above, plus \fBIF\fP, \fBFOR\fP,
+\fBCASE\fP and \fBWHILE\fP.
+.sp
+.sp
+.IR "expressions"
+Displays the results of expression evaluations.
+.sp
+.sp
+.IR "everything"
+Displays the invocation of every AutoGen macro, even \fBTEXT\fP macros
+(i.e. the text outside of macro quotes). Additionally, if you rebuild
+the ``expr.ini'' file with debugging enabled, then all calls to
+AutoGen defined scheme functions will also get logged:
+.br
+.nf
+ cd ${top_builddir}/agen5
+ DEBUG_ENABLED=true bash bootstrap.dir expr.ini
+ make CFLAGS='\-g \-DDEBUG_ENABLED=1'
+.fi
+.sp
+Be aware that you cannot rebuild this source in this way without first
+having installed the \fBautogen\fP executable in your search path.
+Because of this, "expr.ini" is in the distributed source list, and
+not in the dependencies.
+.br
+.TP
+.BR \-\-trace\-out "=\fIfile\fP"
+tracing output file or filter.
+.sp
+The output specified may be a file name, a file that is appended to,
+or, if the option argument begins with the \fBpipe\fP operator
+(\fB|\fP), a command that will receive the tracing output as standard
+in. For example, \fB\-\-traceout='| less'\fP will run the trace output
+through the \fBless\fP program. Appending to a file is specified by
+preceeding the file name with two greater\-than characters (\fB>>\fP).
+.TP
+.BR \-\-show\-defs
+Show the definition tree.
+This option may not be preset with environment variables
+or in initialization (rc) files.
+.sp
+This will print out the complete definition tree before processing
+the template.
+.TP
+.BR \-\-used\-defines
+Show the definitions used.
+This option may not be preset with environment variables
+or in initialization (rc) files.
+.sp
+This will print out the names of definition values searched for
+during the processing of the template, whether actually found or
+not. There may be other referenced definitions in a template in
+portions of the template not evaluated. Some of the names listed
+may be computed names and others AutoGen macro arguments. This is
+not a means for producing a definitive, all\-encompassing list of all
+and only the values used from a definition file. This is intended
+as an aid to template documentation only.
+.TP
+.BR \-C ", " \-\-core
+Leave a core dump on a failure exit.
+.sp
+Many systems default to a zero sized core limit. If the system
+has the sys/resource.h header and if this option is supplied,
+then in the failure exit path, autogen will attempt to set the
+soft core limit to whatever the hard core limit is. If that
+does not work, then an administrator must raise the hard core
+size limit.
+.SS "These options can be used to control what gets processed
+in the definitions files and template files"
+They specify which outputs and parts of outputs to produce.
+.sp
+.TP
+.BR \-s " \fIsuffix\fP, " \-\-skip\-suffix "=" \fIsuffix\fP
+Omit the file with this suffix.
+This option may appear an unlimited number of times.
+This option may not be preset with environment variables
+or in initialization (rc) files.
+This option must not appear in combination with any of the following options:
+select\-suffix.
+.sp
+Occasionally, it may not be desirable to produce all of the output
+files specified in the template. (For example, only the \fI.h\fP
+header file, but not the \fI.c\fP program text.) To do this
+specify \fB\-\-skip\-suffix=c\fP on the command line.
+.TP
+.BR \-o " \fIsuffix\fP, " \-\-select\-suffix "=" \fIsuffix\fP
+specify this output suffix.
+This option may appear an unlimited number of times.
+This option may not be preset with environment variables
+or in initialization (rc) files.
+.sp
+If you wish to override the suffix specifications in the template,
+you can use one or more copies of this option. See the suffix
+specification in the @ref{pseudo macro} section of the info doc.
+.TP
+.BR \-D " \fIvalue\fP, " \-\-define "=" \fIvalue\fP
+name to add to definition list.
+This option may appear an unlimited number of times.
+.sp
+The AutoGen define names are used for the following purposes:
+.sp
+.sp 1
+Sections of the AutoGen definitions may be enabled or disabled
+by using C\-style #ifdef and #ifndef directives.
+.sp 1
+When defining a value for a name, you may specify the index
+for a particular value. That index may be a literal value,
+a define option or a value #define\-d in the definitions themselves.
+.sp 1
+The name of a file may be prefixed with \fB$NAME/\fP.
+The \fB$NAME\fP part of the name string will be replaced with
+the define\-d value for \fBNAME\fP.
+.sp 1
+When AutoGen is finished loading the definitions, the defined values
+are exported to the environment with, \fBputenv(3)\fP.
+These values can then be used in shell scripts with \fB${NAME@\fP}
+references and in templates with \fB(getenv "NAME")\fP.
+.sp 1
+While processing a template, you may specify an index to retrieve
+a specific value. That index may also be a define\-d value.
+.br
+.sp
+It is entirely equivalent to place this name in the exported environment.
+Internally, that is what AutoGen actually does with this option.
+.TP
+.BR \-U " \fIname\-pat\fP, " \-\-undefine "=" \fIname\-pat\fP
+definition list removal pattern.
+This option may appear an unlimited number of times.
+This option may not be preset with environment variables
+or in initialization (rc) files.
+.sp
+Similar to 'C', AutoGen uses \fB#ifdef/#ifndef\fP preprocessing
+directives. This option will cause the matching names to be
+removed from the list of defined values.
+.SS "This option is used to automate dependency tracking"
+.TP
+.BR \-M " \fItype\fP, " \-\-make\-dep [ =\fItype\fP ]
+emit make dependency file.
+This option may appear an unlimited number of times.
+This option may not be preset with environment variables
+or in initialization (rc) files.
+.sp
+.sp
+This option behaves fairly closely to the way the \fB\-M\fP series of
+options work with the gcc compiler, except that instead of just
+emitting the predecessor dependencies, this also emits the successor
+dependencies (output target files). By default, the output dependency
+information will be placed in \fB<base\-name>.d\fP, but may also be
+specified with \fB\-MF<file>\fP. The time stamp on this file will be
+manipulated so that it will be one second older than the oldest
+primary output file.
+.sp
+The target in this dependency file will normally be the dependency
+file name, but may also be overridden with \fB\-MT<targ\-name>\fP.
+AutoGen will not alter the contents of that file, but it may create
+it and it will adjust the modification time to match the start time.
+.sp
+\fBNB:\fP these second letters are part of the option argument, so
+\fB\-MF <file>\fP must have the space character quoted or omitted, and
+\fB\-M "F <file>"\fP is acceptable because the \fBF\fP is part of the
+option argument.
+.sp
+\fB\-M\fP may be followed by any of the letters M, F, P, T, Q, D, or G.
+However, only F, Q, T and P are meaningful. All but F have somewhat
+different meanings. \fB\-MT<name>\fP is interpreted as meaning
+\fB<name>\fP is a sentinel file that will depend on all inputs
+(templates and definition files) and all the output files will depend
+on this sentinel file. It is suitable for use as a real make target.
+Q is treated identically to T, except dollar characters ('$') are
+doubled. P causes a special clean (clobber) phoney rule to be inserted
+into the make file fragment. An empty rule is always created for
+building the list of targets.
+.sp
+This is the recommended usage:
+.nf
+ \-MFwhatever\-you\-like.dep \-MTyour\-sentinel\-file \-MP
+.fi
+and then in your \fBMakefile\fP, make the \fIautogen\fP rule:
+.nf
+ \-include whatever\-you\-like.dep
+ clean_targets += clean\-your\-sentinel\-file
+ your\-sentinel\-file:
+ autogen \-MT$@ \-MF$*.d .....
+ local\-clean :
+ rm \-f $(clean_targets)
+.fi
+.sp
+The modification time on the dependency file is adjusted to be one
+second before the earliest time stamp of any other output file.
+Consequently, it is suitable for use as the sentinel file testifying
+to the fact the program was successfully run. (\fB\-include\fP is
+the GNU make way of specifying "include it if it exists". Your make
+must support that feature or your bootstrap process must create the
+file.)
+.sp
+All of this may also be specified using the \fBDEPENDENCIES_OUTPUT\fP
+or \fBAUTOGEN_MAKE_DEP\fP environment variables. If defined,
+dependency information will be output. If defined with white space
+free text that is something other than \fBtrue\fP, \fBfalse\fP,
+\fByes\fP, \fBno\fP, \fB0\fP or \fB1\fP, then the string is taken
+to be an output file name. If it contains a string of white space
+characters, the first token is as above and the second token is taken
+to be the target (sentinel) file as \fB\-MT\fP in the paragraphs
+above. \fBDEPENDENCIES_OUTPUT\fP will be ignored if there are
+multiple sequences of white space characters or if its contents are,
+specifically, \fBfalse\fP, \fBno\fP or \fB0\fP.
+.TP
+.BR \-? , " \-\-help"
+Display usage information and exit.
+.TP
+.BR \-! , " \-\-more\-help"
+Pass the extended usage information through a pager.
+.TP
+.BR \-> " [\fIrcfile\fP]," " \-\-save\-opts" "[=\fIrcfile\fP]"
+Save the option state to \fIrcfile\fP. The default is the \fIlast\fP
+configuration file listed in the \fBOPTION PRESETS\fP section, below.
+.TP
+.BR \-< " \fIrcfile\fP," " \-\-load\-opts" "=\fIrcfile\fP," " \-\-no\-load\-opts"
+Load options from \fIrcfile\fP.
+The \fIno\-load\-opts\fP form will disable the loading
+of earlier RC/INI files. \fI\-\-no\-load\-opts\fP is handled early,
+out of order.
+.TP
+.BR \-v " [{\fIv|c|n\fP}]," " \-\-version" "[=\fI{v|c|n}\fP]"
+Output version of program and exit. The default mode is `v', a simple
+version. The `c' mode will print copyright information and `n' will
+print the full copyright notice.
+.sp
+.SH "OPTION PRESETS"
+Any option that is not marked as \fInot presettable\fP may be preset
+by loading values from configuration ("RC" or ".INI") file(s) and values from
+environment variables named:
+.nf
+ \fBAUTOGEN_<option-name>\fP or \fBAUTOGEN\fP
+.fi
+.ad
+The environmental presets take precedence (are processed later than)
+the configuration files.
+The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
+If any of these are directories, then the file \fI.autogenrc\fP
+is searched for within those directories.
+.SH "ENVIRONMENT"
+See \fBOPTION PRESETS\fP for configuration environment variables.
+.SH "FILES"
+See \fBOPTION PRESETS\fP for configuration files.
+.SH EXAMPLES
+Here is how the man page is produced:
+.br
+.in +4
+.nf
+autogen \-Tagman\-cmd.tpl \-MFman\-dep \-MTstamp\-man opts.def
+.in -4
+.fi
+.sp
+This command produced this man page from the AutoGen option definition
+file. It overrides the template specified in \fIopts.def\fP (normally
+\fIoptions.tpl\fP) and uses \fIagman\-cmd.tpl\fP. It also sets the
+make file dependency output to \fIman\-dep\fP and the sentinel file
+(time stamp file) to \fIman\-stamp\fP. The base of the file name is
+derived from the defined \fBprog\-name\fP.
+.sp
+The texi invocation document is produced via:
+.br
+.in +4
+.nf
+autogen \-Tagtexi\-cmd.tpl \-MFtexi\-dep \-MTtexi\-stamp opts.def
+.in -4
+.fi
+.SH "EXIT STATUS"
+One of the following exit values will be returned:
+.TP
+.BR 0 " (EXIT_SUCCESS)"
+Successful program execution.
+.TP
+.BR 1 " (EXIT_OPTION_ERROR)"
+The command options were misconfigured.
+.TP
+.BR 2 " (EXIT_BAD_TEMPLATE)"
+An error was encountered processing the template.
+.TP
+.BR 3 " (EXIT_BAD_DEFINITIONS)"
+The definitions could not be deciphered.
+.TP
+.BR 4 " (EXIT_LOAD_ERROR)"
+An error was encountered during the load phase.
+.TP
+.BR 5 " (EXIT_SIGNAL)"
+Program exited due to catching a signal. If your template includes
+string formatting, a number argument to a "%s" formatting element will
+trigger a segmentation fault. Autogen will catch the seg fault signal
+and exit with \fBAUTOGEN_EXIT_SIGNAL(5)\fP. Alternatively, AutoGen
+may have been interrupted with a \fBkill(2)\fP signal.
+.TP
+.BR 66 " (EX_NOINPUT)"
+A specified configuration file could not be loaded.
+.TP
+.BR 70 " (EX_SOFTWARE)"
+libopts had an internal operational error. Please report
+it to autogen-users@lists.sourceforge.net. Thank you.
+.SH "AUTHORS"
+Bruce Korb
+.SH "COPYRIGHT"
+Copyright (C) 1992-2012 Bruce Korb all rights reserved.
+This program is released under the terms of the GNU General Public License, version 3 or later.
+.SH "BUGS"
+Please send bug reports to: autogen-users@lists.sourceforge.net
+.SH "NOTES"
+This manual page was \fIAutoGen\fP-erated from the \fBautogen\fP
+option definitions.
diff --git a/agen5/autogen.c b/agen5/autogen.c
new file mode 100644
index 0000000..73ea05c
--- /dev/null
+++ b/agen5/autogen.c
@@ -0,0 +1,657 @@
+
+/**
+ * @file autogen.c
+ *
+ * Time-stamp: "2012-06-10 12:17:05 bkorb"
+ *
+ * This is the main routine for autogen.
+ *
+ * This file is part of AutoGen.
+ * Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
+
+typedef void (void_main_proc_t)(int, char **);
+
+typedef enum {
+ EXIT_PCLOSE_WAIT,
+ EXIT_PCLOSE_NOWAIT
+} wait_for_pclose_enum_t;
+
+#define _State_(n) #n,
+static char const * const state_names[] = { STATE_TABLE };
+#undef _State_
+
+static sigjmp_buf abendJumpEnv;
+static int abendJumpSignal = 0;
+
+typedef void (sighandler_proc_t)(int sig);
+static sighandler_proc_t ignore_signal, catch_sig_and_bail;
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+inner_main(void * closure, int argc, char ** argv);
+
+static void
+exit_cleanup(wait_for_pclose_enum_t cl_wait);
+
+static void
+cleanup_and_abort(int sig);
+
+static void
+catch_sig_and_bail(int sig);
+
+static void
+ignore_signal(int sig);
+
+static void
+done_check(void);
+
+static void
+setup_signals(sighandler_proc_t * chldHandler,
+ sighandler_proc_t * abrtHandler,
+ sighandler_proc_t * dfltHandler);
+/* = = = END-STATIC-FORWARD = = = */
+
+#ifndef HAVE_CHMOD
+# include "compat/chmod.c"
+#endif
+
+/**
+ * main routine under Guile guidance
+ *
+ * @param closure Guile closure parameter. Not used.
+ * @param argc argument count
+ * @param argv argument vector
+ */
+static void
+inner_main(void * closure, int argc, char ** argv)
+{
+ atexit(done_check);
+ initialize(argc, argv);
+
+ processing_state = PROC_STATE_LOAD_DEFS;
+ read_defs();
+
+ /*
+ * Activate the AutoGen specific Scheme functions.
+ * Then load, process and unload the main template
+ */
+ processing_state = PROC_STATE_LOAD_TPL;
+
+ {
+ templ_t* pTF = tpl_load(tpl_fname, NULL);
+
+ processing_state = PROC_STATE_EMITTING;
+ process_tpl(pTF);
+
+ processing_state = PROC_STATE_CLEANUP;
+ cleanup(pTF);
+ }
+
+ processing_state = PROC_STATE_DONE;
+ setup_signals(SIG_DFL, SIG_IGN, SIG_DFL);
+ exit_code = AUTOGEN_EXIT_SUCCESS;
+ done_check();
+ /* NOTREACHED */
+ (void)closure;
+}
+
+/**
+ * main() called from _start()
+ *
+ * @param argc argument count
+ * @param argv argument vector
+ * @return nothing -- Guile never returns, but calls exit(2).
+ */
+int
+main(int argc, char ** argv)
+{
+ /*
+ * IF we've been kicked with a signal,
+ * THEN abort, passing the signal that whacked us.
+ */
+ if (sigsetjmp(abendJumpEnv, 0) != 0)
+ cleanup_and_abort(abendJumpSignal);
+
+ setup_signals(ignore_signal, SIG_DFL, catch_sig_and_bail);
+ optionSaveState(&autogenOptions);
+ trace_fp = stderr;
+
+ /*
+ * as of 2.0.2, Guile will fiddle with strings all on its own accord.
+ * Coerce the environment into being POSIX ASCII strings so it keeps
+ * its bloody stinking nose out of our data.
+ */
+ putenv((char*)(void*)LC_ALL_IS_C);
+
+ /*
+ * If GUILE_WARN_DEPRECATED has not been defined, then likely we are
+ * not in a development environment and likely we don't want to give
+ * our users any angst.
+ */
+ if (getenv(GUILE_WARN_DEP_STR) == NULL)
+ putenv((char*)(void*)GUILE_WARN_NO_ENV);
+
+ AG_SCM_BOOT_GUILE(argc, argv, inner_main);
+
+ /* NOT REACHED */
+ return EXIT_FAILURE;
+}
+
+/**
+ * This code must run regardless of which exit path is taken
+ *
+ * @param [in] cl_wait Whether or not a child process should be waited for.
+ */
+static void
+exit_cleanup(wait_for_pclose_enum_t cl_wait)
+{
+ /*
+ * There are contexts wherein this function can get run twice.
+ */
+ {
+ static int exit_cleanup_done = 0;
+ if (exit_cleanup_done) {
+ if (OPT_VALUE_TRACE > TRACE_NOTHING)
+ fprintf(trace_fp, EXIT_CLEANUP_MULLIGAN);
+ return;
+ }
+
+ exit_cleanup_done = 1;
+ }
+
+#ifdef SHELL_ENABLED
+ SCM_EVAL_CONST(EXIT_CLEANUP_STR);
+#endif
+
+ close_server_shell();
+
+ if (OPT_VALUE_TRACE > TRACE_NOTHING)
+ fprintf(trace_fp, EXIT_CLEANUP_DONE_FMT,
+ (cl_wait == EXIT_PCLOSE_WAIT)
+ ? EXIT_CLEANUP_WAITED : EXIT_CLEANUP_NOWAIT,
+ (unsigned int)getpid());
+
+ do {
+ if (trace_fp == stderr)
+ break;
+
+ if (! trace_is_to_pipe) {
+ fclose(trace_fp);
+ break;
+ }
+
+
+ fflush(trace_fp);
+ pclose(trace_fp);
+ if (cl_wait == EXIT_PCLOSE_WAIT) {
+ int status;
+ while (wait(&status) > 0) ;
+ }
+ } while (false);
+
+ fflush(stdout);
+ fflush(stderr);
+}
+
+/**
+ * A signal was caught, siglongjmp called and main() has called this.
+ * We do not deallocate stuff so it can be found in the core dump.
+ *
+ * @param[in] sig the signal number
+ */
+static void
+cleanup_and_abort(int sig)
+{
+ if (*oops_pfx != NUL) {
+ fputs(oops_pfx, stderr);
+ oops_pfx = zNil;
+ }
+
+ fprintf(stderr, AG_SIG_ABORT_FMT, sig, strsignal(sig),
+ ((unsigned)processing_state <= PROC_STATE_DONE)
+ ? state_names[ processing_state ] : BOGUS_TAG);
+
+ if (processing_state == PROC_STATE_ABORTING) {
+ exit_cleanup(EXIT_PCLOSE_NOWAIT);
+ _exit(sig + 128);
+ }
+
+ processing_state = PROC_STATE_ABORTING;
+ setup_signals(SIG_DFL, SIG_DFL, SIG_DFL);
+
+ /*
+ * IF there is a current template, then we should report where we are
+ * so that the template writer knows where to look for their problem.
+ */
+ if (current_tpl != NULL) {
+ int line;
+ mac_func_t fnCd;
+ char const * pzFn;
+ char const * pzFl;
+
+ if (cur_macro == NULL) {
+ pzFn = PSEUDO_MACRO_NAME_STR;
+ line = 0;
+ fnCd = (mac_func_t)-1;
+
+ } else {
+ mac_func_t f =
+ (cur_macro->md_code > FUNC_CT)
+ ? FTYP_SELECT : cur_macro->md_code;
+ pzFn = ag_fun_names[ f ];
+ line = cur_macro->md_line;
+ fnCd = cur_macro->md_code;
+ }
+ pzFl = current_tpl->td_file;
+ if (pzFl == NULL)
+ pzFl = NULL_FILE_NAME_STR;
+ fprintf(stderr, AG_ABORT_LOC_FMT, pzFl, line, pzFn, fnCd);
+ }
+
+#ifdef HAVE_SYS_RESOURCE_H
+ /*
+ * If `--core' has been specified and if we have get/set rlimit,
+ * then try to set the core limit to the "hard" maximum before aborting.
+ */
+ if (HAVE_OPT(CORE)) {
+ struct rlimit rlim;
+ getrlimit(RLIMIT_CORE, &rlim);
+ rlim.rlim_cur = rlim.rlim_max;
+ setrlimit(RLIMIT_CORE, &rlim);
+ }
+#endif
+
+ exit_cleanup(EXIT_PCLOSE_NOWAIT);
+ abort();
+}
+
+
+/**
+ * catch_sig_and_bail catches signals we abend on. The "siglongjmp"
+ * goes back to the real "main()" procedure and it will call
+ * "cleanup_and_abort()", above.
+ *
+ * @param[in] sig the signal number
+ */
+static void
+catch_sig_and_bail(int sig)
+{
+ switch (processing_state) {
+ case PROC_STATE_ABORTING:
+ exit_code = AUTOGEN_EXIT_SIGNAL;
+
+ case PROC_STATE_DONE:
+ break;
+
+ default:
+ abendJumpSignal = sig;
+ exit_code = AUTOGEN_EXIT_SIGNAL;
+ siglongjmp(abendJumpEnv, sig);
+ }
+}
+
+
+/**
+ * ignore_signal is the handler for SIGCHLD. If we set it to default,
+ * it will kill us. If we set it to ignore, it will be inherited.
+ * Therefore, always in all programs set it to call a procedure.
+ * The "wait(3)" call will do magical things, but will not override SIGIGN.
+ *
+ * @param[in] sig the signal number
+ */
+static void
+ignore_signal(int sig)
+{
+ (void)sig;
+ return;
+}
+
+
+/**
+ * This is _always_ called for exit processing.
+ * This only returns if "exit(3C)" is called during option processing.
+ * We have no way of determining the correct exit code.
+ * (Requested version or help exits EXIT_SUCCESS. Option failures
+ * are EXIT_FAILURE. We cannot determine here.)
+ */
+static void
+done_check(void)
+{
+ /*
+ * There are contexts wherein this function can get called twice.
+ */
+ {
+ static int done_check_done = 0;
+ if (done_check_done) {
+ if (OPT_VALUE_TRACE > TRACE_NOTHING)
+ fprintf(trace_fp, DONE_CHECK_REDONE);
+ return;
+ }
+ done_check_done = 1;
+ }
+
+ switch (processing_state) {
+ case PROC_STATE_EMITTING:
+ case PROC_STATE_INCLUDING:
+ /*
+ * A library (viz., Guile) procedure has called exit(3C). The
+ * AutoGen abort paths all set processing_state to PROC_STATE_ABORTING.
+ */
+ if (*oops_pfx != NUL) {
+ /*
+ * Emit the CGI page header for an error message. We will rewind
+ * stderr and write the contents to stdout momentarily.
+ */
+ fputs(oops_pfx, stdout);
+ oops_pfx = zNil;
+ }
+
+ if (OPT_VALUE_TRACE > TRACE_NOTHING)
+ scm_backtrace();
+
+ fprintf(stderr, SCHEME_EVAL_ERR_FMT, current_tpl->td_file,
+ cur_macro->md_line);
+
+ /*
+ * We got here because someone called exit early.
+ */
+ do {
+#ifndef DEBUG_ENABLED
+ out_close(false);
+#else
+ out_close(true);
+#endif
+ } while (cur_fpstack->stk_prev != NULL);
+ exit_code = AUTOGEN_EXIT_BAD_TEMPLATE;
+ break; /* continue failure exit */
+
+ case PROC_STATE_LOAD_DEFS:
+ exit_code = AUTOGEN_EXIT_BAD_DEFINITIONS;
+ /* FALLTHROUGH */
+
+ default:
+ fprintf(stderr, AG_ABEND_STATE_FMT, state_names[processing_state]);
+ goto autogen_aborts;
+
+ case PROC_STATE_ABORTING:
+ exit_code = AUTOGEN_EXIT_BAD_TEMPLATE;
+
+ autogen_aborts:
+ if (*oops_pfx != NUL) {
+ /*
+ * Emit the CGI page header for an error message. We will rewind
+ * stderr and write the contents to stdout momentarily.
+ */
+ fputs(oops_pfx, stdout);
+ oops_pfx = zNil;
+ }
+ break; /* continue failure exit */
+
+ case PROC_STATE_OPTIONS:
+ /* Exiting in option processing state is verbose enough */
+ break;
+
+ case PROC_STATE_DONE:
+ break; /* continue normal exit */
+ }
+
+ if (last_scm_cmd != NULL)
+ fprintf(stderr, GUILE_CMD_FAIL_FMT, last_scm_cmd);
+
+ /*
+ * IF we diverted stderr, then now is the time to copy the text to stdout.
+ * This is done for CGI mode wherein we produce an error page in case of
+ * an error, but otherwise discard stderr.
+ */
+ if (cgi_stderr != NULL) {
+ do {
+ long pos = ftell(stderr);
+ char* pz;
+
+ /*
+ * Don't bother with the overhead if there is no work to do.
+ */
+ if (pos <= 0)
+ break;
+ pz = AGALOC(pos, "stderr redir");
+ rewind(stderr);
+ fread( pz, (size_t)1, (size_t)pos, stderr);
+ fwrite(pz, (size_t)1, (size_t)pos, stdout);
+ AGFREE(pz);
+ } while (false);
+
+ unlink(cgi_stderr);
+ AGFREE(cgi_stderr);
+ cgi_stderr = NULL;
+ }
+
+ ag_scribble_deinit();
+
+ if (OPT_VALUE_TRACE > TRACE_NOTHING)
+ fprintf(trace_fp, DONE_CHECK_DONE);
+
+ exit_cleanup(EXIT_PCLOSE_WAIT);
+
+ /*
+ * When processing options, return so that the option processing exit code
+ * is used. Otherwise, terminate execution now with the decided upon
+ * exit code. (Always EXIT_FAILURE, unless this was called at the end
+ * of inner_main().)
+ */
+ if (processing_state != PROC_STATE_OPTIONS)
+ _exit(exit_code);
+}
+
+
+LOCAL void
+ag_abend_at(char const * pzMsg
+#ifdef DEBUG_ENABLED
+ , char const * pzFile, int line
+#endif
+ )
+{
+ if (*oops_pfx != NUL) {
+ fputs(oops_pfx, stderr);
+ oops_pfx = zNil;
+ }
+
+#ifdef DEBUG_ENABLED
+ fprintf(stderr, "Giving up in %s line %d\n", pzFile, line);
+#endif
+
+ if ((processing_state >= PROC_STATE_LIB_LOAD) && (current_tpl != NULL)) {
+ int l_no = (cur_macro == NULL) ? -1 : cur_macro->md_line;
+ fprintf(stderr, ERROR_IN_TPL_FMT, current_tpl->td_file, l_no);
+ }
+ fputs(pzMsg, stderr);
+ pzMsg += strlen(pzMsg);
+ if (pzMsg[-1] != NL)
+ fputc(NL, stderr);
+
+ {
+ proc_state_t oldState = processing_state;
+ processing_state = PROC_STATE_ABORTING;
+
+ switch (oldState) {
+ case PROC_STATE_EMITTING:
+ case PROC_STATE_INCLUDING:
+ case PROC_STATE_CLEANUP:
+ longjmp(abort_jmp_buf, FAILURE);
+ /* NOTREACHED */
+ default:
+ exit(EXIT_FAILURE);
+ /* NOTREACHED */
+ }
+ }
+}
+
+
+static void
+setup_signals(sighandler_proc_t * chldHandler,
+ sighandler_proc_t * abrtHandler,
+ sighandler_proc_t * dfltHandler)
+{
+ struct sigaction sa;
+ int sigNo = 1;
+#ifdef SIGRTMIN
+ const int maxSig = SIGRTMIN-1;
+#else
+ const int maxSig = NSIG;
+#endif
+
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+
+ do {
+ switch (sigNo) {
+ /*
+ * Signal handling for SIGCHLD needs to be ignored. Do *NOT* use
+ * SIG_IGN to do this. That gets inherited by programs that need
+ * to be able to use wait(2) calls. At the same time, we don't
+ * want our children to become zombies. We may run out of zombie
+ * space. Therefore, set the handler to an empty procedure.
+ * POSIX oversight. Allowed to be fixed for next POSIX rev, tho
+ * it is "optional" to reset SIGCHLD on exec(2).
+ */
+#ifndef SIGCHLD
+# define SIGCHLD SIGCLD
+#endif
+ case SIGCHLD:
+ sa.sa_handler = chldHandler;
+ break;
+
+ case SIGABRT:
+ sa.sa_handler = abrtHandler;
+ break;
+
+ /*
+ * Signals we must leave alone.
+ */
+ case SIGKILL:
+ case SIGSTOP:
+
+ /*
+ * Signals we choose to leave alone.
+ */
+#ifdef SIGTSTP
+ case SIGTSTP:
+#endif
+ continue;
+
+#if defined(DEBUG_ENABLED)
+ case SIGBUS:
+ case SIGSEGV:
+ /*
+ * While debugging AutoGen, we want seg faults to happen and
+ * trigger core dumps. Make sure this happens.
+ */
+ sa.sa_handler = SIG_DFL;
+ break;
+#endif
+
+ /*
+ * Signals to ignore with SIG_IGN.
+ */
+ case 0: /* cannot happen, but the following might not be defined */
+#ifdef SIGWINCH
+ case SIGWINCH:
+#endif
+#ifdef SIGTTIN
+ case SIGTTIN: /* tty input */
+#endif
+#ifdef SIGTTOU
+ case SIGTTOU: /* tty output */
+#endif
+ sa.sa_handler = SIG_IGN;
+ break;
+
+#ifdef DAEMON_ENABLED
+# error DAEMON-ization of AutoGen is not ready for prime time
+ Choke Me.
+ case SIGHUP:
+ if (HAVE_OPT(DAEMON)) {
+ sa.sa_handler = handleSighup;
+ break;
+ }
+ /* FALLTHROUGH */
+#endif
+
+ default:
+ sa.sa_handler = dfltHandler;
+ }
+ sigaction(sigNo, &sa, NULL);
+ } while (++sigNo < maxSig);
+}
+
+#ifndef HAVE_STRFTIME
+# include <compat/strftime.c>
+#endif
+
+#ifndef HAVE_STRSIGNAL
+# include <compat/strsignal.c>
+#endif
+
+LOCAL void *
+ao_malloc (size_t sz)
+{
+ void * res = malloc(sz);
+ if (res == NULL) {
+ fprintf(stderr, MALLOC_FAIL_FMT, sz);
+ exit(EXIT_FAILURE);
+ }
+ return res;
+}
+
+
+LOCAL void *
+ao_realloc (void *p, size_t sz)
+{
+ void * res = (p == NULL) ? malloc(sz) : realloc(p, sz);
+ if (res == NULL) {
+ fprintf(stderr, REALLOC_FAIL_FMT, sz, p);
+ exit(EXIT_FAILURE);
+ }
+ return res;
+}
+
+LOCAL char *
+ao_strdup (char const * str)
+{
+ char * res = strdup(str);
+ if (res == NULL) {
+ fprintf(stderr, STRDUP_FAIL_FMT, (int)strlen(str));
+ exit(EXIT_FAILURE);
+ }
+ return res;
+}
+
+#ifdef __GNUC__
+ void ignore_vars(void);
+ void ignore_vars(void) {
+ (void)option_load_mode, (void)program_pkgdatadir;
+ }
+#endif
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/autogen.c */
diff --git a/agen5/autogen.h b/agen5/autogen.h
new file mode 100644
index 0000000..6e4551a
--- /dev/null
+++ b/agen5/autogen.h
@@ -0,0 +1,570 @@
+
+/**
+ * @file autogen.h
+ *
+ * Time-stamp: "2012-04-07 09:45:02 bkorb"
+ *
+ * Global header file for AutoGen
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef AUTOGEN_BUILD
+#define AUTOGEN_BUILD 1
+
+#include "compat/unlocked-io.h"
+
+#include REGEX_HEADER
+#include <libguile/scmconfig.h>
+#if GUILE_VERSION < 107000
+# include <guile/gh.h>
+#else
+# include <libguile.h>
+#endif
+
+#include "ag-text.h"
+#include "opts.h"
+#include "expr.h"
+#include "autoopts/autoopts.h"
+#include "directive.h"
+#include "snprintfv/printf.h"
+
+#define LOG10_2to32 10 /* rounded up */
+
+#if defined(SHELL_ENABLED) || defined(DAEMON_ENABLED)
+# ifndef HAVE_WORKING_FORK
+# error SHELL is enabled and fork() does not work
+ choke me
+# endif
+#endif
+
+#ifndef DIRCH
+# if defined(_WIN32) && !defined(__CYGWIN__)
+# define DIRCH '\\'
+# else
+# define DIRCH '/'
+# endif
+#endif
+
+#define YYSTYPE t_word
+
+#define ag_offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
+
+/*
+ * Dual pipe opening of a child process
+ */
+typedef struct {
+ int fd_read;
+ int fd_write;
+} fd_pair_t;
+
+typedef struct {
+ FILE * fp_read; /* parent read fp */
+ FILE * fp_write; /* parent write fp */
+} fp_pair_t;
+
+#define NOPROCESS ((pid_t)-1)
+#define NULLPROCESS ((pid_t)0)
+#define NL '\n'
+#define TAB '\t'
+
+#include "cgi-fsm.h"
+#include "defParse-fsm.h"
+
+typedef union {
+ unsigned char * pzStr;
+ unsigned char ch;
+} def_token_u_t;
+
+#define STATE_TABLE /* set up `atexit' and load Guile */ \
+ _State_( INIT ) /* processing command line options */ \
+ _State_( OPTIONS ) /* Loading guile at option time */ \
+ _State_( GUILE_PRELOAD ) /* Loading value definitions */ \
+ _State_( LOAD_DEFS ) /* Loading library template */ \
+ _State_( LIB_LOAD ) /* Loading primary template */ \
+ _State_( LOAD_TPL ) /* processing templates */ \
+ _State_( EMITTING ) /* loading an included template */ \
+ _State_( INCLUDING ) /* end of processing before exit() */ \
+ _State_( CLEANUP ) /* Clean up code in error response */ \
+ _State_( ABORTING ) /* `exit' has been called */ \
+ _State_( DONE )
+
+#define _State_(n) PROC_STATE_ ## n,
+typedef enum { STATE_TABLE COUNT_PROC_STATE } proc_state_t;
+#undef _State_
+
+#define EXPORT
+
+typedef struct out_stack out_stack_t;
+typedef struct out_spec out_spec_t;
+typedef struct scan_context scan_ctx_t;
+typedef struct def_entry def_ent_t;
+typedef struct macro_desc macro_t;
+typedef struct template_desc templ_t;
+typedef struct for_state for_state_t;
+typedef struct tlib_mark tlib_mark_t;
+
+#define MAX_SUFFIX_LEN 8 /* maximum length of a file name suffix */
+#define MAX_HEREMARK_LEN 64 /* max length of a here mark */
+#define SCRIBBLE_SIZE 256 /* much larger than any short name */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Template Library Layout
+ *
+ * Procedure for loading a template function
+ */
+typedef macro_t * (load_proc_t)(templ_t*, macro_t*, char const** ppzScan);
+typedef load_proc_t * load_proc_p_t;
+
+typedef void (unload_proc_t)(macro_t*);
+typedef unload_proc_t* unload_proc_p_t;
+
+/*
+ * Procedure for handling a template function
+ * during the text emission phase.
+ */
+typedef macro_t* (hdlr_proc_t)(templ_t*, macro_t*);
+typedef hdlr_proc_t* hdlr_proc_p_t;
+
+/*
+ * This must be included after the function prototypes
+ * (the prototypes are used in the generated tables),
+ * but before the macro descriptor structure (the function
+ * enumeration is generated here).
+ */
+#include "functions.h"
+
+#define TEMPLATE_REVISION 1
+#define TEMPLATE_MAGIC_MARKER {{{'A', 'G', 'L', 'B'}}, \
+ TEMPLATE_REVISION, FUNCTION_CKSUM }
+
+struct tlib_mark {
+ union {
+ unsigned char str[4]; /* {'A', 'G', 'L', 'B'} */
+ unsigned int i[1];
+ } tlm_magic;
+ unsigned short tlm_revision; /* TEMPLATE_REVISION */
+ unsigned short tlm_cksum; /* FUNCTION_CKSUM */
+};
+
+/*
+ * Defines for conditional expressions.
+ * The first four are an enumeration that appear in the
+ * low four bits and the next-to-lowest four bits.
+ * "PRIMARY_TYPE" and "SECONDARY_TYPE" are masks for
+ * extracting this enumeration. The rest are flags.
+ */
+#define EMIT_VALUE 0x0000 /* emit value of variable */
+#define EMIT_EXPRESSION 0x0001 /* Emit Scheme result */
+#define EMIT_SHELL 0x0002 /* emit shell output */
+#define EMIT_STRING 0x0003 /* emit content of expr */
+#define EMIT_PRIMARY_TYPE 0x0007
+#define EMIT_SECONDARY_TYPE 0x0070
+#define EMIT_SECONDARY_SHIFT 4
+#define EMIT_IF_ABSENT 0x0100
+#define EMIT_ALWAYS 0x0200 /* emit one of two exprs */
+#define EMIT_FORMATTED 0x0400 /* format, if val present */
+#define EMIT_NO_DEFINE 0x0800 /* don't get defined value */
+
+struct macro_desc {
+ mac_func_t md_code; /* Macro function */
+ int md_line; /* of macro def */
+ int md_end_idx; /* End of block macro */
+ int md_sib_idx; /* Sibling macro (ELIF or SELECT) */
+
+ uintptr_t md_name_off; /* macro name (sometimes) */
+ uintptr_t md_txt_off; /* associated text */
+ uintptr_t md_res; /* some sort of result */
+ void * md_pvt;
+};
+
+struct template_desc {
+ tlib_mark_t td_magic; /* TEMPLATE_MAGIC_MARKER */
+ size_t td_size; /* Structure Size */
+ char * td_scan; /* Next Pointer */
+ int td_mac_ct; /* Count of Macros */
+ char const * td_file; /* Name of template file */
+ char * td_name; /* Defined Macro Name */
+ char * td_text; /* offset of the text */
+ char td_start_mac[MAX_SUFFIX_LEN];
+ char td_end_mac[ MAX_SUFFIX_LEN];
+ macro_t td_macros[1]; /* Array of Macros */
+/* char td_text[...]; * strings at end of macros */
+};
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Name/Value Definitions Layout
+ */
+typedef enum {
+ VALTYP_UNKNOWN = 0,
+ VALTYP_TEXT,
+ VALTYP_BLOCK
+} val_typ_t;
+
+
+#define NO_INDEX ((short)0x80DEAD)
+
+typedef struct def_ctx def_ctx_t;
+struct def_ctx {
+ def_ent_t * dcx_defent; //!< ptr to current def set
+ def_ctx_t * dcx_prev; //!< ptr to previous def set
+};
+
+typedef union {
+ def_ent_t * dvu_entry;
+ char * dvu_text;
+} def_val_u;
+
+struct def_entry {
+ def_ent_t * de_next; //!< next member of same level
+ def_ent_t * de_twin; //!< next member with same name
+ def_ent_t * de_ptwin; //!< previous memb. of level
+ def_ent_t * de_etwin; //!< head of chain to end ptr
+ char * de_name; //!< name of this member
+ long de_index; //!< index among twins
+ def_val_u de_val; //!< string or list of children
+ char * de_file; //!< definition file name
+ int de_line; //!< def file source line
+ val_typ_t de_type; //!< text/block/not defined yet
+};
+
+struct scan_context {
+ scan_ctx_t * scx_next;
+ char * scx_scan;
+ char const * scx_fname;
+ char * scx_data;
+ int scx_line;
+};
+
+struct out_spec {
+ out_spec_t * os_next;
+ char const * os_file_fmt;
+ bool os_dealloc_fmt;
+ char os_sfx[ 1 ];
+};
+
+/**
+ * Output stack handling flags.
+ */
+#define FPF_FREE 0x0001 /*!< free the fp structure */
+#define FPF_UNLINK 0x0002 /*!< unlink file (temp file) */
+#define FPF_NOUNLINK 0x0004 /*!< do not unlink file */
+#define FPF_STATIC_NM 0x0008 /*!< name statically alloced */
+#define FPF_NOCHMOD 0x0010 /*!< do not chmod(2) file */
+#define FPF_TEMPFILE 0x0020 /*!< the file is a temp */
+
+struct out_stack {
+ int stk_flags;
+ out_stack_t * stk_prev;
+ FILE * stk_fp;
+ char const * stk_fname;
+};
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * FOR loop processing state
+ */
+/**
+ * The current state of each active FOR loop.
+ */
+struct for_state {
+ bool for_loading; //!< the FOR macro is getting ready
+ int for_from; //!< the first index of loop
+ int for_to; //!< the last index of loop
+ int for_by; //!< the loop increment (usually 1)
+ int for_index; //!< the current index
+ char * for_sep_str; //!< inter-iteration string (allocated)
+ char * for_name; //!< name of iterator (not allocated)
+ bool for_islast; //!< true for last iteration
+ bool for_isfirst; //!< true for first iteration
+ jmp_buf for_env; //!< long jump buffer (BREAK, CONTINUE)
+};
+
+typedef enum {
+ LOOP_JMP_OKAY = 0,
+ LOOP_JMP_NEXT = 1,
+ LOOP_JMP_BREAK = 2
+} loop_jmp_type_t;
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Invocation of a defined macro processing state
+ */
+typedef struct ivk_info ivk_info_t;
+struct ivk_info {
+ ivk_info_t * ii_prev; //!< previous layer
+ int ii_depth; //!< Invocation nesting depth
+ jmp_buf ii_env; //!< long jump buffer (RETURN)
+ int ii_for_depth; //!< for depth for this invocation
+ int ii_for_alloc; //!< for state buffer allocation count
+ for_state_t * ii_for_data; //!< array of "for" macro states
+};
+#define IVK_INFO_INITIALIZER(_p) { \
+ .ii_prev = (_p), \
+ .ii_depth = curr_ivk_info->ii_depth + 1, \
+ .ii_for_depth = 0, \
+ .ii_for_alloc = 0, \
+ .ii_for_data = NULL \
+ }
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Parsing stuff
+ */
+#define _MkStr(_s) #_s
+#define MK_STR(_s) _MkStr(_s)
+
+#define SCM_EVAL_CONST(_s) \
+ do { static int const line = __LINE__ - 1; \
+ static char const file[] = __FILE__; \
+ static char const * text = _s; \
+ last_scm_cmd = text; \
+ ag_scm_c_eval_string_from_file_line(text, file, line); \
+ } while (false)
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * GLOBAL VARIABLES
+ *
+ * General Processing Globals
+ */
+#define ag_pname autogenOptions.pzProgName
+MODE proc_state_t processing_state VALUE( PROC_STATE_INIT );
+MODE unsigned int include_depth VALUE( 0 );
+MODE bool defining_macro VALUE( false );
+MODE templ_t * named_tpls VALUE( NULL );
+MODE char const * oops_pfx VALUE( "" );
+/*
+ * "eval_mac_expr" must be able to return a distinct empty string so that
+ * the "CASE" function can distinguish an empty string due to it being a
+ * value from an empty string due to an absent definition.
+ */
+MODE char const no_def_str[1] VALUE( "" );
+
+/*
+ * Template Processing Globals
+ */
+MODE char const * curr_sfx VALUE( NULL );
+/**
+ * The time to set for the modification times of the output files.
+ */
+MODE time_t outfile_time VALUE( 0 );
+/**
+ * The original time autogen started
+ */
+MODE time_t start_time VALUE( 0 );
+MODE out_stack_t * cur_fpstack VALUE( NULL );
+MODE out_spec_t * output_specs VALUE( NULL );
+MODE jmp_buf abort_jmp_buf;
+MODE ivk_info_t root_ivk_info VALUE( { 0 } );
+MODE ivk_info_t * curr_ivk_info VALUE( &root_ivk_info );
+MODE for_state_t * for_state VALUE( NULL );
+MODE FILE * trace_fp VALUE( NULL );
+/**
+ * temporary file name template
+ */
+MODE char const * pz_temp_tpl VALUE( NULL );
+/**
+ * Length of the template that is the temp directory
+ */
+MODE size_t temp_tpl_dir_len VALUE( 0 );
+/**
+ * dependency file file pointer.
+ */
+MODE FILE* dep_fp VALUE( NULL );
+/**
+ * name of target of rule
+ */
+MODE char const * dep_target VALUE( NULL );
+/**
+ * name of dependency file
+ */
+MODE char const * dep_file VALUE( NULL );
+/**
+ * base name of both source and derived files.
+ * Either "_TList" or "_SList" gets put on the end.
+ */
+MODE char const * pz_targ_base VALUE( NULL );
+/**
+ * The actual list of input (source) files.
+ */
+MODE char const * source_list VALUE( NULL );
+MODE size_t source_size VALUE( 0 );
+MODE size_t source_used VALUE( 0 );
+MODE bool dep_phonies VALUE( false );
+MODE char * cgi_stderr VALUE( NULL );
+
+MODE char const * server_args[2] VALUE( { NULL } );
+MODE char const * shell_program VALUE( MK_STR(CONFIG_SHELL) );
+
+/*
+ * AutoGen definiton and template context
+ *
+ * curr_def_ctx is the current, active list of name/value pairs.
+ * Points to its parent list for full search resolution.
+ *
+ * current_tpl the template (and DEFINE macro) from which
+ * the current set of macros is being extracted.
+ *
+ * These are set in exactly ONE place:
+ * On entry to the dispatch routine (gen_block). Two routines, however,
+ * must restore the values: mFunc_Define and mFunc_For. They are the only
+ * routines that dynamically push name/value pairs on the definition stack.
+ */
+MODE def_ctx_t curr_def_ctx VALUE( { NULL } );
+MODE def_ctx_t root_def_ctx VALUE( { NULL } );
+MODE templ_t * current_tpl VALUE( NULL );
+MODE char const * last_scm_cmd VALUE( NULL );
+#ifdef DAEMON_ENABLED
+/*
+ * When operating as a daemon, autogen can be told to reload
+ * its options the next time it wakes up (send it a SIGHUP).
+ */
+MODE bool redo_opts VALUE( true );
+#endif
+
+/*
+ * Current Macro
+ *
+ * This may be set in exactly three places:
+ * 1. The dispatch routine (gen_block) that steps through
+ * a list of macros
+ * 2. mFunc_If may transfer to one of its 'ELIF' or 'ELSE'
+ * alternation macros
+ * 3. mFunc_Case may transfer to one of its selection clauses.
+ */
+MODE macro_t * cur_macro VALUE( NULL );
+MODE tlib_mark_t const magic_marker VALUE( TEMPLATE_MAGIC_MARKER );
+
+/*
+ * Template Parsing Globals
+ */
+MODE int tpl_line VALUE( 1 );
+MODE scan_ctx_t * base_ctx VALUE( NULL );
+MODE scan_ctx_t * cctx VALUE( NULL );
+MODE scan_ctx_t * end_ctx VALUE( NULL );
+MODE size_t end_mac_len VALUE( 0 );
+MODE char end_mac_mark[8] VALUE( "" );
+MODE size_t st_mac_len VALUE( 0 );
+MODE char st_mac_mark[8] VALUE( "" );
+MODE out_stack_t out_root VALUE({ 0 });
+
+#define name_sep_ch '.'
+
+/*
+ * Definition Parsing Globals
+ */
+MODE char * token_str VALUE( NULL );
+MODE te_dp_event token_code VALUE( DP_EV_INVALID );
+
+MODE int ent_stack_depth VALUE( 0 );
+MODE int ent_stack_sz VALUE( 16 );
+MODE def_ent_t * dft_ent_stack[16] VALUE( { 0 } );
+MODE def_ent_t ** ent_stack VALUE( dft_ent_stack );
+MODE def_ent_t * curr_ent VALUE( NULL );
+
+MODE autogen_exit_code_t exit_code VALUE( AUTOGEN_EXIT_OPTION_ERROR );
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * IF we have fopencookie or funopen, then we also have our own fmemopen
+ */
+#ifdef ENABLE_FMEMOPEN
+extern FILE * ag_fmemopen(void *buf, ssize_t len, char const *mode);
+extern int ag_fmemioctl(FILE * fp, int req, ...);
+#endif
+
+typedef union {
+ const void* cp;
+ void* p;
+} v2c_t;
+MODE v2c_t p2p VALUE( { NULL } );
+
+#ifdef DEBUG_ENABLED
+# define AG_ABEND(s) ag_abend_at(s,__FILE__,__LINE__)
+#else
+# define AG_ABEND(s) ag_abend_at(s)
+#endif
+#define AG_CANT(_op, _wh) \
+ AG_ABEND(aprf(CANNOT_FMT, errno, _op, _wh, strerror(errno)))
+
+#ifdef DEBUG_FSM
+# define DEBUG
+#else
+# undef DEBUG
+#endif
+
+#define AG_ABEND_IN(t,m,s) \
+ STMTS( current_tpl=(t); cur_macro=(m); AG_ABEND(s);)
+
+#if __STDC_VERSION__ < 199901L
+# if __GNUC__ >= 2
+# define __func__ __FUNCTION__
+# else
+# define __func__ "<unknown>"
+# endif
+#endif
+
+/*
+ * Code variations based on the version of Guile:
+ */
+#include "guile-iface.h"
+
+#include "proto.h"
+
+static inline SCM ag_eval(char const * pzStr)
+{
+ SCM res;
+ char const * pzSaveScheme = last_scm_cmd; /* Watch for nested calls */
+ last_scm_cmd = pzStr;
+
+ res = ag_scm_c_eval_string_from_file_line(
+ pzStr, current_tpl->td_file, cur_macro->md_line);
+
+ last_scm_cmd = pzSaveScheme;
+ return res;
+}
+
+/*
+ * Extracted from guile-iface stuff. Seems to be stable since for at least
+ * 1.6.0 through 2.0.0. 1.4.x is thoroughly dead now (May, 2011).
+ */
+#define AG_SCM_DISPLAY(_s) \
+ scm_display(_s, scm_current_output_port())
+
+#define AG_SCM_BOOT_GUILE(_ac, _av, _im) \
+ scm_boot_guile((_ac), (_av), (_im), NULL)
+
+#define AG_SCM_APPLY2(_op, _f, _tst) \
+ scm_apply(_op, _f, scm_cons(_tst, AG_SCM_LISTOFNULL()))
+
+#define AG_SCM_CHAR_P(_c) SCM_CHARP(_c)
+
+/*
+ * Hide dummy functions from complexity measurement tools
+ */
+#define HIDE_FN(_t) _t
+
+#endif /* AUTOGEN_BUILD */
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/autogen.h */
diff --git a/agen5/bootstrap.dir b/agen5/bootstrap.dir
new file mode 100644
index 0000000..4d128ba
--- /dev/null
+++ b/agen5/bootstrap.dir
@@ -0,0 +1,148 @@
+#! /bin/echo This_file_must_be_sourced,_not_executed
+#
+# ----------------------------------------------------------------------
+# agen5/bootstrap.dir --- maintainer's bootstrap script
+#
+# Author: Bruce Korb <bkorb@gnu.org>
+# Time-stamp: "2012-04-14 09:39:36 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+# ----------------------------------------------------------------------
+#
+# This script rebuilds sources not kept in the GIT repository.
+# These files are distributed, so it is not necessary to invoke
+# AutoGen before building AutoGen.
+
+# "make" will invoke this file with the name of the desired output
+# as an argument. We do this here rather than in the make file
+# because some of the rules are complex and we don't want to
+# deal with the dual update problem.
+
+readonly stamp_list=$(echo "stamp-opts${nl}stamp-proto"
+ sed -n '/^make_[a-z_]*[(]/{;s/^make_/stamp-/;s/[()].*//;p;}' \
+ ${srcdir}/mk-stamps.sh)
+
+set_defaults()
+{
+ builddir=$(pwd)
+ srcdir=${srcdir:-$builddir}
+ AGexe=$(command -v autogen)
+ CLexe=$(command -v columns)
+ GDexe=$(command -v getdefs)
+
+ test -x "${AGexe}" -a -x "${GDexe}" -a -x "${CLexe}" || \
+ die "autogen is required"
+
+ export builddir srcdir AGexe CLexe GDexe
+
+ # Make sure we have a default for top build and source.
+ # Some of the templates need this information.
+ #
+ local verdata=$(egrep '^AG_' ${top_srcdir}/VERSION | \
+ sed 's,^\(AG[^=]*\)\(.*\),\1\2 export \1,')
+ eval "set -a;${verdata};set +a"
+
+ # disable any $HOME defaults
+ #
+ HOME=/dev/null
+ SHELL=${POSIX_SHELL-/bin/sh}
+
+ ${VERBOSE:-false} && set -x || :
+ # Ensure complete success or a noticable failure
+ #
+ set -e
+}
+
+assemble_Makefile() {
+ {
+ sed '/# *start-generated-text/q' ${srcdir}/Makefile.am
+ echo
+
+ echo list_stamps = '\'
+ sflist=''
+ for f in $stamp_list
+ do sflist=${sflist}$f${nl}
+ done
+ printf %s "$sflist" | \
+ ${CLexe} --spread=1 -I4 --line=' \'
+
+ echo "if AMDEP"
+ for f in $stamp_list
+ do
+ echo "@am__include@ @am__quote@./\$(DEPDIR)/${f}.d@am__quote@"
+ done
+ echo endif
+
+ fmt='\n%s:\n\t@target="$(AUTOGEN_%s_TList)" \\\n'
+ fmt=${fmt}'\t$(MAKE_STAMP)\n'
+ for f in $stamp_list
+ do
+ g=$(echo $f | sed 's/[^a-zA-Z0-9]/_/g')
+ printf "$fmt" $f $g
+ done
+ printf '\n# end-generated-text\n# end of Makefile.am\n'
+
+ } > Makefile.XX
+
+ if cmp -s Makefile.XX Makefile.am
+ then rm -f Makefile.XX
+ else mv -f Makefile.XX Makefile.am
+ fi
+}
+
+assemble_fmemopen() {
+ fmemdir=~bkorb/tools/mine/lib/fmemopen
+ test -f ${fmemdir}/fmemopen.c || return
+
+ test -f agen5/fmemopen.c && rm -f agen5/fmemopen.c
+ {
+ echo '#if defined(ENABLE_FMEMOPEN)'
+ echo '#include <sys/ioctl.h>'
+ echo
+ sed -n '/^typedef enum/,/_IOWR(/p' ${fmemdir}/libfmem.h
+ sed -e '/^#if defined(HAVE_FOPENCOOKIE)/p' \
+ -e '/=--subblock/,/^#if defined(HAVE_FOPENCOOKIE)/d' \
+ -e "s% @file .*% @file $(realpath ${fmemdir}/fmemopen.c)%" \
+ ${fmemdir}/fmemopen.c
+ echo '#endif /* ENABLE_FMEMOPEN */'
+ } > fmemopen.c
+}
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+#
+# M A I N
+#
+PS4='>bsag-${FUNCNAME}> '
+set_defaults ${1+"$@"}
+DEPDIR=
+. ${srcdir}/mk-stamps.sh $stamp_list
+assemble_fmemopen
+assemble_Makefile
+
+# IF we symlinked in columns or getdefs,
+# THEN it is time to unlink them
+#
+test -z "$rmlist" || rm -f $rmlist
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:4
+# sh-basic-offset:4
+# indent-tabs-mode: nil
+# End:
+
+# end of agen5/bootstrap.dir
diff --git a/agen5/cgi-fsm.c b/agen5/cgi-fsm.c
new file mode 100644
index 0000000..6965d79
--- /dev/null
+++ b/agen5/cgi-fsm.c
@@ -0,0 +1,323 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (cgi-fsm.c)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:35 AM by AutoGen 5.16.2pre7
+ * From the definitions cgi.def
+ * and the template file fsm
+ *
+ * Automated Finite State Machine
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name ``Bruce Korb'' nor the name of any other
+ * contributor may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * AutoFSM IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bruce Korb OR ANY OTHER CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#define DEFINE_FSM
+#include "cgi-fsm.h"
+#include <stdio.h>
+
+/*
+ * Do not make changes to this file, except between the START/END
+ * comments, or it will be removed the next time it is generated.
+ */
+/* START === USER HEADERS === DO NOT CHANGE THIS COMMENT */
+
+#include "autogen.h"
+
+/* END === USER HEADERS === DO NOT CHANGE THIS COMMENT */
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+/*
+ * Enumeration of the valid transition types
+ * Some transition types may be common to several transitions.
+ */
+typedef enum {
+ CGI_TR_INVALID,
+ CGI_TR_NAME_EQUAL,
+ CGI_TR_SEPARATE,
+ CGI_TR_STASH,
+ CGI_TR_VALUE_ESCAPE
+} te_cgi_trans;
+#define CGI_TRANSITION_CT 5
+
+/**
+ * State transition handling map. Map the state enumeration and the event
+ * enumeration to the new state and the transition enumeration code (in that
+ * order). It is indexed by first the current state and then the event code.
+ */
+typedef struct cgi_transition t_cgi_transition;
+struct cgi_transition {
+ te_cgi_state next_state;
+ te_cgi_trans transition;
+};
+static const t_cgi_transition
+cgi_trans_table[ CGI_STATE_CT ][ CGI_EVENT_CT ] = {
+
+ /* STATE 0: CGI_ST_INIT */
+ { { CGI_ST_NAME, CGI_TR_STASH }, /* EVT: ALPHA */
+ { CGI_ST_INVALID, CGI_TR_INVALID }, /* EVT: NAME_CHAR */
+ { CGI_ST_INVALID, CGI_TR_INVALID }, /* EVT: = */
+ { CGI_ST_INVALID, CGI_TR_INVALID }, /* EVT: + */
+ { CGI_ST_INVALID, CGI_TR_INVALID }, /* EVT: % */
+ { CGI_ST_INVALID, CGI_TR_INVALID }, /* EVT: OTHER */
+ { CGI_ST_INVALID, CGI_TR_INVALID }, /* EVT: & */
+ { CGI_ST_INVALID, CGI_TR_INVALID } /* EVT: END */
+ },
+
+
+ /* STATE 1: CGI_ST_NAME */
+ { { CGI_ST_NAME, CGI_TR_STASH }, /* EVT: ALPHA */
+ { CGI_ST_NAME, CGI_TR_STASH }, /* EVT: NAME_CHAR */
+ { CGI_ST_VALUE, CGI_TR_NAME_EQUAL }, /* EVT: = */
+ { CGI_ST_INVALID, CGI_TR_INVALID }, /* EVT: + */
+ { CGI_ST_INVALID, CGI_TR_INVALID }, /* EVT: % */
+ { CGI_ST_INVALID, CGI_TR_INVALID }, /* EVT: OTHER */
+ { CGI_ST_INVALID, CGI_TR_INVALID }, /* EVT: & */
+ { CGI_ST_INVALID, CGI_TR_INVALID } /* EVT: END */
+ },
+
+
+ /* STATE 2: CGI_ST_VALUE */
+ { { CGI_ST_VALUE, CGI_TR_STASH }, /* EVT: ALPHA */
+ { CGI_ST_VALUE, CGI_TR_STASH }, /* EVT: NAME_CHAR */
+ { CGI_ST_VALUE, CGI_TR_STASH }, /* EVT: = */
+ { CGI_ST_VALUE, CGI_TR_STASH }, /* EVT: + */
+ { CGI_ST_VALUE, CGI_TR_VALUE_ESCAPE }, /* EVT: % */
+ { CGI_ST_VALUE, CGI_TR_STASH }, /* EVT: OTHER */
+ { CGI_ST_INIT, CGI_TR_SEPARATE }, /* EVT: & */
+ { CGI_ST_DONE, CGI_TR_SEPARATE } /* EVT: END */
+ }
+};
+
+
+#define CgiFsmErr_off 19
+#define CgiEvInvalid_off 75
+#define CgiStInit_off 83
+
+
+static char const zCgiStrings[133] =
+/* 0 */ "** OUT-OF-RANGE **\0"
+/* 19 */ "FSM Error: in state %d (%s), event %d (%s) is invalid\n\0"
+/* 75 */ "invalid\0"
+/* 83 */ "init\0"
+/* 88 */ "name\0"
+/* 93 */ "value\0"
+/* 99 */ "alpha\0"
+/* 105 */ "name_char\0"
+/* 115 */ "=\0"
+/* 117 */ "+\0"
+/* 119 */ "%\0"
+/* 121 */ "other\0"
+/* 127 */ "&\0"
+/* 129 */ "end";
+
+static const size_t aszCgiStates[3] = {
+ 83, 88, 93 };
+
+static const size_t aszCgiEvents[9] = {
+ 99, 105, 115, 117, 119, 121, 127, 129, 75 };
+
+
+#define CGI_EVT_NAME(t) ( (((unsigned)(t)) >= 9) \
+ ? zCgiStrings : zCgiStrings + aszCgiEvents[t])
+
+#define CGI_STATE_NAME(s) ( (((unsigned)(s)) >= 3) \
+ ? zCgiStrings : zCgiStrings + aszCgiStates[s])
+
+#ifndef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
+static int cgi_invalid_transition( te_cgi_state st, te_cgi_event evt );
+
+/* * * * * * * * * THE CODE STARTS HERE * * * * * * * *
+ *
+ * Print out an invalid transition message and return EXIT_FAILURE
+ */
+static int
+cgi_invalid_transition( te_cgi_state st, te_cgi_event evt )
+{
+ /* START == INVALID TRANS MSG == DO NOT CHANGE THIS COMMENT */
+ char* pz = aprf( zCgiStrings + CgiFsmErr_off, st, CGI_STATE_NAME( st ),
+ evt, CGI_EVT_NAME( evt ));
+
+ AG_ABEND( aprf(CGI_PARSE_ERR_FMT, pz ));
+ /* END == INVALID TRANS MSG == DO NOT CHANGE THIS COMMENT */
+
+ return EXIT_FAILURE;
+}
+
+/**
+ * Run the FSM. Will return CGI_ST_DONE or CGI_ST_INVALID
+ */
+te_cgi_state
+cgi_run_fsm(
+ char const* pzSrc,
+ int inlen,
+ char* pzOut,
+ int outlen )
+{
+ te_cgi_state cgi_state = CGI_ST_INIT;
+ te_cgi_event trans_evt;
+ te_cgi_state nxtSt;
+ te_cgi_trans trans;
+ char const* saved_pzSrc = pzSrc;
+ int saved_inlen = inlen;
+ char* saved_pzOut = pzOut;
+ int saved_outlen = outlen;
+ (void)saved_pzSrc;
+ (void)saved_inlen;
+ (void)saved_pzOut;
+ (void)saved_outlen;
+
+ while (cgi_state < CGI_ST_INVALID) {
+
+ /* START == FIND TRANSITION == DO NOT CHANGE THIS COMMENT */
+
+ char curCh;
+ if (--inlen < 0) {
+ trans_evt = CGI_EV_END;
+ curCh = NUL;
+
+ } else {
+ if (outlen < 4) {
+ static char const exhaustion[] = "output space exhausted\n";
+ if (saved_outlen > (int)sizeof(exhaustion))
+ memcpy(saved_pzOut, exhaustion, sizeof(exhaustion));
+
+ return CGI_ST_INVALID;
+ }
+ curCh = *(pzSrc++);
+ if (IS_ALPHABETIC_CHAR( curCh ))
+ trans_evt = CGI_EV_ALPHA;
+ else if (IS_DEC_DIGIT_CHAR( curCh ))
+ trans_evt = CGI_EV_NAME_CHAR;
+ else switch (curCh) {
+ case '_': trans_evt = CGI_EV_NAME_CHAR; break;
+ case '=': trans_evt = CGI_EV_EQUAL; break;
+ case '+': trans_evt = CGI_EV_SPACE; curCh = ' '; break;
+ case '%': trans_evt = CGI_EV_ESCAPE; break;
+ case '&': trans_evt = CGI_EV_SEPARATOR; break;
+ default: trans_evt = CGI_EV_OTHER; break;
+ }
+ }
+
+ /* END == FIND TRANSITION == DO NOT CHANGE THIS COMMENT */
+
+#ifndef __COVERITY__
+ if (trans_evt >= CGI_EV_INVALID) {
+ nxtSt = CGI_ST_INVALID;
+ trans = CGI_TR_INVALID;
+ } else
+#endif /* __COVERITY__ */
+ {
+ const t_cgi_transition* pTT =
+ cgi_trans_table[ cgi_state ] + trans_evt;
+ nxtSt = pTT->next_state;
+ trans = pTT->transition;
+ }
+
+
+ switch (trans) {
+ case CGI_TR_INVALID:
+ /* START == INVALID == DO NOT CHANGE THIS COMMENT */
+ exit( cgi_invalid_transition( cgi_state, trans_evt ));
+ /* END == INVALID == DO NOT CHANGE THIS COMMENT */
+ break;
+
+
+ case CGI_TR_NAME_EQUAL:
+ /* START == NAME_EQUAL == DO NOT CHANGE THIS COMMENT */
+ strcpy( pzOut, "='" );
+ outlen -= 2;
+ pzOut += 2;
+ /* END == NAME_EQUAL == DO NOT CHANGE THIS COMMENT */
+ break;
+
+
+ case CGI_TR_SEPARATE:
+ /* START == SEPARATE == DO NOT CHANGE THIS COMMENT */
+ strcpy( pzOut, "';\n" );
+ outlen -= 2;
+ pzOut += 3;
+ /* END == SEPARATE == DO NOT CHANGE THIS COMMENT */
+ break;
+
+
+ case CGI_TR_STASH:
+ /* START == STASH == DO NOT CHANGE THIS COMMENT */
+ *(pzOut++) = curCh;
+ outlen--;
+ /* END == STASH == DO NOT CHANGE THIS COMMENT */
+ break;
+
+
+ case CGI_TR_VALUE_ESCAPE:
+ /* START == VALUE_ESCAPE == DO NOT CHANGE THIS COMMENT */
+ {
+ char z[4];
+ if (inlen < 2)
+ exit( cgi_invalid_transition( cgi_state, trans_evt ));
+
+ z[0] = *(pzSrc++);
+ z[1] = *(pzSrc++);
+ z[2] = NUL;
+ inlen -= 2;
+
+ /*
+ * We must backslash quote certain characters that are %-quoted
+ * in the input string:
+ */
+ switch (*(pzOut++) = (int)strtol( z, NULL, 16 )) {
+ case '\'':
+ case '\\':
+ case '#':
+ pzOut[0] = pzOut[-1];
+ pzOut[-1] = '\\';
+ pzOut++;
+ }
+ }
+ /* END == VALUE_ESCAPE == DO NOT CHANGE THIS COMMENT */
+ break;
+
+
+ default:
+ /* START == BROKEN MACHINE == DO NOT CHANGE THIS COMMENT */
+ exit( cgi_invalid_transition( cgi_state, trans_evt ));
+ /* END == BROKEN MACHINE == DO NOT CHANGE THIS COMMENT */
+ }
+
+ cgi_state = nxtSt;
+ }
+ return cgi_state;
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of cgi-fsm.c */
diff --git a/agen5/cgi-fsm.h b/agen5/cgi-fsm.h
new file mode 100644
index 0000000..4a1cedf
--- /dev/null
+++ b/agen5/cgi-fsm.h
@@ -0,0 +1,91 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (cgi-fsm.h)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:35 AM by AutoGen 5.16.2pre7
+ * From the definitions cgi.def
+ * and the template file fsm
+ *
+ * Automated Finite State Machine
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name ``Bruce Korb'' nor the name of any other
+ * contributor may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * AutoFSM IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bruce Korb OR ANY OTHER CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * This file enumerates the states and transition events for a FSM.
+ *
+ * te_cgi_state
+ * The available states. FSS_INIT is always defined to be zero
+ * and FSS_INVALID and FSS_DONE are always made the last entries.
+ *
+ * te_cgi_event
+ * The transition events. These enumerate the event values used
+ * to select the next state from the current state.
+ * CGI_EV_INVALID is always defined at the end.
+ */
+#ifndef AUTOFSM_CGI_FSM_H_GUARD
+#define AUTOFSM_CGI_FSM_H_GUARD 1
+
+/*
+ * Finite State machine States
+ *
+ * Count of non-terminal states. The generated states INVALID and DONE
+ * are terminal, but INIT is not :-).
+ */
+#define CGI_STATE_CT 3
+typedef enum {
+ CGI_ST_INIT, CGI_ST_NAME, CGI_ST_VALUE, CGI_ST_INVALID,
+ CGI_ST_DONE
+} te_cgi_state;
+
+/*
+ * Finite State machine transition Events.
+ *
+ * Count of the valid transition events
+ */
+#define CGI_EVENT_CT 8
+typedef enum {
+ CGI_EV_ALPHA, CGI_EV_NAME_CHAR, CGI_EV_EQUAL, CGI_EV_SPACE,
+ CGI_EV_ESCAPE, CGI_EV_OTHER, CGI_EV_SEPARATOR, CGI_EV_END,
+ CGI_EV_INVALID
+} te_cgi_event;
+
+/**
+ * Run the FSM. Will return CGI_ST_DONE or CGI_ST_INVALID
+ */
+extern te_cgi_state
+cgi_run_fsm(
+ char const* pzSrc,
+ int inlen,
+ char* pzOut,
+ int outlen );
+
+#endif /* AUTOFSM_CGI_FSM_H_GUARD */
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of cgi-fsm.h */
diff --git a/agen5/cgi.def b/agen5/cgi.def
new file mode 100644
index 0000000..5175bc1
--- /dev/null
+++ b/agen5/cgi.def
@@ -0,0 +1,55 @@
+
+/*
+ * Time-stamp: "2010-06-30 20:53:21 bkorb"
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+autogen definitions fsm;
+
+/*
+ * This FSM is used to process input CGI data into AutoGen definitions
+ * output. There are three basic states: initial, name processing
+ * and processing a value.
+ */
+
+method = case;
+type = loop;
+cookie = "char const* pzSrc";
+cookie = "int inlen";
+cookie = "char* pzOut";
+cookie = "int outlen";
+
+state = name, value;
+event = alpha, name_char, equal, space, escape, other, separator, end;
+
+equal = "=";
+space = "+";
+escape = "%";
+separator = "&";
+
+transition =
+ { tst = init; tev = alpha; next = name; ttype = stash; },
+ { tst = name; tev = alpha, name_char; ttype = stash; },
+ { tst = name; tev = equal; next = value; },
+ { tst = value; tev = '*'; ttype = stash; },
+ { tst = value; tev = space; ttype = stash; },
+ { tst = value; tev = escape; },
+ { tst = value; tev = end; next = done; ttype = separate; },
+ { tst = value; tev = separator; next = init; ttype = separate; };
+
+/* end of agen5/cgi.def */
diff --git a/agen5/defDirect.c b/agen5/defDirect.c
new file mode 100644
index 0000000..5da38e1
--- /dev/null
+++ b/agen5/defDirect.c
@@ -0,0 +1,1048 @@
+/**
+ * @file defDirect.c
+ *
+ * Time-stamp: "2012-03-31 13:59:07 bkorb"
+ *
+ * This module processes definition file directives.
+ *
+ * blocksort spacing=2 \
+ * output=defDirect-sorted.c \
+ * input=defDirect.c \
+ * pat='^/\*=directive' \
+ * start='^doDir_IGNORE' \
+ * trail='\+\+\+ End of Directives'
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#define NO_MATCH_ERR(_typ) \
+AG_ABEND(aprf(DIRECT_NOMATCH_FMT, cctx->scx_fname, cctx->scx_line, _typ))
+
+static int ifdefLevel = 0;
+
+static teDirectives
+findDirective(char* pzDirName);
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * processDirective
+ *
+ * THIS IS THE ONLY EXTERNAL ENTRY POINT
+ *
+ * A directive character has been found.
+ * Decide what to do and return a pointer to the character
+ * where scanning is to resume.
+ */
+LOCAL char*
+processDirective(char* pzScan)
+{
+ const tDirTable * pTbl = dirTable;
+ char * pzDir;
+ char * pzEnd;
+
+ /*
+ * Search for the end of the #-directive.
+ * Replace "\\\n" sequences with " ".
+ */
+ for (;;) {
+ pzEnd = strchr(pzScan, NL);
+
+ if (pzEnd == NULL) {
+ /*
+ * The end of the directive is the end of the string
+ */
+ pzEnd = pzScan + strlen(pzScan);
+ break;
+ }
+ cctx->scx_line++;
+
+ if (pzEnd[-1] != '\\') {
+ /*
+ * The end of the directive is the end of the line
+ * and the line has not been continued.
+ */
+ *(pzEnd++) = NUL;
+ break;
+ }
+
+ /*
+ * Replace the escape-newline pair with spaces and
+ * find the next end of line
+ */
+ pzEnd[-1] = pzEnd[0] = ' ';
+ }
+
+ /*
+ * Ignore ``#!'' as a comment, enabling a definition file to behave
+ * as a script that gets interpreted by autogen. :-)
+ */
+ if (*pzScan == '!')
+ return pzEnd;
+
+ /*
+ * Find the start of the directive name. Ensure it _is_ a name.
+ */
+ pzScan = SPN_WHITESPACE_CHARS(pzScan);
+ if (! IS_ALPHABETIC_CHAR(*pzScan))
+ return pzEnd;
+
+ /*
+ * Find the *END* of the directive name.
+ */
+ pzDir = pzScan;
+ pzScan = SPN_ALPHABETIC_CHARS(pzScan+1);
+
+ /*
+ * IF there is anything that follows the name, ...
+ */
+ if (*pzScan != NUL) {
+ char * pz;
+
+ /*
+ * IF something funny immediately follows the directive name,
+ * THEN we will ignore it completely.
+ */
+ if (! IS_WHITESPACE_CHAR(*pzScan))
+ return pzEnd;
+
+ /*
+ * Terminate the name being defined
+ * and find the start of anything else.
+ */
+ *pzScan = NUL;
+ pzScan = SPN_WHITESPACE_CHARS(pzScan+1);
+
+
+ /*
+ * Trim off trailing white space
+ */
+ pz = pzScan + strlen(pzScan);
+ while ( (pz > pzScan)
+ && IS_WHITESPACE_CHAR(pz[-1])) pz--;
+ *pz = NUL;
+ }
+
+ pTbl = dirTable + (int)findDirective(pzDir);
+ return (*(pTbl->pDirProc))(pzScan, pzEnd);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Figure out the index of a directive. We will return the directive
+ * count if it is a bogus name.
+ */
+
+static teDirectives
+findDirective(char* pzDirName)
+{
+ teDirectives res = (teDirectives)0;
+ const tDirTable * pTbl = dirTable;
+
+ do {
+ if (strneqvcmp(pzDirName, pTbl->pzDirName, pTbl->nameSize) != 0)
+ continue;
+
+ /*
+ * A directive name ends with either white space or a NUL
+ */
+ if (IS_END_TOKEN_CHAR(pzDirName[ pTbl->nameSize ]))
+ return res;
+
+ } while (pTbl++, ++res < DIRECTIVE_CT);
+
+ {
+ char ch;
+ if (strlen(pzDirName) > 32) {
+ ch = pzDirName[32];
+ pzDirName[32] = NUL;
+ } else {
+ ch = NUL;
+ }
+
+ fprintf(trace_fp, FIND_DIRECT_UNKNOWN, cctx->scx_fname,
+ cctx->scx_line, pzDirName);
+
+ if (ch != NUL)
+ pzDirName[32] = ch;
+ }
+ return res;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Support routines for the directives
+ *
+ * skipToEndif
+ *
+ * Skip through the text to a matching "#endif". We do this when we
+ * have processed the allowable text (found an "#else" after
+ * accepting the preceeding text) or when encountering a "#if*def"
+ * while skipping a block of text due to a failed test.
+ */
+static char*
+skipToEndif(char* pzStart)
+{
+ char* pzScan = pzStart;
+ char* pzRet;
+
+ for (;;) {
+ /*
+ * 'pzScan' is pointing to the first character on a line.
+ * Check for a directive on the current line before scanning
+ * later lines.
+ */
+ if (*pzScan == '#')
+ pzScan++;
+ else {
+ char* pz = strstr(pzScan, DIRECT_CK_LIST_MARK);
+ if (pz == NULL)
+ AG_ABEND(aprf(DIRECT_NOENDIF_FMT, cctx->scx_fname,
+ cctx->scx_line));
+
+ pzScan = pz + 2;
+ }
+
+ pzScan = SPN_WHITESPACE_CHARS(pzScan);
+
+ switch (findDirective(pzScan)) {
+ case DIR_ENDIF:
+ {
+ /*
+ * We found the endif we are interested in
+ */
+ char* pz = strchr(pzScan, NL);
+ if (pz != NULL)
+ pzRet = pz+1;
+ else pzRet = pzScan + strlen(pzScan);
+ goto leave_func;
+ }
+
+ case DIR_IFDEF:
+ case DIR_IFNDEF:
+ /*
+ * We found a nested ifdef/ifndef
+ */
+ pzScan = skipToEndif(pzScan);
+ break;
+
+ default:
+ /*
+ * We do not care what we found
+ */
+ break; /* ignore it */
+ } /* switch (findDirective(pzScan)) */
+ }
+
+ leave_func:
+ while (pzStart < pzRet) {
+ if (*(pzStart++) == NL)
+ cctx->scx_line++;
+ }
+ return pzRet;
+}
+
+
+static char*
+skipToEndmac(char* pzStart)
+{
+ char* pzScan = pzStart;
+ char* pzRet;
+
+ for (;;) {
+ /*
+ * 'pzScan' is pointing to the first character on a line.
+ * Check for a directive on the current line before scanning
+ * later lines.
+ */
+ if (*pzScan == '#')
+ pzScan++;
+ else {
+ char* pz = strstr(pzScan, DIRECT_CK_LIST_MARK);
+ if (pz == NULL)
+ AG_ABEND(aprf(DIRECT_NOENDIF_FMT, cctx->scx_fname,
+ cctx->scx_line));
+
+ pzScan = pz + 2;
+ }
+
+ pzScan = SPN_WHITESPACE_CHARS(pzScan);
+
+ if (findDirective(pzScan) == DIR_ENDMAC) {
+ /*
+ * We found the endmac we are interested in
+ */
+ char* pz = strchr(pzScan, NL);
+ if (pz != NULL)
+ pzRet = pz+1;
+ else pzRet = pzScan + strlen(pzScan);
+ break;
+ }
+ }
+
+ while (pzStart < pzRet) {
+ if (*(pzStart++) == NL)
+ cctx->scx_line++;
+ }
+ return pzRet;
+}
+
+
+/*
+ * skipToElseEnd
+ *
+ * Skip through the text to a matching "#endif" or "#else" or
+ * "#elif*def". We do this when we are skipping code due to a failed
+ * "#if*def" test.
+ */
+static char*
+skipToElseEnd(char* pzStart)
+{
+ char* pzScan = pzStart;
+ char* pzRet;
+
+ for (;;) {
+ /*
+ * 'pzScan' is pointing to the first character on a line.
+ * Check for a directive on the current line before scanning
+ * later lines.
+ */
+ if (*pzScan == '#')
+ pzScan++;
+ else {
+ char* pz = strstr(pzScan, DIRECT_CK_LIST_MARK);
+ if (pz == NULL)
+ AG_ABEND(aprf(DIRECT_NOENDIF_FMT, cctx->scx_fname,
+ cctx->scx_line));
+
+ pzScan = pz + 2;
+ }
+
+ pzScan = SPN_WHITESPACE_CHARS(pzScan);
+
+ switch (findDirective(pzScan)) {
+ case DIR_ELSE:
+ /*
+ * We found an "else" directive for an "ifdef"/"ifndef"
+ * that we were skipping over. Start processing the text.
+ */
+ ifdefLevel++;
+ /* FALLTHROUGH */
+
+ case DIR_ENDIF:
+ {
+ /*
+ * We reached the end of the "ifdef"/"ifndef" we were
+ * skipping (or we dropped in from above).
+ * Start processing the text.
+ */
+ char* pz = strchr(pzScan, NL);
+ if (pz != NULL)
+ pzRet = pz+1;
+ else pzRet = pzScan + strlen(pzScan);
+ goto leave_func;
+ }
+
+ case DIR_IFDEF:
+ case DIR_IFNDEF:
+ /*
+ * We have found a nested "ifdef"/"ifndef".
+ * Call "skipToEndif()" to find *its* end, then
+ * resume looking for our own "endif" or "else".
+ */
+ pzScan = skipToEndif(pzScan);
+ break;
+
+ default:
+ /*
+ * We either don't know what it is or we do not care.
+ */
+ break;
+ } /* switch (findDirective(pzScan)) */
+ }
+
+ leave_func:
+ while (pzStart < pzRet) {
+ if (*(pzStart++) == NL)
+ cctx->scx_line++;
+ }
+ return pzRet;
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Special routines for each directive. These routines are *ONLY*
+ * called from the table when the input is being processed.
+ * After this routine are either declarations or definitions of
+ * directive handling routines. The documentation for these routines
+ * is extracted from this file. See 'makedef.sh' for how it works.
+ * Each declared directive should have either a 'dummy:' section
+ * (if the directive is to be ignored) or a 'text:' section
+ * (if there is some form of implementation). If the directive
+ * needs or may take arguments (e.g. '#define'), then there should
+ * also be an 'arg:' section describing the argument(s).
+ */
+static char *
+doDir_IGNORE(char * arg, char * scan)
+{
+ (void)arg;
+ return scan;
+}
+
+
+/*=directive assert
+ *
+ * arg: `shell-script` | (scheme-expr) | <anything else>
+ *
+ * text:
+ * If the @code{shell-script} or @code{scheme-expr} do not yield @code{true}
+ * valued results, autogen will be aborted. If @code{<anything else>} or
+ * nothing at all is provided, then this directive is ignored.
+ *
+ * When writing the shell script, remember this is on a preprocessing
+ * line. Multiple lines must be backslash continued and the result is a
+ * single long line. Separate multiple commands with semi-colons.
+ *
+ * The result is @code{false} (and fails) if the result is empty, the
+ * number zero, or a string that starts with the letters 'n' or 'f' ("no"
+ * or "false").
+=*/
+static void
+check_assert_str(char const* pz, char const* pzArg)
+{
+ pz = SPN_WHITESPACE_CHARS(pz);
+
+ if (IS_FALSE_TYPE_CHAR(*pz))
+ AG_ABEND(aprf(DIRECT_ASSERT_FMT, pz, pzArg));
+}
+
+static char*
+doDir_assert(char* pzArg, char* pzScan)
+{
+ switch (*pzArg) {
+ case '`':
+ {
+ char* pzS = pzArg+1;
+ char* pzR;
+
+ pzR = strrchr(pzS, '`');
+ if (pzR == NULL)
+ break; /* not a valid script */
+
+ *pzR = NUL;
+ pzS = shell_cmd((char const*)pzS);
+ check_assert_str(pzS, pzArg);
+ free(pzS);
+ break;
+ }
+
+ case '(':
+ {
+ SCM res = ag_scm_c_eval_string_from_file_line(
+ pzArg, cctx->scx_fname, cctx->scx_line );
+
+ check_assert_str(scm2display(res), pzArg);
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ return pzScan;
+}
+
+
+/*=directive define
+ *
+ * arg: name [ <text> ]
+ *
+ * text:
+ * Will add the name to the define list as if it were a DEFINE program
+ * argument. Its value will be the first non-whitespace token following
+ * the name. Quotes are @strong{not} processed.
+ *
+ * After the definitions file has been processed, any remaining entries
+ * in the define list will be added to the environment.
+=*/
+static char*
+doDir_define(char* pzArg, char* pzScan)
+{
+ char* pzName = pzArg;
+
+ /*
+ * Skip any #defines that do not look reasonable
+ */
+ if (! IS_VAR_FIRST_CHAR(*pzArg))
+ return pzScan;
+
+ pzArg = SPN_VARIABLE_NAME_CHARS(pzArg);
+
+ /*
+ * IF this is a macro definition (rather than a value def),
+ * THEN we will ignore it.
+ */
+ if (*pzArg == '(')
+ return pzScan;
+
+ /*
+ * We have found the end of the name.
+ * IF there is no more data on the line,
+ * THEN we do not have space for the '=' required by PUTENV.
+ * Therefore, move the name back over the "#define"
+ * directive itself, giving us the space needed.
+ */
+ if (! IS_WHITESPACE_CHAR(*pzArg)) {
+ char* pzS = pzName;
+ char* pzD = (pzName -= 6);
+
+ *pzArg = NUL;
+ while ((*(pzD++) = *(pzS++)) != NUL) ;
+ pzD[-1] = '=';
+ pzD[ 0] = NUL;
+
+ } else {
+ /*
+ * Otherwise, insert the '=' and move any data up against it.
+ * We only accept one name-type, space separated token.
+ * We are not ANSI-C. ;-)
+ */
+ char* pz = pzArg+1;
+ *pzArg++ = '=';
+ pz = SPN_WHITESPACE_CHARS(pz);
+
+ for (;;) {
+ if ((*pzArg++ = *pz++) == NUL)
+ break;
+ if (! IS_UNQUOTABLE_CHAR(*pz)) {
+ *pzArg = NUL;
+ break;
+ }
+ }
+ }
+
+ SET_OPT_DEFINE(pzName);
+ return pzScan;
+}
+
+
+/*=directive elif
+ *
+ * text:
+ * This must follow an @code{#if}
+ * otherwise it will generate an error.
+ * It will be ignored.
+=*/
+static char *
+doDir_elif(char * arg, char * scan)
+{
+ (void)arg;
+ (void)scan;
+ AG_ABEND(aprf(DIRECT_ELIF_BAD_FMT, cctx->scx_fname, cctx->scx_line));
+ /* NOTREACHED */
+ return NULL;
+}
+
+
+/*=directive else
+ *
+ * text:
+ * This must follow an @code{#if}, @code{#ifdef} or @code{#ifndef}.
+ * If it follows the @code{#if}, then it will be ignored. Otherwise,
+ * it will change the processing state to the reverse of what it was.
+=*/
+static char *
+doDir_else(char * arg, char * scan)
+{
+ (void)arg;
+ if (--ifdefLevel < 0)
+ NO_MATCH_ERR(DIRECT_ELSE_BAD);
+
+ return skipToEndif(scan);
+}
+
+
+/*=directive endif
+ *
+ * text:
+ * This must follow an @code{#if}, @code{#ifdef} or @code{#ifndef}.
+ * In all cases, this will resume normal processing of text.
+=*/
+static char *
+doDir_endif(char * arg, char * scan)
+{
+ (void)arg;
+ if (--ifdefLevel < 0)
+ NO_MATCH_ERR(DIRECT_ENDIF_BAD);
+
+ return scan;
+}
+
+
+/*=directive endmac
+ *
+ * text:
+ * This terminates a "macdef", but must not ever be encountered directly.
+=*/
+static char *
+doDir_endmac(char * arg, char * scan)
+{
+ NO_MATCH_ERR(DIRECT_ENDMAC_BAD);
+ (void)arg;
+ (void)scan;
+ /* NOTREACHED */
+ return NULL;
+}
+
+
+/*=directive endshell
+ *
+ * text:
+ * Ends the text processed by a command shell into autogen definitions.
+=*/
+static char *
+doDir_endshell(char * arg, char * scan)
+{
+ /*
+ * In actual practice, the '#endshell's must be consumed inside
+ * the 'doDir_shell()' procedure.
+ */
+ NO_MATCH_ERR(DIRECT_ENDSHELL_BAD);
+ (void)arg;
+ (void)scan;
+ /* NOTREACHED */
+ return NULL;
+}
+
+
+/*=directive error
+ *
+ * arg: [ <descriptive text> ]
+ *
+ * text:
+ * This directive will cause AutoGen to stop processing
+ * and exit with a status of EXIT_FAILURE.
+=*/
+static char *
+doDir_error(char * arg, char * scan)
+{
+ (void)scan;
+
+ AG_ABEND(aprf(DIRECT_ERROR_FMT, cctx->scx_fname, cctx->scx_line, arg));
+ /* NOTREACHED */
+ return NULL;
+}
+
+
+/*=directive ident
+ *
+ * dummy: Ident directives are ignored.
+=*/
+
+
+/*=directive if
+ *
+ * arg: [ <ignored conditional expression> ]
+ *
+ * text:
+ * @code{#if} expressions are not analyzed. @strong{Everything} from here
+ * to the matching @code{#endif} is skipped.
+=*/
+static char *
+doDir_if(char * arg, char * pzScan)
+{
+ (void)arg;
+
+ return skipToEndif(pzScan);
+}
+
+
+/*=directive ifdef
+ *
+ * arg: name-to-test
+ *
+ * text:
+ * The definitions that follow, up to the matching @code{#endif} will be
+ * processed only if there is a corresponding @code{-Dname} command line
+ * option or if a @code{#define} of that name has been previously encountered.
+=*/
+static char *
+doDir_ifdef(char * pzArg, char * pzScan)
+{
+ if (get_define_str(pzArg, false) == NULL)
+ return skipToElseEnd(pzScan);
+ ifdefLevel++;
+ return pzScan;
+}
+
+
+/*=directive ifndef
+ *
+ * arg: name-to-test
+ *
+ * text:
+ * The definitions that follow, up to the matching @code{#endif} will be
+ * processed only if there is @strong{not} a corresponding @code{-Dname}
+ * command line option or there was a canceling @code{-Uname} option.
+=*/
+static char *
+doDir_ifndef(char * pzArg, char * pzScan)
+{
+ if (get_define_str(pzArg, false) != NULL)
+ return skipToElseEnd(pzScan);
+ ifdefLevel++;
+ return pzScan;
+}
+
+
+/*=directive include
+ *
+ * arg: unadorned-file-name
+ *
+ * text:
+ * This directive will insert definitions from another file into
+ * the current collection. If the file name is adorned with
+ * double quotes or angle brackets (as in a C program), then the
+ * include is ignored.
+=*/
+static char*
+doDir_include(char* pzArg, char* pzScan)
+{
+ static char const * const apzSfx[] = { DIRECT_INC_DEF_SFX, NULL };
+ scan_ctx_t* pCtx;
+ size_t inclSize;
+ char zFullName[ AG_PATH_MAX + 1 ];
+
+ /*
+ * Ignore C-style includes. This allows "C" files to be processed
+ * for their "#define"s.
+ */
+ if ((*pzArg == '"') || (*pzArg == '<'))
+ return pzScan;
+ cctx->scx_scan = pzScan;
+
+ if (! SUCCESSFUL(
+ find_file(pzArg, zFullName, apzSfx, cctx->scx_fname))) {
+ fprintf(trace_fp, DIRECT_INC_CANNOT_FIND,
+ pzArg);
+ return pzScan;
+ }
+
+ /*
+ * Make sure the specified file is a regular file and we can get
+ * the correct size for it.
+ */
+ {
+ struct stat stbf;
+ if (stat(zFullName, &stbf) != 0) {
+ fprintf(trace_fp, DIRECT_INC_CANNOT_STAT, errno, strerror(errno),
+ zFullName);
+ return pzScan;
+ }
+ if (! S_ISREG(stbf.st_mode)) {
+ fprintf(trace_fp, DIRECT_INC_NOT_REG, zFullName);
+ return pzScan;
+ }
+ inclSize = stbf.st_size;
+ if (outfile_time < stbf.st_mtime)
+ outfile_time = stbf.st_mtime;
+ }
+
+ if (inclSize == 0)
+ return pzScan;
+
+ /*
+ * Get the space for the output data and for context overhead.
+ * This is an extra allocation and copy, but easier than rewriting
+ * 'loadData()' for this special context.
+ */
+ {
+ size_t sz = sizeof(scan_ctx_t) + 4 + inclSize;
+ pCtx = (scan_ctx_t*)AGALOC(sz, "inc def head");
+
+ memset((void*)pCtx, 0, sz);
+ pCtx->scx_line = 1;
+ }
+
+ /*
+ * Link it into the context stack
+ */
+ pCtx->scx_next = cctx;
+ cctx = pCtx;
+ AGDUPSTR(pCtx->scx_fname, zFullName, "def file");
+
+ pCtx->scx_scan =
+ pCtx->scx_data =
+ pzScan = (char*)(pCtx + 1);
+
+ /*
+ * Read all the data. Usually in a single read, but loop
+ * in case multiple passes are required.
+ */
+ {
+ FILE* fp = fopen(zFullName, "r" FOPEN_TEXT_FLAG);
+ char* pz = pzScan;
+
+ if (fp == NULL)
+ AG_CANT(DIRECT_INC_CANNOT_OPEN, zFullName);
+
+ if (dep_fp != NULL)
+ add_source_file(zFullName);
+
+ do {
+ size_t rdct = fread((void*)pz, (size_t)1, inclSize, fp);
+
+ if (rdct == 0)
+ AG_CANT(DIRECT_INC_CANNOT_READ, zFullName);
+
+ pz += rdct;
+ inclSize -= rdct;
+ } while (inclSize > 0);
+
+ fclose(fp);
+ *pz = NUL;
+ }
+
+ return pzScan;
+}
+
+
+/*=directive let
+ *
+ * dummy: let directives are ignored.
+=*/
+
+
+/*=directive line
+ *
+ * text:
+ *
+ * Alters the current line number and/or file name. You may wish to
+ * use this directive if you extract definition source from other files.
+ * @command{getdefs} uses this mechanism so AutoGen will report the correct
+ * file and approximate line number of any errors found in extracted
+ * definitions.
+=*/
+static char*
+doDir_line(char* pzArg, char* pzScan)
+{
+ /*
+ * The sequence must be: #line <number> "file-name-string"
+ *
+ * Start by scanning up to and extracting the line number.
+ */
+ pzArg = SPN_WHITESPACE_CHARS(pzArg);
+ if (! IS_DEC_DIGIT_CHAR(*pzArg))
+ return pzScan;
+
+ cctx->scx_line = strtol(pzArg, &pzArg, 0);
+
+ /*
+ * Now extract the quoted file name string.
+ * We dup the string so it won't disappear on us.
+ */
+ pzArg = SPN_WHITESPACE_CHARS(pzArg);
+ if (*(pzArg++) != '"')
+ return pzScan;
+ {
+ char* pz = strchr(pzArg, '"');
+ if (pz == NULL)
+ return pzScan;
+ *pz = NUL;
+ }
+
+ AGDUPSTR(cctx->scx_fname, pzArg, "#line");
+
+ return pzScan;
+}
+
+
+/*=directive macdef
+ *
+ * text:
+ * This is a new AT&T research preprocessing directive. Basically, it is
+ * a multi-line #define that may include other preprocessing directives.
+=*/
+static char*
+doDir_macdef(char* arg, char* pzScan)
+{
+ (void)arg;
+
+ return skipToEndmac(pzScan);
+}
+
+
+/*=directive option
+ *
+ * arg: opt-name [ <text> ]
+ *
+ * text:
+ *
+ * This directive will pass the option name and associated text to the
+ * AutoOpts optionLoadLine routine (@pxref{libopts-optionLoadLine}). The
+ * option text may span multiple lines by continuing them with a backslash.
+ * The backslash/newline pair will be replaced with two space characters.
+ * This directive may be used to set a search path for locating template files
+ * For example, this:
+ *
+ * @example
+ * #option templ-dirs $ENVVAR/dirname
+ * @end example
+ * @noindent
+ * will direct autogen to use the @code{ENVVAR} environment variable to find
+ * a directory named @code{dirname} that (may) contain templates. Since these
+ * directories are searched in most recently supplied first order, search
+ * directories supplied in this way will be searched before any supplied on
+ * the command line.
+=*/
+static char*
+doDir_option(char* pzArg, char* pzScan)
+{
+ optionLoadLine(&autogenOptions, pzArg);
+ return pzScan;
+}
+
+
+/*=directive pragma
+ *
+ * dummy: pragma directives are ignored.
+=*/
+
+
+/*=directive shell
+ *
+ * text:
+ * Invokes @code{$SHELL} or @file{/bin/sh} on a script that should
+ * generate AutoGen definitions. It does this using the same server
+ * process that handles the back-quoted @code{`} text.
+ * @strong{CAUTION}@: let not your @code{$SHELL} be @code{csh}.
+=*/
+static char *
+doDir_shell(char * arg, char * pzScan)
+{
+ static size_t const endshell_len = sizeof("\n#endshell") - 1;
+
+ scan_ctx_t * pCtx;
+ char * pzText = pzScan;
+
+ (void)arg;
+
+ /*
+ * The output time will always be the current time.
+ * The dynamic content is always current :)
+ */
+ outfile_time = time(NULL);
+
+ /*
+ * IF there are no data after the '#shell' directive,
+ * THEN we won't write any data
+ * ELSE we have to find the end of the data.
+ */
+ if (strncmp(pzText, DIRECT_SHELL_END_SHELL+1, endshell_len-1) == 0)
+ return pzScan;
+
+ {
+ char* pz = strstr(pzScan, DIRECT_SHELL_END_SHELL);
+ if (pz == NULL)
+ AG_ABEND(aprf(DIRECT_SHELL_NOEND, cctx->scx_fname,
+ cctx->scx_line));
+
+ while (pzScan < pz) {
+ if (*(pzScan++) == NL) cctx->scx_line++;
+ }
+
+ *pzScan = NUL;
+ }
+
+ /*
+ * Advance the scan pointer to the next line after '#endshell'
+ * IF there is no such line,
+ * THEN the scan will resume on a zero-length string.
+ */
+ pzScan = strchr(pzScan + endshell_len, NL);
+ if (pzScan == NULL)
+ pzScan = (void*)zNil;
+
+ /*
+ * Save the scan pointer into the current context
+ */
+ cctx->scx_scan = pzScan;
+
+ /*
+ * Run the shell command. The output text becomes the
+ * "file text" that is used for more definitions.
+ */
+ pzText = shell_cmd(pzText);
+ if (pzText == NULL)
+ return pzScan;
+
+ if (*pzText == NUL) {
+ AGFREE(pzText);
+ return pzScan;
+ }
+
+ /*
+ * Get the space for the output data and for context overhead.
+ * This is an extra allocation and copy, but easier than rewriting
+ * 'loadData()' for this special context.
+ */
+ pCtx = (scan_ctx_t*)AGALOC(sizeof(scan_ctx_t) + strlen(pzText) + 4,
+ "shell output");
+
+ /*
+ * Link the new scan data into the context stack
+ */
+ pCtx->scx_next = cctx;
+ cctx = pCtx;
+
+ /*
+ * Set up the rest of the context structure
+ */
+ AGDUPSTR(pCtx->scx_fname, DIRECT_SHELL_COMP_DEFS, DIRECT_SHELL_COMP_DEFS);
+ pCtx->scx_scan =
+ pCtx->scx_data = (char*)(pCtx+1);
+ pCtx->scx_line = 0;
+ strcpy(pCtx->scx_scan, pzText);
+ AGFREE(pzText);
+
+ return pCtx->scx_scan;
+}
+
+
+/*=directive undef
+ *
+ * arg: name-to-undefine
+ *
+ * text:
+ * Will remove any entries from the define list
+ * that match the undef name pattern.
+=*/
+static char*
+doDir_undef(char* pzArg, char* pzScan)
+{
+ SET_OPT_UNDEFINE(pzArg);
+ return pzScan;
+}
+
+
+/*+++ End of Directives +++*/
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/defDirect.c */
diff --git a/agen5/defFind.c b/agen5/defFind.c
new file mode 100644
index 0000000..c99f790
--- /dev/null
+++ b/agen5/defFind.c
@@ -0,0 +1,944 @@
+/**
+ * @file defFind.c
+ *
+ * Time-stamp: "2012-04-07 09:12:06 bkorb"
+ *
+ * This module locates definitions.
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * autogen definitions entry list.
+ */
+typedef struct {
+ size_t del_alloc_ct; //!< entry allocation count
+ size_t del_used_ct; //!< entries in actual use
+ def_ent_t ** del_def_ent_ary; //!< pointer to list of entries
+ int del_level; //!< how deep into it we are
+} def_ent_list_t;
+
+typedef struct hash_name_s hash_name_t;
+struct hash_name_s {
+ hash_name_t * hn_next;
+ char hn_str[0];
+};
+
+static hash_name_t ** hash_table = NULL;
+static int hash_table_ct = 0;
+static char zDefinitionName[ AG_PATH_MAX ];
+
+#define ILLFORMEDNAME() \
+ AG_ABEND(aprf(BAD_NAME_FMT, zDefinitionName, \
+ current_tpl->td_file, cur_macro->md_line));
+
+/* = = = START-STATIC-FORWARD = = = */
+static def_ent_t *
+find_by_index(def_ent_t * ent, char * scan);
+
+static void
+add_to_def_list(def_ent_t * ent, def_ent_list_t * del);
+
+static size_t
+bad_def_name(char * pzD, char const * pzS, size_t srcLen);
+
+static def_ent_t *
+find_def(char * name, def_ctx_t * pDefCtx, bool * indexed);
+
+static int
+hash_string(unsigned char const * pz);
+
+static void
+add_string(char const * pz);
+
+static def_ent_t **
+get_def_list(char * name, def_ctx_t * pDefCtx);
+/* = = = END-STATIC-FORWARD = = = */
+
+/**
+ * Find a def entry by an index. Valid indexes are:
+ * * empty, meaning the first
+ * * '$', meaning the last
+ * * a decimal, octal or hex number
+ * * an environment variable with a decimal, octal or hex number
+ *
+ * The "twins" of the passed in entry are searched for a matching
+ * "de_index" value.
+ *
+ * @param[in] ent the eldest twin/sibling of the list to search
+ * @param[in] scan the scanning pointer pointing to the first non-white
+ * character after the open bracket.
+ *
+ * @returns a pointer to the matching definition entry, if any.
+ * Otherwise, NULL.
+ */
+static def_ent_t *
+find_by_index(def_ent_t * ent, char * scan)
+{
+ int idx;
+
+ /*
+ * '[]' means the first entry of whatever index number
+ */
+ if (*scan == ']')
+ return ent;
+
+ /*
+ * '[$]' means the last entry of whatever the last one is.
+ * "de_etwin" points to it, or is NULL.
+ */
+ if (*scan == '$') {
+ scan = SPN_WHITESPACE_CHARS(scan + 1);
+ if (*scan != ']')
+ return NULL;
+
+ if (ent->de_etwin != NULL)
+ return ent->de_etwin;
+
+ return ent;
+ }
+
+ /*
+ * '[nn]' means the specified index number
+ */
+ if (IS_DEC_DIGIT_CHAR(*scan)) {
+ char * pz;
+ idx = strtol(scan, &pz, 0);
+
+ /*
+ * Skip over any trailing space and make sure we have a closer
+ */
+ pz = SPN_WHITESPACE_CHARS(pz);
+ if (*pz != ']')
+ return NULL;
+ }
+
+ else {
+ /*
+ * '[XX]' means get the index from our definitions
+ */
+ char * def = scan;
+ char const * val;
+
+ if (! IS_VAR_FIRST_CHAR(*scan))
+ return NULL;
+
+ scan = SPN_VALUE_NAME_CHARS(scan);
+
+ /*
+ * Temporarily remove the character under *scan and
+ * find the corresponding defined value.
+ */
+ {
+ char svch = *scan;
+ *scan = NUL;
+ val = get_define_str(def, true);
+ *scan = svch;
+ }
+
+ /*
+ * Skip over any trailing space and make sure we have a closer
+ */
+ scan = SPN_WHITESPACE_CHARS(scan);
+ if (*scan != ']')
+ return NULL;
+
+ /*
+ * make sure we found a defined value
+ */
+ if ((val == NULL) || (*val == NUL))
+ return NULL;
+
+ idx = strtol(val, &def, 0);
+
+ /*
+ * Make sure we got a legal number
+ */
+ if (*def != NUL)
+ return NULL;
+ }
+
+ /*
+ * Search for the entry with the specified index.
+ */
+ do {
+ if (ent->de_index > idx)
+ return NULL;
+ if (ent->de_index == idx)
+ break;
+ ent = ent->de_twin;
+ } while (ent != NULL);
+
+ return ent;
+}
+
+
+/*
+ * find entry support routines:
+ *
+ * add_to_def_list: place a new definition entry on the end of the
+ * list of found definitions (reallocating list size as needed).
+ */
+static void
+add_to_def_list(def_ent_t * ent, def_ent_list_t * del)
+{
+ if (++(del->del_used_ct) > del->del_alloc_ct) {
+ del->del_alloc_ct += del->del_alloc_ct + 8; /* 8, 24, 56, ... */
+ del->del_def_ent_ary = (def_ent_t**)
+ AGREALOC((void*)del->del_def_ent_ary,
+ del->del_alloc_ct * sizeof(void*), "add find");
+ }
+
+ del->del_def_ent_ary[del->del_used_ct-1] = ent;
+}
+
+static size_t
+bad_def_name(char * pzD, char const * pzS, size_t srcLen)
+{
+ memcpy((void*)pzD, (void*)pzS, srcLen);
+ pzD[srcLen] = NUL;
+ fprintf(trace_fp, BAD_NAME_FMT, pzD,
+ current_tpl->td_file, cur_macro->md_line);
+ return srcLen + 1;
+}
+
+
+/**
+ * remove white space and roughly verify the syntax.
+ * This procedure will consume everything from the source string that
+ * forms a valid AutoGen compound definition name.
+ * We leave legally when:
+ * 1. the state is "CN_NAME_ENDED", AND
+ * 2. We stumble into a character that is not either '[' or name_sep_ch
+ * (always skipping white space).
+ * We start in CN_START.
+ *
+ * @param[out] pzD place to put canonicalized name
+ * @param[in] pzS input non-canonicalized name
+ * @param[in] srcLen length of input text
+ *
+ * @returns the length of un-consumed source text
+ */
+LOCAL int
+canonical_name(char * pzD, char const * pzS, int srcLen)
+{
+ typedef enum {
+ CN_START_NAME = 0, /* must find a name */
+ CN_NAME_ENDED, /* must find '[' or name_sep_ch or we end */
+ CN_INDEX, /* must find name, number, '$' or ']' */
+ CN_INDEX_CLOSE, /* must find ']' */
+ CN_INDEX_ENDED /* must find name_sep_ch or we end */
+ } teConState;
+
+ teConState state = CN_START_NAME;
+
+ char const* pzOri = pzS;
+ char* pzDst = pzD;
+ size_t stLen = srcLen;
+
+ /*
+ * Before anything, skip a leading name_sep_ch as a special hack
+ * to force a current context lookup.
+ */
+ pzS = SPN_WHITESPACE_CHARS(pzS);
+ if (pzOri != pzS) {
+ srcLen -= pzS - pzOri;
+ if (srcLen <= 0)
+ pzS = zNil;
+ }
+
+ if (*pzS == name_sep_ch) {
+ *(pzD++) = name_sep_ch;
+ pzS++;
+ if (--srcLen <= 0)
+ pzS = zNil;
+ }
+
+ nextSegment:
+
+ /*
+ * The next segment may always start with an alpha character,
+ * but an index may also start with a number. The full number
+ * validation will happen in find_by_index().
+ */
+ {
+ char * p = SPN_WHITESPACE_CHARS(pzS);
+ if (p != pzS) {
+ srcLen -= p - pzS;
+ if (srcLen <= 0)
+ pzS = zNil;
+ pzS = p;
+ }
+ }
+
+ switch (state) {
+ case CN_START_NAME:
+ if (! IS_VAR_FIRST_CHAR(*pzS))
+ return bad_def_name(pzDst, pzOri, stLen);
+ state = CN_NAME_ENDED; /* we found the start of our first name */
+ break; /* fall through to name/number consumption code */
+
+ case CN_NAME_ENDED:
+ switch (*pzS++) {
+ case '[':
+ *(pzD++) = '[';
+ state = CN_INDEX;
+ break;
+
+ case '.': case '/':
+ if (pzS[-1] == name_sep_ch) {
+ *(pzD++) = name_sep_ch;
+ state = CN_START_NAME;
+ break;
+ }
+
+ default:
+ /* legal exit -- we have a name already */
+ *pzD = NUL;
+ return srcLen;
+ }
+
+ if (--srcLen <= 0)
+ return bad_def_name(pzDst, pzOri, stLen);
+ goto nextSegment;
+
+ case CN_INDEX:
+ /*
+ * An index. Valid syntaxes are:
+ *
+ * '[' <#define-d name> ']'
+ * '[' <number> ']'
+ * '[' '$' ']'
+ * '[' ']'
+ *
+ * We will check for and handle the last case right here.
+ * The next cycle must find the index closer (']').
+ */
+ state = CN_INDEX_CLOSE;
+
+ /*
+ * Numbers and #define-d names are handled at the end of the switch.
+ * '$' and ']' are handled immediately below.
+ */
+ if (IS_ALPHANUMERIC_CHAR(*pzS))
+ break;
+
+ /*
+ * A solitary '$' is the highest index, whatever that happens to be
+ * We process that right here because down below we only accept
+ * name-type characters and this is not VMS.
+ */
+ if (*pzS == '$') {
+ if (--srcLen < 0)
+ return bad_def_name(pzDst, pzOri, stLen);
+
+ *(pzD++) = *(pzS++);
+ goto nextSegment;
+ }
+ /* FALLTHROUGH */
+
+ case CN_INDEX_CLOSE:
+ /*
+ * Nothing else is okay.
+ */
+ if ((*(pzD++) = *(pzS++)) != ']')
+ return bad_def_name(pzDst, pzOri, stLen);
+
+ if (--srcLen <= 0) {
+ *pzD = NUL;
+ return srcLen;
+ }
+ state = CN_INDEX_ENDED;
+ goto nextSegment;
+
+ case CN_INDEX_ENDED:
+ if ((*pzS != name_sep_ch) || (--srcLen < 0)) {
+ *pzD = NUL;
+ return srcLen;
+ }
+ *(pzD++) = *(pzS++);
+
+ state = CN_START_NAME;
+ goto nextSegment;
+ }
+
+ /*
+ * The next state must be either looking for what comes after the
+ * end of a name, or for the close bracket after an index.
+ * Whatever, the next token must be a name or a number.
+ */
+ assert((state == CN_NAME_ENDED) || (state == CN_INDEX_CLOSE));
+ assert(IS_ALPHANUMERIC_CHAR(*pzS));
+
+ /*
+ * Copy the name/number. We already know the first character is valid.
+ * However, we must *NOT* downcase #define names...
+ */
+ while (IS_VALUE_NAME_CHAR(*pzS)) {
+ char ch = *(pzS++);
+ if ((state != CN_INDEX_CLOSE) && IS_UPPER_CASE_CHAR(ch))
+ *(pzD++) = tolower(ch);
+
+ else switch (ch) { /* force the separator chars to be '_' */
+ case '-':
+ case '^':
+ *(pzD++) = '_';
+ break;
+
+ default:
+ *(pzD++) = ch;
+ }
+
+ if (--srcLen <= 0) {
+ pzS = zNil;
+ break;
+ }
+ }
+
+ goto nextSegment;
+}
+
+
+/**
+ * Find the definition entry for the name passed in. It is okay to
+ * find block entries IFF they are found on the current level. Once
+ * you start traversing up the tree, the macro must be a text macro.
+ * Return an indicator saying if the element has been indexed (so the
+ * caller will not try to traverse the list of twins).
+ *
+ * @param[in] name name to look for
+ * @param[in] pDefCtx definition context
+ * @param[out] indexed whether the name was indexed or not
+ */
+static def_ent_t *
+find_def(char * name, def_ctx_t * pDefCtx, bool * indexed)
+{
+ static int nestingDepth = 0;
+
+ char * brace;
+ char br_ch;
+ def_ent_t * ent;
+ bool dummy;
+ bool noNesting = false;
+
+ /*
+ * IF we are at the start of a search, then canonicalize the name
+ * we are hunting for, copying it to a modifiable buffer, and
+ * initialize the "indexed" boolean to false (we have not found
+ * an index yet).
+ */
+ if (nestingDepth == 0) {
+ canonical_name(zDefinitionName, name, (int)strlen(name));
+ name = zDefinitionName;
+
+ if (indexed != NULL)
+ *indexed = false;
+ else indexed = &dummy;
+
+ if (*name == name_sep_ch) {
+ noNesting = true;
+ name++;
+ }
+ }
+
+ brace = BRK_NAME_SEP_CHARS(name);
+ br_ch = *brace;
+ *brace = NUL;
+
+ if (br_ch == '[') *indexed = true;
+
+ for (;;) {
+ /*
+ * IF we are at the end of the definitions (reached ROOT),
+ * THEN it is time to bail out.
+ */
+ ent = pDefCtx->dcx_defent;
+ if (ent == NULL)
+ return NULL;
+
+ do {
+ /*
+ * IF the name matches
+ * THEN break out of the double loop
+ */
+ if (strcmp(ent->de_name, name) == 0)
+ goto found_def_entry;
+
+ ent = ent->de_next;
+ } while (ent != NULL);
+
+ /*
+ * IF we are nested, then we cannot change the definition level.
+ * So, we did not find anything.
+ */
+ if ((nestingDepth != 0) || noNesting)
+ return NULL;
+
+ /*
+ * Let's go try the definitions at the next higher level.
+ */
+ pDefCtx = pDefCtx->dcx_prev;
+ if (pDefCtx == NULL)
+ return NULL;
+ } found_def_entry:;
+
+ /*
+ * At this point, we have found the entry that matches the supplied name,
+ * up to the '[' or name_sep_ch or NUL character. It *must* be one of
+ * those three characters.
+ */
+ *brace = br_ch;
+
+ switch (br_ch) {
+ case NUL:
+ return ent;
+
+ case '[':
+ /*
+ * We have to find a specific entry in a list.
+ */
+ brace = SPN_WHITESPACE_CHARS(brace + 1);
+
+ ent = find_by_index(ent, brace);
+ if (ent == NULL)
+ return ent;
+
+ /*
+ * We must find the closing brace, or there is an error
+ */
+ brace = strchr(brace, ']');
+ if (brace == NULL)
+ ILLFORMEDNAME();
+
+ /*
+ * What follows the closing brace? IF we are at the end of the
+ * definition, THEN return what we found. However, if there's
+ * another name, then we have to go look that one up, too.
+ */
+ switch (*++brace) {
+ case NUL:
+ return ent;
+
+ case '.': case '/':
+ /*
+ * Which one? One is valid, the other not and it is not known
+ * at compile time.
+ */
+ if (*brace == name_sep_ch) {
+ name = brace + 1;
+ break;
+ }
+ /* FALLTHROUGH */
+
+ default:
+ ILLFORMEDNAME();
+ }
+ break;
+
+ case '.': case '/':
+ if (br_ch == name_sep_ch) {
+ /*
+ * Which one? One is valid, the other not and it is not known
+ * at compile time.
+ *
+ * It is a segmented value name. Set the name pointer
+ * to the next segment and search starting from the newly
+ * available set of definitions.
+ */
+ name = brace + 1;
+ break;
+ }
+ /* FALLTHROUGH */
+
+ default:
+ ILLFORMEDNAME();
+ }
+
+ /*
+ * We cannot find a member of a non-block type macro definition.
+ */
+ if (ent->de_type != VALTYP_BLOCK)
+ return NULL;
+
+ /*
+ * Loop through all the twins of the entry we found until
+ * we find the entry we want. We ignore twins if we just
+ * used a subscript.
+ */
+ nestingDepth++;
+ {
+ def_ctx_t ctx = { NULL, &curr_def_ctx };
+
+ ctx.dcx_defent = ent->de_val.dvu_entry;
+
+ for (;;) {
+ def_ent_t* res;
+
+ res = find_def(name, &ctx, indexed);
+ if ((res != NULL) || (br_ch == '[')) {
+ nestingDepth--;
+ return res;
+ }
+ ent = ent->de_twin;
+ if (ent == NULL)
+ break;
+ ctx.dcx_defent = ent->de_val.dvu_entry;
+ }
+ }
+
+ nestingDepth--;
+ return NULL;
+}
+
+/*
+ * This makes certain assumptions about the underlying architecture.
+ * Doesn't matter tho. A high collision rate just makes it a teensy
+ * bit slower.
+ */
+static int
+hash_string(unsigned char const * pz)
+{
+ unsigned int res = 0;
+ while (*pz)
+ res ^= (res << 3) ^ *(pz++);
+
+ return res & (hash_table_ct - 1);
+}
+
+static void
+add_string(char const * pz)
+{
+ unsigned char z[SCRIBBLE_SIZE];
+ size_t z_len;
+
+ /*
+ * If there is no hash table, create one.
+ */
+ if (hash_table_ct == 0) {
+ size_t ct = current_tpl->td_mac_ct;
+ if (ct < SCRIBBLE_SIZE)
+ ct = SCRIBBLE_SIZE;
+ else {
+ int bit_ct = 0;
+ while (ct > 1) {
+ bit_ct++;
+ ct >>= 1;
+ }
+ ct = 1 << bit_ct;
+ }
+
+ hash_table_ct = ct;
+ hash_table = malloc(ct * sizeof (*hash_table));
+ memset(hash_table, NUL, ct * sizeof (*hash_table));
+ }
+
+ /*
+ * Save only the last component of the name, sans any index, too.
+ */
+ {
+ char const * p = strrchr(pz, name_sep_ch);
+ if (p != NULL)
+ pz = p + 1;
+ p = strchr(pz, '[');
+
+ if (p != NULL) {
+ z_len = (p - pz) + 1;
+ if (z_len > sizeof(z))
+ return;
+ memcpy(z, pz, z_len - 1);
+ z[z_len - 1] = NUL;
+
+ } else {
+ z_len = strlen(pz) + 1;
+ if (z_len > sizeof(z))
+ return;
+ memcpy(z, pz, z_len);
+ }
+ }
+
+ /*
+ * canonicalize the name
+ */
+ strtransform((char *)z, (char *)z);
+
+ /*
+ * If a new name, insert it in order.
+ */
+ {
+ int ix = hash_string(z);
+
+ hash_name_t ** hptr = &(hash_table[ix]), *new;
+ while (*hptr != NULL) {
+ int cmp = memcmp(z, (*hptr)->hn_str, z_len);
+ if (cmp == 0)
+ return; /* old name */
+
+ if (cmp > 0)
+ break; /* no matching name can be found */
+
+ hptr = &((*hptr)->hn_next);
+ }
+
+ new = AGALOC(sizeof (*new) + z_len, "hn");
+ new->hn_next = *hptr;
+ *hptr = new;
+ memcpy(new->hn_str, z, z_len);
+ }
+}
+
+/**
+ * locate a definition by name.
+ *
+ * @param[in] name the name to find. May be segmented and/or indexed.
+ * @param[out] indexed whether or not the found name is indexed.
+ */
+LOCAL def_ent_t *
+find_def_ent(char * name, bool * indexed)
+{
+ if (HAVE_OPT(USED_DEFINES))
+ add_string(name);
+ return find_def(name, &curr_def_ctx, indexed);
+}
+
+LOCAL void
+print_used_defines(void)
+{
+ if (hash_table_ct == 0)
+ return;
+
+ {
+ int ix = 0;
+
+ FILE * fp = popen(USED_DEFINES_FMT, "w");
+ if (fp == NULL) return;
+
+ while (ix < hash_table_ct) {
+ hash_name_t * hn = hash_table[ix++];
+ while (hn != NULL) {
+ fprintf(fp, USED_DEFINES_LINE_FMT, hn->hn_str);
+ hn = hn->hn_next;
+ }
+ }
+ pclose(fp);
+ }
+}
+
+
+/**
+ * Find the definition entries for the name passed in. It is okay to find
+ * block entries IFF they are found on the current level. Once you start
+ * traversing up the tree, the macro must be a text macro. Return an
+ * indicator saying if the element has been indexed (so the caller will
+ * not try to traverse the list of twins).
+ */
+static def_ent_t **
+get_def_list(char * name, def_ctx_t * pDefCtx)
+{
+ static def_ent_list_t defList = { 0, 0, NULL, 0 };
+
+ char* pcBrace;
+ char breakCh;
+ def_ent_t* ent;
+ bool noNesting = false;
+
+ /*
+ * IF we are at the start of a search, then canonicalize the name
+ * we are hunting for, copying it to a modifiable buffer, and
+ * initialize the "indexed" boolean to false (we have not found
+ * an index yet).
+ */
+ if (defList.del_level == 0) {
+ if (*name == name_sep_ch) {
+ noNesting = true;
+ name = SPN_WHITESPACE_CHARS(name + 1);
+ }
+
+ if (! IS_VAR_FIRST_CHAR(*name)) {
+ strncpy(zDefinitionName, name, sizeof(zDefinitionName) - 1);
+ zDefinitionName[ sizeof(zDefinitionName) - 1] = NUL;
+ ILLFORMEDNAME();
+ }
+
+ canonical_name(zDefinitionName, name, (int)strlen(name));
+ name = zDefinitionName;
+ defList.del_used_ct = 0;
+ }
+
+ pcBrace = BRK_NAME_SEP_CHARS(name);
+ breakCh = *pcBrace;
+ *pcBrace = NUL;
+
+ for (;;) {
+ /*
+ * IF we are at the end of the definitions (reached ROOT),
+ * THEN it is time to bail out.
+ */
+ ent = pDefCtx->dcx_defent;
+ if (ent == NULL) {
+ /*
+ * Make sure we are not nested. Once we start to nest,
+ * then we cannot "change definition levels"
+ */
+ not_found:
+ if (defList.del_level != 0)
+ ILLFORMEDNAME();
+
+ /*
+ * Don't bother returning zero entry list. Just return NULL.
+ */
+ return NULL;
+ }
+
+ do {
+ /*
+ * IF the name matches
+ * THEN go add it, plus all its twins
+ */
+ if (strcmp(ent->de_name, name) == 0)
+ goto found_def_entry;
+
+ ent = ent->de_next;
+ } while (ent != NULL);
+
+ /*
+ * IF we are nested, then we cannot change the definition level.
+ * Just go and return what we have found so far.
+ */
+ if ((defList.del_level != 0) || noNesting)
+ goto returnResult;
+
+ /*
+ * Let's go try the definitions at the next higher level.
+ */
+ pDefCtx = pDefCtx->dcx_prev;
+ if (pDefCtx == NULL)
+ goto not_found;
+ } found_def_entry:;
+
+ /*
+ * At this point, we have found the entry that matches the supplied name,
+ * up to the '[' or name_sep_ch or NUL character. It *must* be one of
+ * those three characters.
+ */
+ *pcBrace = breakCh;
+
+ switch (breakCh) {
+ case NUL:
+ do {
+ add_to_def_list(ent, &defList);
+ ent = ent->de_twin;
+ } while (ent != NULL);
+ goto returnResult;
+
+ case '[':
+ /*
+ * We have to find a specific entry in a list.
+ */
+ pcBrace = SPN_WHITESPACE_CHARS(pcBrace + 1);
+
+ ent = find_by_index(ent, pcBrace);
+ if (ent == NULL)
+ goto returnResult;
+
+ /*
+ * We must find the closing brace, or there is an error
+ */
+ pcBrace = strchr(pcBrace, ']');
+ if (pcBrace == NULL)
+ ILLFORMEDNAME();
+
+ /*
+ * IF we are at the end of the definition,
+ * THEN return what we found
+ */
+ switch (*++pcBrace) {
+ case NUL:
+ goto returnResult;
+
+ case '.': case '/':
+ /*
+ * Which one? One is valid, the other not and it is not known
+ * at compile time.
+ */
+ if (*pcBrace == name_sep_ch)
+ break;
+ /* FALLTHROUGH */
+
+ default:
+ ILLFORMEDNAME();
+ }
+ name = pcBrace + 1;
+ break;
+
+ case '.': case '/':
+ if (breakCh == name_sep_ch) {
+ /*
+ * Which one? One is valid, the other not and it is not known
+ * at compile time.
+ *
+ * It is a segmented value name. Set the name pointer to the
+ * next segment and search starting from the newly available set
+ * of definitions.
+ */
+ name = pcBrace + 1;
+ break;
+ }
+
+ default:
+ ILLFORMEDNAME();
+ }
+
+ /*
+ * Loop through all the twins of the entry. We only look once if we used
+ * a subscript. Ignore any entry types that are not "Blocks" because
+ * text entries won't have any children.
+ */
+ defList.del_level++;
+ do {
+ def_ctx_t ctx = { ent->de_val.dvu_entry, &curr_def_ctx };
+
+ if (ent->de_type == VALTYP_BLOCK)
+ (void)get_def_list(name, &ctx);
+
+ if (breakCh == '[')
+ break;
+
+ ent = ent->de_twin;
+ } while (ent != NULL);
+
+ defList.del_level--;
+
+ returnResult:
+ if (defList.del_level == 0)
+ add_to_def_list(NULL, &defList);
+
+ return defList.del_def_ent_ary;
+}
+
+
+LOCAL def_ent_t **
+find_def_ent_list(char * name)
+{
+ return get_def_list(name, &curr_def_ctx);
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/defFind.c */
diff --git a/agen5/defLex.c b/agen5/defLex.c
new file mode 100644
index 0000000..39c5a25
--- /dev/null
+++ b/agen5/defLex.c
@@ -0,0 +1,678 @@
+
+/**
+ * @file defLex.c
+ *
+ * Time-stamp: "2012-03-31 13:00:08 bkorb"
+ *
+ * This module scans the template variable declarations and passes
+ * tokens back to the parser.
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+/*
+ * This keyword table must match those found in agParse.y.
+ * You will find them in a %token statement that follows
+ * a comment "Keywords"
+ */
+#define KEYWORD_TABLE \
+ _KW_( AUTOGEN ) \
+ _KW_( DEFINITIONS )
+
+#define _KW_(w) static char const z ## w [] = #w;
+KEYWORD_TABLE
+#undef _KW_
+
+#define _KW_(w) z ## w,
+static char const* apzKeywords[] = { KEYWORD_TABLE };
+#undef _KW_
+
+#define _KW_(w) DP_EV_ ## w,
+te_dp_event aKeywordTkn[] = { KEYWORD_TABLE };
+#undef _KW_
+
+#define KEYWORD_CT (sizeof(apzKeywords) / sizeof(apzKeywords[0]))
+
+#define ERROR (-1)
+#define FINISH (-1)
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+pop_context(void);
+
+static void
+trim_whitespace(void);
+
+static void
+lex_escaped_char(void);
+
+static tSuccess
+lex_backquote(void);
+
+static tSuccess
+lex_comment(void);
+
+static tSuccess
+lex_here_string(void);
+
+static void
+loadScheme(void);
+
+static void
+alist_to_autogen_def(void);
+
+static char*
+gather_name(char * pzScan, te_dp_event * pRetVal);
+
+static char*
+build_here_str(char* scan);
+/* = = = END-STATIC-FORWARD = = = */
+
+/**
+ * Pop off an include context and resume from the including file.
+ */
+static void
+pop_context(void)
+{
+ scan_ctx_t* pCX = cctx;
+ cctx = cctx->scx_next;
+ pCX->scx_next = end_ctx;
+ end_ctx = pCX;
+}
+
+static void
+trim_whitespace(void)
+{
+ char * pz = cctx->scx_scan;
+
+ /*
+ * This ensures that any names found previously
+ * are NUL terminated.
+ */
+ if (*pz == NL)
+ cctx->scx_line++;
+ *pz = NUL;
+
+ for (;;) {
+ pz = SPN_HORIZ_WHITE_CHARS(pz+1);
+ if (*pz != NL)
+ break;
+ cctx->scx_line++;
+ }
+
+ cctx->scx_scan = pz;
+}
+
+static void
+lex_escaped_char(void)
+{
+ static int const semi_colon = ';';
+
+ char* pz = strchr(cctx->scx_scan, semi_colon);
+
+ for (;;) {
+ if (pz == NULL) {
+ pz = cctx->scx_scan + strlen(cctx->scx_scan);
+ break;
+ }
+ if (IS_WHITESPACE_CHAR(pz[1])) {
+ *pz = NUL;
+ pz[1] = semi_colon;
+ break;
+ }
+ pz = strchr(pz+1, semi_colon);
+ }
+
+ token_code = DP_EV_STRING;
+ token_str = pz;
+}
+
+static tSuccess
+lex_backquote(void)
+{
+ int line_no = cctx->scx_line;
+ char* pz = ao_string_cook(cctx->scx_scan, &line_no);
+
+ if (pz == NULL)
+ return FAILURE;
+
+ token_str = cctx->scx_scan;
+
+ cctx->scx_scan = pz;
+
+ token_code = DP_EV_STRING;
+ pz = shell_cmd((char const*)token_str);
+ cctx->scx_line = line_no;
+
+ if (pz == NULL)
+ return PROBLEM;
+
+ token_str = pz;
+ return SUCCESS;
+}
+
+static tSuccess
+lex_comment(void)
+{
+ /*
+ * Allow for a comment, C or C++ style
+ */
+ switch (cctx->scx_scan[1]) {
+ case '*':
+ {
+ char* pz = strstr(cctx->scx_scan+2, END_C_COMMENT);
+ if (pz != NULL) {
+ char* p = cctx->scx_scan+1;
+ for (;;) {
+ p = strchr(p+1, NL);
+ if ((p == NULL) || (p > pz))
+ break;
+ cctx->scx_line++;
+ }
+ cctx->scx_scan = pz+2;
+ return SUCCESS;
+ }
+ break;
+ }
+ case '/':
+ {
+ char* pz = strchr(cctx->scx_scan+2, NL);
+ if (pz != NULL) {
+ cctx->scx_scan = pz+1;
+ cctx->scx_line++;
+ return SUCCESS;
+ }
+ break;
+ }
+ }
+
+ return FAILURE;
+}
+
+static tSuccess
+lex_here_string(void)
+{
+ char* pz;
+ if (cctx->scx_scan[1] != '<')
+ return FAILURE;
+
+ pz = build_here_str(cctx->scx_scan + 2);
+ if (pz == NULL) {
+ token_code = DP_EV_INVALID;
+ return PROBLEM;
+ }
+
+ token_code = DP_EV_HERE_STRING;
+ cctx->scx_scan = pz;
+ return SUCCESS;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * LEXICAL SCANNER
+ */
+LOCAL te_dp_event
+yylex(void)
+{
+#define SET_LIT_TKN(t) \
+ token_code = DP_EV_LIT_ ## t; *(cctx->scx_scan++) = NUL;
+
+ token_code = DP_EV_INVALID;
+
+scanAgain:
+ /*
+ * Start the process of locating a token.
+ * We branch here after skipping over a comment
+ * or processing a directive (which may change our context).
+ */
+ if (IS_WHITESPACE_CHAR(*cctx->scx_scan))
+ trim_whitespace();
+
+ switch (*cctx->scx_scan) {
+ case NUL:
+ /*
+ * IF we are not inside an include context,
+ * THEN go finish.
+ */
+ if (cctx->scx_next == NULL)
+ goto lex_done;
+
+ pop_context();
+ goto scanAgain;
+
+ case '#':
+ {
+ extern char * processDirective(char*);
+ char * pz = processDirective(cctx->scx_scan+1);
+ /*
+ * Ensure that the compiler doesn't try to save a copy of
+ * "cctx" in a register. It must be reloaded from memory.
+ */
+ cctx->scx_scan = pz;
+ goto scanAgain;
+ }
+
+ case '{': SET_LIT_TKN(O_BRACE); break;
+ case '=': SET_LIT_TKN(EQ); break;
+ case '}': SET_LIT_TKN(C_BRACE); break;
+ case '[': SET_LIT_TKN(OPEN_BKT); break;
+ case ']': SET_LIT_TKN(CLOSE_BKT); break;
+ case ';': SET_LIT_TKN(SEMI); break;
+ case ',': SET_LIT_TKN(COMMA); break;
+
+ case '\'':
+ case '"':
+ {
+ char* pz = ao_string_cook(cctx->scx_scan, &(cctx->scx_line));
+ if (pz == NULL)
+ goto NUL_error;
+
+ token_str = cctx->scx_scan;
+
+ token_code = DP_EV_STRING;
+ cctx->scx_scan = pz;
+ break;
+ }
+
+ case '<':
+ switch (lex_here_string()) {
+ case SUCCESS: break;
+ case FAILURE: goto BrokenToken;
+ case PROBLEM: return DP_EV_INVALID;
+ }
+ break;
+
+ case '(':
+ loadScheme();
+ break;
+
+ case '\\':
+ if (strncmp(cctx->scx_scan+1, START_SCHEME_LIST, (size_t)2) == 0) {
+ alist_to_autogen_def();
+ goto scanAgain;
+ }
+ lex_escaped_char();
+ break;
+
+ case '`':
+ switch (lex_backquote()) {
+ case FAILURE: goto NUL_error;
+ case PROBLEM: goto scanAgain;
+ case SUCCESS: break;
+ }
+ break;
+
+ case '/':
+ switch (lex_comment()) {
+ case SUCCESS: goto scanAgain;
+ default: break;
+ }
+ /* FALLTHROUGH */ /* to Invalid input char */
+
+ default:
+ BrokenToken:
+ cctx->scx_scan = gather_name(cctx->scx_scan, &token_code);
+ break;
+ } /* switch (*cctx->scx_scan) */
+
+ return token_code;
+
+NUL_error:
+
+ AG_ABEND(aprf(DEF_ERR_FMT, ag_pname, YYLEX_UNENDING_QUOTE,
+ cctx->scx_fname, cctx->scx_line));
+ return DP_EV_INVALID;
+
+lex_done:
+ /*
+ * First time through, return the DP_EV_END token.
+ * Second time through, we really finish.
+ */
+ if (cctx->scx_scan == zNil) {
+ cctx->scx_next = end_ctx;
+ end_ctx = cctx;
+
+ return DP_EV_INVALID;
+ }
+
+ cctx->scx_scan = (char*)zNil;
+ return DP_EV_END;
+#undef SET_LIT_TKN
+}
+
+
+LOCAL void
+yyerror(char* s)
+{
+ char * pz;
+
+ if (strlen(cctx->scx_scan) > 64 )
+ cctx->scx_scan[64] = NUL;
+
+ switch (token_code) {
+ case DP_EV_VAR_NAME:
+ case DP_EV_OTHER_NAME:
+ case DP_EV_STRING:
+ case DP_EV_NUMBER:
+ if (strlen(token_str) > 64 )
+ token_str[64] = NUL;
+
+ pz = aprf(YYLEX_TOKEN_STR, DP_EVT_NAME(token_code), token_str);
+ break;
+
+ default:
+ pz = aprf(YYLEX_DF_STR, DP_EVT_NAME(token_code));
+ }
+ AG_ABEND(aprf(YYLEX_ERR_FMT, s, cctx->scx_fname, cctx->scx_line,
+ pz, cctx->scx_scan));
+}
+
+
+static void
+loadScheme(void)
+{
+ char* pzText = cctx->scx_scan;
+ char* pzEnd = (char*)skip_scheme(pzText, pzText + strlen(pzText));
+ char endCh = *pzEnd;
+ int schemeLen = (pzEnd - pzText);
+ int next_ln;
+ SCM res;
+
+ /*
+ * NUL terminate the Scheme expression, run it, then restore
+ * the NUL-ed character.
+ */
+ if (*pzEnd == NUL)
+ AG_ABEND(aprf(DEF_ERR_FMT, ag_pname, LOAD_SCM_ENDLESS,
+ cctx->scx_fname, cctx->scx_line));
+
+ *pzEnd = NUL;
+ next_ln = cctx->scx_line + count_nl(pzText);
+
+ processing_state = PROC_STATE_GUILE_PRELOAD;
+ res = ag_scm_c_eval_string_from_file_line(
+ pzText, cctx->scx_fname, cctx->scx_line );
+ processing_state = PROC_STATE_LOAD_DEFS;
+ *pzEnd = endCh;
+
+ cctx->scx_scan = pzEnd;
+ pzEnd = (char*)scm2display(res); /* ignore const-ness */
+ cctx->scx_line = next_ln;
+
+ if ((int)strlen(pzEnd) >= schemeLen) {
+ AGDUPSTR(pzEnd, pzEnd, "SCM Result");
+
+ token_str = pzEnd;
+ }
+
+ else {
+ /*
+ * We know the result is smaller than the source. Copy in place.
+ */
+ strcpy(pzText, pzEnd);
+ token_str = pzText;
+ }
+
+ token_code = DP_EV_STRING;
+}
+
+/*
+ * process a single scheme expression, yielding text that gets processed
+ * into AutoGen definitions.
+ */
+static void
+alist_to_autogen_def(void)
+{
+ char* pzText = ++(cctx->scx_scan);
+ char* pzEnd = (char*)skip_scheme(pzText, pzText + strlen(pzText));
+
+ SCM res;
+ size_t res_len;
+ scan_ctx_t* pCtx;
+
+ /*
+ * Wrap the scheme expression with the `alist->autogen-def' function
+ */
+ {
+ char endCh = *pzEnd;
+ *pzEnd = NUL;
+ pzText = aprf(ALIST_TO_AG_WRAP, pzText);
+ *pzEnd = endCh;
+ }
+
+ /*
+ * Run the scheme expression. The result is autogen definition text.
+ */
+ processing_state = PROC_STATE_GUILE_PRELOAD;
+ res = ag_scm_c_eval_string_from_file_line(
+ pzText, cctx->scx_fname, cctx->scx_line );
+
+ /*
+ * The result *must* be a string, or we choke.
+ */
+ if (! AG_SCM_STRING_P(res))
+ AG_ABEND(ALIST_TO_AG_ERR);
+
+ res_len = AG_SCM_STRLEN(res);
+ processing_state = PROC_STATE_LOAD_DEFS;
+ cctx->scx_scan = pzEnd;
+ AGFREE(pzText);
+
+ /*
+ * Now, push the resulting string onto the input stack
+ * and link the new scan data into the context stack
+ */
+ pCtx = (scan_ctx_t*)AGALOC(sizeof(scan_ctx_t) + 4 + res_len, "lex ctx");
+ pCtx->scx_next = cctx;
+ cctx = pCtx;
+
+ /*
+ * Set up the rest of the context structure
+ */
+ AGDUPSTR(pCtx->scx_fname, ALIST_TO_AG_TEXT, "scheme text");
+ pCtx->scx_scan = \
+ pCtx->scx_data = (char*)(pCtx+1);
+ pCtx->scx_line = 0;
+ memcpy((void*)(pCtx->scx_scan), (void*)AG_SCM_CHARS(res), res_len);
+ pCtx->scx_scan[ res_len ] = NUL;
+
+ /*
+ * At this point, the next token will be obtained from the newly
+ * allocated context structure. When empty, input will resume
+ * from the '}' that we left as the next input token in the old
+ * context.
+ */
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * It may be a number, a name, a keyword or garbage.
+ * Figure out which.
+ */
+static char*
+gather_name(char * pzScan, te_dp_event * pRetVal)
+{
+ /*
+ * Check for a number.
+ * Scan it in and advance "pzScan".
+ */
+ if ( IS_DEC_DIGIT_CHAR(*pzScan)
+ || ( (*pzScan == '-')
+ && IS_DEC_DIGIT_CHAR(pzScan[1])
+ ) ) {
+ token_str = pzScan;
+ (void)strtol(pzScan, &pzScan, 0);
+ *pRetVal = DP_EV_NUMBER;
+ return pzScan;
+ }
+
+ if (! IS_UNQUOTABLE_CHAR(*pzScan))
+ AG_ABEND(aprf(ASSEMBLE_NAME_ERR, ag_pname, *pzScan, cctx->scx_fname,
+ cctx->scx_line));
+
+ {
+ char* pz = SPN_VALUE_NAME_CHARS(pzScan);
+
+ if (IS_UNQUOTABLE_CHAR(*pz)) {
+ *pRetVal = DP_EV_OTHER_NAME;
+ pz = SPN_UNQUOTABLE_CHARS(pz+1);
+
+ } else
+ *pRetVal = DP_EV_VAR_NAME;
+
+ /*
+ * Return a NAME token, maybe.
+ * If the name is actually a keyword,
+ * we will return that token code instead.
+ */
+ token_str = pzScan;
+ pzScan = (char*)pz;
+ }
+
+ /*
+ * Now scan the keyword table.
+ */
+ if (*pRetVal == DP_EV_VAR_NAME) {
+ char sv_ch = *pzScan; /* preserve the following character */
+ int kw_ix = 0;
+ *pzScan = NUL; /* NUL terminate the name */
+
+ do {
+ if (streqvcmp(apzKeywords[ kw_ix ], (char*)token_str) == 0) {
+ /*
+ * Return the keyword token code instead of DP_EV_NAME
+ */
+ *pRetVal = aKeywordTkn[ kw_ix ];
+ break;
+ }
+ } while (++kw_ix < (int)KEYWORD_CT);
+
+ *pzScan = sv_ch; /* restore the following character */
+ }
+
+ return pzScan;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * A quoted string has been found.
+ * Find the end of it and compress any escape sequences.
+ */
+static char*
+build_here_str(char* scan)
+{
+ bool no_tabs = false;
+ char zMark[ MAX_HEREMARK_LEN ];
+ size_t markLen = 0;
+ char* dest;
+ int here_str_line;
+
+ /*
+ * See if we are to strip leading tab chars
+ */
+ if (*scan == '-') {
+ no_tabs = true;
+ scan++;
+ }
+
+ /*
+ * Skip white space up to the marker or EOL
+ */
+ scan = SPN_NON_NL_WHITE_CHARS(scan);
+ if (*scan == NL)
+ AG_ABEND(aprf(DEF_ERR_FMT, ag_pname, HERE_MISS_MARK_STR,
+ cctx->scx_fname, cctx->scx_line));
+
+ /*
+ * Copy the marker, noting its length
+ */
+ {
+ char * pz = SPN_VARIABLE_NAME_CHARS(scan);
+ markLen = pz - scan;
+
+ if (markLen == 0)
+ AG_ABEND(aprf(DEF_ERR_FMT, ag_pname, HERE_MISS_MARK_STR,
+ cctx->scx_fname, cctx->scx_line));
+
+ if (markLen >= sizeof(zMark))
+ AG_ABEND(aprf(DEF_ERR_FMT, ag_pname, HERE_MARK_TOO_LONG,
+ cctx->scx_fname, cctx->scx_line));
+
+ memcpy(zMark, scan, markLen);
+ zMark[markLen] = NUL;
+ }
+
+ token_str = dest = scan;
+
+ /*
+ * Skip forward to the EOL after the marker.
+ */
+ scan = strchr(scan, NL);
+ if (scan == NULL)
+ AG_ABEND(aprf(DEF_ERR_FMT, ag_pname, HERE_ENDLESS_STR,
+ cctx->scx_fname, cctx->scx_line));
+
+ /*
+ * And skip the first new line + conditionally skip tabs
+ */
+ here_str_line = cctx->scx_line++;
+ scan++;
+
+ for (;;) {
+ next_line:
+ if (no_tabs) {
+ while (*scan == TAB) ++scan;
+ if ((scan[0] == '\\') && (scan[1] == TAB))
+ ++scan;
+ }
+
+ /*
+ * If we recognize the end mark, break out.
+ */
+ if (! IS_VARIABLE_NAME_CHAR(scan[markLen]))
+ if (strncmp(scan, zMark, markLen) == 0)
+ break;
+
+ for (;;) {
+ switch (*(dest++) = *(scan++)) {
+ case NL:
+ cctx->scx_line++;
+ goto next_line;
+
+ case NUL:
+ AG_ABEND(aprf(DEF_ERR_FMT, ag_pname, HERE_ENDLESS_STR,
+ cctx->scx_fname, here_str_line));
+ }
+ }
+ } /* while strncmp ... */
+
+ /*
+ * dest may still equal token_str, if no data were copied
+ */
+ if (dest > (char*)token_str)
+ dest[-1] = NUL;
+ else dest[0] = NUL;
+
+ return scan + markLen;
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/defLex.c */
diff --git a/agen5/defLoad.c b/agen5/defLoad.c
new file mode 100644
index 0000000..bc36317
--- /dev/null
+++ b/agen5/defLoad.c
@@ -0,0 +1,486 @@
+
+/**
+ * @file defLoad.c
+ *
+ * Time-stamp: "2012-03-04 11:02:51 bkorb"
+ *
+ * This module loads the definitions, calls yyparse to decipher them,
+ * and then makes a fixup pass to point all children definitions to
+ * their parent definition.
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+typedef enum {
+ INPUT_DONE,
+ INPUT_STDIN,
+ INPUT_FILE
+} def_input_mode_t;
+
+static def_ent_t* pFreeEntryList = NULL;
+static void* pAllocList = NULL;
+
+#define ENTRY_SPACE (4096 - sizeof(void*))
+#define ENTRY_ALLOC_CT (ENTRY_SPACE / sizeof(def_ent_t))
+#define ENTRY_ALLOC_SIZE \
+ ((ENTRY_ALLOC_CT * sizeof(def_ent_t)) + sizeof(void*))
+
+/* = = = START-STATIC-FORWARD = = = */
+static def_ent_t*
+insert_ent(def_ent_t* pDef);
+
+static def_input_mode_t
+ready_def_input(char const ** ppzfile, size_t * psz);
+/* = = = END-STATIC-FORWARD = = = */
+
+LOCAL def_ent_t *
+new_def_ent(void)
+{
+ def_ent_t * pRes = pFreeEntryList;
+
+ if (pRes != NULL) {
+ pFreeEntryList = pRes->de_next;
+
+ } else {
+ int ct = ENTRY_ALLOC_CT-1;
+ void* p = AGALOC(ENTRY_ALLOC_SIZE, "def headers");
+
+ *((void**)p) = pAllocList;
+ pAllocList = p;
+ pRes = pFreeEntryList = (def_ent_t*)((void**)p + 1);
+
+ /*
+ * This is a post-loop test loop. It will cycle one fewer times
+ * than there are 'def_ent_t' structs in the memory we just alloced.
+ */
+ do {
+ def_ent_t* pNxt = pRes+1;
+ pRes->de_next = pNxt;
+
+ /*
+ * When the loop ends, "pRes" will point to the last allocated
+ * structure instance. That is the one we will return.
+ */
+ pRes = pNxt;
+ } while (--ct > 0);
+
+ /*
+ * Unlink the last entry from the chain. The next time this
+ * routine is called, the *FIRST* structure in this list will
+ * be returned.
+ */
+ pRes[-1].de_next = NULL;
+ }
+
+ memset((void*)pRes, 0, sizeof(*pRes));
+ return pRes;
+}
+
+/*
+ * Append a new entry at the end of a sibling (or twin) list.
+ */
+LOCAL void
+print_ent(def_ent_t * pDef)
+{
+ int ix = 32 - (2 * ent_stack_depth);
+ char const * space = PRINT_DEF_SPACES + ((ix < 0) ? 0 : ix);
+
+ char const * vtyp;
+
+ switch (pDef->de_type) {
+ case VALTYP_UNKNOWN: vtyp = DEF_TYPE_UNKNOWN; break;
+ case VALTYP_TEXT: vtyp = DEF_TYPE_TEXT; break;
+ case VALTYP_BLOCK: vtyp = DEF_TYPE_BLOCK; break;
+ default: vtyp = DEF_TYPE_INVALID; break;
+ }
+
+ fprintf(trace_fp, PRINT_DEF_SHOW_FMT,
+ space,
+ pDef->de_name, (unsigned int)pDef->de_index,
+ vtyp,
+ pDef->de_file, pDef->de_line);
+}
+
+/**
+ * Append a new entry into a sibling (or twin) list.
+ *
+ * @param pDef new definition
+ * @returns usually, the input, but sometimes it is necessary to move
+ * the data, so returns the address of the incoming data regardless.
+ */
+static def_ent_t*
+insert_ent(def_ent_t* pDef)
+{
+ def_ent_t* pList = ent_stack[ ent_stack_depth ];
+
+ /*
+ * If the current level is empty, then just insert this one and quit.
+ */
+ if (pList->de_val.dvu_entry == NULL) {
+ if (pDef->de_index == NO_INDEX)
+ pDef->de_index = 0;
+ pList->de_val.dvu_entry = pDef;
+
+ return pDef;
+ }
+ pList = pList->de_val.dvu_entry;
+
+ /*
+ * Scan the list looking for a "twin" (same-named entry).
+ */
+ while (strcmp(pDef->de_name, pList->de_name) != 0) {
+ /*
+ * IF we are at the end of the list,
+ * THEN put the new entry at the end of the list.
+ * This is a new name in the current context.
+ * The value type is forced to be the same type.
+ */
+ if (pList->de_next == NULL) {
+ pList->de_next = pDef;
+
+ if (pDef->de_index == NO_INDEX)
+ pDef->de_index = 0;
+
+ return pDef;
+ }
+
+ /*
+ * Check the next sibling for a twin value.
+ */
+ pList = pList->de_next;
+ }
+
+ /* * * * * * WE HAVE FOUND A TWIN
+ *
+ * Link in the new twin chain entry into the list.
+ */
+ if (pDef->de_index == NO_INDEX) {
+ def_ent_t* pT = pList->de_etwin;
+ if (pT == NULL)
+ pT = pList;
+
+ pDef->de_index = pT->de_index + 1;
+ pT->de_twin = pDef;
+ pDef->de_ptwin = pT;
+ pList->de_etwin = pDef;
+
+ } else if (pList->de_index > pDef->de_index) {
+
+ /*
+ * Insert the new entry before any other in the list.
+ * We actually do this by leaving the pList pointer alone and swapping
+ * the contents of the definition entry.
+ */
+ def_ent_t def = *pDef;
+
+ memcpy(&(pDef->de_name), &(pList->de_name),
+ sizeof(def) - ag_offsetof(def_ent_t, de_name));
+
+ memcpy(&(pList->de_name), &(def.de_name),
+ sizeof(def) - ag_offsetof(def_ent_t, de_name));
+
+ /*
+ * Contents are swapped. Link "pDef" after "pList" and return "pList".
+ */
+ pDef->de_twin = pList->de_twin;
+ if (pDef->de_twin != NULL)
+ pDef->de_twin->de_ptwin = pDef;
+
+ pDef->de_ptwin = pList;
+ pList->de_twin = pDef;
+
+ /*
+ * IF this is the first twin, then the original list head is now
+ * the "end twin".
+ */
+ if (pList->de_etwin == NULL)
+ pList->de_etwin = pDef;
+
+ pDef = pList; /* Return the replacement structure address */
+
+ } else {
+ def_ent_t* pL = pList;
+ def_ent_t* pT = pL->de_twin;
+
+ /*
+ * Insert someplace after the first entry. Scan the list until
+ * we either find a larger index or we get to the end.
+ */
+ while ((pT != NULL) && (pT->de_index < pDef->de_index)) {
+ pL = pT;
+ pT = pT->de_twin;
+ }
+
+ pDef->de_twin = pT;
+
+ pL->de_twin = pDef;
+ pDef->de_ptwin = pL;
+ if (pT == NULL)
+ pList->de_etwin = pDef;
+ else
+ pT->de_ptwin = pDef;
+ }
+
+ return pDef; /* sometimes will change */
+}
+
+/**
+ * Figure out where to insert an entry in a list of twins.
+ */
+LOCAL def_ent_t *
+number_and_insert_ent(char * name, char const * idx_str)
+{
+ def_ent_t * ent = new_def_ent();
+
+ ent->de_name = name;
+
+ if (idx_str == NULL)
+ ent->de_index = NO_INDEX;
+
+ else if (IS_SIGNED_NUMBER_CHAR(*idx_str))
+ ent->de_index = strtol(idx_str, NULL, 0);
+
+ else {
+ idx_str = get_define_str(idx_str, true);
+ if (idx_str != NULL)
+ ent->de_index = strtol(idx_str, NULL, 0);
+ else ent->de_index = NO_INDEX;
+ }
+
+ strtransform(ent->de_name, ent->de_name);
+ ent->de_type = VALTYP_UNKNOWN;
+ ent->de_file = (char*)cctx->scx_fname;
+ ent->de_line = cctx->scx_line;
+ return (curr_ent = insert_ent(ent));
+}
+
+/**
+ * figure out which file descriptor to use for reading definitions.
+ */
+static def_input_mode_t
+ready_def_input(char const ** ppzfile, size_t * psz)
+{
+ struct stat stbf;
+
+ if (! ENABLED_OPT(DEFINITIONS)) {
+ base_ctx = (scan_ctx_t*)AGALOC(sizeof(scan_ctx_t), "scan context");
+ memset((void*)base_ctx, 0, sizeof(scan_ctx_t));
+ base_ctx->scx_line = 1;
+ base_ctx->scx_fname = READY_INPUT_NODEF;
+
+ if (! ENABLED_OPT(SOURCE_TIME))
+ outfile_time = time(NULL);
+ return INPUT_DONE;
+ }
+
+ *ppzfile = OPT_ARG(DEFINITIONS);
+
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ fprintf(trace_fp, TRACE_DEF_LOAD);
+
+ /*
+ * Check for stdin as the input file. We use the current time
+ * as the modification time for stdin. We also note it so we
+ * do not try to open it and we try to allocate more memory if
+ * the stdin input exceeds our initial allocation of 16K.
+ */
+ if (strcmp(*ppzfile, "-") == 0) {
+ *ppzfile = OPT_ARG(DEFINITIONS) = "stdin";
+ if (getenv(REQUEST_METHOD) != NULL) {
+ loadCgi();
+ cctx = base_ctx;
+ dp_run_fsm();
+ return INPUT_DONE;
+ }
+
+ accept_fifo:
+ outfile_time = time(NULL);
+ *psz = 0x4000 - (4+sizeof(*base_ctx));
+ return INPUT_STDIN;
+ }
+
+ /*
+ * This, then, must be a regular file. Make sure of that and
+ * find out how big it was and when it was last modified.
+ */
+ if (stat(*ppzfile, &stbf) != 0)
+ AG_CANT(READY_INPUT_STAT, *ppzfile);
+
+ if (! S_ISREG(stbf.st_mode)) {
+ if (S_ISFIFO(stbf.st_mode))
+ goto accept_fifo;
+
+ errno = EINVAL;
+ AG_CANT(READY_INPUT_NOT_REG, *ppzfile);
+ }
+
+ /*
+ * IF the source-time option has been enabled, then
+ * our output file mod time will start as one second after
+ * the mod time on this file. If any of the template files
+ * are more recent, then it will be adjusted.
+ */
+ *psz = stbf.st_size;
+
+ outfile_time = ENABLED_OPT(SOURCE_TIME) ? stbf.st_mtime : time(NULL);
+
+ return INPUT_FILE;
+}
+
+/**
+ * Suck in the entire definitions file and parse it.
+ */
+LOCAL void
+read_defs(void)
+{
+ char const * pzDefFile;
+ char * pzData;
+ size_t dataSize;
+ size_t sizeLeft;
+ FILE * fp;
+ def_input_mode_t in_mode = ready_def_input(&pzDefFile, &dataSize);
+
+ if (in_mode == INPUT_DONE)
+ return;
+
+ /*
+ * Allocate the space we need for our definitions.
+ */
+ sizeLeft = dataSize+4+sizeof(*base_ctx);
+ base_ctx = (scan_ctx_t*)AGALOC(sizeLeft, "file buf");
+ memset((void*)base_ctx, 0, sizeLeft);
+ base_ctx->scx_line = 1;
+ sizeLeft = dataSize;
+
+ /*
+ * Our base context will have its currency pointer set to this
+ * input. It is also a scanning pointer, but since this buffer
+ * is never deallocated, we do not have to remember the initial
+ * value. (It may get reallocated here in this routine, tho...)
+ */
+ pzData =
+ base_ctx->scx_scan =
+ base_ctx->scx_data = (char*)(base_ctx+1);
+ base_ctx->scx_next = NULL;
+
+ /*
+ * Set the input file pointer, as needed
+ */
+ if (in_mode == INPUT_STDIN)
+ fp = stdin;
+
+ else {
+ fp = fopen(pzDefFile, "r" FOPEN_TEXT_FLAG);
+ if (fp == NULL)
+ AG_CANT(READ_DEF_OPEN, pzDefFile);
+
+ if (dep_fp != NULL)
+ add_source_file(pzDefFile);
+ }
+
+ /*
+ * Read until done...
+ */
+ for (;;) {
+ size_t rdct = fread((void*)pzData, (size_t)1, sizeLeft, fp);
+
+ /*
+ * IF we are done,
+ */
+ if (rdct == 0) {
+ /*
+ * IF it is because we are at EOF, then break out
+ * ELSE abend.
+ */
+ if (feof(fp) || (in_mode == INPUT_STDIN))
+ break;
+
+ AG_CANT(READ_DEF_READ, pzDefFile);
+ }
+
+ /*
+ * Advance input pointer, decrease remaining count
+ */
+ pzData += rdct;
+ sizeLeft -= rdct;
+
+ /*
+ * See if there is any space left
+ */
+ if (sizeLeft == 0) {
+ scan_ctx_t* p;
+ off_t dataOff;
+
+ /*
+ * IF it is a regular file, then we are done
+ */
+ if (in_mode != INPUT_STDIN)
+ break;
+
+ /*
+ * We have more data and we are out of space.
+ * Try to reallocate our input buffer.
+ */
+ dataSize += (sizeLeft = 0x1000);
+ dataOff = pzData - base_ctx->scx_data;
+ p = AGREALOC((void*)base_ctx, dataSize+4+sizeof(*base_ctx),
+ "expand f buf");
+
+ /*
+ * The buffer may have moved. Set the data pointer at an
+ * offset within the new buffer and make sure our base pointer
+ * has been corrected as well.
+ */
+ if (p != base_ctx) {
+ p->scx_scan = \
+ p->scx_data = (char*)(p+1);
+ pzData = p->scx_data + dataOff;
+ base_ctx = p;
+ }
+ }
+ }
+
+ if (pzData == base_ctx->scx_data)
+ AG_ABEND(READ_DEF_NO_DEFS);
+
+ *pzData = NUL;
+ AGDUPSTR(base_ctx->scx_fname, pzDefFile, "def file name");
+
+ /*
+ * Close the input file, parse the data
+ * and alphabetically sort the definition tree contents.
+ */
+ if (in_mode != INPUT_STDIN)
+ fclose(fp);
+
+ cctx = base_ctx;
+ dp_run_fsm();
+}
+
+
+LOCAL void
+unload_defs(void)
+{
+ return;
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/defLoad.c */
diff --git a/agen5/defParse-fsm.c b/agen5/defParse-fsm.c
new file mode 100644
index 0000000..5e5e006
--- /dev/null
+++ b/agen5/defParse-fsm.c
@@ -0,0 +1,389 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (defParse-fsm.c)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:34 AM by AutoGen 5.16.2pre7
+ * From the definitions defParse.def
+ * and the template file fsm
+ *
+ * Automated Finite State Machine
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name ``Bruce Korb'' nor the name of any other
+ * contributor may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * AutoFSM IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bruce Korb OR ANY OTHER CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#define DEFINE_FSM
+#include "defParse-fsm.h"
+#include <stdio.h>
+
+#define FSM_USER_HEADERS
+#include "defParse.x"
+#undef FSM_USER_HEADERS
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+/**
+ * Callback routine prototype. They return the next state. Normally, that
+ * should be the value of the "maybe_next" argument.
+ */
+typedef te_dp_state (dp_callback_t)(
+ te_dp_state initial,
+ te_dp_state maybe_next,
+ te_dp_event trans_evt );
+
+static dp_callback_t
+ dp_do_empty_val,
+ dp_do_end_block,
+ dp_do_have_name_lit_eq,
+ dp_do_indexed_name,
+ dp_do_invalid,
+ dp_do_need_name_end,
+ dp_do_need_name_var_name,
+ dp_do_next_val,
+ dp_do_start_block,
+ dp_do_str_value,
+ dp_do_tpl_name;
+
+/**
+ * Declare all the state transition handling routines.
+ */
+typedef struct transition t_dp_transition;
+struct transition {
+ te_dp_state next_state;
+ dp_callback_t* trans_proc;
+};
+
+/**
+ * State transition maps. Map the enumeration and the event enumeration
+ * to the new state and the transition enumeration code (in that order).
+ * It is indexed by first the current state and then the event code.
+ */
+static const t_dp_transition
+dp_trans_table[ DP_STATE_CT ][ DP_EVENT_CT ] = {
+
+ /* STATE 0: DP_ST_INIT */
+ { { DP_ST_NEED_DEF, NULL }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+ },
+
+ /* STATE 1: DP_ST_NEED_DEF */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_NEED_TPL, NULL }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+ },
+
+ /* STATE 2: DP_ST_NEED_TPL */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_NEED_SEMI, dp_do_tpl_name }, /* EVT: VAR_NAME */
+ { DP_ST_NEED_SEMI, dp_do_tpl_name }, /* EVT: OTHER_NAME */
+ { DP_ST_NEED_SEMI, dp_do_tpl_name }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+ },
+
+ /* STATE 3: DP_ST_NEED_SEMI */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_NEED_NAME, NULL }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+ },
+
+ /* STATE 4: DP_ST_NEED_NAME */
+ { { DP_ST_NEED_DEF, NULL }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_DONE, dp_do_need_name_end }, /* EVT: End-Of-File */
+ { DP_ST_HAVE_NAME, dp_do_need_name_var_name }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_HAVE_VALUE, dp_do_end_block }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+ },
+
+ /* STATE 5: DP_ST_HAVE_NAME */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_NEED_NAME, dp_do_empty_val }, /* EVT: ; */
+ { DP_ST_NEED_VALUE, dp_do_have_name_lit_eq }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_NEED_IDX, NULL }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+ },
+
+ /* STATE 6: DP_ST_NEED_VALUE */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_HAVE_VALUE, dp_do_str_value }, /* EVT: VAR_NAME */
+ { DP_ST_HAVE_VALUE, dp_do_str_value }, /* EVT: OTHER_NAME */
+ { DP_ST_HAVE_VALUE, dp_do_str_value }, /* EVT: STRING */
+ { DP_ST_HAVE_VALUE, dp_do_str_value }, /* EVT: HERE_STRING */
+ { DP_ST_HAVE_VALUE, dp_do_str_value }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_NEED_NAME, dp_do_start_block }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+ },
+
+ /* STATE 7: DP_ST_NEED_IDX */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_NEED_CBKT, dp_do_indexed_name }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_NEED_CBKT, dp_do_indexed_name }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+ },
+
+ /* STATE 8: DP_ST_NEED_CBKT */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INDX_NAME, NULL } /* EVT: ] */
+ },
+
+ /* STATE 9: DP_ST_INDX_NAME */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_NEED_NAME, dp_do_empty_val }, /* EVT: ; */
+ { DP_ST_NEED_VALUE, NULL }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+ },
+
+ /* STATE 10: DP_ST_HAVE_VALUE */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_NEED_NAME, NULL }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_NEED_VALUE, dp_do_next_val }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+ }
+};
+
+
+#define DpFsmErr_off 19
+#define DpEvInvalid_off 75
+#define DpStInit_off 83
+
+
+static char const zDpStrings[279] =
+/* 0 */ "** OUT-OF-RANGE **\0"
+/* 19 */ "FSM Error: in state %d (%s), event %d (%s) is invalid\n\0"
+/* 75 */ "invalid\0"
+/* 83 */ "init\0"
+/* 88 */ "need_def\0"
+/* 97 */ "need_tpl\0"
+/* 106 */ "need_semi\0"
+/* 116 */ "need_name\0"
+/* 126 */ "have_name\0"
+/* 136 */ "need_value\0"
+/* 147 */ "need_idx\0"
+/* 156 */ "need_cbkt\0"
+/* 166 */ "indx_name\0"
+/* 176 */ "have_value\0"
+/* 187 */ "autogen\0"
+/* 195 */ "definitions\0"
+/* 207 */ "End-Of-File\0"
+/* 219 */ "var_name\0"
+/* 228 */ "other_name\0"
+/* 239 */ "string\0"
+/* 246 */ "here_string\0"
+/* 258 */ "number\0"
+/* 265 */ ";\0"
+/* 267 */ "=\0"
+/* 269 */ ",\0"
+/* 271 */ "{\0"
+/* 273 */ "}\0"
+/* 275 */ "[\0"
+/* 277 */ "]";
+
+static const size_t aszDpStates[11] = {
+ 83, 88, 97, 106, 116, 126, 136, 147, 156, 166, 176 };
+
+static const size_t aszDpEvents[16] = {
+ 187, 195, 207, 219, 228, 239, 246, 258, 265, 267, 269, 271, 273, 275, 277,
+ 75 };
+
+
+#define DP_EVT_NAME(t) ( (((unsigned)(t)) >= 16) \
+ ? zDpStrings : zDpStrings + aszDpEvents[t])
+
+#define DP_STATE_NAME(s) ( (((unsigned)(s)) >= 11) \
+ ? zDpStrings : zDpStrings + aszDpStates[s])
+
+#ifndef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
+static int dp_invalid_transition( te_dp_state st, te_dp_event evt );
+
+#define FSM_HANDLER_CODE
+#include "defParse.x"
+#undef FSM_HANDLER_CODE
+
+/**
+ * Run the FSM. Will return DP_ST_DONE or DP_ST_INVALID
+ */
+te_dp_state
+dp_run_fsm( void )
+{
+ te_dp_state dp_state = DP_ST_INIT;
+ te_dp_event trans_evt;
+ te_dp_state nxtSt;
+ dp_callback_t* pT;
+
+ while (dp_state < DP_ST_INVALID) {
+
+#define FSM_FIND_TRANSITION
+#include "defParse.x"
+#undef FSM_FIND_TRANSITION
+
+#ifndef __COVERITY__
+ if (trans_evt >= DP_EV_INVALID) {
+ nxtSt = DP_ST_INVALID;
+ pT = dp_do_invalid;
+ } else
+#endif /* __COVERITY__ */
+ {
+ const t_dp_transition* pTT =
+ dp_trans_table[ dp_state ] + trans_evt;
+ nxtSt = pTT->next_state;
+ pT = pTT->trans_proc;
+ }
+
+ if (pT != NULL)
+ nxtSt = (*pT)( dp_state, nxtSt, trans_evt );
+
+ dp_state = nxtSt;
+ }
+ return dp_state;
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of defParse-fsm.c */
diff --git a/agen5/defParse-fsm.h b/agen5/defParse-fsm.h
new file mode 100644
index 0000000..bdda896
--- /dev/null
+++ b/agen5/defParse-fsm.h
@@ -0,0 +1,92 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (defParse-fsm.h)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:34 AM by AutoGen 5.16.2pre7
+ * From the definitions defParse.def
+ * and the template file fsm
+ *
+ * Automated Finite State Machine
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name ``Bruce Korb'' nor the name of any other
+ * contributor may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * AutoFSM IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bruce Korb OR ANY OTHER CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * This file enumerates the states and transition events for a FSM.
+ *
+ * te_dp_state
+ * The available states. FSS_INIT is always defined to be zero
+ * and FSS_INVALID and FSS_DONE are always made the last entries.
+ *
+ * te_dp_event
+ * The transition events. These enumerate the event values used
+ * to select the next state from the current state.
+ * DP_EV_INVALID is always defined at the end.
+ */
+#ifndef AUTOFSM_DEFPARSE_FSM_H_GUARD
+#define AUTOFSM_DEFPARSE_FSM_H_GUARD 1
+
+/*
+ * Finite State machine States
+ *
+ * Count of non-terminal states. The generated states INVALID and DONE
+ * are terminal, but INIT is not :-).
+ */
+#define DP_STATE_CT 11
+typedef enum {
+ DP_ST_INIT, DP_ST_NEED_DEF, DP_ST_NEED_TPL, DP_ST_NEED_SEMI,
+ DP_ST_NEED_NAME, DP_ST_HAVE_NAME, DP_ST_NEED_VALUE, DP_ST_NEED_IDX,
+ DP_ST_NEED_CBKT, DP_ST_INDX_NAME, DP_ST_HAVE_VALUE, DP_ST_INVALID,
+ DP_ST_DONE
+} te_dp_state;
+
+/*
+ * Finite State machine transition Events.
+ *
+ * Count of the valid transition events
+ */
+#define DP_EVENT_CT 15
+typedef enum {
+ DP_EV_AUTOGEN, DP_EV_DEFINITIONS, DP_EV_END,
+ DP_EV_VAR_NAME, DP_EV_OTHER_NAME, DP_EV_STRING,
+ DP_EV_HERE_STRING, DP_EV_NUMBER, DP_EV_LIT_SEMI,
+ DP_EV_LIT_EQ, DP_EV_LIT_COMMA, DP_EV_LIT_O_BRACE,
+ DP_EV_LIT_C_BRACE, DP_EV_LIT_OPEN_BKT, DP_EV_LIT_CLOSE_BKT,
+ DP_EV_INVALID
+} te_dp_event;
+
+/**
+ * Run the FSM. Will return DP_ST_DONE or DP_ST_INVALID
+ */
+extern te_dp_state
+dp_run_fsm( void );
+
+#endif /* AUTOFSM_DEFPARSE_FSM_H_GUARD */
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of defParse-fsm.h */
diff --git a/agen5/defParse.def b/agen5/defParse.def
new file mode 100644
index 0000000..6b24380
--- /dev/null
+++ b/agen5/defParse.def
@@ -0,0 +1,109 @@
+/*
+ * Time-stamp: "2010-08-06 08:57:49 bkorb"
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+autogen definitions fsm;
+
+method = callout;
+type = loop;
+prefix = dp;
+#ifdef DEBUG_ENABLED
+debug-flag = FSM_DEBUG_ENABLED;
+#endif
+handler-file = defParse.x;
+
+/*
+ * Non-terminal "events"
+ */
+event = "autogen", "definitions", end,
+ var_name, other_name, string, here_string, number;
+
+/*
+ * Terminal token-events
+ */
+event = lit_semi, lit_eq, lit_comma, lit_o_brace, lit_c_brace,
+ lit_open_bkt, lit_close_bkt;
+
+lit-semi = ';';
+lit-eq = '=';
+lit-comma = ',';
+lit-o_brace = '{';
+lit-c_brace = '}';
+lit-open_bkt = '[';
+lit-close_bkt = ']';
+end = 'End-Of-File';
+
+state = need_def, need_tpl, need_semi, need_name,
+ have_name, need_value, need_idx, need_cbkt,
+ indx_name, have_value;
+
+/*
+ * Initial to operational state
+ */
+transition =
+{ tst = init; tev = "autogen"; next = need_def; ttype = noop; },
+{ tst = need_def; tev = "definitions"; next = need_tpl; ttype = noop; },
+{ tst = need_tpl; tev = string, other_name, var_name;
+ next = need_semi; ttype = tpl_name; },
+{ tst = need_semi; tev = lit_semi; next = need_name; ttype = noop; };
+
+/*
+ * When looking for the next named object, you either get the name,
+ * or end a block or end the input. If you get an "autogen" token, ignore it.
+ * We likely got it due to a #include.
+ */
+transition =
+{ tst = need_name; tev = "autogen"; next = need_def; ttype = noop; },
+{ tst = need_name; tev = var_name; next = have_name; },
+{ tst = need_name; tev = lit_c_brace; next = have_value;
+ ttype = end_block; },
+{ tst = need_name; tev = end; next = done; };
+
+/*
+ * We have a name now. Next is a semicolon for an empty string value,
+ * or an '=' to start a value list or a '[' for an indexed value.
+ */
+transition =
+{ tst = have_name; tev = lit_semi; next = need_name;
+ ttype = empty_val; },
+{ tst = have_name; tev = lit_eq; next = need_value; },
+{ tst = have_name; tev = lit_open_bkt; next = need_idx; ttype = noop; },
+{ tst = need_idx; tev = number, var_name;
+ ttype = indexed_name; next = need_cbkt; },
+{ tst = need_cbkt; tev = lit_close_bkt; next = indx_name;
+ ttype = noop; },
+/*
+ * once you have one index, you cannot have another.
+ * Otherwise, "indx_name" is identical to "have_name".
+ */
+{ tst = indx_name; tev = lit_semi; next = need_name;
+ ttype = empty_val; },
+{ tst = indx_name; tev = lit_eq; next = need_value;
+ ttype = noop; };
+
+transition =
+{ tst = need_value; tev = string, here_string, other_name, var_name, number;
+ next = have_value; ttype = str_value; },
+{ tst = need_value; tev = lit_o_brace; next = need_name;
+ ttype = start_block; },
+{ tst = have_value; tev = lit_semi; next = need_name;
+ ttype = noop; },
+{ tst = have_value; tev = lit_comma; next = need_value;
+ ttype = next_val; };
+/* end of agen5/defParse.def */
diff --git a/agen5/defParse.x b/agen5/defParse.x
new file mode 100644
index 0000000..8317960
--- /dev/null
+++ b/agen5/defParse.x
@@ -0,0 +1,245 @@
+
+/**
+ * @file defParse.x
+ *
+ * Definition parser functions.
+ *
+ * Time-stamp: "2012-03-31 13:30:28 bkorb"
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef FSM_USER_HEADERS
+static char* pz_new_name = NULL;
+#endif /* FSM_USER_HEADERS */
+
+#ifdef FSM_FIND_TRANSITION
+trans_evt = yylex();
+#endif /* FSM_FIND_TRANSITION */
+
+#ifdef FSM_HANDLER_CODE
+/*
+ * Print out an invalid transition message and return EXIT_FAILURE
+ */
+static int
+dp_invalid_transition(te_dp_state st, te_dp_event evt)
+{
+ char const * fmt_pz = zDpStrings + DpFsmErr_off;
+ fprintf(stderr, fmt_pz, st, DP_STATE_NAME(st), evt, DP_EVT_NAME(evt));
+
+ return EXIT_FAILURE;
+}
+
+static te_dp_state
+dp_do_empty_val(te_dp_state initial, te_dp_state maybe_next,
+ te_dp_event trans_evt)
+{
+ /*
+ * Our state is either "have-name" or "indx-name" and we found a ';',
+ * end of statement. It is a string value with an empty string.
+ */
+ def_ent_t * pDE = number_and_insert_ent(pz_new_name, NULL);
+
+ (void)initial; (void)trans_evt;
+
+ pDE->de_val.dvu_text = (char *)zNil;
+ pDE->de_type = VALTYP_TEXT;
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ print_ent(pDE);
+ return maybe_next;
+}
+
+static te_dp_state
+dp_do_end_block(te_dp_state initial, te_dp_state maybe_next,
+ te_dp_event trans_evt)
+{
+ if (ent_stack_depth <= 0)
+ yyerror((void*)"Too many close braces");
+
+ (void)initial; (void)trans_evt;
+
+ curr_ent = ent_stack[ ent_stack_depth-- ];
+ return maybe_next;
+}
+
+static te_dp_state
+dp_do_have_name_lit_eq(te_dp_state initial, te_dp_state maybe_next,
+ te_dp_event trans_evt)
+{
+ (void)initial; (void)trans_evt;
+ /*
+ * Create a new entry but defer "makeMacro" call until we have the
+ * assigned value.
+ */
+ number_and_insert_ent(pz_new_name, NULL);
+ return maybe_next;
+}
+
+static te_dp_state
+dp_do_indexed_name(te_dp_state initial, te_dp_state maybe_next,
+ te_dp_event trans_evt)
+{
+ (void)initial; (void)trans_evt;
+ /*
+ * Create a new entry with a specified indes, but defer "makeMacro" call
+ * until we have the assigned value.
+ */
+ number_and_insert_ent(pz_new_name, token_str);
+ return maybe_next;
+}
+
+static te_dp_state
+dp_do_invalid(te_dp_state initial, te_dp_state maybe_next,
+ te_dp_event trans_evt)
+{
+ (void)maybe_next;
+ dp_invalid_transition(initial, trans_evt);
+ yyerror((void*)"invalid transition");
+ /* NOTREACHED */
+ return DP_ST_INVALID;
+}
+
+static te_dp_state
+dp_do_need_name_end(te_dp_state initial, te_dp_state maybe_next,
+ te_dp_event trans_evt)
+{
+ (void)initial; (void)trans_evt;
+ if (ent_stack_depth != 0)
+ yyerror((void*)"definition blocks were left open");
+
+ /*
+ * We won't be using the parse stack any more.
+ * We only process definitions once.
+ */
+ if (ent_stack != dft_ent_stack)
+ AGFREE(ent_stack);
+
+ /*
+ * The seed has now done its job. The real root of the
+ * definitions is the first entry off of the seed.
+ */
+ root_def_ctx.dcx_defent = root_def_ctx.dcx_defent->de_val.dvu_entry;
+ return maybe_next;
+}
+
+static te_dp_state
+dp_do_need_name_var_name(te_dp_state initial, te_dp_state maybe_next,
+ te_dp_event trans_evt)
+{
+ (void)initial; (void)trans_evt;
+ pz_new_name = token_str;
+ return maybe_next;
+}
+
+static te_dp_state
+dp_do_next_val(te_dp_state initial, te_dp_state maybe_next,
+ te_dp_event trans_evt)
+{
+ (void)initial; (void)trans_evt;
+ /*
+ * Clone the entry name of the current entry.
+ */
+ number_and_insert_ent(curr_ent->de_name, NULL);
+ return maybe_next;
+}
+
+static te_dp_state
+dp_do_start_block(te_dp_state initial, te_dp_state maybe_next,
+ te_dp_event trans_evt)
+{
+ (void)initial; (void)trans_evt;
+ if (curr_ent->de_type == VALTYP_TEXT)
+ yyerror((void*)"assigning a block value to text name");
+ curr_ent->de_type = VALTYP_BLOCK; /* in case not yet determined */
+
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ print_ent(curr_ent);
+
+ if (++ent_stack_depth >= ent_stack_sz) {
+ def_ent_t** ppDE;
+ ent_stack_sz += ent_stack_sz / 2;
+
+ if (ent_stack == dft_ent_stack) {
+ ppDE = AGALOC(ent_stack_sz * sizeof(void*), "def stack");
+ memcpy(ppDE, dft_ent_stack, sizeof(dft_ent_stack));
+ } else {
+ ppDE = AGREALOC(ent_stack, ent_stack_sz * sizeof(void*),
+ "stretch def stack");
+ }
+ ent_stack = ppDE;
+ }
+ ent_stack[ ent_stack_depth ] = curr_ent;
+ curr_ent = NULL;
+ return maybe_next;
+}
+
+static te_dp_state
+dp_do_str_value(te_dp_state initial, te_dp_state maybe_next,
+ te_dp_event trans_evt)
+{
+ (void)initial; (void)trans_evt;
+ if (curr_ent->de_type == VALTYP_BLOCK)
+ yyerror((void*)"assigning a block value to text name");
+
+ curr_ent->de_val.dvu_text = token_str;
+ curr_ent->de_type = VALTYP_TEXT;
+
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ print_ent(curr_ent);
+
+ /*
+ * The "here string" marker is the line before where the text starts.
+ */
+ if (trans_evt == DP_EV_HERE_STRING)
+ curr_ent->de_line++;
+ return maybe_next;
+}
+
+static te_dp_state
+dp_do_tpl_name(te_dp_state initial, te_dp_state maybe_next,
+ te_dp_event trans_evt)
+{
+ (void)initial; (void)trans_evt;
+ /*
+ * Allow this routine to be called multiple times.
+ * This may happen if we include another definition file.
+ */
+ if (root_def_ctx.dcx_defent == NULL) {
+ static char const zBogus[] = "@BOGUS@";
+ static def_ent_t seed = {
+ NULL, NULL, NULL, NULL, (char*)zBogus, 0, { NULL },
+ (char*)zBogus, 0, VALTYP_BLOCK };
+
+ root_def_ctx.dcx_defent = &seed;
+
+ if (! HAVE_OPT(OVERRIDE_TPL))
+ tpl_fname = token_str;
+
+ ent_stack_depth = 0;
+ ent_stack[0] = &seed;
+ }
+ return maybe_next;
+}
+#endif /* FSM_HANDLER_CODE */
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/defParse.x */
diff --git a/agen5/directive.h b/agen5/directive.h
new file mode 100644
index 0000000..a521a3a
--- /dev/null
+++ b/agen5/directive.h
@@ -0,0 +1,125 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (directive.h)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:39 AM by AutoGen 5.16.2pre7
+ * From the definitions directive.def
+ * and the template file directive
+ *
+ * copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef AUTOGEN_DIRECTIVE_H_GUARD
+#define AUTOGEN_DIRECTIVE_H_GUARD 1
+#ifdef DEFINING
+
+typedef char* (tDirProc)( char* pzArg, char* pzScan );
+
+typedef struct dir_table tDirTable;
+struct dir_table {
+ size_t nameSize;
+ char const * pzDirName;
+ tDirProc * pDirProc;
+ int unused;
+};
+
+/*
+ * Declare the procedures that will handle the directives.
+ */
+static tDirProc doDir_IGNORE;
+static tDirProc doDir_assert;
+static tDirProc doDir_define;
+static tDirProc doDir_elif;
+static tDirProc doDir_else;
+static tDirProc doDir_endif;
+static tDirProc doDir_endmac;
+static tDirProc doDir_endshell;
+static tDirProc doDir_error;
+#define doDir_ident doDir_IGNORE
+static tDirProc doDir_if;
+static tDirProc doDir_ifdef;
+static tDirProc doDir_ifndef;
+static tDirProc doDir_include;
+#define doDir_let doDir_IGNORE
+static tDirProc doDir_line;
+static tDirProc doDir_macdef;
+static tDirProc doDir_option;
+#define doDir_pragma doDir_IGNORE
+static tDirProc doDir_shell;
+static tDirProc doDir_undef;
+
+/*
+ * Define the constant string names for each directive.
+ * We supply all the needed terminating NULs, so tell the compiler
+ * the size to allocate.
+ */
+static char const zDirectives[124] =
+ "assert\0" "define\0" "elif\0" "else\0" "endif\0"
+ "endmac\0" "endshell\0" "error\0" "ident\0" "if\0"
+ "ifdef\0" "ifndef\0" "include\0" "let\0" "line\0"
+ "macdef\0" "option\0" "pragma\0" "shell\0" "undef\0";
+
+/*
+ * Enumerate the directives
+ */
+typedef enum {
+ DIR_ASSERT, DIR_DEFINE, DIR_ELIF, DIR_ELSE, DIR_ENDIF,
+ DIR_ENDMAC, DIR_ENDSHELL, DIR_ERROR, DIR_IDENT, DIR_IF,
+ DIR_IFDEF, DIR_IFNDEF, DIR_INCLUDE, DIR_LET, DIR_LINE,
+ DIR_MACDEF, DIR_OPTION, DIR_PRAGMA, DIR_SHELL, DIR_UNDEF
+} teDirectives;
+
+/*
+ * Set up the table for handling each directive.
+ */
+#define DIRECTIVE_CT 20
+static tDirTable dirTable[ DIRECTIVE_CT ] = {
+ { 6, zDirectives + 0, doDir_assert, 0 },
+ { 6, zDirectives + 7, doDir_define, 0 },
+ { 4, zDirectives + 14, doDir_elif, 0 },
+ { 4, zDirectives + 19, doDir_else, 0 },
+ { 5, zDirectives + 24, doDir_endif, 0 },
+ { 6, zDirectives + 30, doDir_endmac, 0 },
+ { 8, zDirectives + 37, doDir_endshell, 0 },
+ { 5, zDirectives + 46, doDir_error, 0 },
+ { 5, zDirectives + 52, doDir_ident, 0 },
+ { 2, zDirectives + 58, doDir_if, 0 },
+ { 5, zDirectives + 61, doDir_ifdef, 0 },
+ { 6, zDirectives + 67, doDir_ifndef, 0 },
+ { 7, zDirectives + 74, doDir_include, 0 },
+ { 3, zDirectives + 82, doDir_let, 0 },
+ { 4, zDirectives + 86, doDir_line, 0 },
+ { 6, zDirectives + 91, doDir_macdef, 0 },
+ { 6, zDirectives + 98, doDir_option, 0 },
+ { 6, zDirectives +105, doDir_pragma, 0 },
+ { 5, zDirectives +112, doDir_shell, 0 },
+ { 5, zDirectives +118, doDir_undef, 0 } };
+
+#ifdef DAEMON_ENABLED
+typedef struct inet_family_map_s {
+ char const* pz_name;
+ unsigned short nm_len;
+ unsigned short family;
+} inet_family_map_t;
+
+#define INET_FAMILY_TYPE_CT 0
+inet_family_map_t inet_family_map[ 1 ] = {
+ { NULL, 0, 0 } };
+
+#endif /* DAEMON_ENABLED */
+#endif /* DEFINING */
+#endif /* AUTOGEN_DIRECTIVE_H_GUARD */
+/*
+ * End of directive.h */
diff --git a/agen5/directive.tpl b/agen5/directive.tpl
new file mode 100644
index 0000000..8a5429c
--- /dev/null
+++ b/agen5/directive.tpl
@@ -0,0 +1,141 @@
+[= AutoGen5 template -*- Mode: C -*-
+
+# Time-stamp: "2012-01-15 08:39:12 bkorb"
+
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+
+h =]
+[=
+
+ (define ix 0)
+ (define tmp-txt "")
+ (define dir-tbl "")
+ (define dir-enm "_EOF_\n")
+ (define dir-nms "_EOF_\n")
+
+ (string-append
+ (dne " * " "/* ")
+ "\n *"
+ "\n * copyright (c) 1992-2012 by Bruce Korb - all rights reserved"
+ "\n *\n"
+ (gpl "AutoGen" " * ")
+ "\n */\n"
+ (make-header-guard "autogen")
+ )
+
+=]
+#ifdef DEFINING
+
+typedef char* (tDirProc)( char* pzArg, char* pzScan );
+
+typedef struct dir_table tDirTable;
+struct dir_table {
+ size_t nameSize;
+ char const * pzDirName;
+ tDirProc * pDirProc;
+ int unused;
+};
+
+/*
+ * Declare the procedures that will handle the directives.
+ */
+static tDirProc doDir_IGNORE;[=
+FOR directive =][=
+
+ (set! tmp-txt (get "name"))
+ (set! dir-tbl (string-append dir-tbl
+ (sprintf " { %2d, zDirectives +%3d, doDir_%-10s 0 }"
+ (string-length tmp-txt) ix
+ (string-downcase! (string-append (get "name") ",")) )
+ (if (last-for?) " };" ",\n")
+ ) )
+
+ (set! dir-enm (string-append dir-enm
+ "DIR_" (string-upcase! (get "name")) "\n" ))
+
+ (set! dir-nms (string-append dir-nms
+ " \"" tmp-txt "\\0\"\n" ))
+
+ (set! ix (+ ix (string-length tmp-txt) 1))
+
+=][=
+
+ IF (not (exist? "dummy")) =]
+static tDirProc doDir_[=name=];[=
+ ELSE =]
+#define doDir_[=name=] doDir_IGNORE[=
+ ENDIF =][=
+ENDFOR directive =]
+
+/*
+ * Define the constant string names for each directive.
+ * We supply all the needed terminating NULs, so tell the compiler
+ * the size to allocate.
+ */
+static char const zDirectives[[=(. ix)=]] =
+[= (shellf "columns --spread=1 -I3 <<%s_EOF_" dir-nms) =];
+
+/*
+ * Enumerate the directives
+ */
+typedef enum {
+[= (shellf "columns -I4 -S, --spread=1 <<%s_EOF_" dir-enm) =]
+} teDirectives;
+
+/*
+ * Set up the table for handling each directive.
+ */
+#define DIRECTIVE_CT [= (+ (high-lim "directive") 1) =]
+static tDirTable dirTable[ DIRECTIVE_CT ] = {
+[= (. dir-tbl) =]
+
+#ifdef DAEMON_ENABLED
+typedef struct inet_family_map_s {
+ char const* pz_name;
+ unsigned short nm_len;
+ unsigned short family;
+} inet_family_map_t;
+
+[= `
+
+list=\`find /usr/include -follow -name socket.h | \
+ xargs egrep '^#define[ \t]+AF_[A-Z0-9]+[ \t]+[0-9]' | \
+ sed 's,^.*#define[ \t]*AF_,,;s,[ \t].*,,;/^MAX$/d'\`
+
+set -- $list
+echo "#define INET_FAMILY_TYPE_CT $#"
+echo "inet_family_map_t inet_family_map[ \`expr $# + 1\` ] = {"
+
+for f
+do
+ g=\`echo $f | tr '[A-Z]' '[a-z]'\`':'
+ ct=\`echo $g | wc -c\`
+ printf " { %-14s %3d, AF_${f} },\\n" "\\\"${g}\\\"," ${ct}
+done | sort -u
+
+`=]
+ { NULL, 0, 0 } };
+
+#endif /* DAEMON_ENABLED */
+#endif /* DEFINING */
+#endif /* [=(. header-guard)=] */
+/*
+ * End of [= (out-name) =] */[= #
+
+end of directive.tpl =]
diff --git a/agen5/expExtract.c b/agen5/expExtract.c
new file mode 100644
index 0000000..f2aa7a4
--- /dev/null
+++ b/agen5/expExtract.c
@@ -0,0 +1,360 @@
+/**
+ * @file expExtract.c
+ *
+ * Time-stamp: "2012-03-04 09:16:59 bkorb"
+ *
+ * This module implements a file extraction function.
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static char const*
+load_extract_file(char const* pzNewFile);
+
+static SCM
+mk_empty_text(char const* pzStart, char const* pzEnd, SCM def);
+
+static SCM
+get_text(char const* pzText, char const* pzStart, char const* pzEnd, SCM def);
+/* = = = END-STATIC-FORWARD = = = */
+
+/**
+ * Load a file into memory. Keep it in memory and try to reuse it
+ * if we get called again. Likely, there will be several extractions
+ * from a single file.
+ */
+static char const*
+load_extract_file(char const* pzNewFile)
+{
+ static char const * pzFile = NULL;
+ static char const * pzText = NULL;
+ struct stat sbuf;
+ char* pzIn;
+
+ /*
+ * Make sure that we:
+ *
+ * o got the file name from the SCM value
+ * o return the old text if we are searching the same file
+ * o have a regular file with some data
+ * o can allocate the space we need...
+ *
+ * If we don't know about the current file, we leave the data
+ * from any previous file we may have loaded.
+ *
+ * DO *NOT* include this file in dependency output. The output may vary
+ * based on its contents, but since it is always optional input, it cannot
+ * be made to be required by make.
+ */
+ if (pzNewFile == NULL)
+ return NULL;
+
+ if ( (pzFile != NULL)
+ && (strcmp(pzFile, pzNewFile) == 0))
+ return pzText;
+
+ if ( (stat(pzNewFile, &sbuf) != 0)
+ || (! S_ISREG(sbuf.st_mode))
+ || (sbuf.st_size < 10) )
+ return NULL;
+
+ if (pzFile != NULL) {
+ AGFREE((void*)pzFile);
+ AGFREE((void*)pzText);
+ pzFile = pzText = NULL;
+ }
+
+ AGDUPSTR(pzFile, pzNewFile, "extract file");
+ pzIn = (char*)AGALOC(sbuf.st_size + 1, "Extract Text");
+
+ if (! HAVE_OPT(WRITABLE))
+ SET_OPT_WRITABLE;
+
+ pzText = (char const*)pzIn;
+
+ /*
+ * Suck up the file. We must read it all.
+ */
+ {
+ struct stat stbf;
+ FILE* fp = fopen(pzNewFile, "r");
+ if (fp == NULL)
+ goto bad_return;
+
+ if (fstat(fileno(fp), &stbf) != 0) {
+ fclose(fp);
+ goto bad_return;
+ }
+
+ if (outfile_time < stbf.st_mtime)
+ outfile_time = stbf.st_mtime;
+
+ do {
+ size_t sz = fread(pzIn, (size_t)1, (size_t)sbuf.st_size, fp);
+ if (sz == 0) {
+ fprintf(stderr, LD_EXTRACT_BAD_READ, errno, strerror(errno),
+ (int)sbuf.st_size, pzFile);
+ AG_ABEND(LD_EXTRACT_READ_FAIL);
+ }
+
+ pzIn += sz;
+ sbuf.st_size -= sz;
+ } while (sbuf.st_size > 0);
+
+ *pzIn = NUL;
+ fclose(fp);
+
+ if (dep_fp != NULL)
+ add_source_file(pzNewFile);
+ }
+
+ return pzText;
+
+ bad_return:
+
+ AGFREE((void*)pzFile);
+ pzFile = NULL;
+ AGFREE((void*)pzText);
+ pzText = NULL;
+
+ return pzText;
+}
+
+
+/**
+ * Could not find the file or could not find the markers.
+ * Either way, emit an empty enclosure.
+ */
+static SCM
+mk_empty_text(char const* pzStart, char const* pzEnd, SCM def)
+{
+ size_t mlen = strlen(pzStart) + strlen(pzEnd) + 3;
+ char* pzOut;
+
+ if (! AG_SCM_STRING_P(def)) {
+ pzOut = ag_scribble(mlen);
+ sprintf(pzOut, LINE_CONCAT3_FMT+3, pzStart, pzEnd);
+
+ } else {
+ char const * pzDef = ag_scm2zchars(def, "dft extr str");
+ mlen += AG_SCM_STRLEN(def) + 1;
+ pzOut = ag_scribble(mlen);
+ sprintf(pzOut, LINE_CONCAT3_FMT, pzStart, pzDef, pzEnd);
+ }
+
+ return AG_SCM_STR02SCM(pzOut);
+}
+
+
+/*
+ * If we got it, emit it.
+ */
+static SCM
+get_text(char const* pzText, char const* pzStart, char const* pzEnd, SCM def)
+{
+ char const* pzS = strstr(pzText, pzStart);
+ char const* pzE;
+
+ if (pzS == NULL)
+ return mk_empty_text(pzStart, pzEnd, def);
+
+ pzE = strstr(pzS, pzEnd);
+ if (pzE == NULL)
+ return mk_empty_text(pzStart, pzEnd, def);
+
+ pzE += strlen(pzEnd);
+
+ return AG_SCM_STR2SCM(pzS, (size_t)(pzE - pzS));
+}
+
+
+/*=gfunc extract
+ *
+ * what: extract text from another file
+ * general_use:
+ * exparg: file-name, name of file with text
+ * exparg: marker-fmt, format for marker text
+ * exparg: caveat, warn about changing marker, opt
+ * exparg: default, default initial text, opt
+ *
+ * doc:
+ *
+ * This function is used to help construct output files that may contain
+ * text that is carried from one version of the output to the next.
+ *
+ * The first two arguments are required, the second are optional:
+ *
+ * @itemize @bullet
+ * @item
+ * The @code{file-name} argument is used to name the file that
+ * contains the demarcated text.
+ * @item
+ * The @code{marker-fmt} is a formatting string that is used to construct
+ * the starting and ending demarcation strings. The sprintf function is
+ * given the @code{marker-fmt} with two arguments. The first is either
+ * "START" or "END". The second is either "DO NOT CHANGE THIS COMMENT"
+ * or the optional @code{caveat} argument.
+ * @item
+ * @code{caveat} is presumed to be absent if it is the empty string
+ * (@code{""}). If absent, ``DO NOT CHANGE THIS COMMENT'' is used
+ * as the second string argument to the @code{marker-fmt}.
+ * @item
+ * When a @code{default} argument is supplied and no pre-existing text
+ * is found, then this text will be inserted between the START and END
+ * markers.
+ * @end itemize
+ *
+ * @noindent
+ * The resulting strings are presumed to be unique within
+ * the subject file. As a simplified example:
+ *
+ * @example
+ * [+ (extract "fname" "// %s - SOMETHING - %s" ""
+ * "example default") +]
+ * @end example
+ * @noindent
+ * will result in the following text being inserted into the output:
+ *
+ * @example
+ * // START - SOMETHING - DO NOT CHANGE THIS COMMENT
+ * example default
+ * // END - SOMETHING - DO NOT CHANGE THIS COMMENT
+ * @end example
+ *
+ * @noindent
+ * The ``@code{example default}'' string can then be carried forward to
+ * the next generation of the output, @strong{@i{provided}} the output
+ * is not named "@code{fname}" @i{and} the old output is renamed to
+ * "@code{fname}" before AutoGen-eration begins.
+ *
+ * @table @strong
+ * @item NB:
+ * You can set aside previously generated source files inside the pseudo
+ * macro with a Guile/scheme function, extract the text you want to keep
+ * with this extract function. Just remember you should delete it at the
+ * end, too. Here is an example from my Finite State Machine generator:
+ *
+ * @example
+ * [+ AutoGen5 Template -*- Mode: text -*-
+ * h=%s-fsm.h c=%s-fsm.c
+ * (shellf
+ * "test -f %1$s-fsm.h && mv -f %1$s-fsm.h .fsm.head
+ * test -f %1$s-fsm.c && mv -f %1$s-fsm.c .fsm.code" (base-name))
+ * +]
+ * @end example
+ *
+ * This code will move the two previously produced output files to files
+ * named ".fsm.head" and ".fsm.code". At the end of the 'c' output
+ * processing, I delete them.
+ *
+ * @item also NB:
+ * This function presumes that the output file ought to be editable so
+ * that the code between the @code{START} and @code{END} marks can be edited
+ * by the template user. Consequently, when the @code{(extract ...)} function
+ * is invoked, if the @code{writable} option has not been specified, then
+ * it will be set at that point. If this is not the desired behavior, the
+ * @code{--not-writable} command line option will override this.
+ * Also, you may use the guile function @code{(chmod "file" mode-value)}
+ * to override whatever AutoGen is using for the result mode.
+ * @end table
+=*/
+SCM
+ag_scm_extract(SCM file, SCM marker, SCM caveat, SCM def)
+{
+ char const * pzStart;
+ char const * pzEnd;
+ char const * pzText;
+
+ if (! AG_SCM_STRING_P(file) || ! AG_SCM_STRING_P(marker))
+ return SCM_UNDEFINED;
+
+ pzText = load_extract_file(ag_scm2zchars(file, "extr file"));
+
+ {
+ char const * pzMarker = ag_scm2zchars(marker, "marker");
+ char const * pzCaveat = EXTRACT_CAVEAT;
+
+ if (AG_SCM_STRING_P(caveat) && (AG_SCM_STRLEN(caveat) > 0))
+ pzCaveat = ag_scm2zchars(caveat, "caveat");
+
+ pzStart = aprf(pzMarker, EXTRACT_START, pzCaveat);
+ pzEnd = aprf(pzMarker, EXTRACT_END, pzCaveat);
+ }
+
+ {
+ SCM res;
+
+ if (pzText == NULL)
+ res = mk_empty_text(pzStart, pzEnd, def);
+ else res = get_text(pzText, pzStart, pzEnd, def);
+
+ AGFREE((void*)pzStart);
+ AGFREE((void*)pzEnd);
+ return res;
+ }
+}
+
+
+/*=gfunc find_file
+ *
+ * what: locate a file in the search path
+ * exparg: file-name, name of file with text
+ * exparg: @suffix @ file suffix to try, too @ opt @
+ *
+ * doc:
+ *
+ * AutoGen has a search path that it uses to locate template and definition
+ * files. This function will search the same list for @file{file-name}, both
+ * with and without the @file{.suffix}, if provided.
+=*/
+SCM
+ag_scm_find_file(SCM file, SCM suffix)
+{
+ SCM res = SCM_UNDEFINED;
+
+ if (! AG_SCM_STRING_P(file))
+ scm_wrong_type_arg(FIND_FILE_NAME, 1, file);
+
+ {
+ char z[ AG_PATH_MAX+1 ];
+ char const * pz = ag_scm2zchars(file, "file-name");
+
+ /*
+ * The suffix is optional. If provided, it will be a string.
+ */
+ if (AG_SCM_STRING_P(suffix)) {
+ char* apz[2];
+ apz[0] = (char *)ag_scm2zchars(suffix, "file suffix");
+ apz[1] = NULL;
+ if (SUCCESSFUL(find_file(pz, z, (char const **)apz, NULL)))
+ res = AG_SCM_STR02SCM(z);
+
+ } else if (SUCCESSFUL(find_file(pz, z, NULL, NULL)))
+ res = AG_SCM_STR02SCM(z);
+ }
+
+ return res;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/expExtract.c */
diff --git a/agen5/expFormat.c b/agen5/expFormat.c
new file mode 100644
index 0000000..1679e36
--- /dev/null
+++ b/agen5/expFormat.c
@@ -0,0 +1,874 @@
+
+/**
+ * @file expFormat.c
+ *
+ * Time-stamp: "2012-03-04 13:54:56 bkorb"
+ *
+ * This module implements formatting expression functions.
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+typedef enum {
+ LSEG_INFO = 1,
+ LSEG_DESC = 2,
+ LSEG_FULL = 3,
+ LSEG_NAME = 4
+} lic_segment_e_t;
+
+/*=gfunc dne
+ *
+ * what: '"Do Not Edit" warning'
+ *
+ * exparg: prefix, string for starting each output line
+ * exparg: first_prefix, for the first output line, opt
+ * exparg: optpfx, shifted prefix, opt
+ *
+ * doc:
+ * Generate a "DO NOT EDIT" or "EDIT WITH CARE" warning string.
+ * Which depends on whether or not the @code{--writable} command line
+ * option was set.
+ *
+ * The first argument may be an option: -d
+ *
+ * This will suppress the variable text (date and version information).
+ * If specified, then the "prefix" and "first" arguments are shifted
+ * to the next arguments.
+ *
+ * The first argument is a per-line string prefix. The optional second
+ * argument is a prefix for the first-line and, in read-only mode, activates
+ * the editor hints.
+ * @*
+ * @example
+ * -*- buffer-read-only: t -*- vi: set ro:
+ * @end example
+ * @noindent
+ * The warning string also includes information about the template used
+ * to construct the file and the definitions used in its instantiation.
+ *
+ * The optional third argument is used when the first argument is actually an
+ * invocation option and the prefix arguments get shifted. The first
+ * argument must be, specifically, "@code{-d}". That is used to signify that
+ * the date stamp should not be inserted into the output.
+=*/
+SCM
+ag_scm_dne(SCM prefix, SCM first, SCM opt)
+{
+ char const * date_str;
+ char const * pzRes;
+ char const * pzFirst;
+ size_t pfxLen;
+ char const * pzPrefix;
+ SCM res;
+
+ if (! AG_SCM_STRING_P(prefix))
+ return SCM_UNDEFINED;
+
+ date_str = NULL;
+ pzFirst = zNil;
+ pfxLen = AG_SCM_STRLEN(prefix);
+ pzPrefix = ag_scm2zchars(prefix, "dne-prefix");
+
+ /*
+ * Check for the ``-d'' option
+ */
+ if ((pfxLen == 2) && (strncmp(pzPrefix, "-d", (size_t)2) == 0)) {
+ date_str = zNil;
+ pfxLen = AG_SCM_STRLEN(first);
+ pzPrefix = ag_scm2zchars(first, "dne-prefix");
+ first = opt;
+ }
+
+ /*
+ * IF we also have a 'first' prefix string,
+ * THEN we set it to something other than ``zNil'' and deallocate later.
+ */
+ if (AG_SCM_STRING_P(first))
+ pzFirst = aprf(ENABLED_OPT(WRITABLE) ? "%s\n" : EXP_FMT_DNE1,
+ ag_scm2zchars(first, "first-prefix"), pzPrefix);
+
+ if (date_str == NULL) {
+ static char const tim_fmt[] =
+ " %B %e, %Y at %r by AutoGen " AUTOGEN_VERSION;
+
+ size_t const tsiz = sizeof(tim_fmt) + sizeof("september") * 2;
+ time_t curTime = time(NULL);
+ struct tm* pTime = localtime(&curTime);
+
+ date_str = ag_scribble(tsiz);
+ strftime((char *)date_str, tsiz, tim_fmt, pTime);
+ }
+
+ {
+ char const * pz;
+ out_stack_t * pfp = cur_fpstack;
+ char const * tpl_name = strrchr(tpl_fname, DIRCH);
+ if (tpl_name == NULL)
+ tpl_name = tpl_fname;
+ else
+ tpl_name++;
+
+ while (pfp->stk_flags & FPF_UNLINK) pfp = pfp->stk_prev;
+ if (! ENABLED_OPT(DEFINITIONS))
+ pz = "<<no definitions>>";
+
+ else if (*oops_pfx != NUL)
+ pz = "<<CGI-definitions>>";
+
+ else {
+ pz = OPT_ARG(DEFINITIONS);
+ if (strcmp(pz, "-") == 0)
+ pz = "stdin";
+ }
+
+ pzRes = aprf(ENABLED_OPT(WRITABLE) ? EXP_FMT_DNE2 : EXP_FMT_DNE,
+ pzPrefix, pfp->stk_fname, date_str,
+ pz, tpl_name, pzFirst);
+ }
+
+ if (pzRes == NULL)
+ AG_ABEND("Allocating Do-Not-Edit string");
+
+ res = AG_SCM_STR02SCM(pzRes);
+
+ /*
+ * Deallocate any temporary buffers. pzFirst either points to
+ * the zNil string, or to an allocated buffer.
+ */
+ AGFREE((void*)pzRes);
+ if (pzFirst != zNil)
+ AGFREE((void*)pzFirst);
+
+ return res;
+}
+
+
+/*=gfunc error
+ *
+ * what: display message and exit
+ *
+ * exparg: @message@message to display before exiting@@
+ * doc:
+ *
+ * The argument is a string that printed out as part of an error
+ * message. The message is formed from the formatting string:
+ *
+ * @example
+ * DEFINITIONS ERROR in %s line %d for %s: %s\n
+ * @end example
+ *
+ * The first three arguments to this format are provided by the
+ * routine and are: The name of the template file, the line within
+ * the template where the error was found, and the current output
+ * file name.
+ *
+ * After displaying the message, the current output file is removed
+ * and autogen exits with the EXIT_FAILURE error code. IF, however,
+ * the argument begins with the number 0 (zero), or the string is the
+ * empty string, then processing continues with the next suffix.
+=*/
+SCM
+ag_scm_error(SCM res)
+{
+ char const * pzMsg;
+ tSuccess abrt = FAILURE;
+ char zNum[16];
+ int msgLen;
+
+ switch (ag_scm_type_e(res)) {
+ case GH_TYPE_BOOLEAN:
+ if (AG_SCM_FALSEP(res))
+ abrt = PROBLEM;
+ pzMsg = zNil;
+ break;
+
+ case GH_TYPE_NUMBER:
+ {
+ unsigned long val = AG_SCM_TO_ULONG(res);
+ if (val == 0)
+ abrt = PROBLEM;
+ snprintf(zNum, sizeof(zNum), "%d", (int)val);
+ pzMsg = zNum;
+ break;
+ }
+
+ case GH_TYPE_CHAR:
+ zNum[0] = AG_SCM_CHAR(res);
+ if ((zNum[0] == NUL) || (zNum[0] == '0'))
+ abrt = PROBLEM;
+ zNum[1] = NUL;
+ pzMsg = zNum;
+ break;
+
+ case GH_TYPE_STRING:
+ pzMsg = ag_scm2zchars(res, "error string");
+ pzMsg = SPN_WHITESPACE_CHARS(pzMsg);
+ msgLen = strlen(pzMsg);
+
+ /*
+ * IF the message starts with the number zero,
+ * OR the message is the empty string,
+ * THEN this is just a warning that is ignored
+ */
+ if (msgLen <= 0)
+ abrt = PROBLEM;
+ else if (IS_DEC_DIGIT_CHAR(*pzMsg) && (strtol(pzMsg, NULL, 0) == 0))
+ abrt = PROBLEM;
+ break;
+
+ default:
+ pzMsg = BAD_MSG_STR;
+ }
+
+ /*
+ * IF there is a message,
+ * THEN print it.
+ */
+ if (*pzMsg != NUL) {
+ char* pz = aprf(DEF_NOTE_FMT, (abrt != PROBLEM) ? ERROR_STR : WARN_STR,
+ current_tpl->td_file, cur_macro->md_line,
+ cur_fpstack->stk_fname, pzMsg);
+ if (abrt != PROBLEM)
+ AG_ABEND(pz);
+ fputs(pz, trace_fp);
+ AGFREE((void*)pz);
+ }
+
+ longjmp(abort_jmp_buf, abrt);
+ /* NOTREACHED */
+ return SCM_UNDEFINED;
+}
+
+/**
+ * Assemble the copyright preamble and long license description.
+ *
+ * @param txt a pointer to the first of two newlines separating
+ * copyright information from the description.
+ */
+static void
+assemble_full_desc(char * txt, char const * pfx)
+{
+ char * pd;
+ char * md;
+
+ size_t prefix_len = strlen(pfx) + 1;
+ while ( (prefix_len > 0)
+ && IS_WHITESPACE_CHAR(pfx[prefix_len - 2]))
+ prefix_len--;
+
+ /*
+ * Preserve the first newline. Set the move destination
+ * out past where we will be inserting the "<PFX>\n" marker.
+ */
+ pd = txt + 1; /* prefix destination */
+ md = pd + prefix_len; /* move destination */
+
+ while (*txt == NL) txt++;
+ /*
+ * Maybe there were exactly enough NL characters we don't need to move
+ */
+ if (md != txt)
+ memmove(md, txt, strlen(txt) + 1);
+ memmove(pd, pfx, --prefix_len);
+ pd[prefix_len] = NL;
+
+ /*
+ * Look for a trailing license name and trim it and trailing white space
+ */
+ txt = strstr(md, "\n\n");
+ if (txt == NULL)
+ txt = md + strlen(md);
+
+ while ( (txt > md)
+ && IS_WHITESPACE_CHAR(txt[-1])) txt--;
+ *txt = NUL;
+}
+
+/**
+ * Trim off the license name. It is the third double-newline stanza
+ * in the license file.
+ *
+ * @param p a pointer to the first of two newlines separating
+ * copyright information from the description.
+ * @return pointer to second stanza, sans the license name trailer.
+ */
+static char *
+trim_lic_name(char * p)
+{
+ char * res;
+ /* skip the leading white space. It starts with NL. */
+ p = SPN_WHITESPACE_CHARS(p + 1);
+ if (*p == NUL)
+ return p;
+
+ res = p;
+
+ /*
+ * The last section ends with two consecutive new lines.
+ * All trailing newlines are trimmed (not all white space).
+ */
+ p = strstr(p, "\n\n");
+ if (p == NULL)
+ p = res + strlen(res);
+ while ( (p > res)
+ && IS_WHITESPACE_CHAR(p[-1])) p--;
+ *p = NUL;
+
+ return res;
+}
+
+/**
+ * Extract the license name. It is the third double-newline stanza
+ * in the license file.
+ *
+ * @param txt a pointer to the first of two newlines separating
+ * copyright information from the description.
+ * @return pointer to the license name trailer.
+ */
+static char *
+get_lic_name(char * p)
+{
+ char * scan = p;
+ while (*(++scan) == NL) ; /* skip the leading NL's. */
+
+ /*
+ * Find the third stanza. If there. If not, we supply some static
+ * text: "an unknown license"
+ */
+ scan = strstr(scan, "\n\n");
+ if (scan == NULL) {
+ strcpy(p, EXP_FMT_BAD_LIC);
+ return p;
+ }
+ while (*scan == NL) scan++;
+ return scan;
+}
+
+/**
+ * Find the kind of text being requested. It may be "full" (the first
+ * two stanzas), "info" (the first -- copyright info + license name),
+ * "description" (the second -- a one paragraph description), or
+ * "name" -- the third stanza.
+ *
+ * @param txt a pointer to the first of two newlines separating
+ * copyright information from the description.
+ * @return pointer to the requested text.
+ */
+static char *
+find_lic_text(
+ lic_segment_e_t segment, SCM lic, ssize_t * txt_len, char const * pfx)
+{
+ static char const * const lic_sfx[] = { FIND_LIC_TEXT_SFX, NULL };
+
+ char const * lic_pz = ag_scm2zchars(lic, "license");
+ char fname[ AG_PATH_MAX ];
+ char * ftext;
+ size_t flen;
+
+ /*
+ * auto-convert "bsd" into "mbsd" for compatibility.
+ */
+ if (strcmp(lic_pz, FIND_LIC_TEXT_MBSD+1) == 0)
+ lic_pz = FIND_LIC_TEXT_MBSD;
+
+ if (! SUCCESSFUL(find_file(lic_pz, fname, lic_sfx, NULL)))
+ return NULL;
+
+ {
+ struct stat stbf;
+ if (stat(fname, &stbf) != 0)
+ AG_CANT(FIND_LIC_TEXT_NO_LIC, fname);
+ if (! S_ISREG(stbf.st_mode)) {
+ errno = EINVAL;
+ AG_CANT(FIND_LIC_TEXT_BAD_FILE, fname);
+ }
+ flen = stbf.st_size;
+ }
+
+ ftext = ag_scribble(flen + EXP_FMT_BAD_LIC_LEN + 1);
+ *txt_len = flen;
+
+ {
+ FILE * fp = fopen(fname, "r");
+
+ if (fp == NULL)
+ AG_CANT(FIND_LIC_TEXT_OPEN, fname);
+
+ if (fread(ftext, 1, flen, fp) != flen)
+ AG_CANT(FIND_LIC_TEXT_BAD_FILE, fname);
+
+ ftext[flen] = NUL;
+ fclose(fp);
+ }
+
+ if (dep_fp != NULL)
+ add_source_file(fname);
+
+ {
+ char * p = strstr(ftext, DOUBLE_NEWLINE);
+
+ if (p == NULL)
+ AG_ABEND(aprf(FIND_LIC_TEXT_INVAL, fname));
+
+ switch (segment) {
+ case LSEG_INFO: p[1] = NUL; break;
+ case LSEG_DESC: ftext = trim_lic_name(p); break;
+ case LSEG_NAME: ftext = get_lic_name(p); break;
+ case LSEG_FULL: assemble_full_desc(p, pfx); break;
+ }
+ }
+
+ return ftext;
+}
+
+/**
+ * Construct an SCM for the kind of text being requested.
+ *
+ * It may be "full" (the first two stanzas), "info" (the first -- copyright
+ * info + license name), "description" (the second -- a one paragraph
+ * description), or "name" -- the third stanza.
+ *
+ * @param seg which segment of license is desired
+ * @param lic The name of the license
+ * @param prog the name of the program
+ * @param pfx a per-line prefix
+ * @param owner who owns the copyright
+ * @param years the copyright years
+ *
+ * @return the SCM-ized string
+ */
+static SCM
+construct_license(
+ lic_segment_e_t seg, SCM lic, SCM prog, SCM pfx, SCM owner, SCM years)
+{
+ static SCM subs = SCM_UNDEFINED;
+ static SCM empty = SCM_UNDEFINED;
+
+ SCM vals = SCM_UNDEFINED;
+ char * lic_text;
+ ssize_t text_len;
+ char const * pfx_pz = ag_scm2zchars(pfx, "lic-prefix");
+
+ if (subs == SCM_UNDEFINED) {
+ static char const * const slst[] = {
+ MK_LIC_PROG, MK_LIC_PFX, MK_LIC_OWN, MK_LIC_YRS
+ };
+ subs = scm_gc_protect_object(
+ scm_list_4(AG_SCM_STR02SCM(slst[0]), AG_SCM_STR02SCM(slst[1]),
+ AG_SCM_STR02SCM(slst[2]), AG_SCM_STR02SCM(slst[3])));
+
+ empty = scm_gc_protect_object(AG_SCM_STR02SCM(""));
+ }
+
+ if (! AG_SCM_STRING_P(lic))
+ AG_ABEND(MK_LIC_NOT_STR);
+
+ lic_text = find_lic_text(seg, lic, &text_len, pfx_pz);
+ if (lic_text == NULL)
+ AG_ABEND(aprf(MK_LIC_NO_LIC, ag_scm2zchars(lic, "lic")));
+
+ if (! AG_SCM_STRING_P(owner)) owner = empty;
+ if (! AG_SCM_STRING_P(years)) years = empty;
+ vals = scm_list_4(prog, pfx, owner, years);
+
+ do_multi_subs(&lic_text, &text_len, subs, vals);
+
+ return AG_SCM_STR02SCM(lic_text);
+}
+
+/*=gfunc license_full
+ *
+ * what: Emit the licensing information and description
+ * general_use:
+ *
+ * exparg: license, name of license type
+ * exparg: prog-name, name of the program under the GPL
+ * exparg: prefix, String for starting each output line
+ * exparg: owner, owner of the program, optional
+ * exparg: years, copyright years, optional
+ *
+ * doc:
+ *
+ * Emit all the text that @code{license-info} and @code{license-description}
+ * would emit (@pxref{SCM license-info, @code{license-info}},
+ * and @pxref{SCM license-description, @code{license-description}}),
+ * with all the same substitutions.
+ *
+ * All of these depend upon the existence of a license file named after the
+ * @code{license} argument with a @code{.lic} suffix. That file should
+ * contain three blocks of text, each separated by two or more newline
+ * characters.
+ *
+ * The first section describes copyright attribution and the name of the usage
+ * licence. For GNU software, this should be the text that is to be displayed
+ * with the program version. Four text markers can be replaced: <PFX>,
+ * <program>, <years> and <owner>.
+ *
+ * The second section is a short description of the terms of the license.
+ * This is typically the kind of text that gets displayed in the header of
+ * source files. The third section is strictly the name of the license
+ * without any substitution markers. Only the <PFX>, <owner> and <program>
+ * markers are substituted.
+ *
+ * The third section is strictly the name of the license.
+ * No marker substitutions are performed.
+ *
+ * @example
+ * <PFX>Copyright (C) <years> <owner>, all rights reserved.
+ * <PFX>This is free software. It is licensed for use,
+ * <PFX>modification and redistribution under the terms
+ * <PFX>of the GNU General Public License, version 3 or later
+ * <PFX> <http://gnu.org/licenses/gpl.html>
+ *
+ * <PFX><program> is free software: you can redistribute it
+ * <PFX>and/or modify it under the terms of the GNU General
+ * <PFX>Public License as published by the Free Software ...
+ *
+ * the GNU General Public License, version 3 or later
+ * @end example
+=*/
+SCM
+ag_scm_license_full(SCM lic, SCM prog, SCM pfx, SCM owner, SCM years)
+{
+ return construct_license(LSEG_FULL, lic, prog, pfx, owner, years);
+}
+
+/*=gfunc license_description
+ *
+ * what: Emit a license description
+ * general_use:
+ *
+ * exparg: license, name of license type
+ * exparg: prog-name, name of the program under the GPL
+ * exparg: prefix, String for starting each output line
+ * exparg: owner, owner of the program, optional
+ *
+ * doc:
+ *
+ * Emit a string that contains a detailed license description, with
+ * substitutions for program name, copyright holder and a per-line prefix.
+ * This is the text typically used as part of a source file header.
+ * For more details, @xref{SCM license-full, the license-full command}.
+ *
+=*/
+SCM
+ag_scm_license_description(SCM lic, SCM prog, SCM pfx, SCM owner)
+{
+ return construct_license(LSEG_DESC, lic, prog, pfx, owner, SCM_UNDEFINED);
+}
+
+/*=gfunc license_info
+ *
+ * what: Emit the licensing information and copyright years
+ * general_use:
+ *
+ * exparg: license, name of license type
+ * exparg: prog-name, name of the program under the GPL
+ * exparg: prefix, String for starting each output line
+ * exparg: owner, owner of the program, optional
+ * exparg: years, copyright years, optional
+ *
+ * doc:
+ *
+ * Emit a string that contains the licensing description, with some
+ * substitutions for program name, copyright holder, a list of years when the
+ * source was modified, and a per-line prefix. This text typically includes a
+ * brief license description and is often printed out when a program starts
+ * running or as part of the @code{--version} output.
+ * For more details, @xref{SCM license-full, the license-full command}.
+ *
+=*/
+SCM
+ag_scm_license_info(SCM lic, SCM prog, SCM pfx, SCM owner, SCM years)
+{
+ return construct_license(LSEG_INFO, lic, prog, pfx, owner, years);
+}
+
+/*=gfunc license_name
+ *
+ * what: Emit the name of the license
+ * general_use:
+ *
+ * exparg: license, name of license type
+ *
+ * doc:
+ *
+ * Emit a string that contains the full name of the license.
+=*/
+SCM
+ag_scm_license_name(SCM lic)
+{
+ ssize_t text_len;
+ char * txt = find_lic_text(LSEG_NAME, lic, &text_len, "");
+ char * e;
+
+ txt = SPN_WHITESPACE_CHARS(txt);
+ e = SPN_WHITESPACE_BACK(txt, txt);
+ *e = NUL;
+ lic = AG_SCM_STR02SCM(txt);
+ return lic;
+}
+
+/*=gfunc gpl
+ *
+ * what: GNU General Public License
+ * general_use:
+ *
+ * exparg: prog-name, name of the program under the GPL
+ * exparg: prefix, String for starting each output line
+ *
+ * doc:
+ *
+ * Emit a string that contains the GNU General Public License.
+ * This function is now deprecated. Please @xref{SCM license-description}.
+=*/
+SCM
+ag_scm_gpl(SCM prog_name, SCM prefix)
+{
+ static SCM lic = SCM_UNDEFINED;
+
+ if (lic == SCM_UNDEFINED)
+ lic = scm_gc_protect_object(AG_SCM_STR02SCM(FIND_LIC_TEXT_LGPL+1));
+ return ag_scm_license_description(lic, prog_name, prefix, SCM_UNDEFINED);
+}
+
+/*=gfunc agpl
+ *
+ * what: GNU Affero General Public License
+ * general_use:
+ *
+ * exparg: prog-name, name of the program under the GPL
+ * exparg: prefix, String for starting each output line
+ *
+ * doc:
+ *
+ * Emit a string that contains the GNU Affero General Public License.
+ * This function is now deprecated. Please @xref{SCM license-description}.
+=*/
+SCM
+ag_scm_agpl(SCM prog_name, SCM prefix)
+{
+ static SCM lic = SCM_UNDEFINED;
+
+ if (lic == SCM_UNDEFINED)
+ lic = scm_gc_protect_object(AG_SCM_STR02SCM(FIND_LIC_TEXT_AGPL));
+ return ag_scm_license_description(lic, prog_name, prefix, SCM_UNDEFINED);
+}
+
+/*=gfunc lgpl
+ *
+ * what: GNU Library General Public License
+ * general_use:
+ *
+ * exparg: prog_name, name of the program under the LGPL
+ * exparg: owner, Grantor of the LGPL
+ * exparg: prefix, String for starting each output line
+ *
+ * doc:
+ *
+ * Emit a string that contains the GNU Library General Public License.
+ * This function is now deprecated. Please @xref{SCM license-description}.
+=*/
+SCM
+ag_scm_lgpl(SCM prog_name, SCM owner, SCM prefix)
+{
+ static SCM lic = SCM_UNDEFINED;
+
+ if (lic == SCM_UNDEFINED)
+ lic = scm_gc_protect_object(AG_SCM_STR02SCM(FIND_LIC_TEXT_LGPL));
+ return ag_scm_license_description(lic, prog_name, prefix, owner);
+}
+
+/*=gfunc bsd
+ *
+ * what: BSD Public License
+ * general_use:
+ *
+ * exparg: prog_name, name of the program under the BSD
+ * exparg: owner, Grantor of the BSD License
+ * exparg: prefix, String for starting each output line
+ *
+ * doc:
+ *
+ * Emit a string that contains the Free BSD Public License.
+ * This function is now deprecated. Please @xref{SCM license-description}.
+ *
+=*/
+SCM
+ag_scm_bsd(SCM prog_name, SCM owner, SCM prefix)
+{
+ static SCM lic = SCM_UNDEFINED;
+
+ if (lic == SCM_UNDEFINED)
+ lic = scm_gc_protect_object(AG_SCM_STR02SCM(FIND_LIC_TEXT_MBSD));
+ return ag_scm_license_description(lic, prog_name, prefix, owner);
+}
+
+/*=gfunc license
+ *
+ * what: an arbitrary license
+ * general_use:
+ *
+ * exparg: lic_name, file name of the license
+ * exparg: prog_name, name of the licensed program or library
+ * exparg: owner, Grantor of the License
+ * exparg: prefix, String for starting each output line
+ *
+ * doc:
+ * Emit a string that contains the named license.
+ * This function is now deprecated. Please @xref{SCM license-description}.
+=*/
+SCM
+ag_scm_license(SCM license, SCM prog_name, SCM owner, SCM prefix)
+{
+ char const * pzPfx = ag_scm2zchars(prefix, "GPL line prefix");
+ char const * pzPrg = ag_scm2zchars(prog_name, "program name");
+ char const * pzOwner = ag_scm2zchars(owner, "owner");
+ static struct {
+ char const * pzFN;
+ tmap_info_t mi;
+ } lic = { NULL, { NULL, 0, 0, 0, 0, 0, 0, 0 }};
+
+ char* pzRes;
+
+ if (! AG_SCM_STRING_P(license))
+ return SCM_UNDEFINED;
+
+ {
+ static char const * const apzSfx[] = { MK_LIC_SFX, NULL };
+ static char fname[ AG_PATH_MAX ];
+ char const * pzLicense = ag_scm2zchars(license, "lic file");
+
+ /*
+ * Find the template file somewhere
+ */
+ if (! SUCCESSFUL(find_file(pzLicense, fname, apzSfx, NULL))) {
+ errno = ENOENT;
+ AG_CANT(MK_LIC_NO_LIC, pzLicense);
+ }
+
+ if ((lic.pzFN != NULL) && (strcmp(fname, lic.pzFN) != 0)) {
+ text_munmap(&lic.mi);
+ AGFREE((void*)lic.pzFN);
+ lic.pzFN = NULL;
+ }
+
+ if (lic.pzFN == NULL) {
+ text_mmap(fname, PROT_READ|PROT_WRITE, MAP_PRIVATE, &lic.mi);
+ if (TEXT_MMAP_FAILED_ADDR(lic.mi.txt_data))
+ AG_ABEND(aprf(MK_LIC_NO_OPEN, pzLicense));
+
+ if (dep_fp != NULL)
+ add_source_file(pzLicense);
+
+ AGDUPSTR(lic.pzFN, fname, "lic f name");
+ }
+ }
+
+ /*
+ * Trim trailing white space.
+ */
+ {
+ char* pz = (char*)lic.mi.txt_data + lic.mi.txt_size;
+ while ( (pz > (char*)lic.mi.txt_data)
+ && IS_WHITESPACE_CHAR(pz[-1]))
+ pz--;
+ *pz = NUL;
+ }
+
+ /*
+ * Get the addresses of the program name prefix and owner strings.
+ * Make sure they are reasonably sized (less than
+ * SCRIBBLE_SIZE). Copy them to the scratch buffer.
+ */
+ if (AG_SCM_STRLEN(prog_name) >= SCRIBBLE_SIZE)
+ AG_ABEND(aprf(MK_LIC_TOO_BIG_FMT, MK_LIC_BIG_PROG, SCRIBBLE_SIZE));
+
+ if (AG_SCM_STRLEN(prefix) >= SCRIBBLE_SIZE)
+ AG_ABEND(aprf(MK_LIC_TOO_BIG_FMT, MK_LIC_BIG_PFX, SCRIBBLE_SIZE));
+
+ if (AG_SCM_STRLEN(owner) >= SCRIBBLE_SIZE)
+ AG_ABEND(aprf(MK_LIC_TOO_BIG_FMT, MK_LIC_BIG_OWN, SCRIBBLE_SIZE));
+
+ /*
+ * Reformat the string with the given arguments
+ */
+ pzRes = aprf((char*)lic.mi.txt_data, pzPrg, pzOwner);
+ {
+ int pfx_size = strlen(pzPfx);
+ char* pzScan = pzRes;
+ char* pzOut;
+ char* pzSaveRes;
+ size_t out_size = pfx_size;
+
+ /*
+ * Figure out how much space we need (text size plus
+ * a prefix size for each newline)
+ */
+ for (;;) {
+ switch (*(pzScan++)) {
+ case NUL:
+ goto exit_count;
+ case NL:
+ out_size += pfx_size;
+ /* FALLTHROUGH */
+ default:
+ out_size++;
+ }
+ } exit_count:;
+
+ /*
+ * Create our output buffer and insert the first prefix
+ */
+ pzOut = pzSaveRes = ag_scribble(out_size);
+
+ strcpy(pzOut, pzPfx);
+ pzOut += pfx_size;
+ pzScan = pzRes;
+
+ for (;;) {
+ switch (*(pzOut++) = *(pzScan++)) {
+ case NUL:
+ goto exit_copy;
+
+ case NL:
+ strcpy(pzOut, pzPfx);
+ pzOut += pfx_size;
+ break;
+
+ default:
+ break;
+ }
+ }
+ exit_copy:;
+
+ /*
+ * We allocated a temporary buffer that has all the
+ * formatting done, but need the prefixes on each line.
+ */
+ AGFREE((void*)pzRes);
+
+ return AG_SCM_STR2SCM(pzSaveRes, (size_t)((pzOut - pzSaveRes) - 1));
+ }
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/expFormat.c */
diff --git a/agen5/expGperf.c b/agen5/expGperf.c
new file mode 100644
index 0000000..902f18b
--- /dev/null
+++ b/agen5/expGperf.c
@@ -0,0 +1,156 @@
+/**
+ * @file expGperf.c
+ *
+ * Time-stamp: "2012-01-15 08:38:23 bkorb"
+ *
+ * Create a perfect hash function program and use it to compute
+ * index values for a list of provided names. It also documents how
+ * to incorporate that hashing function into a generated C program.
+ *
+ * This file is part of AutoGen.
+ * Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef SHELL_ENABLED
+HIDE_FN(SCM ag_scm_make_gperf(SCM name, SCM hlist))
+{
+ return SCM_UNDEFINED;
+}
+
+HIDE_FN(SCM ag_scm_gperf(SCM name, SCM str))
+{
+ return SCM_UNDEFINED;
+}
+#else
+
+/*=gfunc make_gperf
+ *
+ * what: build a perfect hash function program
+ * general_use:
+ *
+ * exparg: name , name of hash list
+ * exparg: strings , list of strings to hash ,, list
+ *
+ * doc: Build a program to perform perfect hashes of a known list of input
+ * strings. This function produces no output, but prepares a program
+ * named, @file{gperf_<name>} for use by the gperf function
+ * @xref{SCM gperf}.
+ *
+ * This program will be obliterated as AutoGen exits.
+ * However, you may incorporate the generated hashing function
+ * into your C program with commands something like the following:
+ *
+ * @example
+ * [+ (shellf "sed '/^int main(/,$d;/^#line/d' $@{gpdir@}/%s.c"
+ * name ) +]
+ * @end example
+ *
+ * where @code{name} matches the name provided to this @code{make-perf}
+ * function. @code{gpdir} is the variable used to store the name of the
+ * temporary directory used to stash all the files.
+=*/
+SCM
+ag_scm_make_gperf(SCM name, SCM hlist)
+{
+ static bool do_cleanup = true;
+
+ char const * pzName = ag_scm2zchars(name, "gperf name");
+ char const * pzList;
+ SCM newline = AG_SCM_STR2SCM(NEWLINE, (size_t)1);
+
+ if (! AG_SCM_STRING_P(name))
+ return SCM_UNDEFINED;
+
+ /*
+ * Construct the newline separated list of values
+ */
+ hlist = ag_scm_join(newline, hlist);
+ pzList = ag_scm2zchars(hlist, "hash list");
+
+ /*
+ * Stash the concatenated list somewhere, hopefully without an alloc.
+ */
+ {
+ char * cmd = aprf(MK_GPERF_SCRIPT, zMakeProg, pzName, pzList);
+
+ /*
+ * Run the command and ignore the results.
+ * In theory, the program should be ready.
+ */
+ pzList = shell_cmd(cmd);
+ AGFREE(cmd);
+
+ if (pzList != NULL)
+ free((void *)pzList);
+ }
+
+ if (do_cleanup) {
+ SCM_EVAL_CONST(MAKE_GPERF_CLEANUP);
+ do_cleanup = false;
+ }
+
+ return SCM_BOOL_T;
+}
+
+
+/*=gfunc gperf
+ *
+ * what: perform a perfect hash function
+ * general_use:
+ *
+ * exparg: name , name of hash list
+ * exparg: str , string to hash
+ *
+ * doc: Perform the perfect hash on the input string. This is only useful if
+ * you have previously created a gperf program with the @code{make-gperf}
+ * function @xref{SCM make-gperf}. The @code{name} you supply here must
+ * match the name used to create the program and the string to hash must
+ * be one of the strings supplied in the @code{make-gperf} string list.
+ * The result will be a perfect hash index.
+ *
+ * See the documentation for @command{gperf(1GNU)} for more details.
+=*/
+SCM
+ag_scm_gperf(SCM name, SCM str)
+{
+ char const * cmd;
+ char const * key2hash = ag_scm2zchars(str, "key-to-hash");
+ char const * gp_name = ag_scm2zchars(name, "gperf name");
+
+ /*
+ * Format the gperf command and check the result. If it fits in
+ * scribble space, use that.
+ * (If it does fit, then the test string fits already).
+ */
+ cmd = aprf(RUN_GPERF_CMD, gp_name, key2hash);
+ key2hash = shell_cmd(cmd);
+ if (*key2hash == NUL)
+ str = SCM_UNDEFINED;
+ else
+ str = AG_SCM_STR02SCM(key2hash);
+
+ AGFREE((void *)cmd);
+ AGFREE((void *)key2hash);
+ return str;
+}
+#endif
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/expGperf.c */
diff --git a/agen5/expGuile.c b/agen5/expGuile.c
new file mode 100644
index 0000000..e05a2a7
--- /dev/null
+++ b/agen5/expGuile.c
@@ -0,0 +1,522 @@
+
+/**
+ * @file expGuile.c
+ *
+ * Time-stamp: "2012-03-04 19:06:37 bkorb"
+ *
+ * This module implements the expression functions that should
+ * be part of Guile.
+ *
+ * This file is part of AutoGen.
+ * Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+LOCAL teGuileType
+ag_scm_type_e(SCM typ)
+{
+ if (AG_SCM_BOOL_P( typ)) return GH_TYPE_BOOLEAN;
+ if (AG_SCM_SYM_P( typ)) return GH_TYPE_SYMBOL;
+ if (AG_SCM_STRING_P(typ)) return GH_TYPE_STRING;
+ if (AG_SCM_IS_PROC( typ)) return GH_TYPE_PROCEDURE;
+ if (AG_SCM_CHAR_P( typ)) return GH_TYPE_CHAR;
+ if (AG_SCM_VEC_P( typ)) return GH_TYPE_VECTOR;
+ if (AG_SCM_PAIR_P( typ)) return GH_TYPE_PAIR;
+ if (AG_SCM_NUM_P( typ)) return GH_TYPE_NUMBER;
+ if (AG_SCM_LIST_P( typ)) return GH_TYPE_LIST;
+
+ return GH_TYPE_UNDEFINED;
+}
+
+
+LOCAL SCM
+ag_scm_c_eval_string_from_file_line(
+ char const * pzExpr, char const * pzFile, int line)
+{
+ SCM port = scm_open_input_string(AG_SCM_STR02SCM(pzExpr));
+
+ if (OPT_VALUE_TRACE >= TRACE_EVERYTHING)
+ fprintf(trace_fp, TRACE_EVAL_STRING, pzFile, line, pzExpr);
+
+ {
+ static SCM file = SCM_UNDEFINED;
+ static char * pzOldFile = NULL;
+
+ if ((pzOldFile == NULL) || (strcmp(pzOldFile, pzFile) != 0)) {
+ if (pzOldFile != NULL)
+ AGFREE(pzOldFile);
+ AGDUPSTR(pzOldFile, pzFile, "scheme source");
+ file = AG_SCM_STR02SCM(pzFile);
+ }
+
+ {
+ SCM ln = AG_SCM_INT2SCM(line);
+ scm_set_port_filename_x(port, file);
+ scm_set_port_line_x(port, ln);
+ scm_set_port_column_x(port, SCM_INUM0);
+ }
+ }
+
+ {
+ SCM ans = SCM_UNSPECIFIED;
+
+ /* Read expressions from that port; ignore the values. */
+ for (;;) {
+ SCM form = scm_read(port);
+ if (SCM_EOF_OBJECT_P(form))
+ break;
+ ans = scm_primitive_eval_x(form);
+ }
+
+ return ans;
+ }
+}
+
+
+/*=gfunc max
+ *
+ * what: maximum value in list
+ * general_use:
+ *
+ * exparg: list , list of values. Strings are converted to numbers ,, list
+ *
+ * doc: Return the maximum value in the list
+=*/
+SCM
+ag_scm_max(SCM list)
+{
+ int len;
+ SCM car;
+ long max_val = LONG_MIN;
+# ifndef MAX
+# define MAX(m,v) ((v > m) ? v : m)
+# endif
+ len = scm_ilength(list);
+ if (len <= 0)
+ return SCM_UNDEFINED;
+
+ while (--len >= 0) {
+ long val;
+
+ car = SCM_CAR(list);
+ list = SCM_CDR(list);
+
+ switch (ag_scm_type_e(car)) {
+ case GH_TYPE_BOOLEAN:
+ if (car == SCM_BOOL_F) {
+ val = 0;
+ } else {
+ val = 1;
+ }
+ break;
+
+ case GH_TYPE_CHAR:
+ val = (int)AG_SCM_CHAR(car);
+ break;
+
+ case GH_TYPE_NUMBER:
+ val = AG_SCM_TO_LONG(car);
+ break;
+
+ case GH_TYPE_STRING:
+ val = strtol(ag_scm2zchars(car, "number-in-string"), NULL, 0);
+ break;
+
+ default:
+ continue;
+ }
+ max_val = MAX(max_val, val);
+ }
+
+ return AG_SCM_FROM_LONG(max_val);
+}
+
+
+/*=gfunc min
+ *
+ * what: minimum value in list
+ * general_use:
+ *
+ * exparg: list , list of values. Strings are converted to numbers ,, list
+ *
+ * doc: Return the minimum value in the list
+=*/
+SCM
+ag_scm_min(SCM list)
+{
+ int len;
+ SCM car;
+ long min_val = LONG_MAX;
+# ifndef MIN
+# define MIN(m,v) ((v < m) ? v : m)
+# endif
+ len = scm_ilength(list);
+ if (len <= 0)
+ return SCM_UNDEFINED;
+
+ while (--len >= 0) {
+ long val;
+
+ car = SCM_CAR(list);
+ list = SCM_CDR(list);
+
+ switch (ag_scm_type_e(car)) {
+ case GH_TYPE_BOOLEAN:
+ if (car == SCM_BOOL_F) {
+ val = 0;
+ } else {
+ val = 1;
+ }
+ break;
+
+ case GH_TYPE_CHAR:
+ val = (int)AG_SCM_CHAR(car);
+ break;
+
+ case GH_TYPE_NUMBER:
+ val = AG_SCM_TO_LONG(car);
+ break;
+
+ case GH_TYPE_STRING:
+ val = strtol(ag_scm2zchars(car, "number-in-string"), NULL, 0);
+ break;
+
+ default:
+ continue;
+ }
+ min_val = MIN(min_val, val);
+ }
+
+ return AG_SCM_FROM_LONG(min_val);
+}
+
+
+/*=gfunc sum
+ *
+ * what: sum of values in list
+ * general_use:
+ *
+ * exparg: list , list of values. Strings are converted to numbers ,, list
+ *
+ * doc: Compute the sum of the list of expressions.
+=*/
+SCM
+ag_scm_sum(SCM list)
+{
+ int len = scm_ilength(list);
+ long sum = 0;
+
+ if (len <= 0)
+ return AG_SCM_INT2SCM(0);
+
+ do {
+ SCM car = SCM_CAR(list);
+ list = SCM_CDR(list);
+ switch (ag_scm_type_e(car)) {
+ default:
+ return SCM_UNDEFINED;
+
+ case GH_TYPE_CHAR:
+ sum += (long)(unsigned char)AG_SCM_CHAR(car);
+ break;
+
+ case GH_TYPE_NUMBER:
+ sum += AG_SCM_TO_LONG(car);
+ break;
+
+ case GH_TYPE_STRING:
+ sum += strtol(ag_scm2zchars(car, "number-in-string"), NULL, 0);
+ }
+ } while (--len > 0);
+
+ return AG_SCM_FROM_LONG(sum);
+}
+
+
+/*=gfunc string_to_c_name_x
+ *
+ * what: map non-name chars to underscore
+ * general_use:
+ *
+ * exparg: str , input/output string
+ *
+ * doc: Change all the graphic characters that are invalid in a C name token
+ * into underscores. Whitespace characters are ignored. Any other
+ * character type (i.e. non-graphic and non-white) will cause a failure.
+=*/
+SCM
+ag_scm_string_to_c_name_x(SCM str)
+{
+ int len;
+ char* pz;
+
+ if (! AG_SCM_STRING_P(str))
+ scm_wrong_type_arg(STR_TO_C_NAME, 1, str);
+
+
+
+ for (pz = (char*)(void*)AG_SCM_CHARS(str), len = AG_SCM_STRLEN(str);
+ --len >= 0;
+ pz++) {
+
+ char ch = *pz;
+ if (IS_ALPHANUMERIC_CHAR(ch) || IS_WHITESPACE_CHAR(ch))
+ continue;
+
+ if (! IS_GRAPHIC_CHAR(ch))
+ scm_misc_error(STR_TO_C_NAME, STR_TO_C_MAP_FAIL, str);
+
+ *pz = '_';
+ }
+
+ return str;
+}
+
+
+/*=gfunc string_upcase_x
+ *
+ * what: make a string be upper case
+ * general_use:
+ *
+ * exparg: str , input/output string
+ *
+ * doc: Change to upper case all the characters in an SCM string.
+=*/
+SCM
+ag_scm_string_upcase_x(SCM str)
+{
+ int len;
+ char* pz;
+
+ if (! AG_SCM_STRING_P(str))
+ return SCM_UNDEFINED;
+
+ len = AG_SCM_STRLEN(str);
+ pz = (char*)(void*)AG_SCM_CHARS(str);
+ while (--len >= 0) {
+ char ch = *pz;
+ if (IS_LOWER_CASE_CHAR(ch))
+ *pz = toupper(ch);
+ pz++;
+ }
+
+ return str;
+}
+
+
+/*=gfunc string_upcase
+ *
+ * what: upper case a new string
+ * general_use:
+ *
+ * exparg: str , input string
+ *
+ * doc: Create a new SCM string containing the same text as the original,
+ * only all the lower case letters are changed to upper case.
+=*/
+SCM
+ag_scm_string_upcase(SCM str)
+{
+ SCM res;
+ if (! AG_SCM_STRING_P(str))
+ return SCM_UNDEFINED;
+
+ res = AG_SCM_STR2SCM(AG_SCM_CHARS(str), AG_SCM_STRLEN(str));
+ scm_string_upcase_x(res);
+ return res;
+}
+
+
+/*=gfunc string_capitalize_x
+ *
+ * what: capitalize a string
+ * general_use:
+ *
+ * exparg: str , input/output string
+ *
+ * doc: capitalize all the words in an SCM string.
+=*/
+SCM
+ag_scm_string_capitalize_x(SCM str)
+{
+ int len;
+ char* pz;
+ bool word_start = true;
+
+ if (! AG_SCM_STRING_P(str))
+ return SCM_UNDEFINED;
+
+ len = AG_SCM_STRLEN(str);
+ pz = (char*)(void*)AG_SCM_CHARS(str);
+
+ while (--len >= 0) {
+ char ch = *pz;
+
+ if (! IS_ALPHANUMERIC_CHAR(ch)) {
+ word_start = true;
+
+ } else if (word_start) {
+ word_start = false;
+ if (IS_LOWER_CASE_CHAR(ch))
+ *pz = toupper(ch);
+
+ } else if (IS_UPPER_CASE_CHAR(ch))
+ *pz = tolower(ch);
+
+ pz++;
+ }
+
+ return str;
+}
+
+
+/*=gfunc string_capitalize
+ *
+ * what: capitalize a new string
+ * general_use:
+ *
+ * exparg: str , input string
+ *
+ * doc: Create a new SCM string containing the same text as the original,
+ * only all the first letter of each word is upper cased and all
+ * other letters are made lower case.
+=*/
+SCM
+ag_scm_string_capitalize(SCM str)
+{
+ SCM res;
+ if (! AG_SCM_STRING_P(str))
+ return SCM_UNDEFINED;
+
+ res = AG_SCM_STR2SCM(AG_SCM_CHARS(str), AG_SCM_STRLEN(str));
+ ag_scm_string_capitalize_x(res);
+ return res;
+}
+
+
+/*=gfunc string_downcase_x
+ *
+ * what: make a string be lower case
+ * general_use:
+ *
+ * exparg: str , input/output string
+ *
+ * doc: Change to lower case all the characters in an SCM string.
+=*/
+SCM
+ag_scm_string_downcase_x(SCM str)
+{
+ int len;
+ char* pz;
+
+ if (! AG_SCM_STRING_P(str))
+ return SCM_UNDEFINED;
+
+ len = AG_SCM_STRLEN(str);
+ pz = (char*)(void*)AG_SCM_CHARS(str);
+ while (--len >= 0) {
+ char ch = *pz;
+ if (IS_UPPER_CASE_CHAR(ch))
+ *pz = tolower(ch);
+ pz++;
+ }
+
+ return str;
+}
+
+
+/*=gfunc string_downcase
+ *
+ * what: lower case a new string
+ * general_use:
+ *
+ * exparg: str , input string
+ *
+ * doc: Create a new SCM string containing the same text as the original,
+ * only all the upper case letters are changed to lower case.
+=*/
+SCM
+ag_scm_string_downcase(SCM str)
+{
+ SCM res;
+ if (! AG_SCM_STRING_P(str))
+ return SCM_UNDEFINED;
+
+ res = AG_SCM_STR2SCM(AG_SCM_CHARS(str), AG_SCM_STRLEN(str));
+ ag_scm_string_downcase_x(res);
+ return res;
+}
+
+
+/*=gfunc string_to_camelcase
+ *
+ * what: make a string be CamelCase
+ * general_use:
+ *
+ * exparg: str , input/output string
+ *
+ * doc: Capitalize the first letter of each block of letters and numbers,
+ * and stripping out characters that are not alphanumerics.
+ * For example, "alpha-beta0gamma" becomes "AlphaBeta0gamma".
+=*/
+SCM
+ag_scm_string_to_camelcase(SCM str)
+{
+ int len;
+ char* pzd, * res;
+ char* pzs;
+ bool cap_done = false;
+
+ if (! AG_SCM_STRING_P(str))
+ return SCM_UNDEFINED;
+
+ len = AG_SCM_STRLEN(str);
+ res = pzd = ag_scribble(len + 1);
+ pzs = (char*)(void*)AG_SCM_CHARS(str);
+
+ while (--len >= 0) {
+ unsigned int ch = *(pzs++);
+ if (IS_LOWER_CASE_CHAR(ch)) {
+ if (! cap_done) {
+ ch = toupper(ch);
+ cap_done = true;
+ }
+
+ } else if (IS_UPPER_CASE_CHAR(ch)) {
+ if (cap_done)
+ ch = tolower(ch);
+ else
+ cap_done = true;
+
+ } else if (IS_DEC_DIGIT_CHAR(ch)) {
+ cap_done = false;
+
+ } else {
+ cap_done = false;
+ continue;
+ }
+
+ *(pzd++) = ch;
+ }
+
+ return AG_SCM_STR2SCM(res, (pzd - res));
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/expGuile.c */
diff --git a/agen5/expMake.c b/agen5/expMake.c
new file mode 100644
index 0000000..926b930
--- /dev/null
+++ b/agen5/expMake.c
@@ -0,0 +1,429 @@
+
+/**
+ * @file expMake.c
+ *
+ * Time-stamp: "2012-03-04 13:54:13 bkorb"
+ *
+ * This module implements Makefile construction functions.
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Figure out how to handle the line continuation.
+ * If the line we just finished ends with a backslash, we're done.
+ * Just add the newline character. If it ends with a semi-colon or a
+ * doubled amphersand or doubled or-bar, then escape the newline with a
+ * backslash. If the line ends with one of the keywords "then", "in" or
+ * "else", also only add the escaped newline. Otherwise, add a
+ * semi-colon, backslash and newline.
+ *
+ * @param ppzi pointer to pointer to input text
+ * @param ppzo pointer to pointer to output text
+ * @param tabch line prefix (tab) character
+ * @param bol pointer to start of currently-being-output line
+ *
+ * @returns false to say the newline is dropped becase we're done
+ * true to say the line was appended with the newline.
+ */
+static bool
+handle_eol(char ** ppzi, char ** ppzo, char tabch, char * bol)
+{
+ char * pzScn = *ppzi;
+ char * pzOut = *ppzo;
+ int l_len = pzOut - bol;
+
+ /*
+ * Backup past trailing white space (other than newline).
+ */
+ while (IS_NON_NL_WHITE_CHAR(pzOut[-1]))
+ pzOut--;
+
+ /*
+ * Skip over empty lines, but leave leading white space
+ * on the next non-empty line.
+ */
+ {
+ char* pz = pzScn;
+ while (IS_WHITESPACE_CHAR(*pz)) {
+ if (*(pz++) == NL)
+ pzScn = pz;
+ }
+ }
+
+ /*
+ * The final newline is dropped.
+ */
+ if (*pzScn == NUL)
+ return false;
+
+ switch (pzOut[-1]) {
+ case '\\':
+ /*
+ * The newline is already escaped, so don't
+ * insert our extra command termination.
+ */
+ *(pzOut++) = NL;
+ break;
+
+ case '&':
+ /*
+ * A single ampersand is a backgrounded command. We must terminate
+ * those statements, but not statements conjoined with '&&'.
+ */
+ if ('&' != pzOut[-2])
+ goto append_statement_end;
+ /* FALLTHROUGH */
+
+ case '|':
+ case ';':
+ skip_semi_colon:
+ /*
+ * Whatever the reason for a final '|', '&' or ';',
+ * we will not add a semi-colon after it.
+ */
+ memcpy(pzOut, MAKE_SCRIPT_NL + 2, MAKE_SCRIPT_NL_LEN - 2);
+ pzOut += MAKE_SCRIPT_NL_LEN - 2;
+ break;
+
+ case 'n': // "then" or "in"
+ if (l_len < 3)
+ goto append_statement_end;
+
+ if (pzOut[-2] == 'i') {
+ if ((l_len == 3) || IS_WHITESPACE_CHAR(pzOut[-3]))
+ goto skip_semi_colon;
+ goto append_statement_end;
+ }
+
+ if ( (l_len < 5)
+ || ( (l_len > 5)
+ && ! IS_WHITESPACE_CHAR(pzOut[-5]) ))
+ goto append_statement_end;
+ if (strncmp(pzOut-4, HANDLE_EOL__THE, HANDLE_EOL__THE_LEN) == 0)
+ goto skip_semi_colon;
+ goto append_statement_end;
+
+ case 'e': // "else"
+ if ( (l_len < 5)
+ || ( (l_len > 5)
+ && ! IS_WHITESPACE_CHAR(pzOut[-5]) ))
+ goto append_statement_end;
+ if (strncmp(pzOut-4, HANDLE_EOL__ELS, HANDLE_EOL__ELS_LEN) == 0)
+ goto skip_semi_colon;
+ goto append_statement_end;
+
+ default:
+ append_statement_end:
+ /*
+ * Terminate the current command and escape the newline.
+ */
+ memcpy(pzOut, MAKE_SCRIPT_NL, MAKE_SCRIPT_NL_LEN);
+ pzOut += MAKE_SCRIPT_NL_LEN;
+ }
+
+ /*
+ * We have now started our next output line and there are still data.
+ * Indent with a tab, if called for. If we do insert a tab, then skip
+ * leading tabs on the line.
+ */
+ if (tabch) {
+ *(pzOut++) = tabch;
+ while (*pzScn == tabch) pzScn++;
+ }
+
+ *ppzi = pzScn;
+ *ppzo = pzOut;
+ return true;
+}
+
+/**
+ * Pass through untreated sedable lines. Sometimes it is just very useful
+ * to post-process Makefile files with sed(1) to clean it up.
+ *
+ * @param txt pointer to text. We skip initial white space.
+ * @param tab pointer to where we stash the tab character to use
+ * @returns true to say this was a sed line and was emitted,
+ * false to say it was not and needs to be copied out.
+ */
+static bool
+handle_sed_expr(char ** src_p, char ** out_p)
+{
+ char * src = *src_p;
+ char * out = *out_p;
+
+ switch (src[1]) {
+ case 'i':
+ if (strncmp(src+2, HANDLE_SED_IFNDEF, HANDLE_SED_IFNDEF_LEN) == 0)
+ break;
+ if (strncmp(src+2, HANDLE_SED_IFDEF, HANDLE_SED_IFDEF_LEN) == 0)
+ break;
+ return false;
+
+ case 'e':
+ if (strncmp(src+2, HANDLE_SED_ELSE, HANDLE_SED_ELSE_LEN) == 0)
+ break;
+ if (strncmp(src+2, HANDLE_SED_ENDIF, HANDLE_SED_ENDIF_LEN) == 0)
+ break;
+ /* FALLTHROUGH */
+ default:
+ return false;
+ }
+
+ {
+ char * p = BRK_NEWLINE_CHARS(src);
+ size_t l;
+ if (*p == NL) /* do not skip NUL */
+ p++;
+ l = p - src;
+ memcpy(out, src, l);
+ *src_p = src + l;
+ *out_p = out + l;
+ }
+
+ return true;
+}
+
+/**
+ * Compute a maximal size for the output script. Leading and trailing white
+ * space are trimmed. Dollar characters will likely be doubled and newlines
+ * may get as many as MAKE_SCRIPT_NL_LEN characters inserted. Make sure
+ * there's space.
+ *
+ * @param txt pointer to text. We skip initial white space.
+ * @param tab pointer to where we stash the tab character to use
+ * @returns the maximum number of bytes required to store result.
+ */
+static size_t
+script_size(char ** txt_p, char * tab)
+{
+ char * txt = *txt_p;
+ char * ptxte;
+ size_t sz = 0;
+
+ /*
+ * skip all blank lines and other initial white space
+ * in the source string.
+ */
+ if (! IS_WHITESPACE_CHAR(*txt))
+ *tab = TAB;
+ else {
+ txt = SPN_WHITESPACE_CHARS(txt + 1);
+ *tab = (txt[-1] == TAB) ? NUL : TAB;
+ }
+
+ /*
+ * Do nothing with empty input.
+ */
+ if (*txt == NUL)
+ return 0;
+
+ /*
+ * "txt" is now our starting point. Do not modify it any more.
+ */
+ *txt_p = txt;
+
+ for (ptxte = txt - 1;;) {
+ ptxte = BRK_MAKE_SCRIPT_CHARS(ptxte+1);
+ if (*ptxte == NUL)
+ break;
+ sz += (*ptxte == '$') ? 1 : MAKE_SCRIPT_NL_LEN;
+ }
+
+ ptxte = SPN_WHITESPACE_BACK(txt, ptxte);
+ *ptxte = NUL;
+ sz += (ptxte - txt);
+ return sz;
+}
+
+/*=gfunc makefile_script
+ *
+ * what: create makefile script
+ * general_use:
+ *
+ * exparg: text, the text of the script
+ *
+ * doc:
+ * This function will take ordinary shell script text and reformat it
+ * so that it will work properly inside of a makefile shell script.
+ * Not every shell construct can be supported; the intent is to have
+ * most ordinary scripts work without much, if any, alteration.
+ *
+ * The following transformations are performed on the source text:
+ *
+ * @enumerate
+ * @item
+ * Trailing whitespace on each line is stripped.
+ *
+ * @item
+ * Except for the last line, the string, " ; \\" is appended to the end of
+ * every line that does not end with certain special characters or keywords.
+ * Note that this will mutilate multi-line quoted strings, but @command{make}
+ * renders it impossible to use multi-line constructs anyway.
+ *
+ * @item
+ * If the line ends with a backslash, it is left alone.
+ *
+ * @item
+ * If the line ends with a semi-colon, conjunction operator, pipe (vertical
+ * bar) or one of the keywords "then", "else" or "in", then a space and a
+ * backslash is added, but no semi-colon.
+ *
+ * @item
+ * The dollar sign character is doubled, unless it immediately precedes an
+ * opening parenthesis or the single character make macros '*', '<', '@@',
+ * '?' or '%'. Other single character make macros that do not have enclosing
+ * parentheses will fail. For shell usage of the "$@@", "$?" and "$*"
+ * macros, you must enclose them with curly braces, e.g., "$@{?@}".
+ * The ksh construct @code{$(<command>)} will not work. Though some
+ * @command{make}s accept @code{$@{var@}} constructs, this function will
+ * assume it is for shell interpretation and double the dollar character.
+ * You must use @code{$(var)} for all @command{make} substitutions.
+ *
+ * @item
+ * Double dollar signs are replaced by four before the next character
+ * is examined.
+ *
+ * @item
+ * Every line is prefixed with a tab, unless the first line
+ * already starts with a tab.
+ *
+ * @item
+ * The newline character on the last line, if present, is suppressed.
+ *
+ * @item
+ * Blank lines are stripped.
+ *
+ * @item
+ * Lines starting with "@@ifdef", "@@ifndef", "@@else" and "@@endif" are
+ * presumed to be autoconf "sed" expression tags. These lines will be
+ * emitted as-is, with no tab prefix and no line splicing backslash.
+ * These lines can then be processed at configure time with
+ * @code{AC_CONFIG_FILES} sed expressions, similar to:
+ *
+ * @example
+ * sed "/^@@ifdef foo/d;/^@@endif foo/d;/^@@ifndef foo/,/^@@endif foo/d"
+ * @end example
+ * @end enumerate
+ *
+ * @noindent
+ * This function is intended to be used approximately as follows:
+ *
+ * @example
+ * $(TARGET) : $(DEPENDENCIES)
+ * <+ (out-push-new) +>
+ * ....mostly arbitrary shell script text....
+ * <+ (makefile-script (out-pop #t)) +>
+ * @end example
+=*/
+SCM
+ag_scm_makefile_script(SCM text_scm)
+{
+ char * res_str; /*@< result string */
+ char * out; /*@< output scanning ptr */
+ char * bol; /*@< start of last output line */
+ char tabch; /*@< char to use for start-of-line tab */
+
+ char * text = ag_scm2zchars(text_scm, "make script");
+ size_t sz = script_size(&text, &tabch);
+
+ if (sz == 0)
+ return AG_SCM_STR02SCM(zNil);
+
+ bol = out = res_str = ag_scribble(sz);
+
+ /*
+ * Force the initial line to start with a real tab.
+ */
+ *(out++) = TAB;
+
+ for (;;) {
+ char * p = BRK_MAKE_SCRIPT_CHARS(text);
+ size_t l = p - text;
+ if (l > 0) {
+ memcpy(out, text, l);
+ text = p;
+ out += l;
+ }
+
+ /*
+ * "text" now points to one of three characters:
+ * a newline, a dollar or a NUL byte.
+ */
+ if (*text == NUL)
+ break;
+
+ if (*text == NL) {
+ if (! handle_eol(&text, &out, tabch, bol))
+ break;
+
+ bol = out;
+
+ /*
+ * As a special "hack", if a line starts with "@ifdef", "@ifndef",
+ * "@else" or "@endif", then we assume post processing sed will
+ * fix it up. Those lines get left alone.
+ */
+ if (*text == '@') {
+ if (handle_sed_expr(&text, &out))
+ bol = out;
+ }
+
+ } else {
+ /*
+ * Quadruple a double dollar, leave alone make-interesting
+ * dollars, and double it otherwise.
+ */
+ switch (text[1]) {
+ case '(': case '*': case '@': case '<': case '%': case '?':
+ /* one only */
+ break;
+
+ case '$':
+ /*
+ * $$ in the shell means process id. Avoid having to do a
+ * backward scan on the second '$' by handling the next '$'
+ * now. We get FOUR '$' chars.
+ */
+ text++;
+ *(out++) = '$';
+ *(out++) = '$';
+ *(out++) = '$';
+ /* quadruple */
+ break;
+
+ default:
+ *(out++) = '$'; /* double */
+ }
+
+ *(out++) = *(text++);
+ }
+ }
+
+ {
+ SCM res = AG_SCM_STR2SCM(res_str, out - res_str);
+ return res;
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/expMake.c */
diff --git a/agen5/expOutput.c b/agen5/expOutput.c
new file mode 100644
index 0000000..8404ce2
--- /dev/null
+++ b/agen5/expOutput.c
@@ -0,0 +1,934 @@
+
+/**
+ * @file expOutput.c
+ *
+ * Time-stamp: "2012-04-07 09:20:37 bkorb"
+ *
+ * This module implements the output file manipulation function
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef S_IAMB
+/*
+ * Access Mask Bits (3 special plus RWX for User Group & Others (9))
+ */
+# define S_IAMB (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)
+#endif
+
+#define NO_WRITE_MASK ((unsigned)(~(S_IWUSR|S_IWGRP|S_IWOTH) & S_IAMB))
+
+typedef struct {
+ char const * pzSuspendName;
+ out_stack_t* pOutDesc;
+} tSuspendName;
+
+static int suspendCt = 0;
+static int suspAllocCt = 0;
+static tSuspendName* pSuspended = NULL;
+static int outputDepth = 1;
+
+/**
+ * return the current line number
+ */
+static int
+current_line(FILE * fp)
+{
+ int lnno = 1;
+
+ while (! feof(fp)) {
+ int ch = getc(fp);
+ if (ch == NL)
+ lnno++;
+ }
+
+ return lnno;
+}
+
+/**
+ * guts of the output file/line function
+ */
+static SCM
+do_output_file_line(int line_delta, char const * fmt)
+{
+ char * buf;
+ char const * fname = cur_fpstack->stk_fname;
+
+ if (cur_fpstack->stk_flags & FPF_TEMPFILE) {
+ fname = OUTPUT_TEMP_FILE;
+ line_delta = 0;
+
+ } else if (fseek(cur_fpstack->stk_fp, 0, SEEK_SET) == 0) {
+ line_delta += current_line(cur_fpstack->stk_fp);
+
+ } else {
+ line_delta = 0;
+ }
+
+ {
+ size_t sz = strlen(fmt) + strlen(fname) + 24;
+ buf = ag_scribble(sz);
+ }
+
+ {
+ void * args[2] = {
+ (void *)fname,
+ (void *)(uintptr_t)line_delta
+ };
+ sprintfv(buf, fmt, (snv_constpointer *)args);
+ }
+
+ return AG_SCM_STR02SCM(buf);
+}
+
+/**
+ * chmod a-w on a file descriptor.
+ */
+LOCAL void
+make_readonly(void)
+{
+#if defined(HAVE_FSTAT) || defined(HAVE_FCHMOD)
+ int fd = fileno(cur_fpstack->stk_fp);
+#endif
+ struct stat sbuf;
+
+ /*
+ * If the output is supposed to be writable, then also see if
+ * it is a temporary condition (set vs. a command line option).
+ */
+ if (ENABLED_OPT(WRITABLE)) {
+ if (! HAVE_OPT(WRITABLE))
+ CLEAR_OPT(WRITABLE);
+ return;
+ }
+
+ /*
+ * Set our usage mask to all all the access
+ * bits that do not provide for write access
+ */
+#ifdef HAVE_FSTAT
+ fstat(fd, &sbuf);
+#else
+ stat(cur_fpstack->stk_fname, &sbuf);
+#endif
+
+ /*
+ * Mask off the write permission bits, but ensure that
+ * the user read bit is set.
+ */
+ {
+ mode_t f_mode = (NO_WRITE_MASK & sbuf.st_mode) | S_IRUSR;
+
+#ifdef HAVE_FCHMOD
+ fchmod(fd, f_mode);
+#else
+ chmod(cur_fpstack->stk_fname, f_mode);
+#endif
+ }
+}
+
+/**
+ * Some common code for creating a new file
+ */
+LOCAL void
+open_output_file(char const * fname, size_t nmsz, char const * mode, int flags)
+{
+ char * pz;
+ out_stack_t* p = AGALOC(sizeof(*p), "out file stack");
+
+ pz = (char*)AGALOC(nmsz + 1, "file name string");
+ memcpy(pz, fname, nmsz);
+ pz[ nmsz ] = NUL;
+ memset(p, NUL, sizeof(*p));
+ p->stk_fname = pz;
+
+ /*
+ * IF we are creating the file and we are allowed to unlink the output,
+ * then start by unlinking the thing.
+ */
+ if ((*mode == 'w') && ((flags & FPF_NOUNLINK) == 0)) {
+ if ((unlink(pz) != 0) && (errno != ENOENT))
+ AG_CANT(OUTPUT_NO_UNLINK, pz);
+ }
+
+ /*
+ * If we cannot write to the file, try to change permissions.
+ */
+ if ( (access(fname, W_OK) != 0)
+ && (errno != ENOENT)) {
+ struct stat sbuf;
+ if (stat(fname, &sbuf) == 0) {
+ mode_t m = (sbuf.st_mode & 07777) | S_IWUSR;
+ chmod(fname, m);
+ }
+ }
+
+ p->stk_fp = fopen(pz, mode);
+ if (p->stk_fp == NULL)
+ AG_CANT(OUTPUT_NO_OPEN, pz);
+
+ p->stk_prev = cur_fpstack;
+ cur_fpstack = p;
+ p->stk_flags = FPF_FREE | flags;
+ outputDepth++;
+
+ if (OPT_VALUE_TRACE > TRACE_DEBUG_MESSAGE)
+ fprintf(trace_fp, TRACE_OPEN_OUT, __func__, fname, mode);
+
+ /*
+ * Avoid printing temporary file names in the dependency file
+ */
+ if ((dep_fp != NULL) && ((flags & FPF_TEMPFILE) == 0))
+ add_target_file(fname);
+}
+
+/*=gfunc out_delete
+ *
+ * what: delete current output file
+ * doc:
+ * Remove the current output file. Cease processing the template for
+ * the current suffix. It is an error if there are @code{push}-ed
+ * output files. Use the @code{(error "0")} scheme function instead.
+ * @xref{output controls}.
+=*/
+SCM
+ag_scm_out_delete(void)
+{
+ /*
+ * Delete the current output file
+ */
+ if (OPT_VALUE_TRACE > TRACE_DEBUG_MESSAGE)
+ fprintf(trace_fp, TRACE_OUT_DELETE, cur_fpstack->stk_fname);
+ rm_target_file(cur_fpstack->stk_fname);
+ outputDepth = 1;
+ longjmp(abort_jmp_buf, PROBLEM);
+ /* NOTREACHED */
+ return SCM_UNDEFINED;
+}
+
+
+/*=gfunc out_move
+ *
+ * what: change name of output file
+ * exparg: new-name, new name for the current output file
+ *
+ * doc:
+ *
+ * Rename current output file. @xref{output controls}.
+ * Please note: changing the name will not save a temporary file from
+ * being deleted. It @i{may}, however, be used on the root output file.
+ *
+ * NOTE: if you are creating a dependency file, @i{both} the original
+ * file name @i{and} the new file name will be listed as derived files.
+=*/
+SCM
+ag_scm_out_move(SCM new_file)
+{
+ size_t sz = AG_SCM_STRLEN(new_file);
+ char* pz = (char*)AGALOC(sz + 1, "new file name string");
+ memcpy(pz, AG_SCM_CHARS(new_file), sz);
+ pz[ sz ] = NUL;
+
+ if (OPT_VALUE_TRACE > TRACE_DEBUG_MESSAGE)
+ fprintf(trace_fp, TRACE_MOVE_FMT, __func__,
+ cur_fpstack->stk_fname, pz);
+ rename(cur_fpstack->stk_fname, pz);
+
+ if (dep_fp != NULL) {
+ rm_target_file(cur_fpstack->stk_fname);
+ add_target_file(pz);
+ }
+
+ if ((cur_fpstack->stk_flags & FPF_STATIC_NM) == 0)
+ AGFREE((void*)cur_fpstack->stk_fname);
+
+ AGDUPSTR(cur_fpstack->stk_fname, pz, "file name");
+ cur_fpstack->stk_flags &= ~FPF_STATIC_NM;
+ return SCM_UNDEFINED;
+}
+
+
+/*=gfunc out_pop
+ *
+ * what: close current output file
+ * exparg: disp, return contents of the file, optional
+ * doc:
+ * If there has been a @code{push} on the output, then close that
+ * file and go back to the previously open file. It is an error
+ * if there has not been a @code{push}. @xref{output controls}.
+ *
+ * If there is no argument, no further action is taken. Otherwise,
+ * the argument should be @code{#t} and the contents of the file
+ * are returned by the function.
+=*/
+SCM
+ag_scm_out_pop(SCM ret_contents)
+{
+ SCM res = SCM_UNDEFINED;
+
+ if (cur_fpstack->stk_prev == NULL)
+ AG_ABEND(SCM_OUT_POP_EMPTY);
+
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ fprintf(trace_fp, TRACE_POP_FMT, __func__, cur_fpstack->stk_fname,
+ (ret_contents == SCM_UNDEFINED) ? "" : " #t");
+
+ if (AG_SCM_BOOL_P(ret_contents) && AG_SCM_NFALSEP(ret_contents)) {
+ long pos = ftell(cur_fpstack->stk_fp);
+ char * pz;
+
+ if (pos <= 0) {
+ pz = (void*)zNil; // const-ness not important
+ pos = 0;
+
+ } else {
+ pz = ag_scribble((size_t)pos + 1);
+ rewind(cur_fpstack->stk_fp);
+ if (fread(pz, (size_t)pos, (size_t)1, cur_fpstack->stk_fp) != 1)
+ AG_CANT(SCM_OUT_POP_NO_REREAD, cur_fpstack->stk_fname);
+ }
+
+ res = AG_SCM_STR2SCM(pz, pos);
+ }
+
+ outputDepth--;
+ out_close(false);
+ return res;
+}
+
+/*=gfunc output_file_next_line
+ *
+ * what: print the file name and next line number
+ *
+ * exparg: line_off, offset to line number, optional
+ * exparg: alt_fmt, alternate format string, optional
+ *
+ * doc:
+ * Returns a string with the current output file name and line number.
+ * The default format is: # <line+1> "<output-file-name>" The argument may be
+ * either a number indicating an offset from the current output line number
+ * or an alternate formatting string. If both are provided, then the first
+ * must be a numeric offset.
+ *
+ * Be careful that you are directing output to the final output file.
+ * Otherwise, you will get the file name and line number of the temporary
+ * file. That won't be what you want.
+=*/
+SCM
+ag_scm_output_file_next_line(SCM num_or_str, SCM str)
+{
+ char const * pzFmt = FILE_LINE_FMT;
+ int line_off = 1;
+
+ if (AG_SCM_NUM_P(num_or_str))
+ line_off = AG_SCM_TO_LONG(num_or_str);
+ else
+ str = num_or_str;
+
+ if (AG_SCM_STRING_P(str))
+ pzFmt = ag_scm2zchars(str, "file/line format");
+
+ return do_output_file_line(line_off, pzFmt);
+}
+
+
+/*=gfunc out_suspend
+ *
+ * what: suspend current output file
+ * exparg: suspName, A name tag for reactivating
+ *
+ * doc:
+ * If there has been a @code{push} on the output, then set aside the output
+ * descriptor for later reactiviation with @code{(out-resume "xxx")}. The
+ * tag name need not reflect the name of the output file. In fact, the
+ * output file may be an anonymous temporary file. You may also change the
+ * tag every time you suspend output to a file, because the tag names are
+ * forgotten as soon as the file has been "resumed".
+=*/
+SCM
+ag_scm_out_suspend(SCM susp_nm)
+{
+ if (cur_fpstack->stk_prev == NULL)
+ AG_ABEND(OUT_SUSPEND_CANNOT);
+
+ if (++suspendCt > suspAllocCt) {
+ suspAllocCt += 8;
+ if (pSuspended == NULL)
+ pSuspended = (tSuspendName*)
+ AGALOC(suspAllocCt * sizeof(tSuspendName), "susp file list");
+ else
+ pSuspended = (tSuspendName*)
+ AGREALOC((void*)pSuspended,
+ suspAllocCt * sizeof(tSuspendName), "add to susp f");
+ }
+
+ pSuspended[ suspendCt-1 ].pzSuspendName = AG_SCM_TO_NEWSTR(susp_nm);
+ pSuspended[ suspendCt-1 ].pOutDesc = cur_fpstack;
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ fprintf(trace_fp, TRACE_SUSPEND, __func__, cur_fpstack->stk_fname,
+ pSuspended[ suspendCt-1 ].pzSuspendName);
+
+ cur_fpstack = cur_fpstack->stk_prev;
+ outputDepth--;
+
+ return SCM_UNDEFINED;
+}
+
+
+/*=gfunc out_resume
+ *
+ * what: resume suspended output file
+ * exparg: susp_nm, A name tag for reactivating
+ * doc:
+ * If there has been a suspended output, then make that output descriptor
+ * current again. That output must have been suspended with the same tag
+ * name given to this routine as its argument.
+=*/
+SCM
+ag_scm_out_resume(SCM susp_nm)
+{
+ int ix = 0;
+ char const * pzName = ag_scm2zchars(susp_nm, "resume name");
+
+ for (; ix < suspendCt; ix++) {
+ if (strcmp(pSuspended[ ix ].pzSuspendName, pzName) == 0) {
+ pSuspended[ ix ].pOutDesc->stk_prev = cur_fpstack;
+ cur_fpstack = pSuspended[ ix ].pOutDesc;
+ free((void*)pSuspended[ ix ].pzSuspendName); /* Guile alloc */
+ if (ix < --suspendCt)
+ pSuspended[ ix ] = pSuspended[ suspendCt ];
+ ++outputDepth;
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ fprintf(trace_fp, TRACE_RESUME, __func__,
+ cur_fpstack->stk_fname, pzName);
+ return SCM_UNDEFINED;
+ }
+ }
+
+ AG_ABEND(aprf(OUT_RESUME_CANNOT, pzName));
+ /* NOTREACHED */
+ return SCM_UNDEFINED;
+}
+
+
+/*=gfunc out_emit_suspended
+ *
+ * what: emit the text of suspended output
+ * exparg: susp_nm, A name tag of suspended output
+ * doc:
+ * This function is equivalent to
+ * @code{(begin (out-resume <name>) (out-pop #t))}
+=*/
+SCM
+ag_scm_out_emit_suspended(SCM susp_nm)
+{
+ (void)ag_scm_out_resume(susp_nm);
+ return ag_scm_out_pop(SCM_BOOL_T);
+}
+
+
+/*=gfunc ag_fprintf
+ *
+ * what: format to autogen stream
+ *
+ * exparg: ag-diversion, AutoGen diversion name or number
+ * exparg: format, formatting string
+ * exparg: format-arg, list of arguments to formatting string, opt, list
+ *
+ * doc: Format a string using arguments from the alist.
+ * Write to a specified AutoGen diversion.
+ * That may be either a specified suspended output stream
+ * (@pxref{SCM out-suspend}) or an index into the output stack
+ * (@pxref{SCM out-push-new}). @code{(ag-fprintf 0 ...)} is
+ * equivalent to @code{(emit (sprintf ...))}, and
+ * @code{(ag-fprintf 1 ...)} sends output to the most recently
+ * suspended output stream.
+=*/
+SCM
+ag_scm_ag_fprintf(SCM port, SCM fmt, SCM alist)
+{
+ int list_len = scm_ilength(alist);
+ char const * pzFmt = ag_scm2zchars(fmt, WORD_FORMAT);
+ SCM res = run_printf(pzFmt, list_len, alist);
+
+ /*
+ * If "port" is a string, it must match one of the suspended outputs.
+ * Otherwise, we'll fall through to the abend.
+ */
+ if (AG_SCM_STRING_P(port)) {
+ int ix = 0;
+ char const * pzName = ag_scm2zchars(port, "resume name");
+
+ for (; ix < suspendCt; ix++) {
+ if (strcmp(pSuspended[ ix ].pzSuspendName, pzName) == 0) {
+ out_stack_t* pSaveFp = cur_fpstack;
+ cur_fpstack = pSuspended[ ix ].pOutDesc;
+ (void) ag_scm_emit(res);
+ cur_fpstack = pSaveFp;
+ return SCM_UNDEFINED;
+ }
+ }
+ }
+
+ /*
+ * If "port" is a number, it is an index into the output stack with "0"
+ * (zero) representing the current output and "1" the last suspended
+ * output. If the number is out of range, we'll fall through to the
+ * abend.
+ */
+ else if (AG_SCM_NUM_P(port)) {
+ out_stack_t* pSaveFp = cur_fpstack;
+ unsigned long val = AG_SCM_TO_ULONG(port);
+
+ for (; val > 0; val--) {
+ cur_fpstack = cur_fpstack->stk_prev;
+ if (cur_fpstack == NULL) {
+ cur_fpstack = pSaveFp;
+ goto fprintf_woops;
+ }
+ }
+
+ (void) ag_scm_emit(res);
+ cur_fpstack = pSaveFp;
+ return SCM_UNDEFINED;
+ }
+
+ /*
+ * Still here? We have a bad "port" specification.
+ */
+ fprintf_woops:
+
+ AG_ABEND(AG_FPRINTF_BAD_PORT);
+ /* NOTREACHED */
+ return SCM_UNDEFINED;
+}
+
+/*=gfunc out_push_add
+ *
+ * what: append output to file
+ * exparg: file-name, name of the file to append text to
+ *
+ * doc:
+ * Identical to @code{push-new}, except the contents are @strong{not}
+ * purged, but appended to. @xref{output controls}.
+=*/
+SCM
+ag_scm_out_push_add(SCM new_file)
+{
+ static char const append_mode[] = "a" FOPEN_BINARY_FLAG "+";
+
+ if (! AG_SCM_STRING_P(new_file))
+ AG_ABEND(OUT_ADD_INVALID);
+
+ open_output_file(AG_SCM_CHARS(new_file), AG_SCM_STRLEN(new_file),
+ append_mode, 0);
+
+ return SCM_UNDEFINED;
+}
+
+
+/*=gfunc make_tmp_dir
+ *
+ * what: create a temporary directory
+ *
+ * doc:
+ * Create a directory that will be cleaned up upon exit.
+=*/
+SCM
+ag_scm_make_tmp_dir(void)
+{
+ if (pz_temp_tpl == NULL) {
+ char * tmpdir = shell_cmd(MK_TMP_DIR_CMD);
+ char * cmdbf =
+ ag_scribble(SET_TMP_DIR_CMD_LEN + 2 * MK_TMP_DIR_CMD_LEN);
+
+ pz_temp_tpl = tmpdir;
+ temp_tpl_dir_len = strlen(tmpdir) - 9; // "ag-XXXXXX"
+
+ tmpdir[temp_tpl_dir_len - 1] = NUL; // trim dir char
+ sprintf(cmdbf, SET_TMP_DIR_CMD, tmpdir);
+ tmpdir[temp_tpl_dir_len - 1] = DIRCH; // restore dir char
+
+ ag_scm_c_eval_string_from_file_line(cmdbf, __FILE__, __LINE__);
+ }
+
+ return SCM_UNDEFINED;
+}
+
+
+/*=gfunc out_push_new
+ *
+ * what: purge and create output file
+ * exparg: file-name, name of the file to create, optional
+ *
+ * doc:
+ * Leave the current output file open, but purge and create
+ * a new file that will remain open until a @code{pop} @code{delete}
+ * or @code{switch} closes it. The file name is optional and, if omitted,
+ * the output will be sent to a temporary file that will be deleted when
+ * it is closed.
+ * @xref{output controls}.
+=*/
+SCM
+ag_scm_out_push_new(SCM new_file)
+{
+ static char const write_mode[] = "w" FOPEN_BINARY_FLAG "+";
+
+ if (AG_SCM_STRING_P(new_file)) {
+ open_output_file(AG_SCM_CHARS(new_file), AG_SCM_STRLEN(new_file),
+ write_mode, 0);
+ return SCM_UNDEFINED;
+ }
+
+ /*
+ * "ENABLE_FMEMOPEN" is defined if we have either fopencookie(3GNU) or
+ * funopen(3BSD) is available and autogen was not configured with fmemopen
+ * disabled. We cannot use the POSIX fmemopen.
+ */
+#if defined(ENABLE_FMEMOPEN)
+ if (! HAVE_OPT(NO_FMEMOPEN)) {
+ char * pzNewFile;
+ out_stack_t * p;
+
+ /*
+ * This block is used IFF ENABLE_FMEMOPEN is defined and if
+ * --no-fmemopen is *not* selected on the command line.
+ */
+ p = (out_stack_t*)AGALOC(sizeof(out_stack_t), "out file stack");
+ p->stk_prev = cur_fpstack;
+ p->stk_flags = FPF_FREE;
+ p->stk_fp = ag_fmemopen(NULL, (ssize_t)0, "w" FOPEN_BINARY_FLAG "+");
+ pzNewFile = (char*)MEM_FILE_STR;
+ p->stk_flags |= FPF_STATIC_NM | FPF_NOUNLINK | FPF_NOCHMOD;
+
+ if (p->stk_fp == NULL)
+ AG_CANT(OUT_PUSH_NEW_FAIL, pzNewFile);
+
+ p->stk_fname = pzNewFile;
+ outputDepth++;
+ cur_fpstack = p;
+
+ if (OPT_VALUE_TRACE > TRACE_DEBUG_MESSAGE)
+ fprintf(trace_fp, TRACE_OUT_PUSH_NEW, __func__, pzNewFile);
+ return SCM_UNDEFINED;
+ }
+#endif
+
+ /*
+ * Either --no-fmemopen was specified or we cannot use ag_fmemopen().
+ */
+ {
+ static size_t tmplen;
+ char * tmp_fnm;
+ int tmpfd;
+
+ if (pz_temp_tpl == NULL)
+ ag_scm_make_tmp_dir();
+
+ tmplen = temp_tpl_dir_len + 10;
+ tmp_fnm = ag_scribble(tmplen + 1);
+ memcpy(tmp_fnm, pz_temp_tpl, tmplen + 1);
+ tmpfd = mkstemp(tmp_fnm);
+
+ if (tmpfd < 0)
+ AG_ABEND(aprf(OUT_PUSH_NEW_FAILED, pz_temp_tpl));
+
+ open_output_file(tmp_fnm, tmplen, write_mode, FPF_TEMPFILE);
+ close(tmpfd);
+ }
+
+ return SCM_UNDEFINED;
+}
+
+/*=gfunc out_switch
+ *
+ * what: close and create new output
+ * exparg: file-name, name of the file to create
+ *
+ * doc:
+ * Switch output files - close current file and make the current
+ * file pointer refer to the new file. This is equivalent to
+ * @code{out-pop} followed by @code{out-push-new}, except that
+ * you may not pop the base level output file, but you may
+ * @code{switch} it. @xref{output controls}.
+=*/
+SCM
+ag_scm_out_switch(SCM new_file)
+{
+ struct utimbuf tbuf;
+ char* pzNewFile;
+
+ if (! AG_SCM_STRING_P(new_file))
+ return SCM_UNDEFINED;
+ {
+ size_t sz = AG_SCM_STRLEN(new_file);
+ pzNewFile = AGALOC(sz + 1, "new file name");
+ memcpy(pzNewFile, AG_SCM_CHARS(new_file), sz);
+ pzNewFile[ sz ] = NUL;
+ }
+
+ /*
+ * IF no change, THEN ignore this
+ */
+ if (strcmp(cur_fpstack->stk_fname, pzNewFile) == 0) {
+ AGFREE((void*)pzNewFile);
+ return SCM_UNDEFINED;
+ }
+
+ make_readonly();
+
+ /*
+ * Make sure we get a new file pointer!!
+ * and try to ensure nothing is in the way.
+ */
+ unlink(pzNewFile);
+ if ( freopen(pzNewFile, "w" FOPEN_BINARY_FLAG "+", cur_fpstack->stk_fp)
+ != cur_fpstack->stk_fp)
+
+ AG_CANT(OUT_SWITCH_FAIL, pzNewFile);
+
+ /*
+ * Set the mod time on the old file.
+ */
+ tbuf.actime = time(NULL);
+ tbuf.modtime = outfile_time;
+ utime(cur_fpstack->stk_fname, &tbuf);
+ if (OPT_VALUE_TRACE > TRACE_DEBUG_MESSAGE)
+ fprintf(trace_fp, TRACE_OUT_SWITCH,
+ __func__, cur_fpstack->stk_fname, pzNewFile);
+ cur_fpstack->stk_fname = pzNewFile; /* memory leak */
+
+ return SCM_UNDEFINED;
+}
+
+
+/*=gfunc out_depth
+ *
+ * what: output file stack depth
+ * doc: Returns the depth of the output file stack.
+ * @xref{output controls}.
+=*/
+SCM
+ag_scm_out_depth(void)
+{
+ return AG_SCM_INT2SCM(outputDepth);
+}
+
+
+/*=gfunc out_name
+ *
+ * what: current output file name
+ * doc: Returns the name of the current output file. If the current file
+ * is a temporary, unnamed file, then it will scan up the chain until
+ * a real output file name is found.
+ * @xref{output controls}.
+=*/
+SCM
+ag_scm_out_name(void)
+{
+ out_stack_t* p = cur_fpstack;
+ while (p->stk_flags & FPF_UNLINK) p = p->stk_prev;
+ return AG_SCM_STR02SCM((void*)p->stk_fname);
+}
+
+
+/*=gfunc out_line
+ *
+ * what: output file line number
+ * doc: Returns the current line number of the output file.
+ * It rewinds and reads the file to count newlines.
+=*/
+SCM
+ag_scm_out_line(void)
+{
+ int lineNum = 1;
+
+ do {
+ long svpos = ftell(cur_fpstack->stk_fp);
+ long pos = svpos;
+
+ if (pos == 0)
+ break;
+
+ rewind(cur_fpstack->stk_fp);
+ do {
+ int ich = fgetc(cur_fpstack->stk_fp);
+ unsigned char ch = ich;
+ if (ich < 0)
+ break;
+ if (ch == (unsigned char)NL)
+ lineNum++;
+ } while (--pos > 0);
+ fseek(cur_fpstack->stk_fp, svpos, SEEK_SET);
+ } while(0);
+
+ return AG_SCM_INT2SCM(lineNum);
+}
+
+#if 0 /* for compilers that do not like C++ comments... */
+// This is done so that comment delimiters can be included in the doc.
+//
+// /*=gfunc make_header_guard
+// *
+// * what: make self-inclusion guard
+// *
+// * exparg: name , header group name
+// *
+// * doc:
+// * This function will create a @code{#ifndef}/@code{#define}
+// * sequence for protecting a header from multiple evaluation.
+// * It will also set the Scheme variable @code{header-file}
+// * to the name of the file being protected and it will set
+// * @code{header-guard} to the name of the @code{#define} being
+// * used to protect it. It is expected that this will be used
+// * as follows:
+// * @example
+// * [+ (make-header-guard "group_name") +]
+// * ...
+// * #endif /* [+ (. header-guard) +] */
+// *
+// * #include "[+ (. header-file) +]"
+// * @end example
+// * @noindent
+// * The @code{#define} name is composed as follows:
+// *
+// * @enumerate
+// * @item
+// * The first element is the string argument and a separating underscore.
+// * @item
+// * That is followed by the name of the header file with illegal
+// * characters mapped to underscores.
+// * @item
+// * The end of the name is always, "@code{_GUARD}".
+// * @item
+// * Finally, the entire string is mapped to upper case.
+// * @end enumerate
+// *
+// * The final @code{#define} name is stored in an SCM symbol named
+// * @code{header-guard}. Consequently, the concluding @code{#endif} for the
+// * file should read something like:
+// *
+// * @example
+// * #endif /* [+ (. header-guard) +] */
+// * @end example
+// *
+// * The name of the header file (the current output file) is also stored
+// * in an SCM symbol, @code{header-file}. Therefore, if you are also
+// * generating a C file that uses the previously generated header file,
+// * you can put this into that generated file:
+// *
+// * @example
+// * #include "[+ (. header-file) +]"
+// * @end example
+// *
+// * Obviously, if you are going to produce more than one header file from
+// * a particular template, you will need to be careful how these SCM symbols
+// * get handled.
+// =*/
+#endif
+SCM
+ag_scm_make_header_guard(SCM name)
+{
+
+ char const * opz; // output file name string
+ size_t osz;
+
+ char const * gpz; // guard name string
+ size_t gsz;
+
+ {
+ out_stack_t* p = cur_fpstack;
+ while (p->stk_flags & FPF_UNLINK) p = p->stk_prev;
+ opz = p->stk_fname;
+ osz = strlen(opz);
+ }
+
+ /*
+ * Construct the gard name using the leader (passed in or "HEADER")
+ * and the trailer (always "_GUARD") and the output file name in between.
+ */
+ {
+ /*
+ * Leader string and its length. Usually passed, but defaults
+ * to "HEADER"
+ */
+ char const * lpz =
+ AG_SCM_STRING_P(name) ? AG_SCM_CHARS(name) : HEADER_STR;
+ size_t lsz = (lpz == HEADER_STR)
+ ? HEADER_STR_LEN : AG_SCM_STRLEN(name);
+
+ /*
+ * Full, maximal length of output
+ */
+ size_t hsz = lsz + osz + GUARD_SFX_LEN + 2;
+ char * scan_p;
+
+ /*
+ * Sanity:
+ */
+ if (*lpz == NUL) {
+ lpz = HEADER_STR;
+ lsz = HEADER_STR_LEN;
+ hsz += lsz;
+ }
+ scan_p = AGALOC(hsz, "header guard string");
+
+ gpz = scan_p; // gpz must be freed
+ do {
+ *(scan_p++) = toupper(*(lpz++));
+ } while (--lsz > 0);
+
+ /*
+ * This copy converts non-alphanumerics to underscores,
+ * but never inserts more than one at a time. Thus, we may
+ * not use all of the space in "gpz".
+ */
+ lpz = opz;
+ do {
+ *(scan_p++) = '_';
+ lpz = BRK_ALPHANUMERIC_CHARS(lpz);
+ while (IS_ALPHANUMERIC_CHAR(*lpz))
+ *(scan_p++) = toupper((unsigned)*(lpz++));
+ } while (*lpz != NUL);
+
+ memcpy(scan_p, GUARD_SFX, GUARD_SFX_LEN + 1);
+ gsz = (scan_p - gpz) + GUARD_SFX_LEN;
+ }
+
+ {
+ size_t sz1 = MK_HEAD_GUARD_SCM_LEN + gsz + osz;
+ size_t sz2 = MK_HEAD_GUARD_GUARD_LEN + 2 * gsz;
+ size_t sz = (sz1 < sz2) ? sz2 : sz1;
+ char * p = ag_scribble(sz);
+ sprintf(p, MK_HEAD_GUARD_SCM, opz, gpz);
+ (void)ag_scm_c_eval_string_from_file_line(p, __FILE__, __LINE__);
+
+ sprintf(p, MK_HEAD_GUARD_GUARD, gpz);
+ name = AG_SCM_STR02SCM(p);
+ }
+
+ AGFREE(gpz);
+ return (name);
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/expOutput.c */
diff --git a/agen5/expPrint.c b/agen5/expPrint.c
new file mode 100644
index 0000000..472a03a
--- /dev/null
+++ b/agen5/expPrint.c
@@ -0,0 +1,344 @@
+
+/**
+ * @file expPrint.c
+ *
+ * Time-stamp: "2012-03-04 19:45:59 bkorb"
+ *
+ * The following code is necessary because the user can give us
+ * a printf format requiring a string pointer yet fail to provide
+ * a valid pointer, thus it will fault. This code protects
+ * against the fault so an error message can be emitted instead of
+ * a core dump :-)
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef DEBUG_ENABLED
+static sigjmp_buf printJumpEnv;
+static int printJumpSignal = 0;
+#endif
+
+/* = = = START-STATIC-FORWARD = = = */
+static ssize_t
+safePrintf(char** ppzBuf, char const * pzFmt, void** argV);
+/* = = = END-STATIC-FORWARD = = = */
+
+#ifndef DEBUG_ENABLED
+ static void printFault(int sig)
+{
+ printJumpSignal = sig;
+ siglongjmp(printJumpEnv, sig);
+}
+#endif
+
+static ssize_t
+safePrintf(char** ppzBuf, char const * pzFmt, void** argV)
+{
+#if ! defined(DEBUG_ENABLED)
+ /*
+ * In normal operation (or during AutoGen testing), seg faults during the
+ * printf operation are caused by bad input data. During AutoGen
+ * development, we do not supply bad printf arguments, so we want to
+ * capture any segfaults when they happen with the correct stack trace.
+ * Therefore, during AutoGen development, we do not protect against seg
+ * faults.
+ */
+ struct sigaction saSave1;
+ struct sigaction saSave2;
+
+ {
+ struct sigaction sa;
+ sa.sa_handler = printFault;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+
+ sigaction(SIGBUS, &sa, &saSave1);
+ sigaction(SIGSEGV, &sa, &saSave2);
+ }
+
+ /*
+ * IF the sprintfv call below is going to address fault,
+ * THEN ...
+ */
+ if (sigsetjmp(printJumpEnv, 0) != 0) {
+#ifndef HAVE_STRSIGNAL
+ extern char* strsignal(int signo);
+#endif
+ /*
+ * IF the fprintf command in the then clause has not failed yet,
+ * THEN perform that fprintf
+ */
+ if (sigsetjmp(printJumpEnv, 0) == 0)
+ fprintf(trace_fp, SAFE_PRINTF_BAD_FMT, ag_pname,
+ strsignal(printJumpSignal), pzFmt);
+
+ /*
+ * The "sprintfv" command below faulted, so we exit
+ */
+ AG_ABEND(SAFE_PRINTF_BAD_ARGS);
+ }
+#endif /* ! defined(DEBUG_ENABLED) */
+
+ {
+ int printSize = asprintfv(ppzBuf, pzFmt, (snv_constpointer*)argV);
+ if ((printSize & ~0xFFFFFU) != 0) /* 1MB max */
+ AG_ABEND(aprf(ASPRINTFV_FAIL_FMT, printSize));
+
+#if ! defined(DEBUG_ENABLED)
+ sigaction(SIGBUS, &saSave1, NULL);
+ sigaction(SIGSEGV, &saSave2, NULL);
+#endif
+ return printSize;
+ }
+}
+
+
+LOCAL SCM
+run_printf(char const * pzFmt, int len, SCM alist)
+{
+ SCM res;
+ void* args[8];
+ void** arglist;
+ void** argp;
+
+ if (len < 8)
+ arglist = argp = args;
+ else
+ arglist =
+ argp = (void**)malloc((len+1) * sizeof(void*));
+
+ while (len-- > 0) {
+ SCM car = SCM_CAR(alist);
+ alist = SCM_CDR(alist);
+ switch (ag_scm_type_e(car)) {
+ default:
+ case GH_TYPE_UNDEFINED:
+ *(argp++) = (char*)RUN_PRINTF_HUH;
+ break;
+
+ case GH_TYPE_BOOLEAN:
+ *(argp++) = (void*)((car == SCM_BOOL_F)
+ ? SCM_FALSE_STR : SCM_TRUE_STR);
+ break;
+
+ case GH_TYPE_CHAR:
+ *(char*)(argp++) = AG_SCM_CHAR(car);
+ break;
+
+ case GH_TYPE_PAIR:
+ *(argp++) = (char*)(SCM_LIST_STR+1);
+ break;
+
+ case GH_TYPE_NUMBER:
+ *(unsigned long*)(argp++) = AG_SCM_TO_ULONG(car);
+ break;
+
+ case GH_TYPE_SYMBOL:
+ case GH_TYPE_STRING:
+ *(argp++) = ag_scm2zchars(car, "printf str");
+ break;
+
+ case GH_TYPE_PROCEDURE:
+ *(argp++) = (char*)SCM_PROC_CAST;
+ break;
+
+ case GH_TYPE_VECTOR:
+ case GH_TYPE_LIST:
+ *(argp++) = (char*)SCM_LIST_STR;
+ break;
+ }
+ }
+
+ /*
+ * Do the formatting and allocate a new SCM to hold the result.
+ * Free up any allocations made by ``gh_scm2newstr''
+ */
+ {
+ char* pzBuf;
+ size_t bfSize = safePrintf(&pzBuf, pzFmt, arglist);
+ res = AG_SCM_STR2SCM(pzBuf, bfSize);
+ free(pzBuf);
+ }
+
+ if (arglist != args)
+ AGFREE((void*)arglist);
+
+ return res;
+}
+
+
+/*=gfunc sprintf
+ *
+ * what: format a string
+ * general_use:
+ *
+ * exparg: format, formatting string
+ * exparg: format-arg, list of arguments to formatting string, opt, list
+ *
+ * doc: Format a string using arguments from the alist.
+=*/
+SCM
+ag_scm_sprintf(SCM fmt, SCM alist)
+{
+ int list_len = scm_ilength(alist);
+ char* pzFmt = ag_scm2zchars(fmt, WORD_FORMAT);
+
+ if (list_len <= 0)
+ return fmt;
+
+ return run_printf(pzFmt, list_len, alist);
+}
+
+
+/*=gfunc printf
+ *
+ * what: format to stdout
+ * general_use:
+ *
+ * exparg: format, formatting string
+ * exparg: format-arg, list of arguments to formatting string, opt, list
+ *
+ * doc: Format a string using arguments from the alist.
+ * Write to the standard out port. The result will NOT appear in your
+ * output. Use this to print information messages to a template user.
+ * Use ``(sprintf ...)'' to add text to your document.
+=*/
+SCM
+ag_scm_printf(SCM fmt, SCM alist)
+{
+ int list_len = scm_ilength(alist);
+ char* pzFmt = ag_scm2zchars(fmt, WORD_FORMAT);
+
+ AG_SCM_DISPLAY(run_printf(pzFmt, list_len, alist));
+ return SCM_UNDEFINED;
+}
+
+
+/*=gfunc fprintf
+ *
+ * what: format to a file
+ * general_use:
+ *
+ * exparg: port, Guile-scheme output port
+ * exparg: format, formatting string
+ * exparg: format-arg, list of arguments to formatting string, opt, list
+ *
+ * doc: Format a string using arguments from the alist.
+ * Write to a specified port. The result will NOT appear in your
+ * output. Use this to print information messages to a template user.
+=*/
+SCM
+ag_scm_fprintf(SCM port, SCM fmt, SCM alist)
+{
+ int list_len = scm_ilength(alist);
+ char* pzFmt = ag_scm2zchars(fmt, WORD_FORMAT);
+ SCM res = run_printf(pzFmt, list_len, alist);
+
+ return scm_display(res, port);
+}
+
+
+/*=gfunc hide_email
+ *
+ * what: convert eaddr to javascript
+ * general_use:
+ *
+ * exparg: display, display text
+ * exparg: eaddr, email address
+ *
+ * doc: Hides an email address as a java scriptlett.
+ * The 'mailto:' tag and the email address are coded bytes
+ * rather than plain text. They are also broken up.
+=*/
+SCM
+ag_scm_hide_email(SCM display, SCM eaddr)
+{
+ char* pzDisp = ag_scm2zchars(display, "fmt");
+ char* pzEadr = ag_scm2zchars(eaddr, "fmt");
+ size_t st_len = HIDE_EMAIL_START_STR_LEN;
+ size_t end_len = HIDE_EMAIL_END_FMT_LEN;
+
+ size_t str_size = (strlen(pzEadr) * HTML_DEC_DIGIT_LEN)
+ + st_len + end_len + strlen(pzDisp);
+
+ char* pzRes = ag_scribble(str_size);
+ char* pzScan = pzRes;
+
+ memcpy(pzScan, HIDE_EMAIL_START_STR, st_len);
+ pzScan += st_len;
+
+ for (;;) {
+ if (*pzEadr == NUL)
+ break;
+ pzScan += sprintf(pzScan, HTML_DEC_DIGIT, *(pzEadr++));
+ }
+
+ pzScan += sprintf(pzScan, HIDE_EMAIL_END_FMT, pzDisp);
+
+ return AG_SCM_STR2SCM(pzRes, (size_t)(pzScan - pzRes));
+}
+
+/*=gfunc format_arg_count
+ *
+ * what: count the args to a format
+ * general_use:
+ *
+ * exparg: format, formatting string
+ *
+ * doc: "Sometimes, it is useful to simply be able to figure out how many\n"
+ * "arguments are required by a format string. For example, if you\n"
+ * "are extracting a format string for the purpose of generating a\n"
+ * "macro to invoke a printf-like function, you can run the\n"
+ * "formatting string through this function to determine how many\n"
+ * "arguments to provide for in the macro. e.g. for this extraction\n"
+ * "text:\n"
+ * "@example\n\n"
+ * " /" "*=fumble bumble\n"
+ * " * fmt: 'stumble %s: %d\\n'\n"
+ * " =*" "/\n"
+ * "@end example\n\n"
+ * "@noindent\n"
+ * "You may wish to generate a macro:\n"
+ * "@example\n\n"
+ * " #define BUMBLE(a1,a2) printf_like(something,(a1),(a2))\n"
+ * "@end example\n\n"
+ * "@noindent\n"
+ * "You can do this by knowing that the format needs two arguments.\n"
+=*/
+SCM
+ag_scm_format_arg_count(SCM fmt)
+{
+ char* pzFmt = ag_scm2zchars(fmt, WORD_FORMAT);
+ int ct = 0;
+ for (;;) {
+ switch (*(pzFmt++)) {
+ case NUL: goto scanDone;
+ case '%':
+ if (*pzFmt == '%')
+ pzFmt++;
+ else ct++;
+ }
+ } scanDone:;
+
+ return AG_SCM_INT2SCM(ct);
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/expPrint.c */
diff --git a/agen5/expState.c b/agen5/expState.c
new file mode 100644
index 0000000..871fbbe
--- /dev/null
+++ b/agen5/expState.c
@@ -0,0 +1,819 @@
+
+/**
+ * @file expState.c
+ *
+ * This module implements expression functions that
+ * query and get state information from AutoGen data.
+ *
+ * Time-stamp: "2012-04-07 09:50:32 bkorb"
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef SCM_HAVE_T_UINT64
+ typedef uint64_t ver_type_t;
+# define VER_UNIT_SHIFT 16ULL
+# if ((SCM_MAJOR_VERSION * 100) + SCM_MINOR_VERSION) >= 108
+# define SCM_FROM(v) scm_from_uint64(v)
+# else
+# define SCM_FROM(v) gh_ulong2scm((unsigned long)v)
+# endif
+
+#else
+ typedef uint32_t ver_type_t;
+# define VER_UNIT_SHIFT 8
+# ifdef HAVE_SCM_FROM_UINT32
+# define SCM_FROM(v) scm_from_uint32(v)
+# else
+# define SCM_FROM(v) gh_ulong2scm((unsigned long)v)
+# endif
+#endif
+
+/* = = = START-STATIC-FORWARD = = = */
+static int
+entry_length(char* name);
+
+static int
+count_entries(char* name);
+
+static SCM
+find_entry_value(SCM op, SCM obj, SCM test);
+
+static ver_type_t
+str2int_ver(char* pz);
+
+static SCM
+do_tpl_file_line(int line_delta, char const * fmt);
+/* = = = END-STATIC-FORWARD = = = */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * EXPRESSION EVALUATION SUPPORT ROUTINES
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+static int
+entry_length(char* name)
+{
+ def_ent_t** papDefs = find_def_ent_list(name);
+ int res = 0;
+
+ if (papDefs == NULL)
+ return 0;
+
+ for (;;) {
+ def_ent_t* pDE = *(papDefs++);
+ if (pDE == NULL)
+ break;
+ if (pDE->de_type == VALTYP_TEXT)
+ res += strlen(pDE->de_val.dvu_text);
+ else
+ res++;
+ }
+ return res;
+}
+
+
+static int
+count_entries(char* name)
+{
+ def_ent_t** papDefs = find_def_ent_list(name);
+ int res = 0;
+
+ if (papDefs == NULL)
+ return 0;
+
+ for (;;) {
+ def_ent_t* pDE = *(papDefs++);
+ if (pDE == NULL)
+ break;
+ res++;
+ }
+ return res;
+}
+
+/**
+ * Find a definition with a specific value
+ */
+static SCM
+find_entry_value(SCM op, SCM obj, SCM test)
+{
+ bool isIndexed;
+ def_ent_t* pE;
+ char* pzField;
+
+ {
+ char * name = ag_scm2zchars(obj, "find name");
+
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ fprintf(trace_fp, TRACE_FIND_ENT, name);
+
+ pzField = strchr(name, name_sep_ch);
+ if (pzField != NULL)
+ *(pzField++) = NUL;
+
+ pE = find_def_ent(name, &isIndexed);
+ }
+
+ /*
+ * No such entry? return FALSE
+ */
+ if (pE == NULL) {
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ fputs(FIND_ENT_FAIL, trace_fp);
+ return SCM_BOOL_F;
+ }
+
+ /*
+ * No subfield? Check the values
+ */
+ if (pzField == NULL) {
+ SCM result;
+ SCM field;
+ if (pE->de_type != VALTYP_TEXT) {
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ fputs(FIND_ENT_FAIL, trace_fp);
+ return SCM_BOOL_F; /* Cannot match string -- not a text value */
+ }
+
+ field = AG_SCM_STR02SCM(pE->de_val.dvu_text);
+ result = AG_SCM_APPLY2(op, field, test);
+ if (! isIndexed)
+ while (result == SCM_BOOL_F) {
+
+ pE = pE->de_twin;
+ if (pE == NULL)
+ break;
+
+ field = AG_SCM_STR02SCM(pE->de_val.dvu_text);
+ result = AG_SCM_APPLY2(op, field, test);
+ }
+
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ fputs((result == SCM_BOOL_T) ? FIND_ENT_SUCC : FIND_ENT_FAIL,
+ trace_fp);
+ return result;
+ }
+
+ /*
+ * a subfield for a text macro? return FALSE
+ */
+ if (pE->de_type == VALTYP_TEXT) {
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ fputs(FIND_ENT_FAIL, trace_fp);
+ return SCM_BOOL_F;
+ }
+
+ /*
+ * Search the members for what we want.
+ */
+ pzField[-1] = name_sep_ch;
+ {
+ SCM field = AG_SCM_STR02SCM(pzField);
+ SCM result;
+ def_ctx_t ctx = curr_def_ctx;
+
+ curr_def_ctx.dcx_prev = &ctx;
+ curr_def_ctx.dcx_defent = pE->de_val.dvu_entry;
+
+ result = find_entry_value(op, field, test);
+
+ if (! isIndexed)
+ while (result == SCM_BOOL_F) {
+
+ pE = pE->de_twin;
+ if (pE == NULL)
+ break;
+
+ curr_def_ctx.dcx_defent = pE->de_val.dvu_entry;
+ result = find_entry_value(op, field, test);
+ }
+
+ curr_def_ctx = ctx;
+ return result;
+ }
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * EXPRESSION ROUTINES
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc base_name
+ *
+ * what: base output name
+ *
+ * doc: Returns a string containing the base name of the output file(s).
+ * Generally, this is also the base name of the definitions file.
+=*/
+SCM
+ag_scm_base_name(void)
+{
+ return AG_SCM_STR02SCM((char*)(void*)OPT_ARG(BASE_NAME));
+}
+
+/*=gfunc version_compare
+ *
+ * what: compare two version numbers
+ * general_use:
+ *
+ * exparg: op, comparison operator
+ * exparg: v1, first version
+ * exparg: v2, compared-to version
+ *
+ * doc: Converts v1 and v2 strings into 64 bit values and returns the
+ * result of running 'op' on those values. It assumes that the version
+ * is a 1 to 4 part dot-separated series of numbers. Suffixes like,
+ * "5pre4" or "5-pre4" will be interpreted as two numbers. The first
+ * number ("5" in this case) will be decremented and the number after
+ * the "pre" will be added to 0xC000. (Unless your platform is unable
+ * to support 64 bit integer arithmetic. Then it will be added to 0xC0.)
+ * Consequently, these yield true:
+ * @example
+ * (version-compare > "5.8.5" "5.8.5-pre4")
+ * (version-compare > "5.8.5-pre10" "5.8.5-pre4")
+ * @end example
+=*/
+static ver_type_t
+str2int_ver(char* pz)
+{
+ char* pzStr = pz;
+ ver_type_t val = 0;
+ int ix = 4;
+
+ while (--ix >= 0) {
+ unsigned int v;
+ val <<= VER_UNIT_SHIFT;
+ pz = SPN_WHITESPACE_CHARS(pz);
+
+ next_number:
+ if (! IS_DEC_DIGIT_CHAR(*pz)) break;
+ v = (unsigned int)strtoul(pz, &pz, 0) & ((1 << VER_UNIT_SHIFT) - 1);
+ if (pz == NULL)
+ break;
+ val += v;
+ if (*pz == '-') pz++;
+
+ switch (*pz) {
+ case 'p':
+ if ((pz[1] == 'r') && (pz[2] == 'e')) {
+ pz += 3;
+ val = (val << 2) - 1;
+ val <<= (VER_UNIT_SHIFT - 2);
+ if (--ix < 0) goto leave_str2int_ver;
+ goto next_number;
+ }
+ /* FALLTHROUGH */
+
+ default:
+ goto leave_str2int_ver;
+
+ case '.':
+ if (! IS_DEC_DIGIT_CHAR(*(++pz)))
+ goto leave_str2int_ver;
+ break;
+ }
+ } leave_str2int_ver: ;
+
+ while (--ix >= 0) val <<= VER_UNIT_SHIFT;
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ fprintf(trace_fp, TRACE_VER_CONVERT, (long long)val, pzStr);
+ return val;
+}
+
+/**
+ * Convert version number strings into a binary representation and compare.
+ */
+SCM
+ag_scm_version_compare(SCM op, SCM v1, SCM v2)
+{
+ ver_type_t val1 = str2int_ver(ag_scm2zchars(v1, "ver"));
+ ver_type_t val2 = str2int_ver(ag_scm2zchars(v2, "ver"));
+ v1 = SCM_FROM(val1);
+ v2 = SCM_FROM(val2);
+ return scm_apply(op, v1, scm_cons(v2, AG_SCM_LISTOFNULL()));
+}
+
+/*=gfunc count
+ *
+ * what: definition count
+ *
+ * exparg: ag-name, name of AutoGen value
+ *
+ * doc: Count the number of entries for a definition.
+ * The input argument must be a string containing the name
+ * of the AutoGen values to be counted. If there is no
+ * value associated with the name, the result is an SCM
+ * immediate integer value of zero.
+=*/
+SCM
+ag_scm_count(SCM obj)
+{
+ int ent_len = count_entries(ag_scm2zchars(obj, "ag object"));
+
+ return AG_SCM_INT2SCM(ent_len);
+}
+
+
+/*=gfunc def_file
+ *
+ * what: definitions file name
+ *
+ * doc: Get the name of the definitions file.
+ * Returns the name of the source file containing the AutoGen
+ * definitions.
+=*/
+SCM
+ag_scm_def_file(void)
+{
+ return AG_SCM_STR02SCM((char*)(void*)base_ctx->scx_fname);
+}
+
+
+/*=gfunc exist_p
+ *
+ * what: test for value name
+ *
+ * exparg: ag-name, name of AutoGen value
+ *
+ * doc: return SCM_BOOL_T iff a specified name has an AutoGen value.
+ * The name may include indexes and/or member names.
+ * All but the last member name must be an aggregate definition.
+ * For example:
+ * @example
+ * (exist? "foo[3].bar.baz")
+ * @end example
+ * will yield true if all of the following is true:
+ * @*
+ * There is a member value of either group or string type
+ * named @code{baz} for some group value @code{bar} that
+ * is a member of the @code{foo} group with index @code{3}.
+ * There may be multiple entries of @code{bar} within
+ * @code{foo}, only one needs to contain a value for @code{baz}.
+=*/
+SCM
+ag_scm_exist_p(SCM obj)
+{
+ bool x;
+ SCM res;
+
+ if (find_def_ent(ag_scm2zchars(obj, "ag object"), &x) == NULL)
+ res = SCM_BOOL_F;
+ else res = SCM_BOOL_T;
+
+ return res;
+}
+
+
+/*=gfunc ag_function_p
+ *
+ * what: test for function
+ *
+ * exparg: ag-name, name of AutoGen macro
+ *
+ * doc: return SCM_BOOL_T if a specified name is a user-defined AutoGen
+ * macro, otherwise return SCM_BOOL_F.
+=*/
+SCM
+ag_scm_ag_function_p(SCM obj)
+{
+ SCM res;
+
+ if (find_tpl(ag_scm2zchars(obj, "ag user macro")) == NULL)
+ res = SCM_BOOL_F;
+ else res = SCM_BOOL_T;
+
+ return res;
+}
+
+
+/*=gfunc match_value_p
+ *
+ * what: test for matching value
+ *
+ * exparg: op, boolean result operator
+ * exparg: ag-name, name of AutoGen value
+ * exparg: test-str, string to test against
+ *
+ * doc: This function answers the question, "Is there an AutoGen value named
+ * @code{ag-name} with a value that matches the pattern @code{test-str}
+ * using the match function @code{op}?" Return SCM_BOOL_T iff at least
+ * one occurrence of the specified name has such a value. The operator
+ * can be any function that takes two string arguments and yields a
+ * boolean. It is expected that you will use one of the string matching
+ * functions provided by AutoGen.
+ * @*
+ * The value name must follow the same rules as the
+ * @code{ag-name} argument for @code{exist?} (@pxref{SCM exist?}).
+=*/
+SCM
+ag_scm_match_value_p(SCM op, SCM obj, SCM test)
+{
+ if ( (! AG_SCM_IS_PROC(op))
+ || (! AG_SCM_STRING_P(obj)) )
+ return SCM_UNDEFINED;
+
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ fprintf(trace_fp, TRACE_MATCH_VAL, ag_scm2zchars(test, "test val"));
+
+ return find_entry_value(op, obj, test);
+}
+
+
+/*=gfunc get
+ *
+ * what: get named value
+ *
+ * exparg: ag-name, name of AutoGen value
+ * exparg: alt-val, value if not present, optional
+ *
+ * doc:
+ * Get the first string value associated with the name.
+ * It will either return the associated string value (if
+ * the name resolves), the alternate value (if one is provided),
+ * or else the empty string.
+=*/
+SCM
+ag_scm_get(SCM agName, SCM altVal)
+{
+ def_ent_t* pE;
+ bool x;
+
+ pE = (! AG_SCM_STRING_P(agName)) ? NULL :
+ find_def_ent(ag_scm2zchars(agName, "ag value"), &x);
+
+ if ((pE == NULL) || (pE->de_type != VALTYP_TEXT)) {
+ if (AG_SCM_STRING_P(altVal))
+ return altVal;
+ return AG_SCM_STR02SCM(zNil);
+ }
+
+ return AG_SCM_STR02SCM(pE->de_val.dvu_text);
+}
+
+
+/*=gfunc get_c_name
+ *
+ * what: get named value, mapped to C name syntax
+ *
+ * exparg: ag-name, name of AutoGen value
+ *
+ * doc:
+ *
+ * Get the first string value associated with the name. It will either
+ * return the associated string value (if the name resolves), the alternate
+ * value (if one is provided), or else the empty string. The result is
+ * passed through "string->c-name!".
+=*/
+SCM
+ag_scm_get_c_name(SCM agName)
+{
+ return ag_scm_string_to_c_name_x(
+ ag_scm_get(agName, SCM_UNDEFINED));
+}
+
+
+/*=gfunc get_up_name
+ *
+ * what: get upper cased named value, mapped to C name syntax
+ *
+ * exparg: ag-name, name of AutoGen value
+ *
+ * doc:
+ *
+ * Get the first string value associated with the name. It will either
+ * return the associated string value (if the name resolves), the alternate
+ * value (if one is provided), or else the empty string. The result is
+ * passed through "string->c-name!" and "string->up-case!".
+=*/
+SCM
+ag_scm_get_up_name(SCM agName)
+{
+ return ag_scm_string_upcase_x(ag_scm_get_c_name(agName));
+}
+
+
+/*=gfunc get_down_name
+ *
+ * what: get lower cased named value, mapped to C name syntax
+ *
+ * exparg: ag-name, name of AutoGen value
+ *
+ * doc:
+ *
+ * Get the first string value associated with the name. It will either
+ * return the associated string value (if the name resolves), the alternate
+ * value (if one is provided), or else the empty string. The result is
+ * passed through "string->c-name!" and "string->down-case!".
+=*/
+SCM
+ag_scm_get_down_name(SCM agName)
+{
+ return ag_scm_string_downcase_x(ag_scm_get_c_name(agName));
+}
+
+
+/*=gfunc high_lim
+ *
+ * what: get highest value index
+ *
+ * exparg: ag-name, name of AutoGen value
+ *
+ * doc:
+ *
+ * Returns the highest index associated with an array of definitions.
+ * This is generally, but not necessarily, one less than the
+ * @code{count} value. (The indexes may be specified, rendering a
+ * non-zero based or sparse array of values.)
+ *
+ * This is very useful for specifying the size of a zero-based array
+ * of values where not all values are present. For example:
+ *
+ * @example
+ * tMyStruct myVals[ [+ (+ 1 (high-lim "my-val-list")) +] ];
+ * @end example
+=*/
+SCM
+ag_scm_high_lim(SCM obj)
+{
+ def_ent_t* pE;
+ bool isIndexed;
+
+ pE = find_def_ent(ag_scm2zchars(obj, "ag value"), &isIndexed);
+
+ /*
+ * IF we did not find the entry we are looking for
+ * THEN return zero
+ * ELSE search the twin list for the high entry
+ */
+ if (pE == NULL)
+ return AG_SCM_INT2SCM(0);
+
+ if (isIndexed)
+ return AG_SCM_INT2SCM((int)pE->de_index);
+
+ if (pE->de_etwin != NULL)
+ pE = pE->de_etwin;
+
+ return AG_SCM_INT2SCM((int)pE->de_index);
+}
+
+
+/*=gfunc len
+ *
+ * what: get count of values
+ *
+ * exparg: ag-name, name of AutoGen value
+ *
+ * doc: If the named object is a group definition, then "len" is
+ * the same as "count". Otherwise, if it is one or more text
+ * definitions, then it is the sum of their string lengths.
+ * If it is a single text definition, then it is equivalent to
+ * @code{(string-length (get "ag-name"))}.
+=*/
+SCM
+ag_scm_len(SCM obj)
+{
+ int len = entry_length(ag_scm2zchars(obj, "ag value"));
+
+ return AG_SCM_INT2SCM(len);
+}
+
+
+/*=gfunc low_lim
+ *
+ * what: get lowest value index
+ *
+ * exparg: ag-name, name of AutoGen value
+ *
+ * doc: Returns the lowest index associated with an array of definitions.
+=*/
+SCM
+ag_scm_low_lim(SCM obj)
+{
+ def_ent_t* pE;
+ bool x;
+
+ pE = find_def_ent(ag_scm2zchars(obj, "ag value"), &x);
+
+ /*
+ * IF we did not find the entry we are looking for
+ * THEN return zero
+ * ELSE we have the low index.
+ */
+ if (pE == NULL)
+ return AG_SCM_INT2SCM(0);
+
+ return AG_SCM_INT2SCM((int)pE->de_index);
+}
+
+
+/*=gfunc set_option
+ *
+ * what: Set a command line option
+ *
+ * exparg: opt, AutoGen option name + its argument
+ *
+ * doc: The text argument must be an option name followed by any needed
+ * option argument. Returns SCM_UNDEFINED.
+=*/
+SCM
+ag_scm_set_option(SCM opt)
+{
+ optionLoadLine(&autogenOptions, ag_scm2zchars(opt, "opt + arg"));
+ return SCM_UNDEFINED;
+}
+
+
+/*=gfunc suffix
+ *
+ * what: get the current suffix
+ *
+ * doc:
+ * Returns the current active suffix (@pxref{pseudo macro}).
+=*/
+SCM
+ag_scm_suffix(void)
+{
+ return AG_SCM_STR02SCM((char*)curr_sfx);
+}
+
+
+/*=gfunc tpl_file
+ *
+ * what: get the template file name
+ *
+ * exparg: full_path, include full path to file, optonal
+ *
+ * doc: Returns the name of the current template file.
+ * If @code{#t} is passed in as an argument, then the template
+ * file is hunted for in the template search path. Otherwise,
+ * just the unadorned name.
+=*/
+SCM
+ag_scm_tpl_file(SCM full)
+{
+ if (AG_SCM_BOOL_P(full) && AG_SCM_NFALSEP(full)) {
+ static char const * const sfx[] = { TPL_FILE_TPL, NULL };
+
+ char z[AG_PATH_MAX];
+ if (SUCCESSFUL(find_file(tpl_fname, z, sfx, NULL)))
+ return AG_SCM_STR02SCM(z);
+ }
+
+ return AG_SCM_STR02SCM((char*)(void*)tpl_fname);
+}
+
+/**
+ * guts of the template file/line functions
+ */
+static SCM
+do_tpl_file_line(int line_delta, char const * fmt)
+{
+ void * args[2] = {
+ [0] = (void*)current_tpl->td_file,
+ [1] = (void*)((long)cur_macro->md_line + line_delta)
+ };
+ char * buf = strrchr(args[0], DIRCH);
+ if (buf != NULL)
+ args[0] = buf + 1;
+
+ {
+ size_t sz = strlen(fmt) + strlen(args[0]) + 24;
+ buf = ag_scribble(sz);
+ }
+
+ sprintfv(buf, fmt, (snv_constpointer*)args);
+ return AG_SCM_STR02SCM(buf);
+}
+
+/*=gfunc tpl_file_line
+ *
+ * what: get the template file+line number
+ *
+ * exparg: msg-fmt, formatting for line message, optional
+ *
+ * doc:
+ * Returns the file and line number of the current template macro using
+ * either the default format, "from %s line %d", or else the format you
+ * supply. For example, if you want to insert a "C" language file-line
+ * directive, you would supply the format "# %2$d \"%1$s\"", but that
+ * is also already supplied with the scheme variable
+ * @xref{SCM c-file-line-fmt}. You may use it thus:
+ * @example
+ * (tpl-file-line c-file-line-fmt)
+ * @end example
+ *
+ * It is also safe to use the formatting string, "%2$d". AutoGen uses
+ * an argument vector version of printf: @xref{snprintfv},
+ * and it does not need to know the types of each argument in order to
+ * skip forward to the second argument.
+=*/
+SCM
+ag_scm_tpl_file_line(SCM fmt)
+{
+ char const * pzFmt = TPL_FILE_LINE_FMT;
+ if (AG_SCM_STRING_P(fmt))
+ pzFmt = ag_scm2zchars(fmt, "f/l fmt");
+
+ return do_tpl_file_line(0, pzFmt);
+}
+
+/*=gfunc tpl_file_next_line
+ *
+ * what: get the template file plus next line number
+ *
+ * exparg: msg-fmt, formatting for line message, optional
+ *
+ * doc:
+ * This is almost the same as @xref{SCM tpl-file-line}, except that
+ * the line referenced is the next line, per C compiler conventions, and
+ * consequently defaults to the format: # <line-no+1> "<file-name>"
+=*/
+SCM
+ag_scm_tpl_file_next_line(SCM fmt)
+{
+ char const * pzFmt = TPL_FILE_NEXT_LINE_FMT;
+ if (AG_SCM_STRING_P(fmt))
+ pzFmt = ag_scm2zchars(fmt, "f/l fmt");
+
+ return do_tpl_file_line(1, pzFmt);
+}
+
+/*=gfunc def_file_line
+ *
+ * what: get a definition file+line number
+ *
+ * exparg: ag-name, name of AutoGen value
+ * exparg: msg-fmt, formatting for line message, optional
+ *
+ * doc:
+ * Returns the file and line number of a AutoGen defined value, using
+ * either the default format, "from %s line %d", or else the format you
+ * supply. For example, if you want to insert a "C" language file-line
+ * directive, you would supply the format "# %2$d \"%1$s\"", but that
+ * is also already supplied with the scheme variable
+ * @xref{SCM c-file-line-fmt}. You may use it thus:
+ *
+ * @example
+ * (def-file-line "ag-def-name" c-file-line-fmt)
+ * @end example
+ *
+ * It is also safe to use the formatting string, "%2$d". AutoGen uses
+ * an argument vector version of printf: @xref{snprintfv}.
+=*/
+SCM
+ag_scm_def_file_line(SCM obj, SCM fmt)
+{
+ char const * pzFmt = DEF_FILE_LINE_FMT;
+ char * buf;
+ bool x;
+
+ def_ent_t * pE = find_def_ent(ag_scm2zchars(obj, "ag value"), &x);
+
+ /*
+ * IF we did not find the entry we are looking for
+ * THEN return UNDEFINED
+ */
+ if (pE == NULL)
+ return SCM_UNDEFINED;
+
+ if (AG_SCM_STRING_P(fmt))
+ pzFmt = ag_scm2zchars(fmt, "f/l fmt");
+
+ {
+ void * args[2] = {
+ (void*)pE->de_file,
+ (void*)(long)pE->de_line
+ };
+ size_t maxlen;
+
+ buf = strrchr(args[0], DIRCH);
+ if (buf != NULL)
+ args[0] = buf + 1;
+
+ maxlen = strlen(args[0]) + strlen(pzFmt) + LOG10_2to32 + 1;
+ buf = ag_scribble(maxlen);
+ sprintfv(buf, pzFmt, (snv_constpointer*)args);
+ }
+
+ return AG_SCM_STR02SCM(buf);
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/expState.c */
diff --git a/agen5/expString.c b/agen5/expString.c
new file mode 100644
index 0000000..f44ffe7
--- /dev/null
+++ b/agen5/expString.c
@@ -0,0 +1,1132 @@
+
+/**
+ * @file expString.c
+ *
+ * Time-stamp: "2012-03-31 13:33:55 bkorb"
+ *
+ * This module implements expression functions that
+ * manipulate string values.
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static size_t
+string_size(char const * pzScn, size_t newLineSize);
+
+static SCM
+makeString(char const * pzText, char const * pzNewLine, size_t newLineSize);
+
+static size_t
+stringify_for_sh(char * pzNew, uint_t qt, char const * pzDta);
+
+static SCM
+shell_stringify(SCM obj, uint_t qt);
+
+static int
+sub_count(char const * haystack, char const * needle);
+
+static void
+do_substitution(
+ char const * src_str,
+ ssize_t str_len,
+ SCM match,
+ SCM repl,
+ char ** ppz_res,
+ ssize_t * res_len);
+/* = = = END-STATIC-FORWARD = = = */
+
+static size_t
+string_size(char const * pzScn, size_t newLineSize)
+{
+ /*
+ * Start by counting the start and end quotes, plus the NUL.
+ */
+ size_t dtaSize = 3;
+
+ for (;;) {
+ char ch = *(pzScn++);
+ if ((ch >= ' ') && (ch <= '~')) {
+
+ /*
+ * One for each character, plus a backquote when needed
+ */
+ dtaSize++;
+ if ((ch == '"') || (ch == '\\'))
+ dtaSize++;
+ }
+
+ /*
+ * When not a normal character, then count the characters
+ * required to represent whatever it is.
+ */
+ else switch (ch) {
+ case NUL:
+ return dtaSize;
+
+ case NL:
+ dtaSize += newLineSize;
+ break;
+
+ case TAB:
+ case '\a':
+ case '\b':
+ case '\f':
+ case '\r':
+ case '\v':
+ dtaSize += 2;
+ break;
+
+ default:
+ dtaSize += 4;
+ }
+ }
+}
+
+static SCM
+makeString(char const * pzText, char const * pzNewLine, size_t newLineSize)
+{
+ char z[SCRIBBLE_SIZE];
+ char* pzDta;
+ char* pzFre;
+ char const * pzScn = pzText;
+ size_t dtaSize = string_size(pzText, newLineSize);
+
+ /*
+ * We now know how big the string is going to be.
+ * Allocate what we need.
+ */
+ if (dtaSize >= sizeof(z))
+ pzFre = pzDta = AGALOC(dtaSize, "quoting string");
+ else pzFre = pzDta = z;
+
+ *(pzDta++) = '"';
+
+ for (;;) {
+ unsigned char ch = (unsigned char)*pzScn;
+ if ((ch >= ' ') && (ch <= '~')) {
+ if ((ch == '"') || (ch == '\\'))
+ /*
+ * We must escape these characters in the output string
+ */
+ *(pzDta++) = '\\';
+ *(pzDta++) = ch;
+
+ } else switch (ch) {
+ case NUL:
+ goto copyDone;
+
+ case NL:
+ /*
+ * place contiguous new-lines on a single line
+ */
+ while (pzScn[1] == NL) {
+ *(pzDta++) = '\\';
+ *(pzDta++) = 'n';
+ pzScn++;
+ }
+
+ /*
+ * Replace the new-line with its escaped representation.
+ * Also, break and restart the output string, indented
+ * 7 spaces (so that after the '"' char is printed,
+ * any contained tabbing will look correct).
+ * Do *not* start a new line if there are no more data.
+ */
+ if (pzScn[1] == NUL) {
+ *(pzDta++) = '\\';
+ *(pzDta++) = 'n';
+ goto copyDone;
+ }
+
+ strcpy(pzDta, pzNewLine);
+ pzDta += newLineSize;
+ break;
+
+ case '\a':
+ *(pzDta++) = '\\';
+ *(pzDta++) = 'a';
+ break;
+
+ case '\b':
+ *(pzDta++) = '\\';
+ *(pzDta++) = 'b';
+ break;
+
+ case '\f':
+ *(pzDta++) = '\\';
+ *(pzDta++) = 'f';
+ break;
+
+ case '\r':
+ *(pzDta++) = '\\';
+ *(pzDta++) = 'r';
+ break;
+
+ case TAB:
+ *(pzDta++) = '\\';
+ *(pzDta++) = 't';
+ break;
+
+ case '\v':
+ *(pzDta++) = '\\';
+ *(pzDta++) = 'v';
+ break;
+
+ default:
+ /*
+ * sprintf is safe here, because we already computed
+ * the amount of space we will be using.
+ */
+ sprintf(pzDta, MK_STR_OCT_FMT, ch);
+ pzDta += 4;
+ }
+
+ pzScn++;
+ } copyDone:
+
+ /*
+ * End of string. Terminate the quoted output.
+ * If necessary, deallocate the text string.
+ * Return the scan resumption point.
+ */
+ *(pzDta++) = '"';
+ *pzDta = NUL;
+
+ {
+ SCM res = AG_SCM_STR02SCM(pzFre);
+ if (pzFre != z)
+ AGFREE(pzFre);
+ return res;
+ }
+}
+
+static size_t
+stringify_for_sh(char * pzNew, uint_t qt, char const * pzDta)
+{
+ char * pz = pzNew;
+ *(pz++) = qt;
+
+ for (;;) {
+ char c = (*(pz++) = *(pzDta++));
+ switch (c) {
+ case NUL:
+ pz[-1] = qt;
+ *pz = NUL;
+
+ return (pz - pzNew);
+
+ case '\\':
+ /*
+ * If someone went to the trouble to escape a backquote or a
+ * dollar sign, then we should not neutralize it. Note that
+ * we handle a following backslash as a normal character.
+ *
+ * i.e. \\ --> \\\\ *BUT* \\$ --> \\\$
+ */
+ c = *pzDta;
+ switch (*pzDta) {
+ case '$':
+ break;
+
+ case '"':
+ case '`':
+ /*
+ * IF the ensuing quote character does *NOT* match the
+ * quote character for the string, then we will preserve
+ * the single copy of the backslash. If it does match,
+ * then we will double the backslash and a third backslash
+ * will be inserted when we emit the quote character.
+ */
+ if ((unsigned)c != qt)
+ break;
+ /* FALLTHROUGH */
+
+ default:
+ *(pz++) = '\\'; /* \ --> \\ */
+ }
+ break;
+
+ case '"': case '`':
+ if ((unsigned)c == qt) {
+ /*
+ * This routine does both `xx` and "xx" strings, we have
+ * to worry about this stuff differently. I.e., in ""
+ * strings, add a single \ in front of ", and in ``
+ * preserve a add \ in front of `.
+ */
+ pz[-1] = '\\'; /* " --> \" */
+ *(pz++) = c;
+ }
+ }
+ }
+}
+
+static SCM
+shell_stringify(SCM obj, uint_t qt)
+{
+ char* pzNew;
+ size_t dtaSize = 3;
+ char* pzDta = ag_scm2zchars(obj, "AG Object");
+ char* pz = pzDta;
+
+ for (;;) {
+ char c = *(pz++);
+
+ switch (c) {
+ case NUL:
+ goto loopDone1;
+
+ case '"': case '`': case '\\':
+ dtaSize += 2;
+ break;
+
+ default:
+ dtaSize++;
+ }
+ } loopDone1:;
+
+ pzNew = AGALOC(dtaSize, "shell string");
+ dtaSize = stringify_for_sh(pzNew, qt, pzDta);
+
+ {
+ SCM res = AG_SCM_STR2SCM(pzNew, dtaSize);
+ AGFREE(pzNew);
+ return res;
+ }
+}
+
+static int
+sub_count(char const * haystack, char const * needle)
+{
+ int repCt = 0;
+ size_t needle_len = strlen(needle);
+
+ for (;;) {
+ haystack = strstr(haystack, needle);
+ if (haystack == NULL) break;
+ repCt++;
+ haystack += needle_len;
+ }
+ return repCt;
+}
+
+/**
+ * Replace marker text.
+ *
+ * Replace all occurrances of the marker text with the substitution text.
+ * The result is stored in an automatically freed temporary buffer.
+ *
+ * @param src_str The source string
+ * @param str_len The length of the string
+ * @param match the SCM-ized marker string
+ * @param repl the SCM-ized replacement string
+ * @param ppz_res pointer to the result pointer
+ * @param res_len pointer to result length
+ */
+static void
+do_substitution(
+ char const * src_str,
+ ssize_t str_len,
+ SCM match,
+ SCM repl,
+ char ** ppz_res,
+ ssize_t * res_len)
+{
+ char* pzMatch = ag_scm2zchars(match, "match text");
+ char* rep_str = ag_scm2zchars(repl, "repl text");
+ int mark_len = AG_SCM_STRLEN(match);
+ int repl_len = AG_SCM_STRLEN(repl);
+
+ {
+ int ct = sub_count(src_str, pzMatch);
+ if (ct == 0)
+ return; /* No substitutions -- no work. */
+
+ str_len += (repl_len - mark_len) * ct;
+ }
+
+ {
+ char * dest = ag_scribble(str_len + 1);
+ *ppz_res = dest;
+ *res_len = str_len;
+
+ for (;;) {
+ char const * next = strstr(src_str, pzMatch);
+ size_t len;
+
+ if (next == NULL)
+ break;
+ len = next - src_str;
+ if (len != 0) {
+ memcpy(dest, src_str, len);
+ dest += len;
+ }
+ memcpy(dest, rep_str, (size_t)repl_len);
+ dest += repl_len;
+ src_str = next + mark_len;
+ }
+
+ strcpy(dest, src_str);
+ }
+}
+
+
+/*
+ * Recursive routine. It calls itself for list values and calls
+ * "do_substitution" for string values. Each substitution will
+ * be done in the order found in the tree walk of list values.
+ * The "match" and "repl" trees *must* be identical in structure.
+ */
+LOCAL void
+do_multi_subs(char ** ppzStr, ssize_t * pStrLen, SCM match, SCM repl)
+{
+ char* pzStr = *ppzStr;
+ char* pzNxt = pzStr;
+
+ /*
+ * Loop for as long as our list has more entries
+ */
+ while (! AG_SCM_NULLP(match)) {
+ /*
+ * "CAR" is the current value, "CDR" is rest of list
+ */
+ SCM matchCar = SCM_CAR(match);
+ SCM replCar = SCM_CAR(repl);
+
+ match = SCM_CDR(match);
+ repl = SCM_CDR(repl);
+
+ if (AG_SCM_STRING_P(matchCar)) {
+ do_substitution(pzStr, *pStrLen, matchCar, replCar,
+ &pzNxt, pStrLen);
+
+ // coverity[use_after_free] -- invalid alias analysis
+ pzStr = pzNxt;
+ }
+
+ else if (AG_SCM_LIST_P(matchCar))
+ do_multi_subs(&pzStr, pStrLen, matchCar, replCar);
+
+ else
+ /*
+ * Whatever it is it is not part of what we would expect. Bail.
+ */
+ break;
+ }
+
+ *ppzStr = pzStr;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * EXPRESSION EVALUATION ROUTINES
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc in_p
+ *
+ * what: test for string in list
+ * general_use:
+ * exparg: test-string, string to look for
+ * exparg: string-list, list of strings to check,, list
+ *
+ * doc: Return SCM_BOOL_T if the first argument string is found
+ * in one of the entries in the second (list-of-strings) argument.
+=*/
+SCM
+ag_scm_in_p(SCM obj, SCM list)
+{
+ int len;
+ size_t lenz;
+ SCM car;
+ char const * pz1;
+
+ if (! AG_SCM_STRING_P(obj))
+ return SCM_UNDEFINED;
+
+ pz1 = AG_SCM_CHARS(obj);
+ lenz = AG_SCM_STRLEN(obj);
+
+ /*
+ * If the second argument is a string somehow, then treat
+ * this as a straight out string comparison
+ */
+ if (AG_SCM_STRING_P(list)) {
+ if ( (AG_SCM_STRLEN(list) == lenz)
+ && (strncmp(pz1, AG_SCM_CHARS(list), lenz) == 0))
+ return SCM_BOOL_T;
+ return SCM_BOOL_F;
+ }
+
+ len = scm_ilength(list);
+ if (len == 0)
+ return SCM_BOOL_F;
+
+ /*
+ * Search all the lists and sub-lists passed in
+ */
+ while (len-- > 0) {
+ car = SCM_CAR(list);
+ list = SCM_CDR(list);
+
+ /*
+ * This routine is listed as getting a list as the second
+ * argument. That means that if someone builds a list and
+ * hands it to us, it magically becomes a nested list.
+ * This unravels that.
+ */
+ if (! AG_SCM_STRING_P(car)) {
+ if (ag_scm_in_p(obj, car) == SCM_BOOL_T)
+ return SCM_BOOL_T;
+ continue;
+ }
+
+ if ( (AG_SCM_STRLEN(car) == lenz)
+ && (strncmp(pz1, AG_SCM_CHARS(car), lenz) == 0) )
+ return SCM_BOOL_T;
+ }
+
+ return SCM_BOOL_F;
+}
+
+
+/*=gfunc join
+ *
+ * what: join string list with separator
+ * general_use:
+ * exparg: separator, string to insert between entries
+ * exparg: list, list of strings to join,, list
+ *
+ * doc: With the first argument as the separator string,
+ * joins together an a-list of strings into one long string.
+ * The list may contain nested lists, partly because you
+ * cannot always control that.
+=*/
+SCM
+ag_scm_join(SCM sep, SCM list)
+{
+ int l_len, sv_l_len;
+ SCM car;
+ SCM alist = list;
+ size_t sep_len;
+ size_t str_len;
+ char * pzRes;
+ char const * pzSep;
+ char * pzScan;
+
+ if (! AG_SCM_STRING_P(sep))
+ return SCM_UNDEFINED;
+
+ sv_l_len = l_len = scm_ilength(list);
+ if (l_len == 0)
+ return AG_SCM_STR02SCM(zNil);
+
+ pzSep = AG_SCM_CHARS(sep);
+ sep_len = AG_SCM_STRLEN(sep);
+ str_len = 0;
+
+ /*
+ * Count up the lengths of all the strings to be joined.
+ */
+ for (;;) {
+ car = SCM_CAR(list);
+ list = SCM_CDR(list);
+
+ /*
+ * This routine is listed as getting a list as the second
+ * argument. That means that if someone builds a list and
+ * hands it to us, it magically becomes a nested list.
+ * This unravels that.
+ */
+ if (! AG_SCM_STRING_P(car)) {
+ if (car != SCM_UNDEFINED)
+ car = ag_scm_join(sep, car);
+ if (! AG_SCM_STRING_P(car))
+ return SCM_UNDEFINED;
+ }
+
+ str_len += AG_SCM_STRLEN(car);
+
+ if (--l_len <= 0)
+ break;
+
+ str_len += sep_len;
+ }
+
+ l_len = sv_l_len;
+ pzRes = pzScan = ag_scribble(str_len);
+
+ /*
+ * Now, copy each one into the output
+ */
+ for (;;) {
+ size_t cpy_len;
+
+ car = SCM_CAR(alist);
+ alist = SCM_CDR(alist);
+
+ /*
+ * This unravels nested lists.
+ */
+ if (! AG_SCM_STRING_P(car))
+ car = ag_scm_join(sep, car);
+
+ cpy_len = AG_SCM_STRLEN(car);
+ memcpy((void*)pzScan, AG_SCM_CHARS(car), cpy_len);
+ pzScan += cpy_len;
+
+ /*
+ * IF we reach zero, then do not insert a separation and bail out
+ */
+ if (--l_len <= 0)
+ break;
+ memcpy((void*)pzScan, (void*)pzSep, sep_len);
+ pzScan += sep_len;
+ }
+
+ return AG_SCM_STR2SCM(pzRes, str_len);
+}
+
+
+/*=gfunc prefix
+ *
+ * what: prefix lines with a string
+ * general_use:
+ *
+ * exparg: prefix, string to insert at start of each line
+ * exparg: text, multi-line block of text
+ *
+ * doc:
+ * Prefix every line in the second string with the first string.
+ *
+ * For example, if the first string is "# " and the second contains:
+ * @example
+ * two
+ * lines
+ * @end example
+ * @noindent
+ * The result string will contain:
+ * @example
+ * # two
+ * # lines
+ * @end example
+=*/
+SCM
+ag_scm_prefix(SCM prefix, SCM text)
+{
+ char* pzPfx;
+ char* pzText;
+ char* pzDta;
+ size_t out_size, rem_size;
+ size_t pfx_size;
+ char* pzRes;
+
+ pzPfx = ag_scm2zchars(prefix, "prefix");
+ pzDta = \
+ pzText = ag_scm2zchars(text, "text");
+ pfx_size = strlen(pzPfx);
+ out_size = pfx_size;
+
+ for (;;) {
+ switch (*(pzText++)) {
+ case NUL:
+ goto exit_count;
+ case NL:
+ out_size += pfx_size;
+ /* FALLTHROUGH */
+ default:
+ out_size++;
+ }
+ } exit_count:;
+
+ pzText = pzDta;
+ pzRes = pzDta = ag_scribble(rem_size = out_size);
+ strcpy(pzDta, pzPfx);
+ pzDta += pfx_size;
+ rem_size -= pfx_size;
+ pfx_size++;
+
+ for (;;) {
+ char ch = *(pzText++);
+ switch (ch) {
+ case NUL:
+ if (rem_size != 0)
+ AG_ABEND(PREFIX_FAIL);
+
+ return AG_SCM_STR2SCM(pzRes, out_size);
+
+ case NL:
+ *pzDta = ch;
+ strcpy(pzDta+1, pzPfx);
+ pzDta += pfx_size;
+ rem_size -= pfx_size;
+ break;
+
+ default:
+ rem_size--;
+ *(pzDta++) = ch;
+ break;
+ }
+ }
+}
+
+/*=gfunc raw_shell_str
+ *
+ * what: single quote shell string
+ * general_use:
+ *
+ * exparg: string, string to transform
+ *
+ * doc:
+ * Convert the text of the string into a singly quoted string
+ * that a normal shell will process into the original string.
+ * (It will not do macro expansion later, either.)
+ * Contained single quotes become tripled, with the middle quote
+ * escaped with a backslash. Normal shells will reconstitute the
+ * original string.
+ *
+ * @strong{Notice}: some shells will not correctly handle unusual
+ * non-printing characters. This routine works for most reasonably
+ * conventional ASCII strings.
+=*/
+SCM
+ag_scm_raw_shell_str(SCM obj)
+{
+ char* pzDta;
+ char* pz;
+ char* pzFree;
+
+ pzDta = ag_scm2zchars(obj, "AG Object");
+
+ {
+ size_t dtaSize = AG_SCM_STRLEN(obj) + 3; /* NUL + 2 quotes */
+ pz = pzDta-1;
+ for (;;) {
+ pz = strchr(pz+1, '\'');
+ if (pz == NULL)
+ break;
+ dtaSize += 3; /* '\'' -> 3 additional chars */
+ }
+
+ pzFree = pz = AGALOC(dtaSize + 2, "raw string");
+ }
+
+ /*
+ * Handle leading single quotes before starting the first quote.
+ */
+ while (*pzDta == '\'') {
+ *(pz++) = '\\';
+ *(pz++) = '\'';
+
+ /*
+ * IF pure single quotes, then we're done.
+ */
+ if (*++pzDta == NUL) {
+ *pz = NUL;
+ goto returnString;
+ }
+ }
+
+ /*
+ * Start quoting. If the string is empty, we wind up with two quotes.
+ */
+ *(pz++) = '\'';
+
+ for (;;) {
+ switch (*(pz++) = *(pzDta++)) {
+ case NUL:
+ goto loopDone;
+
+ case '\'':
+ /*
+ * We've inserted a single quote, which ends the quoting session.
+ * Now, insert escaped quotes for every quote char we find, then
+ * restart the quoting.
+ */
+ pzDta--;
+ do {
+ *(pz++) = '\\';
+ *(pz++) = '\'';
+ } while (*++pzDta == '\'');
+ if (*pzDta == NUL) {
+ *pz = NUL;
+ goto returnString;
+ }
+ *(pz++) = '\'';
+ }
+ } loopDone:;
+ pz[-1] = '\'';
+ *pz = NUL;
+
+ returnString:
+ {
+ SCM res = AG_SCM_STR02SCM(pzFree);
+ AGFREE(pzFree);
+ return res;
+ }
+}
+
+
+/*=gfunc shell_str
+ *
+ * what: double quote shell string
+ * general_use:
+ *
+ * exparg: string, string to transform
+ *
+ * doc:
+ *
+ * Convert the text of the string into a double quoted string that a normal
+ * shell will process into the original string, almost. It will add the
+ * escape character @code{\\} before two special characters to
+ * accomplish this: the backslash @code{\\} and double quote @code{"}.
+ *
+ * @strong{Notice}: some shells will not correctly handle unusual
+ * non-printing characters. This routine works for most reasonably
+ * conventional ASCII strings.
+ *
+ * @strong{WARNING}:
+ *@*
+ * This function omits the extra backslash in front of a backslash, however,
+ * if it is followed by either a backquote or a dollar sign. It must do this
+ * because otherwise it would be impossible to protect the dollar sign or
+ * backquote from shell evaluation. Consequently, it is not possible to
+ * render the strings "\\$" or "\\`". The lesser of two evils.
+ *
+ * All others characters are copied directly into the output.
+ *
+ * The @code{sub-shell-str} variation of this routine behaves identically,
+ * except that the extra backslash is omitted in front of @code{"} instead
+ * of @code{`}. You have to think about it. I'm open to suggestions.
+ *
+ * Meanwhile, the best way to document is with a detailed output example.
+ * If the backslashes make it through the text processing correctly,
+ * below you will see what happens with three example strings. The first
+ * example string contains a list of quoted @code{foo}s, the second is
+ * the same with a single backslash before the quote characters and the
+ * last is with two backslash escapes. Below each is the result of the
+ * @code{raw-shell-str}, @code{shell-str} and @code{sub-shell-str} functions.
+ *
+ * @example
+ * foo[0] ''foo'' 'foo' "foo" `foo` $foo
+ * raw-shell-str -> \'\''foo'\'\'' '\''foo'\'' "foo" `foo` $foo'
+ * shell-str -> "''foo'' 'foo' \"foo\" `foo` $foo"
+ * sub-shell-str -> `''foo'' 'foo' "foo" \`foo\` $foo`
+ *
+ * foo[1] \'bar\' \"bar\" \`bar\` \$bar
+ * raw-shell-str -> '\'\''bar\'\'' \"bar\" \`bar\` \$bar'
+ * shell-str -> "\\'bar\\' \\\"bar\\\" \`bar\` \$bar"
+ * sub-shell-str -> `\\'bar\\' \"bar\" \\\`bar\\\` \$bar`
+ *
+ * foo[2] \\'BAZ\\' \\"BAZ\\" \\`BAZ\\` \\$BAZ
+ * raw-shell-str -> '\\'\''BAZ\\'\'' \\"BAZ\\" \\`BAZ\\` \\$BAZ'
+ * shell-str -> "\\\\'BAZ\\\\' \\\\\"BAZ\\\\\" \\\`BAZ\\\` \\\$BAZ"
+ * sub-shell-str -> `\\\\'BAZ\\\\' \\\"BAZ\\\" \\\\\`BAZ\\\\\` \\\$BAZ`
+ * @end example
+ *
+ * There should be four, three, five and three backslashes for the four
+ * examples on the last line, respectively. The next to last line should
+ * have four, five, three and three backslashes. If this was not accurately
+ * reproduced, take a look at the agen5/test/shell.test test. Notice the
+ * backslashes in front of the dollar signs. It goes from zero to one to
+ * three for the "cooked" string examples.
+=*/
+SCM
+ag_scm_shell_str(SCM obj)
+{
+ return shell_stringify(obj, (unsigned)'"');
+}
+
+/*=gfunc sub_shell_str
+ *
+ * what: back quoted (sub-)shell string
+ * general_use:
+ *
+ * exparg: string, string to transform
+ *
+ * doc:
+ * This function is substantially identical to @code{shell-str}, except
+ * that the quoting character is @code{`} and the "leave the escape alone"
+ * character is @code{"}.
+=*/
+SCM
+ag_scm_sub_shell_str(SCM obj)
+{
+ return shell_stringify(obj, (unsigned)'`');
+}
+
+
+/*=gfunc stack
+ *
+ * what: make list of AutoGen values
+ *
+ * exparg: ag-name, AutoGen value name
+ *
+ * doc: Create a scheme list of all the strings that are associated
+ * with a name. They must all be text values or we choke.
+=*/
+SCM
+ag_scm_stack(SCM obj)
+{
+ SCM res;
+ SCM * pos = &res;
+ def_ent_t** ppDE;
+ def_ent_t* pDE;
+ SCM str;
+
+ res = SCM_EOL;
+
+ ppDE = find_def_ent_list(ag_scm2zchars(obj, "AG Object"));
+ if (ppDE == NULL)
+ return SCM_EOL;
+
+ for (;;) {
+ pDE = *(ppDE++);
+
+ if (pDE == NULL)
+ break;
+
+ if (pDE->de_type != VALTYP_TEXT)
+ return SCM_UNDEFINED;
+
+ str = AG_SCM_STR02SCM(pDE->de_val.dvu_text);
+ *pos = scm_cons(str, SCM_EOL);
+ pos = SCM_CDRLOC(*pos);
+ }
+
+ return res;
+}
+
+
+/*=gfunc kr_string
+ *
+ * what: emit string for K&R C
+ * general_use:
+ *
+ * exparg: string, string to reformat
+ *
+ * doc:
+ * Reform a string so that, when printed, a K&R C compiler will be able
+ * to compile the data and construct a string that contains exactly
+ * what the current string contains. Many non-printing characters are
+ * replaced with escape sequences. New-lines are replaced with a
+ * backslash-n-backslash and newline sequence,
+=*/
+SCM
+ag_scm_kr_string(SCM str)
+{
+ return makeString(ag_scm2zchars(str, "str"),
+ KR_STRING_NEWLINE, KR_STRING_NEWLINE_LEN);
+}
+
+
+/*=gfunc c_string
+ *
+ * what: emit string for ANSI C
+ * general_use:
+ *
+ * exparg: string, string to reformat
+ *
+ * doc:
+ * Reform a string so that, when printed, the C compiler will be able to
+ * compile the data and construct a string that contains exactly what the
+ * current string contains. Many non-printing characters are replaced with
+ * escape sequences. Newlines are replaced with a backslash, an @code{n}, a
+ * closing quote, a newline, seven spaces and another re-opening quote. The
+ * compiler will implicitly concatenate them. The reader will see line
+ * breaks.
+ *
+ * A K&R compiler will choke. Use @code{kr-string} for that compiler.
+ *
+=*/
+SCM
+ag_scm_c_string(SCM str)
+{
+ return makeString(ag_scm2zchars(str, "str"),
+ C_STRING_NEWLINE, C_STRING_NEWLINE_LEN);
+}
+
+
+/*=gfunc string_tr_x
+ *
+ * what: convert characters
+ * general_use:
+ *
+ * exparg: source, string to transform
+ * exparg: match, characters to be converted
+ * exparg: translation, conversion list
+ *
+ * doc: This is the same as the @code{tr(1)} program, except the
+ * string to transform is the first argument. The second and
+ * third arguments are used to construct mapping arrays for the
+ * transformation of the first argument.
+ *
+ * It is too bad this little program has so many different
+ * and incompatible implementations!
+=*/
+SCM
+ag_scm_string_tr_x(SCM str, SCM from_xform, SCM to_xform)
+{
+ unsigned char ch_map[ 1 << 8 /* bits-per-byte */ ];
+ int i = sizeof(ch_map) - 1;
+ char* pzFrom = ag_scm2zchars(from_xform, "str");
+ char* pzTo = ag_scm2zchars(to_xform, "str");
+
+ do {
+ ch_map[i] = i;
+ } while (--i > 0);
+
+ for (; i <= (int)sizeof(ch_map) - 1; i++) {
+ unsigned char fch = (unsigned char)*(pzFrom++);
+ unsigned char tch = (unsigned char)*(pzTo++);
+
+ if (tch == NUL) {
+ pzTo--;
+ tch = pzTo[-1];
+ }
+
+ switch (fch) {
+ case NUL:
+ goto mapDone;
+
+ case '-':
+ if ((i > 0) && (tch == '-')) {
+ unsigned char fs = (unsigned char)pzFrom[-2];
+ unsigned char fe = (unsigned char)pzFrom[0];
+ unsigned char ts = (unsigned char)pzTo[-2];
+ unsigned char te = (unsigned char)pzTo[0];
+ if (te != NUL) {
+ while (fs < fe) {
+ ch_map[ fs++ ] = ts;
+ if (ts < te) ts++;
+ }
+ break;
+ }
+ }
+
+ default:
+ ch_map[ fch ] = tch;
+ }
+ } mapDone:;
+
+ pzTo = (char*)(void*)AG_SCM_CHARS(str);
+ i = AG_SCM_STRLEN(str);
+ while (i-- > 0) {
+ *pzTo = ch_map[ (int)*pzTo ];
+ pzTo++;
+ }
+ return str;
+}
+
+/*=gfunc string_tr
+ *
+ * what: convert characters with new result
+ * general_use:
+ *
+ * exparg: source, string to transform
+ * exparg: match, characters to be converted
+ * exparg: translation, conversion list
+ *
+ * doc: This is identical to @code{string-tr!}, except that it does not
+ * over-write the previous value.
+=*/
+SCM
+ag_scm_string_tr(SCM Str, SCM From, SCM To)
+{
+ size_t lenz = AG_SCM_STRLEN(Str);
+ SCM res = AG_SCM_STR2SCM(AG_SCM_CHARS(Str), lenz);
+ return ag_scm_string_tr_x(res, From, To);
+}
+
+/*=gfunc string_substitute
+ *
+ * what: multiple global replacements
+ * general_use:
+ *
+ * exparg: source, string to transform
+ * exparg: match, substring or substring list to be replaced
+ * exparg: repl, replacement strings or substrings
+ *
+ * doc: @code{match} and @code{repl} may be either a single string or
+ * a list of strings. Either way, they must have the same structure
+ * and number of elements. For example, to replace all amphersands,
+ * less than and greater than characters, do something like this:
+ *
+ * @example
+ * (string-substitute source
+ * (list "&" "<" ">")
+ * (list "&amp;" "&lt;" "&gt;"))
+ * @end example
+=*/
+SCM
+ag_scm_string_substitute(SCM Str, SCM Match, SCM Repl)
+{
+ char const * pzStr;
+ ssize_t len;
+ SCM res;
+
+ if (! AG_SCM_STRING_P(Str))
+ return SCM_UNDEFINED;
+
+ pzStr = AG_SCM_CHARS(Str);
+ len = AG_SCM_STRLEN(Str);
+
+ if (AG_SCM_STRING_P(Match))
+ do_substitution(pzStr, len, Match, Repl, (char**)&pzStr, &len);
+ else
+ do_multi_subs((char**)&pzStr, &len, Match, Repl);
+
+ res = AG_SCM_STR2SCM(pzStr, len);
+ return res;
+}
+
+/*=gfunc time_string_to_number
+ *
+ * what: duration string to seconds
+ * general_use:
+ * exparg: time_spec, string to parse
+ *
+ * doc: Convert the argument string to a time period in seconds.
+ * The string may use multiple parts consisting of days, hours
+ * minutes and seconds. These are indicated with a suffix of
+ * @code{d}, @code{h}, @code{m} and @code{s} respectively.
+ * Hours, minutes and seconds may also be represented with
+ * @code{HH:MM:SS} or, without hours, as @code{MM:SS}.
+=*/
+SCM
+ag_scm_time_string_to_number(SCM time_spec)
+{
+ extern time_t parse_duration(char const * in_pz);
+
+ char const * pz;
+ time_t time_period;
+
+ if (! AG_SCM_STRING_P(time_spec))
+ return SCM_UNDEFINED;
+
+ pz = AG_SCM_CHARS(time_spec);
+ time_period = parse_duration(pz);
+
+ return AG_SCM_INT2SCM((int)time_period);
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/expString.c */
diff --git a/agen5/expr.h b/agen5/expr.h
new file mode 100644
index 0000000..c181729
--- /dev/null
+++ b/agen5/expr.h
@@ -0,0 +1,160 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (expr.h)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:37 AM by AutoGen 5.16.2pre7
+ * From the definitions expr.def
+ * and the template file snarf
+ *
+ * copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Guile Implementation Routines - for the ag group
+ */
+#ifndef GUILE_PROCS_EXPR_H_GUARD
+#define GUILE_PROCS_EXPR_H_GUARD 1
+#if GUILE_VERSION >= 108000
+# include <libguile.h>
+#else
+# include <guile/gh.h>
+#endif
+
+typedef enum {
+ GH_TYPE_UNDEFINED = 0,
+ GH_TYPE_BOOLEAN,
+ GH_TYPE_SYMBOL,
+ GH_TYPE_CHAR,
+ GH_TYPE_VECTOR,
+ GH_TYPE_PAIR,
+ GH_TYPE_NUMBER,
+ GH_TYPE_STRING,
+ GH_TYPE_PROCEDURE,
+ GH_TYPE_LIST,
+ GH_TYPE_INEXACT,
+ GH_TYPE_EXACT
+} teGuileType;
+
+extern SCM ag_scm_ag_fprintf(SCM, SCM, SCM);
+extern SCM ag_scm_ag_function_p(SCM);
+extern SCM ag_scm_agpl(SCM, SCM);
+extern SCM ag_scm_base_name(void);
+extern SCM ag_scm_bsd(SCM, SCM, SCM);
+extern SCM ag_scm_c_string(SCM);
+extern SCM ag_scm_chdir(SCM);
+extern SCM ag_scm_count(SCM);
+extern SCM ag_scm_def_file(void);
+extern SCM ag_scm_def_file_line(SCM, SCM);
+extern SCM ag_scm_dne(SCM, SCM, SCM);
+extern SCM ag_scm_emit(SCM);
+extern SCM ag_scm_error(SCM);
+extern SCM ag_scm_error_source_line(void);
+extern SCM ag_scm_exist_p(SCM);
+extern SCM ag_scm_extract(SCM, SCM, SCM, SCM);
+extern SCM ag_scm_find_file(SCM, SCM);
+extern SCM ag_scm_first_for_p(SCM);
+extern SCM ag_scm_for_by(SCM);
+extern SCM ag_scm_for_from(SCM);
+extern SCM ag_scm_for_index(SCM);
+extern SCM ag_scm_for_sep(SCM);
+extern SCM ag_scm_for_to(SCM);
+extern SCM ag_scm_format_arg_count(SCM);
+extern SCM ag_scm_fprintf(SCM, SCM, SCM);
+extern SCM ag_scm_get(SCM, SCM);
+extern SCM ag_scm_get_c_name(SCM);
+extern SCM ag_scm_get_down_name(SCM);
+extern SCM ag_scm_get_up_name(SCM);
+extern SCM ag_scm_gperf(SCM, SCM);
+extern SCM ag_scm_gpl(SCM, SCM);
+extern SCM ag_scm_hide_email(SCM, SCM);
+extern SCM ag_scm_high_lim(SCM);
+extern SCM ag_scm_in_p(SCM, SCM);
+extern SCM ag_scm_join(SCM, SCM);
+extern SCM ag_scm_kr_string(SCM);
+extern SCM ag_scm_last_for_p(SCM);
+extern SCM ag_scm_len(SCM);
+extern SCM ag_scm_lgpl(SCM, SCM, SCM);
+extern SCM ag_scm_license(SCM, SCM, SCM, SCM);
+extern SCM ag_scm_license_description(SCM, SCM, SCM, SCM);
+extern SCM ag_scm_license_full(SCM, SCM, SCM, SCM, SCM);
+extern SCM ag_scm_license_info(SCM, SCM, SCM, SCM, SCM);
+extern SCM ag_scm_license_name(SCM);
+extern SCM ag_scm_low_lim(SCM);
+extern SCM ag_scm_make_gperf(SCM, SCM);
+extern SCM ag_scm_make_header_guard(SCM);
+extern SCM ag_scm_make_tmp_dir(void);
+extern SCM ag_scm_makefile_script(SCM);
+extern SCM ag_scm_match_value_p(SCM, SCM, SCM);
+extern SCM ag_scm_max(SCM);
+extern SCM ag_scm_min(SCM);
+extern SCM ag_scm_out_delete(void);
+extern SCM ag_scm_out_depth(void);
+extern SCM ag_scm_out_emit_suspended(SCM);
+extern SCM ag_scm_out_line(void);
+extern SCM ag_scm_out_move(SCM);
+extern SCM ag_scm_out_name(void);
+extern SCM ag_scm_out_pop(SCM);
+extern SCM ag_scm_out_push_add(SCM);
+extern SCM ag_scm_out_push_new(SCM);
+extern SCM ag_scm_out_resume(SCM);
+extern SCM ag_scm_out_suspend(SCM);
+extern SCM ag_scm_out_switch(SCM);
+extern SCM ag_scm_output_file_next_line(SCM, SCM);
+extern SCM ag_scm_prefix(SCM, SCM);
+extern SCM ag_scm_printf(SCM, SCM);
+extern SCM ag_scm_raw_shell_str(SCM);
+extern SCM ag_scm_set_option(SCM);
+extern SCM ag_scm_set_writable(SCM);
+extern SCM ag_scm_shell(SCM);
+extern SCM ag_scm_shell_str(SCM);
+extern SCM ag_scm_shellf(SCM, SCM);
+extern SCM ag_scm_sprintf(SCM, SCM);
+extern SCM ag_scm_stack(SCM);
+extern SCM ag_scm_string_capitalize(SCM);
+extern SCM ag_scm_string_capitalize_x(SCM);
+extern SCM ag_scm_string_contains_eqv_p(SCM, SCM);
+extern SCM ag_scm_string_contains_p(SCM, SCM);
+extern SCM ag_scm_string_downcase(SCM);
+extern SCM ag_scm_string_downcase_x(SCM);
+extern SCM ag_scm_string_end_eqv_match_p(SCM, SCM);
+extern SCM ag_scm_string_end_match_p(SCM, SCM);
+extern SCM ag_scm_string_ends_eqv_p(SCM, SCM);
+extern SCM ag_scm_string_ends_with_p(SCM, SCM);
+extern SCM ag_scm_string_equals_p(SCM, SCM);
+extern SCM ag_scm_string_eqv_match_p(SCM, SCM);
+extern SCM ag_scm_string_eqv_p(SCM, SCM);
+extern SCM ag_scm_string_has_eqv_match_p(SCM, SCM);
+extern SCM ag_scm_string_has_match_p(SCM, SCM);
+extern SCM ag_scm_string_match_p(SCM, SCM);
+extern SCM ag_scm_string_start_eqv_match_p(SCM, SCM);
+extern SCM ag_scm_string_start_match_p(SCM, SCM);
+extern SCM ag_scm_string_starts_eqv_p(SCM, SCM);
+extern SCM ag_scm_string_starts_with_p(SCM, SCM);
+extern SCM ag_scm_string_substitute(SCM, SCM, SCM);
+extern SCM ag_scm_string_to_c_name_x(SCM);
+extern SCM ag_scm_string_to_camelcase(SCM);
+extern SCM ag_scm_string_tr(SCM, SCM, SCM);
+extern SCM ag_scm_string_tr_x(SCM, SCM, SCM);
+extern SCM ag_scm_string_upcase(SCM);
+extern SCM ag_scm_string_upcase_x(SCM);
+extern SCM ag_scm_sub_shell_str(SCM);
+extern SCM ag_scm_suffix(void);
+extern SCM ag_scm_sum(SCM);
+extern SCM ag_scm_time_string_to_number(SCM);
+extern SCM ag_scm_tpl_file(SCM);
+extern SCM ag_scm_tpl_file_line(SCM);
+extern SCM ag_scm_tpl_file_next_line(SCM);
+extern SCM ag_scm_version_compare(SCM, SCM, SCM);
+
+#endif /* GUILE_PROCS_EXPR_H_GUARD */
diff --git a/agen5/expr.ini b/agen5/expr.ini
new file mode 100644
index 0000000..3bd2c81
--- /dev/null
+++ b/agen5/expr.ini
@@ -0,0 +1,270 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (expr.ini)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:37 AM by AutoGen 5.16.2pre7
+ * From the definitions expr.def
+ * and the template file snarf
+ *
+ * copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Guile Initializations - Ag Global Variables
+ */
+#include "expr.h"
+typedef SCM (*scm_callback_t)(void);
+void ag_init(void);
+
+#if GUILE_VERSION >= 108000
+#define NEW_PROC(_As, _Ar, _Ao, _Ax, _An) \
+ scm_c_define_gsubr((char*)(_As), \
+ _Ar, _Ao, _Ax, (scm_callback_t)(void*)ag_scm_ ## _An)
+#else
+#define NEW_PROC(_As, _Ar, _Ao, _Ax, _An) \
+ gh_new_procedure((char*)(_As), (scm_callback_t)(void*)ag_scm_ ## _An, \
+ _Ar, _Ao, _Ax)
+#endif
+
+/*
+ * ag Initialization procedure.
+ */
+void
+ag_init(void)
+{
+static char const g_nm[1062] =
+/* 0 */ "ag-fprintf\0"
+/* 11 */ "ag-function?\0"
+/* 24 */ "agpl\0"
+/* 29 */ "base-name\0"
+/* 39 */ "bsd\0"
+/* 43 */ "c-string\0"
+/* 52 */ "chdir\0"
+/* 58 */ "count\0"
+/* 64 */ "def-file\0"
+/* 73 */ "def-file-line\0"
+/* 87 */ "dne\0"
+/* 91 */ "emit\0"
+/* 96 */ "error\0"
+/* 102 */ "error-source-line\0"
+/* 120 */ "exist?\0"
+/* 127 */ "extract\0"
+/* 135 */ "find-file\0"
+/* 145 */ "first-for?\0"
+/* 156 */ "for-by\0"
+/* 163 */ "for-from\0"
+/* 172 */ "for-index\0"
+/* 182 */ "for-sep\0"
+/* 190 */ "for-to\0"
+/* 197 */ "format-arg-count\0"
+/* 214 */ "fprintf\0"
+/* 222 */ "get\0"
+/* 226 */ "get-c-name\0"
+/* 237 */ "get-down-name\0"
+/* 251 */ "get-up-name\0"
+/* 263 */ "gperf\0"
+/* 269 */ "gpl\0"
+/* 273 */ "hide-email\0"
+/* 284 */ "high-lim\0"
+/* 293 */ "in?\0"
+/* 297 */ "join\0"
+/* 302 */ "kr-string\0"
+/* 312 */ "last-for?\0"
+/* 322 */ "len\0"
+/* 326 */ "lgpl\0"
+/* 331 */ "license\0"
+/* 339 */ "license-description\0"
+/* 359 */ "license-full\0"
+/* 372 */ "license-info\0"
+/* 385 */ "license-name\0"
+/* 398 */ "low-lim\0"
+/* 406 */ "make-gperf\0"
+/* 417 */ "make-header-guard\0"
+/* 435 */ "make-tmp-dir\0"
+/* 448 */ "makefile-script\0"
+/* 464 */ "match-value?\0"
+/* 477 */ "max\0"
+/* 481 */ "min\0"
+/* 485 */ "out-delete\0"
+/* 496 */ "out-depth\0"
+/* 506 */ "out-emit-suspended\0"
+/* 525 */ "out-line\0"
+/* 534 */ "out-move\0"
+/* 543 */ "out-name\0"
+/* 552 */ "out-pop\0"
+/* 560 */ "out-push-add\0"
+/* 573 */ "out-push-new\0"
+/* 586 */ "out-resume\0"
+/* 597 */ "out-suspend\0"
+/* 609 */ "out-switch\0"
+/* 620 */ "output-file-next-line\0"
+/* 642 */ "prefix\0"
+/* 649 */ "printf\0"
+/* 656 */ "raw-shell-str\0"
+/* 670 */ "set-option\0"
+/* 681 */ "set-writable\0"
+/* 694 */ "shell\0"
+/* 700 */ "shell-str\0"
+/* 710 */ "shellf\0"
+/* 717 */ "sprintf\0"
+/* 725 */ "stack\0"
+/* 731 */ "string-capitalize\0"
+/* 749 */ "string-capitalize!\0"
+/* 768 */ "*=*\0"
+/* 772 */ "*==*\0"
+/* 777 */ "string-downcase\0"
+/* 793 */ "string-downcase!\0"
+/* 810 */ "*~\0"
+/* 813 */ "*~~\0"
+/* 817 */ "*=\0"
+/* 820 */ "*==\0"
+/* 824 */ "==\0"
+/* 827 */ "~\0"
+/* 829 */ "=\0"
+/* 831 */ "*~*\0"
+/* 835 */ "*~~*\0"
+/* 840 */ "~~\0"
+/* 843 */ "~*\0"
+/* 846 */ "~~*\0"
+/* 850 */ "=*\0"
+/* 853 */ "==*\0"
+/* 857 */ "string-substitute\0"
+/* 875 */ "string->c-name!\0"
+/* 891 */ "string->camelcase\0"
+/* 909 */ "string-tr\0"
+/* 919 */ "string-tr!\0"
+/* 930 */ "string-upcase\0"
+/* 944 */ "string-upcase!\0"
+/* 959 */ "sub-shell-str\0"
+/* 973 */ "suffix\0"
+/* 980 */ "sum\0"
+/* 984 */ "time-string->number\0"
+/* 1004 */ "tpl-file\0"
+/* 1013 */ "tpl-file-line\0"
+/* 1027 */ "tpl-file-next-line\0"
+/* 1046 */ "version-compare";
+
+ NEW_PROC(g_nm + 0, 2, 0, 1, ag_fprintf);
+ NEW_PROC(g_nm + 11, 1, 0, 0, ag_function_p);
+ NEW_PROC(g_nm + 24, 2, 0, 0, agpl);
+ NEW_PROC(g_nm + 29, 0, 0, 0, base_name);
+ NEW_PROC(g_nm + 39, 3, 0, 0, bsd);
+ NEW_PROC(g_nm + 43, 1, 0, 0, c_string);
+ NEW_PROC(g_nm + 52, 1, 0, 0, chdir);
+ NEW_PROC(g_nm + 58, 1, 0, 0, count);
+ NEW_PROC(g_nm + 64, 0, 0, 0, def_file);
+ NEW_PROC(g_nm + 73, 1, 1, 0, def_file_line);
+ NEW_PROC(g_nm + 87, 1, 2, 0, dne);
+ NEW_PROC(g_nm + 91, 0, 0, 1, emit);
+ NEW_PROC(g_nm + 96, 1, 0, 0, error);
+ NEW_PROC(g_nm + 102, 0, 0, 0, error_source_line);
+ NEW_PROC(g_nm + 120, 1, 0, 0, exist_p);
+ NEW_PROC(g_nm + 127, 2, 2, 0, extract);
+ NEW_PROC(g_nm + 135, 1, 1, 0, find_file);
+ NEW_PROC(g_nm + 145, 0, 1, 0, first_for_p);
+ NEW_PROC(g_nm + 156, 1, 0, 0, for_by);
+ NEW_PROC(g_nm + 163, 1, 0, 0, for_from);
+ NEW_PROC(g_nm + 172, 0, 1, 0, for_index);
+ NEW_PROC(g_nm + 182, 1, 0, 0, for_sep);
+ NEW_PROC(g_nm + 190, 1, 0, 0, for_to);
+ NEW_PROC(g_nm + 197, 1, 0, 0, format_arg_count);
+ NEW_PROC(g_nm + 214, 2, 0, 1, fprintf);
+ NEW_PROC(g_nm + 222, 1, 1, 0, get);
+ NEW_PROC(g_nm + 226, 1, 0, 0, get_c_name);
+ NEW_PROC(g_nm + 237, 1, 0, 0, get_down_name);
+ NEW_PROC(g_nm + 251, 1, 0, 0, get_up_name);
+ NEW_PROC(g_nm + 263, 2, 0, 0, gperf);
+ NEW_PROC(g_nm + 269, 2, 0, 0, gpl);
+ NEW_PROC(g_nm + 273, 2, 0, 0, hide_email);
+ NEW_PROC(g_nm + 284, 1, 0, 0, high_lim);
+ NEW_PROC(g_nm + 293, 1, 0, 1, in_p);
+ NEW_PROC(g_nm + 297, 1, 0, 1, join);
+ NEW_PROC(g_nm + 302, 1, 0, 0, kr_string);
+ NEW_PROC(g_nm + 312, 0, 1, 0, last_for_p);
+ NEW_PROC(g_nm + 322, 1, 0, 0, len);
+ NEW_PROC(g_nm + 326, 3, 0, 0, lgpl);
+ NEW_PROC(g_nm + 331, 4, 0, 0, license);
+ NEW_PROC(g_nm + 339, 3, 1, 0, license_description);
+ NEW_PROC(g_nm + 359, 3, 2, 0, license_full);
+ NEW_PROC(g_nm + 372, 3, 2, 0, license_info);
+ NEW_PROC(g_nm + 385, 1, 0, 0, license_name);
+ NEW_PROC(g_nm + 398, 1, 0, 0, low_lim);
+ NEW_PROC(g_nm + 406, 1, 0, 1, make_gperf);
+ NEW_PROC(g_nm + 417, 1, 0, 0, make_header_guard);
+ NEW_PROC(g_nm + 435, 0, 0, 0, make_tmp_dir);
+ NEW_PROC(g_nm + 448, 1, 0, 0, makefile_script);
+ NEW_PROC(g_nm + 464, 3, 0, 0, match_value_p);
+ NEW_PROC(g_nm + 477, 0, 0, 1, max);
+ NEW_PROC(g_nm + 481, 0, 0, 1, min);
+ NEW_PROC(g_nm + 485, 0, 0, 0, out_delete);
+ NEW_PROC(g_nm + 496, 0, 0, 0, out_depth);
+ NEW_PROC(g_nm + 506, 1, 0, 0, out_emit_suspended);
+ NEW_PROC(g_nm + 525, 0, 0, 0, out_line);
+ NEW_PROC(g_nm + 534, 1, 0, 0, out_move);
+ NEW_PROC(g_nm + 543, 0, 0, 0, out_name);
+ NEW_PROC(g_nm + 552, 0, 1, 0, out_pop);
+ NEW_PROC(g_nm + 560, 1, 0, 0, out_push_add);
+ NEW_PROC(g_nm + 573, 0, 1, 0, out_push_new);
+ NEW_PROC(g_nm + 586, 1, 0, 0, out_resume);
+ NEW_PROC(g_nm + 597, 1, 0, 0, out_suspend);
+ NEW_PROC(g_nm + 609, 1, 0, 0, out_switch);
+ NEW_PROC(g_nm + 620, 0, 2, 0, output_file_next_line);
+ NEW_PROC(g_nm + 642, 2, 0, 0, prefix);
+ NEW_PROC(g_nm + 649, 1, 0, 1, printf);
+ NEW_PROC(g_nm + 656, 1, 0, 0, raw_shell_str);
+ NEW_PROC(g_nm + 670, 1, 0, 0, set_option);
+ NEW_PROC(g_nm + 681, 0, 1, 0, set_writable);
+ NEW_PROC(g_nm + 694, 1, 0, 0, shell);
+ NEW_PROC(g_nm + 700, 1, 0, 0, shell_str);
+ NEW_PROC(g_nm + 710, 1, 0, 1, shellf);
+ NEW_PROC(g_nm + 717, 1, 0, 1, sprintf);
+ NEW_PROC(g_nm + 725, 1, 0, 0, stack);
+ NEW_PROC(g_nm + 731, 1, 0, 0, string_capitalize);
+ NEW_PROC(g_nm + 749, 1, 0, 0, string_capitalize_x);
+ NEW_PROC(g_nm + 768, 2, 0, 0, string_contains_eqv_p);
+ NEW_PROC(g_nm + 772, 2, 0, 0, string_contains_p);
+ NEW_PROC(g_nm + 777, 1, 0, 0, string_downcase);
+ NEW_PROC(g_nm + 793, 1, 0, 0, string_downcase_x);
+ NEW_PROC(g_nm + 810, 2, 0, 0, string_end_eqv_match_p);
+ NEW_PROC(g_nm + 813, 2, 0, 0, string_end_match_p);
+ NEW_PROC(g_nm + 817, 2, 0, 0, string_ends_eqv_p);
+ NEW_PROC(g_nm + 820, 2, 0, 0, string_ends_with_p);
+ NEW_PROC(g_nm + 824, 2, 0, 0, string_equals_p);
+ NEW_PROC(g_nm + 827, 2, 0, 0, string_eqv_match_p);
+ NEW_PROC(g_nm + 829, 2, 0, 0, string_eqv_p);
+ NEW_PROC(g_nm + 831, 2, 0, 0, string_has_eqv_match_p);
+ NEW_PROC(g_nm + 835, 2, 0, 0, string_has_match_p);
+ NEW_PROC(g_nm + 840, 2, 0, 0, string_match_p);
+ NEW_PROC(g_nm + 843, 2, 0, 0, string_start_eqv_match_p);
+ NEW_PROC(g_nm + 846, 2, 0, 0, string_start_match_p);
+ NEW_PROC(g_nm + 850, 2, 0, 0, string_starts_eqv_p);
+ NEW_PROC(g_nm + 853, 2, 0, 0, string_starts_with_p);
+ NEW_PROC(g_nm + 857, 3, 0, 0, string_substitute);
+ NEW_PROC(g_nm + 875, 1, 0, 0, string_to_c_name_x);
+ NEW_PROC(g_nm + 891, 1, 0, 0, string_to_camelcase);
+ NEW_PROC(g_nm + 909, 3, 0, 0, string_tr);
+ NEW_PROC(g_nm + 919, 3, 0, 0, string_tr_x);
+ NEW_PROC(g_nm + 930, 1, 0, 0, string_upcase);
+ NEW_PROC(g_nm + 944, 1, 0, 0, string_upcase_x);
+ NEW_PROC(g_nm + 959, 1, 0, 0, sub_shell_str);
+ NEW_PROC(g_nm + 973, 0, 0, 0, suffix);
+ NEW_PROC(g_nm + 980, 0, 0, 1, sum);
+ NEW_PROC(g_nm + 984, 1, 0, 0, time_string_to_number);
+ NEW_PROC(g_nm +1004, 0, 1, 0, tpl_file);
+ NEW_PROC(g_nm +1013, 0, 1, 0, tpl_file_line);
+ NEW_PROC(g_nm +1027, 0, 1, 0, tpl_file_next_line);
+ NEW_PROC(g_nm +1046, 3, 0, 0, version_compare);
+}
+#undef NEW_PROC
+/* end of expr.ini */
diff --git a/agen5/fmemopen.c b/agen5/fmemopen.c
new file mode 100644
index 0000000..6e865be
--- /dev/null
+++ b/agen5/fmemopen.c
@@ -0,0 +1,743 @@
+#if defined(ENABLE_FMEMOPEN)
+#include <sys/ioctl.h>
+
+typedef enum {
+ FMEMC_INVALID = 0,
+ FMEMC_GET_BUF_ADDR
+} fmemctl_t;
+
+typedef struct {
+ enum { FMEMC_GBUF_LEAVE_OWNERSHIP,
+ FMEMC_GBUF_TAKE_OWNERSHIP
+ } own;
+ char * buffer;
+ size_t buf_size;
+ size_t eof;
+} fmemc_get_buf_addr_t;
+
+#ifdef HURD
+#define _IOT__IOTBASE_fmemc_get_buf_addr_t sizeof(fmemc_get_buf_addr_t)
+#endif
+
+#define IOCTL_FMEMC_GET_BUF_ADDR \
+ _IOWR('m', FMEMC_GET_BUF_ADDR, fmemc_get_buf_addr_t)
+
+/**
+ * @file /old-home/bkorb/tools/mine/lib/fmemopen/fmemopen.c
+ *
+ * Copyright (c) 2004-2012 by Bruce Korb. All rights reserved.
+ *
+ * This code was inspired from software written by
+ * Hanno Mueller, kontakt@hanno.de
+ * and completely rewritten by Bruce Korb, bkorb@gnu.org
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#if defined(HAVE_FOPENCOOKIE)
+# if defined(HAVE_LIBIO_H)
+# include <libio.h>
+# endif
+
+ typedef off64_t * seek_off_t;
+ typedef int seek_ret_t;
+
+#elif defined(HAVE_FUNOPEN)
+ typedef fpos_t seek_off_t;
+ typedef fpos_t seek_ret_t;
+
+# ifdef NEED_COOKIE_FUNCTION_TYPEDEFS
+ typedef int (cookie_read_function_t )(void *, char *, int);
+ typedef int (cookie_write_function_t)(void *, char const *, int);
+ typedef fpos_t (cookie_seek_function_t )(void *, fpos_t, int);
+ typedef int (cookie_close_function_t)(void *);
+# endif /* NEED_COOKIE_FUNCTION_TYPEDEFS */
+#endif
+
+#define PROP_TABLE \
+_Prop_( read, "Read from buffer" ) \
+_Prop_( write, "Write to buffer" ) \
+_Prop_( append, "Append to buffer okay" ) \
+_Prop_( binary, "byte data - not string" ) \
+_Prop_( create, "allocate the string" ) \
+_Prop_( truncate, "start writing at start" ) \
+_Prop_( allocated, "we allocated the buffer" ) \
+_Prop_( fixed_size, "writes do not append" )
+
+#define _Prop_(n,s) BIT_ID_ ## n,
+typedef enum { PROP_TABLE BIT_CT } fmem_flags_e;
+#undef _Prop_
+
+#define FLAG_BIT(n) (1 << BIT_ID_ ## n)
+
+typedef unsigned long mode_bits_t;
+typedef unsigned char buf_bytes_t;
+
+typedef struct fmem_cookie_s fmem_cookie_t;
+struct fmem_cookie_s {
+ mode_bits_t mode;
+ buf_bytes_t * buffer;
+ size_t buf_size; /* Full size of buffer */
+ size_t next_ix; /* Current position */
+ size_t eof; /* End Of File */
+ size_t pg_size; /* size of a memory page.
+ Future architectures allow it to vary
+ by memory region. */
+};
+
+typedef struct {
+ FILE * fp;
+ fmem_cookie_t * cookie;
+} cookie_fp_map_t;
+
+static cookie_fp_map_t const * map = NULL;
+static unsigned int map_ct = 0;
+static unsigned int map_alloc_ct = 0;
+
+/* = = = START-STATIC-FORWARD = = = */
+static int
+fmem_getmode(char const * mode, mode_bits_t * pRes);
+
+static int
+fmem_extend(fmem_cookie_t *pFMC, size_t new_size);
+
+static ssize_t
+fmem_read(void *cookie, void *pBuf, size_t sz);
+
+static ssize_t
+fmem_write(void *cookie, const void *pBuf, size_t sz);
+
+static seek_ret_t
+fmem_seek(void * cookie, seek_off_t offset, int dir);
+
+static int
+fmem_close(void * cookie);
+
+static bool
+fmem_config_user_buf(fmem_cookie_t * pFMC, void * buf, ssize_t len);
+
+static bool
+fmem_alloc_buf(fmem_cookie_t * pFMC, ssize_t len);
+/* = = = END-STATIC-FORWARD = = = */
+
+#ifdef TEST_FMEMOPEN
+ static fmem_cookie_t* saved_cookie = NULL;
+#endif
+
+/**
+ * Convert a mode string into mode bits.
+ */
+static int
+fmem_getmode(char const * mode, mode_bits_t * pRes)
+{
+ if (mode == NULL)
+ return 1;
+
+ switch (*mode) {
+ case 'a': *pRes = FLAG_BIT(write) | FLAG_BIT(append);
+ break;
+ case 'w': *pRes = FLAG_BIT(write) | FLAG_BIT(truncate);
+ break;
+ case 'r': *pRes = FLAG_BIT(read);
+ break;
+ default: return EINVAL;
+ }
+
+ /*
+ * If someone wants to supply a "wxxbxbbxbb+" mode string, I don't care.
+ */
+ for (;;) {
+ switch (*++mode) {
+ case '+': *pRes |= FLAG_BIT(read) | FLAG_BIT(write);
+ if (mode[1] != NUL)
+ return EINVAL;
+ break;
+ case NUL: break;
+ case 'b': *pRes |= FLAG_BIT(binary); continue;
+ case 'x': continue;
+ default: return EINVAL;
+ }
+ break;
+ }
+
+ return 0;
+}
+
+/**
+ * Extend the space associated with an fmem file.
+ */
+static int
+fmem_extend(fmem_cookie_t *pFMC, size_t new_size)
+{
+ size_t ns = (new_size + (pFMC->pg_size - 1)) & (~(pFMC->pg_size - 1));
+
+ /*
+ * We can expand the buffer only if we are in append mode.
+ */
+ if (pFMC->mode & FLAG_BIT(fixed_size))
+ goto no_space;
+
+ if ((pFMC->mode & FLAG_BIT(allocated)) == 0) {
+ /*
+ * Previously, this was a user supplied buffer. We now move to one
+ * of our own. The user is responsible for the earlier memory.
+ */
+ void* bf = malloc(ns);
+ if (bf == NULL)
+ goto no_space;
+
+ memcpy(bf, pFMC->buffer, pFMC->buf_size);
+ pFMC->buffer = bf;
+ pFMC->mode |= FLAG_BIT(allocated);
+ }
+ else {
+ void* bf = realloc(pFMC->buffer, ns);
+ if (bf == NULL)
+ goto no_space;
+
+ pFMC->buffer = bf;
+ }
+
+ /*
+ * Unallocated file space is set to zeros. Emulate that.
+ */
+ memset(pFMC->buffer + pFMC->buf_size, 0, ns - pFMC->buf_size);
+ pFMC->buf_size = ns;
+ return 0;
+
+ no_space:
+ errno = ENOSPC;
+ return -1;
+}
+
+/**
+ * Handle file system callback to read data from our string.
+ */
+static ssize_t
+fmem_read(void *cookie, void *pBuf, size_t sz)
+{
+ fmem_cookie_t *pFMC = cookie;
+
+ if (pFMC->next_ix + sz > pFMC->eof) {
+ if (pFMC->next_ix >= pFMC->eof)
+ return (sz > 0) ? -1 : 0;
+ sz = pFMC->eof - pFMC->next_ix;
+ }
+
+ memcpy(pBuf, pFMC->buffer + pFMC->next_ix, sz);
+
+ pFMC->next_ix += sz;
+
+ return sz;
+}
+
+/**
+ * Handle file system callback to write data to our string
+ */
+static ssize_t
+fmem_write(void *cookie, const void *pBuf, size_t sz)
+{
+ fmem_cookie_t *pFMC = cookie;
+ int add_nul_char;
+
+ /*
+ * In append mode, always seek to the end before writing.
+ */
+ if (pFMC->mode & FLAG_BIT(append))
+ pFMC->next_ix = pFMC->eof;
+
+ /*
+ * Only add a NUL character if:
+ *
+ * * we are not in binary mode
+ * * there are data to write
+ * * the last character to write is not already NUL
+ */
+ add_nul_char =
+ ((pFMC->mode & FLAG_BIT(binary)) != 0)
+ && (sz > 0)
+ && (((char*)pBuf)[sz - 1] != NUL);
+
+ {
+ size_t next_pos = pFMC->next_ix + sz + add_nul_char;
+ if (next_pos > pFMC->buf_size) {
+ if (fmem_extend(pFMC, next_pos) != 0) {
+ /*
+ * We could not extend the memory. Try to write some data.
+ * Fail if we are either at the end or not writing data.
+ */
+ if ((pFMC->next_ix >= pFMC->buf_size) || (sz == 0))
+ return -1; /* no space at all. errno is set. */
+
+ /*
+ * Never add the NUL for a truncated write. "sz" may be
+ * unchanged or limited here.
+ */
+ add_nul_char = 0;
+ sz = pFMC->buf_size - pFMC->next_ix;
+ }
+ }
+ }
+
+ memcpy(pFMC->buffer + pFMC->next_ix, pBuf, sz);
+
+ pFMC->next_ix += sz;
+
+ /*
+ * Check for new high water mark and remember it. Add a NUL if
+ * we do that and if we have a new high water mark.
+ */
+ if (pFMC->next_ix > pFMC->eof) {
+ pFMC->eof = pFMC->next_ix;
+ if (add_nul_char)
+ /*
+ * There is space for this NUL. The "add_nul_char" is not part of
+ * the "sz" that was added to "next_ix".
+ */
+ pFMC->buffer[ pFMC->eof ] = NUL;
+ }
+
+ return sz;
+}
+
+/**
+ * Handle file system callback to set a new current position
+ */
+static seek_ret_t
+fmem_seek(void * cookie, seek_off_t offset, int dir)
+{
+ size_t new_pos;
+ fmem_cookie_t *pFMC = cookie;
+
+#ifdef HAVE_FOPENCOOKIE
+ /*
+ * GNU interface: offset passed and returned by address.
+ */
+ switch (dir) {
+ case SEEK_SET: new_pos = *offset; break;
+ case SEEK_CUR: new_pos = pFMC->next_ix + *offset; break;
+ case SEEK_END: new_pos = pFMC->eof - *offset; break;
+
+ default:
+ goto seek_oops;
+ }
+#else
+ /*
+ * BSD interface: offset passed by value, returned as retval.
+ */
+ switch (dir) {
+ case SEEK_SET: new_pos = offset; break;
+ case SEEK_CUR: new_pos = pFMC->next_ix + offset; break;
+ case SEEK_END: new_pos = pFMC->eof - offset; break;
+
+ default:
+ goto seek_oops;
+ }
+#endif
+
+ if ((signed)new_pos < 0)
+ goto seek_oops;
+
+ if (new_pos > pFMC->buf_size) {
+ if (fmem_extend(pFMC, new_pos))
+ return -1; /* errno is set */
+ }
+
+ pFMC->next_ix = new_pos;
+
+#ifdef HAVE_FOPENCOOKIE
+ *offset = (off64_t)new_pos;
+ return 0;
+#else
+ return new_pos;
+#endif
+
+ seek_oops:
+ errno = EINVAL;
+ return -1;
+}
+
+/**
+ * Free up the memory associated with an fmem file.
+ * If the user is managing the space, then the allocated bit is set.
+ */
+static int
+fmem_close(void * cookie)
+{
+ fmem_cookie_t * pFMC = cookie;
+ cookie_fp_map_t * pmap = (void *)map;
+ unsigned int mct = map_ct;
+
+ while (mct-- != 0) {
+ if (pmap->cookie == cookie) {
+ *pmap = map[--map_ct];
+ break;
+ }
+ pmap++;
+ }
+
+ if (mct > map_ct)
+ errno = EINVAL;
+
+ if (pFMC->mode & FLAG_BIT(allocated))
+ free(pFMC->buffer);
+ free(pFMC);
+
+ return 0;
+}
+
+/**
+ * Configure the user supplied buffer.
+ */
+static bool
+fmem_config_user_buf(fmem_cookie_t * pFMC, void * buf, ssize_t len)
+{
+ /*
+ * User allocated buffer. User responsible for disposal.
+ */
+ if (len == 0) {
+ free(pFMC);
+ errno = EINVAL;
+ return false;
+ }
+
+ pFMC->buffer = (buf_bytes_t*)buf;
+
+ /* Figure out where our "next byte" and EOF are.
+ * Truncated files start at the beginning.
+ */
+ if (pFMC->mode & FLAG_BIT(truncate)) {
+ /*
+ * "write" mode
+ */
+ pFMC->eof = \
+ pFMC->next_ix = 0;
+ }
+
+ else if (pFMC->mode & FLAG_BIT(binary)) {
+ pFMC->eof = len;
+ pFMC->next_ix = (pFMC->mode & FLAG_BIT(append)) ? len : 0;
+
+ } else {
+ /*
+ * append or read text mode -- find the end of the buffer
+ * (the first NUL character)
+ */
+ buf_bytes_t *p = (buf_bytes_t*)buf;
+
+ pFMC->eof = 0;
+ while ((*p != NUL) && (++(pFMC->eof) < (size_t)len)) p++;
+ pFMC->next_ix =
+ (pFMC->mode & FLAG_BIT(append)) ? pFMC->eof : 0;
+ }
+
+ /*
+ * text mode - NUL terminate buffer, if it fits.
+ */
+ if ( ((pFMC->mode & FLAG_BIT(binary)) == 0)
+ && (pFMC->next_ix < (size_t)len)) {
+ pFMC->buffer[pFMC->next_ix] = NUL;
+ }
+
+ pFMC->buf_size = len;
+ return true;
+}
+
+/**
+ * Allocate an initial buffer for fmem.
+ */
+static bool
+fmem_alloc_buf(fmem_cookie_t * pFMC, ssize_t len)
+{
+ /*
+ * We must allocate the buffer. If "len" is zero, set it to page size.
+ */
+ pFMC->mode |= FLAG_BIT(allocated);
+ if (len == 0)
+ len = pFMC->pg_size;
+
+ /*
+ * Unallocated file space is set to NULs. Emulate that.
+ */
+ pFMC->buffer = calloc((size_t)1, (size_t)len);
+ if (pFMC->buffer == NULL) {
+ errno = ENOMEM;
+ free(pFMC);
+ return false;
+ }
+
+ /*
+ * We've allocated the buffer. The end of file and next entry
+ * are both zero.
+ */
+ pFMC->next_ix = 0;
+ pFMC->eof = 0;
+ pFMC->buf_size = len;
+ return true;
+}
+
+/*=export_func ag_fmemopen
+ *
+ * what: Open a stream to a string
+ *
+ * arg: + void* + buf + buffer to use for i/o +
+ * arg: + ssize_t + len + size of the buffer +
+ * arg: + char* + mode + mode string, a la fopen(3C) +
+ *
+ * ret-type: FILE*
+ * ret-desc: a stdio FILE* pointer
+ *
+ * err: NULL is returned and errno is set to @code{EINVAL} or @code{ENOSPC}.
+ *
+ * doc:
+ *
+ * This function requires underlying @var{libc} functionality:
+ * either @code{fopencookie(3GNU)} or @code{funopen(3BSD)}.
+ *
+ * If @var{buf} is @code{NULL}, then a buffer is allocated. The initial
+ * allocation is @var{len} bytes. If @var{len} is less than zero, then the
+ * buffer will be reallocated as more space is needed. Any allocated
+ * memory is @code{free()}-ed when @code{fclose(3C)} is called.
+ *
+ * If @code{buf} is not @code{NULL}, then @code{len} must not be zero.
+ * It may still be less than zero to indicate that the buffer may
+ * be reallocated.
+ *
+ * The mode string is interpreted as follows. If the first character of
+ * the mode is:
+ *
+ * @table @code
+ * @item a
+ * Then the string is opened in "append" mode. In binary mode, "appending"
+ * will begin from the end of the initial buffer. Otherwise, appending will
+ * start at the first NUL character in the initial buffer (or the end of the
+ * buffer if there is no NUL character). Do not use fixed size buffers
+ * (negative @var{len} lengths) in append mode.
+ *
+ * @item w
+ * Then the string is opened in "write" mode. Any initial buffer is presumed
+ * to be empty.
+ *
+ * @item r
+ * Then the string is opened in "read" mode.
+ * @end table
+ *
+ * @noindent
+ * If it is not one of these three, the open fails and @code{errno} is
+ * set to @code{EINVAL}. These initial characters may be followed by:
+ *
+ * @table @code
+ * @item +
+ * The buffer is marked as updatable and both reading and writing is enabled.
+ *
+ * @item b
+ * The I/O is marked as "binary" and a trailing NUL will not be inserted
+ * into the buffer. Without this mode flag, one will be inserted after the
+ * @code{EOF}, if it fits. It will fit if the buffer is extensible (the
+ * provided @var{len} was negative). This mode flag has no effect if
+ * the buffer is opened in read-only mode.
+ *
+ * @item x
+ * This is ignored.
+ * @end table
+ *
+ * @noindent
+ * Any other letters following the inital 'a', 'w' or 'r' will cause an error.
+=*/
+FILE *
+ag_fmemopen(void * buf, ssize_t len, char const * mode)
+{
+ fmem_cookie_t *pFMC;
+
+ {
+ mode_bits_t bits;
+
+ if (fmem_getmode(mode, &bits) != 0) {
+ return NULL;
+ }
+
+ pFMC = malloc(sizeof(fmem_cookie_t));
+ if (pFMC == NULL) {
+ errno = ENOMEM;
+ return NULL;
+ }
+
+ pFMC->mode = bits;
+ }
+
+ /*
+ * Two more mode bits that do not come from the mode string:
+ * a negative size implies fixed size buffer and a NULL
+ * buffer pointer means we must allocate (and free) it.
+ */
+ if (len <= 0) {
+ /*
+ * We only need page size if we might extend an allocation.
+ */
+ len = -len;
+ pFMC->pg_size = getpagesize();
+ }
+
+ else {
+ pFMC->mode |= FLAG_BIT(fixed_size);
+ }
+
+ if (buf != NULL) {
+ if (! fmem_config_user_buf(pFMC, buf, len))
+ return NULL;
+
+ } else if ((pFMC->mode & (FLAG_BIT(append) | FLAG_BIT(truncate))) == 0) {
+ /*
+ * Not appending and not truncating. We must be reading.
+ * We also have no user supplied buffer. Nonsense.
+ */
+ errno = EINVAL;
+ free(pFMC);
+ return NULL;
+ }
+
+ else if (! fmem_alloc_buf(pFMC, len))
+ return NULL;
+
+#ifdef TEST_FMEMOPEN
+ saved_cookie = pFMC;
+#endif
+
+ {
+ FILE * res;
+
+ cookie_read_function_t* pRd = (pFMC->mode & FLAG_BIT(read))
+ ? (cookie_read_function_t*)fmem_read : NULL;
+ cookie_write_function_t* pWr = (pFMC->mode & FLAG_BIT(write))
+ ? (cookie_write_function_t*)fmem_write : NULL;
+
+#ifdef HAVE_FOPENCOOKIE
+ cookie_io_functions_t iof;
+ iof.read = pRd;
+ iof.write = pWr;
+ iof.seek = fmem_seek;
+ iof.close = fmem_close;
+
+ res = fopencookie(pFMC, mode, iof);
+#else
+ res = funopen(pFMC, pRd, pWr, fmem_seek, fmem_close);
+#endif
+ if (res == NULL)
+ return res;
+
+ if (++map_ct >= map_alloc_ct) {
+ void * p = (map_alloc_ct > 0)
+ ? realloc((void *)map, (map_alloc_ct += 4) * sizeof(*map))
+ : malloc((map_alloc_ct = 4) * sizeof(*map));
+
+ if (p == NULL) {
+ fclose(res);
+ errno = ENOMEM; /* "fclose" set it to "EINVAL". */
+ return NULL;
+ }
+
+ map = p;
+ }
+
+ {
+ cookie_fp_map_t * p = (void *)(map + map_ct - 1);
+ p->fp = res;
+ p->cookie = pFMC;
+ }
+
+ return res;
+ }
+}
+
+/*=export_func ag_fmemioctl
+ *
+ * what: perform an ioctl on a FILE* descriptor
+ *
+ * arg: + FILE* + fp + file pointer +
+ * arg: + int + req + ioctl command +
+ * arg: + ... + varargs + arguments for command +
+ *
+ * ret-type: int
+ * ret-desc: zero on success, otherwise error in errno
+ *
+ * err: errno is set to @code{EINVAL} or @code{ENOSPC}.
+ *
+ * doc:
+ *
+ * The file pointer passed in must have been returned by ag_fmemopen.
+=*/
+int
+ag_fmemioctl(FILE * fp, int req, ...)
+{
+ fmem_cookie_t * cookie;
+ fmemc_get_buf_addr_t * gba;
+
+ if ((unsigned int)req != IOCTL_FMEMC_GET_BUF_ADDR) {
+ /*
+ * It is not any of the IOCTL commands we know about.
+ */
+ errno = EINVAL;
+ return -1;
+ }
+
+ {
+ cookie_fp_map_t const * pmap = map;
+ unsigned int mct = map_ct;
+
+ for (;;) {
+ if (mct-- == 0) {
+ /*
+ * fmemopen didn't create this FILE*, so it is invalid.
+ */
+ errno = EINVAL;
+ return -1;
+ }
+ if (pmap->fp == fp)
+ break;
+ pmap++;
+ }
+
+ cookie = pmap->cookie;
+ }
+
+ {
+ va_list ap;
+ va_start(ap, req);
+ gba = va_arg(ap, fmemc_get_buf_addr_t *);
+ va_end(ap);
+ }
+
+ gba->buffer = (char *)(cookie->buffer);
+ gba->buf_size = cookie->buf_size;
+ gba->eof = cookie->eof;
+ if (gba->own != FMEMC_GBUF_LEAVE_OWNERSHIP)
+ cookie->mode &= ~FLAG_BIT(allocated);
+ return 0;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of fmemopen.c */
+#endif /* ENABLE_FMEMOPEN */
diff --git a/agen5/fsm-macro.tlib b/agen5/fsm-macro.tlib
new file mode 100644
index 0000000..24315ef
--- /dev/null
+++ b/agen5/fsm-macro.tlib
@@ -0,0 +1,402 @@
+[= AutoGen5 Template -*- Mode: Scheme -*-
+
+#; Time-stamp: "2012-03-31 17:04:56 bkorb"
+#;
+#; This file is part of AutoGen.
+#; AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+#;
+#; AutoGen is free software: you can redistribute it and/or modify it
+#; under the terms of the GNU General Public License as published by the
+#; Free Software Foundation, either version 3 of the License, or
+#; (at your option) any later version.
+#;
+#; AutoGen is distributed in the hope that it will be useful, but
+#; WITHOUT ANY WARRANTY; without even the implied warranty of
+#; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#; See the GNU General Public License for more details.
+#;
+#; You should have received a copy of the GNU General Public License along
+#; with this program. If not, see <http://www.gnu.org/licenses/>.
+
+=][=
+
+(define exit-proc (get "exit-proc" "exit"))
+
+=][=
+
+DEFINE emit-invalid-msg =][=
+
+ ;; "defs" indexes will be diverted.
+ (define tmp-text "")
+ (define str-table (string-append "z" Pfx "Strings"))
+ (string-table-new str-table)
+ (define add-tbl-str (lambda (ent-str)
+ (set! index-list (string-append index-list
+ (number->string (string-table-add str-table ent-str)) "\n" )) ))
+
+ (string-table-add str-table "** OUT-OF-RANGE **")
+
+ (ag-fprintf 0 "\n#define %sFsmErr_off %d\n" Pfx
+ (string-table-add str-table
+ "FSM Error: in state %d (%s), event %d (%s) is invalid\n"))
+
+ (define invalid-ix (string-table-add str-table "invalid"))
+ (ag-fprintf 0 "#define %sEvInvalid_off %d\n" Pfx invalid-ix)
+
+ (define index-list (sprintf "%d\n" (string-table-add str-table "init")))
+ (ag-fprintf 0 "#define %sStInit_off %s\n" Pfx index-list)
+
+ (out-push-new)
+
+=][=
+
+ FOR state =][=
+ (add-tbl-str (get-down "state")) =][=
+ ENDFOR state =][=
+
+ (ag-fprintf 0 "\nstatic const size_t asz%sStates[%d] = {\n"
+ Pfx (+ 1 (count "state")) )
+ (emit (shell (string-append
+ "${CLexe-columns} --spread=1 -I4 -S, <<_EOF_\n"
+ index-list
+ "_EOF_"
+ )))
+
+ (set! index-list "")
+
+ " };\n" =][=
+
+ FOR event =][=
+
+ (set! tmp-text (get "event"))
+ (set! tmp-text
+ (if (exist? tmp-text) (get tmp-text) (string-downcase! tmp-text)))
+ (add-tbl-str tmp-text)
+ =][=
+
+ ENDFOR event =][=
+
+ (ag-fprintf 0 "\nstatic const size_t asz%sEvents[%d] = {\n"
+ Pfx (+ 1 (count "event")) )
+
+ (emit (shell (string-append
+ "${CLexe-columns} --spread=1 -I4 -S, <<_EOF_\n"
+ index-list
+ (sprintf "%d\n" invalid-ix)
+ "_EOF_")))
+ (emit " };\n")
+
+ (out-suspend "strings")
+ (emit-string-table str-table)
+ (out-resume "strings")
+ (emit (out-pop #t)) =]
+
+#define [=(. PFX)
+ =]_EVT_NAME(t) ( (((unsigned)(t)) >= [=(+ 1 (count "event"))=]) \
+ ? z[=(. Pfx)=]Strings : z[=(. Pfx)
+ =]Strings + asz[=(. Pfx)=]Events[t])
+
+#define [=(. PFX)
+ =]_STATE_NAME(s) ( (((unsigned)(s)) >= [=(+ 1 (count "state"))=]) \
+ ? z[=(. Pfx)=]Strings : z[=(. Pfx)
+ =]Strings + asz[=(. Pfx)=]States[s])
+
+#ifndef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
+static int [=(. pfx)=]_invalid_transition( te_[=(. pfx)=]_state st, te_[=
+ (. pfx)=]_event evt );
+[=
+
+ IF (not (exist? "handler-file")) =]
+/* * * * * * * * * THE CODE STARTS HERE * * * * * * * *
+ *
+ * Print out an invalid transition message and return EXIT_FAILURE
+ */
+static int
+[=(. pfx)=]_invalid_transition( te_[=(. pfx)=]_state st, te_[=
+ (. pfx)=]_event evt )
+{
+[=
+(set! tmp-text (sprintf "\
+ char const * fmt = z%1$sStrings + %1$sFsmErr_off;
+ fprintf( stderr, fmt, st, %2$s_STATE_NAME(st), evt, %2$s_EVT_NAME(evt));"
+ Pfx PFX ))
+
+(extract fsm-source " /* %s == INVALID TRANS MSG == %s */" "" tmp-text)=]
+
+ return EXIT_FAILURE;
+}
+[=
+
+ ENDIF not exist handler-file =][=
+
+ENDDEF emit-invalid-msg
+
+;;; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE emit-cookie-args =][=
+ FOR cookie =]
+ [=cookie=],[=
+ ENDFOR =][=
+ENDDEF emit-cookie-args
+
+;;; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE build-callback =][=
+
+ CASE cb-name =][=
+ = noop =][=
+ * =]
+static te_[=(. pfx)=]_state
+[=cb_prefix=]_[=cb_name=]([= emit-cookie-args =]
+ te_[=(. pfx)=]_state initial,
+ te_[=(. pfx)=]_state maybe_next,
+ te_[=(. pfx)=]_event trans_evt )
+{
+[= (extract fsm-source (string-append
+"/* %s == " (string-tr! (get "cb_name") "a-z_-" "A-Z ") " == %s */" )
+""
+(if (= (get "cb-name") "invalid")
+ (string-append " " exit-proc "(" pfx
+ "_invalid_transition(initial, trans_evt));")
+ " return maybe_next;" )) =]
+}
+[=
+ ESAC =][=
+
+ENDDEF build-callback
+
+# # # # # # # =][=
+
+DEFINE callbacks =][=
+
+ `set -- \`sed 's/,//' ${tmp_dir}/xlist\`` =][=
+
+ WHILE `echo $#` =][=
+
+ INVOKE build-callback
+ cb_prefix = (string-append pfx "_do")
+ cb_name = (shell "echo $1 ; shift") =][=
+
+ ENDWHILE echo $# =][=
+
+ENDDEF callbacks
+
+# # # # # # # =][=
+
+DEFINE run-callback
+
+=]
+ if (pT != NULL)
+ nxtSt = (*pT)( [=
+ FOR cookie =][=
+ (shellf "echo '%s'|sed 's,.*[ \t*],,'" (get "cookie")) =], [=
+
+ ENDFOR =][=(. pfx)=]_state, nxtSt, trans_evt );[=
+
+ENDDEF run-callback
+
+;;; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE build-switch =]
+ case [=cb_prefix=]_[=cb_name=]:[=
+
+ IF (== (get "cb_name") "NOOP") =] break;[=
+ ELSE =]
+[=
+(set! example-code (if (= (get "cb_name") "invalid") (string-append
+ " " exit-proc "(" pfx "_invalid_transition(" pfx
+ "_state, trans_evt));")
+ (string-append " nxtSt = HANDLE_" (get "cb_name") "();") ))
+
+(extract fsm-source
+ (string-append " /* %s == " (get "cb_name") " == %s */")
+ "" example-code ) =]
+ break;
+
+[=ENDIF=][=
+
+ENDDEF build-switch
+
+;;; # # # # # =][=
+
+DEFINE run-switch =][=
+
+(define example-code "") =]
+
+ switch (trans) {[=
+ `set -- \`sed 's/,//' ${tmp_dir}/xlist\`` =][=
+
+ WHILE `echo $#` =][=
+
+ invoke build-switch
+ cb_prefix = (string-append PFX "_TR")
+ cb_name = (shell "echo $1 ; shift") =][=
+
+ ENDWHILE echo $# =]
+ default:
+[=(extract fsm-source " /* %s == BROKEN MACHINE == %s */" ""
+ (string-append " " exit-proc "(" pfx "_invalid_transition("
+ pfx "_state, trans_evt));" ))=]
+ }[=
+
+ENDDEF run-switch
+
+;;; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE preamble =][=
+
+IF (emit (dne " * " "/* "))
+ (== (suffix) "c") =][=
+
+(set! fsm-source (string-append tmp-dir "/fsm.code"))
+(set-writable) =][=
+
+ELSE =][=
+
+(make-tmp-dir)
+(define fsm-source (string-append tmp-dir "/fsm.header"))
+(shellf "test -f %1$s-fsm.h && cp %1$s-fsm.h ${tmp_dir}/fsm.header
+ test -f %1$s-fsm.c && cp %1$s-fsm.c ${tmp_dir}/fsm.code" (base-name))
+
+(define pfx (string->c-name! (string-downcase!
+ (if (exist? "prefix") (get "prefix") (base-name)) )))
+(define PFX (string-upcase pfx))
+(define Pfx (string-capitalize pfx))
+(define t-trans (string-append "t_" pfx "_transition"))
+
+=][=
+
+ENDIF =]
+ *
+ * Automated Finite State Machine
+ *
+[=(license-description "mbsd" "AutoFSM" " * " "Bruce Korb")=]
+ */[=
+
+ENDDEF preamble
+
+;;; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE compute-transitions =][=
+
+;;; Initialize every possible transition as invalid
+;;;
+(define tr-name (if (=* (get "method") "call")
+ (string-append pfx "_do_invalid")
+ (string-append PFX "_TR_INVALID") ))
+(shellf
+ "ev_list='%s' ; st_list='INIT %s'
+ for f in $ev_list ; do for g in $st_list
+ do eval FSM_TRANS_${g}_${f}=\"'{ %s_ST_INVALID, %s }'\"
+ export FSM_TRANS_${g}_${f}
+ done ; done"
+
+ (stack-up "event")
+ (stack-up "state")
+ PFX tr-name )
+
+(define tev "")
+(define tst "")
+(define ttype "")
+(define next "")
+(define proc-ptr-type
+ (lambda (tp)
+ (if (= tp "noop") "NULL"
+ (string-downcase! (string-append pfx "_do_" tp)) )))
+
+=][=#
+;;; Now replace the initial values with proper ones gotten from
+;;; the trasition definitions.
+;;;
+;;; It is actually possible to have multiple specifications for a
+;;; single state/event pair, however the last state/event assignment
+;;; will supply the value for the transition table. Different
+;;; transitions may also specify the same transition method.
+;;; For that, we unique sort the list and eliminate dups.
+;;; The unique-ified list is used to produce the callout table.
+;;;
+=][=
+FOR transition =][=
+
+ IF (== (get "tst") "*") =][=
+
+ ;; This transition applies for all states
+ ;;
+ (set! tev (get-up "tev"))
+ (set! ttype (if (exist? "ttype") (get "ttype")
+ (string-append "${f}_" tev) ))
+
+ (set! tr-name (if (=* (get "method") "call")
+ (proc-ptr-type ttype)
+ (string-upcase! (string-append PFX "_TR_" ttype)) ))
+ (set! next (if (exist? "next") (get-up "next") "${f}"))
+
+ (shellf
+ "for f in ${st_list} ; do F=${f}
+ eval FSM_TRANS_${f}_%s=\"'{ %s_ST_%s, %s }'\"
+ done"
+ tev PFX next tr-name ) =][=
+
+ ELIF (== (get "tev") "*") =][=
+
+ ;; This transition applies for all transitions in a certain state
+ ;;
+ (set! tst (get-up "tst"))
+ (set! ttype (if (exist? "ttype")
+ (get-up "ttype") (string-append tst "_${f}") ))
+
+ (set! tr-name (if (=* (get "method") "call")
+ (proc-ptr-type ttype)
+ (string-append PFX "_TR_" ttype) ))
+
+ (set! next (if (exist? "next") (get-up "next") tst))
+
+ (shellf
+ "for f in ${ev_list} ; do
+ eval FSM_TRANS_%s_${f}=\"'{ %s_ST_%s, %s }'\"
+ done"
+ tst PFX next tr-name) =][=
+
+ ELSE =][=
+
+ FOR tst =][=
+
+ (set! tst (get-up "tst"))
+ (set! next (if (exist? "next") (get-up "next") tst))
+
+ =][=
+ FOR tev =][=
+
+ (set! tev (get-up "tev"))
+ (set! ttype (string-downcase! (if (exist? "ttype") (get "ttype")
+ (string-append tst "_" tev) )))
+
+ (set! tr-name (if (=* (get "method") "call")
+ (proc-ptr-type ttype)
+ (string-upcase! (string-append PFX "_TR_" ttype)) ))
+
+ (shellf "FSM_TRANS_%s_%s=\"{ %s_ST_%s, %s }\""
+ tst tev PFX next tr-name) =][=
+
+ ENDFOR tev =][=
+ ENDFOR tst =][=
+ ENDIF tst or ttkn as '*' =][=
+ENDFOR transition =][=
+
+(define trans-ct
+ (shellf
+ "env | egrep '^FSM_TRANS_' | \
+ sed '/, NULL }/d;s/^.*%s//;s/ .*$/,/' | \
+ sort -u > ${tmp_dir}/xlist
+ echo `wc -l < ${tmp_dir}/xlist` "
+ (if (=* (get "method") "call")
+ (string-append pfx "_do_")
+ (string-append PFX "_TR_"))
+) ) =][=
+
+ENDDEF compute-transitions
+
+# end of agen5/fsm-macro.tlib =]
diff --git a/agen5/fsm-trans.tlib b/agen5/fsm-trans.tlib
new file mode 100644
index 0000000..0706910
--- /dev/null
+++ b/agen5/fsm-trans.tlib
@@ -0,0 +1,359 @@
+[= AutoGen5 Template -*- Mode: Text -*-
+
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+=][=
+(make-tmp-dir)
+
+(define get-up (lambda (nm)
+ (string-upcase! (string->c-name! (get nm))) ))
+
+(define get-down (lambda (nm)
+ (string-downcase! (string->c-name! (get nm))) ))
+
+(define stack-up (lambda (nm)
+ (string-upcase! (string->c-name! (join "\n" (stack nm)))) ))
+
+(define event-string "") =][=
+
+DEFINE state-table =]
+
+ /* STATE [= (get "st_ix") =]: [=
+ (define STATE-NAME (get-up "state"))
+ (shellf "state=%s" STATE-NAME)
+ (string-append PFX "_ST_" STATE-NAME) =] */
+ { [=
+
+ FOR event "\n " =][=
+ (set! event-string (get-up "event"))
+ (set! fmt (shellf "echo ${FSM_TRANS_%s_%s}%s"
+ STATE-NAME event-string (if (last-for?) "" ",") ))
+ (if (exist? event-string) (set! event-string (get event-string)))
+ (sprintf "%-47s /* EVT: %s */" fmt event-string ) =][=
+
+ ENDFOR
+
+=]
+ }[=
+
+ENDDEF state-table
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE enumerate-transitions =]
+/*
+ * Enumeration of the valid transition types
+ * Some transition types may be common to several transitions.
+ */
+typedef enum {
+[=(string-upcase! (shellf
+ "sed '$s/,$//;s/^/ %s_TR_/' ${tmp_dir}/xlist" PFX))=]
+} te_[=(. pfx)=]_trans;
+#define [=(. PFX)=]_TRANSITION_CT [=
+ `tct="\`wc -l < ${tmp_dir}/xlist\`"
+ echo $tct`=]
+
+/**
+ * State transition handling map. Map the state enumeration and the event
+ * enumeration to the new state and the transition enumeration code (in that
+ * order). It is indexed by first the current state and then the event code.
+ */
+typedef struct [=(. pfx)=]_transition [= (. t-trans) =];
+struct [=(. pfx)=]_transition {
+ te_[=(. pfx)=]_state next_state;
+ te_[=(. pfx)=]_trans transition;
+};
+[=
+
+ IF (exist? "use_ifdef")
+
+=]
+#ifndef DEFINE_FSM
+extern const [= (. t-trans) =] [=(. pfx)=]_trans_table[ [=(. PFX)
+=]_STATE_CT ][ [=(. PFX)=]_EVENT_CT ];
+
+extern int
+[=(. pfx)=]_invalid_transition( te_[=(. pfx)=]_state st, te_[=
+ (. pfx)=]_event evt );
+#else
+[=
+
+ ELSE
+
+=]static [=
+ ENDIF
+
+=]const [= (. t-trans) =]
+[=(. pfx)=]_trans_table[ [=(. PFX)
+=]_STATE_CT ][ [=(. PFX)=]_EVENT_CT ] = {[=
+ state-table
+ state = init
+ st_ix = "0" =][=
+
+ FOR state =],
+[= state-table st_ix = (+ 1 (for-index)) =][=
+ ENDFOR =]
+};[=
+
+ IF (exist? "use_ifdef") =][=
+ emit-invalid-msg =]
+#endif /* DEFINE_FSM */[=
+ ENDIF =][=
+
+ENDDEF enumerate-transitions
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE callback-transitions
+
+=]
+/**
+ * Callback routine prototype. They return the next state. Normally, that
+ * should be the value of the "maybe_next" argument.
+ */
+typedef te_[=(. pfx)=]_state ([=(. pfx)=]_callback_t)([=
+ emit-cookie-args =]
+ te_[=(. pfx)=]_state initial,
+ te_[=(. pfx)=]_state maybe_next,
+ te_[=(. pfx)=]_event trans_evt );
+
+static [=(. pfx)=]_callback_t
+[=(shellf "sed '$s/,$/;/;s/^/ %s_do_/' ${tmp_dir}/xlist" pfx)=]
+
+/**
+ * Declare all the state transition handling routines.
+ */
+typedef struct transition [= (. t-trans) =];
+struct transition {[=
+ (set! fmt (sprintf "\n %%-%ds %%s;"
+ (+ (string-length pfx) 14) ))
+ (sprintf (string-append fmt fmt)
+ (string-append "te_" pfx "_state") "next_state"
+ (string-append pfx "_callback_t*") "trans_proc") =]
+};
+
+/**
+ * State transition maps. Map the enumeration and the event enumeration
+ * to the new state and the transition enumeration code (in that order).
+ * It is indexed by first the current state and then the event code.
+ */
+static const [= (. t-trans) =]
+[=(. pfx)=]_trans_table[ [=(. PFX)
+=]_STATE_CT ][ [=(. PFX)=]_EVENT_CT ] = {[=
+
+ state-table
+ state = init st_ix = "0" =][=
+
+ FOR state =],[=
+ state-table st_ix = (+ 1 (for-index)) =][=
+ ENDFOR =]
+};[=
+
+ENDDEF callback-transitions
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE machine-step =][=
+
+(define trans-name "trans")
+(define trans-field "transition")
+(define trans-valu (string-append PFX "_TR_INVALID"))
+
+(if (not (=* (get "method") "case")) (begin
+ (set! trans-name "pT ")
+ (set! trans-field "trans_proc")
+ (set! trans-valu (string-append pfx "_do_invalid"))
+) )
+
+=]
+#ifndef __COVERITY__
+ if (trans_evt >= [=(. PFX)=]_EV_INVALID) {
+ nxtSt = [=(. PFX)=]_ST_INVALID;
+ [=(. trans-name)=] = [=(. trans-valu)=];
+ } else
+#endif /* __COVERITY__ */
+ {
+ const [= (. t-trans) =]* pTT =
+ [=(. pfx)=]_trans_table[ [=(. pfx)=]_state ] + trans_evt;
+[= IF (exist? "debug-flag") \=]
+#ifdef [= (get "debug-flag") =]
+ firstNext = /* next line */
+#endif /* [= "debug-flag =] */
+[= ENDIF \=]
+ nxtSt = pTT->next_state;
+ [=(. trans-name)=] = pTT->[=(. trans-field)=];
+ }
+[= IF (exist? "debug-flag") \=]
+#ifdef [= (get "debug-flag") =]
+ printf( "in state %s(%d) step %s(%d) to %s(%d)\n",
+ [=(. PFX)=]_STATE_NAME( [=(. pfx)=]_state ), [=(. pfx)=]_state,
+ [=(. PFX)=]_EVT_NAME( trans_evt ), trans_evt,
+ [=(. PFX)=]_STATE_NAME( nxtSt ), nxtSt );
+#endif /* [= "debug-flag =] */
+[= ENDIF \=][=
+
+ IF (not (=* (get "method") "case")) =][=
+ INVOKE run-callback =][=
+ ELIF (exist? "handler-file") =]
+#define FSM_SWITCH_CODE
+#include "[= handler-file =]"
+#undef FSM_SWITCH_CODE[=
+ ELSE =][=
+ INVOKE run-switch =][=
+ ENDIF
+
+=]
+[= IF (exist? "debug-flag") \=]
+#ifdef [= (get "debug-flag") =]
+ if (nxtSt != firstNext)
+ printf( "transition code changed destination state to %s(%d)\n",
+ [=(. PFX)=]_STATE_NAME( nxtSt ), nxtSt );
+#endif /* [= "debug-flag =] */
+[= ENDIF \=][=
+
+ IF (not (=* (get "type") "reent")) =]
+ [=(. pfx)=]_state = nxtSt;[=
+ ENDIF =]
+[=
+ENDDEF machine-step
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE fsm-proc-variables
+
+ =]
+[= IF (exist? "debug-flag") \=]
+#ifdef [= (get "debug-flag") =]
+ te_[=(. pfx)=]_state firstNext;
+#endif
+[= ENDIF \=]
+ te_[=(. pfx)=]_state nxtSt;[=
+ IF (=* (get "method") "call") =]
+ [=(. pfx)=]_callback_t* pT;[=
+ ELSE =]
+ te_[=(. pfx)=]_trans trans;[=
+ ENDIF =][=
+
+ENDDEF fsm-proc-variables
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE make-loop-proc =]
+/**
+ * Run the FSM. Will return [=(. PFX)=]_ST_DONE or [=(. PFX)=]_ST_INVALID
+ */
+[=mode=]te_[=(. pfx)=]_state
+[=(. pfx)=]_run_fsm([=
+ IF (exist? "cookie") =][=
+ FOR cookie "," =]
+ [=cookie=][=
+ ENDFOR=][=
+ ELSE=] void[=ENDIF=] )[=
+
+ENDDEF make-loop-proc
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE looping-machine
+
+ =][= make-loop-proc mode = "" =]
+{
+ te_[=(. pfx)=]_state [=(. pfx)=]_state = [=(. PFX)=]_ST_INIT;
+ te_[=(. pfx)=]_event trans_evt;[=
+ INVOKE fsm-proc-variables =][=
+ IF (exist? "cookie") =]
+[= (shell (string-append
+ "cookies='" (stack-join "\n" "cookie") "'
+ echo \"$cookies\" | \
+ sed -e 's/^/ /' \
+ -e 's@\\([a-zA-Z0-9_]*\\)*$@saved_\\1 = \\1;@'
+ echo \"$cookies\" | \
+ sed -e 's@.*[^a-z0-9_A-Z]\\([a-zA-Z0-9_]*\\)*$@\\1;@' \
+ -e 's/^/ (void)saved_/'" ))
+
+ =][=
+ ENDIF=]
+
+ while ([=(. pfx)=]_state < [=(. PFX)=]_ST_INVALID) {
+[=IF (exist? "handler-file")=]
+#define FSM_FIND_TRANSITION
+#include "[= handler-file =]"
+#undef FSM_FIND_TRANSITION[=
+ ELSE =]
+[=(extract fsm-source " /* %s == FIND TRANSITION == %s */" ""
+ " trans_evt = GET_NEXT_TRANS();" ) =][=
+ ENDIF =]
+[= (out-push-new (string-append tmp-dir "/cktbl"))=][=
+ INVOKE machine-step =][=
+ (out-pop) (shell
+ "sed 's/^ / /;s/ / /' ${tmp_dir}/cktbl")
+=]
+ }
+ return [=(. pfx)=]_state;
+}[=
+
+ENDDEF looping-machine
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE make-step-proc =]
+/**
+ * Step the FSM. Returns the resulting state. If the current state is
+ * [=(. PFX)=]_ST_DONE or [=(. PFX)=]_ST_INVALID, it resets to
+ * [=(. PFX)=]_ST_INIT and returns [=(. PFX)=]_ST_INIT.
+ */
+[=mode=]te_[=(. pfx)=]_state
+[=(. pfx)=]_step([=
+ IF (=* (get "type") "reent") =]
+ te_[= (. pfx) =]_state [= (. pfx) =]_state,[=
+ ENDIF =]
+ te_[= (. pfx) =]_event trans_evt[=
+ FOR cookie =],
+ [=cookie=][=
+ ENDFOR=] )[=
+
+ENDDEF make-step-proc
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE stepping-machine
+
+ =][= INVOKE make-step-proc mode = "" =]
+{[=
+ fsm-proc-variables =]
+
+ if ((unsigned)[=(. pfx)=]_state >= [=(. PFX)=]_ST_INVALID) {[=
+ IF (=* (get "type") "step") =]
+ [=(. pfx)=]_state = [=(. PFX)=]_ST_INIT;[=
+ ENDIF =]
+ return [=(. PFX)=]_ST_INIT;
+ }
+[=INVOKE machine-step =][=
+ IF (exist? "handler-file")=]
+#define FSM_FINISH_STEP
+#include "[= handler-file =]"
+#undef FSM_FINISH_STEP[=
+ ELSE =]
+[=(extract fsm-source " /* %s == FINISH STEP == %s */")=][=
+ ENDIF =]
+
+ return nxtSt;
+}[=
+
+ENDDEF stepping-machine
+
+# end of agen5/fsm-trans.tlib =]
diff --git a/agen5/fsm.tpl b/agen5/fsm.tpl
new file mode 100644
index 0000000..8039776
--- /dev/null
+++ b/agen5/fsm.tpl
@@ -0,0 +1,207 @@
+[= AutoGen5 Template -*- Mode: text -*-
+
+h=%s-fsm.h
+
+c=%s-fsm.c
+
+# Time-stamp: "2011-06-03 12:10:58 bkorb"
+
+## This file is part of AutoGen.
+## Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+## NB: THIS FILE IS GPL. THE OUTPUT OF THIS FILE IS LICENSED MBSD.
+
+(setenv "SHELL" "/bin/sh")
+
+=]
+[=
+
+CASE (suffix) =][=
+
+== h =][=
+
+ (define fmt "")
+ (define fsm-ver "0.1") =][=
+ INCLUDE "fsm-trans.tlib" =][=
+ INCLUDE "fsm-macro.tlib" =][=
+
+ INVOKE preamble
+
+=]
+/*
+ * This file enumerates the states and transition events for a FSM.
+ *
+ * te_[=(. pfx)=]_state
+ * The available states. FSS_INIT is always defined to be zero
+ * and FSS_INVALID and FSS_DONE are always made the last entries.
+ *
+ * te_[=(. pfx)=]_event
+ * The transition events. These enumerate the event values used
+ * to select the next state from the current state.
+ * [=(. PFX)=]_EV_INVALID is always defined at the end.
+ */
+[=(make-header-guard "autofsm")=]
+[=
+
+FOR extra-header "\n" \=]
+#include "[=extra-header=]"[=
+ENDFOR
+
+=]
+/*
+ * Finite State machine States
+ *
+ * Count of non-terminal states. The generated states INVALID and DONE
+ * are terminal, but INIT is not :-).
+ */
+#define [=(. PFX)=]_STATE_CT [=(+ 1 (count "state"))=]
+typedef enum {
+[=
+ (shell (string-append
+ "${CLexe-columns} --spread=1 -I4 -S, -f'" PFX "_ST_%s' <<_EOF_
+INIT
+" (stack-up "state") "
+INVALID
+DONE
+_EOF_" )) =]
+} te_[=(. pfx)=]_state;
+
+/*
+ * Finite State machine transition Events.
+ *
+ * Count of the valid transition events
+ */
+#define [=(. PFX)=]_EVENT_CT [=(count "event")=]
+typedef enum {
+[= compute-transitions =][=
+ (shellf "${CLexe-columns} --spread=1 -I4 -S, -f'%s_EV_%%s' <<_EOF_
+%s
+INVALID
+_EOF_" PFX (stack-up "event") )=]
+} te_[=(. pfx)=]_event;
+[=
+
+ CASE method =][=
+
+ ~* call|case =][=
+
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+ #
+ # We are implementing the machine. Declare the external =][=
+
+ CASE type =][=
+
+ ~* step|reent =][= make-step-proc mode = "extern " =];[=
+
+ =* loop =][= make-loop-proc mode = "extern " =];[=
+
+ * =][=
+ (error (string-append "invalid FSM type: ``" (get "type")
+ "'' must be ``looping'', ``stepping'' or ``reentrant''" ))
+ =][=
+ ESAC =][=
+
+ # End external procedure declarations
+ #
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+ #
+ # We are *NOT* implementing the machine. Define the table =][=
+
+ == "" =][=
+ enumerate-transitions use_ifdef = yes =][=
+ =* no =][=
+ enumerate-transitions use_ifdef = yes =][=
+ * =][=
+ (error (sprintf
+ "invalid FSM method: ``%s'' must be ``callout'', ``case'' or ``none''"
+ (get "method"))) =][=
+ ESAC =]
+
+#endif /* [=(. header-guard)=] */[=
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+#
+# C OUTPUT BEGINS HERE
+#
+=][=
+
+== c =][=
+
+ (if (~ (get "method") "(no.*){0,1}")
+ (out-delete) ) =][=
+
+ INVOKE preamble
+
+=]
+#define DEFINE_FSM
+#include "[=(. header-file)=]"
+#include <stdio.h>
+[=IF (exist? "handler-file")=]
+#define FSM_USER_HEADERS
+#include "[= handler-file =]"
+#undef FSM_USER_HEADERS[=
+ ELSE =]
+/*
+ * Do not make changes to this file, except between the START/END
+ * comments, or it will be removed the next time it is generated.
+ */
+[=(extract fsm-source "/* %s === USER HEADERS === %s */")=][=
+ ENDIF =]
+
+#ifndef NULL
+# define NULL 0
+#endif
+[= CASE method =][=
+ =* "case" =][= enumerate-transitions =][=
+ =* "call" =][= callback-transitions =][=
+ ESAC =]
+[=IF (=* (get "type") "step")=]
+/*
+ * The FSM machine state
+ */
+static te_[=(. pfx)=]_state [=(. pfx)=]_state = [=(. PFX)=]_ST_INIT;
+[=ENDIF=]
+[= emit-invalid-msg =][=
+
+ IF (=* (get "method") "call") =][=
+
+ IF (exist? "handler-file") =]
+#define FSM_HANDLER_CODE
+#include "[= handler-file =]"
+#undef FSM_HANDLER_CODE
+[=
+ ELSE =][=
+ INVOKE callbacks =][=
+ ENDIF =][=
+
+ ELSE =][=
+ ENDIF =][=
+
+ CASE type =][=
+ =* loop =][= looping-machine =][=
+ ~* step|reent =][= stepping-machine =][=
+ ESAC =][=
+
+ESAC (suffix)
+
+=]
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of [= (out-name) ;; agen5/fsm.tpl =] */
diff --git a/agen5/funcCase.c b/agen5/funcCase.c
new file mode 100644
index 0000000..b725d28
--- /dev/null
+++ b/agen5/funcCase.c
@@ -0,0 +1,1390 @@
+
+/**
+ * @file funcCase.c
+ *
+ * This module implements the CASE text function.
+ *
+ * Time-stamp: "2012-04-28 08:04:06 bkorb"
+ */
+/*
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#undef IS_LOW
+#define IS_LOW(c) (((c) <= 'z') && ((c) >= 'a'))
+
+#ifndef _toupper
+# ifdef __toupper
+# define _toupper(c) __toupper(c)
+# else
+# define _toupper(c) toupper(c)
+# endif
+#endif
+
+#define PTRUP(p) STMTS(if(IS_LOW(*(p))) *(p)=_toupper(*(p));(p)++)
+
+typedef tSuccess (tSelectProc)(char const * sample, char const * pattern);
+static tSelectProc
+ Select_Compare,
+ Select_Compare_End,
+ Select_Compare_Start,
+ Select_Compare_Full,
+ Select_Equivalent,
+ Select_Equivalent_End,
+ Select_Equivalent_Start,
+ Select_Equivalent_Full,
+ Select_Match,
+ Select_Match_End,
+ Select_Match_Start,
+ Select_Match_Full,
+ Select_Match_Always;
+
+/*
+ * This is global data used to keep track of the current CASE
+ * statement being processed. When CASE statements nest,
+ * these data are copied onto the stack and restored when
+ * the nested CASE statement's ESAC function is found.
+ */
+typedef struct case_stack tCaseStack;
+struct case_stack {
+ macro_t* pCase;
+ macro_t* pSelect;
+};
+
+static tCaseStack current_case;
+static load_proc_t mLoad_Select;
+
+static load_proc_p_t apCaseLoad[ FUNC_CT ] = { NULL };
+static load_proc_p_t apSelectOnly[ FUNC_CT ] = { NULL };
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+compile_re(regex_t* pRe, char const * pzPat, int flags);
+
+static inline void
+up_case(char* pz);
+
+static tSuccess
+Select_Compare(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Compare_End(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Compare_Start(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Compare_Full(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Equivalent(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Equivalent_End(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Equivalent_Start(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Equivalent_Full(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Match(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Match_End(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Match_Start(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Match_Full(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Match_Always(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Match_Existence(char const * sample, char const * pattern);
+
+static tSuccess
+Select_Match_NonExistence(char const * sample, char const * pattern);
+
+static bool
+selection_type_complete(templ_t * tpl, macro_t * mac, char const ** psrc);
+
+static macro_t *
+mLoad_Select(templ_t * tpl, macro_t * mac, char const ** pscan);
+/* = = = END-STATIC-FORWARD = = = */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+static void
+compile_re(regex_t* pRe, char const * pzPat, int flags)
+{
+ void * const pat = (void *)pzPat;
+ int rerr = regcomp(pRe, pat, flags);
+ if (rerr != 0) {
+ char zEr[ SCRIBBLE_SIZE ];
+ regerror(rerr, pRe, zEr, sizeof(zEr));
+ fprintf(stderr, BAD_RE_FMT, rerr, zEr, pzPat);
+ AG_ABEND(COMPILE_RE_BAD);
+ }
+}
+
+
+static inline void
+up_case(char* pz)
+{
+ while (*pz != NUL) PTRUP(pz);
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc string_contains_p
+ *
+ * what: substring match
+ * general_use:
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "*==*"
+ *
+ * doc: Test to see if a string contains a substring. "strstr(3)"
+ * will find an address.
+=*/
+static tSuccess
+Select_Compare(char const * sample, char const * pattern)
+{
+ return (strstr(sample, pattern)) ? SUCCESS : FAILURE;
+}
+
+SCM
+ag_scm_string_contains_p(SCM text, SCM substr)
+{
+ char* pzText = ag_scm2zchars(text, "text to match");
+ char* pzSubstr = ag_scm2zchars(substr, "match expr");
+
+ return (strstr(pzText, pzSubstr) == NULL) ? SCM_BOOL_F : SCM_BOOL_T;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc string_ends_with_p
+ *
+ * what: string ending
+ * general_use:
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "*=="
+ *
+ * doc: Test to see if a string ends with a substring.
+ * strcmp(3) returns zero for comparing the string ends.
+=*/
+static tSuccess
+Select_Compare_End(char const * sample, char const * pattern)
+{
+ size_t vlen = strlen(pattern);
+ size_t tlen = strlen(sample);
+ tSuccess res;
+
+ if (tlen < vlen)
+ res = FAILURE;
+ else if (strcmp(sample + (tlen - vlen), pattern) == 0)
+ res = SUCCESS;
+ else res = FAILURE;
+
+ return res;
+}
+
+SCM
+ag_scm_string_ends_with_p(SCM text, SCM substr)
+{
+ char* pzText = ag_scm2zchars(text, "text to match");
+ char* pzSubstr = ag_scm2zchars(substr, "match expr");
+ return (SUCCESSFUL(Select_Compare_End(pzText, pzSubstr)))
+ ? SCM_BOOL_T : SCM_BOOL_F;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc string_starts_with_p
+ *
+ * what: string starting
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "==*"
+ *
+ * doc: Test to see if a string starts with a substring.
+=*/
+static tSuccess
+Select_Compare_Start(char const * sample, char const * pattern)
+{
+ size_t vlen = strlen(pattern);
+ tSuccess res;
+
+ if (strncmp(sample, pattern, vlen) == 0)
+ res = SUCCESS;
+ else res = FAILURE;
+
+ return res;
+}
+
+SCM
+ag_scm_string_starts_with_p(SCM text, SCM substr)
+{
+ char* pzText = ag_scm2zchars(text, "text to match");
+ char* pzSubstr = ag_scm2zchars(substr, "match expr");
+ return (SUCCESSFUL(Select_Compare_Start(pzText, pzSubstr)))
+ ? SCM_BOOL_T : SCM_BOOL_F;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc string_equals_p
+ *
+ * what: string matching
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "=="
+ *
+ * doc: Test to see if two strings exactly match.
+=*/
+static tSuccess
+Select_Compare_Full(char const * sample, char const * pattern)
+{
+ return (strcmp(sample, pattern) == 0) ? SUCCESS : FAILURE;
+}
+
+SCM
+ag_scm_string_equals_p(SCM text, SCM substr)
+{
+ char* pzText = ag_scm2zchars(text, "text to match");
+ char* pzSubstr = ag_scm2zchars(substr, "match expr");
+
+ return (strcmp(pzText, pzSubstr) == 0) ? SCM_BOOL_T : SCM_BOOL_F;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc string_contains_eqv_p
+ *
+ * what: caseless substring
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "*=*"
+ *
+ * doc: Test to see if a string contains an equivalent string.
+ * `equivalent' means the strings match, but without regard
+ * to character case and certain characters are considered `equivalent'.
+ * Viz., '-', '_' and '^' are equivalent.
+=*/
+static tSuccess
+Select_Equivalent(char const * sample, char const * pattern)
+{
+ char* pz;
+ tSuccess res = SUCCESS;
+ AGDUPSTR(pz, sample, "equiv chars");
+ up_case(pz);
+ if (strstr(pz, pattern) == NULL)
+ res = FAILURE;
+ AGFREE((void*)pz);
+
+ return res;
+}
+
+SCM
+ag_scm_string_contains_eqv_p(SCM text, SCM substr)
+{
+ char * pzSubstr;
+ SCM res;
+
+ AGDUPSTR(pzSubstr, ag_scm2zchars(substr, "search"), "substr");
+
+ up_case(pzSubstr);
+ if (SUCCESSFUL(Select_Equivalent(ag_scm2zchars(text, "sample"),
+ pzSubstr)))
+ res = SCM_BOOL_T;
+ else res = SCM_BOOL_F;
+ AGFREE((void*)pzSubstr);
+ return res;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc string_ends_eqv_p
+ *
+ * what: caseless string ending
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "*="
+ *
+ * doc: Test to see if a string ends with an equivalent string.
+=*/
+static tSuccess
+Select_Equivalent_End(char const * sample, char const * pattern)
+{
+ size_t vlen = strlen(pattern);
+ size_t tlen = strlen(sample);
+
+ if (tlen < vlen)
+ return FAILURE;
+
+ return (streqvcmp(sample + (tlen - vlen), pattern) == 0)
+ ? SUCCESS
+ : FAILURE;
+}
+
+SCM
+ag_scm_string_ends_eqv_p(SCM text, SCM substr)
+{
+ char* pzText = ag_scm2zchars(text, "text to match");
+ char* pzSubstr = ag_scm2zchars(substr, "match expr");
+ return (SUCCESSFUL(Select_Equivalent_End( pzText, pzSubstr )))
+ ? SCM_BOOL_T : SCM_BOOL_F;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc string_starts_eqv_p
+ *
+ * what: caseless string start
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "=*"
+ *
+ * doc: Test to see if a string starts with an equivalent string.
+=*/
+static tSuccess
+Select_Equivalent_Start(char const * sample, char const * pattern)
+{
+ size_t vlen = strlen(pattern);
+
+ return (strneqvcmp(sample, pattern, (int)vlen) == 0)
+ ? SUCCESS
+ : FAILURE;
+}
+
+SCM
+ag_scm_string_starts_eqv_p(SCM text, SCM substr)
+{
+ char* pzText = ag_scm2zchars(text, "text to match");
+ char* pzSubstr = ag_scm2zchars(substr, "match expr");
+ return (SUCCESSFUL(Select_Equivalent_Start(pzText, pzSubstr)))
+ ? SCM_BOOL_T : SCM_BOOL_F;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc string_eqv_p
+ *
+ * what: caseless match
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "="
+ *
+ * doc: Test to see if two strings are equivalent. `equivalent' means the
+ * strings match, but without regard to character case and certain
+ * characters are considered `equivalent'. Viz., '-', '_' and '^' are
+ * equivalent. If the arguments are not strings, then the result of the
+ * numeric comparison is returned.
+ *
+ * This is an overloaded operation. If the arguments are both
+ * numbers, then the query is passed through to @code{scm_num_eq_p()},
+ * otherwise the result depends on the SCMs being strictly equal.
+=*/
+static tSuccess
+Select_Equivalent_Full(char const * sample, char const * pattern)
+{
+ return (streqvcmp(sample, pattern) == 0) ? SUCCESS : FAILURE;
+}
+
+SCM
+ag_scm_string_eqv_p(SCM text, SCM substr)
+{
+ /*
+ * We are overloading the "=" operator. Our arguments may be
+ * numbers or booleans...
+ */
+ teGuileType tt = ag_scm_type_e(text);
+ {
+ teGuileType st = ag_scm_type_e(substr);
+ if (st != tt)
+ return SCM_BOOL_F;
+ }
+
+ switch (tt) {
+ case GH_TYPE_NUMBER:
+ return scm_num_eq_p(text, substr);
+
+ case GH_TYPE_STRING:
+ {
+ char * pzText = ag_scm2zchars(text, "text");
+ char * pzSubstr = ag_scm2zchars(substr, "m expr");
+ return (streqvcmp(pzText, pzSubstr) == 0) ? SCM_BOOL_T : SCM_BOOL_F;
+ }
+
+ case GH_TYPE_BOOLEAN:
+ default:
+ return (text == substr) ? SCM_BOOL_T : SCM_BOOL_F;
+ }
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc string_has_match_p
+ *
+ * what: contained regex match
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "*~~*"
+ *
+ * doc: Test to see if a string contains a pattern.
+ * Case is significant.
+=*/
+/*=gfunc string_has_eqv_match_p
+ *
+ * what: caseless regex contains
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "*~*"
+ *
+ * doc: Test to see if a string contains a pattern.
+ * Case is not significant.
+=*/
+static tSuccess
+Select_Match(char const * sample, char const * pattern)
+{
+ /*
+ * On the first call for this macro, compile the expression
+ */
+ if (cur_macro->md_pvt == NULL) {
+ void * mat = (void *)pattern;
+ regex_t* pRe = AGALOC(sizeof(*pRe), "select match re");
+ compile_re(pRe, mat, (int)cur_macro->md_res);
+ cur_macro->md_pvt = (void*)pRe;
+ }
+
+ if (regexec((regex_t*)cur_macro->md_pvt, sample, (size_t)0,
+ NULL, 0) != 0)
+ return FAILURE;
+ return SUCCESS;
+}
+
+SCM
+ag_scm_string_has_match_p(SCM text, SCM substr)
+{
+ SCM res;
+ regex_t re;
+
+ compile_re(&re, ag_scm2zchars( substr, "match expr" ), REG_EXTENDED);
+
+ if (regexec(&re, ag_scm2zchars(text, "text to match"), (size_t)0,
+ NULL, 0) == 0)
+ res = SCM_BOOL_T;
+ else res = SCM_BOOL_F;
+ regfree(&re);
+
+ return res;
+}
+
+SCM
+ag_scm_string_has_eqv_match_p(SCM text, SCM substr)
+{
+ char* pzText = ag_scm2zchars(text, "text to match");
+ char* pzSubstr = ag_scm2zchars(substr, "match expr");
+ SCM res;
+ regex_t re;
+
+ compile_re(&re, pzSubstr, REG_EXTENDED | REG_ICASE);
+
+ if (regexec(&re, pzText, (size_t)0, NULL, 0) == 0)
+ res = SCM_BOOL_T;
+ else res = SCM_BOOL_F;
+ regfree(&re);
+
+ return res;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc string_end_match_p
+ *
+ * what: regex match end
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "*~~"
+ *
+ * doc: Test to see if a string ends with a pattern.
+ * Case is significant.
+=*/
+/*=gfunc string_end_eqv_match_p
+ *
+ * what: caseless regex ending
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "*~"
+ *
+ * doc: Test to see if a string ends with a pattern.
+ * Case is not significant.
+=*/
+static tSuccess
+Select_Match_End(char const * sample, char const * pattern)
+{
+ regmatch_t m[2];
+ /*
+ * On the first call for this macro, compile the expression
+ */
+ if (cur_macro->md_pvt == NULL) {
+ void * mat = (void *)pattern;
+ regex_t* pRe = AGALOC(sizeof(*pRe), "select match end re");
+ compile_re(pRe, mat, (int)cur_macro->md_res);
+ cur_macro->md_pvt = (void*)pRe;
+ }
+
+ if (regexec((regex_t*)cur_macro->md_pvt, sample, (size_t)2, m, 0)
+ != 0)
+ return FAILURE;
+ if (m[0].rm_eo != (int)strlen(sample))
+ return FAILURE;
+ return SUCCESS;
+}
+
+SCM
+ag_scm_string_end_match_p(SCM text, SCM substr)
+{
+ char* pzText = ag_scm2zchars(text, "text to match");
+ char* pzSubstr = ag_scm2zchars(substr, "match expr");
+ SCM res;
+ regex_t re;
+ regmatch_t m[2];
+
+ compile_re(&re, pzSubstr, REG_EXTENDED);
+
+ if (regexec(&re, pzText, (size_t)2, m, 0) != 0)
+ res = SCM_BOOL_F;
+ else if (m[0].rm_eo != (int)strlen(pzText))
+ res = SCM_BOOL_F;
+ else res = SCM_BOOL_T;
+
+ regfree(&re);
+
+ return res;
+}
+
+SCM
+ag_scm_string_end_eqv_match_p(SCM text, SCM substr)
+{
+ char* pzText = ag_scm2zchars(text, "text to match");
+ char* pzSubstr = ag_scm2zchars(substr, "match expr");
+ SCM res;
+ regex_t re;
+ regmatch_t m[2];
+
+ compile_re(&re, pzSubstr, REG_EXTENDED | REG_ICASE);
+
+ if (regexec(&re, pzText, (size_t)2, m, 0) != 0)
+ res = SCM_BOOL_F;
+ else if (m[0].rm_eo != (int)strlen(pzText))
+ res = SCM_BOOL_F;
+ else res = SCM_BOOL_T;
+
+ regfree(&re);
+
+ return res;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc string_start_match_p
+ *
+ * what: regex match start
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "~~*"
+ *
+ * doc: Test to see if a string starts with a pattern.
+ * Case is significant.
+=*/
+/*=gfunc string_start_eqv_match_p
+ *
+ * what: caseless regex start
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "~*"
+ *
+ * doc: Test to see if a string starts with a pattern.
+ * Case is not significant.
+=*/
+static tSuccess
+Select_Match_Start(char const * sample, char const * pattern)
+{
+ regmatch_t m[2];
+ /*
+ * On the first call for this macro, compile the expression
+ */
+ if (cur_macro->md_pvt == NULL) {
+ void * mat = (void *)pattern;
+ regex_t* pRe = AGALOC(sizeof(*pRe), "select match start re");
+ compile_re(pRe, mat, (int)cur_macro->md_res);
+ cur_macro->md_pvt = (void*)pRe;
+ }
+
+ if (regexec((regex_t*)cur_macro->md_pvt, sample, (size_t)2, m, 0)
+ != 0)
+ return FAILURE;
+ if (m[0].rm_so != 0)
+ return FAILURE;
+ return SUCCESS;
+}
+
+SCM
+ag_scm_string_start_match_p(SCM text, SCM substr)
+{
+ char* pzText = ag_scm2zchars(text, "text to match");
+ char* pzSubstr = ag_scm2zchars(substr, "match expr");
+ SCM res;
+ regex_t re;
+ regmatch_t m[2];
+
+ compile_re(&re, pzSubstr, REG_EXTENDED);
+
+ if (regexec(&re, pzText, (size_t)2, m, 0) != 0)
+ res = SCM_BOOL_F;
+ else if (m[0].rm_so != 0)
+ res = SCM_BOOL_F;
+ else res = SCM_BOOL_T;
+
+ regfree(&re);
+
+ return res;
+}
+
+SCM
+ag_scm_string_start_eqv_match_p(SCM text, SCM substr)
+{
+ char* pzText = ag_scm2zchars(text, "text to match");
+ char* pzSubstr = ag_scm2zchars(substr, "match expr");
+ SCM res;
+ regex_t re;
+ regmatch_t m[2];
+
+ compile_re(&re, pzSubstr, REG_EXTENDED | REG_ICASE);
+
+ if (regexec(&re, pzText, (size_t)2, m, 0) != 0)
+ res = SCM_BOOL_F;
+ else if (m[0].rm_so != 0)
+ res = SCM_BOOL_F;
+ else res = SCM_BOOL_T;
+
+ regfree(&re);
+
+ return res;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=gfunc string_match_p
+ *
+ * what: regex match
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "~~"
+ *
+ * doc: Test to see if a string fully matches a pattern.
+ * Case is significant.
+=*/
+/*=gfunc string_eqv_match_p
+ *
+ * what: caseless regex match
+ * general_use:
+ *
+ * exparg: text, text to test for pattern
+ * exparg: match, pattern/substring to search for
+ *
+ * string: "~"
+ *
+ * doc: Test to see if a string fully matches a pattern.
+ * Case is not significant, but any character equivalences
+ * must be expressed in your regular expression.
+=*/
+static tSuccess
+Select_Match_Full(char const * sample, char const * pattern)
+{
+ regmatch_t m[2];
+
+ /*
+ * On the first call for this macro, compile the expression
+ */
+ if (cur_macro->md_pvt == NULL) {
+ void * mat = (void *)pattern;
+ regex_t* pRe = AGALOC(sizeof(*pRe), "select match full re");
+
+ if (OPT_VALUE_TRACE > TRACE_EXPRESSIONS) {
+ fprintf(trace_fp, TRACE_SEL_MATCH_FULL,
+ pattern, cur_macro->md_res);
+ }
+ compile_re(pRe, mat, (int)cur_macro->md_res);
+ cur_macro->md_pvt = pRe;
+ }
+
+ if (regexec((regex_t*)cur_macro->md_pvt, sample, (size_t)2, m, 0)
+ != 0)
+ return FAILURE;
+
+ if ( (m[0].rm_eo != (int)strlen( sample ))
+ || (m[0].rm_so != 0))
+ return FAILURE;
+ return SUCCESS;
+}
+
+SCM
+ag_scm_string_match_p(SCM text, SCM substr)
+{
+ char* pzText = ag_scm2zchars(text, "text to match");
+ char* pzSubstr = ag_scm2zchars(substr, "match expr");
+ SCM res;
+ regex_t re;
+ regmatch_t m[2];
+
+ compile_re(&re, pzSubstr, REG_EXTENDED);
+
+ if (regexec(&re, pzText, (size_t)2, m, 0) != 0)
+ res = SCM_BOOL_F;
+ else if ( (m[0].rm_eo != (int)strlen(pzText))
+ || (m[0].rm_so != 0) )
+ res = SCM_BOOL_F;
+ else res = SCM_BOOL_T;
+
+ regfree(&re);
+
+ return res;
+}
+
+SCM
+ag_scm_string_eqv_match_p(SCM text, SCM substr)
+{
+ char* pzText = ag_scm2zchars(text, "text to match");
+ char* pzSubstr = ag_scm2zchars(substr, "match expr");
+ SCM res;
+ regex_t re;
+ regmatch_t m[2];
+
+ compile_re(&re, pzSubstr, REG_EXTENDED | REG_ICASE);
+
+ if (regexec(&re, pzText, (size_t)2, m, 0) != 0)
+ res = SCM_BOOL_F;
+ else if ( (m[0].rm_eo != (int)strlen(pzText))
+ || (m[0].rm_so != 0) )
+ res = SCM_BOOL_F;
+ else res = SCM_BOOL_T;
+
+ regfree(&re);
+
+ return res;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/**
+ * We don't bother making a Guile function for any of these :)
+ */
+static tSuccess
+Select_Match_Always(char const * sample, char const * pattern)
+{
+ (void)sample;
+ (void)pattern;
+ return SUCCESS;
+}
+
+/**
+ * If the "sample" addresses "zNil", then we couldn't find a value and
+ * defaulted to an empty string. So, the result is true if the sample
+ * address is anything except "zNil".
+ */
+static tSuccess
+Select_Match_Existence(char const * sample, char const * pattern)
+{
+ (void)pattern;
+ return (sample != no_def_str) ? SUCCESS : FAILURE;
+}
+
+/**
+ * If the "sample" addresses "zUndefined", then we couldn't find a value and
+ * defaulted to an empty string. So, the result false if the sample address
+ * is anything except "zUndefined".
+ */
+static tSuccess
+Select_Match_NonExistence(char const * sample, char const * pattern)
+{
+ (void)pattern;
+ return (sample == no_def_str) ? SUCCESS : FAILURE;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=macfunc CASE
+ *
+ * what: Select one of several template blocks
+ * handler_proc:
+ * load_proc:
+ *
+ * desc:
+ *
+ * The arguments are evaluated and converted to a string, if necessary. A
+ * simple name will be interpreted as an AutoGen value name and its value will
+ * be used by the @code{SELECT} macros (see the example below and the
+ * expression evaluation function, @pxref{EXPR}). The scope of the macro is
+ * up to the matching @code{ESAC} macro. Within the scope of a @code{CASE},
+ * this string is matched against case selection macros. There are sixteen
+ * match macros that are derived from four different ways matches may be
+ * performed, plus an "always true", "true if the AutoGen value was found",
+ * and "true if no AutoGen value was found" matches. The codes for the
+ * nineteen match macros are formed as follows:
+ *
+ * @enumerate
+ * @item
+ * Must the match start matching from the beginning of the string?
+ * If not, then the match macro code starts with an asterisk (@code{*}).
+ * @item
+ * Must the match finish matching at the end of the string?
+ * If not, then the match macro code ends with an asterisk (@code{*}).
+ * @item
+ * Is the match a pattern match or a string comparison?
+ * If a comparison, use an equal sign (@code{=}).
+ * If a pattern match, use a tilde (@code{~}).
+ * @item
+ * Is the match case sensitive?
+ * If alphabetic case is important, double the tilde or equal sign.
+ * @item
+ * Do you need a default match when none of the others match?
+ * Use a single asterisk (@code{*}).
+ * @item
+ * Do you need to distinguish between an empty string value and a value
+ * that was not found? Use the non-existence test (@code{!E}) before
+ * testing a full match against an empty string (@code{== ''}).
+ * There is also an existence test (@code{+E}), more for symmetry than
+ * for practical use.
+ * @end enumerate
+ *
+ * @noindent
+ * For example:
+ *
+ * @example
+ * [+ CASE <full-expression> +]
+ * [+ ~~* "[Tt]est" +]reg exp must match at start, not at end
+ * [+ == "TeSt" +]a full-string, case sensitive compare
+ * [+ = "TEST" +]a full-string, case insensitive compare
+ * [+ !E +]not exists - matches if no AutoGen value found
+ * [+ == "" +]expression yielded a zero-length string
+ * [+ +E +]exists - matches if there is any value result
+ * [+ * +]always match - no testing
+ * [+ ESAC +]
+ * @end example
+ *
+ * @code{<full-expression>} (@pxref{expression syntax}) may be any expression,
+ * including the use of apply-codes and value-names. If the expression yields
+ * a number, it is converted to a decimal string.
+ *
+ * These case selection codes have also been implemented as
+ * Scheme expression functions using the same codes. They are documented
+ * in this texi doc as ``string-*?'' predicates (@pxref{Common Functions}).
+=*/
+/*=macfunc ESAC
+ *
+ * what: Terminate the @code{CASE} Template Block
+ * in-context:
+ *
+ * desc:
+ * This macro ends the @code{CASE} function template block.
+ * For a complete description, @xref{CASE}.
+=*/
+macro_t *
+mFunc_Case(templ_t* pT, macro_t* pMac)
+{
+ typedef tSuccess (t_match_proc)(char const *, char const *);
+ /*
+ * There are only 15 procedures because the case insenstive matching
+ * get mapped into the previous four. The last three are "match always",
+ * "match if a value was found" "match if no value found".
+ */
+ static t_match_proc * const match_procs[] = {
+ &Select_Compare_Full,
+ &Select_Compare_End,
+ &Select_Compare_Start,
+ &Select_Compare,
+
+ &Select_Equivalent_Full,
+ &Select_Equivalent_End,
+ &Select_Equivalent_Start,
+ &Select_Equivalent,
+
+ &Select_Match_Full,
+ &Select_Match_End,
+ &Select_Match_Start,
+ &Select_Match,
+
+ &Select_Match_Always,
+ &Select_Match_Existence,
+ &Select_Match_NonExistence
+ };
+
+ static char const * const match_names[] = {
+ "COMPARE_FULL",
+ "COMPARE_END",
+ "COMPARE_START",
+ "CONTAINS",
+
+ "EQUIVALENT_FULL",
+ "EQUIVALENT_END",
+ "EQUIVALENT_START",
+ "EQUIV_CONTAINS",
+
+ "MATCH_FULL",
+ "MATCH_END",
+ "MATCH_START",
+ "MATCH_WITHIN",
+
+ "MATCH_ALWAYS",
+ "MATCH_EXISTENCE",
+ "MATCH_NONEXISTENCE"
+ };
+
+ macro_t * end_mac = pT->td_macros + pMac->md_end_idx;
+ bool free_txt;
+ char const * samp_text = eval_mac_expr(&free_txt);
+
+ /*
+ * Search through the selection clauses until we either
+ * reach the end of the list for this CASE macro, or we match.
+ */
+ for (;;) {
+ tSuccess mRes;
+ pMac = pT->td_macros + pMac->md_sib_idx;
+ if (pMac >= end_mac) {
+ if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS) {
+ fprintf(trace_fp, TRACE_CASE_FAIL, samp_text);
+
+ if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
+ fprintf(trace_fp, TAB_FILE_LINE_FMT,
+ current_tpl->td_file, pMac->md_line);
+ }
+
+ break;
+ }
+
+ /*
+ * The current macro becomes the selected selection macro
+ */
+ cur_macro = pMac;
+ mRes = (*(match_procs[pMac->md_code & 0x0F])
+ )(samp_text, pT->td_text + pMac->md_txt_off);
+
+ /*
+ * IF match, THEN generate and stop looking for a match.
+ */
+ if (SUCCEEDED(mRes)) {
+ if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS) {
+ fprintf(trace_fp, TRACE_CASE_MATCHED,
+ samp_text,
+ match_names[pMac->md_code & 0x0F],
+ pT->td_text + pMac->md_txt_off);
+
+ if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
+ fprintf(trace_fp, TAB_FILE_LINE_FMT,
+ current_tpl->td_file, pMac->md_line);
+ }
+
+ gen_block(pT, pMac + 1, pT->td_macros + pMac->md_sib_idx);
+ break;
+ }
+ else if (OPT_VALUE_TRACE == TRACE_EVERYTHING) {
+ fprintf(trace_fp, TRACE_CASE_NOMATCH,
+ samp_text,
+ match_names[pMac->md_code & 0x0F],
+ pT->td_text + pMac->md_txt_off);
+ }
+ }
+
+ if (free_txt)
+ AGFREE((void*)samp_text);
+
+ return end_mac;
+}
+
+/*
+ * mLoad_CASE
+ *
+ * This function is called to set up (load) the macro
+ * when the template is first read in (before processing).
+ */
+macro_t *
+mLoad_Case(templ_t* pT, macro_t* pMac, char const ** ppzScan)
+{
+ size_t srcLen = (size_t)pMac->md_res; /* macro len */
+ tCaseStack save_stack = current_case;
+ macro_t* pEsacMac;
+
+ /*
+ * Save the global macro loading mode
+ */
+ load_proc_p_t const * papLP = load_proc_table;
+
+ /*
+ * IF there is no associated text expression
+ * THEN woops! what are we to case on?
+ */
+ if (srcLen == 0)
+ AG_ABEND_IN(pT, pMac, LD_CASE_NO_EXPR);
+
+ /*
+ * Load the expression
+ */
+ (void)mLoad_Expr(pT, pMac, ppzScan);
+
+ /*
+ * IF this is the first time here,
+ * THEN set up the "CASE" mode callout tables.
+ * It is the standard table, except entries are inserted
+ * for SELECT and ESAC.
+ */
+ if (apCaseLoad[0] == NULL) {
+ int i;
+
+ /*
+ * Until there is a selection clause, only comment and select
+ * macros are allowed.
+ */
+ for (i=0; i < FUNC_CT; i++)
+ apSelectOnly[i] = mLoad_Bogus;
+
+ memcpy((void*)apCaseLoad, base_load_table, sizeof( base_load_table ));
+ apSelectOnly[ FTYP_COMMENT] = mLoad_Comment;
+ apSelectOnly[ FTYP_SELECT ] = \
+ apCaseLoad[ FTYP_SELECT ] = mLoad_Select;
+ apCaseLoad[ FTYP_ESAC ] = mLoad_Ending;
+ }
+
+ /*
+ * Set the "select macro only" loading mode
+ */
+ load_proc_table = apSelectOnly;
+
+ /*
+ * Save global pointers to the current macro entry.
+ * We will need this to link the CASE, SELECT and ESAC
+ * functions together.
+ */
+ current_case.pCase = current_case.pSelect = pMac;
+
+ /*
+ * Continue parsing the template from this nested level
+ */
+ pEsacMac = parse_tpl(pMac+1, ppzScan);
+ if (*ppzScan == NULL)
+ AG_ABEND_IN(pT, pMac, LD_CASE_NO_ESAC);
+
+ /*
+ * Tell the last select macro where its end is.
+ * (It ends with the "next" sibling. Since there
+ * is no "next" at the end, it is a tiny lie.)
+ *
+ * Also, make sure the CASE macro knows where the end is.
+ */
+ pMac->md_end_idx = \
+ current_case.pSelect->md_sib_idx = (pEsacMac - pT->td_macros);
+
+ /*
+ * Restore any enclosing CASE function's context.
+ */
+ current_case = save_stack;
+
+ /*
+ * Restore the global macro loading mode
+ */
+ load_proc_table = papLP;
+
+ /*
+ * Return the next available macro descriptor
+ */
+ return pEsacMac;
+}
+
+/**
+ * Figure out the selection type. Return "true" (it is complete) if
+ * no argument is required. That is, if it is a "match anything" or
+ * an existence/non-existence test.
+ *
+ * @param[in] tpl The active template
+ * @param[in,out] mac The selection macro structure
+ * @param[out] psrc The scan pointer for the selection argument
+ */
+static bool
+selection_type_complete(templ_t * tpl, macro_t * mac, char const ** psrc)
+{
+ char const * src = (char*)mac->md_txt_off;
+ mac_func_t fcode = FTYP_SELECT_COMPARE_FULL;
+
+ /*
+ * IF the first character is an asterisk,
+ * THEN the match can start anywhere in the string
+ */
+ if (*src == '*') {
+ src++;
+ if (IS_END_TOKEN_CHAR(*src)) {
+ mac->md_code = FTYP_SELECT_MATCH_ANYTHING;
+ goto leave_done;
+ }
+
+ fcode = (mac_func_t)(
+ (unsigned int)FTYP_SELECT_COMPARE_FULL |
+ (unsigned int)FTYP_SELECT_COMPARE_SKP_START);
+ }
+
+ /*
+ * The next character must indicate whether we are
+ * pattern matching ('~') or doing string compares ('=')
+ */
+ switch (*src++) {
+ case '~':
+ /*
+ * Or in the pattern matching bit
+ */
+ fcode = (mac_func_t)(
+ (unsigned int)fcode | (unsigned int)FTYP_SELECT_MATCH_FULL);
+ mac->md_res = REG_EXTENDED;
+ /* FALLTHROUGH */
+
+ case '=':
+ /*
+ * IF the '~' or '=' is doubled,
+ * THEN it is a case sensitive match. Skip over the char.
+ * ELSE or in the case insensitive bit
+ */
+ if (src[0] == src[-1]) {
+ src++;
+ } else {
+ fcode = (mac_func_t)(
+ (unsigned int)fcode |
+ (unsigned int)FTYP_SELECT_EQUIVALENT_FULL);
+ }
+ break;
+
+ case '!':
+ case '+':
+ switch (*src) {
+ case 'e':
+ case 'E':
+ break;
+ default:
+ goto bad_sel;
+ }
+ if (! IS_END_TOKEN_CHAR(src[1]))
+ goto bad_sel;
+
+ mac->md_code = (src[-1] == '!')
+ ? FTYP_SELECT_MATCH_NONEXISTENCE
+ : FTYP_SELECT_MATCH_EXISTENCE;
+
+ goto leave_done;
+
+ default:
+ bad_sel:
+ AG_ABEND_IN(tpl, mac, LD_SEL_INVAL);
+ }
+
+ /*
+ * IF the last character is an asterisk,
+ * THEN the match may end before the test string ends.
+ * OR in the "may end early" bit.
+ */
+ if (*src == '*') {
+ src++;
+ fcode = (mac_func_t)(
+ (unsigned int)fcode |
+ (unsigned int)FTYP_SELECT_COMPARE_SKP_END);
+ }
+
+ if (! IS_END_TOKEN_CHAR(*src))
+ AG_ABEND_IN(tpl, mac, LD_SEL_INVAL);
+
+ mac->md_code = fcode;
+ *psrc = SPN_WHITESPACE_CHARS(src);
+ return false;
+
+ leave_done:
+
+ /*
+ * md_code has been set. Zero out md_txt_off to indicate
+ * no argument text. NULL the selection argument pointer.
+ */
+ mac->md_txt_off = 0;
+ *psrc = NULL;
+ return true;
+}
+
+/*=macfunc SELECT
+ *
+ * what: Selection block for CASE function
+ * in-context:
+ * alias: | ~ | = | * | ! | + |
+ * unload-proc:
+ *
+ * desc:
+ * This macro selects a block of text by matching an expression
+ * against the sample text expression evaluated in the @code{CASE}
+ * macro. @xref{CASE}.
+ *
+ * You do not specify a @code{SELECT} macro with the word ``select''.
+ * Instead, you must use one of the 19 match operators described in
+ * the @code{CASE} macro description.
+=*/
+static macro_t *
+mLoad_Select(templ_t * tpl, macro_t * mac, char const ** pscan)
+{
+ char const * sel_arg;
+ long arg_len = mac->md_res; /* macro len */
+
+ /*
+ * Set the global macro loading mode
+ */
+ load_proc_table = apCaseLoad;
+ mac->md_res = 0;
+ if (arg_len == 0)
+ AG_ABEND_IN(tpl, mac, LD_SEL_EMPTY);
+
+ if (selection_type_complete(tpl, mac, &sel_arg))
+ goto selection_done;
+
+ arg_len -= (intptr_t)sel_arg - mac->md_txt_off;
+ if (arg_len <= 0)
+ AG_ABEND_IN(tpl, mac, LD_SEL_INVAL);
+
+ /*
+ * See if we are doing case insensitive regular expressions
+ * Turn off the case comparison mode for regular expressions.
+ * We don't have to worry about it. It is done for us.
+ */
+ if ( ((int)mac->md_code & (int)FTYP_SELECT_EQV_MATCH_FULL)
+ == (int)FTYP_SELECT_EQV_MATCH_FULL) {
+
+ static unsigned int const bits =
+ ~( unsigned int)FTYP_SELECT_EQUIVALENT_FULL
+ | (unsigned int)FTYP_SELECT_COMPARE_FULL;
+
+ mac->md_res = REG_EXTENDED | REG_ICASE;
+ mac->md_code = (mac_func_t)((unsigned int)mac->md_code & bits);
+ }
+
+ /*
+ * Copy the selection expression, double NUL terminate.
+ */
+ {
+ char * dest = tpl->td_scan;
+ char const * svdest = dest;
+ mac->md_txt_off = (dest - tpl->td_text);
+ if (mac->md_code == FTYP_SELECT_EQUIVALENT) {
+ do {
+ *(dest++) = toupper((uint8_t)*(sel_arg++));
+ } while (--arg_len > 0);
+ } else {
+ memcpy(dest, sel_arg, arg_len);
+ dest += arg_len;
+ }
+ *(dest++) = NUL;
+ *(dest++) = NUL;
+ tpl->td_scan = dest;
+
+ /*
+ * If the value is a quoted string, strip the quotes and
+ * process the string (backslash fixup).
+ */
+ if ((*svdest == '"') || (*svdest == '\''))
+ span_quote((void *)svdest);
+ }
+
+ selection_done:
+ /*
+ * Link this selection macro to the list of selectors for CASE.
+ */
+ current_case.pSelect->md_sib_idx = (mac - tpl->td_macros);
+ current_case.pSelect = (macro_t*)mac;
+
+ return mac + 1;
+}
+
+/**
+ * Free data for a selection macro. Regular expression selections
+ * allocate the compiled re.
+ */
+void
+mUnload_Select(macro_t * mac)
+{
+ if (mac->md_pvt != NULL) {
+ regex_t * regexp = (regex_t*)mac->md_pvt;
+ regfree(regexp);
+ AGFREE(regexp);
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/funcCase.c */
diff --git a/agen5/funcDef.c b/agen5/funcDef.c
new file mode 100644
index 0000000..80906bd
--- /dev/null
+++ b/agen5/funcDef.c
@@ -0,0 +1,899 @@
+
+/**
+ * @file funcDef.c
+ *
+ * This module implements the DEFINE text function.
+ *
+ * Time-stamp: "2012-04-07 09:47:37 bkorb"
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+typedef int (tCmpProc)(const void*, const void*);
+
+typedef struct def_list def_list_t;
+struct def_list {
+ def_ent_t de;
+ char* pzExpr;
+};
+
+/* = = = START-STATIC-FORWARD = = = */
+static int
+order_def_list(const void* p1, const void* p2);
+
+static def_list_t *
+link_twins(def_list_t * pDL, def_list_t * pNext, int* pCt);
+
+static uint_t
+count_named_values(templ_t * pT, macro_t * mac);
+
+static char *
+gather_assigned_value(char * pzScan, def_list_t * pDL);
+
+static void
+fill_in_values(def_list_t * pDL, char * pzScan, templ_t * pT, macro_t * mac);
+
+static void
+prep_invoke_args(macro_t * mac);
+
+static void
+build_defs(int def_ct, def_list_t * def_list);
+
+static templ_t *
+new_template(templ_t * base_tpl, macro_t * mac, char const * scan);
+
+static void
+load_define_tpl(templ_t * tpl, char const ** ppzScan);
+/* = = = END-STATIC-FORWARD = = = */
+
+static int
+order_def_list(const void* p1, const void* p2)
+{
+ def_ent_t * pDL1 = (def_ent_t*)p1;
+ def_ent_t * pDL2 = (def_ent_t*)p2;
+ int cmp = streqvcmp(pDL1->de_name, pDL2->de_name);
+
+ /*
+ * IF the names are the same, then we order them based on which name
+ * appears first. Do not reorder entries with the same name.
+ */
+ if (cmp == 0)
+ cmp = (int)(pDL1->de_name - pDL2->de_name);
+ return cmp;
+}
+
+static def_list_t *
+link_twins(def_list_t * pDL, def_list_t * pNext, int* pCt)
+{
+ def_list_t * pN;
+ int ct = *pCt;
+ int idx = 1;
+
+ pDL->de.de_twin = &(pNext->de);
+ pNext->de.de_ptwin = &(pDL->de);
+
+ for (;;) {
+ pNext->de.de_index = idx++;
+ pN = pNext + 1; /* We return this, valid or not */
+ if (--ct <= 0) /* count each successive twin */
+ break;
+ if (streqvcmp(pNext->de.de_name, pN->de.de_name) != 0)
+ break;
+
+ /*
+ * We have found another twin. Link it in and advance
+ */
+ pNext->de.de_twin = &(pN->de);
+ pN->de.de_ptwin = &(pNext->de);
+ pNext = pN;
+ }
+
+ pDL->de.de_etwin = &(pNext->de);
+ pNext->de.de_twin = NULL; /* NULL terminated list */
+ pDL->de.de_ptwin = NULL; /* NULL terminated list */
+ *pCt = ct;
+ pDL->de.de_next = NULL; /* in case ct == 0 */
+ return pN; /* If ct is zero, then this is invalid */
+}
+
+
+static uint_t
+count_named_values(templ_t * pT, macro_t * mac)
+{
+ char * pzScan = pT->td_text + mac->md_txt_off;
+ uint_t ct = 0;
+
+ while (*pzScan != NUL) {
+ ct++;
+ if (! IS_VAR_FIRST_CHAR(*pzScan)) {
+ fprintf(stderr, NAMED_VALUES_WHERE, ct, pzScan);
+ AG_ABEND_IN(pT, mac, NAMED_VALUES_NO_NAME);
+ }
+
+ pzScan = SPN_VALUE_NAME_CHARS(pzScan);
+ pzScan = SPN_WHITESPACE_CHARS(pzScan);
+ if (*pzScan != '=')
+ continue;
+ pzScan = SPN_WHITESPACE_CHARS(pzScan+1);
+ pzScan = (char*)skip_expr(pzScan, strlen(pzScan));
+ pzScan = SPN_WHITESPACE_CHARS(pzScan);
+ }
+
+ return ct;
+}
+
+
+static char *
+gather_assigned_value(char * pzScan, def_list_t * pDL)
+{
+ pzScan = SPN_WHITESPACE_CHARS(pzScan);
+ strtransform(pDL->de.de_name, pDL->de.de_name);
+ pDL->pzExpr = pzScan;
+ pDL->de.de_type = VALTYP_TEXT;
+ pzScan = (char*)skip_expr(pzScan, strlen(pzScan));
+
+ /*
+ * Figure out what kind of expression we have
+ */
+ switch (*pDL->pzExpr) {
+ case ';':
+ case '(':
+ /*
+ * These expressions will need evaluation
+ */
+ break;
+
+ case '`':
+ {
+ char* pz;
+ /*
+ * Process the quoted string, but leave a '`' marker, too
+ */
+ AGDUPSTR(pz, pDL->pzExpr, "macro arg expr");
+ span_quote(pz);
+ strcpy(pDL->pzExpr+1, pz);
+ AGFREE((void*)pz);
+ break;
+ }
+ case '"':
+ case '\'':
+ /*
+ * Process the quoted strings now
+ */
+ if ((pzScan - pDL->pzExpr) < 24) {
+ char* pz = (char*)AGALOC(24, "quoted string");
+ memcpy((void*)pz, pDL->pzExpr, (size_t)(pzScan - pDL->pzExpr));
+ pDL->pzExpr = pz;
+ }
+ span_quote(pDL->pzExpr);
+ /* FALLTHROUGH */
+
+ default:
+ /*
+ * Default: the raw sequence of characters is the value
+ */
+ pDL->de.de_val.dvu_text = pDL->pzExpr;
+ pDL->pzExpr = NULL;
+ }
+
+ return pzScan;
+}
+
+
+static void
+fill_in_values(def_list_t * pDL, char * pzScan, templ_t * pT, macro_t * mac)
+{
+ for (;; pDL++ ) {
+ pDL->de.de_name = pzScan;
+ pzScan = SPN_VALUE_NAME_CHARS(pzScan);
+
+ switch (*pzScan) {
+ case NUL:
+ pDL->de.de_val.dvu_text = (char*)zNil;
+ return;
+
+ default:
+ AG_ABEND_IN(pT, mac, FILL_IN_VAL_NO_ASSIGN);
+
+ case ' ': case TAB: case NL: case '\f':
+ *(pzScan++) = NUL;
+ pzScan = SPN_WHITESPACE_CHARS(pzScan);
+
+ /*
+ * The name was separated by space, but has no value
+ */
+ if (*pzScan != '=') {
+ pDL->de.de_val.dvu_text = (char*)zNil;
+ if (*pzScan == NUL)
+ return;
+ continue;
+ }
+ /* FALLTHROUGH */
+
+ case '=':
+ *(pzScan++) = NUL;
+ }
+
+ /*
+ * When we arrive here, we have just clobbered a '=' char.
+ * Now we have gather up the assigned value.
+ */
+ pzScan = gather_assigned_value(pzScan, pDL);
+
+ /*
+ * IF the next char is NUL, we are done.
+ * OTHERWISE, the next character must be a space
+ */
+ if (*pzScan == NUL)
+ break;
+
+ if (! IS_WHITESPACE_CHAR(*pzScan))
+ AG_ABEND_IN(pT, mac, FILL_IN_VAL_NO_SEP);
+
+ /*
+ * Terminate the string value and skip over any additional space
+ */
+ *(pzScan++) = NUL;
+ pzScan = SPN_WHITESPACE_CHARS(pzScan);
+ }
+}
+
+/*
+ * parse_mac_args
+ *
+ * This routine is called just before the first call to mFunc_Define
+ * for a particular macro invocation. It scans the text of the invocation
+ * for name-value assignments that are only to live for the duration
+ * of the processing of the user defined macro.
+ */
+LOCAL void
+parse_mac_args(templ_t * pT, macro_t * mac)
+{
+ char * pzScan = pT->td_text + mac->md_txt_off;
+ uint_t ct;
+ def_list_t * pDL;
+ def_list_t * pN;
+
+ /*
+ * If there is no argument text, then the arg count is zero.
+ */
+ if (mac->md_txt_off == 0) {
+ mac->md_res = 0;
+ return;
+ }
+
+ ct = count_named_values(pT, mac);
+
+ /*
+ * The result is zero if we don't have any
+ */
+ mac->md_sib_idx = ct;
+ if (ct == 0) {
+ mac->md_txt_off = 0;
+ mac->md_res = 0;
+ return;
+ }
+
+ /*
+ * Allocate the array of definition descriptors
+ */
+ pzScan = pT->td_text + mac->md_txt_off;
+ pDL = (def_list_t *)AGALOC(ct * sizeof(def_list_t), "array of def desc");
+ memset((void*)pDL, 0, ct * sizeof(def_list_t));
+ mac->md_res = (uintptr_t)pDL;
+
+ /*
+ * Fill in the array of value assignments
+ */
+ fill_in_values(pDL, pzScan, pT, mac);
+
+ if (ct > 1) {
+ /*
+ * There was more than one value assignment.
+ * Sort them just so we know the siblings are together.
+ * Order is preserved by comparing string addresses,
+ * if the strings compare equal.
+ */
+ pDL = (def_list_t *)mac->md_res;
+ qsort((void*)pDL, (size_t)ct, sizeof(def_list_t), order_def_list);
+
+ /*
+ * Now, link them all together. Singly linked list.
+ */
+ for (;;) {
+ if (--ct == 0) {
+ pDL->de.de_next = NULL;
+ break;
+ }
+
+ pN = pDL + 1;
+
+ /*
+ * IF the next entry has the same name,
+ * THEN it is a "twin". Link twins on the twin list.
+ */
+ if (streqvcmp(pDL->de.de_name, pN->de.de_name) == 0) {
+ pN = link_twins(pDL, pN, (int*)&ct);
+ if (ct <= 0)
+ break; /* pN is now invalid */
+ }
+
+ pDL->de.de_next = &(pN->de);
+ pDL = pN;
+ }
+ }
+}
+
+/**
+ * prepare the args for INVOKE macro.
+ * See if there's any text following the name of the DEFINE macro to invoke.
+ * If there is, then set up the arguments now so it's easy to deal with
+ * next time around. The name of the macro to invoke may be dynamic.
+ * "skip_expr" skips over either a name or a scheme expression that
+ * is supposed to yield a name.
+ *
+ * @param mac the macro structure describing the invocation
+ */
+static void
+prep_invoke_args(macro_t * mac)
+{
+ char * pzText;
+ templ_t * pT = current_tpl;
+
+ if (mac->md_txt_off == 0)
+ AG_ABEND_IN(pT, mac, PREP_INVOKE_NO_NAME);
+ mac->md_name_off = mac->md_txt_off;
+ pzText = pT->td_text + mac->md_txt_off;
+ pzText = (char*)skip_expr(pzText, strlen(pzText));
+
+ /*
+ * IF there is no more text,
+ * THEN there are no arguments
+ */
+ if (*pzText == NUL) {
+ mac->md_txt_off = 0;
+ mac->md_res = 0;
+ }
+
+ /*
+ * OTHERWISE, skip to the start of the text and process
+ * the arguments to the macro
+ */
+ else {
+ if (! IS_WHITESPACE_CHAR(*pzText))
+ AG_ABEND_IN(pT, mac, PREP_INVOKE_NO_SEP);
+ *pzText = NUL;
+ pzText = SPN_WHITESPACE_CHARS(pzText + 1);
+ mac->md_txt_off = pzText - pT->td_text;
+ parse_mac_args(pT, mac);
+ current_tpl = pT;
+ }
+}
+
+/*=macfunc DEBUG
+ *
+ * handler-proc:
+ * load-proc:
+ *
+ * what: Print debug message to trace output
+ * desc:
+ *
+ * If the tracing level is at "debug-message" or above
+ * (@pxref{autogen trace}), this macro prints a debug message to trace
+ * output. This message is not evaluated. This macro can also be used to
+ * set useful debugger breakpoints. By inserting [+DEBUG n+] into your
+ * template, you can set a debugger breakpoint on the #n case element
+ * below (in the AutoGen source) and step through the processing of
+ * interesting parts of your template.
+ *
+ * To be useful, you have to have access to the source tree where autogen
+ * was built and the template being processed. The definitions are also
+ * helpful, but not crucial. Please contact the author if you think you
+ * might actually want to use this.
+=*/
+macro_t *
+mFunc_Debug(templ_t * pT, macro_t * mac)
+{
+ static int dummy = 0;
+ char const * pz = pT->td_text + mac->md_txt_off;
+ int for_index = (curr_ivk_info->ii_for_depth <= 0)
+ ? -1
+ : curr_ivk_info->ii_for_data[ curr_ivk_info->ii_for_depth-1].for_index;
+
+ fprintf(trace_fp, FN_DEBUG, pz, for_index);
+
+ /*
+ * The case element values were chosen to thwart most
+ * optimizers that might be too bright for its own good.
+ * (`dummy' is write-only and could be ignored)
+ */
+ do {
+ if (IS_DEC_DIGIT_CHAR(*pz)) {
+ for_index = atoi(pz);
+ break;
+ }
+ } while (*(pz++) != NUL);
+
+ if (for_index < 0)
+ for_index = -1;
+
+ switch (for_index) {
+ case -1: dummy = 'X'; break;
+ case 0: dummy = 'A'; break;
+ case 1: dummy = 'u'; break;
+ case 2: dummy = 't'; break;
+ case 3: dummy = 'o'; break;
+ case 4: dummy = 'G'; break;
+ case 5: dummy = 'e'; break;
+ case 6: dummy = 'n'; break;
+ case 7: dummy = 'N'; break;
+ case 8: dummy = 'U'; break;
+ case 9: dummy = 'T'; break;
+ case 10: dummy = '.'; break;
+ default: dummy++;
+ }
+ if (IS_GRAPHIC_CHAR(dummy))
+ fprintf(trace_fp, FN_DEBUG_GRAPHIC, dummy);
+ putc(NL, trace_fp);
+ return mac+1;
+}
+
+/**
+ * Build up a definition context.
+ * It is created by passed-in macro arguments.
+ *
+ * @param def_ct number of definitions
+ * @param def_list list of definitions
+ */
+static void
+build_defs(int def_ct, def_list_t * def_list)
+{
+ curr_def_ctx.dcx_defent = &(def_list->de);
+
+ /*
+ * FOR each definition, evaluate the associated expression
+ * and set the text value to it.
+ */
+ do {
+ if (def_list->pzExpr == NULL)
+ continue;
+
+ retryExpression:
+ switch (*(def_list->pzExpr)) {
+ case ';':
+ {
+ char* pz = strchr(def_list->pzExpr, NL);
+ if (pz != NULL) {
+ pz = SPN_WHITESPACE_CHARS(pz + 1);
+ def_list->pzExpr = pz;
+ goto retryExpression;
+ }
+ /* FALLTHROUGH */
+ }
+ case NUL:
+ def_list->pzExpr = NULL;
+ def_list->de.de_val.dvu_text = (char*)zNil;
+ break;
+
+ case '(':
+ {
+ SCM res;
+
+ /*
+ * It is a scheme expression. Accept only string
+ * and number results.
+ */
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS) {
+ fprintf(trace_fp, TRACE_BUILD_DEFS,
+ cur_macro->md_sib_idx - def_ct, def_list->pzExpr);
+ }
+
+ res = ag_eval(def_list->pzExpr);
+ if (AG_SCM_STRING_P(res)) {
+ AGDUPSTR(def_list->de.de_val.dvu_text,
+ ag_scm2zchars(res, "res"), "ev res");
+ }
+ else if (AG_SCM_NUM_P(res)) {
+ def_list->de.de_val.dvu_text = AGALOC(16, "num buf");
+ snprintf(def_list->de.de_val.dvu_text, (size_t)16,
+ BUILD_DEFS_LONG_FMT, AG_SCM_TO_ULONG(res));
+ }
+ else
+ AGDUPSTR(def_list->de.de_val.dvu_text, zNil, "nil str");
+ break;
+ }
+
+ case '`':
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS) {
+ fprintf(trace_fp, TRACE_BUILD_DEFS,
+ cur_macro->md_sib_idx - def_ct, def_list->pzExpr+1);
+ }
+ def_list->de.de_val.dvu_text = shell_cmd(def_list->pzExpr+1);
+ break;
+ }
+ } while (def_list++, --def_ct > 0);
+}
+
+/*=macfunc DEFINE
+ *
+ * what: Define a user AutoGen macro
+ * cindex: define macro
+ * handler_proc:
+ * load_proc:
+ * unload-proc:
+ *
+ * desc:
+ *
+ * This function will define a new macro. You must provide a name for the
+ * macro. You do not specify any arguments, though the invocation may
+ * specify a set of name/value pairs that are to be active during the
+ * processing of the macro.
+ *
+ * @example
+ * [+ define foo +]
+ * ... macro body with macro functions ...
+ * [+ enddef +]
+ * ... [+ foo bar='raw text' baz=<<text expression>> +]
+ * @end example
+ *
+ * Once the macro has been defined, this new macro can be invoked by
+ * specifying the macro name as the first token after the start macro marker.
+ * Alternatively, you may make the invocation explicitly invoke a defined
+ * macro by specifying @code{INVOKE} (@pxref{INVOKE}) in the macro
+ * invocation. If you do that, the macro name can be computed with an
+ * expression that gets evaluated every time the INVOKE macro is encountered.
+ *
+ * Any remaining text in the macro invocation will be used to create new
+ * name/value pairs that only persist for the duration of the processing of
+ * the macro. The expressions are evaluated the same way basic
+ * expressions are evaluated. @xref{expression syntax}.
+ *
+ * The resulting definitions are handled much like regular
+ * definitions, except:
+ *
+ * @enumerate
+ * @item
+ * The values may not be compound. That is, they may not contain
+ * nested name/value pairs.
+ * @item
+ * The bindings go away when the macro is complete.
+ * @item
+ * The name/value pairs are separated by whitespace instead of
+ * semi-colons.
+ * @item
+ * Sequences of strings are not concatenated.
+ * @end enumerate
+ *
+ * @quotation
+ * @strong{NB:} The macro is extracted from the template as the template is
+ * scanned. You cannot conditionally define a macro by enclosing it in an
+ * @code{IF}/@code{ENDIF} (@pxref{IF}) macro pair. If you need to dynamically
+ * select the format of a @code{DEFINE}d macro, then put the flavors into
+ * separate template files that simply define macros. @code{INCLUDE}
+ * (@pxref{INCLUDE}) the appropriate template when you have computed which
+ * you need.
+ * @end quotation
+ *
+ * Due to this, it is acceptable and even a good idea to place all the
+ * @code{DEFINE} macros at the end of the template. That puts the main
+ * body of the template at the beginning of the file.
+=*/
+/*=macfunc ENDDEF
+ *
+ * what: Ends a macro definition.
+ * in-context:
+ *
+ * desc:
+ * This macro ends the @code{DEFINE} function template block.
+ * For a complete description @xref{DEFINE}.
+=*/
+/**
+ * This routine runs the invocation of a defined macro.
+ *
+ * @param tpl not used
+ * @param[in] mac the macro that holds the data for the defined macro
+ */
+macro_t *
+mFunc_Define(templ_t * tpl, macro_t * mac)
+{
+ def_list_t * pList = (def_list_t *)mac->md_res;
+ int defCt = mac->md_sib_idx;
+ def_ctx_t ctx;
+
+ if (OPT_VALUE_TRACE > TRACE_NOTHING) {
+ tpl = (templ_t*)mac->md_pvt;
+
+ fprintf(trace_fp, TPL_INVOKED, tpl->td_name, defCt);
+ if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
+ fprintf(trace_fp, TAB_FILE_LINE_FMT,
+ current_tpl->td_file, mac->md_line);
+ }
+
+ /*
+ * IF we have no special definitions, then do not nest definitions
+ */
+ if (defCt != 0) {
+ ctx = curr_def_ctx;
+ curr_def_ctx.dcx_prev = &ctx;
+ build_defs(defCt, pList);
+ }
+
+ gen_new_block((templ_t*)mac->md_pvt);
+
+ if (defCt != 0)
+ curr_def_ctx = ctx;
+
+ if ((defCt = mac->md_sib_idx) > 0) {
+ pList = (def_list_t *)mac->md_res;
+ while (defCt-- > 0) {
+ if (pList->pzExpr != NULL) {
+ AGFREE((void*)pList->de.de_val.dvu_text);
+ pList->de.de_val.dvu_text = NULL;
+ }
+ pList++;
+ }
+ }
+
+ return mac+1;
+}
+
+/**
+ * unload a defined macro
+ *
+ * @param[in,out] mac macro containing the data to unload
+ */
+void
+mUnload_Define(macro_t * mac)
+{
+ void * p = (void*)(mac->md_res);
+ if (p != NULL)
+ AGFREE(p);
+}
+
+/*=macfunc INVOKE
+ *
+ * handler_proc:
+ * what: Invoke a User Defined Macro
+ *
+ * desc:
+ *
+ * User defined macros may be invoked explicitly or implicitly.
+ * If you invoke one implicitly, the macro must begin with the
+ * name of the defined macro. Consequently, this may @strong{not}
+ * be a computed value. If you explicitly invoke a user defined macro,
+ * the macro begins with the macro name @code{INVOKE} followed by
+ * a @i{basic expression} that must yield a known user defined macro.
+ * A macro name _must_ be found, or AutoGen will issue a diagnostic
+ * and exit.
+ *
+ * Arguments are passed to the invoked macro by name.
+ * The text following the macro name must consist of a series of
+ * names each of which is followed by an equal sign (@code{=}) and
+ * a @i{basic expression} that yields a string.
+ *
+ * The string values may contain template macros that are parsed
+ * the first time the macro is processed and evaluated again every
+ * time the macro is evaluated.
+=*/
+macro_t *
+mFunc_Invoke(templ_t * tpl, macro_t * mac)
+{
+ /*
+ * IF this is the first time through,
+ * THEN separate the name from the rest of the arguments.
+ */
+ if (mac->md_name_off == 0) {
+ prep_invoke_args(mac);
+
+ /*
+ * IF the name is constant and not an expression,
+ * THEN go find the template now and bind the macro call
+ * to a particular template macro
+ */
+ if (IS_VAR_FIRST_CHAR(tpl->td_text[ mac->md_name_off ])) {
+ mac->md_code = FTYP_DEFINE;
+ mac->md_pvt = (void*)find_tpl(tpl->td_text + mac->md_name_off);
+
+ if (mac->md_pvt == NULL) {
+ char const * p = tpl->td_text + mac->md_name_off;
+ AG_ABEND_IN(tpl, mac, aprf(BAD_MAC_NM_FMT, p));
+ /* NOTREACHED */
+ }
+
+ return mFunc_Define(tpl, mac);
+ }
+ }
+
+ /*
+ * Call `eval' to determine the macro name. Every invocation
+ * may be different!!
+ */
+ {
+ SCM macName = eval(tpl->td_text + mac->md_name_off);
+ char * pz = ag_scm2zchars(macName, "mac name");
+ templ_t * ntpl = find_tpl(pz);
+ if (ntpl == NULL) {
+ pz = aprf(BAD_MAC_NM_FMT, pz);
+ AG_ABEND_IN(tpl, mac, pz);
+ /* NOTREACHED */
+ }
+
+ mac->md_pvt = (void*)ntpl;
+ }
+ return mFunc_Define(tpl, mac);
+}
+
+/**
+ * Loads the debug function for load time breakpoints.
+ * @param pT containing template
+ * @param pMac the debug macro data
+ * @param ppzSan pointer to scanning pointer
+ * @returns the next open macro slot
+ */
+macro_t *
+mLoad_Debug(templ_t * pT, macro_t * pMac, char const ** ppzScan)
+{
+ if (OPT_VALUE_TRACE >= TRACE_DEBUG_MESSAGE)
+ return mLoad_Unknown(pT, pMac, ppzScan);
+ return mLoad_Comment(pT, pMac, ppzScan);
+}
+
+static templ_t *
+new_template(templ_t * base_tpl, macro_t * mac, char const * scan)
+{
+ templ_t * ntpl;
+ char * copy;
+ char const * src = (char const *)mac->md_txt_off;
+ int ct = base_tpl->td_mac_ct - (mac - base_tpl->td_macros);
+ size_t aloc_sz =
+ sizeof(*ntpl) + (ct * sizeof(macro_t)) + strlen(scan) + 0x100;
+ aloc_sz &= ~0x0F;
+
+ /*
+ * Allocate a new template block that is much larger than needed.
+ */
+ ntpl = (templ_t*)AGALOC(aloc_sz, "new tpl");
+ memset((void*)ntpl, 0, aloc_sz);
+ ntpl->td_magic = base_tpl->td_magic;
+ ntpl->td_size = aloc_sz;
+ ntpl->td_mac_ct = ct;
+ ntpl->td_file = strdup(base_tpl->td_file);
+
+ copy = ntpl->td_name = (void*)(ntpl->td_macros + ct);
+ if (! IS_VAR_FIRST_CHAR(*src))
+ AG_ABEND_IN(base_tpl, mac, LD_DEF_NEED_NAME);
+
+ while (IS_VALUE_NAME_CHAR(*src))
+ *(copy++) = *(src++);
+
+ *(copy++) = NUL;
+
+ if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS)
+ fprintf(trace_fp, TRACE_MACRO_DEF, ntpl->td_name, ntpl->td_file);
+
+ ntpl->td_text = copy;
+ ntpl->td_scan = copy+1;
+ strcpy(ntpl->td_start_mac, base_tpl->td_start_mac);
+ strcpy(ntpl->td_end_mac, base_tpl->td_end_mac);
+ current_tpl = ntpl;
+
+ return ntpl;
+}
+
+static void
+load_define_tpl(templ_t * tpl, char const ** ppzScan)
+{
+ macro_t * last_mac = parse_tpl(tpl->td_macros, ppzScan);
+ int ct;
+
+ /*
+ * Make sure all of the input string was *NOT* scanned.
+ */
+ if (*ppzScan == NULL)
+ AG_ABEND_IN(tpl, tpl->td_macros, LD_DEF_WOOPS);
+
+ ct = last_mac - tpl->td_macros;
+
+ /*
+ * IF there are empty macro slots,
+ * THEN pack the text
+ */
+ if (ct < tpl->td_mac_ct) {
+ int delta = sizeof(macro_t) * (tpl->td_mac_ct - ct);
+ void * data = (tpl->td_name == NULL) ? tpl->td_text : tpl->td_name;
+ size_t size = tpl->td_scan - (char*)data;
+ memmove((void*)last_mac, data, size);
+
+ tpl->td_text -= delta;
+ tpl->td_scan -= delta;
+ tpl->td_name -= delta;
+ tpl->td_mac_ct = ct;
+ }
+}
+
+macro_t *
+mLoad_Define(templ_t * ori_tpl, macro_t * mac, char const ** p_scan)
+{
+ static load_proc_p_t apDefineLoad[ FUNC_CT ] = { NULL };
+
+ templ_t * new_tpl;
+
+ /**
+ * Save the global macro loading mode
+ */
+ load_proc_p_t const * save_load_procs = load_proc_table;
+
+ if (mac->md_txt_off == 0)
+ AG_ABEND_IN(ori_tpl, mac, LD_DEF_NEED_NAME);
+
+ /*
+ * IF this is the first time here, THEN set up the "DEFINE" block
+ * callout table. It is the standard table, except entries are
+ * inserted for functions that are enabled only while processing
+ * a DEFINE block (viz. "ENDDEF" and removing "DEFINE").
+ */
+ if (apDefineLoad[0] == NULL) {
+ memcpy((void*)apDefineLoad, base_load_table, sizeof(base_load_table));
+ apDefineLoad[ FTYP_ENDDEF ] = &mLoad_Ending;
+ apDefineLoad[ FTYP_DEFINE ] = &mLoad_Bogus;
+ }
+
+ load_proc_table = apDefineLoad;
+ defining_macro = true;
+ new_tpl = new_template(ori_tpl, mac, *p_scan);
+ load_define_tpl(new_tpl, p_scan);
+ defining_macro = false;
+
+ /*
+ * Adjust the sizes. Remove absolute pointers. Reallocate to the correct
+ * size. Restore the offsets to pointer values.
+ */
+ {
+ size_t sz = new_tpl->td_scan - (char*)new_tpl;
+ if (sz < new_tpl->td_size) {
+ new_tpl->td_size = sz;
+ new_tpl->td_name -= (long)new_tpl;
+ new_tpl->td_text -= (long)new_tpl;
+ new_tpl = AGREALOC((void*)new_tpl, new_tpl->td_size, "resize mac");
+ new_tpl->td_name += (long)new_tpl;
+ new_tpl->td_text += (long)new_tpl;
+ }
+ }
+
+#if defined(DEBUG_ENABLED)
+ if (HAVE_OPT(SHOW_DEFS)) {
+ static char const zSum[] = "loaded %d macros from %s\n"
+ "\tBinary template size: 0x%X\n\n";
+ fprintf(trace_fp, zSum, new_tpl->td_mac_ct, new_tpl->td_file,
+ (unsigned int)new_tpl->td_size);
+ }
+#endif
+
+ new_tpl->td_scan = (char*)named_tpls;
+ named_tpls = new_tpl;
+ load_proc_table = save_load_procs;
+ memset((void*)mac, 0, sizeof(*mac));
+ current_tpl = ori_tpl;
+ return mac;
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/funcDef.c */
diff --git a/agen5/funcEval.c b/agen5/funcEval.c
new file mode 100644
index 0000000..5775a34
--- /dev/null
+++ b/agen5/funcEval.c
@@ -0,0 +1,651 @@
+
+/**
+ * @file funcEval.c
+ *
+ * This module evaluates macro expressions.
+ *
+ * Time-stamp: "2012-04-07 09:41:46 bkorb"
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static inline char const *
+tpl_text(templ_t * tpl, macro_t * mac);
+
+static void
+tpl_warning(templ_t * tpl, macro_t * mac, char const * msg);
+
+static int
+expr_type(char * pz);
+/* = = = END-STATIC-FORWARD = = = */
+
+/**
+ * Convert SCM to displayable string.
+ * @param s the input scm
+ * @returns a string a human can read
+ */
+LOCAL char const *
+scm2display(SCM s)
+{
+ static char z[48];
+ char const * pzRes = z;
+
+ switch (ag_scm_type_e(s)) {
+ case GH_TYPE_BOOLEAN:
+ z[0] = AG_SCM_NFALSEP(s) ? '1' : '0'; z[1] = NUL;
+ break;
+
+ case GH_TYPE_STRING:
+ case GH_TYPE_SYMBOL:
+ pzRes = ag_scm2zchars(s, "SCM Result");
+ break;
+
+ case GH_TYPE_CHAR:
+ z[0] = AG_SCM_CHAR(s); z[1] = NUL; break;
+
+ case GH_TYPE_VECTOR:
+ pzRes = RESOLVE_SCM_VECTOR; break;
+
+ case GH_TYPE_PAIR:
+ pzRes = RESOLVE_SCM_PAIR; break;
+
+ case GH_TYPE_NUMBER:
+ snprintf(z, sizeof(z), RESOLVE_SCM_NUMBER, AG_SCM_TO_ULONG(s)); break;
+
+ case GH_TYPE_PROCEDURE:
+#ifdef SCM_SUBR_ENTRY
+ {
+ void * x = &SCM_SUBR_ENTRY(s);
+
+ snprintf(z, sizeof(z), RESOLVE_SCM_PROC,
+ (unsigned long)x);
+ break;
+ }
+#else
+ pzRes = "** PROCEDURE **";
+ break;
+#endif
+
+ case GH_TYPE_LIST:
+ pzRes = RESOLVE_SCM_LIST; break;
+
+ case GH_TYPE_INEXACT:
+ pzRes = RESOLVE_SCM_INEXACT; break;
+
+ case GH_TYPE_EXACT:
+ pzRes = RESOLVE_SCM_EXACT; break;
+
+ case GH_TYPE_UNDEFINED:
+ pzRes = (char*)zNil; break;
+
+ default:
+ pzRes = RESOLVE_SCM_UNKNOWN; break;
+ }
+
+ return pzRes;
+}
+
+/**
+ * Return the text associated with a macro.
+ */
+static inline char const *
+tpl_text(templ_t * tpl, macro_t * mac)
+{
+ if (mac->md_txt_off == 0)
+ return zNil;
+
+ return tpl->td_text + mac->md_txt_off;
+}
+
+static void
+tpl_warning(templ_t * tpl, macro_t * mac, char const * msg)
+{
+ fprintf(trace_fp, TPL_WARN_FMT, tpl->td_file, mac->md_line, msg);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Evaluate an expression and return a string pointer. Always.
+ * It may need to be deallocated, so a boolean pointer is used
+ * to tell the caller. Also, the match existence and non-existence
+ * pay attention to the address of the empty string that gets
+ * returned. If it is, specifically, "zNil", then this code is
+ * saying, "we could not compute a value, so we're returning this
+ * empty string". This is used by the Select_Match_Existence and
+ * Select_Match_NonExistence code to distinguish non-existence from
+ * an empty string value.
+ *
+ * @param allocated tell caller if result has been allocated
+ * @returns a string representing the result.
+ */
+LOCAL char const *
+eval_mac_expr(bool * allocated)
+{
+ templ_t * tpl = current_tpl;
+ macro_t * mac = cur_macro;
+ int code = mac->md_res;
+ char const * text = NULL; /* warning patrol */
+ def_ent_t * ent;
+
+ *allocated = false;
+
+ if ((code & EMIT_NO_DEFINE) != 0) {
+ text = tpl_text(tpl, mac);
+ code &= EMIT_PRIMARY_TYPE;
+ ent = NULL; /* warning patrol */
+ }
+
+ else {
+ /*
+ * Get the named definition entry, maybe
+ */
+ bool indexed;
+ ent = find_def_ent(tpl->td_text + mac->md_name_off, &indexed);
+
+ if (ent == NULL) {
+ switch (code & (EMIT_IF_ABSENT | EMIT_ALWAYS)) {
+ case EMIT_IF_ABSENT:
+ /*
+ * There is only one expression. It applies because
+ * we did not find a definition.
+ */
+ text = tpl_text(tpl, mac);
+ code &= EMIT_PRIMARY_TYPE;
+ break;
+
+ case EMIT_ALWAYS:
+ /*
+ * There are two expressions. Take the second one.
+ */
+ text = tpl->td_text + mac->md_end_idx;
+ code = ((code & EMIT_SECONDARY_TYPE)
+ >> EMIT_SECONDARY_SHIFT);
+ break;
+
+ case 0:
+ /*
+ * Emit only if found
+ */
+ return no_def_str;
+
+ case (EMIT_IF_ABSENT | EMIT_ALWAYS):
+ /*
+ * Emit inconsistently :-}
+ */
+ AG_ABEND_IN(tpl, mac, EVAL_EXPR_PROG_ERR);
+ /* NOTREACHED */
+ }
+ }
+
+ /*
+ * OTHERWISE, we found an entry. Make sure we were supposed to.
+ */
+ else {
+ if ((code & EMIT_IF_ABSENT) != 0)
+ return (char*)zNil;
+
+ if ( (ent->de_type != VALTYP_TEXT)
+ && ((code & EMIT_PRIMARY_TYPE) == EMIT_VALUE) ) {
+ tpl_warning(tpl, mac, EVAL_EXPR_BLOCK_IN_EVAL);
+ return (char*)zNil;
+ }
+
+ /*
+ * Compute the expression string. There are three possibilities:
+ * 1. There is an expression string in the macro, but it must
+ * be formatted with the text value.
+ * Make sure we have a value.
+ * 2. There is an expression string in the macro, but it is *NOT*
+ * to be formatted. Use it as is. Do *NOT* verify that
+ * the define value is text.
+ * 3. There is no expression with the macro invocation.
+ * The define value *must* be text.
+ */
+ if ((code & EMIT_FORMATTED) != 0) {
+ /*
+ * And make sure what we found is a text value
+ */
+ if (ent->de_type != VALTYP_TEXT) {
+ tpl_warning(tpl, mac, EVAL_EXPR_BLOCK_IN_EVAL);
+ return (char*)zNil;
+ }
+
+ *allocated = true;
+ text = aprf(tpl_text(tpl, mac), ent->de_val.dvu_text);
+ }
+
+ else if (mac->md_txt_off != 0)
+ text = tpl->td_text + mac->md_txt_off;
+
+ else {
+ /*
+ * And make sure what we found is a text value
+ */
+ if (ent->de_type != VALTYP_TEXT) {
+ tpl_warning(tpl, mac, EVAL_EXPR_BLOCK_IN_EVAL);
+ return (char*)zNil;
+ }
+
+ text = ent->de_val.dvu_text;
+ }
+
+ code &= EMIT_PRIMARY_TYPE;
+ }
+ }
+
+ /*
+ * The "code" tells us how to handle the expression
+ */
+ switch (code) {
+ case EMIT_VALUE:
+ assert(ent != NULL);
+ if (*allocated) {
+ AGFREE((void*)text);
+ *allocated = false;
+ }
+
+ text = ent->de_val.dvu_text;
+ break;
+
+ case EMIT_EXPRESSION:
+ {
+ SCM res = ag_eval(text);
+
+ if (*allocated) {
+ AGFREE((void*)text);
+ *allocated = false;
+ }
+
+ text = scm2display(res);
+ break;
+ }
+
+ case EMIT_SHELL:
+ {
+ char* pz = shell_cmd(text);
+
+ if (*allocated)
+ AGFREE((void*)text);
+
+ if (pz != NULL) {
+ *allocated = true;
+ text = pz;
+ }
+ else {
+ *allocated = false;
+ text = (char*)zNil;
+ }
+ break;
+ }
+
+ case EMIT_STRING:
+ break;
+ }
+
+ return text;
+}
+
+/*=gfunc error_source_line
+ *
+ * what: display of file & line
+ * general_use:
+ * doc: This function is only invoked just before Guile displays
+ * an error message. It displays the file name and line number
+ * that triggered the evaluation error. You should not need to
+ * invoke this routine directly. Guile will do it automatically.
+=*/
+SCM
+ag_scm_error_source_line(void)
+{
+ fprintf(stderr, SCM_ERROR_FMT, current_tpl->td_name, cur_macro->md_line,
+ current_tpl->td_text + cur_macro->md_txt_off);
+ fflush(stderr);
+
+ return SCM_UNDEFINED;
+}
+
+
+/*=gfunc emit
+ *
+ * what: emit the text for each argument
+ *
+ * exparg: alist, list of arguments to stringify and emit, , list
+ *
+ * doc: Walk the tree of arguments, displaying the values of displayable
+ * SCM types. EXCEPTION: if the first argument is a number, then
+ * that number is used to index the output stack. "0" is the default,
+ * the current output.
+=*/
+SCM
+ag_scm_emit(SCM val)
+{
+ static int depth = 0;
+ static FILE * fp;
+
+ switch (depth) {
+ case 1:
+ {
+ out_stack_t* pSaveFp;
+ unsigned long pnum;
+
+ if (! AG_SCM_NUM_P(val))
+ break;
+
+ pSaveFp = cur_fpstack;
+ pnum = AG_SCM_TO_ULONG(val);
+
+ for (; pnum > 0; pnum--) {
+ pSaveFp = pSaveFp->stk_prev;
+ if (pSaveFp == NULL)
+ AG_ABEND(aprf(EMIT_INVAL_PORT, AG_SCM_TO_ULONG(val)));
+ }
+
+ fp = pSaveFp->stk_fp;
+ return SCM_UNDEFINED;
+ }
+
+ case 0:
+ fp = cur_fpstack->stk_fp; // initialize the first time through
+ break;
+ }
+
+ depth++;
+ for (;;) {
+ if (val == SCM_UNDEFINED)
+ break;
+
+ if (AG_SCM_NULLP(val))
+ break;
+
+ if (AG_SCM_STRING_P(val)) {
+ fputs((char*)ag_scm2zchars(val, "emit val"), fp);
+ fflush(fp);
+ break;
+ }
+
+ switch (ag_scm_type_e(val)) {
+ case GH_TYPE_LIST:
+ case GH_TYPE_PAIR:
+ ag_scm_emit(SCM_CAR(val));
+ val = SCM_CDR(val);
+ continue;
+
+ default:
+ fputs(scm2display(val), fp);
+ fflush(fp);
+ break;
+ }
+
+ break;
+ }
+
+ depth--;
+ return SCM_UNDEFINED;
+}
+
+/**
+ * The global evaluation function.
+ *
+ * The string to "evaluate" may be a literal string, or may need Scheme
+ * interpretation. So, we do one of three things: if the string starts with
+ * a Scheme comment character or evaluation character (';' or '('), then run
+ * a Scheme eval. If it starts with a quote character ('\'' or '"'), then
+ * digest the string and return that. Otherwise, just return the string.
+ *
+ * @param expr input expression string
+ * @returns an SCM value representing the result
+ */
+LOCAL SCM
+eval(char const * expr)
+{
+ bool allocated = false;
+ char * pzTemp;
+ SCM res;
+
+ switch (*expr) {
+ case '(':
+ case ';':
+ res = ag_eval((char*)expr);
+ break;
+
+ case '`':
+ AGDUPSTR(pzTemp, expr, "shell script");
+ (void)span_quote(pzTemp);
+ expr = shell_cmd(pzTemp);
+ AGFREE((void*)pzTemp);
+ res = AG_SCM_STR02SCM((char*)expr);
+ AGFREE((void*)expr);
+ break;
+
+ case '"':
+ case '\'':
+ AGDUPSTR(pzTemp, expr, "quoted string");
+ (void)span_quote(pzTemp);
+ allocated = true;
+ expr = pzTemp;
+ /* FALLTHROUGH */
+
+ default:
+ res = AG_SCM_STR02SCM((char*)expr);
+ if (allocated)
+ AGFREE((void*)expr);
+ }
+
+ return res;
+}
+
+
+/*=macfunc EXPR
+ *
+ * what: Evaluate and emit an Expression
+ * alias: + - + ? + % + ; + ( + '`' + '"' + "'" + . +
+ *
+ * handler_proc:
+ * load_proc:
+ *
+ * desc:
+ * This macro does not have a name to cause it to be invoked
+ * explicitly, though if a macro starts with one of the apply codes
+ * or one of the simple expression markers, then an expression
+ * macro is inferred. The result of the expression evaluation
+ * (@pxref{expression syntax}) is written to the current output.
+=*/
+macro_t*
+mFunc_Expr(templ_t * tpl, macro_t * mac)
+{
+ bool allocated_str;
+ char const * pz = eval_mac_expr(&allocated_str);
+
+ (void)tpl;
+
+ if (*pz != NUL) {
+ fputs(pz, cur_fpstack->stk_fp);
+ fflush(cur_fpstack->stk_fp);
+ }
+
+ if (allocated_str)
+ AGFREE((void*)pz);
+
+ return mac + 1;
+}
+
+/**
+ * Determine the expression type. It may be Scheme (starts with a semi-colon
+ * or an opening parenthesis), a shell command (starts with a back tick),
+ * a quoted string (either single or double), or it is some sort of plain
+ * string. In that case, just return the text.
+ *
+ * @param pz pointer to string to diagnose
+ * @returns the EMIT_* compound value, though actually only
+ * EXPRESSION, SHELL or STRING can really ever be returned.
+ */
+static int
+expr_type(char * pz)
+{
+ switch (*pz) {
+ case ';':
+ case '(':
+ return EMIT_EXPRESSION;
+
+ case '`':
+ span_quote(pz);
+ return EMIT_SHELL;
+
+ case '"':
+ case '\'':
+ span_quote(pz);
+ /* FALLTHROUGH */
+
+ default:
+ return EMIT_STRING;
+ }
+}
+
+
+/**
+ * mLoad_Expr
+ */
+macro_t *
+mLoad_Expr(templ_t * tpl, macro_t * mac, char const ** ppzScan)
+{
+ char * copy; /* next text dest */
+ char const * src = (char const*)mac->md_txt_off; /* macro text */
+ size_t src_len = (long)mac->md_res; /* macro len */
+ char const * end_src = src + src_len;
+
+ if (src_len == 0) {
+ if (mac->md_code == FTYP_INCLUDE)
+ AG_ABEND_IN(tpl, mac, LD_INC_NO_FNAME);
+ mac->md_res = EMIT_VALUE;
+ mac->md_txt_off = 0;
+ return mac + 1;
+ }
+
+ switch (*src) {
+ case '-':
+ mac->md_res = EMIT_IF_ABSENT;
+ src++;
+ break;
+
+ case '?':
+ mac->md_res = EMIT_ALWAYS;
+ src++;
+ if (*src == '%') {
+ mac->md_res |= EMIT_FORMATTED;
+ src++;
+ }
+ break;
+
+ case '%':
+ mac->md_res = EMIT_FORMATTED;
+ src++;
+ break;
+
+ case '`':
+ (void) mLoad_Unknown(tpl, mac, ppzScan);
+ mac->md_res = EMIT_NO_DEFINE | EMIT_SHELL;
+ span_quote(tpl->td_text + mac->md_txt_off);
+ return mac + 1;
+
+ case '"':
+ case '\'':
+ (void) mLoad_Unknown(tpl, mac, ppzScan);
+ mac->md_res = EMIT_NO_DEFINE | EMIT_STRING;
+ span_quote(tpl->td_text + mac->md_txt_off);
+ return mac + 1;
+
+ case '(':
+ case ';':
+ (void) mLoad_Unknown(tpl, mac, ppzScan);
+ mac->md_res = EMIT_NO_DEFINE | EMIT_EXPRESSION;
+ return mac + 1;
+
+ default:
+ mac->md_res = EMIT_VALUE; /* zero */
+ break;
+ }
+
+ copy = tpl->td_scan;
+ mac->md_name_off = (copy - tpl->td_text);
+ {
+ size_t remLen = canonical_name(copy, src, (int)src_len);
+ if (remLen > src_len)
+ AG_ABEND_IN(tpl, mac, LD_EXPR_BAD_NAME);
+ src += src_len - remLen;
+ src_len = remLen;
+ copy += strlen(copy) + 1;
+ }
+
+ if (src >= end_src) {
+ if (mac->md_res != EMIT_VALUE)
+ AG_ABEND_IN(tpl, mac, LD_EXPR_NO_TEXT);
+
+ mac->md_txt_off = 0;
+
+ } else {
+ char* pz = copy;
+ src_len = (long)(end_src - src);
+
+ mac->md_txt_off = (copy - tpl->td_text);
+ /*
+ * Copy the expression
+ */
+ memcpy(copy, src, src_len);
+ copy += src_len;
+ *(copy++) = NUL; *(copy++) = NUL; /* double terminate */
+
+ /*
+ * IF this expression has an "if-present" and "if-not-present"
+ * THEN find the ending expression...
+ */
+ if ((mac->md_res & EMIT_ALWAYS) != 0) {
+ char* pzNextExpr = (char*)skip_expr(pz, src_len);
+
+ /*
+ * The next expression must be within bounds and space separated
+ */
+ if (pzNextExpr >= pz + src_len)
+ AG_ABEND_IN(tpl, mac, LD_EXPR_NEED_TWO);
+
+ if (! IS_WHITESPACE_CHAR(*pzNextExpr))
+ AG_ABEND_IN(tpl, mac, LD_EXPR_NO_SPACE);
+
+ /*
+ * NUL terminate the first expression, skip intervening
+ * white space and put the secondary expression's type
+ * into the macro type code as the "secondary type".
+ */
+ *(pzNextExpr++) = NUL;
+ pzNextExpr = SPN_WHITESPACE_CHARS(pzNextExpr);
+ mac->md_res |= (expr_type(pzNextExpr) << EMIT_SECONDARY_SHIFT);
+ mac->md_end_idx = pzNextExpr - tpl->td_text;
+ }
+
+ mac->md_res |= expr_type(pz);
+ }
+
+ tpl->td_scan = copy;
+ return mac + 1;
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/funcEval.c */
diff --git a/agen5/funcFor.c b/agen5/funcFor.c
new file mode 100644
index 0000000..2d6b219
--- /dev/null
+++ b/agen5/funcFor.c
@@ -0,0 +1,918 @@
+
+/**
+ * @file funcFor.c
+ *
+ * Time-stamp: "2012-04-07 09:13:53 bkorb"
+ *
+ * This module implements the FOR text macro.
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define ENTRY_END INT_MAX
+#define UNASSIGNED 0x7BAD0BAD
+
+/* = = = START-STATIC-FORWARD = = = */
+static for_state_t *
+find_for_state(SCM which_scm);
+
+static bool
+next_def(bool invert, def_ent_t** de_lst);
+
+static int
+for_by_step(templ_t * pT, macro_t * pMac, def_ent_t * found);
+
+static int
+for_each(templ_t * tpl, macro_t * mac, def_ent_t * def_ent);
+
+static void
+load_for_in(char const * pzSrc, size_t srcLen, templ_t * pT, macro_t * pMac);
+/* = = = END-STATIC-FORWARD = = = */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Operational Functions */
+
+static for_state_t *
+find_for_state(SCM which_scm)
+{
+ ivk_info_t * srch = curr_ivk_info;
+ char const * which = AG_SCM_STRING_P(which_scm)
+ ? ag_scm2zchars(which_scm, "which for") : NULL;
+
+ for (; srch != NULL; srch = srch->ii_prev) {
+ int ix;
+
+ if (srch->ii_for_depth <= 0)
+ continue;
+
+ /*
+ * If "which" is not specified, then accept first found
+ */
+ ix = srch->ii_for_depth - 1;
+ if (which == NULL)
+ return srch->ii_for_data + ix;
+
+ for (; ix >= 0; ix--) {
+ for_state_t * fs = srch->ii_for_data + ix;
+ if (strcmp(fs->for_name, which) == 0)
+ return fs;
+ }
+ }
+ return NULL;
+}
+
+/*=gfunc first_for_p
+ *
+ * what: detect first iteration
+ * exparg: for_var, which for loop, opt
+ * doc:
+ *
+ * Returns @code{SCM_BOOL_T} if the named FOR loop (or, if not named, the
+ * current innermost loop) is on the first pass through the data. Outside
+ * of any @code{FOR} loop, it returns @code{SCM_UNDEFINED}, @pxref{FOR}.
+=*/
+SCM
+ag_scm_first_for_p(SCM which)
+{
+ for_state_t * p = find_for_state(which);
+ if (p == NULL)
+ return SCM_UNDEFINED;
+
+ if (! AG_SCM_STRING_P(which))
+ return (for_state->for_isfirst) ? SCM_BOOL_T : SCM_BOOL_F;
+
+ which = (p->for_isfirst ? SCM_BOOL_T : SCM_BOOL_F);
+ return which;
+}
+
+
+/*=gfunc last_for_p
+ *
+ * what: detect last iteration
+ * exparg: for_var, which for loop, opt
+ * doc: Returns SCM_BOOL_T if the named FOR loop (or, if not named, the
+ * current innermost loop) is on the last pass through the data.
+ * Outside of any FOR loop, it returns SCM_UNDEFINED.
+ * @xref{FOR}.
+=*/
+SCM
+ag_scm_last_for_p(SCM which)
+{
+ for_state_t * p = find_for_state(which);
+ if (p == NULL)
+ return SCM_UNDEFINED;
+
+ which = (p->for_islast ? SCM_BOOL_T : SCM_BOOL_F);
+ return which;
+}
+
+
+/*=gfunc for_index
+ *
+ * what: get current loop index
+ * exparg: for_var, which for loop, opt
+ * doc:
+ *
+ * Returns the current index for the named @code{FOR} loop.
+ * If not named, then the index for the innermost loop.
+ * Outside of any FOR loop, it returns @code{SCM_UNDEFINED}, @xref{FOR}.
+=*/
+SCM
+ag_scm_for_index(SCM which)
+{
+ for_state_t * p = find_for_state(which);
+ if (p == NULL)
+ return SCM_UNDEFINED;
+
+ which = AG_SCM_INT2SCM(p->for_index);
+ return which;
+}
+
+
+/*=gfunc for_from
+ *
+ * what: set initial index
+ * exparg: from, the initial index for the AutoGen FOR macro
+ *
+ * doc: This function records the initial index information
+ * for an AutoGen FOR function.
+ * Outside of the FOR macro itself, this function will emit an error.
+ * @xref{FOR}.
+=*/
+SCM
+ag_scm_for_from(SCM from)
+{
+ if ((! for_state->for_loading) || (! AG_SCM_NUM_P(from)))
+ return SCM_UNDEFINED;
+
+ for_state->for_from = AG_SCM_TO_INT(from);
+ return SCM_BOOL_T;
+}
+
+
+/*=gfunc for_to
+ *
+ * what: set ending index
+ * exparg: to, the final index for the AutoGen FOR macro
+ *
+ * doc: This function records the terminating value information
+ * for an AutoGen FOR function.
+ * Outside of the FOR macro itself, this function will emit an error.
+ * @xref{FOR}.
+=*/
+SCM
+ag_scm_for_to(SCM to)
+{
+ if ((! for_state->for_loading) || (! AG_SCM_NUM_P(to)))
+ return SCM_UNDEFINED;
+
+ for_state->for_to = AG_SCM_TO_INT(to);
+ return SCM_BOOL_T;
+}
+
+
+/*=gfunc for_by
+ *
+ * what: set iteration step
+ * exparg: by, the iteration increment for the AutoGen FOR macro
+ *
+ * doc: This function records the "step by" information
+ * for an AutoGen FOR function.
+ * Outside of the FOR macro itself, this function will emit an error.
+ * @xref{FOR}.
+=*/
+SCM
+ag_scm_for_by(SCM by)
+{
+ if ((! for_state->for_loading) || (! AG_SCM_NUM_P(by)))
+ return SCM_UNDEFINED;
+
+ for_state->for_by = AG_SCM_TO_INT(by);
+ return SCM_BOOL_T;
+}
+
+/*=gfunc for_sep
+ *
+ * what: set loop separation string
+ * exparg: separator, the text to insert between the output of
+ * each FOR iteration
+ *
+ * doc: This function records the separation string that is to be inserted
+ * between each iteration of an AutoGen FOR function. This is often
+ * nothing more than a comma.
+ * Outside of the FOR macro itself, this function will emit an error.
+=*/
+SCM
+ag_scm_for_sep(SCM obj)
+{
+ if ((! for_state->for_loading) || (! AG_SCM_STRING_P(obj)))
+ return SCM_UNDEFINED;
+
+ AGDUPSTR(for_state->for_sep_str, ag_scm2zchars(obj, "sep"), "seps");
+ return SCM_BOOL_T;
+}
+
+/**
+ * search for matching definition entry.
+ * Only the current level is traversed, via the "de_twin" link.
+ *
+ * @param[in] invert invert the sense of the search
+ * ("FOR" is running backwards)
+ * @param[in,out] de_lst linked list of definitions
+ */
+static bool
+next_def(bool invert, def_ent_t** de_lst)
+{
+ bool haveMatch = false;
+ def_ent_t* ent = *de_lst;
+
+ while (ent != NULL) {
+ /*
+ * Loop until we find or pass the current index value
+ *
+ * IF we found an entry for the current index,
+ * THEN break out and use it
+ */
+ if (ent->de_index == for_state->for_index) {
+ haveMatch = true;
+ break;
+ }
+
+ /*
+ * IF the next definition is beyond our current index,
+ * (that is, the current index is inside of a gap),
+ * THEN we have no current definition and will use
+ * only the set passed in.
+ */
+ if ((invert)
+ ? (ent->de_index < for_state->for_index)
+ : (ent->de_index > for_state->for_index)) {
+
+ /*
+ * When the "by" step is zero, force syncronization.
+ */
+ if (for_state->for_by == 0) {
+ for_state->for_index = ent->de_index;
+ haveMatch = true;
+ }
+ break;
+ }
+
+ /*
+ * The current index (for_state->for_index) is past the current value
+ * (pB->de_index), so advance to the next entry and test again.
+ */
+ ent = (invert) ? ent->de_ptwin : ent->de_twin;
+ }
+
+ /*
+ * Save our restart point and return the find indication
+ */
+ *de_lst = ent;
+ return haveMatch;
+}
+
+static int
+for_by_step(templ_t * pT, macro_t * pMac, def_ent_t * found)
+{
+ int loopCt = 0;
+ def_ent_t textDef;
+ bool invert = (for_state->for_by < 0) ? true : false;
+ t_word loopLimit = OPT_VALUE_LOOP_LIMIT;
+ def_ctx_t ctx = curr_def_ctx;
+ macro_t * end_mac = pT->td_macros + pMac->md_end_idx;
+
+ /*
+ * IF the for-from and for-to values have not been set,
+ * THEN we set them from the indices of the first and last
+ * entries of the twin set.
+ */
+ {
+ def_ent_t* pLast = (found->de_etwin != NULL)
+ ? found->de_etwin : found;
+
+ if (for_state->for_from == UNASSIGNED)
+ for_state->for_from = (invert) ? pLast->de_index : found->de_index;
+
+ if (for_state->for_to == UNASSIGNED)
+ for_state->for_to = (invert) ? found->de_index : pLast->de_index;
+
+ /*
+ * "loopLimit" is intended to catch runaway ending conditions.
+ * However, if you really have a gazillion entries, who am I
+ * to stop you?
+ */
+ if (loopLimit < pLast->de_index - found->de_index)
+ loopLimit = (pLast->de_index - found->de_index) + 1;
+ }
+
+ /*
+ * Make sure we have some work to do before we start.
+ */
+ if (invert) {
+ if (for_state->for_from < for_state->for_to)
+ return 0;
+ } else {
+ if (for_state->for_from > for_state->for_to)
+ return 0;
+ }
+
+ for_state->for_index = for_state->for_from;
+
+ /*
+ * FROM `from' THROUGH `to' BY `by',
+ * DO...
+ */
+ for (;;) {
+ int next_ix;
+ bool have_next = next_def(invert, &found);
+
+ if (loopLimit-- < 0) {
+ fprintf(trace_fp, TRACE_FOR_STEP_TOO_FAR,
+ pT->td_name, pMac->md_line);
+ fprintf(trace_fp, TRACE_FOR_BY_STEP,
+ pT->td_text + pMac->md_txt_off,
+ for_state->for_from, for_state->for_to, for_state->for_by,
+ (int)OPT_VALUE_LOOP_LIMIT);
+ break;
+ }
+
+ if (for_state->for_by != 0) {
+ next_ix = for_state->for_index + for_state->for_by;
+
+ } else if (invert) {
+ next_ix = (found->de_ptwin == NULL)
+ ? for_state->for_to - 1 /* last iteration !! */
+ : found->de_ptwin->de_index;
+
+ } else {
+ next_ix = (found->de_twin == NULL)
+ ? for_state->for_to + 1 /* last iteration !! */
+ : found->de_twin->de_index;
+ }
+
+ /*
+ * IF we have a non-base definition, use the old def context
+ */
+ if (! have_next)
+ curr_def_ctx = ctx;
+
+ /*
+ * ELSE IF this macro is a text type
+ * THEN create an un-twinned version of it to be found first
+ */
+ else if (found->de_type == VALTYP_TEXT) {
+ textDef = *found;
+ textDef.de_next = textDef.de_twin = NULL;
+
+ curr_def_ctx.dcx_defent = &textDef;
+ curr_def_ctx.dcx_prev = &ctx;
+ }
+
+ /*
+ * ELSE the current definitions are based on the block
+ * macro's values
+ */
+ else {
+ curr_def_ctx.dcx_defent = found->de_val.dvu_entry;
+ curr_def_ctx.dcx_prev = &ctx;
+ }
+
+ for_state->for_islast = (invert)
+ ? ((next_ix < for_state->for_to) ? true : false)
+ : ((next_ix > for_state->for_to) ? true : false);
+
+ switch (call_gen_block(for_state->for_env, pT, pMac+1, end_mac)) {
+ case LOOP_JMP_OKAY:
+ case LOOP_JMP_NEXT:
+ break;
+
+ case LOOP_JMP_BREAK:
+ goto leave_loop;
+ }
+
+ loopCt++;
+ for_state = curr_ivk_info->ii_for_data
+ + (curr_ivk_info->ii_for_depth - 1);
+
+ if (for_state->for_islast)
+ break;
+
+ if ( (for_state->for_sep_str != NULL)
+ && (*for_state->for_sep_str != NUL))
+ fputs(for_state->for_sep_str, cur_fpstack->stk_fp);
+
+ fflush(cur_fpstack->stk_fp);
+ for_state->for_isfirst = false;
+ for_state->for_index = next_ix;
+ } leave_loop:
+
+ curr_def_ctx = ctx; /* Restore the def context */
+ return loopCt;
+}
+
+static int
+for_each(templ_t * tpl, macro_t * mac, def_ent_t * def_ent)
+{
+ int loopCt = 0;
+ def_ctx_t ctx = curr_def_ctx;
+ macro_t * end_mac = tpl->td_macros + mac->md_end_idx;
+
+ curr_def_ctx.dcx_prev = &ctx;
+ mac++;
+
+ for (;;) {
+ def_ent_t txt_def_ent;
+
+ /*
+ * IF this loops over a text macro,
+ * THEN create a definition that will be found *before*
+ * the repeated (twinned) copy. That way, when it
+ * is found as a macro invocation, the current value
+ * will be extracted, instead of the value list.
+ */
+ if (def_ent->de_type == VALTYP_TEXT) {
+ txt_def_ent = *def_ent;
+ txt_def_ent.de_next = txt_def_ent.de_twin = NULL;
+
+ curr_def_ctx.dcx_defent = &txt_def_ent;
+ } else {
+ curr_def_ctx.dcx_defent = def_ent->de_val.dvu_entry;
+ }
+
+ /*
+ * Set the global current index
+ */
+ for_state->for_index = def_ent->de_index;
+
+ /*
+ * Advance to the next twin
+ */
+ def_ent = def_ent->de_twin;
+ if (def_ent == NULL)
+ for_state->for_islast = true;
+
+ switch (call_gen_block(for_state->for_env, tpl, mac, end_mac)) {
+ case LOOP_JMP_OKAY:
+ case LOOP_JMP_NEXT:
+ break;
+
+ case LOOP_JMP_BREAK:
+ goto leave_loop;
+ }
+
+ loopCt++;
+ for_state = curr_ivk_info->ii_for_data
+ + (curr_ivk_info->ii_for_depth - 1);
+
+ if (def_ent == NULL)
+ break;
+ for_state->for_isfirst = false;
+
+ /*
+ * Emit the iteration separation
+ */
+ fputs(for_state->for_sep_str, cur_fpstack->stk_fp);
+ fflush(cur_fpstack->stk_fp);
+ } leave_loop:;
+
+ curr_def_ctx = ctx; /* Restore the def context */
+ return loopCt;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+static void
+load_for_in(char const * pzSrc, size_t srcLen, templ_t * pT, macro_t * pMac)
+{
+ char* pzName = pT->td_text + pMac->md_name_off;
+ int ix = 0;
+ char* pz;
+ def_ent_t * prev_ent = NULL;
+
+ /*
+ * Find the first text value
+ */
+ pz = SPN_WHITESPACE_CHARS(pzSrc + 3);
+ if (*pz == NUL)
+ AG_ABEND_IN(pT, pMac, FOR_IN_LISTLESS);
+ srcLen -= pz - pzSrc;
+ pzSrc = pz;
+
+ {
+ size_t nmlen = strlen(pzName);
+
+ pz = AGALOC(srcLen + 2 + nmlen, "copy FOR text");
+ strcpy(pz, pzName);
+ pzName = pz;
+ pz += nmlen + 1;
+ }
+
+ memcpy(pz, pzSrc, srcLen);
+ pz[srcLen] = NUL;
+
+ do {
+ def_ent_t* pDef = new_def_ent();
+
+ pDef->de_name = pzName;
+ pDef->de_index = ix++;
+ pDef->de_type = VALTYP_TEXT;
+ pDef->de_val.dvu_text = pz;
+
+ switch (*pz) {
+ case '\'':
+ case '"':
+ pz = span_quote(pz);
+ /*
+ * Clean up trailing commas
+ */
+ pz = SPN_WHITESPACE_CHARS(pz);
+ if (*pz == ',')
+ pz++;
+ break;
+
+ default:
+ for (;;) {
+ char ch = *(pz++);
+ switch (ch) {
+ case ' ': case TAB: case '\f': case '\v': case NL:
+ pz[-1] = NUL;
+ if (*pz != ',')
+ break;
+ pz++;
+ /* FALLTHROUGH */
+
+ case ',':
+ pz[-1] = NUL;
+ break;
+
+ case NUL:
+ pz--;
+ break;
+
+ default:
+ continue;
+ }
+ break;
+ }
+ break;
+ }
+
+ /*
+ * Clean up trailing white space
+ */
+ pz = SPN_WHITESPACE_CHARS(pz);
+
+ /*
+ * IF there is a previous entry, link its twin to this one.
+ * OTHERWISE, it is the head of the twin list.
+ * Link to md_pvt.
+ */
+ if (prev_ent != NULL)
+ prev_ent->de_twin = pDef;
+ else
+ pMac->md_pvt = pDef;
+
+ prev_ent = pDef;
+ } while (*pz != NUL);
+
+ pMac->md_txt_off = 0;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*=macfunc FOR
+ *
+ * what: Emit a template block multiple times
+ * cindex: looping, for
+ * cindex: for loop
+ * handler_proc:
+ * load_proc:
+ *
+ * desc:
+ * This macro has a slight variation on the standard syntax:
+ * @example
+ * FOR <value-name> [ <separator-string> ]
+ *
+ * FOR <value-name> (...Scheme expression list)
+ *
+ * FOR <value-name> IN "string" [ ... ]
+ * @end example
+ *
+ * Other than for the last form, the first macro argument must be the name of
+ * an AutoGen value. If there is no value associated with the name, the
+ * @code{FOR} template block is skipped entirely. The scope of the @code{FOR}
+ * macro extends to the corresponding @code{ENDFOR} macro. The last form will
+ * create an array of string values named @code{<value-name>} that only exists
+ * within the context of this @code{FOR} loop. With this form, in order to
+ * use a @code{separator-string}, you must code it into the end of the
+ * template block using the @code{(last-for?)} predicate function
+ * (@pxref{SCM last-for?}).
+ *
+ * If there are any arguments after the @code{value-name}, the initial
+ * characters are used to determine the form. If the first character is
+ * either a semi-colon (@code{;}) or an opening parenthesis (@code{(}), then
+ * it is presumed to be a Scheme expression containing the FOR macro specific
+ * functions @code{for-from}, @code{for-by}, @code{for-to}, and/or
+ * @code{for-sep}. @xref{AutoGen Functions}. If it consists of an '@code{i}'
+ * an '@code{n}' and separated by white space from more text, then the
+ * @code{FOR x IN} form is processed. Otherwise, the remaining text is
+ * presumed to be a string for inserting between each iteration of the loop.
+ * This string will be emitted one time less than the number of iterations of
+ * the loop. That is, it is emitted after each loop, excepting for the last
+ * iteration.
+ *
+ * If the from/by/to functions are invoked, they will specify which copies of
+ * the named value are to be processed. If there is no copy of the named
+ * value associated with a particular index, the @code{FOR} template block
+ * will be instantiated anyway. The template must use methods for detecting
+ * missing definitions and emitting default text. In this fashion, you can
+ * insert entries from a sparse or non-zero based array into a dense, zero
+ * based array.
+ *
+ * @strong{NB:} the @code{for-from}, @code{for-to}, @code{for-by} and
+ * @code{for-sep} functions are disabled outside of the context of the
+ * @code{FOR} macro. Likewise, the @code{first-for}, @code{last-for}
+ * and @code{for-index} functions are disabled outside of the range
+ * of a @code{FOR} block.
+ *
+ * @strong{Also:} the @code{<value-name>} must be a single level name,
+ * not a compound name (@pxref{naming values}).
+ *
+ * @example
+ * [+FOR var (for-from 0) (for-to <number>) (for-sep ",") +]
+ * ... text with @code{var}ious substitutions ...[+
+ * ENDFOR var+]
+ * @end example
+ *
+ * @noindent
+ * this will repeat the @code{... text with @code{var}ious
+ * substitutions ...} <number>+1 times. Each repetition,
+ * except for the last, will have a comma @code{,} after it.
+ *
+ * @example
+ * [+FOR var ",\n" +]
+ * ... text with @code{var}ious substitutions ...[+
+ * ENDFOR var +]
+ * @end example
+ *
+ * @noindent
+ * This will do the same thing, but only for the index
+ * values of @code{var} that have actually been defined.
+=*/
+/*=macfunc ENDFOR
+ *
+ * what: Terminates the @code{FOR} function template block
+ * in-context:
+ *
+ * desc:
+ * This macro ends the @code{FOR} function template block.
+ * For a complete description @xref{FOR}.
+=*/
+macro_t *
+mFunc_For(templ_t * tpl, macro_t * mac)
+{
+ macro_t * ret_mac = tpl->td_macros + mac->md_end_idx;
+ def_ent_t * def;
+ int lp_ct;
+
+ /*
+ * "md_pvt" is used by the "FOR x IN ..." variation of the macro.
+ * When parsed, a chain of text definitions are hung off of "md_pvt".
+ * "for_each()" will then chase through the linked list of text
+ * values. This winds up being identical to [+ FOR var +] where
+ * a list of "var" values has been set.
+ */
+ if (mac->md_pvt != NULL)
+ def = mac->md_pvt;
+ else {
+ bool indexed;
+ def = find_def_ent(tpl->td_text + mac->md_name_off, &indexed);
+ if (def == NULL) {
+ if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS) {
+ fprintf(trace_fp, TRACE_FN_FOR_SKIP,
+ tpl->td_text + mac->md_name_off);
+
+ if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
+ fprintf(trace_fp, TAB_FILE_LINE_FMT,
+ tpl->td_file, mac->md_line);
+ }
+
+ return ret_mac;
+ }
+ }
+
+ for_state = new_for_context();
+ for_state->for_name = tpl->td_text + mac->md_name_off;
+
+ if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS)
+ fprintf(trace_fp, TRACE_FN_FOR, tpl->td_text + mac->md_name_off,
+ tpl->td_file, mac->md_line);
+
+ /*
+ * Check for a FOR iterating based on scheme macros
+ */
+ if (tpl->td_text[ mac->md_txt_off ] == '(') {
+ for_state->for_from = \
+ for_state->for_to = UNASSIGNED;
+
+ for_state->for_loading = true;
+ (void) eval(tpl->td_text + mac->md_txt_off);
+ for_state->for_loading = false;
+ lp_ct = for_by_step(tpl, mac, def);
+
+ } else {
+ /*
+ * The FOR iterates over a list of definitions
+ */
+ AGDUPSTR(for_state->for_sep_str, tpl->td_text + mac->md_txt_off, "ss");
+ lp_ct = for_each(tpl, mac, def);
+ }
+
+ if (for_state->for_sep_str != NULL)
+ AGFREE(for_state->for_sep_str);
+
+ free_for_context(false);
+
+ if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS) {
+ fprintf(trace_fp, TRACE_FN_FOR_REPEAT, tpl->td_text + mac->md_name_off,
+ lp_ct);
+
+ if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
+ fprintf(trace_fp, TAB_FILE_LINE_FMT, tpl->td_file, mac->md_line);
+ }
+
+ return ret_mac;
+}
+
+/**
+ * allocate and zero out a FOR macro context.
+ *
+ * @returns the top of thecurr_ivk_info stack of contexts.
+ */
+LOCAL for_state_t *
+new_for_context(void)
+{
+ for_state_t * res;
+
+ /*
+ * Push the current FOR context onto a stack.
+ */
+ if (++(curr_ivk_info->ii_for_depth) > curr_ivk_info->ii_for_alloc) {
+ void * dta = curr_ivk_info->ii_for_data;
+ size_t sz = (curr_ivk_info->ii_for_alloc += 5) * sizeof(for_state_t);
+
+ if (dta == NULL)
+ dta = AGALOC(sz, "Init FOR sate");
+ else dta = AGREALOC(dta, sz, "FOR state");
+ curr_ivk_info->ii_for_data = dta;
+ }
+
+ res = curr_ivk_info->ii_for_data + (curr_ivk_info->ii_for_depth - 1);
+ memset((void*)res, 0, sizeof(for_state_t));
+ res->for_isfirst = true;
+ return res;
+}
+
+/**
+ * allocate and zero out a FOR macro context.
+ *
+ * @returns the top of thecurr_ivk_info stack of contexts.
+ */
+LOCAL void
+free_for_context(bool everything)
+{
+ if ((--(curr_ivk_info->ii_for_depth) == 0) || everything) {
+ AGFREE(curr_ivk_info->ii_for_data);
+ curr_ivk_info->ii_for_data = NULL;
+ curr_ivk_info->ii_for_alloc = 0;
+ curr_ivk_info->ii_for_depth = 0;
+ }
+}
+
+/**
+ * Function to initiate loading of FOR block.
+ * It must replace the dispatch table to handle the ENDFOR function,
+ * which will unload the dispatch table.
+ */
+macro_t *
+mLoad_For(templ_t * tpl, macro_t * mac, char const ** p_scan)
+{
+ char * scan_out = tpl->td_scan; /* next text dest */
+ char const * scan_in = (char const*)mac->md_txt_off; /* macro text */
+ size_t in_len = (size_t)mac->md_res; /* macro len */
+
+ /*
+ * Save the global macro loading mode
+ */
+ load_proc_p_t const * save_load_procs = load_proc_table;
+
+ static load_proc_p_t load_for_macro_procs[ FUNC_CT ] = { NULL };
+
+ load_proc_table = load_for_macro_procs;
+
+ /*
+ * IF this is the first time here, THEN set up the "FOR" mode callout
+ * table. It is the standard table, except entries are inserted for
+ * functions that are enabled only while processing a FOR macro
+ */
+ if (load_for_macro_procs[0] == NULL) {
+ memcpy((void*)load_for_macro_procs, base_load_table,
+ sizeof(base_load_table));
+ load_for_macro_procs[ FTYP_ENDFOR ] = &mLoad_Ending;
+ }
+
+ if (in_len == 0)
+ AG_ABEND_IN(tpl, mac, LD_FOR_NAMELESS);
+
+ /*
+ * src points to the name of the iteration "variable"
+ * Special hack: if the name is preceeded by a `.',
+ * then the lookup is local-only and we will accept it.
+ */
+ mac->md_name_off = tpl->td_scan - tpl->td_text;
+ if (*scan_in == '.') {
+ *(scan_out++) = *(scan_in++);
+ if (! IS_VAR_FIRST_CHAR(*scan_in))
+ scan_out--; /* force an error */
+ }
+
+ while (IS_VALUE_NAME_CHAR(*scan_in)) *(scan_out++) = *(scan_in++);
+ *(scan_out++) = NUL;
+
+ if (tpl->td_text[ mac->md_name_off ] == NUL)
+ AG_ABEND_IN(tpl, mac, LD_FOR_INVALID_VAR);
+
+ /*
+ * Skip space to the start of the text following the iterator name
+ */
+ scan_in = SPN_WHITESPACE_CHARS(scan_in);
+ in_len -= scan_in - (char*)mac->md_txt_off;
+
+ /* * * * *
+ *
+ * No source -> zero offset to text
+ */
+ if ((ssize_t)in_len <= 0) {
+ mac->md_txt_off = 0;
+ }
+
+ /* * * * *
+ *
+ * FOR foo IN ... -> no text, but we create an array of text values
+ */
+ else if ( (strneqvcmp(scan_in, LD_FOR_IN, 2) == 0)
+ && IS_WHITESPACE_CHAR(scan_in[2])) {
+ load_for_in(scan_in, in_len, tpl, mac);
+ }
+
+ /* * * * *
+ *
+ * *EITHER* a: FOR foo "<<separator>>"
+ * *OR* FOR foo (scheme ...) ...
+ */
+ else {
+ mac->md_txt_off = scan_out - tpl->td_text;
+ memmove(scan_out, scan_in, in_len);
+ scan_out[in_len] = NUL;
+ if (IS_QUOTE_CHAR(*scan_out))
+ span_quote(scan_out);
+ scan_out += in_len + 1;
+ }
+ /*
+ * * * * */
+
+ tpl->td_scan = scan_out;
+ {
+ macro_t * next_mac = parse_tpl(mac + 1, p_scan);
+ if (*p_scan == NULL)
+ AG_ABEND_IN(tpl, mac, LD_FOR_NO_ENDFOR);
+
+ mac->md_end_idx = mac->md_sib_idx = next_mac - tpl->td_macros;
+
+ load_proc_table = save_load_procs;
+ return next_mac;
+ }
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/funcFor.c */
diff --git a/agen5/funcIf.c b/agen5/funcIf.c
new file mode 100644
index 0000000..ddf3aa9
--- /dev/null
+++ b/agen5/funcIf.c
@@ -0,0 +1,514 @@
+
+/**
+ * @file funcIf.c
+ *
+ * Time-stamp: "2012-04-07 09:59:54 bkorb"
+ *
+ * This module implements the _IF text function.
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+typedef struct if_stack tIfStack;
+struct if_stack {
+ macro_t* pIf;
+ macro_t* pElse;
+};
+
+static tIfStack current_if;
+static load_proc_t mLoad_Elif, mLoad_Else;
+
+/* = = = START-STATIC-FORWARD = = = */
+static bool
+eval_true(void);
+
+static macro_t*
+mLoad_Elif(templ_t * pT, macro_t * pMac, char const ** ppzScan);
+
+static macro_t *
+mLoad_Else(templ_t * pT, macro_t * pMac, char const ** ppzScan);
+/* = = = END-STATIC-FORWARD = = = */
+
+/*
+ * eval_true - should a string be interpreted as TRUE?
+ *
+ * It is always true unless:
+ *
+ * 1. it is the empty string
+ * 2. it starts with a digit and the number evaluates to zero
+ * 3. it starts with either "#f" or "#F"
+ * 4. For its length or its first five characters (whichever is less)
+ * it matches the string "false"
+ */
+static bool
+eval_true(void)
+{
+ bool needFree;
+ bool res = true;
+ char const * pz = eval_mac_expr(&needFree);
+
+ if (IS_DEC_DIGIT_CHAR(*pz))
+ res = (atoi(pz) == 0) ? false : true;
+
+ else switch (*pz) {
+ case NUL:
+ res = false;
+ break;
+
+ case '#':
+ if ((pz[1] == 'f') || (pz[1] == 'F'))
+ res = false;
+ break;
+
+ case 'f':
+ case 'F':
+ {
+ int len = strlen(pz);
+ if (len > 5)
+ len = 5;
+ if (strneqvcmp(EVAL_TRUE_FALSE_STR, pz, len) == 0)
+ res = false;
+ break;
+ }
+ }
+
+ if (needFree)
+ AGFREE(pz);
+
+ return res;
+}
+
+
+/*=macfunc IF
+ *
+ * what: Conditionally Emit a Template Block
+ * cindex: conditional emit
+ * cindex: if test
+ * handler_proc:
+ * load_proc:
+ *
+ * desc:
+ * Conditional block. Its arguments are evaluated (@pxref{EXPR}) and
+ * if the result is non-zero or a string with one or more bytes,
+ * then the condition is true and the text from that point
+ * until a matched @code{ELIF}, @code{ELSE} or @code{ENDIF} is emitted.
+ * @code{ELIF} introduces a conditional alternative if the @code{IF}
+ * clause evaluated FALSE and @code{ELSE} introduces an unconditional
+ * alternative.
+ *
+ * @example
+ * [+IF <full-expression> +]
+ * emit things that are for the true condition[+
+ *
+ * ELIF <full-expression-2> +]
+ * emit things that are true maybe[+
+ *
+ * ELSE "This may be a comment" +]
+ * emit this if all but else fails[+
+ *
+ * ENDIF "This may *also* be a comment" +]
+ * @end example
+ *
+ * @noindent
+ * @code{<full-expression>} may be any expression described in the
+ * @code{EXPR} expression function, including the use of apply-codes
+ * and value-names. If the expression yields an empty string, it
+ * is interpreted as @i{false}.
+=*/
+/*=macfunc ENDIF
+ *
+ * what: Terminate the @code{IF} Template Block
+ * in-context:
+ *
+ * desc:
+ * This macro ends the @code{IF} function template block.
+ * For a complete description @xref{IF}.
+=*/
+macro_t*
+mFunc_If(templ_t* pT, macro_t* pMac)
+{
+ macro_t* pRet = pT->td_macros + pMac->md_end_idx;
+ macro_t* pIf = pMac;
+
+ do {
+ /*
+ * The current macro becomes the 'ELIF' or 'ELSE' macro
+ */
+ cur_macro = pMac;
+
+ /*
+ * 'ELSE' is equivalent to 'ELIF true'
+ */
+ if ( (pMac->md_code == FTYP_ELSE)
+ || eval_true()) {
+
+ if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS) {
+ fprintf(trace_fp, TRACE_FN_IF, (pMac->md_code == FTYP_ELSE)
+ ? FN_IF_ELSE : pT->td_text + pMac->md_txt_off,
+ pMac->md_line);
+
+ if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
+ fprintf(trace_fp, TAB_FILE_LINE_FMT,
+ current_tpl->td_file, pIf->md_line);
+ }
+
+ gen_block(pT, pMac+1, pT->td_macros + pMac->md_sib_idx);
+ break;
+ }
+ pMac = pT->td_macros + pMac->md_sib_idx;
+ } while (pMac < pRet);
+
+ if ((OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS) && (pMac >= pRet)) {
+ fprintf(trace_fp, TRACE_FN_IF_NOTHING,
+ current_tpl->td_text + cur_macro->md_txt_off);
+
+ if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
+ fprintf(trace_fp, TAB_FILE_LINE_FMT,
+ current_tpl->td_file, pIf->md_line);
+ }
+
+ return pRet;
+}
+
+
+/*=macfunc WHILE
+ *
+ * what: Conditionally loop over a Template Block
+ * cindex: conditional emit
+ * cindex: while test
+ * handler_proc:
+ * load_proc:
+ *
+ * desc:
+ * Conditionally repeated block. Its arguments are evaluated (@pxref{EXPR})
+ * and as long as the result is non-zero or a string with one or more bytes,
+ * then the condition is true and the text from that point
+ * until a matched @code{ENDWHILE} is emitted.
+ *
+ * @example
+ * [+WHILE <full-expression> +]
+ * emit things that are for the true condition[+
+ *
+ * ENDWHILE +]
+ * @end example
+ *
+ * @noindent
+ * @code{<full-expression>} may be any expression described in the
+ * @code{EXPR} expression function, including the use of apply-codes
+ * and value-names. If the expression yields an empty string, it
+ * is interpreted as @i{false}.
+=*/
+/*=macfunc ENDWHILE
+ *
+ * what: Terminate the @code{WHILE} Template Block
+ * in-context:
+ *
+ * desc:
+ * This macro ends the @code{WHILE} function template block.
+ * For a complete description @xref{WHILE}.
+=*/
+macro_t*
+mFunc_While(templ_t* pT, macro_t* pMac)
+{
+ macro_t * end = pT->td_macros + pMac->md_end_idx;
+ int ct = 0;
+
+ if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS)
+ fprintf(trace_fp, TRACE_FN_WHILE_START,
+ current_tpl->td_text + cur_macro->md_txt_off,
+ pT->td_file, pMac->md_line);
+
+ for (;;) {
+ jmp_buf jbuf;
+
+ current_tpl = pT;
+ cur_macro = pMac;
+
+ if (! eval_true())
+ break;
+ ct++;
+ if (call_gen_block(jbuf, pT, pMac+1, end) == LOOP_JMP_BREAK)
+ break;
+ }
+
+ if (OPT_VALUE_TRACE >= TRACE_BLOCK_MACROS) {
+ fprintf(trace_fp, TRACE_FN_WHILE_END, ct);
+
+ if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
+ fprintf(trace_fp, TAB_FILE_LINE_FMT, pT->td_file, pMac->md_line);
+ }
+
+ return end;
+}
+
+/*=macfunc ELIF
+ *
+ * what: Alternate Conditional Template Block
+ * in-context:
+ *
+ * desc:
+ * This macro must only appear after an @code{IF} function, and
+ * before any associated @code{ELSE} or @code{ENDIF} functions.
+ * It denotes the start of an alternate template block for the
+ * @code{IF} function. Its expression argument is evaluated as are
+ * the arguments to @code{IF}. For a complete description @xref{IF}.
+=*/
+static macro_t*
+mLoad_Elif(templ_t * pT, macro_t * pMac, char const ** ppzScan)
+{
+ if ((int)pMac->md_res == 0)
+ AG_ABEND_IN(pT, pMac, NO_IF_EXPR);
+ /*
+ * Load the expression
+ */
+ (void)mLoad_Expr(pT, pMac, ppzScan);
+
+ current_if.pElse->md_sib_idx = pMac - pT->td_macros;
+ current_if.pElse = pMac;
+ return pMac + 1;
+}
+
+
+/*=macfunc ELSE
+ *
+ * what: Alternate Template Block
+ * in-context:
+ *
+ * desc:
+ * This macro must only appear after an @code{IF} function,
+ * and before the associated @code{ENDIF} function.
+ * It denotes the start of an alternate template block for
+ * the @code{IF} function. For a complete description @xref{IF}.
+=*/
+static macro_t *
+mLoad_Else(templ_t * pT, macro_t * pMac, char const ** ppzScan)
+{
+ /*
+ * After processing an "ELSE" macro,
+ * we have a special handler function for 'ENDIF' only.
+ */
+ static load_proc_p_t load_for_if_after_else_procs[ FUNC_CT ] = { NULL };
+ (void)ppzScan;
+
+ if (load_for_if_after_else_procs[0] == NULL) {
+ memcpy((void*)load_for_if_after_else_procs, base_load_table,
+ sizeof(base_load_table));
+ load_for_if_after_else_procs[ FTYP_ENDIF ] = &mLoad_Ending;
+ }
+
+ load_proc_table = load_for_if_after_else_procs;
+
+ current_if.pElse->md_sib_idx = pMac - pT->td_macros;
+ current_if.pElse = pMac;
+ pMac->md_txt_off = 0;
+
+ return pMac+1;
+}
+
+
+/**
+ * End any of the block macros. It ends @code{ENDDEF},
+ * @code{ENDFOR}, @code{ENDIF}, @code{ENDWHILE} and @code{ESAC}. It
+ * leaves no entry in the dispatch tables for itself. By returning
+ * NULL, it tells the macro parsing loop to return.
+ *
+ * @param tpl ignored
+ * @param[out] mac zeroed out for re-use
+ * @param scan ignored
+ */
+macro_t *
+mLoad_Ending(templ_t * tpl, macro_t * mac, char const ** scan)
+{
+ (void) tpl;
+ (void) scan;
+ memset((void*)mac, 0, sizeof(*mac));
+ return NULL;
+}
+
+/**
+ * Load template macros until matching @code{ENDIF} is found.
+ *
+ * @param[in,out] tpl Template we are filling in with macros
+ * @param[in,out] mac Linked into the "if" macro segments
+ * @param[in,out] scan pointer to scanning pointer. We advance it
+ * past the ending @code{ENDIF} macro.
+ *
+ * @returns the address of the next macro slot for insertion.
+ */
+macro_t *
+mLoad_If(templ_t * tpl, macro_t * mac, char const ** ppzScan)
+{
+ size_t srcLen = (size_t)mac->md_res; /* macro len */
+ tIfStack save_stack = current_if;
+ load_proc_p_t const * papLP = load_proc_table;
+ macro_t * pEndifMac;
+
+ /*
+ * While processing an "IF" macro,
+ * we have handler functions for 'ELIF', 'ELSE' and 'ENDIF'
+ * Otherwise, we do not. Switch the callout function table.
+ */
+ static load_proc_p_t apIfLoad[ FUNC_CT ] = { NULL };
+
+ /*
+ * IF there is no associated text expression
+ * THEN woops! what are we to case on?
+ */
+ if (srcLen == 0)
+ AG_ABEND_IN(tpl, mac, NO_IF_EXPR);
+
+ if (apIfLoad[0] == NULL) {
+ memcpy((void*)apIfLoad, base_load_table, sizeof(base_load_table));
+ apIfLoad[ FTYP_ELIF ] = &mLoad_Elif;
+ apIfLoad[ FTYP_ELSE ] = &mLoad_Else;
+ apIfLoad[ FTYP_ENDIF ] = &mLoad_Ending;
+ }
+
+ load_proc_table = apIfLoad;
+
+ /*
+ * We will need to chain together the 'IF', 'ELIF', and 'ELSE'
+ * macros. The 'ENDIF' gets absorbed.
+ */
+ current_if.pIf = current_if.pElse = mac;
+
+ /*
+ * Load the expression
+ */
+ (void)mLoad_Expr(tpl, mac, ppzScan);
+
+ /*
+ * Now, do a nested parse of the template.
+ * When the matching 'ENDIF' macro is encountered,
+ * the handler routine will cause 'parse_tpl()'
+ * to return with the text scanning pointer pointing
+ * to the remaining text.
+ */
+ pEndifMac = parse_tpl(mac+1, ppzScan);
+ if (*ppzScan == NULL)
+ AG_ABEND_IN(tpl, mac, LD_IF_NO_ENDIF);
+
+ current_if.pIf->md_end_idx = \
+ current_if.pElse->md_sib_idx = pEndifMac - tpl->td_macros;
+
+ /*
+ * Restore the context of any encompassing block macros
+ */
+ current_if = save_stack;
+ load_proc_table = papLP;
+ return pEndifMac;
+}
+
+/**
+ * load the @code{WHILE} macro. Sets up the while loop parsing table, which
+ * is a copy of the global "base_load_table" with added entries for
+ * @code{ENDWHILE}, @code{NEXT} and @code{BREAK}.
+ *
+ * @param[in,out] tpl Template we are filling in with macros
+ * @param[in,out] mac Linked into the "if" macro segments
+ * @param[in,out] scan pointer to scanning pointer. We advance it
+ * past the ending @code{ENDWHILE} macro.
+ *
+ * @returns the address of the next macro slot for insertion.
+ */
+macro_t *
+mLoad_While(templ_t * pT, macro_t * mac, char const ** p_scan)
+{
+ /*
+ * While processing a "WHILE" macro,
+ * we have handler a handler function for ENDWHILE, NEXT and BREAK.
+ */
+ static load_proc_p_t while_tbl[ FUNC_CT ] = { NULL };
+
+
+ load_proc_p_t const * lpt = load_proc_table; //!< save current table
+
+ /*
+ * IF there is no associated text expression
+ * THEN woops! what are we to case on?
+ */
+ if ((size_t)mac->md_res == 0)
+ AG_ABEND_IN(pT, mac, LD_WHILE_NO_EXPR);
+
+ if (while_tbl[0] == NULL) {
+ memcpy((void*)while_tbl, base_load_table, sizeof(base_load_table));
+ while_tbl[ FTYP_ENDWHILE ] = &mLoad_Ending;
+ }
+
+ load_proc_table = while_tbl;
+
+ /*
+ * Load the expression
+ */
+ (void)mLoad_Expr(pT, mac, p_scan);
+
+ /*
+ * Now, do a nested parse of the template. When the matching 'ENDWHILE'
+ * macro is encountered, the handler routine will cause 'parse_tpl()'
+ * to return with the text scanning pointer pointing to the remaining
+ * text.
+ */
+ {
+ macro_t * end = parse_tpl(mac+1, p_scan);
+ if (*p_scan == NULL)
+ AG_ABEND_IN(pT, mac, LD_WHILE_NO_ENDWHILE);
+
+ mac->md_sib_idx = \
+ mac->md_end_idx = end - pT->td_macros;
+
+ load_proc_table = lpt; // restore context
+ return end;
+ }
+}
+
+/*=gfunc set_writable
+ *
+ * what: Make the output file be writable
+ *
+ * exparg: + set? + boolean arg, false to make output non-writable + opt
+ *
+ * doc: This function will set the current output file to be writable
+ * (or not). This is only effective if neither the @code{--writable}
+ * nor @code{--not-writable} have been specified. This state
+ * is reset when the current suffix's output is complete.
+=*/
+SCM
+ag_scm_set_writable(SCM set)
+{
+ switch (STATE_OPT(WRITABLE)) {
+ case OPTST_DEFINED:
+ case OPTST_PRESET:
+ fprintf(trace_fp, SET_WRITE_WARN, current_tpl->td_file,
+ cur_macro->md_line);
+ break;
+
+ default:
+ if (AG_SCM_BOOL_P(set) && (set == SCM_BOOL_F))
+ CLEAR_OPT(WRITABLE);
+ else
+ SET_OPT_WRITABLE;
+ }
+
+ return SCM_UNDEFINED;
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/funcIf.c */
diff --git a/agen5/functions.c b/agen5/functions.c
new file mode 100644
index 0000000..963bd06
--- /dev/null
+++ b/agen5/functions.c
@@ -0,0 +1,539 @@
+
+/**
+ * @file functions.c
+ *
+ * Time-stamp: "2012-06-10 11:24:45 bkorb"
+ *
+ * This module implements text functions.
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*=macfunc CONTINUE
+ *
+ * handler-proc: Break
+ * load-proc: Leave
+ * what: Skip to end of a FOR or WHILE macro.
+ *
+ * desc:
+ * This will skip the remainder of the loop and start the next.
+=*/
+
+/*=macfunc BREAK
+ *
+ * handler-proc: Break
+ * load-proc: Leave
+ * what: Leave a FOR or WHILE macro
+ *
+ * desc:
+ * This will unwind the loop context and resume after ENDFOR/ENDWHILE.
+ * Note that unless this happens to be the last iteration anyway,
+ * the (last-for?) function will never yield "#t".
+=*/
+macro_t *
+mFunc_Break(templ_t * tpl, macro_t * mac)
+{
+ for_state_t * fst = curr_ivk_info->ii_for_data;
+ int code = (mac->md_code == FTYP_BREAK) ? LOOP_JMP_BREAK : LOOP_JMP_NEXT;
+ if (fst == NULL) {
+ char const * which =
+ (mac->md_code == FTYP_BREAK) ? BREAK_STR : CONTINUE_STR;
+ AG_ABEND(aprf(BAD_BREAK_FMT, which));
+ }
+ fst += curr_ivk_info->ii_for_depth - 1;
+
+ (void)tpl;
+ (void)mac;
+ longjmp(fst->for_env, code);
+}
+
+/**
+ * wrapper function for calling gen_block in a loop.
+ * It sets up and handles the jump buffer, returning the jump result.
+ *
+ * @param[in,out] jbuf the jump buffer
+ * @param[in] tpl the new active template
+ * @param[in] mac the looping macro
+ * @param[in] end_mac pointer to the first macro after the block
+ *
+ * @returns either LOOP_JMP_OKAY (0) or LOOP_JMP_BREAK (the caller should
+ * exit the loop).
+ */
+LOCAL loop_jmp_type_t
+call_gen_block(jmp_buf jbuf, templ_t * tpl, macro_t * mac, macro_t * end_mac)
+{
+ switch (setjmp(jbuf)) {
+ case LOOP_JMP_OKAY: // 0
+ gen_block(tpl, mac, end_mac);
+ /* FALLTHROUGH */
+
+ case LOOP_JMP_NEXT:
+ return LOOP_JMP_OKAY;
+
+ case LOOP_JMP_BREAK:
+ default:
+ return LOOP_JMP_BREAK;
+ }
+}
+
+/*=macfunc RETURN
+ *
+ * handler-proc:
+ * load-proc: Leave
+ *
+ * what: Leave an INVOKE-d (DEFINE) macro
+ *
+ * desc:
+ * This will unwind looping constructs inside of a DEFINE-d macro and
+ * return to the invocation point. The output files and diversions
+ * @i{are left alone}. This means it is unwise to start diversions
+ * in a DEFINEd macro and RETURN from it before you have handled the
+ * diversion. Unless you are careful. Here is some rope for you.
+ * Please be careful using it.
+=*/
+macro_t *
+mFunc_Return(templ_t * tpl, macro_t * mac)
+{
+ (void)tpl;
+ (void)mac;
+ free_for_context(true);
+ if (curr_ivk_info->ii_prev == NULL)
+ AG_ABEND_IN(tpl, mac, RETURN_FROM_NOWHERE);
+ longjmp(curr_ivk_info->ii_env, 1);
+}
+
+/**
+ * Generate a block with a new template context. It may be either
+ * an @code{INCLUDE}-d template or a user @code{DEFINE}-d macro.
+ * If @code{gen_block} returns with a long jump, the long jump value
+ * is ignored. It was terminated early with a @code{RETURN}.
+ *
+ * @param[in] tpl new template block (included or invoked).
+ */
+LOCAL void
+gen_new_block(templ_t * tpl)
+{
+ templ_t * oldt = current_tpl;
+ ivk_info_t ii = IVK_INFO_INITIALIZER(curr_ivk_info);
+
+ curr_ivk_info = &ii;
+
+ if (setjmp(ii.ii_env) == 0) {
+ macro_t * m = tpl->td_macros;
+ gen_block(tpl, m, m + tpl->td_mac_ct);
+ }
+
+ current_tpl = oldt;
+ curr_ivk_info = ii.ii_prev;
+}
+
+/**
+ * Validate the context for leaving early. @code{FOR} and @code{WHILE} loops
+ * may leave an interation early with @code{CONTINUE} or @code{BREAK}.
+ * @code{DEFINE}-d macros and @code{INCLUDE}-d files may leave early with
+ * @code{RETURN}. Loops may not be left early from an @code{INVOKE}-d macro
+ * or an @code{INCLUDE}-d template.
+ *
+ * This load function handles @code{BREAK}, @code{CONTINUE} and @code{RETURN}.
+ * It is always defined, so it must check for itself whether the
+ * context is correct or not.
+ *
+ * @param tpl template being loaded
+ * @param mac the macro descriptor
+ * @param p_scan the input text scanning pointer
+ *
+ * @returns the macro table entry after mac
+ */
+LOCAL macro_t *
+mLoad_Leave(templ_t * tpl, macro_t * mac, char const ** p_scan)
+{
+ (void) tpl;
+
+ if (mac->md_code == FTYP_RETURN) {
+ /*
+ * Check returns at load time. "break" and "continue" at
+ * instantiation time.
+ */
+ if (! defining_macro && (include_depth == 0))
+ (void)mLoad_Bogus(tpl, mac, p_scan);
+ }
+ return mac + 1;
+}
+
+/*=macfunc INCLUDE
+ *
+ * what: Read in and emit a template block
+ * handler_proc:
+ * load_proc: Expr
+ *
+ * desc:
+ *
+ * The entire contents of the named file is inserted at this point.
+ * The contents of the file are processed for macro expansion. The
+ * arguments are eval-ed, so you may compute the name of the file to
+ * be included. The included file must not contain any incomplete
+ * function blocks. Function blocks are template text beginning with
+ * any of the macro functions @samp{CASE}, @samp{DEFINE}, @samp{FOR},
+ * @samp{IF} and @samp{WHILE}; extending through their respective
+ * terminating macro functions.
+=*/
+macro_t *
+mFunc_Include(templ_t * tpl, macro_t * mac)
+{
+ bool allocated_name;
+ char const * fname = eval_mac_expr(&allocated_name);
+
+ include_depth++;
+ if (*fname != NUL) {
+ templ_t * new_tpl = tpl_load(fname, tpl->td_file);
+ macro_t * last_mac = new_tpl->td_macros + (new_tpl->td_mac_ct - 1);
+
+ if (last_mac->md_code == FTYP_TEXT) {
+ /*
+ * Strip off trailing white space from included templates
+ */
+ char * pz = new_tpl->td_text + last_mac->md_txt_off;
+ char * pe = SPN_WHITESPACE_BACK(pz, pz);
+
+ /*
+ * IF there is no text left, remove the macro entirely
+ */
+ if (pe > pz) {
+ *pe = NUL;
+ } else {
+ new_tpl->td_mac_ct--;
+ }
+ }
+
+ if (OPT_VALUE_TRACE > TRACE_DEBUG_MESSAGE) {
+ fprintf(trace_fp, TRACE_FN_INC_TPL, new_tpl->td_file);
+ if (OPT_VALUE_TRACE == TRACE_EVERYTHING)
+ fprintf(trace_fp, TRACE_FN_INC_LINE, current_tpl->td_file,
+ mac->md_line);
+ }
+
+ gen_new_block(new_tpl);
+ tpl_unload(new_tpl);
+ current_tpl = tpl;
+ }
+ include_depth--;
+
+ if (allocated_name)
+ AGFREE((void*)fname);
+
+ return mac + 1;
+}
+
+/*=macfunc UNKNOWN
+ *
+ * what: Either a user macro or a value name.
+ * handler_proc:
+ * load_proc:
+ * unnamed:
+ *
+ * desc:
+ *
+ * The macro text has started with a name not known to AutoGen. If, at run
+ * time, it turns out to be the name of a defined macro, then that macro is
+ * invoked. If it is not, then it is a conditional expression that is
+ * evaluated only if the name is defined at the time the macro is invoked.
+ *
+ * You may not specify @code{UNKNOWN} explicitly.
+=*/
+macro_t *
+mFunc_Unknown(templ_t * pT, macro_t * pMac)
+{
+ templ_t * pInv = find_tpl(pT->td_text + pMac->md_name_off);
+ if (pInv != NULL) {
+ if (OPT_VALUE_TRACE >= TRACE_EVERYTHING)
+ fprintf(trace_fp, TRACE_FN_REMAPPED, TRACE_FN_REMAP_INVOKE,
+ pMac->md_code, pT->td_file, pMac->md_line);
+ pMac->md_code = FTYP_DEFINE;
+ pMac->md_pvt = (void*)pInv;
+ parse_mac_args(pT, pMac);
+ return mFunc_Define(pT, pMac);
+ }
+
+ if (OPT_VALUE_TRACE >= TRACE_EVERYTHING) {
+ fprintf(trace_fp, TRACE_FN_REMAPPED, TRACE_FN_REMAP_EXPR,
+ pMac->md_code, pT->td_file, pMac->md_line);
+ fprintf(trace_fp, TRACE_FN_REMAP_BASE,
+ pT->td_text + pMac->md_name_off);
+ }
+
+ pMac->md_code = FTYP_EXPR;
+ if (pMac->md_txt_off == 0) {
+ pMac->md_res = EMIT_VALUE;
+
+ } else {
+ char* pzExpr = pT->td_text + pMac->md_txt_off;
+ switch (*pzExpr) {
+ case ';':
+ case '(':
+ pMac->md_res = EMIT_EXPRESSION;
+ break;
+
+ case '`':
+ pMac->md_res = EMIT_SHELL;
+ span_quote(pzExpr);
+ break;
+
+ case '"':
+ case '\'':
+ span_quote(pzExpr);
+ /* FALLTHROUGH */
+
+ default:
+ pMac->md_res = EMIT_STRING;
+ }
+
+ if (OPT_VALUE_TRACE >= TRACE_EVERYTHING)
+ fprintf(trace_fp, TRACE_UNKNOWN_FMT, pMac->md_res, pzExpr);
+ }
+
+ return mFunc_Expr(pT, pMac);
+}
+
+
+/*=macfunc BOGUS
+ *
+ * what: Out-of-context or unknown functions are bogus.
+ * handler_proc:
+ * load_proc:
+ * unnamed:
+=*/
+macro_t*
+mFunc_Bogus(templ_t* pT, macro_t* pMac)
+{
+ char * pz = aprf(FN_BOGUS_FMT, pMac->md_code,
+ (pMac->md_code < FUNC_CT)
+ ? ag_fun_names[ pMac->md_code ]
+ : FN_BOGUS_HUH);
+
+ AG_ABEND_IN(pT, pMac, pz);
+ /* NOTREACHED */
+ return pMac;
+}
+
+
+/*=macfunc TEXT
+ *
+ * what: A block of text to be emitted.
+ * handler_proc:
+ * unnamed:
+=*/
+macro_t*
+mFunc_Text(templ_t* pT, macro_t* pMac)
+{
+ fputs(pT->td_text + pMac->md_txt_off, cur_fpstack->stk_fp);
+ fflush(cur_fpstack->stk_fp);
+ return pMac + 1;
+}
+
+
+/*=macfunc COMMENT
+ *
+ * what: A block of comment to be ignored
+ * load_proc:
+ * alias: "#"
+ *
+ * desc:
+ * This function can be specified by the user, but there will
+ * never be a situation where it will be invoked at emit time.
+ * The macro is actually removed from the internal representation.
+ *
+ * If the native macro name code is @code{#}, then the
+ * entire macro function is treated as a comment and ignored.
+ *
+ * @example
+ * [+ # say what you want, but no '+' before any ']' chars +]
+ * @end example
+=*/
+macro_t *
+mLoad_Comment(templ_t * tpl, macro_t * mac, char const ** p_scan)
+{
+ (void)tpl;
+ (void)p_scan;
+ memset((void*)mac, 0, sizeof(*mac));
+ return mac;
+}
+
+/**
+ * The default (unknown) load function.
+ *
+ * Move any text into the text offset field. This macro will change to
+ * either INVOKE or an expression function, depending on whether or not a
+ * DEFINE macro corresponds to the name. This is determined at instantiation
+ * time. This is used as the default load mechanism.
+ *
+ * @param tpl template being loaded
+ * @param mac the macro descriptor
+ * @param p_scan the input text scanning pointer
+ *
+ * @returns the macro table entry after mac
+ */
+macro_t *
+mLoad_Unknown(templ_t * tpl, macro_t * mac, char const ** unused)
+{
+ char const * scan;
+ ssize_t src_len = (size_t)mac->md_res; /* macro len */
+ (void)unused;
+
+ if (src_len <= 0)
+ goto return_emtpy_expr;
+
+ scan = (char const*)mac->md_txt_off; /* macro text */
+
+ switch (*scan) {
+ case ';':
+ {
+ char const * start = scan;
+
+ /*
+ * Strip off scheme comments
+ */
+ do {
+ scan = strchr(scan, NL);
+ if (scan == NULL)
+ goto return_emtpy_expr;
+ scan = SPN_WHITESPACE_CHARS(scan);
+ if (*scan == NUL)
+ goto return_emtpy_expr;
+ } while (*scan == ';');
+ src_len -= scan - start;
+ break;
+ }
+
+ case '[':
+ case '.':
+ {
+ /*
+ * We are going to recopy the definition name, this time as a
+ * canonical name (i.e. including '[', ']' and '.' characters,
+ * but with all blanks squeezed out)
+ */
+ char * cname = tpl->td_text + mac->md_name_off;
+ size_t cname_len = strlen(cname);
+
+ /*
+ * Move back the source pointer. We may have skipped blanks,
+ * so skip over however many first, then back up over the name.
+ * We have found a name, so we won't back up past the start.
+ */
+ while (IS_WHITESPACE_CHAR(scan[-1])) scan--, src_len++;
+ scan -= cname_len;
+ src_len += cname_len;
+
+ /*
+ * Now copy over the full canonical name. Check for errors.
+ * Advance the scan pointer to just past the name we've copied.
+ */
+ {
+ size_t rem_len = canonical_name(cname, scan, (int)src_len);
+ if (rem_len > src_len)
+ AG_ABEND_IN(tpl, mac, LD_UNKNOWN_INVAL_DEF);
+
+ scan += src_len - rem_len;
+ src_len = rem_len;
+ }
+
+ /*
+ * Where we are stashing text ("td_scan") gets set to just past the
+ * NUL byte terminating the name. "cname" is now longer than before.
+ */
+ tpl->td_scan = cname + strlen(cname) + 1;
+ if (src_len <= 0)
+ goto return_emtpy_expr;
+ break;
+ }
+ }
+
+ /*
+ * Copy the expression (the remaining text)
+ */
+ {
+ char * dest = tpl->td_scan; /* next text dest */
+ mac->md_txt_off = (dest - tpl->td_text);
+ mac->md_res = 0;
+ memcpy(dest, scan, src_len);
+ dest += src_len;
+ *(dest++) = NUL;
+ *dest = NUL; /* double terminate */
+ tpl->td_scan = dest;
+ }
+
+ return mac + 1;
+
+ return_emtpy_expr:
+ mac->md_txt_off = 0;
+ mac->md_res = 0;
+ return mac + 1;
+}
+
+
+/**
+ * Some functions are known to AutoGen, but invalid out of context.
+ * For example, ELIF, ELSE and ENDIF are all known to AutoGen.
+ * However, the load function pointer for those functions points
+ * here, until an "IF" function is encountered.
+ *
+ * @param tpl template being loaded
+ * @param mac the macro descriptor
+ * @param p_scan the input text scanning pointer
+ *
+ * @returns the macro table entry after mac
+ */
+macro_t *
+mLoad_Bogus(templ_t * tpl, macro_t * mac, char const ** p_scan)
+{
+ char const * pzSrc = (char const*)mac->md_txt_off; /* macro text */
+ char const * pzMac;
+
+ char z[ 64 ];
+ (void)p_scan;
+
+ if (pzSrc != NULL) {
+ z[0] = ':';
+ z[1] = z[2] = ' ';
+ strncpy(z+3, pzSrc, (size_t)60);
+ z[63] = NUL;
+ pzSrc = z;
+ }
+ else
+ pzSrc = zNil;
+
+ {
+ int ix = mac->md_code;
+ if ((unsigned)ix >= FUNC_CT)
+ ix = 0;
+
+ pzMac = ag_fun_names[ ix ];
+ }
+
+ pzSrc = aprf(LD_BOGUS_UNKNOWN, tpl->td_file, mac->md_line, pzMac, pzSrc);
+
+ AG_ABEND_IN(tpl, mac, pzSrc);
+ /* NOTREACHED */
+ return NULL;
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/functions.c */
diff --git a/agen5/functions.h b/agen5/functions.h
new file mode 100644
index 0000000..b19b0a9
--- /dev/null
+++ b/agen5/functions.h
@@ -0,0 +1,325 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (functions.h)
+ *
+ * It has been AutoGen-ed
+ * From the definitions functions.def
+ * and the template file functions.tpl
+ *
+ * Tables of Text Functions for AutoGen
+ *
+ * copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * The 24 AutoGen macros are tagged with special attributes:
+ *
+ * A - is invoked via an alias
+ *
+ * U - is unnamed. May *not* be explicitly invoked. May not have
+ * have an alias. These three are used by AutoGen for its purposes.
+ *
+ * L - has a special load procedure defined
+ *
+ * C - in context. May be explicitly invoked in certain situations.
+ * For example, "ELSE" may only be specified within an "IF" block.
+ * Their load procedures are enabled by the block macro (e.g. IF),
+ * and disabled by the block ending macro (e.g. ENDIF).
+ * While disabled, the load procedure is the "Bogus" method.
+ *
+ * If a function is neither has a special load procedure nor is
+ * situational, then the "Unknown" load method is applied.
+ *
+ * R - has a special remove (unload) procedure
+ *
+ * H - has a handler procedure defined. Only these procedures should
+ * be encountered by the dispatcher during processing.
+ *
+ * U L H - BOGUS Out-of-context or unknown functions are bogus.
+ * L H - BREAK Leave a FOR or WHILE macro
+ * L H - CASE Select one of several template blocks
+ * A L - COMMENT A block of comment to be ignored
+ * L H - CONTINUE Skip to end of a FOR or WHILE macro.
+ * L H - DEBUG Print debug message to trace output
+ * L RH - DEFINE Define a user AutoGen macro
+ * C - ELIF Alternate Conditional Template Block
+ * C - ELSE Alternate Template Block
+ * C - ENDDEF Ends a macro definition.
+ * C - ENDFOR Terminates the @code{FOR} function template block
+ * C - ENDIF Terminate the @code{IF} Template Block
+ * C - ENDWHILE Terminate the @code{WHILE} Template Block
+ * C - ESAC Terminate the @code{CASE} Template Block
+ * A L H - EXPR Evaluate and emit an Expression
+ * L H - FOR Emit a template block multiple times
+ * L H - IF Conditionally Emit a Template Block
+ * L H - INCLUDE Read in and emit a template block
+ * H - INVOKE Invoke a User Defined Macro
+ * L H - RETURN Leave an INVOKE-d (DEFINE) macro
+ * A C R - SELECT Selection block for CASE function
+ * U H - TEXT A block of text to be emitted.
+ * U L H - UNKNOWN Either a user macro or a value name.
+ * L H - WHILE Conditionally loop over a Template Block
+ */
+#ifndef AUTOGEN_FUNCTIONS_H_GUARD
+#define AUTOGEN_FUNCTIONS_H_GUARD 1
+
+#define FUNC_CT 24
+
+/**
+ * Enumerate all the AutoGen macro types.
+ */
+typedef enum {
+ FTYP_BOGUS, /* Out-of-context or unknown functions are bogus. */
+ FTYP_BREAK, /* Leave a FOR or WHILE macro */
+ FTYP_CASE, /* Select one of several template blocks */
+ FTYP_COMMENT, /* A block of comment to be ignored */
+ FTYP_CONTINUE, /* Skip to end of a FOR or WHILE macro. */
+ FTYP_DEBUG, /* Print debug message to trace output */
+ FTYP_DEFINE, /* Define a user AutoGen macro */
+ FTYP_ELIF, /* Alternate Conditional Template Block */
+ FTYP_ELSE, /* Alternate Template Block */
+ FTYP_ENDDEF, /* Ends a macro definition. */
+ FTYP_ENDFOR, /* Terminates the @code{FOR} function template block */
+ FTYP_ENDIF, /* Terminate the @code{IF} Template Block */
+ FTYP_ENDWHILE, /* Terminate the @code{WHILE} Template Block */
+ FTYP_ESAC, /* Terminate the @code{CASE} Template Block */
+ FTYP_EXPR, /* Evaluate and emit an Expression */
+ FTYP_FOR, /* Emit a template block multiple times */
+ FTYP_IF, /* Conditionally Emit a Template Block */
+ FTYP_INCLUDE, /* Read in and emit a template block */
+ FTYP_INVOKE, /* Invoke a User Defined Macro */
+ FTYP_RETURN, /* Leave an INVOKE-d (DEFINE) macro */
+ FTYP_SELECT, /* Selection block for CASE function */
+ FTYP_TEXT, /* A block of text to be emitted. */
+ FTYP_UNKNOWN, /* Either a user macro or a value name. */
+ FTYP_WHILE, /* Conditionally loop over a Template Block */
+
+ FTYP_SELECT_COMPARE_FULL = 0x8000, /* *==* */
+ FTYP_SELECT_COMPARE_SKP_START = 0x8001, /* *== */
+ FTYP_SELECT_COMPARE_SKP_END = 0x8002, /* ==* */
+ FTYP_SELECT_COMPARE = 0x8003, /* == */
+
+ FTYP_SELECT_EQUIVALENT_FULL = 0x8004, /* *=* */
+ FTYP_SELECT_EQUIVALENT_SKP_START = 0x8005, /* *= */
+ FTYP_SELECT_EQUIVALENT_SKP_END = 0x8006, /* =* */
+ FTYP_SELECT_EQUIVALENT = 0x8007, /* = */
+
+ FTYP_SELECT_MATCH_FULL = 0x8008, /* *~~* */
+ FTYP_SELECT_MATCH_SKP_START = 0x8009, /* *~~ */
+ FTYP_SELECT_MATCH_SKP_END = 0x800A, /* ~~* */
+ FTYP_SELECT_MATCH = 0x800B, /* ~~ */
+
+ FTYP_SELECT_EQV_MATCH_FULL = 0x800C, /* *~* */
+ FTYP_SELECT_EQV_MATCH_SKP_START = 0x800D, /* *~ */
+ FTYP_SELECT_EQV_MATCH_SKP_END = 0x800E, /* ~* */
+ FTYP_SELECT_EQV_MATCH = 0x800F, /* ~ */
+
+ FTYP_SELECT_MATCH_ANYTHING = 0x801C, /* * */
+ FTYP_SELECT_MATCH_EXISTENCE = 0x801D, /* +E */
+ FTYP_SELECT_MATCH_NONEXISTENCE = 0x801E /* !E */
+} mac_func_t;
+
+/**
+ * The function processing procedures.
+ */
+hdlr_proc_t
+ mFunc_Bogus, mFunc_Break, mFunc_Case, mFunc_Debug, mFunc_Define,
+ mFunc_Expr, mFunc_For, mFunc_If, mFunc_Include, mFunc_Invoke,
+ mFunc_Return, mFunc_Text, mFunc_Unknown, mFunc_While;
+
+/**
+ * Template Loading Functions.
+ */
+load_proc_t
+ mLoad_Bogus, mLoad_Case, mLoad_Comment, mLoad_Debug, mLoad_Define,
+ mLoad_Ending, mLoad_Expr, mLoad_For, mLoad_If, mLoad_Leave,
+ mLoad_Unknown, mLoad_While;
+
+/* tpParse.c use only * * * * * * * * * * * * * * * */
+/**
+ * Parsing function tables for load processing (template scanning phase).
+ */
+static load_proc_p_t const base_load_table[ FUNC_CT ] = {
+ /* BOGUS */ mLoad_Bogus,
+ /* BREAK */ mLoad_Leave,
+ /* CASE */ mLoad_Case,
+ /* COMMENT */ mLoad_Comment,
+ /* CONTINUE */ mLoad_Leave,
+ /* DEBUG */ mLoad_Debug,
+ /* DEFINE */ mLoad_Define,
+ /* ELIF */ mLoad_Bogus /*dynamic*/,
+ /* ELSE */ mLoad_Bogus /*dynamic*/,
+ /* ENDDEF */ mLoad_Bogus /*dynamic*/,
+ /* ENDFOR */ mLoad_Bogus /*dynamic*/,
+ /* ENDIF */ mLoad_Bogus /*dynamic*/,
+ /* ENDWHILE */ mLoad_Bogus /*dynamic*/,
+ /* ESAC */ mLoad_Bogus /*dynamic*/,
+ /* EXPR */ mLoad_Expr,
+ /* FOR */ mLoad_For,
+ /* IF */ mLoad_If,
+ /* INCLUDE */ mLoad_Expr,
+ /* INVOKE */ mLoad_Unknown /*default*/,
+ /* RETURN */ mLoad_Leave,
+ /* SELECT */ mLoad_Bogus /*dynamic*/,
+ /* TEXT */ mLoad_Unknown /*default*/,
+ /* UNKNOWN */ mLoad_Unknown,
+ /* WHILE */ mLoad_While
+};
+
+/**
+ * This global pointer is used to switch parsing tables.
+ * The block functions (CASE, DEFINE, FOR, and IF) change this to point
+ * to their tables that include relevant additional functions.
+ */
+load_proc_p_t const * load_proc_table = base_load_table;
+
+/**
+ * name-to-function type mapping table.
+ * This table must be sorted alphabetically by the content
+ * of the naming string.
+ */
+typedef struct fn_name_type fn_name_type_t;
+struct fn_name_type {
+ size_t cmpLen; /*!< compare length (sans NUL) */
+ char const * pName; /*!< ptr to name */
+ mac_func_t fType; /*!< function type enum */
+};
+
+/**
+ * Define all the strings that are used to determine the function enumeration
+ * number. These are used in a table separated by aliases and sorted by these
+ * ASCII values.
+ */
+static char const zFnStrg[142] =
+ "BREAK\0" "CASE\0" "#\0" "CONTINUE\0" "DEBUG\0"
+ "DEFINE\0" "ELIF\0" "ELSE\0" "ENDDEF\0" "ENDFOR\0"
+ "ENDIF\0" "ENDWHILE\0" "ESAC\0" "-\0" "?\0"
+ "%\0" ";\0" "(\0" "`\0" "\"\0"
+ "'\0" ".\0" "FOR\0" "IF\0" "INCLUDE\0"
+ "INVOKE\0" "RETURN\0" "~\0" "=\0" "*\0"
+ "!\0" "+\0" "WHILE\0";
+
+/**
+ * The number of names by which the macros go.
+ * Some have multiple names (aliases, e.g. selection clauses).
+ */
+#define FUNC_ALIAS_LOW_INDEX 0
+#define FUNC_ALIAS_HIGH_INDEX 14
+#define FUNC_NAMES_LOW_INDEX 15
+#define FUNC_NAMES_HIGH_INDEX 32
+#define FUNCTION_NAME_CT 33
+
+/* * * * * * * * tpParse.c use only * * * * * * * * * * * * * * */
+/**
+ * And now, the table separated by aliasing and then sorted by string content
+ */
+static fn_name_type_t const fn_name_types[ FUNCTION_NAME_CT ] = {
+ { 1, zFnStrg +132, FTYP_SELECT },
+ { 1, zFnStrg + 91, FTYP_EXPR },
+ { 1, zFnStrg + 11, FTYP_COMMENT },
+ { 1, zFnStrg + 83, FTYP_EXPR },
+ { 1, zFnStrg + 93, FTYP_EXPR },
+ { 1, zFnStrg + 87, FTYP_EXPR },
+ { 1, zFnStrg +130, FTYP_SELECT },
+ { 1, zFnStrg +134, FTYP_SELECT },
+ { 1, zFnStrg + 79, FTYP_EXPR },
+ { 1, zFnStrg + 95, FTYP_EXPR },
+ { 1, zFnStrg + 85, FTYP_EXPR },
+ { 1, zFnStrg +128, FTYP_SELECT },
+ { 1, zFnStrg + 81, FTYP_EXPR },
+ { 1, zFnStrg + 89, FTYP_EXPR },
+ { 1, zFnStrg +126, FTYP_SELECT },
+
+ { 5, zFnStrg + 0, FTYP_BREAK },
+ { 4, zFnStrg + 6, FTYP_CASE },
+ { 8, zFnStrg + 13, FTYP_CONTINUE },
+ { 5, zFnStrg + 22, FTYP_DEBUG },
+ { 6, zFnStrg + 28, FTYP_DEFINE },
+ { 4, zFnStrg + 35, FTYP_ELIF },
+ { 4, zFnStrg + 40, FTYP_ELSE },
+ { 6, zFnStrg + 45, FTYP_ENDDEF },
+ { 6, zFnStrg + 52, FTYP_ENDFOR },
+ { 5, zFnStrg + 59, FTYP_ENDIF },
+ { 8, zFnStrg + 65, FTYP_ENDWHILE },
+ { 4, zFnStrg + 74, FTYP_ESAC },
+ { 3, zFnStrg + 97, FTYP_FOR },
+ { 2, zFnStrg +101, FTYP_IF },
+ { 7, zFnStrg +104, FTYP_INCLUDE },
+ { 6, zFnStrg +112, FTYP_INVOKE },
+ { 6, zFnStrg +119, FTYP_RETURN },
+ { 5, zFnStrg +136, FTYP_WHILE } };
+
+static char const * const ag_fun_names[ FUNC_CT ] = {
+ "Bogus", zFnStrg+0, zFnStrg+6, "COMMENT", zFnStrg+13,
+ zFnStrg+22, zFnStrg+28, zFnStrg+35, zFnStrg+40, zFnStrg+45,
+ zFnStrg+52, zFnStrg+59, zFnStrg+65, zFnStrg+74, "EXPR",
+ zFnStrg+97, zFnStrg+101, zFnStrg+104, zFnStrg+112, zFnStrg+119,
+ "SELECT", "Text", "Unknown", zFnStrg+136 };
+
+/* * * * * * * * tpProcess.c use only * * * * * * * * * * * * * */
+/**
+ * Template Processing Function Table
+ *
+ * Pointers to the procedure to call when the function code
+ * is encountered.
+ */
+static hdlr_proc_p_t const load_procs[ FUNC_CT ] = {
+ /* BOGUS */ mFunc_Bogus,
+ /* BREAK */ mFunc_Break,
+ /* CASE */ mFunc_Case,
+ /* COMMENT */ mFunc_Bogus,
+ /* CONTINUE */ mFunc_Break,
+ /* DEBUG */ mFunc_Debug,
+ /* DEFINE */ mFunc_Define,
+ /* ELIF */ mFunc_Bogus,
+ /* ELSE */ mFunc_Bogus,
+ /* ENDDEF */ mFunc_Bogus,
+ /* ENDFOR */ mFunc_Bogus,
+ /* ENDIF */ mFunc_Bogus,
+ /* ENDWHILE */ mFunc_Bogus,
+ /* ESAC */ mFunc_Bogus,
+ /* EXPR */ mFunc_Expr,
+ /* FOR */ mFunc_For,
+ /* IF */ mFunc_If,
+ /* INCLUDE */ mFunc_Include,
+ /* INVOKE */ mFunc_Invoke,
+ /* RETURN */ mFunc_Return,
+ /* SELECT */ mFunc_Bogus,
+ /* TEXT */ mFunc_Text,
+ /* UNKNOWN */ mFunc_Unknown,
+ /* WHILE */ mFunc_While
+};
+
+/* * * * * * * * * * tpLoad.c use only * * * * * * * * * * * * * */
+/**
+ * Template Unloading Function Table
+ *
+ * Pointers to the procedure to call when the function code
+ * is encountered in a template being unloaded.
+ */
+unload_proc_t mUnload_Define, mUnload_Select;
+
+static unload_proc_p_t const unload_procs[ FUNC_CT ] = {
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, mUnload_Define, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL,
+ mUnload_Select, NULL, NULL, NULL
+};
+
+#define FUNCTION_CKSUM ((unsigned short)0x22FE)
+
+#endif /* AUTOGEN_FUNCTIONS_H_GUARD */
+/* functions.h ends here */
diff --git a/agen5/guile-iface.def b/agen5/guile-iface.def
new file mode 100644
index 0000000..f5d6359
--- /dev/null
+++ b/agen5/guile-iface.def
@@ -0,0 +1,183 @@
+
+AutoGen Definitions guile-iface.tpl;
+
+#if 0
+iface = {
+ i-name = ;
+ i-args = ;
+ i-impl = { i-end = ''; i-code = ''; };
+};
+#endif
+
+invalid = '200000-200003',
+ '-106000';
+
+iface = {
+ i-name = bool_p;
+ i-args = '_b';
+ i-impl = { i-end = '107'; i-code = 'SCM_BOOLP(_b)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_is_bool(_b)'; };
+};
+
+iface = {
+ i-name = char;
+ i-args = '_c';
+ i-impl = { i-end = '107'; i-code = 'gh_scm2char(_c)'; };
+ i-impl = { i-end = '201'; i-code = 'SCM_CHAR(_c)'; };
+};
+
+iface = {
+ i-name = chars;
+ i-args = '_s';
+ i-impl = { i-end = '107'; i-code = 'SCM_CHARS(_s)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_i_string_chars(_s)'; };
+};
+
+iface = {
+ i-name = falsep;
+ i-args = '_r';
+ i-impl = { i-end = '107'; i-code = 'SCM_FALSEP(_r)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_is_false(_r)'; };
+};
+
+iface = {
+ i-name = from_long;
+ i-args = '_l';
+ i-impl = { i-end = '107'; i-code = 'gh_long2scm(_l)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_from_long(_l)'; };
+};
+
+iface = {
+ i-name = int2scm;
+ i-args = '_i';
+ i-impl = { i-end = '107'; i-code = 'gh_int2scm(_i)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_from_int(_i)'; };
+};
+
+iface = {
+ i-name = is_proc;
+ i-args = '_p';
+ i-impl = { i-end = '107'; i-code = 'SCM_NFALSEP( scm_procedure_p(_p))'; };
+ i-impl = { i-end = '201'; i-code = 'scm_is_true( scm_procedure_p(_p))'; };
+};
+
+iface = {
+ i-name = list_p;
+ i-args = '_l';
+ i-impl = { i-end = '107'; i-code = 'SCM_NFALSEP( scm_list_p(_l))'; };
+ i-impl = { i-end = '201'; i-code = 'scm_is_true( scm_list_p(_l))'; };
+};
+
+iface = {
+ i-name = listofnull;
+ i-impl = { i-end = '107'; i-code = 'scm_listofnull'; };
+ i-impl = { i-end = '201'; i-code = 'scm_list_1(SCM_EOL)'; };
+};
+
+iface = {
+ i-name = long2scm;
+ i-args = '_i';
+ i-impl = { i-end = '107'; i-code = 'gh_long2scm(_i)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_from_long(_i)'; };
+};
+
+iface = {
+ i-name = nfalsep;
+ i-args = '_r';
+ i-impl = { i-end = '107'; i-code = 'SCM_NFALSEP(_r)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_is_true(_r)'; };
+};
+
+iface = {
+ i-name = nullp;
+ i-args = '_m';
+ i-impl = { i-end = '107'; i-code = 'SCM_NULLP(_m)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_is_null(_m)'; };
+};
+
+iface = {
+ i-name = num_p;
+ i-args = '_n';
+ i-impl = { i-end = '107'; i-code = 'SCM_NUMBERP(_n)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_is_number(_n)'; };
+};
+
+iface = {
+ i-name = pair_p;
+ i-args = '_p';
+ i-impl = { i-end = '107'; i-code = 'SCM_NFALSEP( scm_pair_p(_p))'; };
+ i-impl = { i-end = '201'; i-code = 'scm_is_true( scm_pair_p(_p))'; };
+};
+
+iface = {
+ i-name = str02scm;
+ i-args = '_s';
+ i-impl = { i-end = '107'; i-code = 'scm_makfrom0str(_s)'; };
+ i-impl = { i-end = '200'; i-code = 'scm_from_locale_string(_s)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_from_utf8_string(_s)'; };
+};
+
+iface = {
+ i-name = str2scm;
+ i-args = '_st,_sz';
+ i-impl = { i-end = '107'; i-code = 'scm_mem2string(_st,_sz)'; };
+ i-impl = { i-end = '200'; i-code = 'scm_from_locale_stringn(_st,_sz)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_from_utf8_stringn(_st,_sz)'; };
+};
+
+iface = {
+ i-name = to_newstr;
+ i-args = '_s';
+ i-impl = { i-end = '107'; i-code = 'gh_scm2newstr(_s, NULL)'; };
+ i-impl = { i-end = '200'; i-code = 'scm_to_locale_string(_s)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_to_utf8_string(_s)'; };
+};
+
+iface = {
+ i-name = string_p;
+ i-args = '_s';
+ i-impl = { i-end = '107'; i-code = 'SCM_STRINGP(_s)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_is_string(_s)'; };
+};
+
+iface = {
+ i-name = strlen;
+ i-args = '_s';
+ i-impl = { i-end = '107'; i-code = 'SCM_STRING_LENGTH(_s)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_c_string_length(_s)'; };
+};
+
+iface = {
+ i-name = sym_p;
+ i-args = '_s';
+ i-impl = { i-end = '107'; i-code = 'SCM_SYMBOLP(_s)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_is_symbol(_s)'; };
+};
+
+iface = {
+ i-name = to_int;
+ i-args = '_i';
+ i-impl = { i-end = '107'; i-code = 'gh_scm2int(_i)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_to_int(_i)'; };
+};
+
+iface = {
+ i-name = to_long;
+ i-args = '_v';
+ i-impl = { i-end = '107'; i-code = 'gh_scm2long(_v)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_to_long(_v)'; };
+};
+
+iface = {
+ i-name = to_ulong;
+ i-args = '_v';
+ i-impl = { i-end = '107'; i-code = 'gh_scm2ulong(_v)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_to_ulong(_v)'; };
+};
+
+iface = {
+ i-name = vec_p;
+ i-args = '_v';
+ i-impl = { i-end = '107'; i-code = 'SCM_VECTORP(_v)'; };
+ i-impl = { i-end = '201'; i-code = 'scm_is_vector(_v)'; };
+};
diff --git a/agen5/guile-iface.h b/agen5/guile-iface.h
new file mode 100644
index 0000000..f26122d
--- /dev/null
+++ b/agen5/guile-iface.h
@@ -0,0 +1,95 @@
+#ifndef MUTATING_GUILE_IFACE_H_GUARD
+#define MUTATING_GUILE_IFACE_H_GUARD 1
+
+#if (GUILE_VERSION >= 200000) && (GUILE_VERSION <= 200003)
+# error AutoGen does not work with this version of Guile
+ choke me.
+
+#elif (GUILE_VERSION <= 106000)
+# error AutoGen does not work with this version of Guile
+ choke me.
+
+#elif GUILE_VERSION < 107000
+# define AG_SCM_BOOL_P(_b) SCM_BOOLP(_b)
+# define AG_SCM_CHAR(_c) gh_scm2char(_c)
+# define AG_SCM_CHARS(_s) SCM_CHARS(_s)
+# define AG_SCM_FALSEP(_r) SCM_FALSEP(_r)
+# define AG_SCM_FROM_LONG(_l) gh_long2scm(_l)
+# define AG_SCM_INT2SCM(_i) gh_int2scm(_i)
+# define AG_SCM_IS_PROC(_p) SCM_NFALSEP( scm_procedure_p(_p))
+# define AG_SCM_LIST_P(_l) SCM_NFALSEP( scm_list_p(_l))
+# define AG_SCM_LISTOFNULL() scm_listofnull
+# define AG_SCM_LONG2SCM(_i) gh_long2scm(_i)
+# define AG_SCM_NFALSEP(_r) SCM_NFALSEP(_r)
+# define AG_SCM_NULLP(_m) SCM_NULLP(_m)
+# define AG_SCM_NUM_P(_n) SCM_NUMBERP(_n)
+# define AG_SCM_PAIR_P(_p) SCM_NFALSEP( scm_pair_p(_p))
+# define AG_SCM_STR02SCM(_s) scm_makfrom0str(_s)
+# define AG_SCM_STR2SCM(_st,_sz) scm_mem2string(_st,_sz)
+# define AG_SCM_TO_NEWSTR(_s) gh_scm2newstr(_s, NULL)
+# define AG_SCM_STRING_P(_s) SCM_STRINGP(_s)
+# define AG_SCM_STRLEN(_s) SCM_STRING_LENGTH(_s)
+# define AG_SCM_SYM_P(_s) SCM_SYMBOLP(_s)
+# define AG_SCM_TO_INT(_i) gh_scm2int(_i)
+# define AG_SCM_TO_LONG(_v) gh_scm2long(_v)
+# define AG_SCM_TO_ULONG(_v) gh_scm2ulong(_v)
+# define AG_SCM_VEC_P(_v) SCM_VECTORP(_v)
+
+#elif GUILE_VERSION < 200000
+# define AG_SCM_BOOL_P(_b) scm_is_bool(_b)
+# define AG_SCM_CHAR(_c) SCM_CHAR(_c)
+# define AG_SCM_CHARS(_s) scm_i_string_chars(_s)
+# define AG_SCM_FALSEP(_r) scm_is_false(_r)
+# define AG_SCM_FROM_LONG(_l) scm_from_long(_l)
+# define AG_SCM_INT2SCM(_i) scm_from_int(_i)
+# define AG_SCM_IS_PROC(_p) scm_is_true( scm_procedure_p(_p))
+# define AG_SCM_LIST_P(_l) scm_is_true( scm_list_p(_l))
+# define AG_SCM_LISTOFNULL() scm_list_1(SCM_EOL)
+# define AG_SCM_LONG2SCM(_i) scm_from_long(_i)
+# define AG_SCM_NFALSEP(_r) scm_is_true(_r)
+# define AG_SCM_NULLP(_m) scm_is_null(_m)
+# define AG_SCM_NUM_P(_n) scm_is_number(_n)
+# define AG_SCM_PAIR_P(_p) scm_is_true( scm_pair_p(_p))
+# define AG_SCM_STR02SCM(_s) scm_from_locale_string(_s)
+# define AG_SCM_STR2SCM(_st,_sz) scm_from_locale_stringn(_st,_sz)
+# define AG_SCM_TO_NEWSTR(_s) scm_to_locale_string(_s)
+# define AG_SCM_STRING_P(_s) scm_is_string(_s)
+# define AG_SCM_STRLEN(_s) scm_c_string_length(_s)
+# define AG_SCM_SYM_P(_s) scm_is_symbol(_s)
+# define AG_SCM_TO_INT(_i) scm_to_int(_i)
+# define AG_SCM_TO_LONG(_v) scm_to_long(_v)
+# define AG_SCM_TO_ULONG(_v) scm_to_ulong(_v)
+# define AG_SCM_VEC_P(_v) scm_is_vector(_v)
+
+#elif GUILE_VERSION < 201000
+# define AG_SCM_BOOL_P(_b) scm_is_bool(_b)
+# define AG_SCM_CHAR(_c) SCM_CHAR(_c)
+# define AG_SCM_CHARS(_s) scm_i_string_chars(_s)
+# define AG_SCM_FALSEP(_r) scm_is_false(_r)
+# define AG_SCM_FROM_LONG(_l) scm_from_long(_l)
+# define AG_SCM_INT2SCM(_i) scm_from_int(_i)
+# define AG_SCM_IS_PROC(_p) scm_is_true( scm_procedure_p(_p))
+# define AG_SCM_LIST_P(_l) scm_is_true( scm_list_p(_l))
+# define AG_SCM_LISTOFNULL() scm_list_1(SCM_EOL)
+# define AG_SCM_LONG2SCM(_i) scm_from_long(_i)
+# define AG_SCM_NFALSEP(_r) scm_is_true(_r)
+# define AG_SCM_NULLP(_m) scm_is_null(_m)
+# define AG_SCM_NUM_P(_n) scm_is_number(_n)
+# define AG_SCM_PAIR_P(_p) scm_is_true( scm_pair_p(_p))
+# define AG_SCM_STR02SCM(_s) scm_from_utf8_string(_s)
+# define AG_SCM_STR2SCM(_st,_sz) scm_from_utf8_stringn(_st,_sz)
+# define AG_SCM_TO_NEWSTR(_s) scm_to_utf8_string(_s)
+# define AG_SCM_STRING_P(_s) scm_is_string(_s)
+# define AG_SCM_STRLEN(_s) scm_c_string_length(_s)
+# define AG_SCM_SYM_P(_s) scm_is_symbol(_s)
+# define AG_SCM_TO_INT(_i) scm_to_int(_i)
+# define AG_SCM_TO_LONG(_v) scm_to_long(_v)
+# define AG_SCM_TO_ULONG(_v) scm_to_ulong(_v)
+# define AG_SCM_VEC_P(_v) scm_is_vector(_v)
+
+#else
+# error unknown GUILE_VERSION
+ choke me.
+#endif
+
+#endif /* MUTATING_GUILE_IFACE_H_GUARD */
diff --git a/agen5/guile-iface.tpl b/agen5/guile-iface.tpl
new file mode 100644
index 0000000..e94cb89
--- /dev/null
+++ b/agen5/guile-iface.tpl
@@ -0,0 +1,116 @@
+[= AutoGen5 Template h =]
+[=
+(emit (make-header-guard "mutating"))
+(shell "ranged='#if'
+guile_range() {
+ local lo=${1%%-*}
+ local hi=${1##*-}
+ if test ${#lo} -eq 0
+ then echo \"${ranged} (GUILE_VERSION <= $hi)\"
+ elif test ${#hi} -eq 0
+ then echo \"${ranged} (GUILE_VERSION >= $lo)\"
+ else echo \"${ranged} (GUILE_VERSION >= $lo) && (GUILE_VERSION <= $hi)\"
+ fi
+ ranged='#elif'
+}") =]
+[=
+
+FOR invalid \=]
+
+[= (shell (string-append "guile_range " (get "invalid"))) =]
+# error AutoGen does not work with this version of Guile
+ choke me.
+[=
+ENDFOR invalid =]
+[= (out-push-new) =]
+set -- $(sort -n -u <<_EOF_
+[= (join "\n" (stack "iface.i-impl.i-end")) =]
+_EOF_
+)
+v_list="$*"
+r_list=$(ix=$# ; while (( ix > 0 )) ; do eval echo \${$ix}
+ (( ix = ix - 1 )) ; done)
+i_list="[= (join " " (stack "iface.i-name")) =]"
+PS4='>${FUNC_NAME:-ag}> '
+
+fill_in() {
+ for v in $r_list
+ do
+ eval f=\"\${${name}_vals[$v]}\"
+ if test ${#f} -gt 0
+ then val="$f"
+ else eval ${name}_vals[$v]=\"$val\"
+ fi
+ done
+}
+
+emit_iface_macro() {
+ NM=$(echo $i | tr a-z- A-Z_)
+ eval NM=\"$NM\(\${${i}_args}\)\"
+ if test ${#code} -lt 40 -a ${#NM} -lt 22
+ then
+ printf '# define AG_SCM_%-21s %s\n' "${NM}" "${code}"
+ else
+ printf '# define AG_SCM_%-21s \\\n %s\n' "${NM}" "${code}"
+ fi
+}
+
+emit_iface_type() {
+ local nm=ag_scm_$(echo $i | tr A-Z- a-z_)
+ printf '# define %-28s %s\n' $nm "$code"
+}
+
+prt_tbl() {
+ if='#[= (if (exist? "invalid") "elif" "if ") =]'
+ for v in $v_list
+ do
+ printf '%s GUILE_VERSION < %s000\n' "$if" "$v"
+ if='#elif'
+
+ for i in $i_list
+ do
+ eval type=\"\${${i}_type}\"
+ eval code=\"\${${i}_vals[$v]}\"
+ case "$type" in
+ ( macro | '' ) emit_iface_macro ;;
+ ( typedef ) emit_iface_type ;;
+ esac
+ done
+
+ echo
+ done
+}
+[=
+(shell (out-pop #t)) =][=
+
+FOR iface =][=
+
+ (shell (string-append
+ "val='" (get "i-impl[].i-code") "'\n"
+ (get "i-name") "_args='" (get "i-args") "'\n"
+ "name=" (get "i-name") "\n"
+ (get "i-name") "_type=" (get "i-type" "macro")
+
+ )) =][=
+
+ FOR i-impl =][=
+
+ (shell (string-append
+ (get "i-name") "_vals[" (get "i-end") "]='" (get "i-code") "'"
+ )) =][=
+
+ ENDFOR =][=
+
+ `fill_in` =][=
+
+ENDFOR iface =][=
+
+`prt_tbl`
+=]
+
+#else
+# error unknown GUILE_VERSION
+ choke me.
+#endif
+
+#endif /* [= (. header-guard) =] */
diff --git a/agen5/invoke-autogen.texi b/agen5/invoke-autogen.texi
new file mode 100644
index 0000000..31c65f9
--- /dev/null
+++ b/agen5/invoke-autogen.texi
@@ -0,0 +1,872 @@
+@node autogen Invocation
+@chapter Invoking autogen
+@pindex autogen
+@cindex The Automated Program Generator
+@ignore
+# -*- buffer-read-only: t -*- vi: set ro:
+#
+# DO NOT EDIT THIS FILE (invoke-autogen.texi)
+#
+# It has been AutoGen-ed August 11, 2012 at 09:41:40 AM by AutoGen 5.16.2pre7
+# From the definitions /old-home/bkorb/ag/ag/agen5/opts.def
+# and the template file agtexi-cmd.tpl
+@end ignore
+
+AutoGen creates text files from templates using external definitions.
+
+@code{AutoGen} is designed for generating program files that contain
+repetitive text with varied substitutions. The goal is to simplify the
+maintenance of programs that contain large amounts of repetitious text.
+This is especially valuable if there are several blocks of such text
+that must be kept synchronized.
+
+One common example is the problem of maintaining the code required for
+processing program options. Processing options requires a minimum of
+four different constructs be kept in proper order in different places
+in your program. You need at least: The flag character in the flag
+string, code to process the flag when it is encountered, a global
+state variable or two, and a line in the usage text.
+You will need more things besides this if you choose to implement
+long option names, configuration file processing, environment variables
+and so on.
+
+All of this can be done mechanically; with the proper templates
+and this program.
+
+
+This chapter was generated by @strong{AutoGen},
+using the @code{agtexi-cmd} template and the option descriptions for the @code{autogen} program.
+This software is released under the GNU General Public License, version 3 or later.
+
+@menu
+* autogen usage:: autogen help/usage (@option{--help})
+* autogen input-select:: input-select options
+* autogen out-handling:: out-handling options
+* autogen debug-tpl:: debug-tpl options
+* autogen processing:: processing options
+* autogen dep-track:: dep-track options
+* autogen config:: presetting/configuring autogen
+* autogen exit status:: exit status
+* autogen Examples:: Examples
+@end menu
+
+@node autogen usage
+@section autogen help/usage (@option{--help})
+@cindex autogen help
+
+This is the automatically generated usage text for autogen.
+
+The text printed is the same whether selected with the @code{help} option
+(@option{--help}) or the @code{more-help} option (@option{--more-help}). @code{more-help} will print
+the usage text by passing it through a pager program.
+@code{more-help} is disabled on platforms without a working
+@code{fork(2)} function. The @code{PAGER} environment variable is
+used to select the program, defaulting to @file{more}. Both will exit
+with a status code of 0.
+
+@exampleindent 0
+@example
+autogen (GNU AutoGen) - The Automated Program Generator - Ver. 5.16.2pre7
+USAGE: autogen [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ <def-file> ]
+
+The following options select definitions, templates and scheme functions
+to use:
+
+ Flg Arg Option-Name Description
+ -L Str templ-dirs Template search directory list
+ - may appear multiple times
+ -T Str override-tpl Override template file
+ - may not be preset
+ -l Str lib-template Library template file
+ - may appear multiple times
+ Str definitions Definitions input file
+ - disabled as --no-definitions
+ - enabled by default
+ - may not be preset
+ -S Str load-scheme Scheme code file to load
+ -F Str load-functions Load scheme function library
+ Str shell name or path name of shell to use
+ -m no no-fmemopen Do not use in-mem streams
+ Str equate characters considered equivalent
+
+The following options modify how output is handled:
+
+ Flg Arg Option-Name Description
+ -b Str base-name Base name for output file(s)
+ - may not be preset
+ no source-time set mod times to latest source
+ - disabled as --no-source-time
+ no writable Allow output files to be writable
+ - disabled as --not-writable
+
+The following options are often useful while debugging new templates:
+
+ Flg Arg Option-Name Description
+ Num loop-limit Limit on increment loops
+ - is scalable with a suffix: k/K/m/M/g/G/t/T
+ - It must lie in one of the ranges:
+ -1 exactly, or
+ 1 to 16777216
+ -t Num timeout Time limit for server shell
+ - It must be in the range:
+ 0 to 3600
+ KWd trace tracing level of detail
+ Str trace-out tracing output file or filter
+ --- show-defs This option has been disabled
+ no used-defines Show the definitions used
+ - may not be preset
+ -C no core Leave a core dump on a failure exit
+
+These options can be used to control what gets processed in the
+definitions files and template files:
+
+ Flg Arg Option-Name Description
+ -s Str skip-suffix Omit the file with this suffix
+ - prohibits these options:
+ select-suffix
+ - may not be preset
+ - may appear multiple times
+ -o Str select-suffix specify this output suffix
+ - may not be preset
+ - may appear multiple times
+ -D Str define name to add to definition list
+ - may appear multiple times
+ -U Str undefine definition list removal pattern
+ - an alternate for define
+
+This option is used to automate dependency tracking:
+
+ Flg Arg Option-Name Description
+ -M opt make-dep emit make dependency file
+ - may not be preset
+ - may appear multiple times
+
+version, usage and configuration options:
+
+ Flg Arg Option-Name Description
+ -R Str reset-option Reset an option's state
+ -v opt version Output version information and exit
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -u no usage Abbreviated usage to stdout
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+AutoGen creates text files from templates using external definitions.
+
+The following option preset mechanisms are supported:
+ - reading file $HOME
+ - reading file ./.autogenrc
+ - examining environment variables named AUTOGEN_*
+
+The valid "trace" option keywords are:
+ nothing debug-message server-shell templates block-macros
+ expressions everything
+ or an integer from 0 through 6
+
+AutoGen is a tool designed for generating program files that contain
+repetitive text with varied substitutions.
+Packaged by Bruce (2012-08-10)
+Report autogen bugs to bkorb@@gnu.org
+@end example
+@exampleindent 4
+
+@node autogen input-select
+@section input-select options
+The following options select definitions, templates and scheme functions to use.
+@subheading templ-dirs option (-L).
+@anchor{autogen templ-dirs}
+@cindex autogen-templ-dirs
+
+This is the ``template search directory list'' option.
+This option takes an argument string @file{dir}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+Add a directory to the list of directories to search when opening
+a template, either as the primary template or an included one.
+The last entry has the highest priority in the search list.
+That is to say, they are searched in reverse order.
+@subheading override-tpl option (-T).
+@anchor{autogen override-tpl}
+@cindex autogen-override-tpl
+
+This is the ``override template file'' option.
+This option takes an argument string @file{tpl-file}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+Definition files specify the standard template that is to be expanded.
+This option will override that name and expand a different template.
+@subheading lib-template option (-l).
+@anchor{autogen lib-template}
+@cindex autogen-lib-template
+
+This is the ``library template file'' option.
+This option takes an argument string @file{tpl-file}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+DEFINE macros are saved from this template file for use in processing
+the main macro file. Template text aside from the DEFINE macros is
+is ignored.
+@subheading definitions option.
+@anchor{autogen definitions}
+@cindex autogen-definitions
+
+This is the ``definitions input file'' option.
+This option takes an argument string @file{file}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+is enabled by default.
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+Use this argument to specify the input definitions file with a
+command line option. If you do not specify this option, then
+there must be a command line argument that specifies the file,
+even if only to specify stdin with a hyphen (@code{-}).
+Specify, @code{--no-definitions} when you wish to process
+a template without any active AutoGen definitions.
+@subheading load-scheme option (-S).
+@anchor{autogen load-scheme}
+@cindex autogen-load-scheme
+
+This is the ``scheme code file to load'' option.
+This option takes an argument string @file{file}.
+Use this option to pre-load Scheme scripts into the Guile
+interpreter before template processing begins.
+Please note that the AutoGen specific functions are not loaded
+until after argument processing. So, though they may be specified
+in lambda functions you define, they may not be invoked until after
+option processing is complete.
+@subheading load-functions option (-F).
+@anchor{autogen load-functions}
+@cindex autogen-load-functions
+
+This is the ``load scheme function library'' option.
+This option takes an argument string @file{file}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must be compiled in by defining @code{HAVE_DLOPEN} during the compilation.
+@end itemize
+
+This option is used to load Guile-scheme functions. The automatically
+called initialization routine @code{scm_init} must be used to register
+these routines or data.
+@subheading shell option.
+@anchor{autogen shell}
+@cindex autogen-shell
+
+This is the ``name or path name of shell to use'' option.
+This option takes an argument string @file{shell}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must be compiled in by defining @code{SHELL_ENABLED} during the compilation.
+@end itemize
+
+By default, when AutoGen is built, the configuration is probed for a
+reasonable Bourne-like shell to use for shell script processing. If
+a particular template needs an alternate shell, it must be specified
+with this option on the command line, with an environment variable
+(@code{SHELL}) or in the configuration/initialization file.
+@subheading no-fmemopen option (-m).
+@anchor{autogen no-fmemopen}
+@cindex autogen-no-fmemopen
+
+This is the ``do not use in-mem streams'' option.
+If the local C library supports "@code{fopencookie(3GNU)}", or
+"@code{funopen(3BSD)}" then AutoGen prefers to use in-memory stream
+buffer opens instead of anonymous files. This may lead to problems
+if there is a shortage of virtual memory. If, for a particular
+application, you run out of memory, then specify this option.
+This is unlikely in a modern 64-bit virtual memory environment.
+
+On platforms without these functions, the option is accepted
+but ignored. @code{fmemopen(POSIX)} is not adequate because
+its string buffer is not reallocatable. @code{open_memstream(POSIX)}
+is @i{also} not adequate because the stream is only opened for
+output. AutoGen needs a reallocatable buffer available for both
+reading and writing.
+@subheading equate option.
+@anchor{autogen equate}
+@cindex autogen-equate
+
+This is the ``characters considered equivalent'' option.
+This option takes an argument string @file{char-list}.
+This option will alter the list of characters considered equivalent.
+The default are the three characters, "_-^". (The last is conventional
+on a Tandem/HP-NonStop, and I used to do a lot of work on Tandems.)
+@node autogen out-handling
+@section out-handling options
+The following options modify how output is handled.
+@subheading base-name option (-b).
+@anchor{autogen base-name}
+@cindex autogen-base-name
+
+This is the ``base name for output file(s)'' option.
+This option takes an argument string @file{name}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+A template may specify the exact name of the output file. Normally,
+it does not. Instead, the name is composed of the base name of the
+definitions file with suffixes appended. This option will override the
+base name derived from the definitions file name. This is required if
+there is no definitions file and advisable if definitions are being
+read from stdin. If the definitions are being read from standard in,
+the base name defaults to @file{stdin}. Any leading directory components
+in the name will be silently removed. If you wish the output file to
+appear in a particular directory, it is recommended that you "cd" into
+that directory first, or use directory names in the format specification
+for the output suffix lists, @xref{pseudo macro}.
+@subheading source-time option.
+@anchor{autogen source-time}
+@cindex autogen-source-time
+
+This is the ``set mod times to latest source'' option.
+If you stamp your output files with the @code{DNE} macro output, then
+your output files will always be different, even if the content has
+not really changed. If you use this option, then the modification
+time of the output files will change only if the input files change.
+This will help reduce unneeded builds.
+@subheading writable option.
+@anchor{autogen writable}
+@cindex autogen-writable
+
+This is the ``allow output files to be writable'' option.
+This option will leave output files writable.
+Normally, output files are read-only.
+@node autogen debug-tpl
+@section debug-tpl options
+The following options are often useful while debugging new templates.
+They specify limits that prevent the template from taking overly long
+or producing more output than expected.
+@subheading loop-limit option.
+@anchor{autogen loop-limit}
+@cindex autogen-loop-limit
+
+This is the ``limit on increment loops'' option.
+This option takes an argument number @file{lim}.
+This option prevents runaway loops. For example, if you accidentally
+specify, "FOR x (for-from 1) (for-to -1) (for-by 1)", it will take a
+long time to finish. If you do have more than 256 entries in tables,
+you will need to specify a new limit with this option.
+@subheading timeout option (-t).
+@anchor{autogen timeout}
+@cindex autogen-timeout
+
+This is the ``time limit for server shell'' option.
+This option takes an argument number @file{time-lim}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must be compiled in by defining @code{SHELL_ENABLED} during the compilation.
+@end itemize
+
+AutoGen works with a shell server process. Most normal commands will
+complete in less than 10 seconds. If, however, your commands need more
+time than this, use this option.
+
+The valid range is 0 to 3600 seconds (1 hour).
+Zero will disable the server time limit.
+@subheading trace option.
+@anchor{autogen trace}
+@cindex autogen-trace
+
+This is the ``tracing level of detail'' option.
+This option takes an argument keyword @file{level}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+This option takes a keyword as its argument.
+The argument sets an enumeration value that can be tested by comparing the option value macro (OPT_VALUE_TRACE).
+The available keywords are:
+@example
+ nothing debug-message server-shell
+ templates block-macros expressions
+ everything
+@end example
+
+or their numeric equivalent.@end itemize
+
+This option will cause AutoGen to display a trace of its template
+processing. There are six levels, each level including messages from
+the previous levels:
+
+@table @samp
+@item nothing
+Does no tracing at all (default)
+
+@item debug-message
+Print messages from the "DEBUG" AutoGen macro (@pxref{DEBUG}).
+
+@item server-shell
+Traces all input and output to the server shell. This includes a shell
+"independent" initialization script about 30 lines long. Its output is
+discarded and not inserted into any template.
+
+@item templates
+Traces the invocation of @code{DEFINE}d macros and @code{INCLUDE}s
+
+@item block-macros
+Traces all block macros. The above, plus @code{IF}, @code{FOR},
+@code{CASE} and @code{WHILE}.
+
+@item expressions
+Displays the results of expression evaluations.
+
+@item everything
+Displays the invocation of every AutoGen macro, even @code{TEXT} macros
+(i.e. the text outside of macro quotes). Additionally, if you rebuild
+the ``expr.ini'' file with debugging enabled, then all calls to
+AutoGen defined scheme functions will also get logged:
+@*
+@example
+cd $@{top_builddir@}/agen5
+DEBUG_ENABLED=true bash bootstrap.dir expr.ini
+make CFLAGS='-g -DDEBUG_ENABLED=1'
+@end example
+
+Be aware that you cannot rebuild this source in this way without first
+having installed the @code{autogen} executable in your search path.
+Because of this, "expr.ini" is in the distributed source list, and
+not in the dependencies.
+@end table
+@subheading trace-out option.
+@anchor{autogen trace-out}
+@cindex autogen-trace-out
+
+This is the ``tracing output file or filter'' option.
+This option takes an argument string @file{file}.
+The output specified may be a file name, a file that is appended to,
+or, if the option argument begins with the @code{pipe} operator
+(@code{|}), a command that will receive the tracing output as standard
+in. For example, @code{--traceout='| less'} will run the trace output
+through the @code{less} program. Appending to a file is specified by
+preceeding the file name with two greater-than characters (@code{>>}).
+@subheading show-defs option.
+@anchor{autogen show-defs}
+@cindex autogen-show-defs
+
+This is the ``show the definition tree'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must be compiled in by defining @code{DEBUG_ENABLED} during the compilation.
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+This will print out the complete definition tree before processing
+the template.
+@subheading used-defines option.
+@anchor{autogen used-defines}
+@cindex autogen-used-defines
+
+This is the ``show the definitions used'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+This will print out the names of definition values searched for
+during the processing of the template, whether actually found or
+not. There may be other referenced definitions in a template in
+portions of the template not evaluated. Some of the names listed
+may be computed names and others AutoGen macro arguments. This is
+not a means for producing a definitive, all-encompassing list of all
+and only the values used from a definition file. This is intended
+as an aid to template documentation only.
+@subheading core option (-C).
+@anchor{autogen core}
+@cindex autogen-core
+
+This is the ``leave a core dump on a failure exit'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must be compiled in by defining @code{HAVE_SYS_RESOURCE_H} during the compilation.
+@end itemize
+
+Many systems default to a zero sized core limit. If the system
+has the sys/resource.h header and if this option is supplied,
+then in the failure exit path, autogen will attempt to set the
+soft core limit to whatever the hard core limit is. If that
+does not work, then an administrator must raise the hard core
+size limit.
+@node autogen processing
+@section processing options
+These options can be used to control what gets processed
+in the definitions files and template files.
+They specify which outputs and parts of outputs to produce.
+@subheading skip-suffix option (-s).
+@anchor{autogen skip-suffix}
+@cindex autogen-skip-suffix
+
+This is the ``omit the file with this suffix'' option.
+This option takes an argument string @file{suffix}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@item
+must not appear in combination with any of the following options:
+select-suffix.
+@end itemize
+
+Occasionally, it may not be desirable to produce all of the output
+files specified in the template. (For example, only the @file{.h}
+header file, but not the @file{.c} program text.) To do this
+specify @code{--skip-suffix=c} on the command line.
+@subheading select-suffix option (-o).
+@anchor{autogen select-suffix}
+@cindex autogen-select-suffix
+
+This is the ``specify this output suffix'' option.
+This option takes an argument string @file{suffix}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+If you wish to override the suffix specifications in the template,
+you can use one or more copies of this option. See the suffix
+specification in the @ref{pseudo macro} section of the info doc.
+@subheading define option (-D).
+@anchor{autogen define}
+@cindex autogen-define
+
+This is the ``name to add to definition list'' option.
+This option takes an argument string @file{value}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+The AutoGen define names are used for the following purposes:
+
+@enumerate
+@item
+Sections of the AutoGen definitions may be enabled or disabled
+by using C-style #ifdef and #ifndef directives.
+@item
+When defining a value for a name, you may specify the index
+for a particular value. That index may be a literal value,
+a define option or a value #define-d in the definitions themselves.
+@item
+The name of a file may be prefixed with @code{$NAME/}.
+The @code{$NAME} part of the name string will be replaced with
+the define-d value for @code{NAME}.
+@item
+When AutoGen is finished loading the definitions, the defined values
+are exported to the environment with, @code{putenv(3)}.
+These values can then be used in shell scripts with @code{$@{NAME@}}
+references and in templates with @code{(getenv "NAME")}.
+@item
+While processing a template, you may specify an index to retrieve
+a specific value. That index may also be a define-d value.
+@end enumerate
+
+It is entirely equivalent to place this name in the exported environment.
+Internally, that is what AutoGen actually does with this option.
+@subheading undefine option (-U).
+@anchor{autogen undefine}
+@cindex autogen-undefine
+
+This is the ``definition list removal pattern'' option.
+This option takes an argument string @file{name-pat}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+Similar to 'C', AutoGen uses @code{#ifdef/#ifndef} preprocessing
+directives. This option will cause the matching names to be
+removed from the list of defined values.
+@node autogen dep-track
+@section dep-track options
+This option is used to automate dependency tracking.
+@subheading make-dep option (-M).
+@anchor{autogen make-dep}
+@cindex autogen-make-dep
+
+This is the ``emit make dependency file'' option.
+This option takes an optional argument string @file{type}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+
+This option behaves fairly closely to the way the @code{-M} series of
+options work with the gcc compiler, except that instead of just
+emitting the predecessor dependencies, this also emits the successor
+dependencies (output target files). By default, the output dependency
+information will be placed in @code{<base-name>.d}, but may also be
+specified with @code{-MF<file>}. The time stamp on this file will be
+manipulated so that it will be one second older than the oldest
+primary output file.
+
+The target in this dependency file will normally be the dependency
+file name, but may also be overridden with @code{-MT<targ-name>}.
+AutoGen will not alter the contents of that file, but it may create
+it and it will adjust the modification time to match the start time.
+
+@strong{NB:} these second letters are part of the option argument, so
+@code{-MF <file>} must have the space character quoted or omitted, and
+@code{-M "F <file>"} is acceptable because the @code{F} is part of the
+option argument.
+
+@code{-M} may be followed by any of the letters M, F, P, T, Q, D, or G.
+However, only F, Q, T and P are meaningful. All but F have somewhat
+different meanings. @code{-MT<name>} is interpreted as meaning
+@code{<name>} is a sentinel file that will depend on all inputs
+(templates and definition files) and all the output files will depend
+on this sentinel file. It is suitable for use as a real make target.
+Q is treated identically to T, except dollar characters ('$') are
+doubled. P causes a special clean (clobber) phoney rule to be inserted
+into the make file fragment. An empty rule is always created for
+building the list of targets.
+
+This is the recommended usage:
+@example
+ -MFwhatever-you-like.dep -MTyour-sentinel-file -MP
+@end example
+and then in your @code{Makefile}, make the @file{autogen} rule:
+@example
+ -include whatever-you-like.dep
+ clean_targets += clean-your-sentinel-file
+
+ your-sentinel-file:
+ autogen -MT$@@ -MF$*.d .....
+
+ local-clean :
+ rm -f $(clean_targets)
+@end example
+
+The modification time on the dependency file is adjusted to be one
+second before the earliest time stamp of any other output file.
+Consequently, it is suitable for use as the sentinel file testifying
+to the fact the program was successfully run. (@code{-include} is
+the GNU make way of specifying "include it if it exists". Your make
+must support that feature or your bootstrap process must create the
+file.)
+
+All of this may also be specified using the @code{DEPENDENCIES_OUTPUT}
+or @code{AUTOGEN_MAKE_DEP} environment variables. If defined,
+dependency information will be output. If defined with white space
+free text that is something other than @code{true}, @code{false},
+@code{yes}, @code{no}, @code{0} or @code{1}, then the string is taken
+to be an output file name. If it contains a string of white space
+characters, the first token is as above and the second token is taken
+to be the target (sentinel) file as @code{-MT} in the paragraphs
+above. @code{DEPENDENCIES_OUTPUT} will be ignored if there are
+multiple sequences of white space characters or if its contents are,
+specifically, @code{false}, @code{no} or @code{0}.
+
+
+@node autogen config
+@section presetting/configuring autogen
+
+Any option that is not marked as @i{not presettable} may be preset by
+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
+the options listed above in upper case and segmented with underscores.
+The @code{AUTOGEN} variable will be tokenized and parsed like
+the command line. The remaining variables are tested for existence and their
+values are treated like option arguments.
+
+
+@noindent
+@code{libopts} will search in 2 places for configuration files:
+@itemize @bullet
+@item
+$HOME
+@item
+$PWD
+@end itemize
+The environment variables @code{HOME}, and @code{PWD}
+are expanded and replaced when @file{autogen} runs.
+For any of these that are plain files, they are simply processed.
+For any that are directories, then a file named @file{.autogenrc} is searched for
+within that directory and processed.
+
+
+Configuration files may be in a wide variety of formats.
+The basic format is an option name followed by a value (argument) on the
+same line. Values may be separated from the option name with a colon,
+equal sign or simply white space. Values may be continued across multiple
+lines by escaping the newline with a backslash.
+
+Multiple programs may also share the same initialization file.
+Common options are collected at the top, followed by program specific
+segments. The segments are separated by lines like:
+@example
+[AUTOGEN]
+@end example
+@noindent
+or by
+@example
+<?program autogen>
+@end example
+@noindent
+Do not mix these styles within one configuration file.
+
+Compound values and carefully constructed string values may also be
+specified using XML syntax:
+@example
+<option-name>
+ <sub-opt>...&lt;...&gt;...</sub-opt>
+</option-name>
+@end example
+@noindent
+yielding an @code{option-name.sub-opt} string value of
+@example
+"...<...>..."
+@end example
+@code{AutoOpts} does not track suboptions. You simply note that it is a
+hierarchicly valued option. @code{AutoOpts} does provide a means for searching
+the associated name/value pair list (see: optionFindValue).
+
+The command line options relating to configuration and/or usage help are:
+
+@subheading version (-v)
+
+Print the program version to standard out, optionally with licensing
+information, then exit 0. The optional argument specifies how much licensing
+detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument. Only the
+first letter of the argument is examined:
+
+@table @samp
+@item version
+Only print the version. This is the default.
+@item copyright
+Name the copyright usage licensing terms.
+@item verbose
+Print the full copyright usage licensing terms.
+@end table
+
+@subheading usage (-u)
+
+Print abbreviated usage to standard out, then exit 0.
+
+@subheading reset-option (-R)
+
+Resets the specified option to the compiled-in initial state.
+This will undo anything that may have been set by configuration files.
+The option argument may be either the option flag character or its long name.
+
+@node autogen exit status
+@section autogen exit status
+
+One of the following exit values will be returned:
+@table @samp
+@item 0 (EXIT_SUCCESS)
+Successful program execution.
+@item 1 (EXIT_OPTION_ERROR)
+The command options were misconfigured.
+@item 2 (EXIT_BAD_TEMPLATE)
+An error was encountered processing the template.
+@item 3 (EXIT_BAD_DEFINITIONS)
+The definitions could not be deciphered.
+@item 4 (EXIT_LOAD_ERROR)
+An error was encountered during the load phase.
+@item 5 (EXIT_SIGNAL)
+Program exited due to catching a signal. If your template includes
+string formatting, a number argument to a "%s" formatting element will
+trigger a segmentation fault. Autogen will catch the seg fault signal
+and exit with @code{AUTOGEN_EXIT_SIGNAL(5)}. Alternatively, AutoGen
+may have been interrupted with a @code{kill(2)} signal.
+@item 66 (EX_NOINPUT)
+A specified configuration file could not be loaded.
+@item 70 (EX_SOFTWARE)
+libopts had an internal operational error. Please report
+it to autogen-users@@lists.sourceforge.net. Thank you.
+@end table
+@node autogen Examples
+@section autogen Examples
+Here is how the man page is produced:
+@example
+autogen -Tagman-cmd.tpl -MFman-dep -MTstamp-man opts.def
+@end example
+
+This command produced this man page from the AutoGen option definition
+file. It overrides the template specified in @file{opts.def} (normally
+@file{options.tpl}) and uses @file{agman-cmd.tpl}. It also sets the
+make file dependency output to @file{man-dep} and the sentinel file
+(time stamp file) to @file{man-stamp}. The base of the file name is
+derived from the defined @code{prog-name}.
+
+The texi invocation document is produced via:
+@example
+autogen -Tagtexi-cmd.tpl -MFtexi-dep -MTtexi-stamp opts.def
+@end example
+
diff --git a/agen5/loadPseudo.c b/agen5/loadPseudo.c
new file mode 100644
index 0000000..33763da
--- /dev/null
+++ b/agen5/loadPseudo.c
@@ -0,0 +1,497 @@
+
+/**
+ * @file loadPseudo.c
+ *
+ * Find the start and end macro markers. In btween we must find the
+ * "autogen" and "template" keywords, followed by any suffix specs.
+ *
+ * Time-stamp: "2012-03-31 13:03:19 bkorb"
+ *
+ * This module processes the "pseudo" macro
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define DEFINE_FSM
+#include "pseudo-fsm.h"
+
+/* = = = START-STATIC-FORWARD = = = */
+static char const *
+do_scheme_expr(char const * pzData, char const * pzFileName);
+
+static char const *
+handle_hash_line(char const * pz);
+
+static te_pm_event
+next_pm_token(char const ** ppzData, te_pm_state fsm_state, char const * fnm);
+
+static char const *
+copy_mark(char const * pzData, char* pzMark, size_t * pCt);
+/* = = = END-STATIC-FORWARD = = = */
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * do_scheme_expr
+ *
+ * Process a scheme specification
+ */
+static char const *
+do_scheme_expr(char const * pzData, char const * pzFileName)
+{
+ char* pzEnd = (char*)pzData + strlen(pzData);
+ char ch;
+ macro_t* pCM = cur_macro;
+ macro_t mac = { (mac_func_t)~0, 0, 0, 0, 0, 0, 0, NULL };
+
+ mac.md_line = tpl_line;
+ pzEnd = (char*)skip_scheme(pzData, pzEnd);
+ ch = *pzEnd;
+ *pzEnd = NUL;
+ cur_macro = &mac;
+
+ ag_scm_c_eval_string_from_file_line(
+ (char*)pzData, pzFileName, tpl_line );
+
+ cur_macro = pCM;
+ *pzEnd = ch;
+ while (pzData < pzEnd)
+ if (*(pzData++) == NL)
+ tpl_line++;
+ return (char const *)pzEnd;
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * do_suffix
+ *
+ * Process a suffix specification
+ */
+LOCAL char const *
+do_suffix(char const * const pzData, char const * pzFileName, int lineNo)
+{
+ /*
+ * The following is the complete list of POSIX required-to-be-legal
+ * file name characters. These are the only characters we allow to
+ * appear in a suffix. We do, however, add '=' and '%' because we
+ * also allow a format specification to follow the suffix,
+ * separated by an '=' character.
+ */
+ out_spec_t * pOS;
+ char const * pzSfxFmt;
+ char const * pzResult;
+ size_t spn;
+ static out_spec_t ** ppOSList = &output_specs;
+
+ /*
+ * Skip over the suffix construct
+ */
+ pzSfxFmt = SPN_SUFFIX_CHARS(pzData);
+
+ if (*pzSfxFmt != '=') {
+ pzResult = pzSfxFmt;
+ pzSfxFmt = NULL;
+
+ } else {
+ pzSfxFmt++;
+
+ if (*pzSfxFmt == '(') {
+ char const *pe = pzSfxFmt + strlen(pzSfxFmt);
+ pzResult = skip_scheme(pzSfxFmt, pe);
+
+ } else {
+ pzResult = SPN_SUFFIX_FMT_CHARS(pzSfxFmt);
+
+ if (pzSfxFmt == pzResult)
+ AG_ABEND(DO_SUFFIX_EMPTY);
+ }
+ }
+
+ /*
+ * If pzFileName is NULL, then we are called by --select-suffix.
+ * Otherwise, the suffix construct is saved only for the main template,
+ * and only when the --select-suffix option was not specified.
+ */
+ if ( (pzFileName != NULL)
+ && ( (processing_state != PROC_STATE_LOAD_TPL)
+ || HAVE_OPT(SELECT_SUFFIX)))
+ return pzResult;
+
+ /*
+ * Allocate Output Spec and link into the global list. Copy all the
+ * "spanned" text, including any '=' character, scheme expression or
+ * file name format string.
+ */
+ spn = pzResult - pzData;
+ {
+ size_t sz = sizeof(*pOS) + spn + 1;
+ pOS = AGALOC(sz, "Output Specification");
+ memset(pOS, NUL, sz);
+ }
+
+ *ppOSList = pOS;
+ ppOSList = &pOS->os_next; /* NULL, from memset */
+ memcpy(pOS->os_sfx, pzData, spn);
+ pOS->os_sfx[spn] = NUL;
+
+ /*
+ * IF the suffix contains its own formatting construct,
+ * THEN split it off from the suffix and set the formatting ptr.
+ * ELSE supply a default.
+ */
+ if (pzSfxFmt != NULL) {
+ size_t sfx_len = pzSfxFmt - pzData;
+ pOS->os_sfx[sfx_len-1] = NUL;
+ pOS->os_file_fmt = pOS->os_sfx + sfx_len;
+
+ if (*pOS->os_file_fmt == '(') {
+ SCM str =
+ ag_scm_c_eval_string_from_file_line(
+ pOS->os_file_fmt, pzFileName, lineNo );
+ size_t str_length;
+ char const * pz;
+
+ pzSfxFmt = pz = scm2display(str);
+ str_length = strlen(pzSfxFmt);
+
+ if (str_length == 0)
+ AG_ABEND(DO_SUFFIX_EMPTY);
+ pz = SPN_SUFFIX_FMT_CHARS(pz);
+
+ if ((unsigned)(pz - pzSfxFmt) != str_length)
+ AG_ABEND(aprf(DO_SUFFIX_BAD_CHARS, pz));
+
+ /*
+ * IF the scheme replacement text fits in the space, don't
+ * mess with allocating another string.
+ */
+ if (str_length < spn - sfx_len)
+ strcpy(pOS->os_sfx + sfx_len, pzSfxFmt);
+ else {
+ AGDUPSTR(pOS->os_file_fmt, pzSfxFmt, "suffix format");
+ pOS->os_dealloc_fmt = true;
+ }
+ }
+
+ } else {
+ /*
+ * IF the suffix does not start with punctuation,
+ * THEN we will insert a '.' of our own.
+ */
+ pOS->os_file_fmt = IS_VAR_FIRST_CHAR(pOS->os_sfx[0])
+ ? DOT_SFX_FMT : SFX_FMT;
+ }
+
+ return pzResult;
+}
+
+static char const *
+handle_hash_line(char const * pz)
+{
+ char const * res = strchr(pz, NL);
+ if (res == NULL)
+ AG_ABEND(HANDLE_HASH_BAD_TPL);
+
+ /*
+ * If the comment starts with "#!/", then see if it names
+ * an executable. If it does, it is specifying a shell to use.
+ */
+ if ((pz[1] == '!') && (pz[2] == '/')) {
+ char const * pzScn = pz + 3;
+ char * nmbuf;
+ size_t len;
+
+ pzScn = SPN_FILE_NAME_CHARS(pzScn);
+
+ len = pzScn - (pz + 2);
+ nmbuf = ag_scribble(len);
+ memcpy(nmbuf, pz+2, len);
+ nmbuf[len] = NUL;
+
+ /*
+ * If we find the executable, then change the configured shell and
+ * the SHELL environment variable to this executable.
+ */
+ if (access(nmbuf, X_OK) == 0) {
+ char * sp = malloc(len + 7); // len + "SHELL=" + NUL byte
+ sprintf(sp, HANDLE_HASH_ENV_FMT, HANDLE_HASH_SHELL, nmbuf);
+ putenv(sp);
+ AGDUPSTR(shell_program, nmbuf, "prog shell");
+ AGDUPSTR(server_args[0], nmbuf, "shell name");
+ }
+ }
+
+ return res;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * next_pm_token
+ *
+ * Skiping leading white space, figure out what sort of token is under
+ * the scan pointer (pzData).
+ */
+static te_pm_event
+next_pm_token(char const ** ppzData, te_pm_state fsm_state, char const * fnm)
+{
+ char const * pzData = *ppzData;
+
+ /*
+ * At the start of processing in this function, we can never be at
+ * the "start of a line". A '#' type comment before the initial
+ * start macro marker is illegal. Otherwise, our scan pointer is
+ * after some valid token, which won't be the start of a line, either.
+ */
+ bool line_start = false;
+
+ skipWhiteSpace:
+ while (IS_WHITESPACE_CHAR(*pzData)) {
+ if (*(pzData++) == NL) {
+ line_start = true;
+ tpl_line++;
+
+ /*
+ * IF we are done with the macro markers,
+ * THEN we skip white space only thru the first new line.
+ */
+ if (fsm_state == PM_ST_END_MARK) {
+ *ppzData = pzData;
+ return PM_EV_END_PSEUDO;
+ }
+ }
+ }
+
+ if (line_start && (*pzData == '#')) {
+ pzData = handle_hash_line(pzData);
+ goto skipWhiteSpace;
+ }
+
+ *ppzData = pzData; /* in case we return */
+
+ /*
+ * After the end marker has been found,
+ * anything else is really the start of the data.
+ */
+ if (fsm_state == PM_ST_END_MARK)
+ return PM_EV_END_PSEUDO;
+
+ /*
+ * IF the token starts with an alphanumeric,
+ * THEN it must be "autogen5" or "template" or a suffix specification
+ */
+ if (IS_VAR_FIRST_CHAR(*pzData)) {
+ if (strneqvcmp(pzData, AG_MARK, AG_MARK_LEN) == 0) {
+ if (IS_WHITESPACE_CHAR(pzData[ AG_MARK_LEN ])) {
+ *ppzData = pzData + AG_MARK_LEN + 1;
+ return PM_EV_AUTOGEN;
+ }
+
+ return PM_EV_SUFFIX;
+ }
+
+ if ( (strneqvcmp(pzData, TPL_MARK, TPL_MARK_LEN) == 0)
+ && (IS_WHITESPACE_CHAR(pzData[ TPL_MARK_LEN ])) ) {
+ *ppzData = pzData + TPL_MARK_LEN;
+ return PM_EV_TEMPLATE;
+ }
+
+ return PM_EV_SUFFIX;
+ }
+
+ /*
+ * Handle emacs mode markers and scheme expressions only once we've
+ * gotten past "init" state.
+ */
+ if (fsm_state > PM_ST_INIT)
+ switch (*pzData) {
+ case '-':
+ if ((pzData[1] == '*') && (pzData[2] == '-'))
+ return PM_EV_ED_MODE;
+ break;
+
+ case '(':
+ return PM_EV_SCHEME;
+ }
+
+ /*
+ * Alphanumerics and underscore are already handled. Thus, it must be
+ * a punctuation character that may introduce a suffix: '.' '-' '_'
+ */
+ if (IS_SUFFIX_CHAR(*pzData))
+ return PM_EV_SUFFIX;
+
+ /*
+ * IF it is some other punctuation,
+ * THEN it must be a start/end marker.
+ */
+ if (IS_PUNCTUATION_CHAR(*pzData))
+ return PM_EV_MARKER;
+
+ /*
+ * Otherwise, it is just junk.
+ */
+ AG_ABEND(aprf(NEXT_PM_TOKEN_INVALID, fnm));
+ /* NOTREACHED */
+ return PM_EV_INVALID;
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Some sort of marker is under the scan pointer. Copy it for as long
+ * as we find punctuation characters.
+ */
+static char const *
+copy_mark(char const * pzData, char* pzMark, size_t * pCt)
+{
+ int ct = 0;
+
+ for (;;) {
+ char ch = *pzData;
+ if (! IS_PUNCTUATION_CHAR(ch))
+ break;
+ *(pzMark++) = ch;
+ if (++ct >= (int)sizeof(st_mac_mark))
+ return NULL;
+
+ pzData++;
+ }
+
+ *pCt = ct;
+ *pzMark = NUL;
+
+ if (OPT_VALUE_TRACE >= TRACE_EXPRESSIONS)
+ fprintf(trace_fp, TRACE_COPY_MARK, pzMark - ct);
+
+ return pzData;
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Using a finite state machine, scan over the tokens that make up the
+ * "pseudo macro" at the start of every template.
+ */
+LOCAL char const *
+loadPseudoMacro(char const * pzData, char const * pzFileName)
+{
+ char const * pzBadness;
+# define BAD_MARKER(t) { pzBadness = t; goto abort_load; }
+
+ te_pm_state fsm_state = PM_ST_INIT;
+
+ tpl_line = 1;
+
+ while (fsm_state != PM_ST_DONE) {
+ te_pm_event fsm_tkn = next_pm_token(&pzData, fsm_state, pzFileName);
+ te_pm_state nxt_state;
+ te_pm_trans trans;
+
+ nxt_state = pm_trans_table[ fsm_state ][ fsm_tkn ].next_state;
+ trans = pm_trans_table[ fsm_state ][ fsm_tkn ].transition;
+
+ /*
+ * There are only so many "PM_TR_<state-name>_<token-name>"
+ * transitions that are legal. See which one we got.
+ * It is legal to alter "nxt_state" while processing these.
+ */
+ switch (trans) {
+ case PM_TR_SKIP_ED_MODE:
+ {
+ char* pzEnd = strstr(pzData + 3, PSEUDO_MAC_MODE_MARK);
+ char* pzNL = strchr(pzData + 3, NL);
+ if ((pzEnd == NULL) || (pzNL < pzEnd))
+ BAD_MARKER(PSEUDO_MAC_BAD_MODE);
+
+ pzData = pzEnd + 3;
+ break;
+ }
+
+ case PM_TR_INIT_MARKER:
+ pzData = copy_mark(pzData, st_mac_mark, &st_mac_len);
+ if (pzData == NULL)
+ BAD_MARKER(PSEUDO_MAC_BAD_LENGTH);
+
+ break;
+
+ case PM_TR_TEMPL_MARKER:
+ pzData = copy_mark(pzData, end_mac_mark, &end_mac_len);
+ if (pzData == NULL)
+ BAD_MARKER(PSEUDO_MAC_BAD_LENGTH);
+
+ /*
+ * IF the end macro seems to end with the start macro and
+ * it is exactly twice as long as the start macro, then
+ * presume that someone ran the two markers together.
+ */
+ if ( (end_mac_len == 2 * st_mac_len)
+ && (strcmp(st_mac_mark, end_mac_mark + st_mac_len) == 0)) {
+ pzData -= st_mac_len;
+ end_mac_mark[ st_mac_len ] = NUL;
+ end_mac_len = st_mac_len;
+ }
+
+ if (strstr(end_mac_mark, st_mac_mark) != NULL)
+ BAD_MARKER(PSEUDO_MAC_BAD_ENDER);
+ if (strstr(st_mac_mark, end_mac_mark) != NULL)
+ BAD_MARKER(PSEUDO_MAC_BAD_STARTER);
+ break;
+
+ case PM_TR_TEMPL_SUFFIX:
+ pzData = do_suffix(pzData, pzFileName, tpl_line);
+ break;
+
+ case PM_TR_TEMPL_SCHEME:
+ pzData = do_scheme_expr(pzData, pzFileName);
+ break;
+
+ case PM_TR_INVALID:
+ pm_invalid_transition(fsm_state, fsm_tkn);
+ switch (fsm_state) {
+ case PM_ST_INIT: BAD_MARKER(PSEUDO_MAC_BAD_NOSTART);
+ case PM_ST_ST_MARK: BAD_MARKER(PSEUDO_MAC_BAD_NOAG5);
+ case PM_ST_AGEN: BAD_MARKER(PSEUDO_MAC_BAD_NOTPL);
+ case PM_ST_TEMPL: BAD_MARKER(PSEUDO_MAC_BAD_NOEND);
+ case PM_ST_END_MARK: BAD_MARKER(PSEUDO_MAC_BAD_NOEOL);
+ default: BAD_MARKER(PSEUDO_MAC_BAD_FSM);
+ }
+
+ case PM_TR_NOOP:
+ break;
+
+ default:
+ BAD_MARKER(PSEUDO_MAC_BAD_PSEUDO);
+ }
+
+ fsm_state = nxt_state;
+ }
+
+ return pzData;
+
+ abort_load:
+ AG_ABEND(aprf(PSEUDO_MAC_ERR_FMT, pzFileName, tpl_line, pzBadness));
+# undef BAD_MARKER
+ return NULL;
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/loadPseudo.c */
diff --git a/agen5/mk-stamps.sh b/agen5/mk-stamps.sh
new file mode 100644
index 0000000..1c841f5
--- /dev/null
+++ b/agen5/mk-stamps.sh
@@ -0,0 +1,298 @@
+#! /bin/echo This_file_must_be_sourced,_not_executed
+#
+# agen5/mk-stamps.sh
+#
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+# ----------------------------------------------------------------------
+#
+# This script rebuilds sources not kept in the GIT repository.
+# These files are distributed, so it is not necessary to invoke
+# AutoGen before building AutoGen.
+
+# "make" will invoke this file with the name of the desired output
+# as an argument. We do this here rather than in the make file
+# because some of the rules are complex and we don't want to
+# deal with the dual update problem.
+
+if test -z "$mainpid"
+then
+ . ${top_srcdir}/config/bootstrap.shlib
+ . ${top_builddir}/config/shdefs
+fi
+
+set_defaults()
+{
+ local AGnam=autogen
+ local GDnam=getdefs
+ local CLnam=columns
+ local AGdir=agen5
+ local GDdir=getdefs
+ local CLdir=columns
+ local f n b v
+
+ for v in AG GD CL
+ do
+ eval f=\${${v}exe}
+ eval n=\${${v}nam}
+ eval b=${top_builddir}/\${${v}dir}/\${${v}nam}
+ if test -x "$b"
+ then
+ f=$b
+
+ elif ! test -x "$f"
+ then
+ f=`command -v $n`
+ test -x "${f}" || die "$n is required"
+ fi
+ eval $v=$f
+ export $v
+ done
+
+ if ! test -x ${AGexe}
+ then
+ run_ag() {
+ touch stamp-${1}
+ touch ${target}
+ }
+ fi
+
+ # Make sure we have a default for top build and source.
+ # Some of the templates need this information.
+ #
+ local verdata=`${EGREP} '^AG_' ${top_srcdir}/VERSION | \
+ sed 's,^\(AG[^=]*\)\(.*\),\1\2 export \1,'`
+ eval "${verdata}"
+
+ # disable any $HOME defaults
+ #
+ HOME=/dev/null
+ SHELL=${POSIX_SHELL-/bin/sh}
+
+ ${VERBOSE:-false} && set -x || :
+ # Ensure complete success or a noticable failure
+ #
+ set -e
+}
+
+# # # # # # # # # # # # # # # # # # #
+#
+# Make the definition parser
+#
+make_parse()
+{
+ local opts=''
+
+ test ${#DEBUG_ENABLED} -gt 0 && \
+ opts=-DDEBUG_ENABLED
+
+ run_ag parse ${opts} defParse.def
+}
+
+# # # # # # # # # # # # # # # # # # #
+#
+# Make the pseudo-macro processing Finite State Machine
+#
+make_cgi()
+{
+ run_ag cgi cgi.def
+}
+
+make_pseudo()
+{
+ run_ag pseudo pseudo.def
+ rm -f .fsm.*
+}
+
+# # # # # # # # # # # # # # # # # # #
+#
+# Make the expression processing code
+#
+# NOTE: the expr.test test extracts this function!!
+#
+make_exprini()
+{
+ # funcCase.c must be first file in list.
+ # It has the exparg attribute names.
+ #
+ exec 3> expr.cfg
+ cat >&3 <<- _EOConfig_
+ defs-to-get gfunc
+ template snarf
+ srcfile
+ assign two-phase = yes
+ assign group = ag
+ output expr.def
+ subblock exparg = arg_name,arg_desc,arg_optional,arg_list
+ _EOConfig_
+
+ test ${#DEBUG_ENABLED} -gt 0 && \
+ printf '%-15s %s\n' assign 'debug-enabled = true' >&3
+
+ for f in func*.c exp*.c agShell.c
+ do echo input ${f} ; done >&3
+ exec 3>&-
+
+ echo ${GDexe} load=expr.cfg
+ set +e
+ ( SHELL=sh ${GDexe} load=expr.cfg ${files} 2>&1 ) | \
+ ${EGREP} -v 'no copies of pattern' >&2
+ set -e
+ run_ag exprini expr.def
+ rmlist=${rmlist}\ expr.cfg
+}
+
+# # # # # # # # # # # # # # # # # # #
+#
+# Make the directive.h header
+#
+make_directive()
+{
+ cat > directive.cfg <<- _EOConfig_
+ defs-to-get directive
+ template directive
+ output directive.def
+ linenum
+ _EOConfig_
+
+ ${GDexe} load=directive.cfg ${srcdir}/defDirect.c
+ run_ag directive -t30 directive.def
+ rmlist=${rmlist}\ directive.cfg
+}
+
+# # # # # # # # # # # # # # # # # # #
+#
+# Construct the texinfo doc
+#
+make_texi()
+{
+ eopt="-Tagtexi-cmd.tpl -DLEVEL=chapter -binvoke-autogen"
+ run_ag texi ${eopt} ${srcdir}/opts.def
+}
+
+# # # # # # # # # # # # # # # # # # #
+#
+# Construct the ag-text strings
+#
+make_ag_text()
+{
+ run_ag ag_text ${srcdir}/ag-text.def
+}
+
+# # # # # # # # # # # # # # # # # # #
+#
+# Construct the man page
+#
+make_fmem()
+{
+ ${GDexe} templ=agman3.tpl linenum output=fmemopen.def ${srcdir}/fmemopen.c
+ run_ag fmem fmemopen.def
+}
+
+make_man()
+{
+ run_ag man -Tagman-cmd -DMAN_SECTION=1 ${srcdir}/opts.def
+}
+
+# # # # # # # # # # # # # # # # # # #
+#
+# Construct the function tables
+#
+make_func()
+{
+ local files=`${GREP} -l '/\*=macfunc' *.c`
+ local opts='srcfile linenum defs=macfunc listattr=alias'
+
+ ${GDexe} output=functions.def template=functions.tpl ${opts} ${files}
+ run_ag func functions.def
+}
+
+make_gver()
+{
+ test -f guile-iface.def || make_func
+ run_ag gver guile-iface.def
+}
+
+dispatch()
+{
+ if test -d "${DEPDIR}"
+ then DEPFILE=./${DEPDIR}/stamp-${1}.d
+ else DEPFILE=''
+ fi
+ eval make_${1}
+}
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+#
+# M A I N
+#
+PS4='>stmp-${FUNCNAME}> '
+set_defaults ${1+"$@"}
+
+# FOR each output target,
+# DO the appropriate rule...
+#
+for t
+do
+ echo Re-building "$t"
+ case "$t" in
+ stamp-* )
+ dispatch ${t#stamp-} ;;
+
+ defParse-fsm.c | defParse-fsm.h )
+ dispatch parse ;;
+
+ opts.[ch] )
+ dispatch opts ;;
+
+ expr.h | expr.def | expr.ini )
+ dispatch exprini ;;
+
+ directive.def | directive.h )
+ dispatch directive ;;
+
+ autogen.texi | autogen.menu )
+ dispatch texi ;;
+
+ autogen.1 | fmemopen.3 )
+ dispatch man ;;
+
+ proto.h )
+ dispatch proto ;;
+
+ functions.h )
+ dispatch func ;;
+
+ *) if test `type -t $t` = function 2>/dev/null 1>&2
+ then dispatch $t
+ else die "Don't know how to make $t"
+ fi ;;
+ esac
+done
+assemble_Makefile
+
+rm -f $rmlist ag-*.log
+
+trap '' 0
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:4
+# sh-basic-offset:4
+# indent-tabs-mode: nil
+# End:
+
+# end of agen5/bootstrap.dir
diff --git a/agen5/opts.c b/agen5/opts.c
new file mode 100644
index 0000000..2e623f3
--- /dev/null
+++ b/agen5/opts.c
@@ -0,0 +1,1491 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (opts.c)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:32 AM by AutoGen 5.16.2pre7
+ * From the definitions opts.def
+ * and the template file options
+ *
+ * Generated from AutoOpts 36:5:11 templates.
+ *
+ * AutoOpts is a copyrighted work. This source file is not encumbered
+ * by AutoOpts licensing, but is provided under the licensing terms chosen
+ * by the autogen author or copyright holder. AutoOpts is
+ * licensed under the terms of the LGPL. The redistributable library
+ * (``libopts'') is licensed under the terms of either the LGPL or, at the
+ * users discretion, the BSD license. See the AutoOpts and/or libopts sources
+ * for details.
+ *
+ * The autogen program is copyrighted and licensed
+ * under the following terms:
+ *
+ * Copyright (C) 1992-2012 Bruce Korb, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the
+ * GNU General Public License, version 3 or later
+ * <http://gnu.org/licenses/gpl.html>
+ *
+ * autogen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * autogen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __doxygen__
+#define OPTION_CODE_COMPILE 1
+#include "opts.h"
+#include <sys/types.h>
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern FILE * option_usage_fp;
+
+/* TRANSLATORS: choose the translation for option names wisely because you
+ cannot ever change your mind. */
+#define zCopyright (autogen_opt_strs+0)
+#define zLicenseDescrip (autogen_opt_strs+275)
+
+/*
+ * global included definitions
+ */
+
+#include "autogen.h"
+#ifdef HAVE_DLOPEN
+# ifdef HAVE_DLFCN_H
+# include <dlfcn.h>
+# else
+ extern void* dlopen(char const*,int);
+# endif
+
+# ifndef RTLD_GLOBAL
+# define RTLD_GLOBAL 0
+# endif
+
+# ifndef RTLD_NOW
+# ifdef RTLD_LAZY
+# define RTLD_NOW DL_LAZY
+# else
+# define RTLD_NOW 0
+# endif
+# endif
+#endif
+
+#if HAVE_CTYPE_H
+# include <ctype.h>
+#else
+# define isspace(_c) 0
+#endif
+
+typedef void (init_proc_t)(void);
+char const * tpl_fname = NULL;
+bool trace_is_to_pipe = false;
+
+#define CANNOT_LOCATE_FMT (autogen_opt_strs+878)
+#define LOAD_GUILE_FILE_FMT (autogen_opt_strs+910)
+
+#define DLOPEN_ERROR_FMT (autogen_opt_strs+922)
+#define SYM_NOT_FOUND_FMT (autogen_opt_strs+946)
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+/*
+ * autogen option static const strings
+ */
+static char const autogen_opt_strs[3398] =
+/* 0 */ "autogen (GNU AutoGen) 5.16.2\n"
+ "Copyright (C) 1992-2012 Bruce Korb, all rights reserved.\n"
+ "This is free software. It is licensed for use, modification and\n"
+ "redistribution under the terms of the\n"
+ "GNU General Public License, version 3 or later\n"
+ " <http://gnu.org/licenses/gpl.html>\n\0"
+/* 275 */ "autogen is free software: you can redistribute it and/or modify it under\n"
+ "the terms of the GNU General Public License as published by the Free\n"
+ "Software Foundation, either version 3 of the License, or (at your option)\n"
+ "any later version.\n\n"
+ "autogen is distributed in the hope that it will be useful, but WITHOUT ANY\n"
+ "WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n"
+ "FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\n"
+ "details.\n\n"
+ "You should have received a copy of the GNU General Public License along\n"
+ "with this program. If not, see <http://www.gnu.org/licenses/>.\n\0"
+/* 878 */ "Cannot locate scheme file '%s'\n\0"
+/* 910 */ "(load \"%s\")\0"
+/* 922 */ "dlopen(%s) error %d\n"
+ "%s\n\0"
+/* 946 */ "dlsym(scm_init) not found in %s\n"
+ "\tyou must initialize the library yourself\n\0"
+/* 1021 */ "The following options select definitions, templates and scheme functions\n"
+ "to use:\0"
+/* 1102 */ "Template search directory list\0"
+/* 1133 */ "TEMPL_DIRS\0"
+/* 1144 */ "templ-dirs\0"
+/* 1155 */ "Override template file\0"
+/* 1178 */ "OVERRIDE_TPL\0"
+/* 1191 */ "override-tpl\0"
+/* 1204 */ "Library template file\0"
+/* 1226 */ "LIB_TEMPLATE\0"
+/* 1239 */ "lib-template\0"
+/* 1252 */ "Definitions input file\0"
+/* 1275 */ "DEFINITIONS\0"
+/* 1287 */ "no-definitions\0"
+/* 1302 */ "no\0"
+/* 1305 */ "Scheme code file to load\0"
+/* 1330 */ "LOAD_SCHEME\0"
+/* 1342 */ "load-scheme\0"
+/* 1354 */ "Load scheme function library\0"
+/* 1383 */ "LOAD_FUNCTIONS\0"
+/* 1398 */ "load-functions\0"
+/* 1413 */ "name or path name of shell to use\0"
+/* 1447 */ "SHELL\0"
+/* 1453 */ "shell\0"
+/* 1459 */ "Do not use in-mem streams\0"
+/* 1485 */ "NO_FMEMOPEN\0"
+/* 1497 */ "no-fmemopen\0"
+/* 1509 */ "characters considered equivalent\0"
+/* 1542 */ "EQUATE\0"
+/* 1549 */ "equate\0"
+/* 1556 */ "_-^\0"
+/* 1560 */ "The following options modify how output is handled:\0"
+/* 1612 */ "Base name for output file(s)\0"
+/* 1641 */ "BASE_NAME\0"
+/* 1651 */ "base-name\0"
+/* 1661 */ "set mod times to latest source\0"
+/* 1692 */ "SOURCE_TIME\0"
+/* 1704 */ "no-source-time\0"
+/* 1719 */ "Allow output files to be writable\0"
+/* 1753 */ "WRITABLE\0"
+/* 1762 */ "not-writable\0"
+/* 1775 */ "not\0"
+/* 1779 */ "The following options are often useful while debugging new templates:\0"
+/* 1849 */ "Limit on increment loops\0"
+/* 1874 */ "LOOP_LIMIT\0"
+/* 1885 */ "loop-limit\0"
+/* 1896 */ "Time limit for server shell\0"
+/* 1924 */ "TIMEOUT\0"
+/* 1932 */ "timeout\0"
+/* 1940 */ "tracing level of detail\0"
+/* 1964 */ "TRACE\0"
+/* 1970 */ "trace\0"
+/* 1976 */ "tracing output file or filter\0"
+/* 2006 */ "TRACE_OUT\0"
+/* 2016 */ "trace-out\0"
+/* 2026 */ "Show the definition tree\0"
+/* 2051 */ "SHOW_DEFS\0"
+/* 2061 */ "show-defs\0"
+/* 2071 */ "Show the definitions used\0"
+/* 2097 */ "USED_DEFINES\0"
+/* 2110 */ "used-defines\0"
+/* 2123 */ "Leave a core dump on a failure exit\0"
+/* 2159 */ "CORE\0"
+/* 2164 */ "core\0"
+/* 2169 */ "These options can be used to control what gets processed in the\n"
+ "definitions files and template files:\0"
+/* 2271 */ "Omit the file with this suffix\0"
+/* 2302 */ "SKIP_SUFFIX\0"
+/* 2314 */ "skip-suffix\0"
+/* 2326 */ "specify this output suffix\0"
+/* 2353 */ "SELECT_SUFFIX\0"
+/* 2367 */ "select-suffix\0"
+/* 2381 */ "name to add to definition list\0"
+/* 2412 */ "DEFINE\0"
+/* 2419 */ "define\0"
+/* 2426 */ "definition list removal pattern\0"
+/* 2458 */ "UNDEFINE\0"
+/* 2467 */ "undefine\0"
+/* 2476 */ "This option is used to automate dependency tracking:\0"
+/* 2529 */ "emit make dependency file\0"
+/* 2555 */ "MAKE_DEP\0"
+/* 2564 */ "make-dep\0"
+/* 2573 */ "Display extended usage information and exit\0"
+/* 2617 */ "help\0"
+/* 2622 */ "Extended usage information passed thru pager\0"
+/* 2667 */ "more-help\0"
+/* 2677 */ "Output version information and exit\0"
+/* 2713 */ "version\0"
+/* 2721 */ "Reset an option's state\0"
+/* 2745 */ "reset-option\0"
+/* 2758 */ "Abbreviated usage to stdout\0"
+/* 2786 */ "usage\0"
+/* 2792 */ "Save the option state to a config file\0"
+/* 2831 */ "save-opts\0"
+/* 2841 */ "Load options from a config file\0"
+/* 2873 */ "LOAD_OPTS\0"
+/* 2883 */ "no-load-opts\0"
+/* 2896 */ "AUTOGEN\0"
+/* 2904 */ "autogen (GNU AutoGen) - The Automated Program Generator - Ver. 5.16.2\n"
+ "USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ <def-file> ]\n\0"
+/* 3047 */ "$HOME\0"
+/* 3053 */ ".\0"
+/* 3055 */ ".autogenrc\0"
+/* 3066 */ "autogen-users@lists.sourceforge.net\0"
+/* 3102 */ "\n"
+ "AutoGen creates text files from templates using external definitions.\n\0"
+/* 3174 */ "\n"
+ "AutoGen is a tool designed for generating program files that contain\n"
+ "repetitive text with varied substitutions.\n\0"
+/* 3288 */ "autogen (GNU AutoGen) 5.16.2\0"
+/* 3317 */ "nothing\0"
+/* 3325 */ "debug-message\0"
+/* 3339 */ "server-shell\0"
+/* 3352 */ "templates\0"
+/* 3362 */ "block-macros\0"
+/* 3375 */ "expressions\0"
+/* 3387 */ "everything";
+
+/*
+ * input-select option description:
+ */
+#define INPUT_SELECT_DESC (autogen_opt_strs+1021)
+#define INPUT_SELECT_FLAGS (OPTST_DOCUMENT | OPTST_NO_INIT)
+
+/*
+ * templ-dirs option description:
+ */
+/* TRANSLATORS: the option argument is a file name */
+#define TEMPL_DIRS_DESC (autogen_opt_strs+1102)
+#define TEMPL_DIRS_NAME (autogen_opt_strs+1133)
+#define TEMPL_DIRS_name (autogen_opt_strs+1144)
+#define TEMPL_DIRS_FLAGS (OPTST_DISABLED | OPTST_STACKED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * override-tpl option description:
+ */
+#define OVERRIDE_TPL_DESC (autogen_opt_strs+1155)
+#define OVERRIDE_TPL_NAME (autogen_opt_strs+1178)
+#define OVERRIDE_TPL_name (autogen_opt_strs+1191)
+#define OVERRIDE_TPL_FLAGS (OPTST_DISABLED | OPTST_NO_INIT \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * lib-template option description:
+ */
+#define LIB_TEMPLATE_DESC (autogen_opt_strs+1204)
+#define LIB_TEMPLATE_NAME (autogen_opt_strs+1226)
+#define LIB_TEMPLATE_name (autogen_opt_strs+1239)
+#define LIB_TEMPLATE_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * definitions option description:
+ */
+#define DEFINITIONS_DESC (autogen_opt_strs+1252)
+#define DEFINITIONS_NAME (autogen_opt_strs+1275)
+#define NOT_DEFINITIONS_name (autogen_opt_strs+1287)
+#define NOT_DEFINITIONS_PFX (autogen_opt_strs+1302)
+#define DEFINITIONS_name (NOT_DEFINITIONS_name + 3)
+#define DEFINITIONS_FLAGS (OPTST_INITENABLED | OPTST_NO_INIT \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * load-scheme option description:
+ */
+#define LOAD_SCHEME_DESC (autogen_opt_strs+1305)
+#define LOAD_SCHEME_NAME (autogen_opt_strs+1330)
+#define LOAD_SCHEME_name (autogen_opt_strs+1342)
+#define LOAD_SCHEME_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * load-functions option description:
+ */
+#ifdef HAVE_DLOPEN
+#define LOAD_FUNCTIONS_DESC (autogen_opt_strs+1354)
+#define LOAD_FUNCTIONS_NAME (autogen_opt_strs+1383)
+#define LOAD_FUNCTIONS_name (autogen_opt_strs+1398)
+#define LOAD_FUNCTIONS_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+#else /* disable load-functions */
+#define LOAD_FUNCTIONS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
+#define LOAD_FUNCTIONS_NAME NULL
+#define LOAD_FUNCTIONS_DESC NULL
+#define LOAD_FUNCTIONS_name NULL
+#endif /* HAVE_DLOPEN */
+
+/*
+ * shell option description:
+ */
+#ifdef SHELL_ENABLED
+#define SHELL_DESC (autogen_opt_strs+1413)
+#define SHELL_NAME (autogen_opt_strs+1447)
+#define SHELL_name (autogen_opt_strs+1453)
+#define SHELL_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+#else /* disable shell */
+#define SHELL_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
+#define SHELL_NAME NULL
+#define SHELL_DESC NULL
+#define SHELL_name NULL
+#endif /* SHELL_ENABLED */
+
+/*
+ * no-fmemopen option description:
+ */
+#define NO_FMEMOPEN_DESC (autogen_opt_strs+1459)
+#define NO_FMEMOPEN_NAME (autogen_opt_strs+1485)
+#define NO_FMEMOPEN_name (autogen_opt_strs+1497)
+#define NO_FMEMOPEN_FLAGS (OPTST_DISABLED)
+
+/*
+ * equate option description:
+ */
+#define EQUATE_DESC (autogen_opt_strs+1509)
+#define EQUATE_NAME (autogen_opt_strs+1542)
+#define EQUATE_name (autogen_opt_strs+1549)
+#define EQUATE_DFT_ARG (autogen_opt_strs+1556)
+#define EQUATE_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * out-handling option description:
+ */
+#define OUT_HANDLING_DESC (autogen_opt_strs+1560)
+#define OUT_HANDLING_FLAGS (OPTST_DOCUMENT | OPTST_NO_INIT)
+
+/*
+ * base-name option description:
+ */
+#define BASE_NAME_DESC (autogen_opt_strs+1612)
+#define BASE_NAME_NAME (autogen_opt_strs+1641)
+#define BASE_NAME_name (autogen_opt_strs+1651)
+#define BASE_NAME_FLAGS (OPTST_DISABLED | OPTST_NO_INIT \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * source-time option description:
+ */
+#define SOURCE_TIME_DESC (autogen_opt_strs+1661)
+#define SOURCE_TIME_NAME (autogen_opt_strs+1692)
+#define NOT_SOURCE_TIME_name (autogen_opt_strs+1704)
+#define NOT_SOURCE_TIME_PFX (autogen_opt_strs+1302)
+#define SOURCE_TIME_name (NOT_SOURCE_TIME_name + 3)
+#define SOURCE_TIME_FLAGS (OPTST_DISABLED)
+
+/*
+ * writable option description:
+ */
+#define WRITABLE_DESC (autogen_opt_strs+1719)
+#define WRITABLE_NAME (autogen_opt_strs+1753)
+#define NOT_WRITABLE_name (autogen_opt_strs+1762)
+#define NOT_WRITABLE_PFX (autogen_opt_strs+1775)
+#define WRITABLE_name (NOT_WRITABLE_name + 4)
+#define WRITABLE_FLAGS (OPTST_DISABLED)
+
+/*
+ * debug-tpl option description:
+ */
+#define DEBUG_TPL_DESC (autogen_opt_strs+1779)
+#define DEBUG_TPL_FLAGS (OPTST_DOCUMENT | OPTST_NO_INIT)
+
+/*
+ * loop-limit option description:
+ */
+#define LOOP_LIMIT_DESC (autogen_opt_strs+1849)
+#define LOOP_LIMIT_NAME (autogen_opt_strs+1874)
+#define LOOP_LIMIT_name (autogen_opt_strs+1885)
+#define LOOP_LIMIT_DFT_ARG ((char const*)256)
+#define LOOP_LIMIT_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC) \
+ | OPTST_SCALED_NUM)
+
+/*
+ * timeout option description:
+ */
+#ifdef SHELL_ENABLED
+#define TIMEOUT_DESC (autogen_opt_strs+1896)
+#define TIMEOUT_NAME (autogen_opt_strs+1924)
+#define TIMEOUT_name (autogen_opt_strs+1932)
+#define TIMEOUT_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
+
+#else /* disable timeout */
+#define TIMEOUT_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
+#define TIMEOUT_NAME NULL
+#define TIMEOUT_DESC NULL
+#define TIMEOUT_name NULL
+#endif /* SHELL_ENABLED */
+
+/*
+ * trace option description:
+ */
+#define TRACE_DESC (autogen_opt_strs+1940)
+#define TRACE_NAME (autogen_opt_strs+1964)
+#define TRACE_name (autogen_opt_strs+1970)
+#define TRACE_DFT_ARG ((char const*)TRACE_NOTHING)
+#define TRACE_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_ENUMERATION))
+
+/*
+ * trace-out option description:
+ */
+#define TRACE_OUT_DESC (autogen_opt_strs+1976)
+#define TRACE_OUT_NAME (autogen_opt_strs+2006)
+#define TRACE_OUT_name (autogen_opt_strs+2016)
+#define TRACE_OUT_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * show-defs option description:
+ */
+#ifdef DEBUG_ENABLED
+#define SHOW_DEFS_DESC (autogen_opt_strs+2026)
+#define SHOW_DEFS_NAME (autogen_opt_strs+2051)
+#define SHOW_DEFS_name (autogen_opt_strs+2061)
+#define SHOW_DEFS_FLAGS (OPTST_DISABLED | OPTST_NO_INIT)
+
+#else /* disable show-defs */
+#define SHOW_DEFS_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
+#define SHOW_DEFS_NAME NULL
+#define SHOW_DEFS_DESC (NULL)
+#define SHOW_DEFS_name (autogen_opt_strs+2061)
+#endif /* DEBUG_ENABLED */
+
+/*
+ * used-defines option description:
+ */
+#define USED_DEFINES_DESC (autogen_opt_strs+2071)
+#define USED_DEFINES_NAME (autogen_opt_strs+2097)
+#define USED_DEFINES_name (autogen_opt_strs+2110)
+#define USED_DEFINES_FLAGS (OPTST_DISABLED | OPTST_NO_INIT)
+
+/*
+ * core option description:
+ */
+#ifdef HAVE_SYS_RESOURCE_H
+#define CORE_DESC (autogen_opt_strs+2123)
+#define CORE_NAME (autogen_opt_strs+2159)
+#define CORE_name (autogen_opt_strs+2164)
+#define CORE_FLAGS (OPTST_DISABLED)
+
+#else /* disable core */
+#define CORE_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
+#define CORE_NAME NULL
+#define CORE_DESC NULL
+#define CORE_name NULL
+#endif /* HAVE_SYS_RESOURCE_H */
+
+/*
+ * processing option description:
+ */
+#define PROCESSING_DESC (autogen_opt_strs+2169)
+#define PROCESSING_FLAGS (OPTST_DOCUMENT | OPTST_NO_INIT)
+
+/*
+ * skip-suffix option description with
+ * "Must also have options" and "Incompatible options":
+ */
+#define SKIP_SUFFIX_DESC (autogen_opt_strs+2271)
+#define SKIP_SUFFIX_NAME (autogen_opt_strs+2302)
+#define SKIP_SUFFIX_name (autogen_opt_strs+2314)
+static int const aSkip_SuffixCantList[] = {
+ INDEX_OPT_SELECT_SUFFIX, NO_EQUIVALENT };
+#define SKIP_SUFFIX_FLAGS (OPTST_DISABLED | OPTST_STACKED | OPTST_NO_INIT \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * select-suffix option description:
+ */
+#define SELECT_SUFFIX_DESC (autogen_opt_strs+2326)
+#define SELECT_SUFFIX_NAME (autogen_opt_strs+2353)
+#define SELECT_SUFFIX_name (autogen_opt_strs+2367)
+#define SELECT_SUFFIX_FLAGS (OPTST_DISABLED | OPTST_NO_INIT \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * define option description:
+ */
+#define DEFINE_DESC (autogen_opt_strs+2381)
+#define DEFINE_NAME (autogen_opt_strs+2412)
+#define DEFINE_name (autogen_opt_strs+2419)
+#define DEFINE_FLAGS (OPTST_DISABLED | OPTST_STACKED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * undefine option description:
+ */
+#define UNDEFINE_DESC (autogen_opt_strs+2426)
+#define UNDEFINE_NAME (autogen_opt_strs+2458)
+#define UNDEFINE_name (autogen_opt_strs+2467)
+#define UNDEFINE_FLAGS (OPTST_DISABLED | OPTST_NO_INIT \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * dep-track option description:
+ */
+#define DEP_TRACK_DESC (autogen_opt_strs+2476)
+#define DEP_TRACK_FLAGS (OPTST_DOCUMENT | OPTST_NO_INIT)
+
+/*
+ * make-dep option description:
+ */
+#define MAKE_DEP_DESC (autogen_opt_strs+2529)
+#define MAKE_DEP_NAME (autogen_opt_strs+2555)
+#define MAKE_DEP_name (autogen_opt_strs+2564)
+#define MAKE_DEP_FLAGS (OPTST_DISABLED | OPTST_NO_INIT \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_ARG_OPTIONAL)
+
+/*
+ * Help/More_Help/Version option descriptions:
+ */
+#define HELP_DESC (autogen_opt_strs+2573)
+#define HELP_name (autogen_opt_strs+2617)
+#ifdef HAVE_WORKING_FORK
+#define MORE_HELP_DESC (autogen_opt_strs+2622)
+#define MORE_HELP_name (autogen_opt_strs+2667)
+#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
+#else
+#define MORE_HELP_DESC NULL
+#define MORE_HELP_name NULL
+#define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
+#endif
+#ifdef NO_OPTIONAL_OPT_ARGS
+# define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
+#else
+# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
+ OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
+#endif
+#define VER_DESC (autogen_opt_strs+2677)
+#define VER_name (autogen_opt_strs+2713)
+#define RESET_DESC (autogen_opt_strs+2721)
+#define RESET_name (autogen_opt_strs+2745)
+#define RESET_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_NO_INIT)
+#define USAGE_DESC (autogen_opt_strs+2758)
+#define USAGE_name (autogen_opt_strs+2786)
+#define SAVE_OPTS_DESC (autogen_opt_strs+2792)
+#define SAVE_OPTS_name (autogen_opt_strs+2831)
+#define LOAD_OPTS_DESC (autogen_opt_strs+2841)
+#define LOAD_OPTS_NAME (autogen_opt_strs+2873)
+#define NO_LOAD_OPTS_name (autogen_opt_strs+2883)
+#define LOAD_OPTS_pfx (autogen_opt_strs+1302)
+#define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3)
+/*
+ * Declare option callback procedures
+ */
+#ifdef HAVE_DLOPEN
+ static tOptProc doOptLoad_Functions;
+#else /* not HAVE_DLOPEN */
+# define doOptLoad_Functions NULL
+#endif /* def/not HAVE_DLOPEN */
+#ifdef SHELL_ENABLED
+ static tOptProc doOptShell;
+#else /* not SHELL_ENABLED */
+# define doOptShell NULL
+#endif /* def/not SHELL_ENABLED */
+#ifdef SHELL_ENABLED
+ static tOptProc doOptTimeout;
+#else /* not SHELL_ENABLED */
+# define doOptTimeout NULL
+#endif /* def/not SHELL_ENABLED */
+extern tOptProc
+ config_dep, optionBooleanVal, optionNestedVal,
+ optionNumericVal, optionPagedUsage, optionPrintVersion,
+ optionResetOpt, optionStackArg, optionTimeDate,
+ optionTimeVal, optionUnstackArg, optionVendorOption;
+static tOptProc
+ doOptLib_Template, doOptLoad_Scheme, doOptLoop_Limit,
+ doOptOverride_Tpl, doOptSelect_Suffix, doOptTrace,
+ doUsageOpt;
+#define VER_PROC optionPrintVersion
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Define the autogen Option Descriptions.
+ * This is an array of OPTION_CT entries, one for each
+ * option that the autogen program responds to.
+ */
+static tOptDesc optDesc[OPTION_CT] = {
+ { /* entry idx, value */ 0, 0,
+ /* equiv idx, value */ 0, 0,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 0, 0,
+ /* opt state flags */ INPUT_SELECT_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ INPUT_SELECT_DESC, NULL, NULL,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 1, VALUE_OPT_TEMPL_DIRS,
+ /* equiv idx, value */ 1, VALUE_OPT_TEMPL_DIRS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ TEMPL_DIRS_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --templ-dirs */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionStackArg,
+ /* desc, NAME, name */ TEMPL_DIRS_DESC, TEMPL_DIRS_NAME, TEMPL_DIRS_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 2, VALUE_OPT_OVERRIDE_TPL,
+ /* equiv idx, value */ 2, VALUE_OPT_OVERRIDE_TPL,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OVERRIDE_TPL_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --override-tpl */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptOverride_Tpl,
+ /* desc, NAME, name */ OVERRIDE_TPL_DESC, OVERRIDE_TPL_NAME, OVERRIDE_TPL_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 3, VALUE_OPT_LIB_TEMPLATE,
+ /* equiv idx, value */ 3, VALUE_OPT_LIB_TEMPLATE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ LIB_TEMPLATE_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --lib-template */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptLib_Template,
+ /* desc, NAME, name */ LIB_TEMPLATE_DESC, LIB_TEMPLATE_NAME, LIB_TEMPLATE_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 4, VALUE_OPT_DEFINITIONS,
+ /* equiv idx, value */ 4, VALUE_OPT_DEFINITIONS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ DEFINITIONS_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --definitions */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ DEFINITIONS_DESC, DEFINITIONS_NAME, DEFINITIONS_name,
+ /* disablement strs */ NOT_DEFINITIONS_name, NOT_DEFINITIONS_PFX },
+
+ { /* entry idx, value */ 5, VALUE_OPT_LOAD_SCHEME,
+ /* equiv idx, value */ 5, VALUE_OPT_LOAD_SCHEME,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ LOAD_SCHEME_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --load-scheme */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptLoad_Scheme,
+ /* desc, NAME, name */ LOAD_SCHEME_DESC, LOAD_SCHEME_NAME, LOAD_SCHEME_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 6, VALUE_OPT_LOAD_FUNCTIONS,
+ /* equiv idx, value */ 6, VALUE_OPT_LOAD_FUNCTIONS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ LOAD_FUNCTIONS_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --load-functions */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptLoad_Functions,
+ /* desc, NAME, name */ LOAD_FUNCTIONS_DESC, LOAD_FUNCTIONS_NAME, LOAD_FUNCTIONS_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 7, VALUE_OPT_SHELL,
+ /* equiv idx, value */ 7, VALUE_OPT_SHELL,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ SHELL_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --shell */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptShell,
+ /* desc, NAME, name */ SHELL_DESC, SHELL_NAME, SHELL_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 8, VALUE_OPT_NO_FMEMOPEN,
+ /* equiv idx, value */ 8, VALUE_OPT_NO_FMEMOPEN,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ NO_FMEMOPEN_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --no-fmemopen */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ NO_FMEMOPEN_DESC, NO_FMEMOPEN_NAME, NO_FMEMOPEN_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 9, VALUE_OPT_EQUATE,
+ /* equiv idx, value */ 9, VALUE_OPT_EQUATE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ EQUATE_FLAGS, 0,
+ /* last opt argumnt */ { EQUATE_DFT_ARG },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ EQUATE_DESC, EQUATE_NAME, EQUATE_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 0, 0,
+ /* equiv idx, value */ 0, 0,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 0, 0,
+ /* opt state flags */ OUT_HANDLING_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ OUT_HANDLING_DESC, NULL, NULL,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 11, VALUE_OPT_BASE_NAME,
+ /* equiv idx, value */ 11, VALUE_OPT_BASE_NAME,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ BASE_NAME_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --base-name */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ BASE_NAME_DESC, BASE_NAME_NAME, BASE_NAME_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 12, VALUE_OPT_SOURCE_TIME,
+ /* equiv idx, value */ 12, VALUE_OPT_SOURCE_TIME,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ SOURCE_TIME_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --source-time */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ SOURCE_TIME_DESC, SOURCE_TIME_NAME, SOURCE_TIME_name,
+ /* disablement strs */ NOT_SOURCE_TIME_name, NOT_SOURCE_TIME_PFX },
+
+ { /* entry idx, value */ 13, VALUE_OPT_WRITABLE,
+ /* equiv idx, value */ 13, VALUE_OPT_WRITABLE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ WRITABLE_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --writable */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ WRITABLE_DESC, WRITABLE_NAME, WRITABLE_name,
+ /* disablement strs */ NOT_WRITABLE_name, NOT_WRITABLE_PFX },
+
+ { /* entry idx, value */ 0, 0,
+ /* equiv idx, value */ 0, 0,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 0, 0,
+ /* opt state flags */ DEBUG_TPL_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ DEBUG_TPL_DESC, NULL, NULL,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 15, VALUE_OPT_LOOP_LIMIT,
+ /* equiv idx, value */ 15, VALUE_OPT_LOOP_LIMIT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ LOOP_LIMIT_FLAGS, 0,
+ /* last opt argumnt */ { LOOP_LIMIT_DFT_ARG },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptLoop_Limit,
+ /* desc, NAME, name */ LOOP_LIMIT_DESC, LOOP_LIMIT_NAME, LOOP_LIMIT_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 16, VALUE_OPT_TIMEOUT,
+ /* equiv idx, value */ 16, VALUE_OPT_TIMEOUT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ TIMEOUT_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --timeout */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptTimeout,
+ /* desc, NAME, name */ TIMEOUT_DESC, TIMEOUT_NAME, TIMEOUT_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 17, VALUE_OPT_TRACE,
+ /* equiv idx, value */ 17, VALUE_OPT_TRACE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ TRACE_FLAGS, 0,
+ /* last opt argumnt */ { TRACE_DFT_ARG },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptTrace,
+ /* desc, NAME, name */ TRACE_DESC, TRACE_NAME, TRACE_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 18, VALUE_OPT_TRACE_OUT,
+ /* equiv idx, value */ 18, VALUE_OPT_TRACE_OUT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ TRACE_OUT_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --trace-out */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ TRACE_OUT_DESC, TRACE_OUT_NAME, TRACE_OUT_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 19, VALUE_OPT_SHOW_DEFS,
+ /* equiv idx, value */ 19, VALUE_OPT_SHOW_DEFS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ SHOW_DEFS_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --show-defs */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ SHOW_DEFS_DESC, SHOW_DEFS_NAME, SHOW_DEFS_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 20, VALUE_OPT_USED_DEFINES,
+ /* equiv idx, value */ 20, VALUE_OPT_USED_DEFINES,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ USED_DEFINES_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --used-defines */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ USED_DEFINES_DESC, USED_DEFINES_NAME, USED_DEFINES_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 21, VALUE_OPT_CORE,
+ /* equiv idx, value */ 21, VALUE_OPT_CORE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ CORE_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --core */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ CORE_DESC, CORE_NAME, CORE_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 0, 0,
+ /* equiv idx, value */ 0, 0,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 0, 0,
+ /* opt state flags */ PROCESSING_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ PROCESSING_DESC, NULL, NULL,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 23, VALUE_OPT_SKIP_SUFFIX,
+ /* equiv idx, value */ 23, VALUE_OPT_SKIP_SUFFIX,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ SKIP_SUFFIX_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --skip-suffix */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, aSkip_SuffixCantList,
+ /* option proc */ optionStackArg,
+ /* desc, NAME, name */ SKIP_SUFFIX_DESC, SKIP_SUFFIX_NAME, SKIP_SUFFIX_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 24, VALUE_OPT_SELECT_SUFFIX,
+ /* equiv idx, value */ 24, VALUE_OPT_SELECT_SUFFIX,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ SELECT_SUFFIX_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --select-suffix */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptSelect_Suffix,
+ /* desc, NAME, name */ SELECT_SUFFIX_DESC, SELECT_SUFFIX_NAME, SELECT_SUFFIX_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 25, VALUE_OPT_DEFINE,
+ /* equiv idx, value */ 25, VALUE_OPT_DEFINE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ DEFINE_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --define */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionStackArg,
+ /* desc, NAME, name */ DEFINE_DESC, DEFINE_NAME, DEFINE_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 26, VALUE_OPT_UNDEFINE,
+ /* equiv idx, value */ NOLIMIT, NOLIMIT,
+ /* equivalenced to */ INDEX_OPT_DEFINE,
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ UNDEFINE_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --undefine */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionUnstackArg,
+ /* desc, NAME, name */ UNDEFINE_DESC, UNDEFINE_NAME, UNDEFINE_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 0, 0,
+ /* equiv idx, value */ 0, 0,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 0, 0,
+ /* opt state flags */ DEP_TRACK_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ DEP_TRACK_DESC, NULL, NULL,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 28, VALUE_OPT_MAKE_DEP,
+ /* equiv idx, value */ 28, VALUE_OPT_MAKE_DEP,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ MAKE_DEP_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --make-dep */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ config_dep,
+ /* desc, NAME, name */ MAKE_DEP_DESC, MAKE_DEP_NAME, MAKE_DEP_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ INDEX_OPT_RESET_OPTION, VALUE_OPT_RESET_OPTION,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_RESET_OPTION,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ RESET_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionResetOpt,
+ /* desc, NAME, name */ RESET_DESC, NULL, RESET_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ VER_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ VER_PROC,
+ /* desc, NAME, name */ VER_DESC, NULL, VER_name,
+ /* disablement strs */ NULL, NULL },
+
+
+
+ { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doUsageOpt,
+ /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ MORE_HELP_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionPagedUsage,
+ /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ INDEX_OPT_USAGE, VALUE_OPT_USAGE,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_USAGE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doUsageOpt,
+ /* desc, NAME, name */ USAGE_DESC, NULL, USAGE_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_SAVE_OPTS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
+ | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ SAVE_OPTS_DESC, NULL, SAVE_OPTS_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_LOAD_OPTS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
+ | OPTST_DISABLE_IMM, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionLoadOpt,
+ /* desc, NAME, name */ LOAD_OPTS_DESC, LOAD_OPTS_NAME, LOAD_OPTS_name,
+ /* disablement strs */ NO_LOAD_OPTS_name, LOAD_OPTS_pfx }
+};
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Define the autogen Option Environment
+ */
+#define zPROGNAME (autogen_opt_strs+2896)
+#define zUsageTitle (autogen_opt_strs+2904)
+#define zRcName (autogen_opt_strs+3055)
+static char const * const apzHomeList[3] = {
+ autogen_opt_strs+3047,
+ autogen_opt_strs+3053,
+ NULL };
+#define zBugsAddr (autogen_opt_strs+3066)
+#define zExplain (autogen_opt_strs+3102)
+#define zDetail (autogen_opt_strs+3174)
+#define zFullVersion (autogen_opt_strs+3288)
+/* extracted from optcode.tlib near line 350 */
+
+#define OPTPROC_BASE OPTPROC_NONE
+#define translate_option_strings NULL
+
+static optArgBucket_t const original_autogen_defaults[ OPTION_CT ] = {
+ { NULL }, /* doc opt */
+ { NULL }, /* --templ-dirs */
+ { NULL }, /* --override-tpl */
+ { NULL }, /* --lib-template */
+ { NULL }, /* --definitions */
+ { NULL }, /* --load-scheme */
+ { NULL }, /* --load-functions */
+ { NULL }, /* --shell */
+ { NULL }, /* --no-fmemopen */
+ { EQUATE_DFT_ARG },
+ { NULL }, /* doc opt */
+ { NULL }, /* --base-name */
+ { NULL }, /* --source-time */
+ { NULL }, /* --writable */
+ { NULL }, /* doc opt */
+ { LOOP_LIMIT_DFT_ARG },
+ { NULL }, /* --timeout */
+ { TRACE_DFT_ARG },
+ { NULL }, /* --trace-out */
+ { NULL }, /* --show-defs */
+ { NULL }, /* --used-defines */
+ { NULL }, /* --core */
+ { NULL }, /* doc opt */
+ { NULL }, /* --skip-suffix */
+ { NULL }, /* --select-suffix */
+ { NULL }, /* --define */
+ { NULL }, /* --undefine */
+ { NULL }, /* doc opt */
+ { NULL }, /* --make-dep */
+ { NULL }, /* resettable */
+ { NULL }, /* version */
+ { NULL }, /* help */
+ { NULL }, /* more-help */
+ { NULL }, /* usage-opt */
+ { NULL }, /* save-opts */
+ { NULL } /* load-opts */
+};
+static void * const original_autogen_cookies[ OPTION_CT ] = {
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
+};
+
+
+#define autogen_full_usage (NULL)
+
+#define autogen_short_usage (NULL)
+
+#endif /* not defined __doxygen__ */
+
+/*
+ * Create the static procedure(s) declared above.
+ */
+/**
+ * The callout function that invokes the optionUsage function.
+ *
+ * @param pOptions the AutoOpts option description structure
+ * @param pOptDesc the descriptor for the "help" (usage) option.
+ * @noreturn
+ */
+static void
+doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
+{
+ if ((pOptDesc->fOptState & OPTST_RESET) != 0)
+ return;
+
+ int ex_code = (pOptDesc->optIndex == INDEX_OPT_HELP)
+ ? AUTOGEN_EXIT_SUCCESS : AO_EXIT_REQ_USAGE;
+ optionUsage(&autogenOptions, ex_code);
+ /* NOTREACHED */
+ (void)pOptions;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the override-tpl option.
+ *
+ * @param pOptions the autogen options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptOverride_Tpl(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ /* extracted from opts.def, line 171 */
+ tpl_fname = pOptDesc->optArg.argString;
+ (void)pOptions;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the lib-template option.
+ *
+ * @param pOptions the autogen options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptLib_Template(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ /* extracted from opts.def, line 192 */
+ templ_t* pT;
+ processing_state = PROC_STATE_LIB_LOAD;
+ pT = tpl_load(pOptDesc->optArg.argString, NULL);
+ tpl_unload(pT);
+ processing_state = PROC_STATE_OPTIONS;
+ (void)pOptions;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the load-scheme option.
+ *
+ * @param pOptions the autogen options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptLoad_Scheme(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ /* extracted from opts.def, line 254 */
+ proc_state_t saveState = processing_state;
+ char* pz;
+ char zPath[MAXPATHLEN];
+ static char const * const apzSfx[] = { "scm", NULL };
+
+ if (! SUCCESSFUL(
+ find_file(pOptDesc->optArg.argString, zPath, apzSfx, NULL))) {
+
+ usage_message(CANNOT_LOCATE_FMT,
+ pOptDesc->optArg.argString);
+ /* NOTREACHED */
+ }
+
+ pz = aprf(LOAD_GUILE_FILE_FMT, zPath);
+ processing_state = PROC_STATE_GUILE_PRELOAD;
+ (void)ag_scm_c_eval_string_from_file_line(
+ pz, __FILE__, __LINE__);
+ free(pz);
+ processing_state = saveState;
+ (void)pOptions;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the load-functions option, when HAVE_DLOPEN is #define-d.
+ *
+ * @param pOptions the autogen options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+#ifdef HAVE_DLOPEN
+static void
+doOptLoad_Functions(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ /* extracted from opts.def, line 304 */
+ void* hdl = dlopen(
+ pOptDesc->optArg.argString, RTLD_NOW|RTLD_GLOBAL);
+ init_proc_t* proc;
+
+ if (hdl == NULL) {
+ char const* pzErr = dlerror();
+ fprintf(stderr, DLOPEN_ERROR_FMT,
+ pOptDesc->optArg.argString, errno, pzErr);
+ exit(EXIT_FAILURE);
+ }
+ proc = (init_proc_t*)dlsym(hdl, "scm_init");
+ if (proc == NULL) {
+ fprintf(stderr, SYM_NOT_FOUND_FMT,
+ pOptDesc->optArg.argString);
+ }
+ else (*proc)();
+ (void)pOptions;
+}
+#endif /* defined HAVE_DLOPEN */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the shell option, when SHELL_ENABLED is #define-d.
+ *
+ * @param pOptions the autogen options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+#ifdef SHELL_ENABLED
+static void
+doOptShell(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ /* extracted from opts.def, line 341 */
+ shell_program = pOptDesc->optArg.argString;
+ (void)pOptions;
+}
+#endif /* defined SHELL_ENABLED */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the loop-limit option.
+ *
+ * @param pOptions the autogen options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptLoop_Limit(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ static struct {long rmin, rmax;} const rng[2] = {
+ { -1, LONG_MIN }, { 1, 0x1000000 } };
+ int ix;
+
+ if (pOptions <= OPTPROC_EMIT_LIMIT)
+ goto emit_ranges;
+ if ((pOptDesc->fOptState & OPTST_RESET) != 0)
+ return;
+ optionNumericVal(pOptions, pOptDesc);
+
+ for (ix = 0; ix < 2; ix++) {
+ if (pOptDesc->optArg.argInt < rng[ix].rmin)
+ continue; /* ranges need not be ordered. */
+ if (pOptDesc->optArg.argInt == rng[ix].rmin)
+ return;
+ if (rng[ix].rmax == LONG_MIN)
+ continue;
+ if (pOptDesc->optArg.argInt <= rng[ix].rmax)
+ return;
+ }
+
+ option_usage_fp = stderr;
+
+emit_ranges:
+ optionShowRange(pOptions, pOptDesc, (void *)rng, 2);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the timeout option, when SHELL_ENABLED is #define-d.
+ *
+ * @param pOptions the autogen options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+#ifdef SHELL_ENABLED
+static void
+doOptTimeout(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ static struct {long rmin, rmax;} const rng[1] = {
+ { 0, 3600 } };
+ int ix;
+
+ if (pOptions <= OPTPROC_EMIT_LIMIT)
+ goto emit_ranges;
+ if ((pOptDesc->fOptState & OPTST_RESET) != 0)
+ return;
+ optionNumericVal(pOptions, pOptDesc);
+
+ for (ix = 0; ix < 1; ix++) {
+ if (pOptDesc->optArg.argInt < rng[ix].rmin)
+ continue; /* ranges need not be ordered. */
+ if (pOptDesc->optArg.argInt == rng[ix].rmin)
+ return;
+ if (rng[ix].rmax == LONG_MIN)
+ continue;
+ if (pOptDesc->optArg.argInt <= rng[ix].rmax)
+ return;
+ }
+
+ option_usage_fp = stderr;
+
+emit_ranges:
+ optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
+}
+#endif /* defined SHELL_ENABLED */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the trace option.
+ *
+ * @param pOptions the autogen options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptTrace(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+
+/* extracted from optmain.tlib near line 871 */
+ static char const * const azNames[7] = {
+ autogen_opt_strs+3317, autogen_opt_strs+3325, autogen_opt_strs+3339,
+ autogen_opt_strs+3352, autogen_opt_strs+3362, autogen_opt_strs+3375,
+ autogen_opt_strs+3387 };
+
+ if (pOptions <= OPTPROC_EMIT_LIMIT) {
+ (void) optionEnumerationVal(pOptions, pOptDesc, azNames, 7);
+ return; /* protect AutoOpts client code from internal callbacks */
+ }
+ if ((pOptDesc->fOptState & OPTST_RESET) != 0)
+ return;
+
+ pOptDesc->optArg.argEnum =
+ optionEnumerationVal(pOptions, pOptDesc, azNames, 7);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the select-suffix option.
+ *
+ * @param pOptions the autogen options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptSelect_Suffix(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ /* extracted from opts.def, line 781 */
+ char const * arg = pOptDesc->optArg.argString;
+ if ((arg != NULL) && (*arg != NUL))
+ (void)do_suffix(arg, NULL, -1);
+ (void)pOptions;
+}
+/* extracted from optmain.tlib near line 1146 */
+
+/**
+ * Print a usage message with a format and va_list argument.
+ * The optionUsage function is then invoked to print
+ * the error usage text (somewhat abbreviated) and then exit.
+ *
+ * @param[in] fmt the message format string
+ * @param[in] ap the var-arg list.
+ * @noreturn
+ */
+void
+vusage_message(char const * fmt, va_list ap)
+{
+ char const * er_leader = _("autogen usage error:\n");
+ fputs(er_leader, stderr);
+ vfprintf(stderr, fmt, ap);
+ optionUsage(&autogenOptions, AUTOGEN_EXIT_OPTION_ERROR);
+ /* NOTREACHED */
+}
+
+/**
+ * Print a usage message with a format and a variable argument list.
+ * vusage_message() is called to do the work.
+ *
+ * @param[in] fmt the message format string
+ * @param[in] ... the argument list for the message
+ * @noreturn
+ */
+void
+usage_message(char const * fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vusage_message(fmt, ap);
+ /* NOTREACHED */
+ va_end(ap);
+}
+
+/**
+ * The directory containing the data associated with autogen.
+ */
+#ifndef PKGDATADIR
+# define PKGDATADIR ""
+#endif
+
+/**
+ * Information about the person or institution that packaged autogen
+ * for the current distribution.
+ */
+#ifndef WITH_PACKAGER
+# define autogen_packager_info NULL
+#else
+static char const autogen_packager_info[] =
+ "Packaged by " WITH_PACKAGER
+
+# ifdef WITH_PACKAGER_VERSION
+ " ("WITH_PACKAGER_VERSION")"
+# endif
+
+# ifdef WITH_PACKAGER_BUG_REPORTS
+ "\nReport autogen bugs to " WITH_PACKAGER_BUG_REPORTS
+# endif
+ "\n";
+#endif
+#ifndef __doxygen__
+
+#endif /* __doxygen__ */
+/**
+ * The option definitions for autogen. The one structure that
+ * binds them all.
+ */
+tOptions autogenOptions = {
+ OPTIONS_STRUCT_VERSION,
+ 0, NULL, /* original argc + argv */
+ ( OPTPROC_BASE
+ + OPTPROC_ERRSTOP
+ + OPTPROC_SHORTOPT
+ + OPTPROC_LONGOPT
+ + OPTPROC_NO_REQ_OPT
+ + OPTPROC_NEGATIONS
+ + OPTPROC_ENVIRON ),
+ 0, NULL, /* current option index, current option */
+ NULL, NULL, zPROGNAME,
+ zRcName, zCopyright, zLicenseDescrip,
+ zFullVersion, apzHomeList, zUsageTitle,
+ zExplain, zDetail, optDesc,
+ zBugsAddr, /* address to send bugs to */
+ NULL, NULL, /* extensions/saved state */
+ optionUsage, /* usage procedure */
+ translate_option_strings, /* translation procedure */
+ /*
+ * Indexes to special options
+ */
+ { INDEX_OPT_MORE_HELP, /* more-help option index */
+ INDEX_OPT_SAVE_OPTS, /* save option index */
+ NO_EQUIVALENT, /* '-#' option index */
+ NO_EQUIVALENT /* index of default opt */
+ },
+ 36 /* full option count */, 29 /* user option count */,
+ autogen_full_usage, autogen_short_usage,
+ original_autogen_defaults, original_autogen_cookies,
+ PKGDATADIR, autogen_packager_info
+};
+
+#ifdef __cplusplus
+}
+#endif
+/* opts.c ends here */
diff --git a/agen5/opts.def b/agen5/opts.def
new file mode 100644
index 0000000..c595909
--- /dev/null
+++ b/agen5/opts.def
@@ -0,0 +1,998 @@
+/* -*- Mode: conf -*- */
+
+autogen definitions options;
+
+/*
+ * Time-stamp: "2012-04-15 11:12:30 bkorb"
+ *
+ * This file is part of AutoGen.
+ * Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+copyright = {
+ date = "1992-2012";
+ owner = "Bruce Korb";
+ eaddr = 'autogen-users@lists.sourceforge.net';
+ type = gpl;
+};
+
+/*
+ * "XML2AG" is a wrapper around AutoGen. Therefore, this file serves
+ * to describe the options for both programs. Which is being described
+ * depends on the definition state of "XML2AG".
+ */
+#ifndef XML2AG
+prog-name = "autogen";
+prog-title = "The Automated Program Generator";
+homerc = $HOME, ".";
+environrc;
+usage-opt;
+usage-message;
+resettable;
+config-header = config.h;
+no-xlate = anything;
+
+#else
+prog-name = xml2ag;
+prog-title = "XML to AutoGen Definiton Converter";
+#endif
+package = 'GNU AutoGen';
+
+argument = "[ <def-file> ]";
+long-opts;
+
+version = `
+ if test ! -d "${top_srcdir}"; then
+ echo "NOTICE: Setting top_srcdir to .." >&2
+ top_srcdir=..
+ fi
+ test -f ${top_srcdir}/VERSION || \
+ die "error ${top_srcdir}/VERSION file missing"
+ eval \`egrep '^AG_[A-Z_]*=' ${top_srcdir}/VERSION\` 2> /dev/null
+ echo $AG_VERSION `;
+
+include = "[= AutoGen5 Template =]";
+#ifndef XML2AG
+include = <<- _END_INCLUDE
+ #include "autogen.h"
+ #ifdef HAVE_DLOPEN
+ # ifdef HAVE_DLFCN_H
+ # include <dlfcn.h>
+ # else
+ extern void* dlopen(char const*,int);
+ # endif
+
+ # ifndef RTLD_GLOBAL
+ # define RTLD_GLOBAL 0
+ # endif
+
+ # ifndef RTLD_NOW
+ # ifdef RTLD_LAZY
+ # define RTLD_NOW DL_LAZY
+ # else
+ # define RTLD_NOW 0
+ # endif
+ # endif
+ #endif
+
+ #if HAVE_CTYPE_H
+ # include <ctype.h>
+ #else
+ # define isspace(_c) 0
+ #endif
+
+ typedef void (init_proc_t)(void);
+ char const * tpl_fname = NULL;
+ bool trace_is_to_pipe = false;
+ _END_INCLUDE;
+
+export = <<- _EOExport_
+ extern char const * tpl_fname;
+ extern bool trace_is_to_pipe;
+ _EOExport_;
+#endif /* XML2AG */
+
+exit-name[1] = option-error;
+exit-desc[1] = 'The command options were misconfigured.';
+exit-name[2] = bad_template;
+exit-desc[2] = 'An error was encountered processing the template.';
+exit-name[3] = bad_definitions;
+exit-desc[3] = 'The definitions could not be deciphered.';
+exit-name[4] = load-error;
+exit-desc[4] = 'An error was encountered during the load phase.';
+exit-name[5] = signal;
+exit-desc[5] = <<- _EndDesc_
+ Program exited due to catching a signal. If your template includes
+ string formatting, a number argument to a "%s" formatting element will
+ trigger a segmentation fault. Autogen will catch the seg fault signal
+ and exit with @code{AUTOGEN_EXIT_SIGNAL(5)}. Alternatively, AutoGen
+ may have been interrupted with a @code{kill(2)} signal.
+ _EndDesc_;
+
+#ifndef XML2AG
+flag = {
+ name = input-select;
+ documentation;
+
+ descrip =
+'The following options select definitions, templates and '
+'scheme functions to use';
+};
+#endif
+
+flag = {
+ name = templ-dirs;
+ value = L;
+ arg-type = string;
+ descrip = "Template search directory list";
+ max = NOLIMIT;
+ arg-name = dir;
+ translators = 'the option argument is a file name';
+ stack-arg;
+#ifndef XML2AG
+ settable;
+ doc = <<- _EOF_
+ Add a directory to the list of directories to search when opening
+ a template, either as the primary template or an included one.
+ The last entry has the highest priority in the search list.
+ That is to say, they are searched in reverse order.
+ _EOF_;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = override-tpl;
+ value = T;
+ arg-type = string;
+ arg-name = tpl-file;
+ descrip = "Override template file";
+#ifndef XML2AG
+ no-preset;
+ doc = <<- _EOF_
+ Definition files specify the standard template that is to be expanded.
+ This option will override that name and expand a different template.
+ _EOF_;
+
+ flag-code = " tpl_fname = pOptDesc->optArg.argString;";
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = lib-template;
+ value = l;
+ arg-type = string;
+ arg-name = tpl-file;
+ descrip = "Library template file";
+ max = NOLIMIT;
+#ifndef XML2AG
+ doc = <<- _EOF_
+ DEFINE macros are saved from this template file for use in processing
+ the main macro file. Template text aside from the DEFINE macros is
+ is ignored.
+ _EOF_;
+
+ flag-code = <<- _EOCode_
+ templ_t* pT;
+ processing_state = PROC_STATE_LIB_LOAD;
+ pT = tpl_load(pOptDesc->optArg.argString, NULL);
+ tpl_unload(pT);
+ processing_state = PROC_STATE_OPTIONS;
+ _EOCode_;
+#else
+ stack-arg;
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = 'definitions';
+ arg-type = string;
+ arg-name = file;
+ descrip = "Definitions input file";
+#ifndef XML2AG
+ disable = no;
+ no-preset;
+ enabled;
+ settable;
+ doc = <<- _EOF_
+ Use this argument to specify the input definitions file with a
+ command line option. If you do not specify this option, then
+ there must be a command line argument that specifies the file,
+ even if only to specify stdin with a hyphen (@code{-}).
+ Specify, @code{--no-definitions} when you wish to process
+ a template without any active AutoGen definitions.
+ _EOF_;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+include =
+ '#define CANNOT_LOCATE_FMT ([=
+ (string-table-add-ref opt-strs
+ "Cannot locate scheme file \'%s\'\n")=])' "\n"
+
+ '#define LOAD_GUILE_FILE_FMT ([=
+ (string-table-add-ref opt-strs
+ "(load \"%s\")")=])';
+
+flag = {
+ name = load-scheme;
+ value = S;
+ arg-type = string;
+ arg-name = file;
+ descrip = "Scheme code file to load";
+#ifndef XML2AG
+ settable;
+ doc = <<- _EOF_
+ Use this option to pre-load Scheme scripts into the Guile
+ interpreter before template processing begins.
+ Please note that the AutoGen specific functions are not loaded
+ until after argument processing. So, though they may be specified
+ in lambda functions you define, they may not be invoked until after
+ option processing is complete.
+ _EOF_;
+
+ flag-code = <<- _EOCode_
+ proc_state_t saveState = processing_state;
+ char* pz;
+ char zPath[MAXPATHLEN];
+ static char const * const apzSfx[] = { "scm", NULL };
+
+ if (! SUCCESSFUL(
+ find_file(pOptDesc->optArg.argString, zPath, apzSfx, NULL))) {
+
+ usage_message(CANNOT_LOCATE_FMT,
+ pOptDesc->optArg.argString);
+ /* NOTREACHED */
+ }
+
+ pz = aprf(LOAD_GUILE_FILE_FMT, zPath);
+ processing_state = PROC_STATE_GUILE_PRELOAD;
+ (void)ag_scm_c_eval_string_from_file_line(
+ pz, __FILE__, __LINE__);
+ free(pz);
+ processing_state = saveState;
+ _EOCode_;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+include =
+ '#define DLOPEN_ERROR_FMT ([=
+ (string-table-add-ref opt-strs
+ "dlopen(%s) error %d\n%s\n")=])' "\n"
+
+ '#define SYM_NOT_FOUND_FMT ([=
+ (string-table-add-ref opt-strs (string-append
+ "dlsym(scm_init) not found in %s\n"
+ "\tyou must initialize the library yourself\n")) =])';
+
+flag = {
+ name = load-functions;
+ value = F;
+ arg-type = string;
+ arg-name = file;
+ descrip = "Load scheme function library";
+ ifdef = HAVE_DLOPEN;
+#ifndef XML2AG
+ doc = <<- _EOF_
+ This option is used to load Guile-scheme functions. The automatically
+ called initialization routine @code{scm_init} must be used to register
+ these routines or data.
+ _EOF_;
+
+ flag-code = <<- _EOCode_
+ void* hdl = dlopen(
+ pOptDesc->optArg.argString, RTLD_NOW|RTLD_GLOBAL);
+ init_proc_t* proc;
+
+ if (hdl == NULL) {
+ char const* pzErr = dlerror();
+ fprintf(stderr, DLOPEN_ERROR_FMT,
+ pOptDesc->optArg.argString, errno, pzErr);
+ exit(EXIT_FAILURE);
+ }
+ proc = (init_proc_t*)dlsym(hdl, "scm_init");
+ if (proc == NULL) {
+ fprintf(stderr, SYM_NOT_FOUND_FMT,
+ pOptDesc->optArg.argString);
+ }
+ else (*proc)();
+ _EOCode_;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = shell;
+ arg-type = string;
+ arg-name = shell;
+
+ descrip = "name or path name of shell to use";
+#ifndef XML2AG
+ ifdef = SHELL_ENABLED;
+ doc = <<- _EOF_
+ By default, when AutoGen is built, the configuration is probed for a
+ reasonable Bourne-like shell to use for shell script processing. If
+ a particular template needs an alternate shell, it must be specified
+ with this option on the command line, with an environment variable
+ (@code{SHELL}) or in the configuration/initialization file.
+ _EOF_;
+ flag-code = " shell_program = pOptDesc->optArg.argString;";
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = no-fmemopen;
+ descrip = "Do not use in-mem streams";
+ value = m;
+#ifndef XML2AG
+ doc = <<- _EOF_
+ If the local C library supports "@code{fopencookie(3GNU)}", or
+ "@code{funopen(3BSD)}" then AutoGen prefers to use in-memory stream
+ buffer opens instead of anonymous files. This may lead to problems
+ if there is a shortage of virtual memory. If, for a particular
+ application, you run out of memory, then specify this option.
+ This is unlikely in a modern 64-bit virtual memory environment.
+
+ On platforms without these functions, the option is accepted
+ but ignored. @code{fmemopen(POSIX)} is not adequate because
+ its string buffer is not reallocatable. @code{open_memstream(POSIX)}
+ is @i{also} not adequate because the stream is only opened for
+ output. AutoGen needs a reallocatable buffer available for both
+ reading and writing.
+ _EOF_;
+
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = equate;
+ arg-name = char-list;
+ arg-type = string;
+ descrip = "characters considered equivalent";
+#ifndef XML2AG
+ arg-default = "_-^" /* default equivalence */;
+ doc = <<- _EODoc_
+ This option will alter the list of characters considered equivalent.
+ The default are the three characters, "_-^". (The last is conventional
+ on a Tandem/HP-NonStop, and I used to do a lot of work on Tandems.)
+ _EODoc_;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+#ifndef XML2AG
+flag = {
+ name = out-handling;
+ documentation;
+ descrip = 'The following options modify how output is handled';
+};
+#endif
+
+flag = {
+ name = base-name;
+ value = b;
+ arg-type = string;
+ arg-name = name;
+ descrip = "Base name for output file(s)";
+#ifndef XML2AG
+ no-preset;
+ doc = <<- _EOF_
+ A template may specify the exact name of the output file. Normally,
+ it does not. Instead, the name is composed of the base name of the
+ definitions file with suffixes appended. This option will override the
+ base name derived from the definitions file name. This is required if
+ there is no definitions file and advisable if definitions are being
+ read from stdin. If the definitions are being read from standard in,
+ the base name defaults to @file{stdin}. Any leading directory components
+ in the name will be silently removed. If you wish the output file to
+ appear in a particular directory, it is recommended that you "cd" into
+ that directory first, or use directory names in the format specification
+ for the output suffix lists, @xref{pseudo macro}.
+ _EOF_;
+#else
+ settable;
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = source-time;
+ descrip = "set mod times to latest source";
+#ifndef XML2AG
+ disable = no;
+ doc = <<- _EOF_
+ If you stamp your output files with the @code{DNE} macro output, then
+ your output files will always be different, even if the content has
+ not really changed. If you use this option, then the modification
+ time of the output files will change only if the input files change.
+ This will help reduce unneeded builds.
+ _EOF_;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = writable;
+ descrip = "Allow output files to be writable";
+ disable = not;
+#ifndef XML2AG
+ settable;
+ doc = <<- _EODoc_
+ This option will leave output files writable.
+ Normally, output files are read-only.
+ _EODoc_;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+#ifndef XML2AG
+flag = {
+ name = debug-tpl;
+ documentation = <<- _EODoc_
+ They specify limits that prevent the template from taking overly long
+ or producing more output than expected.
+ _EODoc_;
+ descrip =
+'The following options are often useful while debugging new templates';
+};
+#endif
+
+flag = {
+ name = loop-limit;
+ arg-type = number;
+ arg-default = 256;
+ arg-range = "-1";
+ arg-range = "1->0x1000000"; /* 16 million */
+ scaled;
+
+ arg-name = lim;
+ descrip = "Limit on increment loops";
+#ifndef XML2AG
+ doc = <<- _EODoc_
+ This option prevents runaway loops. For example, if you accidentally
+ specify, "FOR x (for-from 1) (for-to -1) (for-by 1)", it will take a
+ long time to finish. If you do have more than 256 entries in tables,
+ you will need to specify a new limit with this option.
+ _EODoc_;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = timeout;
+ value = t;
+ arg-type = number;
+ arg-range = "0->3600"; /* one hour limit */
+ arg-name = time-lim;
+
+ descrip = "Time limit for server shell";
+#ifndef XML2AG
+ ifdef = SHELL_ENABLED;
+ doc = <<- _EOF_
+ AutoGen works with a shell server process. Most normal commands will
+ complete in less than 10 seconds. If, however, your commands need more
+ time than this, use this option.
+
+ The valid range is 0 to 3600 seconds (1 hour).
+ Zero will disable the server time limit.
+ _EOF_;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = trace;
+ arg-type = keyword;
+ arg-default = nothing;
+ arg-name = level;
+ descrip = "tracing level of detail";
+ keyword = nothing, debug-message, server-shell, templates,
+ block-macros, expressions, everything;
+
+#ifndef XML2AG
+ doc = <<- _EOF_
+ This option will cause AutoGen to display a trace of its template
+ processing. There are six levels, each level including messages from
+ the previous levels:
+
+ @table @samp
+ @item nothing
+ Does no tracing at all (default)
+
+ @item debug-message
+ Print messages from the "DEBUG" AutoGen macro (@pxref{DEBUG}).
+
+ @item server-shell
+ Traces all input and output to the server shell. This includes a shell
+ "independent" initialization script about 30 lines long. Its output is
+ discarded and not inserted into any template.
+
+ @item templates
+ Traces the invocation of @code{DEFINE}d macros and @code{INCLUDE}s
+
+ @item block-macros
+ Traces all block macros. The above, plus @code{IF}, @code{FOR},
+ @code{CASE} and @code{WHILE}.
+
+ @item expressions
+ Displays the results of expression evaluations.
+
+ @item everything
+ Displays the invocation of every AutoGen macro, even @code{TEXT} macros
+ (i.e. the text outside of macro quotes). Additionally, if you rebuild
+ the ``expr.ini'' file with debugging enabled, then all calls to
+ AutoGen defined scheme functions will also get logged:
+ @*
+ @example
+ cd $@{top_builddir@}/agen5
+ DEBUG_ENABLED=true bash bootstrap.dir expr.ini
+ make CFLAGS='-g -DDEBUG_ENABLED=1'
+ @end example
+
+ Be aware that you cannot rebuild this source in this way without first
+ having installed the @code{autogen} executable in your search path.
+ Because of this, "expr.ini" is in the distributed source list, and
+ not in the dependencies.
+ @end table
+ _EOF_;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = trace-out;
+ arg-type = string;
+ arg-name = file;
+ descrip = "tracing output file or filter";
+#ifndef XML2AG
+
+ doc = <<- _EOF_
+ The output specified may be a file name, a file that is appended to,
+ or, if the option argument begins with the @code{pipe} operator
+ (@code{|}), a command that will receive the tracing output as standard
+ in. For example, @code{--traceout='| less'} will run the trace output
+ through the @code{less} program. Appending to a file is specified by
+ preceeding the file name with two greater-than characters (@code{>>}).
+ _EOF_;
+
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+/*
+ * These are for debugging AutoGen itself:
+ */
+flag = {
+ name = show-defs;
+ descrip = "Show the definition tree";
+#ifndef XML2AG
+ no-preset;
+ ifdef = DEBUG_ENABLED;
+ omitted-usage;
+
+ doc = <<- _EOF_
+ This will print out the complete definition tree before processing
+ the template.
+ _EOF_ ;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = used-defines;
+ descrip = "Show the definitions used";
+#ifndef XML2AG
+ no-preset;
+ doc = <<- _EOF_
+ This will print out the names of definition values searched for
+ during the processing of the template, whether actually found or
+ not. There may be other referenced definitions in a template in
+ portions of the template not evaluated. Some of the names listed
+ may be computed names and others AutoGen macro arguments. This is
+ not a means for producing a definitive, all-encompassing list of all
+ and only the values used from a definition file. This is intended
+ as an aid to template documentation only.
+ _EOF_ ;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = core;
+ value = C;
+ descrip = 'Leave a core dump on a failure exit';
+ ifdef = HAVE_SYS_RESOURCE_H;
+
+ doc = <<- _EOF_
+ Many systems default to a zero sized core limit. If the system
+ has the sys/resource.h header and if this option is supplied,
+ then in the failure exit path, autogen will attempt to set the
+ soft core limit to whatever the hard core limit is. If that
+ does not work, then an administrator must raise the hard core
+ size limit.
+ _EOF_;
+};
+
+#ifdef DAEMON_ENABLED
+flag = {
+ name = daemon;
+ value = d;
+ arg-type = string;
+ arg-name = connect-type;
+ descrip = "TCP port or pipe file name";
+ woops = (error "Daemon-ization is not ready for prime time");
+#ifndef XML2AG
+ ifdef = DAEMON_ENABLED;
+ no-preset;
+ flag-code = ' SET_OPT_DEFINITIONS("-");';
+ doc = <<- _EODoc_
+ If you wish to be able to run AutoGen as a daemon process, specify
+ this option. The resulting daemon will be able to receive requests on
+ either a socket or over a named pipe. The syntax of the connect-type
+ argument determines the kind of connection:
+
+ @table @samp
+ @item is a number
+ The address family will default to AF_INET and the number must
+ represent the port number AutoGen will listen on.
+
+ @item contains a colon
+ The string up to the colon will be looked up. If it matches an
+ address family, the string after the colon is presumed to be an
+ address of the appropriate kind. "unix:" addresses should be a
+ path name with existing directory names, but a non-existent base
+ file name. "inet:" and "inet6" should be followed by a port number.
+
+ @item some other string
+ The string represents a named pipe. The name of the bi-directional
+ pipe that any number of processes can open and communicate over. If
+ your system does @strong{not} support such things, then the input pipe
+ will be suffixed with "-in" and the output pipe suffixed with "-out"
+ and only one client may connect at a time.
+ @end table
+ _EODoc_;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+#endif // DAEMON_ENABLED
+
+#ifndef XML2AG
+flag = {
+ name = processing;
+ documentation = <<- _EODoc_
+ They specify which outputs and parts of outputs to produce.
+ _EODoc_;
+
+ descrip = <<- _EODoc_
+ These options can be used to control what gets processed
+ in the definitions files and template files
+ _EODoc_;
+};
+#endif
+
+flag = {
+ name = skip-suffix;
+ value = s;
+ arg-type = string;
+ arg-name = suffix;
+ descrip = "Omit the file with this suffix";
+ max = NOLIMIT;
+ flags-cant = select-suffix;
+ stack-arg;
+
+#ifndef XML2AG
+ no-preset;
+ doc = <<- _EOF_
+ Occasionally, it may not be desirable to produce all of the output
+ files specified in the template. (For example, only the @file{.h}
+ header file, but not the @file{.c} program text.) To do this
+ specify @code{--skip-suffix=c} on the command line.
+ _EOF_;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = select-suffix;
+ value = o;
+ arg-type = string;
+ arg-name = suffix;
+ descrip = "specify this output suffix";
+ max = NOLIMIT;
+
+#ifndef XML2AG
+ no-preset;
+ doc = <<- _EOF_
+ If you wish to override the suffix specifications in the template,
+ you can use one or more copies of this option. See the suffix
+ specification in the @ref{pseudo macro} section of the info doc.
+ _EOF_;
+ flag-code = <<- _EOCode_
+ char const * arg = pOptDesc->optArg.argString;
+ if ((arg != NULL) && (*arg != NUL))
+ (void)do_suffix(arg, NULL, -1);
+ _EOCode_;
+#else
+ doc = "Pass-through AutoGen argument";
+ stack-arg;
+#endif
+};
+
+flag = {
+ name = define;
+ value = D;
+ arg-type = string;
+ arg-name = value;
+ max = NOLIMIT;
+ descrip = "name to add to definition list";
+ stack-arg;
+#ifndef XML2AG
+ settable;
+ doc = <<- _EODoc_
+ The AutoGen define names are used for the following purposes:
+
+ @enumerate
+ @item
+ Sections of the AutoGen definitions may be enabled or disabled
+ by using C-style #ifdef and #ifndef directives.
+ @item
+ When defining a value for a name, you may specify the index
+ for a particular value. That index may be a literal value,
+ a define option or a value #define-d in the definitions themselves.
+ @item
+ The name of a file may be prefixed with @code{$NAME/}.
+ The @code{$NAME} part of the name string will be replaced with
+ the define-d value for @code{NAME}.
+ @item
+ When AutoGen is finished loading the definitions, the defined values
+ are exported to the environment with, @code{putenv(3)}.
+ These values can then be used in shell scripts with @code{$@{NAME@}}
+ references and in templates with @code{(getenv "NAME")}.
+ @item
+ While processing a template, you may specify an index to retrieve
+ a specific value. That index may also be a define-d value.
+ @end enumerate
+
+ It is entirely equivalent to place this name in the exported environment.
+ Internally, that is what AutoGen actually does with this option.
+ _EODoc_;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+flag = {
+ name = undefine;
+ value = U;
+ arg-type = string;
+ arg-name = name-pat;
+ max = NOLIMIT;
+ descrip = "definition list removal pattern";
+ unstack-arg = define;
+#ifndef XML2AG
+ no-preset;
+ settable;
+ doc = <<- _EOF_
+ Similar to 'C', AutoGen uses @code{#ifdef/#ifndef} preprocessing
+ directives. This option will cause the matching names to be
+ removed from the list of defined values.
+ _EOF_ ;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+#ifndef XML2AG
+flag = {
+ name = dep-track;
+ documentation;
+ descrip = 'This option is used to automate dependency tracking';
+};
+#endif
+
+flag = {
+ name = make-dep;
+ value = M;
+ arg-type = string;
+ arg-name = type;
+ arg-optional;
+ max = NOLIMIT;
+ descrip = "emit make dependency file";
+
+#ifndef XML2AG
+ call-proc = config_dep;
+ settable;
+ no-preset;
+ doc = <<- _EOF_
+
+ This option behaves fairly closely to the way the @code{-M} series of
+ options work with the gcc compiler, except that instead of just
+ emitting the predecessor dependencies, this also emits the successor
+ dependencies (output target files). By default, the output dependency
+ information will be placed in @code{<base-name>.d}, but may also be
+ specified with @code{-MF<file>}. The time stamp on this file will be
+ manipulated so that it will be one second older than the oldest
+ primary output file.
+
+ The target in this dependency file will normally be the dependency
+ file name, but may also be overridden with @code{-MT<targ-name>}.
+ AutoGen will not alter the contents of that file, but it may create
+ it and it will adjust the modification time to match the start time.
+
+ @strong{NB:} these second letters are part of the option argument, so
+ @code{-MF <file>} must have the space character quoted or omitted, and
+ @code{-M "F <file>"} is acceptable because the @code{F} is part of the
+ option argument.
+
+ @code{-M} may be followed by any of the letters M, F, P, T, Q, D, or G.
+ However, only F, Q, T and P are meaningful. All but F have somewhat
+ different meanings. @code{-MT<name>} is interpreted as meaning
+ @code{<name>} is a sentinel file that will depend on all inputs
+ (templates and definition files) and all the output files will depend
+ on this sentinel file. It is suitable for use as a real make target.
+ Q is treated identically to T, except dollar characters ('$') are
+ doubled. P causes a special clean (clobber) phoney rule to be inserted
+ into the make file fragment. An empty rule is always created for
+ building the list of targets.
+
+ This is the recommended usage:
+ @example
+ -MFwhatever-you-like.dep -MTyour-sentinel-file -MP
+ @end example
+ and then in your @code{Makefile}, make the @file{autogen} rule:
+ @example
+ -include whatever-you-like.dep
+ clean_targets += clean-your-sentinel-file
+
+ your-sentinel-file:
+ autogen -MT$@@ -MF$*.d .....
+
+ local-clean :
+ rm -f $(clean_targets)
+ @end example
+
+ The modification time on the dependency file is adjusted to be one
+ second before the earliest time stamp of any other output file.
+ Consequently, it is suitable for use as the sentinel file testifying
+ to the fact the program was successfully run. (@code{-include} is
+ the GNU make way of specifying "include it if it exists". Your make
+ must support that feature or your bootstrap process must create the
+ file.)
+
+ All of this may also be specified using the @code{DEPENDENCIES_OUTPUT}
+ or @code{AUTOGEN_MAKE_DEP} environment variables. If defined,
+ dependency information will be output. If defined with white space
+ free text that is something other than @code{true}, @code{false},
+ @code{yes}, @code{no}, @code{0} or @code{1}, then the string is taken
+ to be an output file name. If it contains a string of white space
+ characters, the first token is as above and the second token is taken
+ to be the target (sentinel) file as @code{-MT} in the paragraphs
+ above. @code{DEPENDENCIES_OUTPUT} will be ignored if there are
+ multiple sequences of white space characters or if its contents are,
+ specifically, @code{false}, @code{no} or @code{0}.
+ _EOF_ ;
+#else
+ doc = "Pass-through AutoGen argument";
+#endif
+};
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Program Documentation
+ */
+#ifndef XML2AG
+option-doc-format = texi;
+
+explain =
+"AutoGen creates text files from templates using external definitions.";
+
+detail = <<- _EndOfDetail_
+ AutoGen is a tool designed for generating program files that contain
+ repetitive text with varied substitutions.
+ _EndOfDetail_;
+
+detail = <<- _EndOfDetail_
+ The definitions (@code{<def-file>}) can be specified with the
+ @code{definitions} option or as the command argument, but not both.
+ Omitting it or specifying @code{-} will result in reading definitions
+ from standard input.
+
+ The output file names are based on the template, but generally use the
+ base name of the definition file. If standard in is read for the
+ definitions, then @code{stdin} will be used for that base name. The
+ suffixes to the base name are gotten from the template. However, the
+ template file may specify the entire output file name. The generated
+ files are always created in the current directory. If you need to
+ place output in an alternate directory, @code{cd} to that directory and
+ use the @code{--templ_dirs} option to search the original directory.
+
+ @code{loop-limit} is used in debugging to stop runaway expansions.
+ _EndOfDetail_;
+
+doc-section = {
+ ds-type = DESCRIPTION;
+ ds-format = texi;
+ ds-text = <<- _END_MAN_DESCRIP
+ @code{AutoGen} is designed for generating program files that contain
+ repetitive text with varied substitutions. The goal is to simplify the
+ maintenance of programs that contain large amounts of repetitious text.
+ This is especially valuable if there are several blocks of such text
+ that must be kept synchronized.
+
+ One common example is the problem of maintaining the code required for
+ processing program options. Processing options requires a minimum of
+ four different constructs be kept in proper order in different places
+ in your program. You need at least: The flag character in the flag
+ string, code to process the flag when it is encountered, a global
+ state variable or two, and a line in the usage text.
+ You will need more things besides this if you choose to implement
+ long option names, configuration file processing, environment variables
+ and so on.
+
+ All of this can be done mechanically; with the proper templates
+ and this program.
+ _END_MAN_DESCRIP;
+};
+
+doc-section = {
+ ds-type = EXAMPLES;
+ ds-format = texi;
+ ds-text = <<- _EndOfMan_
+ Here is how the man page is produced:
+ @example
+ autogen -Tagman-cmd.tpl -MFman-dep -MTstamp-man opts.def
+ @end example
+
+ This command produced this man page from the AutoGen option definition
+ file. It overrides the template specified in @file{opts.def} (normally
+ @file{options.tpl}) and uses @file{agman-cmd.tpl}. It also sets the
+ make file dependency output to @file{man-dep} and the sentinel file
+ (time stamp file) to @file{man-stamp}. The base of the file name is
+ derived from the defined @code{prog-name}.
+
+ The texi invocation document is produced via:
+ @example
+ autogen -Tagtexi-cmd.tpl -MFtexi-dep -MTtexi-stamp opts.def
+ @end example
+ _EndOfMan_;
+};
+#endif /* XML2AG */
+
+/* end of opts.def */
diff --git a/agen5/opts.h b/agen5/opts.h
new file mode 100644
index 0000000..7365da1
--- /dev/null
+++ b/agen5/opts.h
@@ -0,0 +1,305 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (opts.h)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:31 AM by AutoGen 5.16.2pre7
+ * From the definitions opts.def
+ * and the template file options
+ *
+ * Generated from AutoOpts 36:5:11 templates.
+ *
+ * AutoOpts is a copyrighted work. This header file is not encumbered
+ * by AutoOpts licensing, but is provided under the licensing terms chosen
+ * by the autogen author or copyright holder. AutoOpts is
+ * licensed under the terms of the LGPL. The redistributable library
+ * (``libopts'') is licensed under the terms of either the LGPL or, at the
+ * users discretion, the BSD license. See the AutoOpts and/or libopts sources
+ * for details.
+ *
+ * The autogen program is copyrighted and licensed
+ * under the following terms:
+ *
+ * Copyright (C) 1992-2012 Bruce Korb, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the
+ * GNU General Public License, version 3 or later
+ * <http://gnu.org/licenses/gpl.html>
+ *
+ * autogen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * autogen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+/*
+ * This file contains the programmatic interface to the Automated
+ * Options generated for the autogen program.
+ * These macros are documented in the AutoGen info file in the
+ * "AutoOpts" chapter. Please refer to that doc for usage help.
+ */
+#ifndef AUTOOPTS_OPTS_H_GUARD
+#define AUTOOPTS_OPTS_H_GUARD 1
+#include "config.h"
+#include <autoopts/options.h>
+#include <stdarg.h>
+
+/*
+ * Ensure that the library used for compiling this generated header is at
+ * least as new as the version current when the header template was released
+ * (not counting patch version increments). Also ensure that the oldest
+ * tolerable version is at least as old as what was current when the header
+ * template was released.
+ */
+#define AO_TEMPLATE_VERSION 147461
+#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
+ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
+# error option template version mismatches autoopts/options.h header
+ Choke Me.
+#endif
+
+/*
+ * Enumeration of each option:
+ */
+typedef enum {
+ INDEX_OPT_TEMPL_DIRS = 1,
+ INDEX_OPT_OVERRIDE_TPL = 2,
+ INDEX_OPT_LIB_TEMPLATE = 3,
+ INDEX_OPT_DEFINITIONS = 4,
+ INDEX_OPT_LOAD_SCHEME = 5,
+ INDEX_OPT_LOAD_FUNCTIONS = 6,
+ INDEX_OPT_SHELL = 7,
+ INDEX_OPT_NO_FMEMOPEN = 8,
+ INDEX_OPT_EQUATE = 9,
+ INDEX_OPT_BASE_NAME = 11,
+ INDEX_OPT_SOURCE_TIME = 12,
+ INDEX_OPT_WRITABLE = 13,
+ INDEX_OPT_LOOP_LIMIT = 15,
+ INDEX_OPT_TIMEOUT = 16,
+ INDEX_OPT_TRACE = 17,
+ INDEX_OPT_TRACE_OUT = 18,
+ INDEX_OPT_SHOW_DEFS = 19,
+ INDEX_OPT_USED_DEFINES = 20,
+ INDEX_OPT_CORE = 21,
+ INDEX_OPT_SKIP_SUFFIX = 23,
+ INDEX_OPT_SELECT_SUFFIX = 24,
+ INDEX_OPT_DEFINE = 25,
+ INDEX_OPT_UNDEFINE = 26,
+ INDEX_OPT_MAKE_DEP = 28,
+ INDEX_OPT_RESET_OPTION = 29,
+ INDEX_OPT_VERSION = 30,
+ INDEX_OPT_HELP = 31,
+ INDEX_OPT_MORE_HELP = 32,
+ INDEX_OPT_USAGE = 33,
+ INDEX_OPT_SAVE_OPTS = 34,
+ INDEX_OPT_LOAD_OPTS = 35
+} teOptIndex;
+
+#define OPTION_CT 36
+#define AUTOGEN_VERSION "5.16.2"
+#define AUTOGEN_FULL_VERSION "autogen (GNU AutoGen) 5.16.2"
+
+/*
+ * Interface defines for all options. Replace "n" with the UPPER_CASED
+ * option name (as in the teOptIndex enumeration above).
+ * e.g. HAVE_OPT(INPUT_SELECT)
+ */
+#define DESC(n) (autogenOptions.pOptDesc[INDEX_OPT_## n])
+#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
+#define OPT_ARG(n) (DESC(n).optArg.argString)
+#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
+#define COUNT_OPT(n) (DESC(n).optOccCt)
+#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
+#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
+#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
+#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
+#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
+#define CLEAR_OPT(n) STMTS( \
+ DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
+ if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
+ DESC(n).fOptState |= OPTST_DISABLED; \
+ DESC(n).optCookie = NULL )
+
+/* * * * * *
+ *
+ * Enumeration of autogen exit codes
+ */
+typedef enum {
+ AUTOGEN_EXIT_SUCCESS = 0,
+ AUTOGEN_EXIT_OPTION_ERROR = 1,
+ AUTOGEN_EXIT_BAD_TEMPLATE = 2,
+ AUTOGEN_EXIT_BAD_DEFINITIONS = 3,
+ AUTOGEN_EXIT_LOAD_ERROR = 4,
+ AUTOGEN_EXIT_SIGNAL = 5,
+ AUTOGEN_EXIT_NO_CONFIG_INPUT = 66,
+ AUTOGEN_EXIT_LIBOPTS_FAILURE = 70
+} autogen_exit_code_t;
+/* * * * * *
+ *
+ * Interface defines for specific options.
+ */
+#define VALUE_OPT_TEMPL_DIRS 'L'
+
+#define SET_OPT_TEMPL_DIRS(a) STMTS( \
+ DESC(TEMPL_DIRS).optActualIndex = 1; \
+ DESC(TEMPL_DIRS).optActualValue = VALUE_OPT_TEMPL_DIRS; \
+ DESC(TEMPL_DIRS).fOptState &= OPTST_PERSISTENT_MASK; \
+ DESC(TEMPL_DIRS).fOptState |= OPTST_SET; \
+ DESC(TEMPL_DIRS).optArg.argString = (a); \
+ (*(DESC(TEMPL_DIRS).pOptProc))(&autogenOptions, \
+ autogenOptions.pOptDesc + 1); )
+#define VALUE_OPT_OVERRIDE_TPL 'T'
+#define VALUE_OPT_LIB_TEMPLATE 'l'
+#define VALUE_OPT_DEFINITIONS 4
+
+#define SET_OPT_DEFINITIONS(a) STMTS( \
+ DESC(DEFINITIONS).optActualIndex = 4; \
+ DESC(DEFINITIONS).optActualValue = VALUE_OPT_DEFINITIONS; \
+ DESC(DEFINITIONS).fOptState &= OPTST_PERSISTENT_MASK; \
+ DESC(DEFINITIONS).fOptState |= OPTST_SET; \
+ DESC(DEFINITIONS).optArg.argString = (a) )
+#define DISABLE_OPT_DEFINITIONS STMTS( \
+ DESC(DEFINITIONS).fOptState &= OPTST_PERSISTENT_MASK; \
+ DESC(DEFINITIONS).fOptState |= OPTST_SET | OPTST_DISABLED; \
+ DESC(DEFINITIONS).optArg.argString = NULL )
+#define VALUE_OPT_LOAD_SCHEME 'S'
+
+#define SET_OPT_LOAD_SCHEME(a) STMTS( \
+ DESC(LOAD_SCHEME).optActualIndex = 5; \
+ DESC(LOAD_SCHEME).optActualValue = VALUE_OPT_LOAD_SCHEME; \
+ DESC(LOAD_SCHEME).fOptState &= OPTST_PERSISTENT_MASK; \
+ DESC(LOAD_SCHEME).fOptState |= OPTST_SET; \
+ DESC(LOAD_SCHEME).optArg.argString = (a); \
+ (*(DESC(LOAD_SCHEME).pOptProc))(&autogenOptions, \
+ autogenOptions.pOptDesc + 5); )
+#define VALUE_OPT_LOAD_FUNCTIONS 'F'
+#define VALUE_OPT_SHELL 7
+#define VALUE_OPT_NO_FMEMOPEN 'm'
+#define VALUE_OPT_EQUATE 9
+#define VALUE_OPT_BASE_NAME 'b'
+#define VALUE_OPT_SOURCE_TIME 12
+#define VALUE_OPT_WRITABLE 13
+
+#define SET_OPT_WRITABLE STMTS( \
+ DESC(WRITABLE).optActualIndex = 13; \
+ DESC(WRITABLE).optActualValue = VALUE_OPT_WRITABLE; \
+ DESC(WRITABLE).fOptState &= OPTST_PERSISTENT_MASK; \
+ DESC(WRITABLE).fOptState |= OPTST_SET )
+#define DISABLE_OPT_WRITABLE STMTS( \
+ DESC(WRITABLE).fOptState &= OPTST_PERSISTENT_MASK; \
+ DESC(WRITABLE).fOptState |= OPTST_SET | OPTST_DISABLED; \
+ DESC(WRITABLE).optArg.argString = NULL )
+#define VALUE_OPT_LOOP_LIMIT 15
+
+#define OPT_VALUE_LOOP_LIMIT (DESC(LOOP_LIMIT).optArg.argInt)
+#define VALUE_OPT_TIMEOUT 't'
+#ifdef SHELL_ENABLED
+#define OPT_VALUE_TIMEOUT (DESC(TIMEOUT).optArg.argInt)
+#endif /* SHELL_ENABLED */
+#define VALUE_OPT_TRACE 17
+
+typedef enum {
+ TRACE_NOTHING, TRACE_DEBUG_MESSAGE, TRACE_SERVER_SHELL,
+ TRACE_TEMPLATES, TRACE_BLOCK_MACROS, TRACE_EXPRESSIONS,
+ TRACE_EVERYTHING
+} te_Trace;
+#define OPT_TRACE_VAL2STR(_v) optionKeywordName(&DESC(TRACE), (_v))
+#define OPT_VALUE_TRACE (DESC(TRACE).optArg.argEnum)
+#define VALUE_OPT_TRACE_OUT 18
+#define VALUE_OPT_SHOW_DEFS 19
+#define VALUE_OPT_USED_DEFINES 20
+#define VALUE_OPT_CORE 'C'
+#define VALUE_OPT_SKIP_SUFFIX 's'
+#define VALUE_OPT_SELECT_SUFFIX 'o'
+#define VALUE_OPT_DEFINE 'D'
+
+#define SET_OPT_DEFINE(a) STMTS( \
+ DESC(DEFINE).optActualIndex = 25; \
+ DESC(DEFINE).optActualValue = VALUE_OPT_DEFINE; \
+ DESC(DEFINE).fOptState &= OPTST_PERSISTENT_MASK; \
+ DESC(DEFINE).fOptState |= OPTST_SET; \
+ DESC(DEFINE).optArg.argString = (a); \
+ (*(DESC(DEFINE).pOptProc))(&autogenOptions, \
+ autogenOptions.pOptDesc + 25); )
+#define VALUE_OPT_UNDEFINE 'U'
+
+#define SET_OPT_UNDEFINE(a) STMTS( \
+ DESC(DEFINE).optActualIndex = 26; \
+ DESC(DEFINE).optActualValue = VALUE_OPT_UNDEFINE; \
+ DESC(DEFINE).fOptState &= OPTST_PERSISTENT_MASK; \
+ DESC(DEFINE).fOptState |= OPTST_SET | OPTST_EQUIVALENCE; \
+ DESC(DEFINE).optArg.argString = (a); \
+ (*(DESC(UNDEFINE).pOptProc))(&autogenOptions, \
+ autogenOptions.pOptDesc + INDEX_OPT_DEFINE); )
+#define VALUE_OPT_MAKE_DEP 'M'
+
+#define SET_OPT_MAKE_DEP(a) STMTS( \
+ DESC(MAKE_DEP).optActualIndex = 28; \
+ DESC(MAKE_DEP).optActualValue = VALUE_OPT_MAKE_DEP; \
+ DESC(MAKE_DEP).fOptState &= OPTST_PERSISTENT_MASK; \
+ DESC(MAKE_DEP).fOptState |= OPTST_SET; \
+ DESC(MAKE_DEP).optArg.argString = (a); \
+ (*(DESC(MAKE_DEP).pOptProc))(&autogenOptions, \
+ autogenOptions.pOptDesc + 28); )
+#define VALUE_OPT_HELP '?'
+#define VALUE_OPT_MORE_HELP '!'
+#define VALUE_OPT_RESET_OPTION 'R'
+#define VALUE_OPT_VERSION 'v'
+#define VALUE_OPT_USAGE 'u'
+#define VALUE_OPT_SAVE_OPTS '>'
+#define VALUE_OPT_LOAD_OPTS '<'
+#define SET_OPT_SAVE_OPTS(a) STMTS( \
+ DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
+ DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
+ DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
+/*
+ * Interface defines not associated with particular options
+ */
+#define ERRSKIP_OPTERR STMTS(autogenOptions.fOptSet &= ~OPTPROC_ERRSTOP)
+#define ERRSTOP_OPTERR STMTS(autogenOptions.fOptSet |= OPTPROC_ERRSTOP)
+#define RESTART_OPT(n) STMTS( \
+ autogenOptions.curOptIdx = (n); \
+ autogenOptions.pzCurOpt = NULL)
+#define START_OPT RESTART_OPT(1)
+#define USAGE(c) (*autogenOptions.pUsageProc)(&autogenOptions, c)
+/* extracted from opthead.tlib near line 484 */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * global exported definitions
+ */
+extern char const * tpl_fname;
+extern bool trace_is_to_pipe;
+
+extern void vusage_message(char const * fmt, va_list ap);
+extern void usage_message(char const * fmt, ...);
+
+
+/* * * * * *
+ *
+ * Declare the autogen option descriptor.
+ */
+extern tOptions autogenOptions;
+# define OPT_NO_XLAT_CFG_NAMES
+# define OPT_NO_XLAT_OPT_NAMES
+
+# define OPT_XLAT_CFG_NAMES
+# define OPT_XLAT_OPT_NAMES
+
+# ifndef _
+# define _(_s) _s
+# endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* AUTOOPTS_OPTS_H_GUARD */
+/* opts.h ends here */
diff --git a/agen5/proto.h b/agen5/proto.h
new file mode 100644
index 0000000..2423ec3
--- /dev/null
+++ b/agen5/proto.h
@@ -0,0 +1,300 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * Prototypes for agen5
+ * Generated Sat Aug 11 09:41:33 PDT 2012
+ */
+#ifndef AGEN5_PROTO_H_GUARD
+#define AGEN5_PROTO_H_GUARD 1
+
+#ifndef LOCAL
+# define LOCAL extern
+# define REDEF_LOCAL 1
+#else
+# undef REDEF_LOCAL
+#endif
+/*
+ * Extracted from agCgi.c
+ */
+LOCAL void
+loadCgi(void);
+
+/*
+ * Extracted from agDep.c
+ */
+LOCAL void
+add_source_file(char const * pz);
+
+LOCAL void
+rm_source_file(char const * pz);
+
+LOCAL void
+add_target_file(char const * pz);
+
+LOCAL void
+rm_target_file(char const * pz);
+
+LOCAL void
+start_dep_file(void);
+
+LOCAL void
+wrap_up_depends(void);
+
+/*
+ * Extracted from agInit.c
+ */
+LOCAL void
+initialize(int arg_ct, char** arg_vec);
+
+LOCAL void
+config_dep(tOptions * opts, tOptDesc * od);
+
+/*
+ * Extracted from agShell.c
+ */
+LOCAL void
+close_server_shell(void);
+
+LOCAL char *
+shell_cmd(char const * cmd);
+
+/*
+ * Extracted from agUtils.c
+ */
+LOCAL char *
+aprf(char const * pzFmt, ...);
+
+LOCAL void
+open_trace_file(char ** av, tOptDesc * odsc);
+
+LOCAL void
+check_make_dep_env(void);
+
+LOCAL void
+process_ag_opts(int arg_ct, char ** arg_vec);
+
+LOCAL char const *
+get_define_str(char const * de_name, bool check_env);
+
+LOCAL char *
+span_quote(char * in_q);
+
+LOCAL char const *
+skip_scheme(char const * scan, char const * end);
+
+LOCAL int
+count_nl(char const * pz);
+
+LOCAL char const *
+skip_expr(char const * pzSrc, size_t len);
+
+/*
+ * Extracted from autogen.c
+ */
+LOCAL void
+ag_abend_at(char const * pzMsg
+#ifdef DEBUG_ENABLED
+ , char const * pzFile, int line
+#endif
+ );
+
+LOCAL void *
+ao_malloc (size_t sz);
+
+LOCAL void *
+ao_realloc (void *p, size_t sz);
+
+LOCAL char *
+ao_strdup (char const * str);
+
+/*
+ * Extracted from defDirect.c
+ */
+LOCAL char*
+processDirective(char* pzScan);
+
+/*
+ * Extracted from defFind.c
+ */
+LOCAL int
+canonical_name(char * pzD, char const * pzS, int srcLen);
+
+LOCAL def_ent_t *
+find_def_ent(char * name, bool * indexed);
+
+LOCAL void
+print_used_defines(void);
+
+LOCAL def_ent_t **
+find_def_ent_list(char * name);
+
+/*
+ * Extracted from defLex.c
+ */
+LOCAL te_dp_event
+yylex(void);
+
+LOCAL void
+yyerror(char* s);
+
+/*
+ * Extracted from defLoad.c
+ */
+LOCAL def_ent_t *
+new_def_ent(void);
+
+LOCAL void
+print_ent(def_ent_t * pDef);
+
+LOCAL def_ent_t *
+number_and_insert_ent(char * name, char const * idx_str);
+
+LOCAL void
+read_defs(void);
+
+LOCAL void
+unload_defs(void);
+
+/*
+ * Extracted from expGuile.c
+ */
+LOCAL teGuileType
+ag_scm_type_e(SCM typ);
+
+LOCAL SCM
+ag_scm_c_eval_string_from_file_line(
+ char const * pzExpr, char const * pzFile, int line);
+
+/*
+ * Extracted from expOutput.c
+ */
+LOCAL void
+make_readonly(void);
+
+LOCAL void
+open_output_file(char const * fname, size_t nmsz, char const * mode, int flags);
+
+/*
+ * Extracted from expPrint.c
+ */
+LOCAL SCM
+run_printf(char const * pzFmt, int len, SCM alist);
+
+/*
+ * Extracted from expString.c
+ */
+LOCAL void
+do_multi_subs(char ** ppzStr, ssize_t * pStrLen, SCM match, SCM repl);
+
+/*
+ * Extracted from funcDef.c
+ */
+LOCAL void
+parse_mac_args(templ_t * pT, macro_t * mac);
+
+/*
+ * Extracted from funcEval.c
+ */
+LOCAL char const *
+scm2display(SCM s);
+
+LOCAL char const *
+eval_mac_expr(bool * allocated);
+
+LOCAL SCM
+eval(char const * expr);
+
+/*
+ * Extracted from funcFor.c
+ */
+LOCAL for_state_t *
+new_for_context(void);
+
+LOCAL void
+free_for_context(bool everything);
+
+/*
+ * Extracted from functions.c
+ */
+LOCAL loop_jmp_type_t
+call_gen_block(jmp_buf jbuf, templ_t * tpl, macro_t * mac, macro_t * end_mac);
+
+LOCAL void
+gen_new_block(templ_t * tpl);
+
+LOCAL macro_t *
+mLoad_Leave(templ_t * tpl, macro_t * mac, char const ** p_scan);
+
+/*
+ * Extracted from loadPseudo.c
+ */
+LOCAL char const *
+do_suffix(char const * const pzData, char const * pzFileName, int lineNo);
+
+LOCAL char const *
+loadPseudoMacro(char const * pzData, char const * pzFileName);
+
+/*
+ * Extracted from scmStrings.c
+ */
+LOCAL void
+ag_scribble_init(void);
+
+LOCAL void
+ag_scribble_deinit(void);
+
+LOCAL void
+ag_scribble_free(void);
+
+LOCAL char *
+ag_scribble(ssize_t size);
+
+LOCAL char *
+ag_scm2zchars(SCM s, const char * type);
+
+/*
+ * Extracted from tpLoad.c
+ */
+LOCAL templ_t *
+find_tpl(char const * pzTemplName);
+
+LOCAL tSuccess
+find_file(char const * in_name,
+ char * res_name,
+ char const * const * sfx_list,
+ char const * referring_tpl);
+
+LOCAL templ_t *
+tpl_load(char const * fname, char const * referrer);
+
+LOCAL void
+tpl_unload(templ_t * tpl);
+
+LOCAL void
+cleanup(templ_t * tpl);
+
+/*
+ * Extracted from tpParse.c
+ */
+LOCAL macro_t *
+parse_tpl(macro_t * mac, char const ** p_scan);
+
+/*
+ * Extracted from tpProcess.c
+ */
+LOCAL void
+gen_block(templ_t * tpl, macro_t * mac, macro_t * emac);
+
+LOCAL out_spec_t *
+next_out_spec(out_spec_t * os);
+
+LOCAL void
+process_tpl(templ_t * tpl);
+
+LOCAL void
+out_close(bool purge);
+
+#ifdef REDEF_LOCAL
+# undef LOCAL
+# define LOCAL
+#endif
+#endif /* AGEN5_PROTO_H_GUARD */
diff --git a/agen5/pseudo-fsm.h b/agen5/pseudo-fsm.h
new file mode 100644
index 0000000..338022f
--- /dev/null
+++ b/agen5/pseudo-fsm.h
@@ -0,0 +1,227 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (pseudo-fsm.h)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:36 AM by AutoGen 5.16.2pre7
+ * From the definitions pseudo.def
+ * and the template file fsm
+ *
+ * Automated Finite State Machine
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name ``Bruce Korb'' nor the name of any other
+ * contributor may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * AutoFSM IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bruce Korb OR ANY OTHER CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * This file enumerates the states and transition events for a FSM.
+ *
+ * te_pm_state
+ * The available states. FSS_INIT is always defined to be zero
+ * and FSS_INVALID and FSS_DONE are always made the last entries.
+ *
+ * te_pm_event
+ * The transition events. These enumerate the event values used
+ * to select the next state from the current state.
+ * PM_EV_INVALID is always defined at the end.
+ */
+#ifndef AUTOFSM_PSEUDO_FSM_H_GUARD
+#define AUTOFSM_PSEUDO_FSM_H_GUARD 1
+
+/*
+ * Finite State machine States
+ *
+ * Count of non-terminal states. The generated states INVALID and DONE
+ * are terminal, but INIT is not :-).
+ */
+#define PM_STATE_CT 5
+typedef enum {
+ PM_ST_INIT, PM_ST_ST_MARK, PM_ST_AGEN, PM_ST_TEMPL,
+ PM_ST_END_MARK, PM_ST_INVALID, PM_ST_DONE
+} te_pm_state;
+
+/*
+ * Finite State machine transition Events.
+ *
+ * Count of the valid transition events
+ */
+#define PM_EVENT_CT 7
+typedef enum {
+ PM_EV_ED_MODE, PM_EV_MARKER, PM_EV_END_PSEUDO, PM_EV_AUTOGEN,
+ PM_EV_TEMPLATE, PM_EV_SUFFIX, PM_EV_SCHEME, PM_EV_INVALID
+} te_pm_event;
+
+/*
+ * Enumeration of the valid transition types
+ * Some transition types may be common to several transitions.
+ */
+typedef enum {
+ PM_TR_INIT_MARKER,
+ PM_TR_INVALID,
+ PM_TR_NOOP,
+ PM_TR_SKIP_ED_MODE,
+ PM_TR_TEMPL_MARKER,
+ PM_TR_TEMPL_SCHEME,
+ PM_TR_TEMPL_SUFFIX
+} te_pm_trans;
+#define PM_TRANSITION_CT 7
+
+/**
+ * State transition handling map. Map the state enumeration and the event
+ * enumeration to the new state and the transition enumeration code (in that
+ * order). It is indexed by first the current state and then the event code.
+ */
+typedef struct pm_transition t_pm_transition;
+struct pm_transition {
+ te_pm_state next_state;
+ te_pm_trans transition;
+};
+
+#ifndef DEFINE_FSM
+extern const t_pm_transition pm_trans_table[ PM_STATE_CT ][ PM_EVENT_CT ];
+
+extern int
+pm_invalid_transition( te_pm_state st, te_pm_event evt );
+#else
+const t_pm_transition
+pm_trans_table[ PM_STATE_CT ][ PM_EVENT_CT ] = {
+
+ /* STATE 0: PM_ST_INIT */
+ { { PM_ST_INIT, PM_TR_SKIP_ED_MODE }, /* EVT: -*- */
+ { PM_ST_ST_MARK, PM_TR_INIT_MARKER }, /* EVT: MARKER */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: END_PSEUDO */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: AUTOGEN */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: TEMPLATE */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: SUFFIX */
+ { PM_ST_INVALID, PM_TR_INVALID } /* EVT: SCHEME */
+ },
+
+
+ /* STATE 1: PM_ST_ST_MARK */
+ { { PM_ST_ST_MARK, PM_TR_SKIP_ED_MODE }, /* EVT: -*- */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: MARKER */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: END_PSEUDO */
+ { PM_ST_AGEN, PM_TR_NOOP }, /* EVT: AUTOGEN */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: TEMPLATE */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: SUFFIX */
+ { PM_ST_INVALID, PM_TR_INVALID } /* EVT: SCHEME */
+ },
+
+
+ /* STATE 2: PM_ST_AGEN */
+ { { PM_ST_AGEN, PM_TR_SKIP_ED_MODE }, /* EVT: -*- */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: MARKER */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: END_PSEUDO */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: AUTOGEN */
+ { PM_ST_TEMPL, PM_TR_NOOP }, /* EVT: TEMPLATE */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: SUFFIX */
+ { PM_ST_INVALID, PM_TR_INVALID } /* EVT: SCHEME */
+ },
+
+
+ /* STATE 3: PM_ST_TEMPL */
+ { { PM_ST_TEMPL, PM_TR_SKIP_ED_MODE }, /* EVT: -*- */
+ { PM_ST_END_MARK, PM_TR_TEMPL_MARKER }, /* EVT: MARKER */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: END_PSEUDO */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: AUTOGEN */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: TEMPLATE */
+ { PM_ST_TEMPL, PM_TR_TEMPL_SUFFIX }, /* EVT: SUFFIX */
+ { PM_ST_TEMPL, PM_TR_TEMPL_SCHEME } /* EVT: SCHEME */
+ },
+
+
+ /* STATE 4: PM_ST_END_MARK */
+ { { PM_ST_END_MARK, PM_TR_INVALID }, /* EVT: -*- */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: MARKER */
+ { PM_ST_DONE, PM_TR_NOOP }, /* EVT: END_PSEUDO */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: AUTOGEN */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: TEMPLATE */
+ { PM_ST_INVALID, PM_TR_INVALID }, /* EVT: SUFFIX */
+ { PM_ST_INVALID, PM_TR_INVALID } /* EVT: SCHEME */
+ }
+};
+#define PmFsmErr_off 19
+#define PmEvInvalid_off 75
+#define PmStInit_off 83
+
+
+static char const zPmStrings[169] =
+/* 0 */ "** OUT-OF-RANGE **\0"
+/* 19 */ "FSM Error: in state %d (%s), event %d (%s) is invalid\n\0"
+/* 75 */ "invalid\0"
+/* 83 */ "init\0"
+/* 88 */ "st_mark\0"
+/* 96 */ "agen\0"
+/* 101 */ "templ\0"
+/* 107 */ "end_mark\0"
+/* 116 */ "-*-\0"
+/* 120 */ "marker\0"
+/* 127 */ "end_pseudo\0"
+/* 138 */ "autogen\0"
+/* 146 */ "template\0"
+/* 155 */ "suffix\0"
+/* 162 */ "scheme";
+
+static const size_t aszPmStates[5] = {
+ 83, 88, 96, 101, 107 };
+
+static const size_t aszPmEvents[8] = {
+ 116, 120, 127, 138, 146, 155, 162, 75 };
+
+
+#define PM_EVT_NAME(t) ( (((unsigned)(t)) >= 8) \
+ ? zPmStrings : zPmStrings + aszPmEvents[t])
+
+#define PM_STATE_NAME(s) ( (((unsigned)(s)) >= 5) \
+ ? zPmStrings : zPmStrings + aszPmStates[s])
+
+#ifndef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
+static int pm_invalid_transition( te_pm_state st, te_pm_event evt );
+
+/* * * * * * * * * THE CODE STARTS HERE * * * * * * * *
+ *
+ * Print out an invalid transition message and return EXIT_FAILURE
+ */
+static int
+pm_invalid_transition( te_pm_state st, te_pm_event evt )
+{
+ /* START == INVALID TRANS MSG == DO NOT CHANGE THIS COMMENT */
+ char const * fmt = zPmStrings + PmFsmErr_off;
+ fprintf( stderr, fmt, st, PM_STATE_NAME(st), evt, PM_EVT_NAME(evt));
+ /* END == INVALID TRANS MSG == DO NOT CHANGE THIS COMMENT */
+
+ return EXIT_FAILURE;
+}
+
+#endif /* DEFINE_FSM */
+
+#endif /* AUTOFSM_PSEUDO_FSM_H_GUARD */
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of pseudo-fsm.h */
diff --git a/agen5/pseudo.def b/agen5/pseudo.def
new file mode 100644
index 0000000..8051e64
--- /dev/null
+++ b/agen5/pseudo.def
@@ -0,0 +1,69 @@
+/* -*- Mode: C -*- */
+
+/**
+ * \file pseudo.def
+ *
+ * Time-stamp: "2010-07-03 09:51:09 bkorb"
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * This defines the finite state transition table for parsing the
+ * pseudo-macro at the head of every template
+ */
+AutoGen Definitions fsm;
+
+/* "method" is not defined -- produce a header only */
+
+prefix = pm;
+
+event = ed_mode; /* the -*- mode marker */
+event = marker; /* a start or end macro mark */
+event = end_pseudo; /* newline found in end_mark state */
+
+event = "autogen"; /* "autogen" */
+event = template; /* "template" */
+event = suffix; /* a string other than the above */
+event = scheme; /* a scheme expression to process */
+
+state = st_mark; /* start marker processed */
+state = agen; /* "autogen5" processed */
+state = templ; /* "template" processed */
+state = end_mark; /* end marker processed */
+
+ed-mode = '-*-';
+
+/*
+ * No-op transition. Applies to all states and does not change state.
+ */
+transition = { tst = '*'; tev = ed_mode; ttype = skip_ed_mode; };
+/*
+ * Disable the ed_mode transition in the end_mark state tho
+ */
+transition = { tst = end_mark; tev = ed_mode; ttype = invalid; };
+
+/*
+ * Meaningful transitions
+ */
+transition = { tst = init; tev = marker; next = st_mark; };
+transition = { tst = st_mark; tev = "autogen"; next = agen; ttype = noop; };
+transition = { tst = agen; tev = template; next = templ; ttype = noop; };
+transition = { tst = templ; tev = suffix; };
+transition = { tst = templ; tev = scheme; };
+transition = { tst = templ; tev = marker; next = end_mark; };
+transition = { tst = end_mark; tev = end_pseudo; next = done; ttype = noop; };
+
+/* end of agen5/pseudo.def */
diff --git a/agen5/schemedef.scm b/agen5/schemedef.scm
new file mode 100644
index 0000000..f87f04b
--- /dev/null
+++ b/agen5/schemedef.scm
@@ -0,0 +1,388 @@
+
+;;; Time-stamp: "2012-04-14 08:39:41 bkorb"
+;;;
+;;; This file is part of AutoGen.
+;;; AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+;;;
+;;; AutoGen is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by the
+;;; Free Software Foundation, either version 3 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; AutoGen is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+;;; See the GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License along
+;;; with this program. If not, see <http://www.gnu.org/licenses/>.
+;;;
+;;; This module defines all the scheme initialization for AutoGen.
+;;; It gets sucked up into directives.h as a single ANSI-C string.
+;;; Comments, blank lines and leading white space are omitted.
+;;;
+;;; The contents of this file get converted to a C language static string
+;;; and is then fed to the guile library at start up time.
+;;; Blank lines, commends, leading and trailing white space and spaces
+;;; before closing parentheses are all stripped.
+;;;
+(use-modules (ice-9 common-list))
+
+(define identifier?
+ (lambda (x) (or (string? x) (symbol? x))))
+
+(define normalize-identifier
+ (lambda (x)
+ (if (string? x) (string->symbol x) x)))
+
+(define coerce->string
+ (lambda (x)
+ (let ((char->string (lambda (x) (make-string 1 x)))
+ (coercable? (lambda (x)
+ (or (string? x) (boolean? x) (char? x)
+ (symbol? x) (list? x) (number? x)) )) )
+
+ (if (not (coercable? x))
+ (error "Wrong type to coerce->string" x))
+
+ (cond
+ ((string? x) (string-append
+ (char->string #\") x (char->string #\") ))
+
+ ; Probably not what was wanted, but fun
+ ((boolean? x) (if x "#t" "#f"))
+ ((char? x) (char->string x))
+ ((number? x) (number->string x))
+ ((symbol? x) (symbol->string x))
+ ((list? x) (if (every coercable? x)
+ (apply string-append (map coerce->string x)) ))
+) ) ) )
+
+
+;;; alist->autogen-def:
+;;; take a scheme alist of values, and create autogen assignments.
+;;; recursive alists are handled. Using a bare list as a value to be
+;;; assigned is not a terribly good idea, though it should work if it
+;;; doesn't look too much like an alist The returned string doesn't
+;;; contain opening and closing brackets.
+
+(define alist->autogen-def
+ (lambda (lst . recursive)
+ (if (null? recursive) (set! recursive #f)
+ (set! recursive #t))
+ (let ((res (if recursive "{\n" ""))
+ (list-nnul? (lambda (x) (and (list? x) (not (null? x))))))
+ (do ((i lst (cdr i)))
+ ((null? i) (if recursive
+ (string-append res "}")
+ res))
+ (let* ((kvpair (car i))
+ (value (cdr kvpair))
+ (value-is-alist (if (and (list-nnul? value)
+ (list-nnul? (car value))
+ (list-nnul? (caar value))
+ (identifier? (caaar value)))
+ #t #f)))
+ (set! res (string-append res
+ (coerce->string (normalize-identifier (car kvpair)))
+ " = "
+ (if value-is-alist
+ (alist->autogen-def (car value) 1)
+ (coerce->string (cdr kvpair)))
+ ";\n"
+) ) ) ) ) ) )
+
+(define shell-cleanup "")
+(define add-cleanup (lambda (t)
+ (set! shell-cleanup (string-append shell-cleanup "\n" t "\n")) ))
+(define tmp-dir "")
+
+(define header-file "")
+(define header-guard "")
+(define autogen-version "AUTOGEN_VERSION")
+(define c-file-line-fmt "#line %2$d \"%1$s\"\n")
+
+(define-macro (defined-as predicate symbol)
+ `(and (defined? ',symbol) (,predicate ,symbol)))
+
+;;; /*=gfunc html_escape_encode
+;;; *
+;;; * what: encode html special characters
+;;; * general-use:
+;;; *
+;;; * exparg: str , string to make substitutions in
+;;; *
+;;; * doc: This function will replace replace the characters @code{'&'},
+;;; * @code{'<'} and @code{'>'} characters with the HTML/XML
+;;; * escape-encoded strings (@code{"&amp;"}, @code{"&lt;"}, and
+;;; * @code{"&gt;"}, respectively).
+;;; =*/
+;;;
+(define html-escape-encode (lambda (str)
+ (string-substitute str
+ '("&" "<" ">")
+ '("&amp;" "&lt;" "&gt;") ) ))
+
+(define stt-table (make-hash-table 31))
+(define stt-curr stt-table)
+(define stt-idx-tbl stt-table)
+(define stt-idx 0)
+
+;;; /*=gfunc string_table_new
+;;; *
+;;; * what: create a string table
+;;; * general-use:
+;;; *
+;;; * exparg: st-name , the name of the array of characters
+;;; *
+;;; * doc:
+;;; * This function will create an array of characters. The companion
+;;; * functions, (@xref{SCM string-table-add},
+;;; * @xref{SCM string-table-add-ref}, and
+;;; * @pxref{SCM emit-string-table}) will insert text and emit the
+;;; * populated table.
+;;; *
+;;; * With these functions, it should be much easier to construct
+;;; * structures containing string offsets instead of string pointers.
+;;; * That can be very useful when transmitting, storing or sharing data
+;;; * with different address spaces.
+;;; *
+;;; * @noindent
+;;; * Here is a brief example copied from the strtable.test test:
+;;; *
+;;; * @example
+;;; * [+ (string-table-new "scribble")
+;;; * `' (out-push-new) ;; redirect output to temporary
+;;; * `' (define ct 1) +][+
+;;; *
+;;; * FOR str IN that was the week that was +][+
+;;; * `' (set! ct (+ ct 1))
+;;; * +]
+;;; * `' [+ (string-table-add-ref "scribble" (get "str")) +],[+
+;;; * ENDFOR +]
+;;; * [+ (out-suspend "main")
+;;; * `' (emit-string-table "scribble")
+;;; * `' (ag-fprintf 0 "\nchar const *ap[%d] = @{" ct)
+;;; * `' (out-resume "main")
+;;; * `' (out-pop #t) ;; now dump out the redirected output +]
+;;; * `' NULL @};
+;;; * @end example
+;;; *
+;;; * @noindent
+;;; * Some explanation:
+;;; *
+;;; * @noindent
+;;; * I added the @code{(out-push-new)} because the string table text is
+;;; * diverted into an output stream named, ``scribble'' and I want to
+;;; * have the string table emitted before the string table references.
+;;; * The string table references are also emitted inside the @code{FOR}
+;;; * loop. So, when the loop is done, the current output is suspended
+;;; * under the name, ``main'' and the ``scribble'' table is then emitted
+;;; * into the primary output. (@code{emit-string-table} inserts its
+;;; * output directly into the current output stream. It does not need to
+;;; * be the last function in an AutoGen macro block.) Next I
+;;; * @code{ag-fprintf} the array-of-pointer declaration directly into the
+;;; * current output. Finally I restore the ``main'' output stream and
+;;; * @code{(out-pop #t)}-it into the main output stream.
+;;; *
+;;; * Here is the result. Note that duplicate strings are not repeated
+;;; * in the string table:
+;;; *
+;;; * @example
+;;; * static char const scribble[18] =
+;;; * `' "that\0" "was\0" "the\0" "week\0";
+;;; *
+;;; * char const *ap[7] = @{
+;;; * `' scribble+0,
+;;; * `' scribble+5,
+;;; * `' scribble+9,
+;;; * `' scribble+13,
+;;; * `' scribble+0,
+;;; * `' scribble+5,
+;;; * `' NULL @};
+;;; * @end example
+;;; *
+;;; * These functions use the global name space @code{stt-*} in addition to
+;;; * the function names.
+;;; *
+;;; * If you utilize this in your programming, it is recommended that you
+;;; * prevent printf format usage warnings with the GCC option
+;;; * @code{-Wno-format-contains-nul}
+;;; =*/
+;;;
+(define string-table-new (lambda (st-name) (begin
+ (set! stt-curr (make-hash-table 31))
+ (hash-create-handle! stt-table st-name stt-curr)
+ (out-push-new)
+ (out-suspend st-name)
+ (set! stt-idx-tbl (make-hash-table 31))
+ (hash-create-handle! stt-curr "string-indexes" stt-idx-tbl)
+ (hash-create-handle! stt-curr "current-index" 0)
+ ""
+)))
+
+;;; /*=gfunc string_table_add
+;;; * general-use:
+;;; *
+;;; * what: Add an entry to a string table
+;;; *
+;;; * exparg: st-name , the name of the array of characters
+;;; * exparg: str-val , the (possibly) new value to add
+;;; *
+;;; * doc: Check for a duplicate string and, if none, then insert a new
+;;; * string into the string table. In all cases, returns the
+;;; * character index of the beginning of the string in the table.
+;;; *
+;;; * The returned index can be used in expressions like:
+;;; * @example
+;;; * string_array + <returned-value>
+;;; * @end example
+;;; * @noindent
+;;; * that will yield the address of the first byte of the inserted
+;;; * string. See the @file{strtable.test} AutoGen test for a usage
+;;; * example.
+;;; =*/
+;;;
+(define string-table-add (lambda (st-name str-val) (begin
+ (set! stt-curr (hash-ref stt-table st-name))
+ (set! stt-idx-tbl (hash-ref stt-curr "string-indexes"))
+ (set! stt-idx (hash-ref stt-idx-tbl str-val))
+ (if (not (number? stt-idx))
+ (begin
+ (set! stt-idx (hash-ref stt-curr "current-index"))
+ (ag-fprintf st-name "/* %5d */ %s \"\\0\"\n"
+ stt-idx (c-string str-val))
+ (hash-create-handle! stt-idx-tbl str-val stt-idx)
+ (hash-set! stt-curr "current-index"
+ (+ stt-idx (string-length str-val) 1) )
+ ) )
+ stt-idx
+)))
+
+;;; /*=gfunc string_table_add_ref
+;;; *
+;;; * what: Add an entry to a string table, get reference
+;;; * general-use:
+;;; *
+;;; * exparg: st-name , the name of the array of characters
+;;; * exparg: str-val , the (possibly) new value to add
+;;; *
+;;; * doc: Identical to string-table-add, except the value returned
+;;; * is the string "st-name" '+' and the index returned by
+;;; * string-table-add.
+;;; =*/
+;;;
+(define string-table-add-ref (lambda (st-name str-val)
+ (string-append st-name "+"
+ (number->string (string-table-add st-name str-val)) ) ))
+
+;;; /*=gfunc emit_string_table
+;;; *
+;;; * what: output a string table
+;;; *
+;;; * exparg: st-name , the name of the array of characters
+;;; *
+;;; * doc: Emit into the current output stream a
+;;; * @code{static char const} array named @code{st-name}
+;;; * that will have @code{NUL} bytes between each inserted string.
+;;; =*/
+;;;
+(define emit-string-table (lambda (st-name) (begin
+ (set! stt-curr (hash-ref stt-table st-name))
+ (set! stt-idx (hash-ref stt-curr "current-index"))
+ (ag-fprintf 0 "\nstatic char const %s[%d] =\n" st-name stt-idx)
+ (out-resume st-name)
+
+ ;; Columnize the output.
+ ;; Remove any leading spaces -- columns adds them itself.
+ ;; Glue the "\0" string to its preceding text.
+ ;; End the last line with a semi-colon
+ ;;
+ (emit (shell (string-append
+ "sed 's/^ / /
+ $s/\" \"\\\\0\"/\";/
+ s/\" \"\\\\0/\\\\0/
+ ' <<\\_EOF_\n"
+ (out-pop #t)
+ "_EOF_")))
+ (emit "\n")
+)))
+
+;;; /*=gfunc string_table_size
+;;; *
+;;; * what: print the current size of a string table
+;;; * general-use:
+;;; *
+;;; * exparg: st-name , the name of the array of characters
+;;; *
+;;; * doc: Returns the current byte count of the string table.
+;;; =*/
+;;;
+(define string-table-size (lambda (st-name)
+ (hash-ref (hash-ref stt-table st-name) "current-index") ))
+
+;;; /*=gfunc gperf_code
+;;; *
+;;; * what: emit the source of the generated gperf program
+;;; * general-use:
+;;; *
+;;; * exparg: st-name , the name of the gperf hash list
+;;; *
+;;; * doc:
+;;; * Returns the contents of the emitted code, suitable
+;;; * for inclusion in another program. The interface contains
+;;; * the following elements:
+;;; *
+;;; * @table @samp
+;;; * @item struct @i{<st-name>}_index
+;;; * containg the fields: @code{@{char const * name, int const id; @};}
+;;; *
+;;; * @item @i{<st-name>}_hash()
+;;; * This is the hashing function with local only scope (static).
+;;; *
+;;; * @item @i{<st-name>}_find()
+;;; * This is the searching and validation function. The first argument
+;;; * is the string to look up, the second is its length.
+;;; * It returns a pointer to the corresponding @code{@i{<st-name>}_index}
+;;; * entry.
+;;; * @end table
+;;; *
+;;; * Use this in your template as follows where "@i{<st-name>}" was
+;;; * set to be "@code{lookup}":
+;;; *
+;;; * @example
+;;; * [+ (make-gperf "lookup" (join "\n" (stack "name_list")))
+;;; * (gperf-code "lookup") +]
+;;; * void my_fun(char * str) @{
+;;; * struct lookup_index * li = lookup_find(str, strlen(str));
+;;; * if (li != NULL) printf("%s yields %d\n", str, li->idx);
+;;; * @end example
+;;; =*/
+;;;
+(define gperf-code (lambda (gp-name) (shellf
+ "sed -e '1,/^#line/d' \
+ -e '/#include/d' \
+ -e '/#line/d' \
+ -e '/^[ \t]*$/d' \
+ -e 's/^const struct /static const struct /' \
+ -e '/^int main(/,$d' ${gpdir}/%s.c"
+ gp-name
+)))
+
+;;; /*=gfunc stack_join
+;;; *
+;;; * what: stack values then join them
+;;; *
+;;; * exparg: join , string between each element
+;;; * exparg: ag-name , name of autogen values to stack
+;;; *
+;;; * doc: This function will collect all the values named @code{ag-name}
+;;; * (see the @pxref{SCM stack, stack function}) and join them
+;;; * separated by the @code{join} string (see the
+;;; * @pxref{SCM join, join function}).
+;;; =*/
+;;;
+(define stack-join (lambda (j-str ag-name)
+ (join j-str (stack ag-name))))
+
+;;; end of agen5/schemedef.scm
diff --git a/agen5/scmStrings.c b/agen5/scmStrings.c
new file mode 100644
index 0000000..1d9ac0b
--- /dev/null
+++ b/agen5/scmStrings.c
@@ -0,0 +1,203 @@
+
+/**
+ * @file scmStrings.c
+ *
+ * Temporary SCM strings.
+ *
+ * Time-stamp: "2012-08-11 08:29:47 bkorb"
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define ROUND_SCRIBBLE(_v, _sz) (((_v) + ((_sz) - 1)) & ~((_sz) - 1))
+
+typedef struct string_buf_s string_buf_t;
+
+struct string_buf_s {
+ string_buf_t * next_p;
+ ssize_t const sb_size;
+ ssize_t sb_off;
+ unsigned char sb_buf[1];
+};
+
+static string_buf_t * ag_strbufs = NULL;
+static string_buf_t ** next_strbuf = &ag_strbufs;
+static size_t const str_buf_hdr_sz =
+ (&(((string_buf_t *)NULL)->sb_buf[0])) - ((unsigned char *)NULL);
+
+/**
+ * Initialize the scribble string library
+ */
+LOCAL void
+ag_scribble_init(void)
+{
+ ag_strbufs = NULL;
+ next_strbuf = &ag_strbufs;
+}
+
+/**
+ * Free up the scribble strings memory pool.
+ */
+LOCAL void
+ag_scribble_deinit(void)
+{
+ string_buf_t* sb = ag_strbufs;
+ ag_scribble_init();
+
+ while (sb != NULL) {
+ string_buf_t* sb_next_p = sb->next_p;
+ free(sb);
+ sb = sb_next_p;
+ }
+}
+
+/**
+ * Free up the scribble strings used during the processing of one macro.
+ */
+LOCAL void
+ag_scribble_free(void)
+{
+ string_buf_t* sb = ag_strbufs;
+
+ while (sb != NULL) {
+ sb->sb_off = 0;
+ sb = sb->next_p;
+ }
+}
+
+/**
+ * allocate a new scribble block. Multiple of 8K bytes.
+ */
+static string_buf_t *
+new_scribble_block(size_t min_size)
+{
+ string_buf_t * res = NULL;
+
+ /*
+ * allow space for allocation header and round up
+ */
+ min_size += str_buf_hdr_sz;
+ min_size = ROUND_SCRIBBLE(min_size, 0x2000);
+
+ /*
+ * Allocate and link into list. Advance pointer to next entry.
+ */
+ *next_strbuf = res = AGALOC(min_size, "scribble buf");
+ next_strbuf = &(res->next_p);
+ res->next_p = NULL;
+ res->sb_off = 0;
+ /*
+ * The "sb_size" field is read-only. Override this.
+ */
+ {
+ size_t * psz = (void *)&(res->sb_size);
+ *psz = min_size - str_buf_hdr_sz;
+ }
+
+ return res;
+}
+
+/**
+ * Allocate a scribble string. It will be deallocated when a macro finishes.
+ * Therefore, *DO NOT* use these at the start of a block macro expecting
+ * the space to still be usable at the end of the block macro.
+ * These allocations are intended for temporary space needs that cannot
+ * be kept on the stack. Expression processing.
+ *
+ * @param size the number of bytes needed
+ * @return the memory as a pointer to character
+ */
+LOCAL char *
+ag_scribble(ssize_t size)
+{
+ string_buf_t* sb = ag_strbufs;
+ char* buf;
+
+ size += 1; // allow for NUL byte & round to word boundary
+ size = ROUND_SCRIBBLE(size, sizeof(void *));
+
+ for (;;) {
+ if (sb == NULL) {
+ sb = new_scribble_block(size);
+ break;
+ }
+
+ if ((sb->sb_size - sb->sb_off) >= size)
+ break;
+
+ sb = sb->next_p;
+ }
+
+ buf = (char*)(sb->sb_buf + sb->sb_off);
+ sb->sb_off += size;
+ return buf;
+}
+
+/**
+ * As of Guile 1.7.x, access to the NUL terminated string referenced by
+ * an SCM is no longer guaranteed. Therefore, we must extract the string
+ * into one of our "scribble" buffers.
+ *
+ * @param s the string to convert
+ * @param type a string describing the string
+ * @return a NUL terminated string, or it aborts.
+ */
+LOCAL char *
+ag_scm2zchars(SCM s, const char * type)
+{
+#if GUILE_VERSION < 107000 /* pre-Guile 1.7.x */
+
+ if (! AG_SCM_STRING_P(s))
+ AG_ABEND(aprf(NOT_STR_FMT, type));
+
+ if (SCM_SUBSTRP(s))
+ s = scm_makfromstr(SCM_CHARS(s), SCM_LENGTH(s), 0);
+ return SCM_CHARS(s);
+
+#else
+ size_t len;
+ char * buf;
+
+ if (! AG_SCM_STRING_P(s))
+ AG_ABEND(aprf(NOT_STR_FMT, type));
+
+ len = scm_c_string_length(s);
+ if (len == 0) {
+ static char z = NUL;
+ return &z;
+ }
+
+ buf = ag_scribble(len);
+
+ {
+ size_t buflen = scm_to_locale_stringbuf(s, buf, len);
+ if (buflen != len)
+ AG_ABEND(aprf(SCM2ZCHARS_BAD_VAL, buflen, len));
+ }
+
+ buf[len] = NUL;
+ return buf;
+#endif
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/scmStrings.c */
diff --git a/agen5/snarf.tpl b/agen5/snarf.tpl
new file mode 100644
index 0000000..e485628
--- /dev/null
+++ b/agen5/snarf.tpl
@@ -0,0 +1,316 @@
+[= AutoGen5 template -*- Mode: Text -*-
+
+# Time-stamp: "2011-01-31 14:16:48 bkorb"
+
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+
+(setenv "SHELL" "/bin/sh")
+
+ini =]
+[=#
+
+This template will emit the code necessary for registering callout routines
+for Guile/Scheme. The name of the output file will be ``basename.ini''
+where ``basename'' may be of your choosing.
+
+The following definitions are used:
+
+group A module prefix that preceeds the "scm_" prefix to all symbols
+init the name of the created initialization routine. This defaults
+ to "scm_init" or "group_init", if "group" is specified.
+ You must specify this for shared libraries.
+init-code code to put at the start of the init routine
+fini-code code to put at the end of the init routine
+
+gfunc this is a compound definition containing the following definitions
+ name the name of the function. The Scheme string name will normally be
+ derived from this name, but it may be over-ridden with the "string"
+ attribute. The transforming sed expression is:
+
+ sed -e's/_p$/?/;s/_x$/!/;s/_/-/g;s/-to-/->/'
+
+ string the Scheme name for the function, if not derivable from the name.
+ static If defined, then the function will not be exported.
+
+ exparg "EXPression ARGument" for each argument your routine handles,
+ you must specify one of these. This is a compound definition
+ with the following "attributes" that may be defined:
+
+ arg-name The name of the argument. required
+ arg-desc A very brief description of the argument. required
+ arg-optional Specify this if the argument is only optional
+ arg-list Specify this for the last argument if the last argument
+ may be an SCM list (i.e. an SCM-flavor of var args).
+
+syntax This defines a Guile syntax element. Read the Guile doc for
+ descriptions of the following attributes:
+ name the name of the C variable to hold the value
+ type
+ cfn
+ string the Scheme name for the syntax element, if not derivable.
+
+symbol This defines a Guile symbol.
+ name the name of the C variable to hold the value
+ init-val initial scm value for object
+ const-val initial integer value for object (signed long)
+ string the Scheme name for the symbol, if not derivable.
+
+If you are using a definitions file, these are defined in the normal
+way. If you are extracting them from `getdefs(1AG)' comments, then:
+
+1. `group' and `init' should be defined on the command line thus:
+ getdefs assign=group=XX assign=init=init_proc_name
+
+2. `init-code' and `fini-code' should be defined in a traditional
+ definitions file and be incorporated from a command line option:
+ getdefs copy=file-name.def
+
+3. `gfunc', `syntax', and `symbol' are getdefs' entry types.
+ The `name' attributes come from the getdefs entry name.
+ The remaining attributes are specified in the comment, per
+ the getdefs documentation.
+
+=][=
+
+(define ix 0)
+(define scm-prefix
+ (if (exist? "group")
+ (string-append (get "group") "_scm_")
+ "scm_" ))
+(out-push-new (string-append (base-name) ".h"))
+(dne " * " "/* ")=]
+ *
+ * copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
+[=(gpl "AutoGen" " * ")=]
+ *
+ * Guile Implementation Routines[=% group " - for the %s group" =]
+ */
+[=(make-header-guard "GUILE_PROCS")=]
+#if GUILE_VERSION >= 108000
+# include <libguile.h>
+#else
+# include <guile/gh.h>
+#endif
+
+typedef enum {
+ GH_TYPE_UNDEFINED = 0,
+ GH_TYPE_BOOLEAN,
+ GH_TYPE_SYMBOL,
+ GH_TYPE_CHAR,
+ GH_TYPE_VECTOR,
+ GH_TYPE_PAIR,
+ GH_TYPE_NUMBER,
+ GH_TYPE_STRING,
+ GH_TYPE_PROCEDURE,
+ GH_TYPE_LIST,
+ GH_TYPE_INEXACT,
+ GH_TYPE_EXACT
+} teGuileType;
+[=
+FOR gfunc =]
+extern SCM [= (string-append scm-prefix (get "name") "(") =][=
+ IF (exist? "exparg") =][=
+ FOR exparg ", " =]SCM[=
+ ENDFOR =][=
+ ELSE =]void[=
+ ENDIF =]);[=
+ENDFOR gfunc =][=
+
+FOR symbol =][=
+ IF (exist? "global") =]
+extern SCM [= (string-append scm-prefix "sym_" (get "name") ";") =][=
+ ENDIF =][=
+ENDFOR symbol =]
+
+#endif /* [=(. header-guard)=] */
+[=
+
+(out-pop)
+(dne " * " "/* ")
+
+=]
+ *
+ * copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
+[=
+(string-table-new "g_nm")
+
+(define add-to-g_nm (lambda ()
+ (string-table-add "g_nm"
+ (if (exist? "string")
+ (get "string")
+ (shellf
+ "echo '%s'|sed -e's/_p$/?/' -e's/_x$/!/' -e's/_/-/g' -e's/-to-/->/'"
+ (get "name") ) ) ) ))
+
+(gpl "AutoGen" " * ")=]
+ *
+ * Guile Initializations - [=% group (string-capitalize! "%s ")
+ =]Global Variables
+ */
+#include "[= (. header-file) =]"
+typedef SCM (*scm_callback_t)(void);
+void [=
+(define init-proc
+ (if (exist? "init")
+ (get "init")
+ (if (exist? "group")
+ (string-append (get "group") "_init")
+ "scm_init")))
+
+ init-proc =](void);
+[=
+
+ FOR symbol =][=
+ (sprintf "\n%s SCM %ssym_%-18s = SCM_BOOL_F;"
+ (if (exist? "global") "extern" "static")
+ scm-prefix (get "name") ) =][=
+ ENDFOR symbol
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */=][=
+
+IF (exist? "debug-enabled") =]
+#ifdef DEBUG_ENABLED[=
+
+ FOR gfunc
+
+=]
+static SCM
+agrelay_scm_[= (get "name") =]([=
+ IF (not (exist? "exparg")) =]void[=
+ (define pass-list "") =][=
+ ELSE =][=
+ (out-push-new) =][=
+ FOR exparg ", " =]SCM scm[= (for-index) =][= ENDFOR =][=
+ (define call-list (out-pop #t))
+ (define pass-list (shellf "echo '%s' | sed 's/SCM s/s/g'" call-list))
+ call-list =][=
+ ENDIF exparg exists/not =])
+{
+ if (OPT_VALUE_TRACE >= TRACE_EVERYTHING) {
+ static char const proc_z[] =
+ "Called ag_scm_[= name =]()\n";
+ fwrite(proc_z, sizeof(proc_z) - 1, 1, trace_fp);
+ }
+ return ag_scm_[= name =]([= (. pass-list) =]);
+}
+[= ENDFOR gfunc =]
+#if GUILE_VERSION >= 108000
+#define NEW_PROC(_As, _Ar, _Ao, _Ax, _An) \
+ scm_c_define_gsubr((char*)(_As), \
+ _Ar, _Ao, _Ax, (scm_callback_t)(void*)agrelay_scm_ ## _An)
+#else
+#define NEW_PROC(_As, _Ar, _Ao, _Ax, _An) \
+ gh_new_procedure((char*)(_As), (scm_callback_t)(void*)agrelay_scm_ ## _An, \
+ _Ar, _Ao, _Ax)
+#endif
+
+#else /* DEBUG_ENABLED *not* */[=
+
+ENDIF debug-enabled exists
+
+=]
+#if GUILE_VERSION >= 108000
+#define NEW_PROC(_As, _Ar, _Ao, _Ax, _An) \
+ scm_c_define_gsubr((char*)(_As), \
+ _Ar, _Ao, _Ax, (scm_callback_t)(void*)ag_scm_ ## _An)
+#else
+#define NEW_PROC(_As, _Ar, _Ao, _Ax, _An) \
+ gh_new_procedure((char*)(_As), (scm_callback_t)(void*)ag_scm_ ## _An, \
+ _Ar, _Ao, _Ax)
+#endif
+[= (if (exist? "debug-enabled") "#endif /* DEBUG_ENABLED */\n") =]
+/*
+ * [=group=] Initialization procedure.
+ */
+void
+[=(. init-proc)=](void)
+{[=
+
+ (out-push-new)
+
+ (if (exist? "init-code")
+ (prefix " " (get "init-code")) "") =][=
+
+ FOR gfunc =][=
+ INVOKE mk-new-proc =][=
+ ENDFOR gfunc =][=
+
+ FOR syntax =]
+ scm_make_synt(g_nm+[= (add-to-g_nm) =], [=type=], [=cfn=]);[=
+ ENDFOR syntax =][=
+
+ FOR symbol =]
+ [=(. scm-prefix)=]sym_[=name=] = scm_permanent_object[=
+ IF (not (and (exist? "init_val") (exist? "const_val")))
+ =](SCM_CAR (scm_intern0 (g_nm+[= (add-to-g_nm) =])));[=
+
+ ELSE =](scm_intern0 (g_nm+[= (add-to-g_nm) =]));
+ SCM_SETCDR ([=(. scm-prefix)=]sym_[=name=], [=
+ ?% init_val "%s" (sprintf "scm_long2num(%s)" (get "const_val"))=]);[=
+ ENDIF =][=
+ ENDFOR symbol =][=
+
+ (out-suspend "main")
+ (emit-string-table "g_nm")
+ (out-resume "main")
+ (out-pop #t) =][=
+ (if (exist? "fini-code")
+ (prefix " " (get "fini-code")) "") =]
+}
+#undef NEW_PROC
+/* end of [= (out-name) =] */
+[= #
+
+# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+=][=
+
+DEFINE mk-new-proc =][=
+
+ (set! ix (add-to-g_nm))
+
+ (ag-fprintf 0 "\n NEW_PROC(g_nm +%4d, " ix) =][=
+
+ IF (not (exist? "exparg"))
+
+ =]0, 0, 0[=
+
+ # Count of all the arguments: (count "exparg")
+ Of these, some may be optional: (count "exparg.arg_optional")
+ Of the optional, one may be an arg_list.
+ The sum of the three numbers must be: (count "exparg") =][=
+
+ ELIF (not (exist? "exparg.arg_list")) =][=
+ (- (count "exparg") (count "exparg.arg_optional")) =], [=
+ (count "exparg.arg_optional" ) =], 0[=
+
+ ELIF (not (exist? "exparg.arg_optional")) =][=
+ (- (count "exparg") 1) =], 0, 1[=
+
+ ELSE =][=
+ (- (count "exparg") (count "exparg.arg_optional")) =], [=
+ (- (count "exparg.arg_optional" ) 1) =], 1[=
+ ENDIF =], [=
+
+ name =]);[=
+
+ENDDEF =][=
+
+end of snarf.tpl \=]
diff --git a/agen5/test/Makefile.am b/agen5/test/Makefile.am
new file mode 100644
index 0000000..0915a4b
--- /dev/null
+++ b/agen5/test/Makefile.am
@@ -0,0 +1,71 @@
+## -*- Mode: Makefile -*-
+##
+## Makefile.am -- process this file with automake to produce Makefile.in
+##
+## Time-stamp: "2012-04-07 09:22:01 bkorb"
+## Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+SHELL_TESTS = define.test directives.test error.test expr.test extract.test \
+ include.test opts.test output.test snarf.test suffix.test shell.test
+
+NOSHELL_TESTS = \
+ alist.test case.test columns.test debug.test defref.test \
+ dynref.test endmac.test for.test forfrom.test forin.test \
+ format.test get.test gperf.test heredef.test html.test \
+ in.test leave.test license.test line.test loop.test \
+ make.test match.test pseudo.test reorder.test stack.test \
+ stress.test string.test strtable.test strxform.test time.test
+
+UNREADY_TESTS = daemon.test
+TESTS = @AGEN5_TESTS@
+EXTRA_DIST = $(TESTS) daemon.test
+FUNCLIST = funcCase.c funcDef.c funcEval.c funcFor.c funcIf.c functions.c
+EXPRLIST = expFormat.c expGuile.c expOutput.c expPrint.c expState.c \
+ expString.c expGperf.c expExtract.c $(FUNCLIST)
+
+TESTS_ENVIRONMENT = TERM='' \
+ CFLAGS='$(CFLAGS)' \
+ COMPILE='$(COMPILE)' \
+ EXPRLIST="$(EXPRLIST)" \
+ LDFLAGS='$(LDFLAGS)' \
+ SHELL="$(POSIX_SHELL)" \
+ srcdir="$(srcdir)" \
+ top_builddir="$(top_builddir)" \
+ top_srcdir="$(top_srcdir)"
+
+distclean-local:
+ -rm -rf testdir FAILURES
+
+$(TESTS) : defs
+
+defs : ${top_builddir}/autoopts/test/defs
+ @set -x ; \
+ $(SED) -e '/^ *srcdir=/s@".*"@"$(srcdir)"@' \
+ -e '/^ *top_srcdir=/s@".*"@"$(top_srcdir)"@' \
+ ${top_builddir}/autoopts/test/defs > $@ ; \
+ cd $(srcdir) ; chmod +x *.test || :
+
+${top_builddir}/autoopts/test/defs :
+ cd ${top_builddir}/autoopts/test ; $(MAKE) defs
+
+verbose : defs
+ rm -rf FAILURES testdir ; \
+ VERBOSE=true $(MAKE) check TESTS="$(TESTS)"
+
+# Makefile.am ends here
diff --git a/agen5/test/Makefile.in b/agen5/test/Makefile.in
new file mode 100644
index 0000000..61073be
--- /dev/null
+++ b/agen5/test/Makefile.in
@@ -0,0 +1,581 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = agen5/test
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = @AGexe@
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = @CLexe@
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SHELL_TESTS = define.test directives.test error.test expr.test extract.test \
+ include.test opts.test output.test snarf.test suffix.test shell.test
+
+NOSHELL_TESTS = \
+ alist.test case.test columns.test debug.test defref.test \
+ dynref.test endmac.test for.test forfrom.test forin.test \
+ format.test get.test gperf.test heredef.test html.test \
+ in.test leave.test license.test line.test loop.test \
+ make.test match.test pseudo.test reorder.test stack.test \
+ stress.test string.test strtable.test strxform.test time.test
+
+UNREADY_TESTS = daemon.test
+TESTS = @AGEN5_TESTS@
+EXTRA_DIST = $(TESTS) daemon.test
+FUNCLIST = funcCase.c funcDef.c funcEval.c funcFor.c funcIf.c functions.c
+EXPRLIST = expFormat.c expGuile.c expOutput.c expPrint.c expState.c \
+ expString.c expGperf.c expExtract.c $(FUNCLIST)
+
+TESTS_ENVIRONMENT = TERM='' \
+ CFLAGS='$(CFLAGS)' \
+ COMPILE='$(COMPILE)' \
+ EXPRLIST="$(EXPRLIST)" \
+ LDFLAGS='$(LDFLAGS)' \
+ SHELL="$(POSIX_SHELL)" \
+ srcdir="$(srcdir)" \
+ top_builddir="$(top_builddir)" \
+ top_srcdir="$(top_srcdir)"
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu agen5/test/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu agen5/test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ fi; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-local
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am check check-TESTS check-am clean clean-generic \
+ clean-libtool distclean distclean-generic distclean-libtool \
+ distclean-local distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am
+
+
+distclean-local:
+ -rm -rf testdir FAILURES
+
+$(TESTS) : defs
+
+defs : ${top_builddir}/autoopts/test/defs
+ @set -x ; \
+ $(SED) -e '/^ *srcdir=/s@".*"@"$(srcdir)"@' \
+ -e '/^ *top_srcdir=/s@".*"@"$(top_srcdir)"@' \
+ ${top_builddir}/autoopts/test/defs > $@ ; \
+ cd $(srcdir) ; chmod +x *.test || :
+
+${top_builddir}/autoopts/test/defs :
+ cd ${top_builddir}/autoopts/test ; $(MAKE) defs
+
+verbose : defs
+ rm -rf FAILURES testdir ; \
+ VERBOSE=true $(MAKE) check TESTS="$(TESTS)"
+
+# Makefile.am ends here
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/agen5/test/alist.test b/agen5/test/alist.test
new file mode 100755
index 0000000..0f913fa
--- /dev/null
+++ b/agen5/test/alist.test
@@ -0,0 +1,79 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# alist.test --- test evalstack functionality
+#
+# Time-stamp: "2010-06-26 16:06:53 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating $testname.tpl
+cat > $testname.tpl <<'_EOF_'
+[= AutoGen5 Template test =]
+[=
+
+FOR value "\n"
+
+=] [= (for-index) =] name is [=name=][=
+ENDFOR =]
+_EOF_
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo creating $testname.def
+cat > $testname.def <<'_EOF_'
+autogen definitions alist;
+
+\'(
+ (value ((name "first")) )
+ (value ((name "second") (name "third")) )
+ )
+
+value = { name = last; };
+_EOF_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+
+echo creating $testname.out
+# this is the output we should expect to see
+cat > $testname.out <<_EOF_
+ 0 name is first
+ 1 name is second
+ 2 name is last
+_EOF_
+
+AGCMD="-L ${srcdir}/.."
+run_ag x ${AGCMD} $testname.def || failure ${AGCMD} failed
+cmp -s $testname.test $testname.out || failure unexpected output
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of alist.test
diff --git a/agen5/test/case.test b/agen5/test/case.test
new file mode 100755
index 0000000..5ec29f9
--- /dev/null
+++ b/agen5/test/case.test
@@ -0,0 +1,136 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# case.test --- test CASE functionality
+#
+# Time-stamp: "2010-12-13 14:16:57 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+#
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. ./defs
+
+# # # # # # # TEMPLATE FILE # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<'EOF'
+<= AutoGen5 template test =>
+<=
+FOR grp "\n" =><=
+ CASE (get "nam") =><=
+
+ == first =>first: <=(sprintf "%-6s" (get "val"))=> matches: <=
+ CASE (get "val") =><=
+ ~~ ^[a-z]*$ =>~~ ^[a-z]*$ OK<=
+ ~~ ^[A-Z]*$ =>~~ ^[A-Z]*$ *** BOGUS ***<=
+ ~~ .* =>~~ .* *** BOGUS ***<=
+ ESAC => and <=
+ CASE (get "val") =><=
+ ~ ^[a-z]*$ =>~ ^[a-z]*$ OK<=
+ * =>~ .* *** BOGUS ***<=
+ ESAC =><=
+
+ == second =>second: <=(sprintf "%-6s" (get "val"))=> matches: <=
+ CASE (get "val") =><=
+ ~~ ^[a-z]*$ =>~~ ^[a-z]*$ *** BOGUS ***<=
+ ~~ ^[A-Z]*$ =>~~ ^[A-Z]*$ *** BOGUS ***<=
+ ~* . =>~* . OK<=
+ ESAC => and <=
+ CASE (get "val") =><=
+ ~ ^[a-z]*$ =>~ ^[a-z]*$ OK<=
+ * =>~ .* *** BOGUS ***<=
+ ESAC =><=
+
+ == third =>third: <=(sprintf "%-6s" (get "val"))=> matches: <=
+ CASE (get "val") =><=
+ ~~ ^[a-z]*$ =>~~ ^[a-z]*$ *** BOGUS ***<=
+ ~~ ^[A-Z]*$ =>~~ ^[A-Z]*$ OK<=
+ ~~ .* =>~~ .* *** BOGUS ***<=
+ ESAC => and <=
+ CASE (get "val") =><=
+ ~ ^[a-z]*$ =>~ ^[a-z]*$ OK<=
+ * =>~ .* *** BOGUS ***<=
+ ESAC =><=
+
+ ESAC =><=
+
+ENDFOR grp=>
+empty: <= CASE empty-val =><=
+ ~* . =>WRONG<=
+ !E =>BOGUS<=
+ +E =>valid<=
+ * =>REAL-BOGUS<=
+ ESAC =>
+bogus: <= CASE bogus-val =><=
+ ~* . =>WRONG<=
+ +E =>BOGUS<=
+ !E =>valid<=
+ * =>REAL-BOGUS<=
+ ESAC =>
+EOF
+
+# # # # # # # SAMPLE OUTPUT FILE # # # # # #
+
+echo creating ${testname}.out in `pwd`
+# this is the output we should expect to see
+cat > ${testname}.out <<'EOF'
+first: string matches: ~~ ^[a-z]*$ OK and ~ ^[a-z]*$ OK
+second: String matches: ~* . OK and ~ ^[a-z]*$ OK
+third: STRING matches: ~~ ^[A-Z]*$ OK and ~ ^[a-z]*$ OK
+empty: valid
+bogus: valid
+EOF
+
+# # # # # # # DEFINITIONS FILE # # # # # #
+
+cat > ${testname}.def <<EOF
+autogen definitions ${testname};
+
+grp = {
+ nam = first;
+ val = string;
+};
+
+grp = {
+ nam = second;
+ val = String;
+};
+
+grp = {
+ nam = third;
+ val = STRING;
+};
+empty-val;
+EOF
+
+# # # # # # # RUN AUTOGEN # # # # # #
+
+run_ag x ${testname}.def || failure autogen failed
+
+# # # # # # # TEST RESULTS # # # # # #
+
+cmp -s ${testname}.test ${testname}.out || failure unexpected output
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of case.test
diff --git a/agen5/test/columns.test b/agen5/test/columns.test
new file mode 100755
index 0000000..6c02f09
--- /dev/null
+++ b/agen5/test/columns.test
@@ -0,0 +1,56 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# case.test --- test CASE functionality
+#
+# Time-stamp: "2010-12-13 14:24:49 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+#
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. ./defs
+
+# # # # # # # # # # # # # TEST 1 # # # # # # # # # # # #
+
+${CLexe:-columns} --first '#define TABLE' --spread=1 --line=' \' \
+ -I4 -c 3 -f '_Tbl_(%s)'> ${testname}.res <<_EOF_
+one
+two
+three
+four
+five
+six
+_EOF_
+
+cat > ${testname}.base <<\_EOF_
+#define TABLE \
+ _Tbl_(one) _Tbl_(two) _Tbl_(three) \
+ _Tbl_(four) _Tbl_(five) _Tbl_(six)
+_EOF_
+
+cmp ${testname}.base ${testname}.res || \
+ failure "malformed result:${nl}`diff ${testname}.base ${testname}.res`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of columns.test
diff --git a/agen5/test/daemon.test b/agen5/test/daemon.test
new file mode 100755
index 0000000..33114e7
--- /dev/null
+++ b/agen5/test/daemon.test
@@ -0,0 +1,127 @@
+#! /bin/ksh
+# -*- Mode: Shell-script -*-
+# daemon.test --- test functionality of `for' function
+#
+# Time-stamp: "2011-02-02 12:00:31 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+tdir=$( (mktemp -d $PWD/.daemon-XXXXXX.d) 2>/dev/null)
+test -z "${tdir}" && {
+ tdir=$PWD/.daemon-$$.d
+ rm -rf ${tdir}
+ mkdir ${tdir} || exit 1
+}
+
+ag=`cd .. >/dev/null ; pwd`/autogen
+
+case $- in
+*x* ) setcmd="set -ex" ;;
+* ) setcmd='set -e' ;;
+esac
+cd ${tdir}
+
+exec 5> daemon-results
+
+cat > daemon.tpl <<_EOF_
+[= AutoGen5 Template =]
+This is from the [= (shell "echo $$") =] server.
+_EOF_
+
+run_thrice() {
+ $setcmd
+ sleep 1
+ for f in 1 2 3
+ do (
+ cat > ${1} <<_EOF_
+AutoGen Definitions daemon.tpl;
+hello = yes;
+_EOF_
+
+ sleep 1
+
+ cat >&5 < ${2}
+ ) &
+ done
+ sleep 1
+}
+
+do_run() {
+ $setcmd
+ $cmd &
+ pid=$!
+
+ while test ! -S ${1} -a ! -p ${1}
+ do print -u2 No ${1}. Must delay.
+ ( ps -p ${pid} > /dev/null 2>&1 ) || {
+ print -u2 "autogen has gone away"
+ exit 1
+ }
+ sleep 1
+ done
+
+ run_thrice "$@"
+ ps -fp $pid
+
+ kill -HUP ${pid} || \
+ kill -TERM ${pid} || \
+ kill -KILL ${pid}
+}
+
+( ${ag} --daemon daemon-io --help > /dev/null 2>&1 ) || exit 0
+
+cmd="${ag} --daemon daemon-io -b dmn"
+do_run daemon-io-in daemon-io-out
+
+tmp=$(echo ${tdir} | ${SED} 's,.*/\.,,;s/\.d$//')
+pipe=$PWD/${tmp}
+
+cmd="${ag} --daemon unix:${pipe} -b dmn"
+do_run ${tmp} ${tmp}
+
+sleep 2
+exec 5>&-
+cat daemon-results
+cd ..
+rm -rf ${tdir}
+
+# No daemon-io-in. Must delay.
+# UID PID PPID C STIME TTY TIME CMD
+# bkorb 18431 18427 3 18:18 pts/1 00:00:00 /home/bkorb/ag/ag/agen5/.libs/lt
+# AutoGen aborting on signal 1 (Hangup) in state OPTIONS
+# No daemon-w0QjvL. Must delay.
+# ./daemon.test[71]: cannot create daemon-w0QjvL: No such device or address
+# ./daemon.test[71]: cannot create daemon-w0QjvL: No such device or address
+# ./daemon.test[71]: cannot create daemon-w0QjvL: No such device or address
+# UID PID PPID C STIME TTY TIME CMD
+# bkorb 18466 18427 3 18:18 pts/1 00:00:00 /home/bkorb/ag/ag/agen5/.libs/lt
+# AutoGen aborting on signal 1 (Hangup) in state OPTIONS
+
+# This is from the 18427 server.
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of daemon.test
diff --git a/agen5/test/debug.test b/agen5/test/debug.test
new file mode 100755
index 0000000..d83216f
--- /dev/null
+++ b/agen5/test/debug.test
@@ -0,0 +1,175 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# debug.test --- definition reference testing
+#
+# Time-stamp: "2012-04-07 09:45:03 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+#
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+cat > ${testname}.tpl <<_EOF_
+<= AutoGen5 template test =>
+The last of each list:<=
+FOR list =><= DEBUG slot 64 =>
+ LAST -> <= val[$] =>
+
+ list -> <=
+ FOR val ", " =><= DEBUG bucket 128 => val[<=(for-index)=>]=<=val=><=
+ ENDFOR =><=
+ENDFOR =>
+_EOF_
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+# Create the files we need in the test environment
+cat > ${testname}.def <<_EOF_
+AutoGen definitions "${testname}." "tpl";
+list = { val = L0.first, L0.last; };
+List[3] = { val = L3.third.all; };
+_EOF_
+
+# # # # # # # # # # ANTICIPATED RESULTS # # # # # # # # #
+
+cat > ${testname}.base1 <<\_EOF_
+
+eval from file agInit.c line XXX:
+(debug-enable 'backtrace)
+Definition Load:
+list[0] (block) from debug.def/2
+ val[0] (text) from debug.def/2
+ val[1] (text) from debug.def/2
+list[3] (block) from debug.def/3
+ val[0] (text) from debug.def/3
+marker ``<='' loaded
+marker ``=>'' loaded
+Starting test template
+open_output_file 'debug.test' mode wb+
+Text (15) in debug.tpl at line 2
+ The last of each list:
+FOR ( F) in debug.tpl at line 3
+FOR list loop in debug.tpl on line 3 begins:
+DEBUG ( 5) in debug.tpl at line 3
+ slot 64
+ -- DEBUG slot 64 -- FOR index 0
+Text (15) in debug.tpl at line 3
+
+Unknown (16) in debug.tpl at line 4
+remapped to 'Expr' (16) in debug.tpl at line 4
+ based on val[$]
+Text (15) in debug.tpl at line 4
+
+FOR ( F) in debug.tpl at line 7
+ ,
+FOR val loop in debug.tpl on line 7 begins:
+DEBUG ( 5) in debug.tpl at line 7
+ bucket 128
+ -- DEBUG bucket 128 -- FOR index 0
+Text (15) in debug.tpl at line 7
+ val[
+EXPR ( E) in debug.tpl at line 7
+ (for-index)
+eval from file debug.tpl line 7:
+(for-index)
+Text (15) in debug.tpl at line 7
+ ]=
+Unknown (16) in debug.tpl at line 7
+remapped to 'Expr' (16) in debug.tpl at line 7
+ based on val
+DEBUG ( 5) in debug.tpl at line 7
+ bucket 128
+ -- DEBUG bucket 128 -- FOR index 1
+Text (15) in debug.tpl at line 7
+ val[
+EXPR ( E) in debug.tpl at line 7
+ (for-index)
+eval from file debug.tpl line 7:
+(for-index)
+Text (15) in debug.tpl at line 7
+ ]=
+EXPR ( E) in debug.tpl at line 7
+FOR val repeated 2 times
+ from debug.tpl line 7
+DEBUG ( 5) in debug.tpl at line 3
+ slot 64
+ -- DEBUG slot 64 -- FOR index 3
+Text (15) in debug.tpl at line 3
+
+EXPR ( E) in debug.tpl at line 4
+Text (15) in debug.tpl at line 4
+
+FOR ( F) in debug.tpl at line 7
+ ,
+FOR val loop in debug.tpl on line 7 begins:
+DEBUG ( 5) in debug.tpl at line 7
+ bucket 128
+ -- DEBUG bucket 128 -- FOR index 0
+Text (15) in debug.tpl at line 7
+ val[
+EXPR ( E) in debug.tpl at line 7
+ (for-index)
+eval from file debug.tpl line 7:
+(for-index)
+Text (15) in debug.tpl at line 7
+ ]=
+EXPR ( E) in debug.tpl at line 7
+FOR val repeated 1 times
+ from debug.tpl line 7
+FOR list repeated 2 times
+ from debug.tpl line 3
+Text (15) in debug.tpl at line 9
+
+out_close 'debug.test'
+_EOF_
+
+traceout=${testname}-aglog-x1-$$.log
+
+if ${VERBOSE}
+then trace_args=''
+else trace_args=--trace=everything\ --trace-out=${traceout}
+fi
+
+run_ag x1 ${trace_args} ${testname}.def || failure AutoGen failed
+${SED} -e 's@from file .*agInit.*@from file agInit.c line XXX:@' \
+ -e '/Called ag_scm_for_index/d' \
+ -e '/^AutoGen [0-9]* starts:/d' \
+ ${traceout} > ${testname}.trace1
+cmp -s ${testname}.base1 ${testname}.trace1 || \
+ failure "`diff -c ${testname}.base1 ${testname}.trace1`"
+
+${VERBOSE} || {
+ traceout=${testname}-aglog-x2-$$.log
+ trace_args=--trace-out=${traceout}
+ run_ag x2 ${trace_args} ${testname}.def || failure AutoGen failed
+ test -f ${traceout} -a -s ${traceout} && \
+ failure "autogen produced trace output"
+}
+
+cleanup
+
+##
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of debug.test
diff --git a/agen5/test/define.test b/agen5/test/define.test
new file mode 100755
index 0000000..68008e4
--- /dev/null
+++ b/agen5/test/define.test
@@ -0,0 +1,160 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# define.test --- test evalstack functionality
+#
+# Time-stamp: "2012-04-07 09:40:07 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # TEMPLATE LIBRARY FILE # # # # # #
+
+echo creating $testname.tlib
+cat > $testname.tlib <<'_EOF_'
+[+ AutoGen5 Template Library +]
+[+
+
+# * * * * * * * * * * * *
+
+ VISUAL SEPARATION
++][+
+
+DEFINE first_macro
++][+(for-index)+] Argument list:
+ [+
+ FOR arg "\n\t"
+ +]arg[ [+(for-index)+] ] = [+ arg +][+
+ ENDFOR +][+
+ENDDEF +][+
+
+# * * * * * * * * * * * *
+
+ VISUAL SEPARATION
++][+
+
+DEFINE last_macro
+ +]This is the last (number [+(for-index)+]) macro.[+
+ENDDEF +]
+_EOF_
+
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating $testname.tpl
+cat > $testname.tpl <<'_EOF_'
+[= AutoGen5 Template test =]
+[=
+
+DEFINE nest =][=
+ IF (exist? "name") =]
+level [=level=] iteration [=(for-index)=] Nested Name: [=name=][=
+ ENDIF =][=
+
+ FOR .nesting =][=
+ nest =][=
+ ENDFOR =][=
+
+ENDDEF nest =][=
+
+FOR value
+
+=][=
+ IF (or (first-for?) (last-for?)) =][=
+ INVOKE (string-append (get "value") "_macro")
+ arg = one arg = "the second arg = the second"
+ arg = (shell "date +'%A, %D'") arg = 'done.' =][=
+ ELSE =]
+
+ non first/last value: [=value=] = [= (for-index) =]
+[=ENDIF =][=
+ENDFOR =]
+[=invoke nest =]
+Done.
+_EOF_
+
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo creating $testname.def
+cat > $testname.def <<_EOF_
+autogen definitions $testname;
+
+value = first;
+value[2] = secondary;
+value[4] = tertiary;
+value[6] = last;
+
+level = 0;
+nesting[1] = {
+ level = 1;
+ name = primary;
+ nesting[1] = {
+ level = 2;
+ name = secondary;
+ }, {
+ level = 2;
+ /* no name defined - default to primary level */
+ nesting[1] = {
+ level = 3;
+ name = tertiary;
+ };
+ };
+};
+_EOF_
+
+# this is the output we should expect to see
+cat > $testname.samp <<_EOF_
+0 Argument list:
+ arg[ 0 ] = one
+ arg[ 1 ] = the second arg = the second
+ arg[ 2 ] = `date +'%A, %D'`
+ arg[ 3 ] = done.
+
+ non first/last value: secondary = 2
+
+
+ non first/last value: tertiary = 4
+This is the last (number 6) macro.
+
+level 1 iteration 1 Nested Name: primary
+level 2 iteration 1 Nested Name: secondary
+level 2 iteration 2 Nested Name: primary
+level 3 iteration 1 Nested Name: tertiary
+Done.
+_EOF_
+
+run_ag x --lib=$testname.tlib $testname.def || \
+ failure "autogen failed"
+set -x
+cmp -s $testname.samp $testname.test || \
+ failure "`diff $testname.samp $testname.test`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of define.test
diff --git a/agen5/test/defref.test b/agen5/test/defref.test
new file mode 100755
index 0000000..cac27d5
--- /dev/null
+++ b/agen5/test/defref.test
@@ -0,0 +1,124 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# defref.test --- definition reference testing
+#
+# Time-stamp: "2011-02-02 12:09:02 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+${SED} 's/^ *[0-9]*://;s/^ //' > ${testname}.tpl <<_EOF_
+ 1: <= AutoGen5 template test =>
+ 2: The last of each list:<=
+ 3: FOR list =>
+ 4: list[<= (for-index) =>] -> <= val[$] =><=
+ 5: ENDFOR =>
+ 6:
+ 7: The first of each list:<=
+ 8: FOR list =>
+ 9: list[<=(for-index)=>] -> <=val[]=><=
+10: ENDFOR =>
+11:
+12: The full list:<=
+13: FOR list =>
+14: list[<=(for-index)=>] -> <=
+15: FOR val ", " => val[<=(for-index)=>]=<=val=><=
+16: ENDFOR =><=
+17: ENDFOR =>
+18:
+19: The local global list:<=
+20: FOR list =>
+21: list[<=(for-index)=>] == "<=
+22: (join ", " (stack ".param.name")) =>"
+21: .. "<=
+22: (join ", " (stack "param.name")) =>"<=
+23: ENDFOR =>
+24:
+25: The first value is: <= ?% list[].val[] "val = %s (first)" "Undefined??"=>
+26: The last value is: <= ?% list[$].val[$] "val = %s (last)" "Undefined??"=>
+_EOF_
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+# Create the files we need in the test environment
+cat > ${testname}.def <<_EOF_
+AutoGen definitions "${testname}." "tpl";
+param = { name = "global"; };
+list = { val = L0.first, L0.second, L0.last;
+ param = { name = "first-1", "first-2"; }; },
+ { val[2] = L1.second-and-last; Val[0] = L1.first;
+ param = { name = "second-1", "second-2"; }; };
+List[3] = { val = L3.third.all; },
+ { val[3] = L4.last; VAL[2] = L4.middle; VAL[1] = L4.first; };
+_EOF_
+
+# # # # # # # # # # ANTICIPATED RESULT # # # # # # # # #
+
+cat > ${testname}.out <<_EOF_
+The last of each list:
+ list[0] -> L0.last
+ list[1] -> L1.second-and-last
+ list[3] -> L3.third.all
+ list[4] -> L4.last
+
+The first of each list:
+ list[0] -> L0.first
+ list[1] -> L1.first
+ list[3] -> L3.third.all
+ list[4] -> L4.first
+
+The full list:
+ list[0] -> val[0]=L0.first, val[1]=L0.second, val[2]=L0.last
+ list[1] -> val[0]=L1.first, val[2]=L1.second-and-last
+ list[3] -> val[0]=L3.third.all
+ list[4] -> val[1]=L4.first, val[2]=L4.middle, val[3]=L4.last
+
+The local global list:
+ list[0] == "first-1, first-2"
+ .. "first-1, first-2"
+ list[1] == "second-1, second-2"
+ .. "second-1, second-2"
+ list[3] == ""
+ .. "global"
+ list[4] == ""
+ .. "global"
+
+The first value is: val = L0.first (first)
+The last value is: val = L4.last (last)
+_EOF_
+
+run_ag x ${testname}.def || failure AutoGen failed
+cmp -s ${testname}.test ${testname}.out || \
+ failure "`diff ${testname}.test ${testname}.out`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of defref.test
diff --git a/agen5/test/directives.test b/agen5/test/directives.test
new file mode 100755
index 0000000..aab6833
--- /dev/null
+++ b/agen5/test/directives.test
@@ -0,0 +1,148 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# directives.test --- test definition directives
+#
+# Time-stamp: "2011-02-02 12:09:10 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+mkdir ${testname}.dir
+mkdir ${testname}.dir/subdir
+LDIR=`pwd`/${testname}.dir
+export LDIR
+
+echo creating ${testname}.dir/subdir/${testname}.tpl
+cat > ${testname}.dir/subdir/${testname}.tpl <<'_EOF_'
+[= AutoGen5 Template test =]
+Irrelevant [=foo=].
+_EOF_
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo creating ${testname}.inc
+${SED} 's/^ *[0-9]*: //' > ${testname}.inc <<_EOF_
+ 1: autogen definitions ${testname};
+ 2:
+ 3: #option templ-dir \$LDIR/subdir
+ 4:
+ 5: /*
+ 6: #define COMMENT
+ 7: #ifdef COMMENT
+ 8: # error error in comment
+ 9: */
+ 10:
+ 11: #ifdef MUMBLE
+ 12: # define MORE
+ 13: #else
+ 14: # define FUMBLE
+ 15: #endif
+_EOF_
+
+echo creating ${testname}.def
+${SED} 's/^ *[0-9]*: //' > ${testname}.def <<_EOF_
+ 1: autogen definitions ${testname};
+ 2:
+ 3: #include ${testname}.inc
+ 4:
+ 5: #ifdef FUMBLE
+ 6: # error we fumbled mumble
+ 7: #endif
+ 8:
+ 9: #ifndef MORE
+ 10: # error we fumbled more
+ 11: #endif
+ 12:
+ 13: #if (FOO == 1)
+ 14: # error we got iffed
+ 15: #elif (FOO == 0)
+ 16: # error we got FOO zeroed
+ 17: #else
+ 18: # error we got lost
+ 19: #endif
+ 20:
+ 21: #shell
+ 22:
+ 23: echo "#line 1 shelltext"
+ 24: echo "foo = bar;"
+ 25:
+ 26: #endshell
+ 27:
+ 28: #define FUMBLE
+ 29: #undef MORE
+ 30:
+ 31: #ifndef FUMBLE
+ 32: # error we goofed fumble
+ 33: #endif
+ 34:
+ 35: #ifdef MORE
+ 36: # error we mumbled more
+ 37: #endif
+_EOF_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+
+echo creating ${testname}.base
+# this is the output we should expect to see
+cat > ${testname}.base <<_EOF_
+Irrelevant bar.
+_EOF_
+
+agopts="-DMUMBLE -DFOO=1"
+MORE=DOITWRONG
+
+run_ag x1 ${agopts} ${testname}.def
+test $? -eq 0 || failure ${agopts}-1 failed
+cmp -s ${testname}.base ${testname}.test || \
+ failure "`diff ${testname}.base ${testname}.test`"
+
+echo '#assert `echo true`' >> ${testname}.inc
+run_ag x2 ${agopts} ${testname}.def
+test $? -eq 0 || failure ${agopts}-2 failed
+
+echo '#assert `echo false`' >> ${testname}.inc
+run_ag x3 ${agopts} ${testname}.def
+test $? -ne 0 || failure ${agopts}-3 failed
+
+${FGREP} -v '#assert' ${testname}.inc > ${testname}2.inc
+mv -f ${testname}2.inc ${testname}.inc
+
+echo '#assert (version-compare > autogen-version "5.8.4")' >> ${testname}.inc
+run_ag x4 ${agopts} ${testname}.def
+test $? -eq 0 || failure ${agopts}-4 failed
+
+echo '#assert (version-compare < autogen-version "5.8.4.63")' >> ${testname}.inc
+run_ag x5 ${agopts} ${testname}.def
+test $? -ne 0 || failure ${agopts}-5 failed
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of directives.test
diff --git a/agen5/test/dynref.test b/agen5/test/dynref.test
new file mode 100755
index 0000000..1f62248
--- /dev/null
+++ b/agen5/test/dynref.test
@@ -0,0 +1,82 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# dynref.test --- test dynamic scoping of definition values
+#
+# Time-stamp: "2010-06-26 16:06:18 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating $testname.tpl
+cat > $testname.tpl <<'_EOF_'
+[= AutoGen5 Template test =]
+[=
+
+DEFINE nest =][=
+
+ FOR nesting =][=
+ IF (first-for?)
+=]The un-nested value is: [=val_u=].[=
+ ENDIF =][=
+ ENDFOR =][=
+
+ENDDEF =][=
+
+nest Val-u = "hidden value"
+
+=]
+_EOF_
+
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo creating $testname.def
+cat > $testname.def <<_EOF_
+autogen definitions $testname;
+
+nesting = { name = one; };
+nesting = { name = two; };
+nesting = { name = three; };
+nesting = { name = four; };
+_EOF_
+
+# this is the output we should expect to see
+cat > $testname.out <<_EOF_
+The un-nested value is: hidden value.
+_EOF_
+
+run_ag x $testname.def || failure autogen failed
+cmp -s $testname.test $testname.out || \
+ failure "`diff $testname.test $testname.out`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of dynref.test
diff --git a/agen5/test/endmac.test b/agen5/test/endmac.test
new file mode 100755
index 0000000..c5ac062
--- /dev/null
+++ b/agen5/test/endmac.test
@@ -0,0 +1,73 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# endmac.test --- test variations on the end macro marker
+#
+# Time-stamp: "2011-02-24 10:53:51 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+set -x
+cat > ${testname}1.tpl <<EOF
+<=AutoGen5 template test=>><<=
+`echo ENDMAC 1`
+=>> <=`pwd`=>>
+<=# comment this test fails because the '=' is bound to 'test' >>
+This is a test
+EOF
+
+run_ag x1 -T${testname}1 --no-def 2> /dev/null && \
+ failure $testname failure test was successful. Oops.
+echo $testname failure test failed correctly
+
+cat > ${testname}2.tpl <<EOF
+<=AutoGen5 template test =>>
+ENDMAC 2 <=`echo print this message` =>>
+<=# comment This test succeeds because the '=' is not part of 'test' =>>
+This is a test
+EOF
+
+run_ag x2 -T${testname}2 --no-def || \
+ failure $testname success test was a failure
+echo first successful $testname test succeeded
+
+cat > ${testname}3.tpl <<EOF
+<+AutoGen5 template test+>>
+ENDMAC 3 <+(define foo "print this message") foo +>>
+<+# comment The '+' is not joined because it is neither '=' nor
+ a legal file name character +>>
+This is a test
+EOF
+
+run_ag x3 -T${testname}3 --no-def || \
+ failure second $testname success test was a failure
+echo second successful $testname test succeeded
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of endmac.test
diff --git a/agen5/test/error.test b/agen5/test/error.test
new file mode 100755
index 0000000..de9a896
--- /dev/null
+++ b/agen5/test/error.test
@@ -0,0 +1,250 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+#
+# error.test --- test error functionality
+#
+# Author: Bruce Korb <bkorb@gnu.org>
+# Time-stamp: "2011-12-30 16:40:11 bkorb"
+#
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. ./defs
+
+verb_ok=true
+
+ag_err()
+{
+ (
+ set +x
+ if ${VERBOSE} && ${verb_ok}
+ then
+ AUTOGEN_TRACE=everything
+ AUTOGEN_TRACE_OUT=${testname}-task${seq}-aglog.txt
+ VERBOSE=false
+ export AUTOGEN_TRACE AUTOGEN_TRACE_OUT
+ else
+ unset AUTOGEN_TRACE AUTOGEN_TRACE_OUT
+ fi
+
+ seq=${1} ; shift
+ exec 2> ${testname}.err${seq}
+ touch ${testname}-task${seq}-running
+ run_ag x${seq} "$@"
+ res=$?
+ rm -f ${testname}-task${seq}-running
+ exit $res
+ ) && touch ${testname}-task${seq}-OK
+}
+
+# # # # # # # # # # # # # TEST 1 # # # # # # # # # # # #
+
+echo creating ${testname}.tpl
+${SED} 's/[ 0-9]*=//' > ${testname}.tpl <<'_EOF_'
+ 1 =<= AutoGen5 template fnord null =>
+ 2 =THIS TEXT SHOULD BE DELETED!!
+ 3 =<=
+ 4 =CASE (suffix) =><=
+ 5 =
+ 6 = == fnord =><=
+ 7 =
+ 8 = ;; (out-push-new)
+ 9 = ;; (error (string-append "0 this is really okay" (out-pop #t))
+ 10 = (error "0 this is really okay")
+ 11 =
+ 12 = =>this is never seen<=
+ 13 =
+ 14 = * =><=
+ 15 =
+ 16 = (error "This is a multi-line
+ 17 = error to show how to exit
+ 18 = your template") =><=
+ 19 =
+ 20 =ESAC =>
+ 21 =this is never seen
+_EOF_
+
+echo creating ${testname}.def
+cat > ${testname}.def <<'_EOF_'
+autogen definitions alist;
+#error The definitions file has a `#error' directive
+_EOF_
+
+echo creating ${testname}.base1
+# this is the output we should expect to see
+cat > ${testname}.base1 <<'_EOF_'
+#error directive -- in error.def on line 3
+ The definitions file has a `#error' directive
+_EOF_
+
+ag_err 1 ${testname}.def
+test -f ${testname}-task1-OK \
+ && failure unexpected success for test-1
+
+${SED} '/Giving up in/d;/Failing Guile command:/,$d' ${testname}.err1 \
+ > ${testname}.err
+cmp -s ${testname}.err ${testname}.base1 || \
+ failure "expected->actual${nl}`diff -c ${testname}.base1 ${testname}.err`"
+
+# # # # # # # # # # # # # TEST 2 # # # # # # # # # # # #
+
+echo creating ${testname}.base2
+# this is the output we should expect to see
+cat > ${testname}.base2 <<'_EOF_'
+DEFINITIONS Warning in error.tpl line 8 for error2.fnord:
+ 0 this is really okay
+Error in template error.tpl, line 16
+ DEFINITIONS ERROR in error.tpl line 16 for /dev/null:
+ This is a multi-line
+ error to show how to exit
+ your template
+Failing Guile command: = = = = =
+
+(error "This is a multi-line
+ error to show how to exit
+ your template")
+
+=================================
+_EOF_
+
+agopts="--no-def --base=${testname}"
+
+verb_ok=false
+ag_err 2 -T${testname}.tpl ${agopts}2
+test -f ${testname}-task2-OK \
+ && failure unexpected success for test-2
+verb_ok=true
+
+if test ${GUILE_VERSION} -gt 107000
+then
+ ${EGREP} -v 'Giving up in | is deprecated\.' ${testname}.err2
+else
+ ${EGREP} -v 'Giving up in ' ${testname}.err2
+fi > ${testname}.res2
+
+cmp -s ${testname}.base2 ${testname}.res2 || \
+ failure "expected->actual${nl}`diff -c ${testname}.base2 ${testname}.res2`"
+
+# # # # # # # # # # # # # TEST 3 # # # # # # # # # # # #
+
+# REMOVED: This test always worked, but the exact results
+# vary all over the place. Too hard to test.
+
+# # # # # # # # # # # # # TEST 4 # # # # # # # # # # # #
+
+${SED} 's,^#error.*,this is broken;,' ${testname}.def > ${testname}2.def
+
+echo creating ${testname}.base4
+# this is the output we should expect to see
+cat > ${testname}.base4 <<'_EOF_'
+FSM Error: in state 5 (have_name), event 3 (var_name) is invalid
+invalid transition: in error2.def on line 2
+ token in error: var_name: ''is broken;
+''
+
+ [[...<error-text>]] broken;
+
+
+Likely causes: a mismatched quote, a value that needs quoting,
+ or a missing semi-colon
+_EOF_
+
+ag_err 4 ${testname}2.def
+test -f ${testname}-task4-OK \
+ && failure unexpected success for test-4
+
+${GREP} -v 'Giving up in' ${testname}.err4 > ${testname}.res4
+cmp -s ${testname}.res4 ${testname}.base4 \
+ || failure "expected->actual${nl}`diff -c ${testname}.base4 ${testname}.res4`"
+
+# # # # # # # # # # # # # TEST 5 # # # # # # # # # # # #
+
+echo creating ${testname}.tpl5
+cat > ${testname}.tpl5 <<'_EOF_'
+<= AutoGen5 template fnord null =>
+THIS TEXT SHOULD BE DELETED!!
+<= ENDIF =>
+_EOF_
+
+ag_err 5 -T ${testname}.tpl5 ${agopts}5 > /dev/null
+test -f ${testname}-task5-OK \
+ && failure unexpected success for test-5
+
+${EGREP} -v 'Giving up in .*functions\.c' ${testname}.err5 > ${testname}.res5
+cat > ${testname}.base5 <<'EOF'
+Error in template error.tpl5, line 3
+ Unknown macro or invalid context in error.tpl5 line 3:
+ ENDIF
+EOF
+
+cmp -s ${testname}.base5 ${testname}.res5 || \
+ failure "expected->actual${nl}`diff -c ${testname}.base5 ${testname}.res5`"
+
+# # # # # # # # # # # # # TEST 6 # # # # # # # # # # # #
+
+echo creating ${testname}.tpl6
+cat > ${testname}.tpl6 <<'_EOF_'
+<= AutoGen5 template fnord null =>
+This is a broken template, "nothing" is not defined.
+<= (
+if (exist? "nothing")
+ (error "it is broken
+ 'cuz it's okay")
+ (stumble-over-unbound-variable)
+) =>
+End Of File
+_EOF_
+
+ag_err 6 -T ${testname}.tpl6 ${agopts}6 > /dev/null
+test -f ${testname}-task6-OK \
+ && failure unexpected success for test-6
+
+cat > ${testname}.base6 <<EOF
+Scheme evaluation error. AutoGen ABEND-ing in template
+ error.tpl6 on line 3
+Failing Guile command: = = = = =
+
+(
+if (exist? "nothing")
+ (error "it is broken
+ 'cuz it's okay")
+ (stumble-over-unbound-variable)
+)
+
+=================================
+EOF
+
+# Guile keeps changing its mind about what it ought to print in the
+# face of an unbound variable. So, the heck with it. We've tried to
+# print file and line, but it was made just too hard. Strip out all
+# the Guile library error messages. :(
+#
+${SED} -n '/^Scheme evaluation error./,$p' ${testname}.err6 | \
+ ${SED} "/^${testname}\.tpl6:7:4:/d" > ${testname}.res6
+
+cmp -s ${testname}.base6 ${testname}.res6 || \
+ failure "expected->actual${nl}`diff -c ${testname}.base6 ${testname}.res6`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of error.test
diff --git a/agen5/test/expr.test b/agen5/test/expr.test
new file mode 100755
index 0000000..3e6eeda
--- /dev/null
+++ b/agen5/test/expr.test
@@ -0,0 +1,107 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# expr.test --- [= % name (sprintf "%%-18s" "%s") =] expression
+#
+# Time-stamp: "2012-04-01 06:07:01 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # TEMPLATE & DEFINITIONS FILES # # # # # # # # #
+#
+# We construct this by pulling down the sources from the
+# AutoGen source directory. We will also copy out the same
+# commands as are used there. ${top_srcdir} is a full path.
+#
+cp ${top_srcdir}/agen5/snarf.tpl ${top_srcdir}/agen5/exp*.c \
+ ${top_srcdir}/agen5/func*.c ${top_srcdir}/agen5/agShell.c ${TMPDIR}/.
+f=`fgrep '#ifdef DEBUG_ENABLED' ${top_srcdir}/agen5/expr.ini`
+test -n "$f" && {
+ DEBUG_ENABLED=true
+ export DEBUG_ENABLED
+}
+
+exec 3> ${TMPDIR}/${testname}.sh
+cat >&3 <<- _EOF_
+ GDexe=${GDexe}
+ CLexe=${CLexe}
+ srcdir=`pwd`
+ export GDexe CLexe srcdir
+ cd ${TMPDIR}
+ set -e
+ _EOF_
+
+if ${VERBOSE}
+then
+ cat >&3 <<- _EOF_
+ PS4='>${testname}-\${FUNCNAME-mkexp}> '
+ set -x
+ run_ag()
+ {
+ tfile=ag-\${1}-$$.log
+ tag="-MF${testname}-stamp-\${1} --trace=every --trace-out=\${tfile}"
+ shift
+ ${AGexe} -L${top_srcdir}/autoopts/tpl \${tag} "\$@"
+ }
+ _EOF_
+else
+ cat >&3 <<- _EOF_
+ run_ag()
+ {
+ tag="-MF${testname}-stamp-\${1}"
+ shift
+ echo ${AGexe} "\$@"
+ ${AGexe} -L${top_srcdir}/autoopts/tpl \${tag} "\$@"
+ }
+ _EOF_
+fi
+
+${SED} -n '/^make_exprini()/,/^[}]$/p' ${top_srcdir}/agen5/mk-stamps.sh | \
+ ${SED} 's/rm -f /echo rm -f/' >&3
+cat >&3 <<- _EOF_
+ make_exprini
+ ${SED} "${sed_omit_license}" expr.ini > \${srcdir}/expr.res
+ ${SED} "${sed_omit_license}" ${top_srcdir}/agen5/expr.ini \
+ > \${srcdir}/expr.base
+ _EOF_
+exec 3>&-
+
+# Remove the lines that *will* be different, always...
+#
+${SHELLX} ${TMPDIR}/${testname}.sh || failure "${testname}.sh failed"
+
+test -s expr.res || \
+ failure "${testname} test produced no output"
+
+cmp expr.base expr.res || \
+ failure "`diff -c expr.base expr.res`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of expr.test
diff --git a/agen5/test/extract.test b/agen5/test/extract.test
new file mode 100755
index 0000000..1e3e4c0
--- /dev/null
+++ b/agen5/test/extract.test
@@ -0,0 +1,80 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# extract.test --- test extract functionality
+#
+# Time-stamp: "2010-06-26 16:05:58 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+mkdir ${testname}.dir
+echo creating ${testname}.dir/${testname}.tpl
+cat > ${testname}.dir/${testname}.tpl <<_EOF_
+[= AutoGen5 template out =]
+This is the start of generated text[=\` echo ' working' \` =]
+We will be extracting from [=(find-file "${testname}" "sample")=]:
+[=(extract (find-file "${testname}" "sample")
+ "/* =-= %s =-= MARKER =-= %s =-= */")=]
+[=(extract (find-file "${testname}" "sample")
+ "/* =-= %s =-= SECOND =-= %s =-= */"
+ "DNC Test" "DEFAULT-ed text.")=]
+And this is the end.[= \` echo ' done' \` =]
+_EOF_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+
+echo creating ${testname}.dir/${testname}.sample
+# this is the output we should expect to see
+cat > ${testname}.dir/${testname}.sample <<_EOF_
+This is the start of generated text working
+We will be extracting from ${testname}.dir/${testname}.sample:
+_EOF_
+cat >> ${testname}.dir/${testname}.sample <<\_EOF_
+/* =-= START =-= MARKER =-= DO NOT CHANGE THIS COMMENT =-= */
+This is inserted text
+/* =-= END =-= MARKER =-= DO NOT CHANGE THIS COMMENT =-= */
+/* =-= START =-= SECOND =-= DNC Test =-= */
+This is an insertion
+test.
+/* =-= END =-= SECOND =-= DNC Test =-= */
+And this is the end. done
+_EOF_
+
+AGCMD="--no-def -L${testname}.dir -b${testname} -T${testname}.tpl"
+
+run_ag x ${AGCMD} || failure autogen ${AGCMD} failed
+
+cmp -s ${testname}.out ${testname}.dir/${testname}.sample || \
+ failure "`diff -c ${testname}.out ${testname}.dir/${testname}.sample`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of extract.test
diff --git a/agen5/test/for.test b/agen5/test/for.test
new file mode 100755
index 0000000..45a2f55
--- /dev/null
+++ b/agen5/test/for.test
@@ -0,0 +1,112 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# for.test --- test functionality of `for' function
+#
+# Time-stamp: "2011-02-02 12:09:29 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating $testname.tpl
+${SED} 's/^ *[0-9]*: //' > $testname.tpl <<_EOF_
+ 1: <= AutoGen5 template test =>
+ 2: <=
+ 3: FOR list ",\n" =><=
+ 4: IF (first-for?)
+ 5: =>FIRST: <=
+ 6: ELIF (last-for?)
+ 7: =>LAST: <=
+ 8: ELSE
+ 9: =>MIDDLE: <=
+10: ENDIF =><=elt[0]=><=
+11: ENDFOR =>
+12: <=
+13: FOR list-2 \=>
+14: <=FOR list ", "\=>
+15: <=bumble \=>
+16: <=ENDFOR \=>
+17: <=
+18: ENDFOR =>
+19: <=
+20: FOR list ",\n" =><=
+21: FOR list-2 \=>
+22: <=(for-index "list")=>: <=
+23:
+24: IF (first-for? "list")
+25: =>FIRST <=
+26: ELIF (last-for? "list")
+27: =>LAST <=
+28: ELSE
+29: =>MIDDLE <=
+30: ENDIF =><=
+31:
+32: (tpl-file-line " on line %2\$d") =><=
+33:
+34: ENDFOR =><=
+35: ENDFOR =>
+_EOF_
+
+
+# Create the files we need in the test environment
+cat > $testname.def <<_EOF_
+AutoGen definitions $testname;
+list = { elt = one; },
+{ elt = two.one, two.two, two.three; };
+list = { elt = three; }, {elt = four;};
+
+list-2 = { bumble = mumble; };
+_EOF_
+
+# this is the output we should expect to see
+cat > $testname.sample <<_EOF_
+FIRST: one,
+MIDDLE: two.one,
+MIDDLE: three,
+LAST: four
+mumble, mumble, mumble, mumble
+0: FIRST on line 32,
+1: MIDDLE on line 32,
+2: MIDDLE on line 32,
+3: LAST on line 32
+_EOF_
+
+run_ag x $testname.def || failure AutoGen failed
+cmp -s $testname.test $testname.sample || \
+ failure "`diff -c $testname.test $testname.sample`"
+
+echo '<= FOR =><= ENDFOR =>' >> $testname.tpl
+f=`(run_ag x $testname.def 2>&1) | ${EGREP} 'requires iterator'`
+test -z "$f" && \
+ failure "failed to detect missing FOR iterator"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of for.test
diff --git a/agen5/test/forfrom.test b/agen5/test/forfrom.test
new file mode 100755
index 0000000..ea4a3a2
--- /dev/null
+++ b/agen5/test/forfrom.test
@@ -0,0 +1,79 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+#
+# forfrom.test --- test forfrom functionality
+#
+# Time-stamp: "2010-07-17 09:52:04 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+#
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating $testname.tpl
+cat > $testname.tpl <<_EOF_
+<= AutoGen5 template test =>
+<=
+
+FOR list (for-by 3) (for-sep ",\n")
+
+ =>list[<=(for-index)=>] = <=
+ ?% elt 'this is "%s"' EMPTY=><=
+
+ENDFOR
+
+=>
+_EOF_
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo creating $testname.def
+cat > $testname.def <<EOF
+AutoGen definitions $testname;
+list[1] = { elt = one; };
+list[3] = { elt = three; };
+list[5] = { elt = five; };
+list[7] = { elt = seven; };
+list[9] = { elt = nine; };
+EOF
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+
+echo creating $testname.out
+# this is the output we should expect to see
+cat > $testname.out <<'_EOF_'
+list[1] = this is "one",
+list[4] = EMPTY,
+list[7] = this is "seven"
+_EOF_
+
+run_ag x $testname.def || failure autogen failed
+cmp -s $testname.test $testname.out || failure unexpected output
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of forfrom.test
diff --git a/agen5/test/forin.test b/agen5/test/forin.test
new file mode 100755
index 0000000..313d887
--- /dev/null
+++ b/agen5/test/forin.test
@@ -0,0 +1,86 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+#
+# forin.test --- test forin functionality
+#
+# Time-stamp: "2010-07-17 09:51:55 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+#
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+set -x
+echo creating ${testname}.tpl in `pwd`
+cat > ${testname}.tpl <<_EOF_
+[+ AutoGen5 template out +]
+[+
+FOR t IN build host target +][+
+ FOR v IN alias cpu vendor os +]
+[+t+]_[+v+]=@[+t+]_[+v+]@[+
+ ENDFOR +]
+[+t+]_canonical=@[+t+]_cpu@-@[+t+]_vendor@-@[+t+]_os@
+[+
+
+ENDFOR
+
++]
+_EOF_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+
+echo creating ${testname}.ok
+# this is the output we should expect to see
+cat > ${testname}.ok <<'_EOF_'
+
+build_alias=@build_alias@
+build_cpu=@build_cpu@
+build_vendor=@build_vendor@
+build_os=@build_os@
+build_canonical=@build_cpu@-@build_vendor@-@build_os@
+
+host_alias=@host_alias@
+host_cpu=@host_cpu@
+host_vendor=@host_vendor@
+host_os=@host_os@
+host_canonical=@host_cpu@-@host_vendor@-@host_os@
+
+target_alias=@target_alias@
+target_cpu=@target_cpu@
+target_vendor=@target_vendor@
+target_os=@target_os@
+target_canonical=@target_cpu@-@target_vendor@-@target_os@
+
+_EOF_
+
+run_ag x --no-def -T${testname}.tpl -b ${testname} || \
+ failure autogen failed
+cmp -s ${testname}.ok ${testname}.out || \
+ failure "`diff ${testname}.ok ${testname}.out`"
+exit 0
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of forin.test
diff --git a/agen5/test/format.test b/agen5/test/format.test
new file mode 100755
index 0000000..87d88c9
--- /dev/null
+++ b/agen5/test/format.test
@@ -0,0 +1,96 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# format.test --- Count format string arguments.
+#
+# Time-stamp: "2010-06-26 16:05:41 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<_EOF_
+[++ AutoGen5 template test ++]
+[++ (dne "-d" "# ") ++]
+[++
+
+FOR fmt "\n"
+
+++]Fmt [++(+ 1 (for-index))++] has [++(format-arg-count (get "fmt"))
+++] args: [++(c-string (get "fmt"))++][++
+
+ENDFOR
+
+++]
+[++(hide-email "Bruce Korb" "bkorb@gnu.org")++]
+_EOF_
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo creating ${testname}.def
+cat > ${testname}.def <<_EOF_
+AutoGen definitions ${testname};
+fmt = "none";
+fmt = "one %s val";
+fmt = "two %s (%d%%) vals";
+_EOF_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+set -x
+echo creating ${testname}.base
+# this is the output we should expect to see
+cat > ${testname}.base <<'_EOF_'
+# DO NOT EDIT THIS FILE (format.test)
+#
+# It has been AutoGen-ed
+# From the definitions format.def
+# and the template file format
+Fmt 1 has 0 args: "none"
+Fmt 2 has 1 args: "one %s val"
+Fmt 3 has 2 args: "two %s (%d%%) vals"
+<script language="JavaScript" type="text/javascript">
+<!--
+var one = 'm&#97;';
+var two = 'i&#108;t';
+document.write('<a href="' + one + two );
+document.write('&#111;:&#98;&#107;&#111;&#114;&#98;&#64;&#103;&#110;&#117;&#46;&#111;&#114;&#103;');
+document.write('" >Bruce Korb</a>');
+//-->
+</script>
+_EOF_
+
+run_ag x ${testname}.def || failure autogen failed
+cmp -s ${testname}.base ${testname}.test || \
+ failure "`diff ${testname}.base ${testname}.test`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of format.test
diff --git a/agen5/test/get.test b/agen5/test/get.test
new file mode 100755
index 0000000..7800a9a
--- /dev/null
+++ b/agen5/test/get.test
@@ -0,0 +1,95 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# get.test --- test get functionality
+#
+# Time-stamp: "2011-03-06 15:26:30 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating $testname.tpl
+cat > $testname.tpl <<_EOF_
+[= AutoGen5 template test =]
+[=
+
+IF (not (exist? "foo.bar.baz")) =][=
+ (error "foo.bar.baz does, too, exist!") =][=
+
+ELIF (not (= "mumble" (get "foo.bar.baz"))) =][=
+ (error (sprintf "We got the wrong baz. We got: %s"
+ (get "foo.bar.baz"))) =][=
+ELSE
+ =]A OK[=
+ENDIF =][=
+
+- bogus "\nA OK2" =][=
+- foo "\nBOGUS" =]
+[= (get "fuz-zy") =]
+[= (get "fuz_zy") =]
+[= (get "fuz^zy") =]
+[= (get-c-name "fuz-zy") =]
+[= (get-up-name "fuz-zy") =]
+[= (get-down-name "fuz-zy") =]
+_EOF_
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo creating $testname.def
+cat > $testname.def <<_EOF_
+AutoGen definitions $testname;
+
+foo = { bar = { nada = nothing; }; };
+foo = { bar = { baz = mumble; }; }; /* this is the one */
+foo = { bar = { baz = grumble; }; };
+fuz-zy = Mum-Ble;
+_EOF_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+set -x
+echo creating $testname.out
+# this is the output we should expect to see
+cat > $testname.out <<'_EOF_'
+A OK
+A OK2
+Mum-Ble
+Mum-Ble
+Mum-Ble
+Mum_Ble
+MUM_BLE
+mum_ble
+_EOF_
+
+run_ag x $testname.def || failure autogen failed
+cmp -s $testname.test $testname.out || failure unexpected output
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of get.test
diff --git a/agen5/test/gperf.test b/agen5/test/gperf.test
new file mode 100755
index 0000000..aa4746f
--- /dev/null
+++ b/agen5/test/gperf.test
@@ -0,0 +1,95 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# gperf.test --- test functionality of `gperf'
+#
+# Time-stamp: "2010-12-06 13:08:36 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+# ----------------------------------------------------------------------
+
+if gperf --version > /dev/null 2>&1
+then :
+else
+ echo gperf functionality does not work without gperf >&2
+ exit 0
+fi
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<_EOF_
+<= AutoGen5 template test =>
+<=
+
+(if (not (make-gperf "${testname}" (stack "foo.bar")))
+ (error "cannot make gperf")) =><=
+
+FOR foo "\n" =><=
+
+ FOR bar =>
+<=bar=> yields: <=(gperf "${testname}" (get "bar"))=><=
+ ENDFOR =><=
+
+ENDFOR =><=
+\`tar cf - .${testname}.* > ${testname}-prog.tar || \
+ die 'cannot save gperf files'\`=><=
+(out-push-new "${testname}-code.c")
+(emit (gperf-code "${testname}")) (emit "\n")
+(out-pop)
+=>
+_EOF_
+
+
+# Create the files we need in the test environment
+cat > ${testname}.def <<_EOF_
+AutoGen Definitions ${testname};
+foo = { bar = first; bar = second; };
+foo = { bar = third; bar = fourth; };
+_EOF_
+
+# this is the output we should expect to see
+cat > ${testname}.base <<_EOF_
+
+first yields: 0x01
+second yields: 0x02
+
+third yields: 0x03
+fourth yields: 0x04
+_EOF_
+
+if ${VERBOSE:-false}
+then opts="x --trace=server-shell ${testname}.def"
+else opts="x ${testname}.def"
+fi
+
+run_ag ${opts} || failure AutoGen failed
+cmp -s ${testname}.base ${testname}.test || \
+ failure "`diff ${testname}.base ${testname}.test`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of gperf.test
diff --git a/agen5/test/heredef.test b/agen5/test/heredef.test
new file mode 100755
index 0000000..959fb92
--- /dev/null
+++ b/agen5/test/heredef.test
@@ -0,0 +1,102 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# heredef.test --- definition reference testing
+#
+# Time-stamp: "2011-02-02 12:09:38 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+${SED} 's/^ *[0-9]*: //' > ${testname}.tpl <<\_EOF_
+ 1: <= AutoGen5 template test =>
+ 2: <=
+ 3:
+ 4: (if (not (= (get "string1") (get "string2")))
+ 5: (error (sprintf "`%s' <> `%s'"
+ 6: (get "string1") (get "string2") )) )
+ 7:
+ 8: =><=
+ 9:
+10: (if (not (= (get "string2") (get "string3")))
+11: (error (sprintf "`%s' <> `%s'"
+12: (get "string1") (get "string2") )) )
+13: =>OKAY: <= (c-string (get "string3")) =>
+14: FROM: string1 extracted <= (def-file-line "string1") =>
+15: string2 extracted
+16: <= (def-file-line "string2" c-file-line-fmt) =>
+17: string3 extracted <=
+18: (def-file-line "string3" "From %1$s on line %2$d") =>
+_EOF_
+
+# # # # # # # # # # SAMPLE FILE # # # # # # # # #
+cat > ${testname}.sample <<\_EOF_
+OKAY: "\"`Testing'"
+FROM: string1 extracted from heredef.def line 11
+ string2 extracted
+#line 15 "heredef.def"
+
+ string3 extracted From heredef.def on line 18
+_EOF_
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+# Create the files we need in the test environment
+echo "AutoGen definitions ${testname};" > ${testname}.def
+${SED} 's/^ *[0-9]*: //' >> ${testname}.def <<\_EOF_
+ 2: #ifdef BOGUS
+ 3: /* Line 3 */
+ 4: #else
+ 5: #ifdef WRONG
+ 6: /* line 6 */
+ 7: #endif
+ 8: #endif
+ 9: /* line 9 */
+10: string1 = <<- AG_EOF
+11: "`Testing'
+12: AG_EOF; /* " */
+13: /* line 13 */
+14: string2 = <<- AG_EOF
+15: "`Testing'
+16: AG_EOF; /* " */
+17:
+18: string3 = "\"`Testing'"; /* line 18 */
+19:
+_EOF_
+
+run_ag x ${testname}.def || failure ${testname} AutoGen failed
+
+if cmp ${testname}.test ${testname}.sample
+then cleanup
+else failure "`diff ${testname}.sample ${testname}.test`"
+fi
+
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of heredef.test
diff --git a/agen5/test/html.test b/agen5/test/html.test
new file mode 100755
index 0000000..8ed4fb8
--- /dev/null
+++ b/agen5/test/html.test
@@ -0,0 +1,130 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# html.test --- test html generation
+#
+# Time-stamp: "2011-12-30 12:17:28 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILES # # # # # # # # #
+
+echo creating cgi.tpl
+cat > cgi.tpl <<'_EOF_'
+<? AutoGen5 Template ?>
+<? DEFINE form-error
+?>HTTP/1.0 500 AutoGen Forms Error
+Content-Type: text/plain
+
+The submitted form does not contain a valid template<?
+ IF (exist? "template") ?> (<?template?>) <?ENDIF?>.<?
+ENDDEF ?><?
+ (define foo "")
+ (if (exist? "break") (set! foo bogus)) ?><?
+IF (not (exist? "template")) ?><?
+ form-error ?><?
+
+ELIF (access? (get "template") R_OK) ?><?
+ INCLUDE (get "template") ?><?
+
+ELIF (access? (string-append
+ (get "template") ".tpl") R_OK) ?><?
+ INCLUDE (string-append (get "template") ".tpl") ?><?
+
+ELSE ?><?
+ form-error ?><?
+ENDIF ?>
+_EOF_
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<'_EOF_'
+<? AutoGen5 Template ?>
+<head>Mumble: <? mumble ?></head>
+<body>Foolish: <? foo ?></body>
+_EOF_
+
+# # # # # # # SAMPLE OUTPUT FILE # # # # # #
+
+echo creating ${testname}.out in `pwd`
+# this is the output we should expect to see
+cat > ${testname}.samp <<'_EOF_'
+content-type: text/html
+
+<head>Mumble: fumble bumble</head>
+<body>Foolish: bar</body>
+_EOF_
+
+# # # # # # # RUN AUTOGEN # # # # # #
+
+REQUEST_METHOD=GET
+QUERY_STRING="mumble=fumble+bumble&foo=bar&template=${testname}"
+CONTENT_LENGTH=`expr "${QUERY_STRING}" : ".*"`
+
+export CONTENT_LENGTH REQUEST_METHOD QUERY_STRING
+
+run_ag x1 | ${EGREP} -v '^in state' > ${testname}.test
+
+cmp -s ${testname}.samp ${testname}.test || \
+ failure "`diff ${testname}.samp ${testname}.test`"
+
+# # # # # # # SECOND RUN # # # # # #
+
+QUERY_STRING="${QUERY_STRING}&break=true"
+CONTENT_LENGTH=`expr "${QUERY_STRING}" : ".*"`
+
+run_ag x2 > ${testname}-2.test
+fgrep 'AutoGen form processing error' ${testname}-2.test || \
+ failure autogen unexpectedly succeeded
+
+cat > ${testname}-2.samp <<'_EOF_'
+Content-type: text/plain
+
+AutoGen form processing error:
+cgi.tpl:9:22: In expression (define foo bogus):
+cgi.tpl:9:22: Unbound variable: bogus
+Scheme evaluation error. AutoGen ABEND-ing in template
+ cgi.tpl on line 9
+Failing Guile command: = = = = =
+
+(define foo "")
+ (if (exist? "break") (set! foo bogus))
+
+=================================
+_EOF_
+${EGREP} -v '^in state' ${testname}-2.test > ${testname}-2.res
+cmp -s ${testname}-2.samp ${testname}-2.res || {
+ exec >&2
+ echo Your Guile library does not handle error traps correctly and causes
+ echo garbage to be emitted instead. Do not use this autogen as a CGI service.
+}
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of html.test
diff --git a/agen5/test/in.test b/agen5/test/in.test
new file mode 100755
index 0000000..c3793a9
--- /dev/null
+++ b/agen5/test/in.test
@@ -0,0 +1,95 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# in.test --- Verify that the "in?" predicate works
+#
+# Time-stamp: "2010-06-26 16:05:12 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<_EOF_
+[++ AutoGen5 template out ++][++
+
+(define stack-list (stack "foo.bar"))
+(string-append
+ (if (in? (get "baz") stack-list) "success" "FAIL")
+ "\n"
+ (if (in? (get "oops") stack-list) "FAIL" "success")
+) ++][++
+
+IF .true ++]
+success[++
+ELSE ++]
+FAILURE[++
+ENDIF ++]-[++ .true ++][++
+
+IF .false ++]
+FAILURE[++
+ELSE ++]
+success[++
+ENDIF ++]-[++ .false ++]
+_EOF_
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo creating ${testname}.def
+cat > ${testname}.def <<_EOF_
+AutoGen definitions ${testname};
+foo = { bar = one; };
+foo = { bar = two; };
+foo = { bar = three; };
+foo = { bar = four; };
+baz = three;
+oops = oops;
+true = true;
+false = false;
+_EOF_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+set -x
+echo creating ${testname}.ok
+# this is the output we should expect to see
+cat > ${testname}.ok <<'_EOF_'
+success
+success
+success-true
+success-false
+_EOF_
+
+run_ag x ${testname}.def || failure autogen failed
+cmp -s ${testname}.ok ${testname}.out || \
+ failure "`diff ${testname}.ok ${testname}.test`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of in.test
diff --git a/agen5/test/include.test b/agen5/test/include.test
new file mode 100755
index 0000000..2b1ca88
--- /dev/null
+++ b/agen5/test/include.test
@@ -0,0 +1,80 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# include.test --- test include functionality
+#
+# Time-stamp: "2012-08-11 08:03:16 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.in
+cat > ${testname}.in <<_EOF_
+<= AutoGen5 Template
+# this is just a test
+test =>
+<= v-name =>: <= \`echo This is an ${testname} test\` =>
+_EOF_
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<_EOF_
+[= AutoGen5 Template
+# this is just a test
+
+test =]
+[= Include "${testname}.in" =]
+_EOF_
+
+mkdir ${testname}.d ${testname}.d/good
+cat > ${testname}.d/${testname}.def <<- _EOF_
+ AutoGen Definitions ${testname}.tpl;
+ #include good/${testname}-aux.def
+ _EOF_
+
+echo "v-name = Verify;" > ${testname}.d/good/${testname}-aux.def
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+
+echo creating ${testname}.ok
+# this is the output we should expect to see
+cat > ${testname}.ok <<_EOF_
+Verify: This is an ${testname} test
+_EOF_
+
+AGCMD="-L ${testname}.d/bad -L ${testname}.d/bad/good"
+
+run_ag x ${AGCMD} ${testname}.d/${testname}.def || \
+ failure ${AGCMD} failed
+cmp -s ${testname}.test ${testname}.ok || \
+ failure "unexpected output
+ `diff -u ${testname}.test ${testname}.ok `"
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of include.test
diff --git a/agen5/test/leave.test b/agen5/test/leave.test
new file mode 100755
index 0000000..9476d49
--- /dev/null
+++ b/agen5/test/leave.test
@@ -0,0 +1,105 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# leave.test --- test return/next/break functionality
+#
+# Time-stamp: "2012-04-07 09:03:06 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILES # # # # # # # # #
+
+echo creating $testname.tlib
+cat > $testname.tlib <<'_EOF_'
+[= AutoGen5 Template test =]
+[= RETURN =]
+BOGUS
+_EOF_
+
+echo creating $testname.tpl
+cat > $testname.tpl <<_EOF_
+[= AutoGen5 Template test =]
+[=
+INVOKE macro
+=][=
+DEFINE macro =][=
+
+FOR value =][=
+ IF (= 1 (for-index)) =][= BREAK =][= ENDIF =]
+BOGUS
+[= ENDFOR =][=
+
+FOR value =][=
+ CASE (for-index) =][=
+ == 4 =][=
+ * =][= CONTINUE =][=
+ ESAC =][= (for-index) =] Okay.[=
+ INCLUDE "$testname.tlib" =][=
+
+ RETURN \=]
+
+BOGUS
+[= ENDFOR =][= ENDDEF =]
+_EOF_
+
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo creating $testname.def
+cat > $testname.def <<_EOF_
+autogen definitions $testname;
+
+value[1] = first;
+value[2] = secondary;
+value[4] = tertiary;
+value[6] = last;
+
+_EOF_
+
+# this is the output we should expect to see
+echo 4 Okay. > $testname.samp
+
+run_ag x $testname.def || \
+ failure "autogen failed"
+set -x
+cmp -s $testname.samp $testname.test || \
+ failure "`diff $testname.samp $testname.test`"
+
+# # # # # # # # # # TEMPLATE FILES # # # # # # # # #
+
+echo creating $testname.tlib
+cat > $testname.tlib <<'_EOF_'
+[= AutoGen5 Template test =]
+[= BREAK =]
+BOGUS
+_EOF_
+
+run_ag x -b $testname-bad $testname.def 2>/dev/null && \
+ failure "processed broken template"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of leave.test
diff --git a/agen5/test/license.test b/agen5/test/license.test
new file mode 100755
index 0000000..5925acf
--- /dev/null
+++ b/agen5/test/license.test
@@ -0,0 +1,114 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# license.test --- test license functionality
+#
+# Time-stamp: "2010-06-26 16:05:08 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<_EOF_
+[= AutoGen5 template test =]
+/*
+[= (license "${testname}" "${testname}" "Auto-Gen" " * " ) =]
+ */
+_EOF_
+
+# # # # # # # # # # LICENSE FILE # # # # # # # # #
+
+echo creating ${testname}.lic
+cat > ${testname}.lic <<'_EOF_'
+This is a bogus license granted by %2$s for %1$s.
+Use it in good health
+_EOF_
+
+# # # # # # # # # # EXTEND FILES TO PAGESIZE # # # # # # # # #
+
+cat > ${testname}-extend.c <<- _EOF_
+ #define HAVE_CONFIG_H 1
+ #include "config.h"
+ #include "compat/compat.h"
+
+ int main( int argc, char** argv ) {
+ char z_tail[] = "=]\n */\n";
+ long offset = 0L - (sizeof(z_tail) - 1);
+ struct stat sb;
+ char* file;
+ size_t sz;
+ FILE* fp;
+
+ file = *++argv;
+ fp = fopen(file, "a");
+ if (fp == NULL) return 1;
+ if (stat(file, &sb) != 0) return 1;
+ sz = 0x2000 - (sb.st_size & 0x1FFFUL);
+ while (sz > 0) { putc( '\n', fp ); sz--; }
+ fclose(fp);
+
+ file = *++argv;
+ fp = fopen( file, "r+" );
+ if (fp == NULL) return 1;
+ if (stat(file, &sb) != 0) return 1;
+ fseek(fp, offset, SEEK_END);
+ sz = 0x2000 - (sb.st_size & 0x1FFFUL);
+ while (sz > 0) { putc( '\n', fp ); sz--; }
+ fputs(z_tail, fp);
+ fclose(fp);
+
+ return 0; }
+ _EOF_
+
+Csrc=${testname}-extend
+compile
+
+./${testname}-extend ${testname}.lic ${testname}.tpl || \
+ failure "Could not extend license/template files to 8KB"
+ls -l ${testname}.???
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+set -x
+echo creating ${testname}.out
+# this is the output we should expect to see
+cat > ${testname}.out <<_EOF_
+/*
+ * This is a bogus license granted by Auto-Gen for ${testname}.
+ * Use it in good health
+ */
+_EOF_
+
+run_ag x -b ${testname} --no-def -T ${testname}.tpl || \
+ failure autogen failed
+cmp -s ${testname}.test ${testname}.out || failure unexpected output
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of license.test
diff --git a/agen5/test/line.test b/agen5/test/line.test
new file mode 100755
index 0000000..c0462f0
--- /dev/null
+++ b/agen5/test/line.test
@@ -0,0 +1,68 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# line.test --- test (tpl-file-line) functionality
+#
+# Time-stamp: "2011-02-02 12:09:53 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+${SED} 's/^ *[0-9]*: //' > ${testname}.tpl << _EOTPL_
+ 1: [= AutoGen5 Template txt =]
+ 2: ${testname} Test
+ 3: [= (define ix 0) (define ct 63) =]
+ 4: [=WHILE (< ix ct) \=]
+ 5: [= (set! ix (+ ix 1))
+ 6: (sprintf "test %2d of %2d: %s\n" ix ct (tpl-file-line "%2\$d"))
+ 7: \=]
+ 8: [=ENDWHILE \=]
+ 9: End ${testname} Test
+_EOTPL_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+set -x
+echo creating ${testname}.out
+# this is the output we should expect to see
+cat > ${testname}.out <<- \_EOF_
+ line Test
+
+ End line Test
+ _EOF_
+
+run_ag x --base=${testname} --no-def --override=${testname}.tpl || \
+ failure autogen failed
+${EGREP} -v ' of 63: 5$' ${testname}.txt > ${testname}.test
+
+cmp -s ${testname}.test ${testname}.out || failure unexpected output
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of line.test
diff --git a/agen5/test/loop.test b/agen5/test/loop.test
new file mode 100755
index 0000000..ef92af5
--- /dev/null
+++ b/agen5/test/loop.test
@@ -0,0 +1,78 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# loop.test --- test FOR loop
+#
+# Time-stamp: "2010-06-26 16:04:59 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+limit=32
+cat > ${testname}.tpl <<- _EOTPL_
+ [= AutoGen5 Template test =]
+ ${testname} Test
+ [= (define ix 0) (define ct ${limit}) =][=
+
+ WHILE (< ix ct) =][=
+ (set! ix (+ ix 1)) =][=
+ (sprintf "test %2d of %2d: %s\n"
+ ix ct (tpl-file-line "%2\$d")) =][=
+ ENDWHILE
+
+ =]End ${testname} Test
+ _EOTPL_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+set -x
+echo creating ${testname}.base
+
+# this is the output we should expect to see
+#
+exec 3> ${testname}.base
+echo "${testname} Test" >&3
+ix=1
+while test $ix -le $limit
+do printf "test %2d of ${limit}: 7\n" $ix
+ ix=`expr $ix + 1`
+done >&3
+echo "End ${testname} Test" >&3
+exec 3>&-
+
+run_ag x --base=${testname} --no-def --override=${testname}.tpl || \
+ failure autogen failed
+
+cmp -s ${testname}.base ${testname}.test || \
+ failure "unexpected output: `diff ${testname}.base ${testname}.test`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of loop.test
diff --git a/agen5/test/make.test b/agen5/test/make.test
new file mode 100755
index 0000000..cfa55dd
--- /dev/null
+++ b/agen5/test/make.test
@@ -0,0 +1,91 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# make.test --- test makefile script manufacture
+#
+# Time-stamp: "2010-06-26 16:04:55 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<'_EOF_'
+[= AutoGen5 Template
+
+=]
+== This source:
+[=
+
+ (out-push-new)
+
+=]
+foo=`pwd` && ls -l $foo
+bar=$foo continue=command \
+make macros: $(MAKE) $* $@ $< $% $?
+shell vars: ${MAKE} $# $F ${?} ${*} $$
+[=
+(define txt (out-pop #t))
+(string-append txt "\n== converts to:\n\n" (makefile-script txt))
+=]
+_EOF_
+
+# # # # # # # SAMPLE OUTPUT FILE # # # # # #
+
+echo creating ${testname}.out in `pwd`
+# this is the output we should expect to see
+cat > ${testname}.samp <<'_EOF_'
+== This source:
+
+foo=`pwd` && ls -l $foo
+bar=$foo continue=command \
+make macros: $(MAKE) $* $@ $< $% $?
+shell vars: ${MAKE} $# $F ${?} ${*} $$
+
+== converts to:
+
+ foo=`pwd` && ls -l $$foo ; \
+ bar=$$foo continue=command \
+ make macros: $(MAKE) $* $@ $< $% $? ; \
+ shell vars: $${MAKE} $$# $$F $${?} $${*} $$$$
+_EOF_
+
+# # # # # # # RUN AUTOGEN # # # # # #
+
+run_ag x -T ${testname}.tpl --no-def > ${testname}.test || \
+ failure autogen failed
+
+# # # # # # # TEST RESULTS # # # # # #
+
+cmp -s ${testname}.samp ${testname}.test || \
+ failure "`diff ${testname}.samp ${testname}.test`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of make.test
diff --git a/agen5/test/match.test b/agen5/test/match.test
new file mode 100755
index 0000000..def13a3
--- /dev/null
+++ b/agen5/test/match.test
@@ -0,0 +1,72 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# match.test --- test the "match-value?" scheme
+#
+# Time-stamp: "2010-06-26 16:04:51 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<'_EOF_'
+[= AutoGen5 Template test =]
+ ==* "sec" [= IF (match-value? ==* "foo.valu" "sec" )
+ =]YES[=ELSE=]FAIL[=ENDIF=]
+ ==* "SEC" [= IF (match-value? ==* "foo.valu" "SEC" )
+ =]FAIL[=ELSE=]YES[=ENDIF=]
+ *=* "rST" [= IF (match-value? *=* "foo.valu" "rST" )
+ =]YES[=ELSE=]FAIL[=ENDIF=]
+ *==* "rST" [= IF (match-value? *==* "foo.valu" "rST" )
+ =]FAIL[=ELSE=]YES[=ENDIF=]
+_EOF_
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo creating ${testname}.def
+cat > ${testname}.def <<_EOF_
+autogen definitions ${testname}.tpl;
+
+foo = { valu = first.0; valu = primary.0; };
+foo = { valu = first.1; valu = secondary.1; };
+foo = { valu = first.2; };
+foo = { valu = first.3; valu = tertiery.3; };
+_EOF_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+
+run_ag x ${testname}.def || \
+ failure could not generate output
+${EGREP} FAIL ${testname}.test && \
+ failure some ${testname} tests failed
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of match.test
diff --git a/agen5/test/opts.test b/agen5/test/opts.test
new file mode 100755
index 0000000..489e30f
--- /dev/null
+++ b/agen5/test/opts.test
@@ -0,0 +1,91 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# opts.test --- Verify the handling of options
+#
+# Time-stamp: "2011-12-04 05:12:42 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. ./defs
+
+# Fetch the options files
+#
+unstamp()
+{
+ # The "zDetail" and zCopyrightNotice text gets formatted with "fmt -w 75".
+ # The different "fmt" implementations behave differently.
+ #
+ ${SED} -e "${sed_omit_license}" \
+ -e '/ extracted from.* line [1-9]/d' \
+ -e '/static char const zDetail/,/";$/d' \
+ -e '/static char const zCopyright/,/";$/d' \
+ -e '/static char const zLicenseDescrip/,/";$/d' \
+ -e '/ "autogen is free software: /,/www\.gnu\.org\/licenses/d' \
+ $1 > $2 ||
+ failure Cannot remove stamps from $1
+}
+
+workdir=`pwd`
+rm -f ../VERSION ./opts.* || :
+
+cd ${top_srcdir}/agen5
+unstamp opts.c ${workdir}/opts.c.base
+unstamp opts.h ${workdir}/opts.h.base
+cp opts.def ${workdir}/.
+cp -f ${top_srcdir}/VERSION ${workdir}/..
+
+cd ${workdir}
+set -x
+ls -l * ../VERSION > $testname.log
+
+echo Checking for "'define DEBUG'" options
+if ${GREP} 'define DEBUG' ${srcdir}/../opts.h
+then
+ AGCMD="-DDEBUG=1"
+else
+ AGCMD=""
+fi
+
+run_ag x ${AGCMD} opts.def || {
+ rm -f ../VERSION
+ failure ${AGCMD} opts.def
+}
+
+rm -f ../VERSION
+
+unstamp opts.c opts.c.res
+echo diff opts.c.base opts.c.res
+diff opts.c.base opts.c.res || \
+ failure "`diff -c opts.c.base opts.c.res`"
+
+unstamp opts.h opts.h.res
+echo diff opts.h.base opts.h.res
+diff opts.h.base opts.h.res || \
+ failure "`diff -c opts.h.base opts.h.res`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of opts.test
diff --git a/agen5/test/output.test b/agen5/test/output.test
new file mode 100755
index 0000000..06aeb72
--- /dev/null
+++ b/agen5/test/output.test
@@ -0,0 +1,120 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# include.test --- test include functionality
+#
+# Time-stamp: "2010-06-26 16:04:42 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating $testname.tpl
+cat > $testname.tpl <<'EOF'
+<= AutoGen5 template test =>
+<=(out-push-new)
+
+=>This is sample output
+<= `echo echoed text.` =><=
+(out-suspend "here")
+(out-push-new)
+=>This text is from another diversion.
+<=
+(out-suspend "there")
+=>This is the first output text.
+<=(out-resume "here")
+=>
+Final text<=
+
+(define text (out-pop #t)) =><=
+
+DEFINE wrapper
+
+=>BEGIN
+<=(out-resume "there") (out-pop #t)
+=><=
+(. text)=>
+END<=
+
+ENDDEF wrapper =><=
+
+wrapper =>
+Done.
+EOF
+
+# # # # # # # SAMPLE OUTPUT FILE # # # # # #
+
+echo creating $testname.out in `pwd`
+# this is the output we should expect to see
+cat > $testname.samp <<'EOF'
+This is the first output text.
+BEGIN
+This text is from another diversion.
+This is sample output
+echoed text.
+Final text
+END
+Done.
+EOF
+
+# # # # # # # RUN AUTOGEN # # # # # #
+
+run_ag nodef -b $testname -T $testname.tpl --no-def || \
+ failure autogen failed
+
+# # # # # # # TEST RESULTS # # # # # #
+
+cmp -s $testname.samp $testname.test || \
+ failure "`diff $testname.samp $testname.test`"
+
+# # # # # # # EMPTY DEFINITIONS FILE # # # # # #
+
+cat > $testname.def <<EOF
+AutoGen Definitions $testname.tpl;
+EOF
+
+# # # # # # # RUN AUTOGEN # # # # # #
+
+mv -f $testname.test $testname.tst1 || \
+ failure moving output-1 failed
+
+run_ag def $testname.def || \
+ failure autogen failed
+
+mv -f $testname.test $testname.tst2 || \
+ failure moving output-2 failed
+
+# # # # # # # TEST RESULTS # # # # # #
+
+cmp -s $testname.tst1 $testname.tst2 || \
+ failure "`diff $testname.tst1 $testname.tst2`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of output.test
diff --git a/agen5/test/pseudo.test b/agen5/test/pseudo.test
new file mode 100755
index 0000000..f5b87c7
--- /dev/null
+++ b/agen5/test/pseudo.test
@@ -0,0 +1,103 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# pseudo.test --- test the select pseudo option
+#
+# Time-stamp: "2010-06-26 16:04:38 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<- \_EOF_
+ [= AutoGen5 Template
+
+ (define f-name "")
+
+ h=(begin
+ (set! f-name (getenv "incdir"))
+ (if (not (string? f-name)) (set! f-name "."))
+ (set! f-name (string-append f-name "/%s-hdr.%s"))
+ (shellf
+ "d=`dirname %s`
+ test -d ${d} || mkdir -p $d || die cannot mkdir $d"
+ f-name)
+ f-name
+ )
+
+ c=(begin
+ (set! f-name (getenv "srcdir"))
+ (if (not (string? f-name)) (set! f-name "."))
+ (set! f-name (string-append f-name "/%s-body.%s"))
+ (shellf
+ "d=`dirname %s`
+ test -d ${d} || mkdir -p $d || die cannot mkdir $d"
+ f-name)
+ f-name
+ )
+
+ # end of pseudo
+ =]
+ [=
+
+ (sprintf "two file create %s: " (suffix)) =][=
+
+ CASE (suffix) =][=
+
+ == h =]HEADER FILE[=
+ == c =]BODY 4 FILE[=
+ * =][= (error "woops") =][=
+
+ ESAC =]
+ _EOF_
+
+# # # # # # # # # # RUN TESTS # # # # # # #
+
+incdir=${testname}-inc
+srcdir=${testname}-src
+
+export incdir srcdir
+
+run_ag x --no-def -T${testname}.tpl -b${testname} || \
+ failure autogen --no-def -T${testname}.tpl -b${testname}
+
+f=${incdir}/${testname}-hdr.h
+test -f ${f} || \
+ failure missing file: ${f}
+${FGREP} 'two file create h: HEADER FILE' ${f} || failure bad contents for $f
+
+f=${srcdir}/${testname}-body.c
+test -f ${f} || \
+ failure missing file: ${f}
+${FGREP} 'two file create c: BODY 4 FILE' ${f} || failure bad contents for $f
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of pseudo.test
diff --git a/agen5/test/reorder.test b/agen5/test/reorder.test
new file mode 100755
index 0000000..55cfb82
--- /dev/null
+++ b/agen5/test/reorder.test
@@ -0,0 +1,107 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# reorder.test --- test reorder functionality
+#
+# Time-stamp: "2010-06-26 16:04:32 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating $testname.tpl
+cat > $testname.tpl <<'_EOF_'
+<= AutoGen5 template test =>
+From zero:<=
+
+FOR a (for-from 0) (for-by 1) (for-sep ",")=>
+<=(sprintf "%5d: " (for-index))=><=
+ ?% elt %s absent =><=
+ IF (first-for?) => first loop<= ENDIF =><=
+ IF (last-for? ) => last loop<= ENDIF =><=
+ENDFOR =>
+
+From start by two:<=
+
+FOR a (for-by 2) (for-sep ",")=>
+<=(sprintf "%5d: " (for-index)) =><=
+ ?% elt %s absent =><=
+ IF (first-for?) => first loop<= ENDIF =><=
+ IF (last-for? ) => last loop<= ENDIF =><=
+ENDFOR =>
+_EOF_
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo creating $testname.def
+cat > $testname.def <<_EOF_
+autogen definitions $testname;
+a[ 3] = { elt = three; };
+a[ 5] = { elt = five; };
+a[12] = { elt = twelve; };
+a[ 8] = { elt = eight; };
+a[ 1] = { elt = one; };
+a[ 2] = { elt = two; };
+_EOF_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+
+echo creating $testname.out
+# this is the output we should expect to see
+cat > $testname.out <<_EOF_
+From zero:
+ 0: absent first loop,
+ 1: one,
+ 2: two,
+ 3: three,
+ 4: absent,
+ 5: five,
+ 6: absent,
+ 7: absent,
+ 8: eight,
+ 9: absent,
+ 10: absent,
+ 11: absent,
+ 12: twelve last loop
+
+From start by two:
+ 1: one first loop,
+ 3: three,
+ 5: five,
+ 7: absent,
+ 9: absent,
+ 11: absent last loop
+_EOF_
+
+run_ag x $testname.def || failure autogen failed
+cmp -s $testname.test $testname.out || failure unexpected output
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of reorder.test
diff --git a/agen5/test/shell.test b/agen5/test/shell.test
new file mode 100755
index 0000000..269f46a
--- /dev/null
+++ b/agen5/test/shell.test
@@ -0,0 +1,165 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# shell.test --- test functionality of switching shells
+#
+# Time-stamp: "2012-05-12 19:56:39 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# The test will verify that a real shell processes the declarations
+# and our weirdo shell handles the template.
+#
+# ----------------------------------------------------------------------
+
+exec 9>&2
+
+. ./defs
+
+${FGREP} '#define SHELL_ENABLED ' ${top_builddir}/config.h > /dev/null 2>&1
+test $? -eq 0 || exit 0
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+cat > ${testname}.c <<- \_EOF_
+ #include <stdio.h>
+ #include <string.h>
+ #include <ctype.h>
+ #define NUL '\0'
+ char buf[ 4096 ];
+ int
+ main( int argc, char** argv )
+ {
+ char *pz;
+ for (;;) {
+ pz = fgets(buf, sizeof(buf),stdin);
+ if (pz == NULL)
+ return 1; /* must get something every time */
+ while (isspace(*pz)) pz++;
+ if (*pz != NUL) break; /* ignore initial blank lines */
+ }
+
+ for (;;) {
+ if (*pz == '#') goto next_line;
+ if (strncmp( pz, "cd ", 3 ) == 0) goto next_line;
+ if ((strncmp( pz, "echo", 4 ) == 0) && isspace( pz[4] )) {
+ pz += 5;
+ while (isspace(*pz)) pz++; /* suppress the 'echo' */
+ }
+ if (*pz == '\0') pz--; /* always force a newline */
+ fputs( pz, stdout );
+ fflush( stdout );
+
+ next_line:
+ pz = fgets(buf, sizeof(buf),stdin);
+ if (pz == NULL)
+ break;
+ while (isspace(*pz)) pz++;
+ }
+ return 0;
+ }
+ _EOF_
+
+compile
+
+# The backslashes are stripped by the here-doc processing
+#
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<- _EOF_
+ <= AutoGen5 template test
+ (setenv "SHELL" "./${testname}") =>
+ <=\` echo SHELL=\$SHELL \`=>
+ Some <=dummy=> text
+ <= FOR foo =>
+ foo[<=(for-index)=>] = <=foo=>
+ raw-shell-str: <=(raw-shell-str (get "foo"))=>
+ shell-str: <=(shell-str (get "foo"))=>
+ sub-shell-str: <=(sub-shell-str (get "foo"))=>
+ <= ENDFOR =>
+ <=\` : This is a final test \`=>
+ _EOF_
+
+echo creating ${testname}.def
+cat >${testname}.def <<- \_EOF_
+ AutoGen Definitions shell.tpl;
+
+ foo = "''foo'' 'foo' \"foo\" `foo` $foo";
+ foo = '\\\'bar\\\' \\"bar\\" \`bar\` \$bar';
+ foo = '\\\\\'BAZ\\\\\' \\\\"BAZ\\\\" \\\`BAZ\\\` \\\$BAZ';
+ dummy = `echo "mumble"`; /* processed with regular shell */
+ _EOF_
+
+# this is the output we should expect to see
+cat > ${testname}.sample <<- \_EOF_
+ SHELL=$SHELL
+ Some "mumble" text
+
+ foo[0] = ''foo'' 'foo' "foo" `foo` $foo
+ raw-shell-str: \'\''foo'\'\'' '\''foo'\'' "foo" `foo` $foo'
+ shell-str: "''foo'' 'foo' \"foo\" `foo` $foo"
+ sub-shell-str: `''foo'' 'foo' "foo" \`foo\` $foo`
+
+ foo[1] = \'bar\' \"bar\" \`bar\` \$bar
+ raw-shell-str: '\'\''bar\'\'' \"bar\" \`bar\` \$bar'
+ shell-str: "\\'bar\\' \\\"bar\\\" \`bar\` \$bar"
+ sub-shell-str: `\\'bar\\' \"bar\" \\\`bar\\\` \$bar`
+
+ foo[2] = \\'BAZ\\' \\"BAZ\\" \\`BAZ\\` \\$BAZ
+ raw-shell-str: '\\'\''BAZ\\'\'' \\"BAZ\\" \\`BAZ\\` \\$BAZ'
+ shell-str: "\\\\'BAZ\\\\' \\\\\"BAZ\\\\\" \\\`BAZ\\\` \\\$BAZ"
+ sub-shell-str: `\\\\'BAZ\\\\' \\\"BAZ\\\" \\\\\`BAZ\\\\\` \\\$BAZ`
+
+ : This is a final test
+ _EOF_
+
+run_ag x --shell=$PWD/shell ${testname}.def || \
+ failure "autogen ${testname}.def"
+
+${GREP} -v '^AGexe=' ${testname}.test > ${testname}.XX
+mv -f ${testname}.XX ${testname}.test
+if cmp -s ${testname}.test ${testname}.sample
+then cleanup
+ exit 0
+fi
+
+if ${FGREP} 'SHELL=' ${testname}.test > /dev/null 2>&1
+then
+ if ${FGREP} 'SHELL=$SHELL' ${testname}.test > /dev/null 2>&1
+ then : ; else
+ cat >&9 <<- _EOF_
+ The ${testname}.test output file does not start with "SHELL=\$SHELL"
+ This is because you have a Guile library that cannot modify
+ the environment. This is a known breakage on some platforms
+ (viz., BSD derivatives). Sorry.
+ _EOF_
+ ${FGREP} 'SHELL=' ${testname}.test >&9
+ cleanup
+ exit 0
+ fi
+fi
+
+failure "`set +x;diff -c ${testname}.sample ${testname}.test`"
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of shell.test
diff --git a/agen5/test/snarf.test b/agen5/test/snarf.test
new file mode 100755
index 0000000..c03e408
--- /dev/null
+++ b/agen5/test/snarf.test
@@ -0,0 +1,267 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# snarf.test --- test the extraction of scm-type definitions
+#
+# Time-stamp: "2012-03-04 19:48:23 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # SOURCE FILE # # # # # # # # #
+
+echo creating ${testname}.c
+cat > ${testname}.c <<_EOF_
+#include "${testname}.h"
+#include "${testname}.ini"
+/*=gfunc test_to_example_x
+ *
+ * exparg: in, test input arg desc, optional, list
+ *
+=*/
+SCM
+test_scm_test_to_example_x(SCM in)
+{
+ return in;
+}
+
+/*=symbol mumble_check
+ *
+ * init_val: SCM_BOOL_T
+=*/
+/*=symbol bumble_it
+ *
+ * const_val: 100L
+ * global:
+=*/
+/*=syntax guile_syntax_ele
+ *
+ * type: scm_makacro
+ * cfn: scm_m_undefine
+=*/
+_EOF_
+
+# # # # # # # # # # PROCESS SOURCE FILE # # # # # # # # #
+
+f=`echo ${AGexe} | ${SED} 's/ .*//'`
+
+agsrc=`cd $top_srcdir/agen5 && pwd`
+tplsrc=`cd $top_srcdir/autoopts/tpl && pwd`
+
+cat > ${testname}.cfg <<- _EOF_
+ subblock exparg=arg_name,arg_desc,arg_optional,arg_list
+ template snarf.tpl
+ srcfile
+ assign group = ${testname}_grp
+ assign init = Chosen_init
+ base-name ${testname}
+ agarg -L$agsrc
+ agarg -L$tplsrc
+ input ${testname}.c
+ autogen ${f}
+ _EOF_
+unset DEBUG_ENABLED
+
+echo "getdefs load=${testname}.cfg ${testname}.c"
+${VERBOSE} && {
+ AUTOGEN_TRACE=everything
+ AUTOGEN_TRACE_OUT=">>${testname}-ag-log.txt"
+ export AUTOGEN_TRACE AUTOGEN_TRACE_OUT
+}
+${GDexe} load=${testname}.cfg || \
+ failure getdefs load=${testname}.cfg
+
+${SED} -e "${sed_omit_license}" -e '/^#undef *NEW_PROC *$/,$d' \
+ ${testname}.ini > ${testname}.ini.tst1
+
+${SED} "${sed_omit_license}" ${testname}.h > ${testname}.h.tst1
+
+# # # # # # # # # # EXPECTED INI FILE # # # # # # # # #
+
+echo creating ${testname}.ini.OK1
+cat > ${testname}.ini.OK1 <<'_EOF_'
+#include "snarf.h"
+typedef SCM (*scm_callback_t)(void);
+void Chosen_init(void);
+
+extern SCM snarf_grp_scm_sym_bumble_it = SCM_BOOL_F;
+static SCM snarf_grp_scm_sym_mumble_check = SCM_BOOL_F;
+#if GUILE_VERSION >= 108000
+#define NEW_PROC(_As, _Ar, _Ao, _Ax, _An) \
+ scm_c_define_gsubr((char*)(_As), \
+ _Ar, _Ao, _Ax, (scm_callback_t)(void*)ag_scm_ ## _An)
+#else
+#define NEW_PROC(_As, _Ar, _Ao, _Ax, _An) \
+ gh_new_procedure((char*)(_As), (scm_callback_t)(void*)ag_scm_ ## _An, \
+ _Ar, _Ao, _Ax)
+#endif
+
+/*
+ * snarf_grp Initialization procedure.
+ */
+void
+Chosen_init(void)
+{
+static char const g_nm[55] =
+/* 0 */ "test->example!\0"
+/* 15 */ "guile-syntax-ele\0"
+/* 32 */ "bumble-it\0"
+/* 42 */ "mumble-check";
+
+ NEW_PROC(g_nm + 0, 0, 0, 1, test_to_example_x);
+ scm_make_synt(g_nm+15, scm_makacro, scm_m_undefine);
+ snarf_grp_scm_sym_bumble_it = scm_permanent_object(SCM_CAR (scm_intern0 (g_nm+32)));
+ snarf_grp_scm_sym_mumble_check = scm_permanent_object(SCM_CAR (scm_intern0 (g_nm+42)));
+}
+_EOF_
+
+cmp ${testname}.ini.tst1 ${testname}.ini.OK1 || \
+ failure "`diff ${testname}.ini.tst1 ${testname}.ini.OK1`"
+
+# # # # # # # # # # EXPECTED HEADER FILE # # # # # # #
+
+echo creating ${testname}.h.OK
+cat > ${testname}.h.OK <<_EOF_
+#ifndef GUILE_PROCS_SNARF_H_GUARD
+#define GUILE_PROCS_SNARF_H_GUARD 1
+#if GUILE_VERSION >= 108000
+# include <libguile.h>
+#else
+# include <guile/gh.h>
+#endif
+
+typedef enum {
+ GH_TYPE_UNDEFINED = 0,
+ GH_TYPE_BOOLEAN,
+ GH_TYPE_SYMBOL,
+ GH_TYPE_CHAR,
+ GH_TYPE_VECTOR,
+ GH_TYPE_PAIR,
+ GH_TYPE_NUMBER,
+ GH_TYPE_STRING,
+ GH_TYPE_PROCEDURE,
+ GH_TYPE_LIST,
+ GH_TYPE_INEXACT,
+ GH_TYPE_EXACT
+} teGuileType;
+
+extern SCM snarf_grp_scm_test_to_example_x(SCM);
+extern SCM snarf_grp_scm_sym_bumble_it;
+
+#endif /* GUILE_PROCS_SNARF_H_GUARD */
+_EOF_
+
+cmp ${testname}.h.* || \
+ failure "`diff ${testname}.h.*`"
+
+# # # # # # # # # # PROCESS SOURCE FILE AGAIN # # # # # # # # #
+
+cp ${testname}.cfg ${testname}.cfg1
+
+echo 'assign debug-enabled = true' >> ${testname}.cfg
+DEBUG_ENABLED=true
+export DEBUG_ENABLED
+
+${GDexe} load=${testname}.cfg || \
+ failure getdefs load=${testname}.cfg
+
+${SED} -e "${sed_omit_license}" \
+ -e '/^#undef *NEW_PROC$/,$d' \
+ ${testname}.ini > ${testname}.ini.tst2
+
+${SED} "${sed_omit_license}" ${testname}.h > ${testname}.h.tst2
+
+# # # # # # # # # # EXPECTED INI FILE # # # # # # # # #
+
+echo creating ${testname}.ini.OK2
+cat > ${testname}.ini.OK2 <<'_EOF_'
+#include "snarf.h"
+typedef SCM (*scm_callback_t)(void);
+void Chosen_init(void);
+
+extern SCM snarf_grp_scm_sym_bumble_it = SCM_BOOL_F;
+static SCM snarf_grp_scm_sym_mumble_check = SCM_BOOL_F;
+#ifdef DEBUG_ENABLED
+static SCM
+agrelay_scm_test_to_example_x(SCM scm0)
+{
+ if (OPT_VALUE_TRACE >= TRACE_EVERYTHING) {
+ static char const proc_z[] =
+ "Called ag_scm_test_to_example_x()\n";
+ fwrite(proc_z, sizeof(proc_z) - 1, 1, trace_fp);
+ }
+ return ag_scm_test_to_example_x(scm0);
+}
+
+#if GUILE_VERSION >= 108000
+#define NEW_PROC(_As, _Ar, _Ao, _Ax, _An) \
+ scm_c_define_gsubr((char*)(_As), \
+ _Ar, _Ao, _Ax, (scm_callback_t)(void*)agrelay_scm_ ## _An)
+#else
+#define NEW_PROC(_As, _Ar, _Ao, _Ax, _An) \
+ gh_new_procedure((char*)(_As), (scm_callback_t)(void*)agrelay_scm_ ## _An, \
+ _Ar, _Ao, _Ax)
+#endif
+
+#else /* DEBUG_ENABLED *not* */
+#if GUILE_VERSION >= 108000
+#define NEW_PROC(_As, _Ar, _Ao, _Ax, _An) \
+ scm_c_define_gsubr((char*)(_As), \
+ _Ar, _Ao, _Ax, (scm_callback_t)(void*)ag_scm_ ## _An)
+#else
+#define NEW_PROC(_As, _Ar, _Ao, _Ax, _An) \
+ gh_new_procedure((char*)(_As), (scm_callback_t)(void*)ag_scm_ ## _An, \
+ _Ar, _Ao, _Ax)
+#endif
+#endif /* DEBUG_ENABLED */
+
+/*
+ * snarf_grp Initialization procedure.
+ */
+void
+Chosen_init(void)
+{
+static char const g_nm[55] =
+/* 0 */ "test->example!\0"
+/* 15 */ "guile-syntax-ele\0"
+/* 32 */ "bumble-it\0"
+/* 42 */ "mumble-check";
+
+ NEW_PROC(g_nm + 0, 0, 0, 1, test_to_example_x);
+ scm_make_synt(g_nm+15, scm_makacro, scm_m_undefine);
+ snarf_grp_scm_sym_bumble_it = scm_permanent_object(SCM_CAR (scm_intern0 (g_nm+32)));
+ snarf_grp_scm_sym_mumble_check = scm_permanent_object(SCM_CAR (scm_intern0 (g_nm+42)));
+}
+_EOF_
+
+cmp ${testname}.ini.tst2 ${testname}.ini.OK2 || \
+ failure "`diff ${testname}.ini.tst2 ${testname}.ini.OK2`"
+
+cleanup
+
+##
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of snarf.test
diff --git a/agen5/test/stack.test b/agen5/test/stack.test
new file mode 100755
index 0000000..32317af
--- /dev/null
+++ b/agen5/test/stack.test
@@ -0,0 +1,93 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# stack.test --- test stack and join functionality
+#
+## Time-stamp: "2010-02-24 08:41:38 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<_EOF_
+[= AutoGen5 template test =]
+[=
+
+ (join ", " (stack "foo.bar.baz"))
+
+=]
+[=
+
+ (join ",\n" "one" "two" "three" "four" )
+
+=]
+[=
+
+ (join ", " "foo" (stack "foo.bar.baz") "bar" "baz")
+
+=]
+[= (string-substitute (join "\n" (stack "foo.bar.baz"))
+ '("umb" "le") '("_UMB_" "<=") ) =]
+_EOF_
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo creating ${testname}.def
+cat > ${testname}.def <<_EOF_
+AutoGen definitions ${testname};
+
+foo = { bar = { baz = fumble; }; };
+foo = { bar = { baz = mumble; }; };
+foo = { bar = { baz = grumble; }; };
+_EOF_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+set -x
+echo creating ${testname}.out
+# this is the output we should expect to see
+cat > ${testname}.out <<'_EOF_'
+fumble, mumble, grumble
+one,
+two,
+three,
+four
+foo, fumble, mumble, grumble, bar, baz
+f_UMB_<=
+m_UMB_<=
+gr_UMB_<=
+_EOF_
+
+run_ag x ${testname}.def || failure autogen failed
+cmp -s ${testname}.test ${testname}.out || \
+ failure "`diff ${testname}.*t`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of stack.test
diff --git a/agen5/test/stress.test b/agen5/test/stress.test
new file mode 100755
index 0000000..05dc399
--- /dev/null
+++ b/agen5/test/stress.test
@@ -0,0 +1,68 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# stress.test --- stress test
+#
+## Time-stamp: "2011-03-06 15:26:25 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<_EOF_
+[= AutoGen5 template test =]
+Entry Count = [= (count "entry") =].
+_EOF_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+set -x
+echo creating ${testname}.samp
+ecount=${STRESS_COUNT:-1000}
+# this is the output we should expect to see
+echo "Entry Count = ${ecount}." > ${testname}.samp
+
+(
+ set +x
+ echo "AutoGen Definitions ${testname};"
+ idx=1
+ while test $idx -le ${ecount}
+ do
+ echo "entry = { value = 'val-${idx}'; depth = '${idx}'; const = xx; };"
+ idx=`expr $idx + 1`
+ done
+) | run_ag x -b ${testname} -
+test $? -eq 0 || failure autogen failed
+
+cmp -s ${testname}.test ${testname}.samp || \
+ failure "`diff ${testname}.test ${testname}.samp`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of stress.test
diff --git a/agen5/test/string.test b/agen5/test/string.test
new file mode 100755
index 0000000..dfcabb3
--- /dev/null
+++ b/agen5/test/string.test
@@ -0,0 +1,247 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# string.test --- test string formation rules
+#
+# Time-stamp: "2012-05-12 19:56:52 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# There are five different things we need to examine:
+#
+# 1. That the autogen internal string.
+# 2. What we expect that string to contain.
+# 3. What is generated as the "C" representation
+# 4. What is generated for raw shell strings
+# 5. What is generated for "cooked" shell strings
+#
+# We will compare all these things by generating a C program that
+# will test the various strings and a shell script to invoke the
+# program with the two shell string formats for arguments.
+# The program will also write out the expected string value.
+# That value will be compared with what autogen wrote out
+# as its internal value.
+#
+# All this stuff must be generated carefully.
+# Specifically, the '${testname}' expressions need to
+# be expanded in certain parts of the output file.
+# In those areas, the eof marker must *not* be quoted.
+# In other places (e.g., where defining the strings),
+# rather than hassle with understanding shell quoting rules,
+# instead we *will* quote the EOF marker to avoid
+# any shell interpretation at all!!
+#
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating $testname.tpl
+exec 4> $testname.tpl
+cat >&4 <<_EOF_
+[= AutoGen5 Template c sh =]
+[=
+
+CASE (suffix) =][=
+
+ == c
+
+=]#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifndef STDOUT_FILENO
+# define STDOUT_FILENO 1
+#endif[=
+
+
+ ;; Create a file containing nothing but the
+ ;; autogen internal contents of the string
+ ;;
+ (out-push-new "${testname}.raw")
+
+ =][=string=][=
+
+ (out-pop)
+
+=]
+_EOF_
+
+test -z "$LINENO" && LINENO=`
+ ${GREP} -n FIND-THIS-LINE-NUMBER $0 | sed 's/:.*//'` # close enough
+printf '\nchar zTestFile[] = "%s";\n#line %s\n' \
+ ${testname}.raw `expr $LINENO + 4` >&4
+
+cat >&4 <<'_EOF_'
+char zGened[] = [=(c-string (get "string"))=];
+char zKrGen[] = [=(kr-string (get "string"))=];
+char zExpect[] = "'\f\r\b\v\t\a\n\n"
+ "\\f\\r\\b\\v\\t\\a\\n\n"
+ "\"Wow!\" This'll be \\hard\\'\n"
+ "#endif /* .\n"
+ "and it'll be a \"hassle\"."
+ "\001\002\003\n'";
+#define expectSize ((int)(sizeof(zExpect) - 1))
+int checkStr( char* pz, char const* pzWhat );
+int checkStr( char* pz, char const* pzWhat )
+{
+ static char const zNotMatch[] =
+ "%s generated string mismatches at offset %d of %d\n"
+ "Expected char: 0x%02X saw char: 0x%02X\n"
+ "Expected string:\n==>%s<==\n\n"
+ "Generated string:\n-->%s<--\n\n";
+
+ char* pzE = zExpect;
+ char* pzR = pz;
+ int ix = strlen( pz );
+ int res = 0;
+
+ if (ix != expectSize) {
+ fprintf( stderr, "%s is %d bytes, not %d\n", pzWhat, ix, expectSize );
+ res = 1;
+ }
+
+ for (ix = 0; ix < expectSize; ix++) {
+ if (*(pzE++) != *(pzR++)) {
+ fprintf(stderr, zNotMatch, pzWhat, ix, expectSize,
+ (unsigned)pzE[-1], (unsigned)pzR[-1], zExpect, pz);
+ return 1;
+ }
+ }
+ if (*pzE != '\0') {
+ fputs( "compile error: expected string too long\n", stderr);
+ res = 1;
+ } else if (*pzR != '\0') {
+ fprintf(stderr, "%s has %d residual characters:\n==>%s<==\n",
+ pzWhat, (int)strlen(pzR), pzR);
+ res = 1;
+ }
+ return res;
+}
+
+
+int main( int argc, char** argv )
+{
+ int resCode = 0;
+
+ /*
+ * Write out the expected value to a file.
+ * The "cmp" program will compare it with the
+ * internal version autogen wrote out itself.
+ */
+ write( STDOUT_FILENO, zExpect, sizeof( zExpect )-1);
+ close( STDOUT_FILENO );
+
+ if (sizeof( zGened ) != sizeof( zExpect )) {
+ fputs( "Expected and generated string sizes do not match.\n",
+ stderr );
+ resCode = 1;
+ }
+
+ if (strlen( zGened ) != sizeof( zGened )-1) {
+ fputs( "The generated string contains a NUL.\n", stderr );
+ resCode++;
+ }
+
+ if (checkStr( zGened, "'C' program" ))
+ resCode++;
+
+ if (checkStr( zKrGen, "K&R 'C' program" ))
+ resCode++;
+
+ if (checkStr( argv[1], "Raw shell" ))
+ resCode++;
+
+ if (checkStr( argv[2], "Cooked shell" ))
+ resCode++;
+
+ return resCode;
+}[=
+
+ == sh
+
+=]#! /bin/sh
+set -x
+_EOF_
+
+cat 1>&4 <<_EOF_
+./${testname} [=(raw-shell-str (get "string"))
+ =] [=(shell-str (get "string"))=] > ${testname}.out
+res=\$?
+cmp ${testname}.out ${testname}.raw > /dev/null 2>&1
+
+if [ \$? -ne 0 ]
+then
+ echo the AutoGen internal content did not match expectations
+ res=\`expr \$res + 1\`
+fi
+if [ \$res -eq 0 ]
+then
+ echo All string comparisons pass
+else
+ echo There were \$res string test failures
+ exit \$res
+fi[=
+
+ESAC
+
+=]
+_EOF_
+exec 4>&-
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo creating $testname.def
+echo "autogen definitions $testname.tpl;" > $testname.def
+cat >> $testname.def <<'_EOF_'
+
+string =
+ "'\f\r\b\v\t\a\n
+"
+ '\f\r\b\v\t\a\n
+'
+ '"Wow!" This\'ll be \\hard\\\'
+\#endif /* .
+'
+ "and it'll be a \"hassle\"."
+ "\001\x02\X03\n'";
+
+_EOF_
+
+# # # # # # # # # # RUN THE TESTS # # # # # # # # # # #
+
+SHELL=${SHELL-/bin/sh}
+
+run_ag x $testname.def || failure autogen failed
+
+compile
+
+chmod +x *.sh
+
+./${testname}.sh || failure strings do not match
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of string.test
diff --git a/agen5/test/strtable.test b/agen5/test/strtable.test
new file mode 100755
index 0000000..8c06e44
--- /dev/null
+++ b/agen5/test/strtable.test
@@ -0,0 +1,97 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# strtable.test --- test string-table functionality
+#
+# Time-stamp: "2012-01-07 09:02:42 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<_EOF_
+[= AutoGen5 template test =]
+[=
+
+(string-table-new "scribble")
+(out-push-new) ;; redirect output to temporary
+(define ct 1)
+
+=][=
+
+FOR str IN that was the week that was
+
+=][= (set! ct (+ ct 1)) =]
+ [= (string-table-add-ref "scribble" (get "str")) =],[=
+
+ENDFOR
+
+=][=
+ (out-suspend "main")
+ (emit-string-table "scribble")
+ (emit (sprintf "\n#define STRING_CT %d\n" (- ct 1)))
+ (ag-fprintf 0 "\nchar const * const ap[%d] = {" ct)
+ (out-resume "main")
+ (out-pop #t) ;; now dump out the redirected output
+ ;; and finish: =]
+ NULL };
+_EOF_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+set -x
+echo creating ${testname}.base
+# this is the output we should expect to see
+cat > ${testname}.base <<'_EOF_'
+
+static char const scribble[18] =
+/* 0 */ "that\0"
+/* 5 */ "was\0"
+/* 9 */ "the\0"
+/* 13 */ "week";
+
+#define STRING_CT 6
+
+char const * const ap[7] = {
+ scribble+0,
+ scribble+5,
+ scribble+9,
+ scribble+13,
+ scribble+0,
+ scribble+5,
+ NULL };
+_EOF_
+
+run_ag x -b ${testname} -T ${testname}.tpl --no-defin || \
+ failure autogen failed
+cmp -s ${testname}.base ${testname}.test || \
+ failure "bad output: `diff -c ${testname}.base ${testname}.test`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of strtable.test
diff --git a/agen5/test/strxform.test b/agen5/test/strxform.test
new file mode 100755
index 0000000..cdf043a
--- /dev/null
+++ b/agen5/test/strxform.test
@@ -0,0 +1,87 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# strxform.test --- test string transformation functionality
+#
+# Time-stamp: "2011-02-02 12:02:13 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+${SED} 's/^ *[0-9]*: //' > ${testname}.tpl <<- _EOTPL_
+ 1: [= AutoGen5 Template test =]
+ 2: string input: [= in-str =]
+ 3:
+ 4: string->c-name! [= (string->c-name! (get "in-str")) =]
+ 5: string-upcase! [= (string-upcase! (get "in-str")) =]
+ 6: string-capitalize! [= (string-capitalize! (get "in-str")) =]
+ 7: string-capitalize [= (string-capitalize (get "in-str")) =]
+ 8: string-downcase! [= (string-downcase! (get "in-str")) =]
+ 9: string-downcase [= (string-downcase (get "in-str")) =]
+10: string->camelcase [= (string->camelcase (get "in-str")) =]
+_EOTPL_
+
+cat > ${testname}.def <<- _EOF_
+ AutoGen Definitions ${testname}.tpl;
+ in-str = "The 10quick\tfoxes-jumped/very=\n=high9indeed!";
+ _EOF_
+
+# # # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+set -x
+echo creating ${testname}.out
+# this is the output we should expect to see
+cat > ${testname}.out <<- \_EOF_
+ string input: The 10quick foxes-jumped/very=
+ =high9indeed!
+
+ string->c-name! The 10quick foxes_jumped_very_
+ _high9indeed_
+ string-upcase! THE 10QUICK FOXES-JUMPED/VERY=
+ =HIGH9INDEED!
+ string-capitalize! The 10quick Foxes-Jumped/Very=
+ =High9indeed!
+ string-capitalize The 10quick Foxes-Jumped/Very=
+ =High9indeed!
+ string-downcase! the 10quick foxes-jumped/very=
+ =high9indeed!
+ string-downcase the 10quick foxes-jumped/very=
+ =high9indeed!
+ string->camelcase The10QuickFoxesJumpedVeryHigh9Indeed
+ _EOF_
+
+run_ag x ${testname}.def || failure autogen failed
+
+cmp -s ${testname}.test ${testname}.out || \
+ failure "unexpected output:${nl}`diff ${testname}.out ${testname}.test`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of strxform.test
diff --git a/agen5/test/suffix.test b/agen5/test/suffix.test
new file mode 100755
index 0000000..55997f5
--- /dev/null
+++ b/agen5/test/suffix.test
@@ -0,0 +1,90 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# suffix.test --- test the select suffix option
+#
+# Time-stamp: "2013-03-10 07:10:42 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<'_EOF_'
+[= AutoGen5 Template test =]
+[=
+
+CASE (suffix) =][=
+
+== test =]BOGUS[=
+== "* NONE *" =]No Suffix[=
+== Example =]Example[=
+* =]Bogon ``[=(suffix)=]''[=
+
+ESAC =]
+_EOF_
+
+# # # # # # # # # # EXPECTED OUTPUT FILE # # # # # # #
+
+echo "Example" > ${testname}.Example.test
+echo "No Suffix" > ${testname}.stdout.test
+
+# # # # # # # # # # RUN TESTS # # # # # # #
+nodefopt="--no-def -T${testname}.tpl"
+run_ag ex ${nodefopt} -oExample -b${testname} || \
+ failure autogen ${nodefopt} -oExample -b${testname}
+
+cmp ${testname}.Example* || \
+ failure `diff -c cmp ${testname}.Example*`
+
+# # # # # # # # # # STDOUT TEMPLATE # # # # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<'_EOF_'
+[= AutoGen5 Template =]
+[=
+text =]
+_EOF_
+
+cat > ${testname}.samp <<- EOF
+ This is some text.
+ This should appear in the output.
+EOF
+
+cat > ${testname}.def <<\EOF
+AutoGen Definitions suffix;
+text = `cat suffix.samp`;
+EOF
+
+run_ag sfx ${testname}.def | ${EGREP} -v '^in state ' > ${testname}.out
+cmp ${testname}.out ${testname}.samp || \
+ failure "`diff ${testname}.out ${testname}.samp`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of suffix.test
diff --git a/agen5/test/time.test b/agen5/test/time.test
new file mode 100755
index 0000000..ad46a38
--- /dev/null
+++ b/agen5/test/time.test
@@ -0,0 +1,64 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# time.test --- test modification time settings
+#
+## Time-stamp: "2010-02-24 08:41:34 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+
+echo creating ${testname}.tpl
+cat > ${testname}.tpl <<_EOF_
+[= AutoGen5 template test =]
+Plain text template.
+_EOF_
+
+touch -t 200109110846.00 ${testname}.tpl
+
+run_ag time --source-time -b ${testname} -T ${testname}.tpl --no-definitions || \
+ failure autogen failed
+
+touch -t 200109110846.02 ${testname}.taaa
+
+set -- `ls -t ${testname}.t*`
+
+while :
+do
+ test "${3}" = ${testname}.tpl || break
+ test "${2}" = ${testname}.test || break
+ test "${1}" = ${testname}.taaa || break
+ cleanup
+ exit 0
+done
+
+failure "wrong file time ordering: $*"
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of time.test
diff --git a/agen5/tpLoad.c b/agen5/tpLoad.c
new file mode 100644
index 0000000..9180662
--- /dev/null
+++ b/agen5/tpLoad.c
@@ -0,0 +1,560 @@
+
+/**
+ * @file tpLoad.c
+ *
+ * Time-stamp: "2012-08-11 08:55:46 bkorb"
+ *
+ * This module will load a template and return a template structure.
+ *
+ * This file is part of AutoGen.
+ * Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static bool
+read_okay(char const * pzFName);
+
+static char const *
+expand_dir(char const ** dir_pp, char * name_buf);
+
+static size_t
+cnt_macros(char const * pz);
+
+static void
+load_macs(templ_t * pT, char const * pzF, char const * pzN,
+ char const * pzData);
+
+static templ_t *
+digest_tpl(tmap_info_t * minfo, char * fname);
+/* = = = END-STATIC-FORWARD = = = */
+
+/**
+ * Return the template structure matching the name passed in.
+ */
+LOCAL templ_t *
+find_tpl(char const * pzTemplName)
+{
+ templ_t * pT = named_tpls;
+ while (pT != NULL) {
+ if (streqvcmp(pzTemplName, pT->td_name) == 0)
+ break;
+ pT = (templ_t*)(void*)(pT->td_scan);
+ }
+ return pT;
+}
+
+/**
+ * the name is a regular file with read access.
+ * @param[in] pzFName file name to check
+ * @returns \a true when the named file exists and is a regular file
+ * @returns \a false otherwise.
+ */
+static bool
+read_okay(char const * pzFName)
+{
+ struct stat stbf;
+ if (stat(pzFName, &stbf) != 0)
+ return false;
+ if (! S_ISREG(stbf.st_mode))
+ return false;
+ return (access(pzFName, R_OK) == 0) ? true : false;
+}
+
+/**
+ * Expand a directory name that starts with '$'.
+ *
+ * @param[in,out] dir_pp pointer to pointer to directory name
+ * @returns the resulting pointer
+ */
+static char const *
+expand_dir(char const ** dir_pp, char * name_buf)
+{
+ char * res = (void *)*dir_pp;
+
+ if (res[1] == NUL)
+ AG_ABEND(aprf(LOAD_FILE_SHORT_NAME, res));
+
+ if (! optionMakePath(name_buf, (int)AG_PATH_MAX, res,
+ autogenOptions.pzProgPath)) {
+ /*
+ * The name expanded to "empty", so substitute curdir.
+ */
+ strcpy(res, FIND_FILE_CURDIR);
+
+ } else {
+ free(res);
+ AGDUPSTR(res, name_buf, "find dir name");
+ *dir_pp = res; /* save computed name for later */
+ }
+
+ return res;
+}
+
+/**
+ * Search for a file.
+ *
+ * Starting with the current directory, search the directory list trying to
+ * find the base template file name. If there is a referring template (a
+ * template with an "INCLUDE" macro), then try that, too, before giving up.
+ *
+ * @param[in] in_name the file name we are looking for.
+ * @param[out] res_name where we stash the file name we found.
+ * @param[in] sfx_list a list of suffixes to try, if \a in_name has none.
+ * @param[in] referring_tpl file name of the template with a INCLUDE macro.
+ *
+ * @returns \a SUCCESS when \a res_name is valid
+ * @returns \a FAILURE when the file is not found.
+ */
+LOCAL tSuccess
+find_file(char const * in_name,
+ char * res_name,
+ char const * const * sfx_list,
+ char const * referring_tpl)
+{
+ bool no_suffix;
+ void * free_me = NULL;
+ tSuccess res = SUCCESS;
+
+ size_t nm_len = strlen(in_name);
+ if (nm_len >= AG_PATH_MAX - MAX_SUFFIX_LEN)
+ return FAILURE;
+
+ /*
+ * Expand leading environment variables.
+ * We will not mess with embedded ones.
+ */
+ if (*in_name == '$') {
+ if (! optionMakePath(res_name, (int)AG_PATH_MAX, in_name,
+ autogenOptions.pzProgPath))
+ return FAILURE;
+
+ AGDUPSTR(in_name, res_name, "find file name");
+ free_me = (void*)in_name;
+
+ /*
+ * in_name now points to the name the file system can use.
+ * It must _not_ point to res_name because we will likely
+ * rewrite that value using this pointer!
+ */
+ nm_len = strlen(in_name);
+ }
+
+ /*
+ * Not a complete file name. If there is not already
+ * a suffix for the file name, then append ".tpl".
+ * Check for immediate access once again.
+ */
+ {
+ char * bf = strrchr(in_name, '/');
+ bf = (bf != NULL) ? strchr(bf, '.') : strchr(in_name, '.');
+ no_suffix = (bf == NULL);
+ }
+
+ /*
+ * The referrer is useful only if it includes a directory name.
+ * If not NULL, referring_tpl becomes an allocated directory name.
+ */
+ if (referring_tpl != NULL) {
+ char * pz = strrchr(referring_tpl, '/');
+ if (pz == NULL)
+ referring_tpl = NULL;
+ else {
+ AGDUPSTR(referring_tpl, referring_tpl, "referring_tpl");
+ pz = strrchr(referring_tpl, '/');
+ *pz = NUL;
+ }
+ }
+
+ {
+ /*
+ * Search each directory in our directory search list for the file.
+ * We always force two copies of this option, so we know it exists.
+ * Later entries are more recently added and are searched first.
+ * We start the "dirlist" pointing to the real last entry.
+ */
+ int ct = STACKCT_OPT(TEMPL_DIRS);
+ char const ** dirlist = STACKLST_OPT(TEMPL_DIRS) + ct - 1;
+ char const * c_dir = FIND_FILE_CURDIR;
+
+ /*
+ * IF the file name starts with a directory separator,
+ * then we only search once, looking for the exact file name.
+ */
+ if (*in_name == '/')
+ ct = -1;
+
+ for (;;) {
+ char * pzEnd;
+
+ /*
+ * c_dir is always FIND_FILE_CURDIR the first time through
+ * and is never that value after that.
+ */
+ if (c_dir == FIND_FILE_CURDIR) {
+
+ memcpy(res_name, in_name, nm_len);
+ pzEnd = res_name + nm_len;
+ *pzEnd = NUL;
+
+ } else {
+ int fmt_len;
+
+ /*
+ * IF one of our template paths starts with '$', then expand it
+ * and replace it now and forever (the rest of this run, anyway).
+ */
+ if (*c_dir == '$')
+ c_dir = expand_dir(dirlist+1, res_name);
+
+ fmt_len = snprintf(res_name, AG_PATH_MAX - MAX_SUFFIX_LEN,
+ FIND_FILE_DIR_FMT, c_dir, in_name);
+ if (fmt_len >= AG_PATH_MAX - MAX_SUFFIX_LEN)
+ break; // fail-return
+ pzEnd = res_name + fmt_len;
+ }
+
+ if (read_okay(res_name))
+ goto find_file_done;
+
+ /*
+ * IF the file does not already have a suffix,
+ * THEN try the ones that are okay for this file.
+ */
+ if (no_suffix && (sfx_list != NULL)) {
+ char const * const * sfxl = sfx_list;
+ *(pzEnd++) = '.';
+
+ do {
+ strcpy(pzEnd, *(sfxl++)); /* must fit */
+ if (read_okay(res_name))
+ goto find_file_done;
+
+ } while (*sfxl != NULL);
+ }
+
+ /*
+ * IF we've exhausted the search list,
+ * THEN see if we're done, else go through search dir list.
+ *
+ * We try one more thing if there is a referrer.
+ * If the searched-for file is a full path, "ct" will
+ * start at -1 and we will leave the loop here and now.
+ */
+ if (--ct < 0) {
+ if ((referring_tpl == NULL) || (ct != -1))
+ break;
+ c_dir = referring_tpl;
+
+ } else {
+ c_dir = *(dirlist--);
+ }
+ }
+ }
+
+ res = FAILURE;
+
+ find_file_done:
+ AGFREE(free_me);
+ AGFREE(referring_tpl);
+ return res;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Count the macros in a template.
+ * We need to allocate the right number of pointers.
+ */
+static size_t
+cnt_macros(char const * pz)
+{
+ size_t ct = 2;
+ for (;;) {
+ pz = strstr(pz, st_mac_mark);
+ if (pz == NULL)
+ break;
+ ct += 2;
+ if (strncmp(pz - end_mac_len, end_mac_mark, end_mac_len) == 0)
+ ct--;
+ pz += st_mac_len;
+ }
+ return ct;
+}
+
+
+/**
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Load the macro array and file name.
+ */
+static void
+load_macs(templ_t * pT, char const * pzF, char const * pzN,
+ char const * pzData)
+{
+ macro_t* pMac = pT->td_macros;
+
+ {
+ char* pzText = (char*)(pMac + pT->td_mac_ct);
+ size_t len;
+
+ AGDUPSTR(pT->td_file, pzF, "templ file");
+
+ len = strlen(pzN) + 1;
+ memcpy((void*)pzText, (void*)pzN, len);
+ pT->td_name = pzText;
+ pzText += len;
+ pT->td_text = pzText;
+ pT->td_scan = pzText + 1;
+ }
+
+ current_tpl = pT;
+
+ {
+ macro_t* pMacEnd = parse_tpl(pMac, &pzData);
+ int ct;
+
+ /*
+ * Make sure all of the input string was scanned.
+ */
+ if (pzData != NULL)
+ AG_ABEND(LOAD_MACS_BAD_PARSE);
+
+ ct = pMacEnd - pMac;
+
+ /*
+ * IF there are empty macro slots,
+ * THEN pack the text
+ */
+ if (ct < pT->td_mac_ct) {
+ int delta = sizeof(macro_t) * (pT->td_mac_ct - ct);
+ void* data =
+ (pT->td_name == NULL) ? pT->td_text : pT->td_name;
+ size_t size = pT->td_scan - (char*)data;
+ memmove((void*)pMacEnd, data, size);
+
+ pT->td_text -= delta;
+ pT->td_scan -= delta;
+ pT->td_name -= delta;
+ pT->td_mac_ct = ct;
+ }
+ }
+
+ pT->td_size = pT->td_scan - (char*)pT;
+ pT->td_scan = NULL;
+
+ /*
+ * We cannot reallocate a smaller array because
+ * the entries are all linked together and
+ * realloc-ing it may cause it to move.
+ */
+#if defined(DEBUG_ENABLED)
+ if (HAVE_OPT(SHOW_DEFS)) {
+ static char const zSum[] =
+ "loaded %d macros from %s\n"
+ "\tBinary template size: 0x%zX\n\n";
+ fprintf(trace_fp, zSum, pT->td_mac_ct, pzF, pT->td_size);
+ }
+#endif
+}
+
+/**
+ * Load a template from mapped memory. Load up the pseudo macro,
+ * count the macros, allocate the data, and parse all the macros.
+ *
+ * @param[in] minfo information about the mapped memory.
+ * @param[in] fname the full path input file name.
+ *
+ * @returns the digested data
+ */
+static templ_t *
+digest_tpl(tmap_info_t * minfo, char * fname)
+{
+ templ_t * res;
+
+ /*
+ * Count the number of macros in the template. Compute
+ * the output data size as a function of the number of macros
+ * and the size of the template data. These may get reduced
+ * by comments.
+ */
+ char const * dta =
+ loadPseudoMacro((char const *)minfo->txt_data, fname);
+
+ size_t mac_ct = cnt_macros(dta);
+ size_t alloc_sz = (sizeof(*res) + (mac_ct * sizeof(macro_t))
+ + minfo->txt_size
+ - (dta - (char const *)minfo->txt_data)
+ + strlen(fname) + 0x10) & ~0x0F;
+
+ res = (templ_t*)AGALOC(alloc_sz, "main template");
+ memset((void*)res, 0, alloc_sz);
+
+ /*
+ * Initialize the values:
+ */
+ res->td_magic = magic_marker;
+ res->td_size = alloc_sz;
+ res->td_mac_ct = mac_ct;
+
+ strcpy(res->td_start_mac, st_mac_mark); /* must fit */
+ strcpy(res->td_end_mac, end_mac_mark); /* must fit */
+ load_macs(res, fname, PSEUDO_MAC_TPL_FILE, dta);
+
+ res->td_name -= (long)res;
+ res->td_text -= (long)res;
+ res = (templ_t*)AGREALOC((void*)res, res->td_size,
+ "resize template");
+ res->td_name += (long)res;
+ res->td_text += (long)res;
+
+ return res;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Starting with the current directory, search the directory
+ * list trying to find the base template file name.
+ */
+LOCAL templ_t *
+tpl_load(char const * fname, char const * referrer)
+{
+ static tmap_info_t map_info;
+ static char tpl_file[ AG_PATH_MAX ];
+
+ /*
+ * Find the template file somewhere
+ */
+ {
+ static char const * const sfx_list[] = {
+ LOAD_TPL_SFX_TPL, LOAD_TPL_SFX_AGL, NULL };
+ if (! SUCCESSFUL(find_file(fname, tpl_file, sfx_list, referrer))) {
+ errno = ENOENT;
+ AG_CANT(LOAD_TPL_CANNOT_MAP, fname);
+ }
+ }
+
+ /*
+ * Make sure the specified file is a regular file.
+ * Make sure the output time stamp is at least as recent.
+ */
+ {
+ struct stat stbf;
+ if (stat(tpl_file, &stbf) != 0)
+ AG_CANT(LOAD_TPL_CANNOT_STAT, fname);
+
+ if (! S_ISREG(stbf.st_mode)) {
+ errno = EINVAL;
+ AG_CANT(LOAD_TPL_IRREGULAR, fname);
+ }
+
+ if (outfile_time < stbf.st_mtime)
+ outfile_time = stbf.st_mtime;
+ }
+
+ text_mmap(tpl_file, PROT_READ|PROT_WRITE, MAP_PRIVATE, &map_info);
+ if (TEXT_MMAP_FAILED_ADDR(map_info.txt_data))
+ AG_ABEND(aprf(LOAD_TPL_CANNOT_OPEN, tpl_file));
+
+ if (dep_fp != NULL)
+ add_source_file(tpl_file);
+
+ /*
+ * Process the leading pseudo-macro. The template proper
+ * starts immediately after it.
+ */
+ {
+ macro_t * sv_mac = cur_macro;
+ templ_t * res;
+ cur_macro = NULL;
+
+ res = digest_tpl(&map_info, tpl_file);
+ cur_macro = sv_mac;
+ text_munmap(&map_info);
+
+ return res;
+ }
+}
+
+/**
+ * Deallocate anything related to a template.
+ * This includes the pointer passed in and any macros that have an
+ * unload procedure associated with it.
+ *
+ * @param[in] tpl the template to unload
+ */
+LOCAL void
+tpl_unload(templ_t * tpl)
+{
+ macro_t * mac = tpl->td_macros;
+ int ct = tpl->td_mac_ct;
+
+ while (--ct >= 0) {
+ unload_proc_p_t proc;
+ unsigned int ix = mac->md_code;
+
+ /*
+ * "select" functions get remapped, depending on the alias used for
+ * the selection. See the "mac_func_t" enumeration in functions.h.
+ */
+ if (ix >= FUNC_CT)
+ ix = FTYP_SELECT;
+
+ proc = unload_procs[ ix ];
+ if (proc != NULL)
+ (*proc)(mac);
+
+ mac++;
+ }
+
+ AGFREE((void*)(tpl->td_file));
+ AGFREE(tpl);
+}
+
+/**
+ * This gets called when all is well at the end.
+ * The supplied template and all named templates are unloaded.
+ *
+ * @param[in] tpl the last template standing
+ */
+LOCAL void
+cleanup(templ_t * tpl)
+{
+ if (HAVE_OPT(USED_DEFINES))
+ print_used_defines();
+
+ if (dep_fp != NULL)
+ wrap_up_depends();
+
+ optionFree(&autogenOptions);
+
+ for (;;) {
+ tpl_unload(tpl);
+ tpl = named_tpls;
+ if (tpl == NULL)
+ break;
+ named_tpls = (templ_t*)(void*)(tpl->td_scan);
+ }
+
+ free_for_context(true);
+ unload_defs();
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/tpLoad.c */
diff --git a/agen5/tpParse.c b/agen5/tpParse.c
new file mode 100644
index 0000000..8f053c6
--- /dev/null
+++ b/agen5/tpParse.c
@@ -0,0 +1,400 @@
+
+/**
+ * @file tpParse.c
+ *
+ * Time-stamp: "2012-04-22 10:05:41 bkorb"
+ *
+ * This module will load a template and return a template structure.
+ *
+ * This file is part of AutoGen.
+ * Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if defined(DEBUG_ENABLED)
+static int tplNestLevel = 0;
+
+static char const zTDef[] = "%-10s (%d) line %d end=%d, strlen=%d\n";
+#endif
+
+/* = = = START-STATIC-FORWARD = = = */
+static mac_func_t
+func_code(char const ** ppzScan);
+
+static char const *
+find_mac_end(char const ** ppzMark);
+
+static char const *
+find_mac_start(char const * pz, macro_t** ppM, templ_t* pTpl);
+
+static char const *
+find_macro(templ_t * pTpl, macro_t ** ppM, char const ** ppzScan);
+/* = = = END-STATIC-FORWARD = = = */
+
+/*
+ * Return the enumerated function type corresponding
+ * to a name pointed to by the input argument.
+ */
+static mac_func_t
+func_code(char const ** ppzScan)
+{
+ fn_name_type_t const * pNT;
+ char const * pzFuncName = *ppzScan;
+ int hi, lo, av;
+ int cmp;
+
+ /*
+ * IF the name starts with a punctuation, then it is some sort of
+ * alias. Find the function in the alias portion of the table.
+ */
+ if (IS_PUNCTUATION_CHAR(*pzFuncName)) {
+ hi = FUNC_ALIAS_HIGH_INDEX;
+ lo = FUNC_ALIAS_LOW_INDEX;
+ do {
+ av = (hi + lo)/2;
+ pNT = fn_name_types + av;
+ cmp = (int)(*(pNT->pName)) - (int)(*pzFuncName);
+
+ /*
+ * For strings that start with a punctuation, we
+ * do not need to test for the end of token
+ * We will not strip off the marker and the load function
+ * will figure out what to do with the code.
+ */
+ if (cmp == 0)
+ return pNT->fType;
+ if (cmp > 0)
+ hi = av - 1;
+ else lo = av + 1;
+ } while (hi >= lo);
+ return FTYP_BOGUS;
+ }
+
+ if (! IS_VAR_FIRST_CHAR(*pzFuncName))
+ return FTYP_BOGUS;
+
+ hi = FUNC_NAMES_HIGH_INDEX;
+ lo = FUNC_NAMES_LOW_INDEX;
+
+ do {
+ av = (hi + lo)/2;
+ pNT = fn_name_types + av;
+ cmp = strneqvcmp(pNT->pName, pzFuncName, (int)pNT->cmpLen);
+ if (cmp == 0) {
+ /*
+ * Make sure we matched to the end of the token.
+ */
+ if (IS_VARIABLE_NAME_CHAR(pzFuncName[pNT->cmpLen]))
+ break;
+
+ /*
+ * Advance the scanner past the macro name.
+ * The name is encoded in the "fType".
+ */
+ *ppzScan = pzFuncName + pNT->cmpLen;
+ return pNT->fType;
+ }
+ if (cmp > 0)
+ hi = av - 1;
+ else lo = av + 1;
+ } while (hi >= lo);
+
+ /*
+ * Save the name for later lookup
+ */
+ cur_macro->md_name_off = (current_tpl->td_scan - current_tpl->td_text);
+ {
+ char * pzCopy = current_tpl->td_scan;
+ char * pe = SPN_VALUE_NAME_CHARS(pzFuncName);
+ size_t l = pe - pzFuncName;
+ memcpy(pzCopy, pzFuncName, l);
+ pzCopy += l;
+ pzFuncName += l;
+
+ /*
+ * Names are allowed to contain colons, but not end with them.
+ */
+ if (pzCopy[-1] == ':')
+ pzCopy--, pzFuncName--;
+
+ *(pzCopy++) = NUL;
+ *ppzScan = pzFuncName;
+ current_tpl->td_scan = pzCopy;
+ }
+
+ /*
+ * "Unknown" means we have to check again before we
+ * know whether to assign it to "FTYP_INVOKE" or "FTYP_COND".
+ * That depends on whether or not we find a named template
+ * at template instantiation time.
+ */
+ return FTYP_UNKNOWN;
+}
+
+static char const *
+find_mac_end(char const ** ppzMark)
+{
+ char const * pzMark = *ppzMark + st_mac_len;
+ char const * pzFunc;
+ char const * pzNextMark;
+ char const * pzEndMark;
+
+ /*
+ * Set our pointers to the start of the macro text
+ */
+ for (;;) {
+ pzMark = SPN_NON_NL_WHITE_CHARS(pzMark);
+ if (*pzMark != NL)
+ break;
+ tpl_line++;
+ pzMark++;
+ }
+
+ pzFunc = pzMark;
+ cur_macro->md_code = func_code(&pzMark);
+ cur_macro->md_line = tpl_line;
+ *ppzMark = pzMark;
+
+ /*
+ * Find the end. (We must.) If the thing is empty, treat as a comment,
+ * but warn about it.
+ */
+ pzEndMark = strstr(pzMark, end_mac_mark);
+ if (pzEndMark == NULL)
+ AG_ABEND(FIND_MAC_END_NOPE);
+
+ if (pzEndMark == pzFunc) {
+ cur_macro->md_code = FTYP_COMMENT;
+ fprintf(trace_fp, FIND_MAC_END_EMPTY,
+ current_tpl->td_file, tpl_line);
+ return pzEndMark;
+ }
+
+ /*
+ * Back up over a preceding backslash. It is a flag to indicate the
+ * removal of the end of line white space.
+ */
+ if (pzEndMark[-1] == '\\')
+ pzEndMark--;
+
+ pzNextMark = strstr(pzMark, st_mac_mark);
+ if (pzNextMark == NULL)
+ return pzEndMark;
+
+ if (pzEndMark > pzNextMark)
+ AG_ABEND(FIND_MAC_END_NESTED);
+
+ return pzEndMark;
+}
+
+static char const *
+find_mac_start(char const * pz, macro_t** ppM, templ_t* pTpl)
+{
+ char * pzCopy;
+ char const * pzEnd;
+ char const * res = strstr(pz, st_mac_mark);
+ macro_t * pM = *ppM;
+
+ if (res == pz)
+ return res;
+
+ /*
+ * There is some text here. Make a text macro entry.
+ */
+ pzCopy = pTpl->td_scan;
+ pzEnd = (res != NULL) ? res : pz + strlen(pz);
+ pM->md_txt_off = pzCopy - pTpl->td_text;
+ pM->md_code = FTYP_TEXT;
+ pM->md_line = tpl_line;
+
+#if defined(DEBUG_ENABLED)
+ if (HAVE_OPT(SHOW_DEFS)) {
+ int ct = tplNestLevel;
+ fprintf(trace_fp, "%3u ", (unsigned int)(pM - pTpl->td_macros));
+ do { fputs(" ", trace_fp); } while (--ct > 0);
+
+ fprintf(trace_fp, zTDef, ag_fun_names[ FTYP_TEXT ], FTYP_TEXT,
+ pM->md_line, pM->md_end_idx, (unsigned int)(pzEnd - pz));
+ }
+#endif
+
+ do {
+ if ((*(pzCopy++) = *(pz++)) == NL)
+ tpl_line++;
+ } while (pz < pzEnd);
+
+ *(pzCopy++) = NUL;
+ *ppM = pM + 1;
+ pTpl->td_scan = pzCopy;
+
+ return res; /* may be NULL, if there are no more macros */
+}
+
+static char const *
+find_macro(templ_t * pTpl, macro_t ** ppM, char const ** ppzScan)
+{
+ char const * pzScan = *ppzScan;
+ char const * pzMark;
+
+ pzMark = find_mac_start(pzScan, ppM, pTpl);
+
+ /*
+ * IF no more macro marks are found, THEN we are done...
+ */
+ if (pzMark == NULL)
+ return pzMark;
+
+ /*
+ * Find the macro code and the end of the macro invocation
+ */
+ cur_macro = *ppM;
+ pzScan = find_mac_end(&pzMark);
+
+ /*
+ * Count the lines in the macro text and advance the
+ * text pointer to after the marker.
+ */
+ {
+ char const * pzMacEnd = pzScan;
+ char const * pz = pzMark;
+
+ for (;;pz++) {
+ pz = strchr(pz, NL);
+ if ((pz == NULL) || (pz > pzMacEnd))
+ break;
+ tpl_line++;
+ }
+
+ /*
+ * Strip white space from the macro
+ */
+ pzMark = SPN_WHITESPACE_CHARS(pzMark);
+
+ if (pzMark != pzMacEnd) {
+ pzMacEnd = SPN_WHITESPACE_BACK( pzMark, pzMacEnd);
+ (*ppM)->md_txt_off = (uintptr_t)pzMark;
+ (*ppM)->md_res = (long)(pzMacEnd - pzMark);
+ }
+ }
+
+ /*
+ * IF the end macro mark was preceded by a backslash, then we remove
+ * trailing white space from there to the end of the line.
+ */
+ if ((*pzScan != '\\') || (strncmp(end_mac_mark, pzScan, end_mac_len) == 0))
+ pzScan += end_mac_len;
+
+ else {
+ char const * pz;
+ pzScan += end_mac_len + 1;
+ pz = SPN_NON_NL_WHITE_CHARS(pzScan);
+ if (*pz == NL) {
+ pzScan = pz + 1;
+ tpl_line++;
+ }
+ }
+
+ *ppzScan = pzScan;
+ return pzMark;
+}
+
+LOCAL macro_t *
+parse_tpl(macro_t * mac, char const ** p_scan)
+{
+ char const * scan = *p_scan;
+ templ_t * tpl = current_tpl;
+
+#if defined(DEBUG_ENABLED)
+ static char const zTUndef[] = "%-10s (%d) line %d - MARKER\n";
+
+ #define DEBUG_DEC(l) l--
+
+ if ( ((tplNestLevel++) > 0)
+ && HAVE_OPT(SHOW_DEFS)) {
+ int ct = tplNestLevel;
+ macro_t* pPm = mac-1;
+
+ fprintf(trace_fp, "%3u ", (unsigned int)(pPm - tpl->td_macros));
+ do { fputs(" ", trace_fp); } while (--ct > 0);
+
+ fprintf(trace_fp, zTUndef, ag_fun_names[ pPm->md_code ],
+ pPm->md_code, pPm->md_line);
+ }
+#else
+ #define DEBUG_DEC(l)
+#endif
+
+ while (find_macro(tpl, &mac, &scan) != NULL) {
+ /*
+ * IF the called function returns a NULL next macro pointer,
+ * THEN some block has completed. The returned scanning pointer
+ * will be non-NULL.
+ */
+ {
+ load_proc_p_t const fn = load_proc_table[mac->md_code];
+ macro_t * nxt_mac = fn(tpl, mac, &scan);
+
+#if defined(DEBUG_ENABLED)
+ if (HAVE_OPT(SHOW_DEFS)) {
+ mac_func_t ft = mac->md_code;
+ int ln = mac->md_line;
+ int ct = tplNestLevel;
+ if (mac->md_code == FTYP_BOGUS)
+ fputs(" ", trace_fp);
+ else fprintf(trace_fp, "%3u ",
+ (unsigned int)(mac - tpl->td_macros));
+
+ do { fputs(" ", trace_fp); } while (--ct > 0);
+
+ if (mac->md_code == FTYP_BOGUS)
+ fprintf(trace_fp, zTUndef, ag_fun_names[ ft ], ft, ln);
+ else {
+ char const * pz;
+ if (ft >= FUNC_CT)
+ ft = FTYP_SELECT;
+ pz = (mac->md_txt_off == 0)
+ ? zNil
+ : (tpl->td_text + mac->md_txt_off);
+ fprintf(trace_fp, zTDef, ag_fun_names[ft], mac->md_code,
+ ln, mac->md_end_idx, (unsigned int)strlen(pz));
+ }
+ }
+#endif
+
+ if (nxt_mac == NULL) {
+ *p_scan = scan;
+ DEBUG_DEC(tplNestLevel);
+ return mac;
+ }
+ mac = nxt_mac;
+ }
+ }
+
+ DEBUG_DEC(tplNestLevel);
+
+ /*
+ * We reached the end of the input string.
+ * Return a NULL scanning pointer and a pointer to the end.
+ */
+ *p_scan = NULL;
+ return mac;
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/tpParse.c */
diff --git a/agen5/tpProcess.c b/agen5/tpProcess.c
new file mode 100644
index 0000000..4eb4f6f
--- /dev/null
+++ b/agen5/tpProcess.c
@@ -0,0 +1,413 @@
+
+/**
+ * @file tpProcess.c
+ *
+ * Parse and process the template data descriptions
+ *
+ * Time-stamp: "2012-04-07 09:26:41 bkorb"
+ *
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+trace_macro(templ_t * tpl, macro_t * mac);
+
+static void
+do_stdout_tpl(templ_t * tpl);
+
+static void
+open_output(out_spec_t * spec);
+/* = = = END-STATIC-FORWARD = = = */
+
+/**
+ * Generate all the text within a block.
+ * The caller must know the exact bounds of the block.
+ *
+ * @param tpl template containing block of macros
+ * @param mac first macro in series
+ * @param emac one past last macro in series
+ */
+LOCAL void
+gen_block(templ_t * tpl, macro_t * mac, macro_t * emac)
+{
+ /*
+ * Set up the processing context for this block of macros.
+ * It is used by the Guile callback routines and the exception
+ * handling code. It is all for user friendly diagnostics.
+ */
+ current_tpl = tpl;
+
+ while ((mac != NULL) && (mac < emac)) {
+ mac_func_t fc = mac->md_code;
+ if (fc >= FUNC_CT)
+ fc = FTYP_BOGUS;
+
+ if (OPT_VALUE_TRACE >= TRACE_EVERYTHING)
+ trace_macro(tpl, mac);
+
+ cur_macro = mac;
+ mac = (*(load_procs[ fc ]))(tpl, mac);
+ ag_scribble_free();
+ }
+}
+
+/**
+ * Print out information about the invocation of a macro.
+ * Print up to the first 32 characters in the macro, for context.
+ *
+ * @param tpl template containing macros
+ * @param mac first macro in series
+ */
+static void
+trace_macro(templ_t * tpl, macro_t * mac)
+{
+ mac_func_t fc = mac->md_code;
+ if (fc >= FUNC_CT)
+ fc = FTYP_BOGUS;
+
+ fprintf(trace_fp, TRACE_MACRO_FMT, ag_fun_names[fc], mac->md_code,
+ tpl->td_file, mac->md_line);
+
+ if (mac->md_txt_off > 0) {
+ char * pz = tpl->td_text + mac->md_txt_off;
+ char * pe = BRK_NEWLINE_CHARS(pz);
+ if (pe > pz + 32)
+ pz = pz + 32;
+
+ putc(' ', trace_fp); putc(' ', trace_fp);
+ fwrite(pz, pe - pz, 1, trace_fp);
+ putc(NL, trace_fp);
+ }
+}
+
+/**
+ * The template output goes to stdout. Perhaps because output
+ * is for a CGI script. In any case, this case must be handled
+ * specially.
+ *
+ * @param tpl template to be processed
+ */
+static void
+do_stdout_tpl(templ_t * tpl)
+{
+ SCM res;
+
+ last_scm_cmd = NULL; /* We cannot be in Scheme processing */
+
+ switch (setjmp(abort_jmp_buf)) {
+ case SUCCESS:
+ break;
+
+ case PROBLEM:
+ if (*oops_pfx != NUL) {
+ fprintf(stdout, DO_STDOUT_TPL_ABANDONED, oops_pfx);
+ oops_pfx = zNil;
+ }
+ fclose(stdout);
+ return;
+
+ default:
+ fprintf(stdout, DO_STDOUT_TPL_BADR, oops_pfx);
+
+ case FAILURE:
+ exit(EXIT_FAILURE);
+ /* NOTREACHED */
+ }
+
+ curr_sfx = DO_STDOUT_TPL_NOSFX;
+ curr_def_ctx = root_def_ctx;
+ cur_fpstack = &out_root;
+ out_root.stk_fp = stdout;
+ out_root.stk_fname = DO_STDOUT_TPL_STDOUT;
+ out_root.stk_flags = FPF_NOUNLINK | FPF_STATIC_NM;
+ if (OPT_VALUE_TRACE >= TRACE_EVERYTHING)
+ fputs(DO_STDOUT_TPL_START_STD, trace_fp);
+
+ /*
+ * IF there is a CGI prefix for error messages,
+ * THEN divert all output to a temporary file so that
+ * the output will be clean for any error messages we have to emit.
+ */
+ if (*oops_pfx == NUL)
+ gen_block(tpl, tpl->td_macros, tpl->td_macros + tpl->td_mac_ct);
+
+ else {
+ char const * pzRes;
+ (void)ag_scm_out_push_new(SCM_UNDEFINED);
+
+ gen_block(tpl, tpl->td_macros, tpl->td_macros + tpl->td_mac_ct);
+
+ /*
+ * Read back in the spooled output. Make sure it starts with
+ * a content-type: prefix. If not, we supply our own HTML prefix.
+ */
+ res = ag_scm_out_pop(SCM_BOOL_T);
+ pzRes = AG_SCM_CHARS(res);
+
+ /* 13 char prefix is: "content-type:" */
+ if (strneqvcmp(pzRes, DO_STDOUT_TPL_CONTENT, 13) != 0)
+ fputs(DO_STDOUT_TPL_CONTENT, stdout);
+
+ fwrite(pzRes, AG_SCM_STRLEN(res), 1, stdout);
+ }
+
+ fclose(stdout);
+}
+
+/**
+ * pop the current output spec structure. Deallocate it and the
+ * file name, too, if necessary.
+ */
+LOCAL out_spec_t *
+next_out_spec(out_spec_t * os)
+{
+ out_spec_t * res = os->os_next;
+
+ if (os->os_dealloc_fmt)
+ AGFREE(os->os_file_fmt);
+
+ AGFREE(os);
+ return res;
+}
+
+LOCAL void
+process_tpl(templ_t * tpl)
+{
+ /*
+ * IF the template file does not specify any output suffixes,
+ * THEN we will generate to standard out with the suffix set to zNoSfx.
+ * With output going to stdout, we don't try to remove output on errors.
+ */
+ if (output_specs == NULL) {
+ do_stdout_tpl(tpl);
+ return;
+ }
+
+ do {
+ out_spec_t * ospec = output_specs;
+
+ /*
+ * We cannot be in Scheme processing. We've either just started
+ * or we've made a long jump from our own code. If we've made a
+ * long jump, we've printed a message that is sufficient and we
+ * don't need to print any scheme expressions.
+ */
+ last_scm_cmd = NULL;
+
+ /*
+ * HOW was that we got here?
+ */
+ switch (setjmp(abort_jmp_buf)) {
+ case SUCCESS:
+ if (OPT_VALUE_TRACE >= TRACE_EVERYTHING) {
+ fprintf(trace_fp, PROC_TPL_START, ospec->os_sfx);
+ fflush(trace_fp);
+ }
+ /*
+ * Set the output file name buffer.
+ * It may get switched inside open_output.
+ */
+ open_output(ospec);
+ memcpy(&out_root, cur_fpstack, sizeof(out_root));
+ AGFREE(cur_fpstack);
+ cur_fpstack = &out_root;
+ curr_sfx = ospec->os_sfx;
+ curr_def_ctx = root_def_ctx;
+ cur_fpstack->stk_flags &= ~FPF_FREE;
+ cur_fpstack->stk_prev = NULL;
+ gen_block(tpl, tpl->td_macros, tpl->td_macros+tpl->td_mac_ct);
+
+ do {
+ out_close(false); /* keep output */
+ } while (cur_fpstack->stk_prev != NULL);
+ break;
+
+ case PROBLEM:
+ /*
+ * We got here by a long jump. Close/purge the open files.
+ */
+ do {
+ out_close(true); /* discard output */
+ } while (cur_fpstack->stk_prev != NULL);
+ last_scm_cmd = NULL; /* "problem" means "drop current output". */
+ break;
+
+ default:
+ fprintf(trace_fp, PROC_TPL_BOGUS_RET, oops_pfx);
+ oops_pfx = zNil;
+ /* FALLTHROUGH */
+
+ case FAILURE:
+ /*
+ * We got here by a long jump. Close/purge the open files.
+ */
+ do {
+ out_close(true); /* discard output */
+ } while (cur_fpstack->stk_prev != NULL);
+
+ /*
+ * On failure (or unknown jump type), we quit the program, too.
+ */
+ processing_state = PROC_STATE_ABORTING;
+ do ospec = next_out_spec(ospec);
+ while (ospec != NULL);
+ exit(EXIT_FAILURE);
+ /* NOTREACHED */
+ }
+
+ output_specs = next_out_spec(ospec);
+ } while (output_specs != NULL);
+}
+
+
+LOCAL void
+out_close(bool purge)
+{
+ if ((cur_fpstack->stk_flags & FPF_NOCHMOD) == 0)
+ make_readonly();
+
+ if (OPT_VALUE_TRACE > TRACE_DEBUG_MESSAGE)
+ fprintf(trace_fp, OUT_CLOSE_TRACE_WRAP, __func__,
+ cur_fpstack->stk_fname);
+
+ fclose(cur_fpstack->stk_fp);
+
+ /*
+ * Only stdout and /dev/null are marked, "NOUNLINK"
+ */
+ if ((cur_fpstack->stk_flags & FPF_NOUNLINK) == 0) {
+ /*
+ * IF we are told to purge the file OR the file is an AutoGen temp
+ * file, then get rid of the output.
+ */
+ if (purge || ((cur_fpstack->stk_flags & FPF_UNLINK) != 0))
+ unlink(cur_fpstack->stk_fname);
+
+ else {
+ struct utimbuf tbuf;
+
+ tbuf.actime = time(NULL);
+ tbuf.modtime = outfile_time;
+
+ /*
+ * The putative start time is one second earlier than the
+ * earliest output file time, regardless of when that is.
+ */
+ if (outfile_time <= start_time)
+ start_time = outfile_time - 1;
+
+ utime(cur_fpstack->stk_fname, &tbuf);
+ }
+ }
+
+ /*
+ * Do not deallocate statically allocated names
+ */
+ if ((cur_fpstack->stk_flags & FPF_STATIC_NM) == 0)
+ AGFREE((void*)cur_fpstack->stk_fname);
+
+ /*
+ * Do not deallocate the root entry. It is not allocated!!
+ */
+ if ((cur_fpstack->stk_flags & FPF_FREE) != 0) {
+ out_stack_t* p = cur_fpstack;
+ cur_fpstack = p->stk_prev;
+ AGFREE((void*)p);
+ }
+}
+
+/**
+ * Figure out what to use as the base name of the output file.
+ * If an argument is not provided, we use the base name of
+ * the definitions file.
+ */
+static void
+open_output(out_spec_t * spec)
+{
+ static char const write_mode[] = "w" FOPEN_BINARY_FLAG "+";
+
+ char const * out_file = NULL;
+
+ if (strcmp(spec->os_sfx, OPEN_OUTPUT_NULL) == 0) {
+ static int const flags = FPF_NOUNLINK | FPF_NOCHMOD | FPF_TEMPFILE;
+ null_open:
+ open_output_file(DEV_NULL, DEV_NULL_LEN, write_mode, flags);
+ return;
+ }
+
+ /*
+ * IF we are to skip the current suffix,
+ * we will redirect the output to /dev/null and
+ * perform all the work. There may be side effects.
+ */
+ if (HAVE_OPT(SKIP_SUFFIX)) {
+ int ct = STACKCT_OPT(SKIP_SUFFIX);
+ const char ** ppz = STACKLST_OPT(SKIP_SUFFIX);
+
+ while (--ct >= 0) {
+ if (strcmp(spec->os_sfx, *ppz++) == 0)
+ goto null_open;
+ }
+ }
+
+ /*
+ * Remove any suffixes in the last file name
+ */
+ {
+ char const * def_file = OPT_ARG(BASE_NAME);
+ char z[AG_PATH_MAX];
+ const char * pst = strrchr(def_file, '/');
+ char * end;
+
+ pst = (pst == NULL) ? def_file : (pst + 1);
+
+ /*
+ * We allow users to specify a suffix with '-' and '_', but when
+ * stripping a suffix from the "base name", we do not recognize 'em.
+ */
+ end = strchr(pst, '.');
+ if (end != NULL) {
+ size_t len = (unsigned)(end - pst);
+ if (len >= sizeof(z))
+ AG_ABEND("--base-name name is too long");
+
+ memcpy(z, pst, len);
+ z[ end - pst ] = NUL;
+ pst = z;
+ }
+
+ /*
+ * Now formulate the output file name in the buffer
+ * provided as the input argument.
+ */
+ out_file = aprf(spec->os_file_fmt, pst, spec->os_sfx);
+ if (out_file == NULL)
+ AG_ABEND(aprf(OPEN_OUTPUT_BAD_FMT, spec->os_file_fmt, pst,
+ spec->os_sfx));
+ }
+
+ open_output_file(out_file, strlen(out_file), write_mode, 0);
+ free((void *)out_file);
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of agen5/tpProcess.c */
diff --git a/autoopts/Makefile.am b/autoopts/Makefile.am
new file mode 100644
index 0000000..9a57022
--- /dev/null
+++ b/autoopts/Makefile.am
@@ -0,0 +1,207 @@
+## -*- Mode: Makefile -*-
+## ---------------------------------------------------------------------
+## autoopts/Makefile.am
+##
+## Time-stamp: "2012-04-14 14:22:31 bkorb"
+## Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+
+SUBDIRS = @OPTS_TESTDIR@
+INCLUDES = @INCLIST@
+libsrc = libopts-@AO_CURRENT@.@AO_REVISION@.@AO_AGE@.tar.gz
+LIBOPTS_VER = @AO_CURRENT@:@AO_REVISION@:@AO_AGE@
+
+if NEED_PATHFIND
+PATHFIND_MAN = pathfind.3
+else
+PATHFIND_MAN =
+endif
+
+MAN_STAMP = man3-stamp
+GENTEXI = libopts.texi libopts.menu
+TEXI_STAMP = texi-stamp
+EXTRA_DIST =
+GENMAN = $(PATHFIND_MAN) \
+ ao_string_tokenize.3 configFileLoad.3 optionFileLoad.3 \
+ optionFindNextValue.3 optionFindValue.3 optionFree.3 \
+ optionGetValue.3 optionLoadLine.3 optionNextValue.3 \
+ optionOnlyUsage.3 optionProcess.3 optionRestore.3 \
+ optionSaveFile.3 optionSaveState.3 optionUnloadNested.3 \
+ optionVersion.3 strequate.3 streqvcmp.3 \
+ streqvmap.3 strneqvcmp.3 strtransform.3
+
+nodist_pkgdata_DATA = $(libsrc) \
+ tpl/man2man tpl/man2mdoc tpl/man2texi \
+ tpl/mdoc2man tpl/mdoc2mdoc tpl/mdoc2texi \
+ tpl/texi2man tpl/texi2mdoc tpl/texi2texi \
+ tpl/tpl-config.tlib
+
+pkgdata_DATA = \
+ autoopts.m4 tpl/aginfo.tpl tpl/aginfo3.tpl \
+ tpl/agman-cmd.tpl tpl/agman.tlib tpl/agman1.tpl \
+ tpl/agman3.tpl tpl/agmdoc-cmd.tpl tpl/agpl.lic \
+ tpl/agtexi-cmd.tpl tpl/bits.tpl tpl/cmd-doc.tlib \
+ tpl/def2pot.tpl tpl/getopt.tpl tpl/gpl.lic \
+ tpl/gplv2.lic tpl/lgpl.lic tpl/mbsd.lic \
+ tpl/optcode.tlib tpl/opthead.tlib tpl/options.tpl \
+ tpl/optlib.tlib tpl/optmain.tlib tpl/rc-sample.tpl \
+ tpl/stdoptions.def tpl/strings.tpl tpl/usage.tlib
+
+EXTRA_DATA = $(pkgdata_DATA) \
+ autogen.map autoopts-config.in bootstrap.dir \
+ install-hook.sh mk-autoopts-pc.in mk-tpl-config.sh \
+ po tpl/man2mdoc.pl tpl/man2texi.sh \
+ tpl/mdoc2man.sh tpl/mdoc2texi.pl tpl/texi2man.sh \
+ tpl/texi2mdoc.sh tpl/tpl-config-tlib.in tpl/usage-txt.tpl
+
+GENSCRIPTS = $(srcdir)/funcs.def \
+ tpl/man2man tpl/man2mdoc tpl/man2texi tpl/mdoc2man tpl/mdoc2mdoc \
+ tpl/mdoc2texi tpl/texi2man tpl/texi2mdoc tpl/texi2texi
+
+EXTRA_DIST += $(top_srcdir)/config/gendocs.sh
+EXTRA_DIST += gettext.h
+EXTRA_DIST += parse-duration.c
+EXTRA_DIST += parse-duration.h
+
+GENHDRS = autoopts/options.h autoopts/usage-txt.h genshell.h \
+ xat-attribute.h value-type.h ao-strs.h ag-char-map.h
+HDRS = $(GENHDRS) autoopts.h project.h proto.h
+GEN_SRC = ao-strs.c value-type.c xat-attribute.c
+
+## The primary source (autoopts.c) must be by itself on the first line after
+## "CSRC". 'sed' does some magic here to get the list of source files for the
+## documentation. Files without documentation are on the CSRC = line.
+##
+CSRC = parse-duration.c $(GEN_SRC) \
+ autoopts.c \
+ alias.c boolean.c check.c configfile.c cook.c \
+ enum.c env.c file.c find.c genshell.c \
+ load.c makeshell.c nested.c numeric.c pgusage.c \
+ putshell.c reset.c restore.c save.c sort.c \
+ stack.c streqvcmp.c text_mmap.c time.c tokenize.c \
+ usage.c version.c
+
+
+SRC = $(HDRS) $(CSRC) $(GENSRC)
+DEF_FILES = genshell.def $(srcdir)/funcs.def ao-strs.def
+pkgconfigdir =$(libdir)/pkgconfig
+
+## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+##
+## A U T O M A K E V A R S
+##
+## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+CLEANFILES = tmp-* libopts.c
+DISTCLEANFILES = $(GENMAN) $(GENTEXI) *-stamp
+MAINTAINERCLEANFILES = $(GENHDRS) $(GENSRC) $(GENSCRIPTS)
+m4datadir = $(datadir)/aclocal
+
+nodist_libopts_la_SOURCES = libopts.c
+libopts_la_SOURCES = $(HDRS)
+libopts_la_CFLAGS = -DPKGDATADIR='"$(pkgdatadir)"'
+libopts_la_LDFLAGS = -version-info $(LIBOPTS_VER)
+libopts_la_LIBADD = $(top_builddir)/snprintfv/libsnprintfv.la
+
+EXTRA_DIST += $(SRC) $(EXTRA_DATA) $(man_MANS) $(DEF_FILES)
+
+INST_MANS = autoopts-config.1 $(GENMAN)
+INST_PKGCFG = pkgconfig/autoopts.pc
+INST_PKGDATA = autoopts.m4 $(TPL_FILES)
+INST_LIBS = libopts.la
+INST_HDRS = autoopts/options.h autoopts/usage-txt.h
+INST_SH = autoopts-config
+
+man_MANS = $(INST_MANS)
+m4data_DATA = autoopts.m4
+nobase_data_DATA = $(INST_PKGCFG)
+lib_LTLIBRARIES = $(INST_LIBS)
+nobase_include_HEADERS = $(INST_HDRS)
+bin_SCRIPTS = $(INST_SH)
+
+BOOTENV = AGexe="$(AGexe)" GDexe="$(GDexe)" CLexe="$(CLexe)" \
+ srcdir="$(srcdir)" top_srcdir="$(top_srcdir)" \
+ builddir="$(builddir)" top_builddir="$(top_builddir)" \
+ POSIX_SHELL="$(POSIX_SHELL)"
+
+## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+##
+## M A K E F I L E R U L E S
+##
+## # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+libopts.c : tpl-config-stamp
+$(GENSCRIPTS) : tpl-config-stamp
+
+tpl-config-stamp: $(HDRS) $(CSRC) \
+ $(top_builddir)/config.h $(srcdir)/mk-tpl-config.sh
+ $(BOOTENV) \
+ $(POSIX_SHELL) $(srcdir)/mk-tpl-config.sh $@ $(HDRS) $(CSRC)
+
+makeshell.lo : genshell.c
+genshell.c : $(srcdir)/genshell.def
+ $(BOOTENV) \
+ $(POSIX_SHELL) $(srcdir)/bootstrap.dir $@
+
+strcspn.lo : $(top_srcdir)/compat/strcspn.c
+ $(LTCOMPILE) -o $@ -c $(top_srcdir)/compat/strcspn.c
+
+install-data-local : install-man3
+
+$(GENMAN) : $(MAN_STAMP)
+$(MAN_STAMP) : $(srcdir)/funcs.def
+ @test -x ../agen5/autogen || exit 0 ; \
+ touch tmp-$@ ; \
+ opts='-L$(srcdir)/tpl -L$(builddir)/tpl -Tagman3.tpl' ; \
+ echo ! $(AGexe) $${opts} $(srcdir)/funcs.def ; \
+ $(AGexe) $${opts} $(srcdir)/funcs.def ; \
+ mv -f tmp-$@ $@
+
+$(GENTEXI) : $(TEXI_STAMP)
+$(TEXI_STAMP) : ../agen5/autogen $(srcdir)/funcs.def
+ @touch tmp-$@ ; \
+ opts='-L$(srcdir)/tpl -L$(builddir)/tpl -Taginfo3.tpl' ; \
+ cmd="$(AGexe) $${opts} -DLEVEL=subsection -blibopts" ; \
+ cmd="$${cmd} -L$(srcdir) $(srcdir)/funcs.def" ; \
+ echo ! $$cmd ; $$cmd ; mv -f tmp-$@ $@
+
+libsrc : $(libsrc)
+$(libsrc) :
+ @$(BOOTENV) \
+ AO_AGE=@AO_AGE@ AO_CURRENT=@AO_CURRENT@ AO_REVISION=@AO_REVISION@ \
+ $(POSIX_SHELL) $(top_srcdir)/pkg/libopts/mklibsrc.sh
+
+pkgconfig/autoopts.pc : mk-autoopts-pc
+ $(POSIX_SHELL) mk-autoopts-pc $@
+
+install-data-hook:
+ @DESTdestdir='$(DESTDIR)$(includedir)/autoopts' \
+ DESTpkgdatadir='$(DESTDIR)$(pkgdatadir)' \
+ top_builddir='$(top_builddir)' \
+ LIBOPTS_VER='$(LIBOPTS_VER)' \
+ POSIX_SHELL='$(POSIX_SHELL)' \
+ bindir='$(bindir)' \
+ $(POSIX_SHELL) $(srcdir)/install-hook.sh
+
+.NOTPARALLEL:
+
+# Makefile.am ends here
diff --git a/autoopts/Makefile.in b/autoopts/Makefile.in
new file mode 100644
index 0000000..2d35b42
--- /dev/null
+++ b/autoopts/Makefile.in
@@ -0,0 +1,1193 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = autoopts
+DIST_COMMON = $(nobase_include_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/autoopts-config.in \
+ $(srcdir)/mk-autoopts-pc.in $(top_srcdir)/config/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = mk-autoopts-pc autoopts-config
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" \
+ "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(datadir)" \
+ "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgdatadir)" \
+ "$(DESTDIR)$(includedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libopts_la_DEPENDENCIES = $(top_builddir)/snprintfv/libsnprintfv.la
+am__objects_1 =
+am__objects_2 = $(am__objects_1)
+am_libopts_la_OBJECTS = $(am__objects_2)
+nodist_libopts_la_OBJECTS = libopts_la-libopts.lo
+libopts_la_OBJECTS = $(am_libopts_la_OBJECTS) \
+ $(nodist_libopts_la_OBJECTS)
+libopts_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libopts_la_CFLAGS) \
+ $(CFLAGS) $(libopts_la_LDFLAGS) $(LDFLAGS) -o $@
+SCRIPTS = $(bin_SCRIPTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libopts_la_SOURCES) $(nodist_libopts_la_SOURCES)
+DIST_SOURCES = $(libopts_la_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+man1dir = $(mandir)/man1
+man3dir = $(mandir)/man3
+NROFF = nroff
+MANS = $(man_MANS)
+DATA = $(m4data_DATA) $(nobase_data_DATA) $(nodist_pkgdata_DATA) \
+ $(pkgdata_DATA)
+HEADERS = $(nobase_include_HEADERS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = @AGexe@
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = @CLexe@
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUBDIRS = @OPTS_TESTDIR@
+INCLUDES = @INCLIST@
+libsrc = libopts-@AO_CURRENT@.@AO_REVISION@.@AO_AGE@.tar.gz
+LIBOPTS_VER = @AO_CURRENT@:@AO_REVISION@:@AO_AGE@
+@NEED_PATHFIND_FALSE@PATHFIND_MAN =
+@NEED_PATHFIND_TRUE@PATHFIND_MAN = pathfind.3
+MAN_STAMP = man3-stamp
+GENTEXI = libopts.texi libopts.menu
+TEXI_STAMP = texi-stamp
+EXTRA_DIST = $(top_srcdir)/config/gendocs.sh gettext.h \
+ parse-duration.c parse-duration.h $(SRC) $(EXTRA_DATA) \
+ $(man_MANS) $(DEF_FILES)
+GENMAN = $(PATHFIND_MAN) \
+ ao_string_tokenize.3 configFileLoad.3 optionFileLoad.3 \
+ optionFindNextValue.3 optionFindValue.3 optionFree.3 \
+ optionGetValue.3 optionLoadLine.3 optionNextValue.3 \
+ optionOnlyUsage.3 optionProcess.3 optionRestore.3 \
+ optionSaveFile.3 optionSaveState.3 optionUnloadNested.3 \
+ optionVersion.3 strequate.3 streqvcmp.3 \
+ streqvmap.3 strneqvcmp.3 strtransform.3
+
+nodist_pkgdata_DATA = $(libsrc) \
+ tpl/man2man tpl/man2mdoc tpl/man2texi \
+ tpl/mdoc2man tpl/mdoc2mdoc tpl/mdoc2texi \
+ tpl/texi2man tpl/texi2mdoc tpl/texi2texi \
+ tpl/tpl-config.tlib
+
+pkgdata_DATA = \
+ autoopts.m4 tpl/aginfo.tpl tpl/aginfo3.tpl \
+ tpl/agman-cmd.tpl tpl/agman.tlib tpl/agman1.tpl \
+ tpl/agman3.tpl tpl/agmdoc-cmd.tpl tpl/agpl.lic \
+ tpl/agtexi-cmd.tpl tpl/bits.tpl tpl/cmd-doc.tlib \
+ tpl/def2pot.tpl tpl/getopt.tpl tpl/gpl.lic \
+ tpl/gplv2.lic tpl/lgpl.lic tpl/mbsd.lic \
+ tpl/optcode.tlib tpl/opthead.tlib tpl/options.tpl \
+ tpl/optlib.tlib tpl/optmain.tlib tpl/rc-sample.tpl \
+ tpl/stdoptions.def tpl/strings.tpl tpl/usage.tlib
+
+EXTRA_DATA = $(pkgdata_DATA) \
+ autogen.map autoopts-config.in bootstrap.dir \
+ install-hook.sh mk-autoopts-pc.in mk-tpl-config.sh \
+ po tpl/man2mdoc.pl tpl/man2texi.sh \
+ tpl/mdoc2man.sh tpl/mdoc2texi.pl tpl/texi2man.sh \
+ tpl/texi2mdoc.sh tpl/tpl-config-tlib.in tpl/usage-txt.tpl
+
+GENSCRIPTS = $(srcdir)/funcs.def \
+ tpl/man2man tpl/man2mdoc tpl/man2texi tpl/mdoc2man tpl/mdoc2mdoc \
+ tpl/mdoc2texi tpl/texi2man tpl/texi2mdoc tpl/texi2texi
+
+GENHDRS = autoopts/options.h autoopts/usage-txt.h genshell.h \
+ xat-attribute.h value-type.h ao-strs.h ag-char-map.h
+
+HDRS = $(GENHDRS) autoopts.h project.h proto.h
+GEN_SRC = ao-strs.c value-type.c xat-attribute.c
+CSRC = parse-duration.c $(GEN_SRC) \
+ autoopts.c \
+ alias.c boolean.c check.c configfile.c cook.c \
+ enum.c env.c file.c find.c genshell.c \
+ load.c makeshell.c nested.c numeric.c pgusage.c \
+ putshell.c reset.c restore.c save.c sort.c \
+ stack.c streqvcmp.c text_mmap.c time.c tokenize.c \
+ usage.c version.c
+
+SRC = $(HDRS) $(CSRC) $(GENSRC)
+DEF_FILES = genshell.def $(srcdir)/funcs.def ao-strs.def
+pkgconfigdir = $(libdir)/pkgconfig
+CLEANFILES = tmp-* libopts.c
+DISTCLEANFILES = $(GENMAN) $(GENTEXI) *-stamp
+MAINTAINERCLEANFILES = $(GENHDRS) $(GENSRC) $(GENSCRIPTS)
+m4datadir = $(datadir)/aclocal
+nodist_libopts_la_SOURCES = libopts.c
+libopts_la_SOURCES = $(HDRS)
+libopts_la_CFLAGS = -DPKGDATADIR='"$(pkgdatadir)"'
+libopts_la_LDFLAGS = -version-info $(LIBOPTS_VER)
+libopts_la_LIBADD = $(top_builddir)/snprintfv/libsnprintfv.la
+INST_MANS = autoopts-config.1 $(GENMAN)
+INST_PKGCFG = pkgconfig/autoopts.pc
+INST_PKGDATA = autoopts.m4 $(TPL_FILES)
+INST_LIBS = libopts.la
+INST_HDRS = autoopts/options.h autoopts/usage-txt.h
+INST_SH = autoopts-config
+man_MANS = $(INST_MANS)
+m4data_DATA = autoopts.m4
+nobase_data_DATA = $(INST_PKGCFG)
+lib_LTLIBRARIES = $(INST_LIBS)
+nobase_include_HEADERS = $(INST_HDRS)
+bin_SCRIPTS = $(INST_SH)
+BOOTENV = AGexe="$(AGexe)" GDexe="$(GDexe)" CLexe="$(CLexe)" \
+ srcdir="$(srcdir)" top_srcdir="$(top_srcdir)" \
+ builddir="$(builddir)" top_builddir="$(top_builddir)" \
+ POSIX_SHELL="$(POSIX_SHELL)"
+
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu autoopts/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu autoopts/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+mk-autoopts-pc: $(top_builddir)/config.status $(srcdir)/mk-autoopts-pc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+autoopts-config: $(top_builddir)/config.status $(srcdir)/autoopts-config.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+libopts.la: $(libopts_la_OBJECTS) $(libopts_la_DEPENDENCIES) $(EXTRA_libopts_la_DEPENDENCIES)
+ $(libopts_la_LINK) -rpath $(libdir) $(libopts_la_OBJECTS) $(libopts_la_LIBADD) $(LIBS)
+install-binSCRIPTS: $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libopts_la-libopts.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+libopts_la-libopts.lo: libopts.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libopts_la_CFLAGS) $(CFLAGS) -MT libopts_la-libopts.lo -MD -MP -MF $(DEPDIR)/libopts_la-libopts.Tpo -c -o libopts_la-libopts.lo `test -f 'libopts.c' || echo '$(srcdir)/'`libopts.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libopts_la-libopts.Tpo $(DEPDIR)/libopts_la-libopts.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libopts.c' object='libopts_la-libopts.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libopts_la_CFLAGS) $(CFLAGS) -c -o libopts_la-libopts.lo `test -f 'libopts.c' || echo '$(srcdir)/'`libopts.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-man1: $(man_MANS)
+ @$(NORMAL_INSTALL)
+ @list1=''; \
+ list2='$(man_MANS)'; \
+ test -n "$(man1dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.1[a-z]*$$/p'; \
+ fi; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man1dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.1[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+install-man3: $(man_MANS)
+ @$(NORMAL_INSTALL)
+ @list1=''; \
+ list2='$(man_MANS)'; \
+ test -n "$(man3dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.3[a-z]*$$/p'; \
+ fi; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man3:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man3dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.3[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir)
+install-m4dataDATA: $(m4data_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(m4data_DATA)'; test -n "$(m4datadir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(m4datadir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(m4datadir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(m4datadir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(m4datadir)" || exit $$?; \
+ done
+
+uninstall-m4dataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(m4data_DATA)'; test -n "$(m4datadir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(m4datadir)'; $(am__uninstall_files_from_dir)
+install-nobase_dataDATA: $(nobase_data_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(nobase_data_DATA)'; test -n "$(datadir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(datadir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(datadir)" || exit 1; \
+ fi; \
+ $(am__nobase_list) | while read dir files; do \
+ xfiles=; for file in $$files; do \
+ if test -f "$$file"; then xfiles="$$xfiles $$file"; \
+ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
+ test -z "$$xfiles" || { \
+ test "x$$dir" = x. || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(datadir)/$$dir'"; \
+ $(MKDIR_P) "$(DESTDIR)$(datadir)/$$dir"; }; \
+ echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(datadir)/$$dir'"; \
+ $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(datadir)/$$dir" || exit $$?; }; \
+ done
+
+uninstall-nobase_dataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nobase_data_DATA)'; test -n "$(datadir)" || list=; \
+ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
+ dir='$(DESTDIR)$(datadir)'; $(am__uninstall_files_from_dir)
+install-nodist_pkgdataDATA: $(nodist_pkgdata_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(nodist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgdatadir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \
+ done
+
+uninstall-nodist_pkgdataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nodist_pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir)
+install-pkgdataDATA: $(pkgdata_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pkgdatadir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \
+ done
+
+uninstall-pkgdataDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(pkgdatadir)'; $(am__uninstall_files_from_dir)
+install-nobase_includeHEADERS: $(nobase_include_HEADERS)
+ @$(NORMAL_INSTALL)
+ @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+ fi; \
+ $(am__nobase_list) | while read dir files; do \
+ xfiles=; for file in $$files; do \
+ if test -f "$$file"; then xfiles="$$xfiles $$file"; \
+ else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
+ test -z "$$xfiles" || { \
+ test "x$$dir" = x. || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)/$$dir'"; \
+ $(MKDIR_P) "$(DESTDIR)$(includedir)/$$dir"; }; \
+ echo " $(INSTALL_HEADER) $$xfiles '$(DESTDIR)$(includedir)/$$dir'"; \
+ $(INSTALL_HEADER) $$xfiles "$(DESTDIR)$(includedir)/$$dir" || exit $$?; }; \
+ done
+
+uninstall-nobase_includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(nobase_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
+ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+cscopelist-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @list='$(MANS)'; if test -n "$$list"; then \
+ list=`for p in $$list; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+ if test -n "$$list" && \
+ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+ echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \
+ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
+ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+ echo " typically 'make maintainer-clean' will remove them" >&2; \
+ exit 1; \
+ else :; fi; \
+ else :; fi
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(LTLIBRARIES) $(SCRIPTS) $(MANS) $(DATA) $(HEADERS)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(datadir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-recursive
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-data-local install-m4dataDATA install-man \
+ install-nobase_dataDATA install-nobase_includeHEADERS \
+ install-nodist_pkgdataDATA install-pkgdataDATA
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am: install-binSCRIPTS install-libLTLIBRARIES
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man: install-man1 install-man3
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binSCRIPTS uninstall-libLTLIBRARIES \
+ uninstall-m4dataDATA uninstall-man uninstall-nobase_dataDATA \
+ uninstall-nobase_includeHEADERS uninstall-nodist_pkgdataDATA \
+ uninstall-pkgdataDATA
+
+uninstall-man: uninstall-man1 uninstall-man3
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \
+ cscopelist-recursive ctags-recursive install-am \
+ install-data-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool cscopelist \
+ cscopelist-recursive ctags ctags-recursive distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-binSCRIPTS install-data \
+ install-data-am install-data-hook install-data-local \
+ install-dvi install-dvi-am install-exec install-exec-am \
+ install-html install-html-am install-info install-info-am \
+ install-libLTLIBRARIES install-m4dataDATA install-man \
+ install-man1 install-man3 install-nobase_dataDATA \
+ install-nobase_includeHEADERS install-nodist_pkgdataDATA \
+ install-pdf install-pdf-am install-pkgdataDATA install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-binSCRIPTS uninstall-libLTLIBRARIES \
+ uninstall-m4dataDATA uninstall-man uninstall-man1 \
+ uninstall-man3 uninstall-nobase_dataDATA \
+ uninstall-nobase_includeHEADERS uninstall-nodist_pkgdataDATA \
+ uninstall-pkgdataDATA
+
+
+libopts.c : tpl-config-stamp
+$(GENSCRIPTS) : tpl-config-stamp
+
+tpl-config-stamp: $(HDRS) $(CSRC) \
+ $(top_builddir)/config.h $(srcdir)/mk-tpl-config.sh
+ $(BOOTENV) \
+ $(POSIX_SHELL) $(srcdir)/mk-tpl-config.sh $@ $(HDRS) $(CSRC)
+
+makeshell.lo : genshell.c
+genshell.c : $(srcdir)/genshell.def
+ $(BOOTENV) \
+ $(POSIX_SHELL) $(srcdir)/bootstrap.dir $@
+
+strcspn.lo : $(top_srcdir)/compat/strcspn.c
+ $(LTCOMPILE) -o $@ -c $(top_srcdir)/compat/strcspn.c
+
+install-data-local : install-man3
+
+$(GENMAN) : $(MAN_STAMP)
+$(MAN_STAMP) : $(srcdir)/funcs.def
+ @test -x ../agen5/autogen || exit 0 ; \
+ touch tmp-$@ ; \
+ opts='-L$(srcdir)/tpl -L$(builddir)/tpl -Tagman3.tpl' ; \
+ echo ! $(AGexe) $${opts} $(srcdir)/funcs.def ; \
+ $(AGexe) $${opts} $(srcdir)/funcs.def ; \
+ mv -f tmp-$@ $@
+
+$(GENTEXI) : $(TEXI_STAMP)
+$(TEXI_STAMP) : ../agen5/autogen $(srcdir)/funcs.def
+ @touch tmp-$@ ; \
+ opts='-L$(srcdir)/tpl -L$(builddir)/tpl -Taginfo3.tpl' ; \
+ cmd="$(AGexe) $${opts} -DLEVEL=subsection -blibopts" ; \
+ cmd="$${cmd} -L$(srcdir) $(srcdir)/funcs.def" ; \
+ echo ! $$cmd ; $$cmd ; mv -f tmp-$@ $@
+
+libsrc : $(libsrc)
+$(libsrc) :
+ @$(BOOTENV) \
+ AO_AGE=@AO_AGE@ AO_CURRENT=@AO_CURRENT@ AO_REVISION=@AO_REVISION@ \
+ $(POSIX_SHELL) $(top_srcdir)/pkg/libopts/mklibsrc.sh
+
+pkgconfig/autoopts.pc : mk-autoopts-pc
+ $(POSIX_SHELL) mk-autoopts-pc $@
+
+install-data-hook:
+ @DESTdestdir='$(DESTDIR)$(includedir)/autoopts' \
+ DESTpkgdatadir='$(DESTDIR)$(pkgdatadir)' \
+ top_builddir='$(top_builddir)' \
+ LIBOPTS_VER='$(LIBOPTS_VER)' \
+ POSIX_SHELL='$(POSIX_SHELL)' \
+ bindir='$(bindir)' \
+ $(POSIX_SHELL) $(srcdir)/install-hook.sh
+
+.NOTPARALLEL:
+
+# Makefile.am ends here
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/autoopts/ag-char-map.h b/autoopts/ag-char-map.h
new file mode 100644
index 0000000..0f81225
--- /dev/null
+++ b/autoopts/ag-char-map.h
@@ -0,0 +1,510 @@
+/*
+ * 29 bits for 46 character classifications
+ * generated by char-mapper on 08/11/12 at 09:41:13
+ *
+ * This file contains the character classifications
+ * used by AutoGen and AutoOpts for identifying tokens.
+ * The table is static scope, so %guard is empty.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+#ifndef AG_CHAR_MAP_H_GUARD
+#define AG_CHAR_MAP_H_GUARD 1
+
+#ifdef HAVE_CONFIG_H
+# if defined(HAVE_INTTYPES_H)
+# include <inttypes.h>
+
+# elif defined(HAVE_STDINT_H)
+# include <stdint.h>
+
+# elif !defined(HAVE_UINT32_T)
+# if SIZEOF_INT == 4
+ typedef unsigned int uint32_t;
+# elif SIZEOF_LONG == 4
+ typedef unsigned long uint32_t;
+# endif
+# endif /* HAVE_*INT*_H header */
+
+#else /* not HAVE_CONFIG_H -- */
+# include <inttypes.h>
+#endif /* HAVE_CONFIG_H */
+
+#if 0 /* mapping specification source (from autogen.map) */
+//
+// %guard
+// %file ag-char-map.h
+// %backup
+// %optimize
+//
+// %comment -- see above
+// %
+//
+// newline "\n"
+// nul-byte "\x00"
+// dir-sep "/\\"
+// percent "%"
+// comma ","
+// colon ":"
+// underscore "_"
+// plus "+"
+// dollar "$"
+// option-marker "-"
+//
+// horiz-white "\t "
+// alt-white "\v\f\r\b"
+// whitespace +horiz-white +newline +alt-white
+// non-nl-white +horiz-white +alt-white
+// quote "'\""
+// parentheses "()"
+//
+// graphic "!-~"
+// inversion "~-"
+// oct-digit "0-7"
+// dec-digit "89" +oct-digit
+// hex-digit "a-fA-F" +dec-digit
+// lower-case "a-z"
+// upper-case "A-Z"
+// alphabetic +lower-case +upper-case
+// alphanumeric +alphabetic +dec-digit
+// var-first +underscore +alphabetic
+// variable-name +var-first +dec-digit
+// option-name "^-" +variable-name
+// value-name +colon +option-name
+// name-sep "[.]"
+// compound-name +value-name +name-sep +horiz-white
+// scheme-note +parentheses +quote
+//
+// unquotable "!-~" -"#,;<=>[\\]`{}?*" -quote -parentheses
+// end-xml-token "/>" +whitespace
+// plus-n-space +plus +whitespace
+// punctuation "!-~" -alphanumeric -"_"
+// suffix "-._" +alphanumeric
+// suffix-fmt +percent +suffix +dir-sep
+// false-type "nNfF0" +nul-byte
+// file-name +dir-sep +suffix
+// end-token +nul-byte +whitespace
+// end-list-entry +comma +end-token
+// set-separator "|+" +end-list-entry
+// signed-number +inversion +dec-digit
+// make-script +dollar +newline
+// load-line-skip +horiz-white +option-marker
+//
+#endif /* 0 -- mapping spec. source */
+
+
+typedef uint32_t ag_char_map_mask_t;
+
+#define IS_NEWLINE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000001)
+#define SPN_NEWLINE_CHARS(_s) spn_ag_char_map_chars(_s, 0)
+#define BRK_NEWLINE_CHARS(_s) brk_ag_char_map_chars(_s, 0)
+#define SPN_NEWLINE_BACK(s,e) spn_ag_char_map_back(s, e, 0)
+#define BRK_NEWLINE_BACK(s,e) brk_ag_char_map_back(s, e, 0)
+#define IS_NUL_BYTE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000002)
+#define SPN_NUL_BYTE_CHARS(_s) spn_ag_char_map_chars(_s, 1)
+#define BRK_NUL_BYTE_CHARS(_s) brk_ag_char_map_chars(_s, 1)
+#define SPN_NUL_BYTE_BACK(s,e) spn_ag_char_map_back(s, e, 1)
+#define BRK_NUL_BYTE_BACK(s,e) brk_ag_char_map_back(s, e, 1)
+#define IS_DIR_SEP_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000004)
+#define SPN_DIR_SEP_CHARS(_s) spn_ag_char_map_chars(_s, 2)
+#define BRK_DIR_SEP_CHARS(_s) brk_ag_char_map_chars(_s, 2)
+#define SPN_DIR_SEP_BACK(s,e) spn_ag_char_map_back(s, e, 2)
+#define BRK_DIR_SEP_BACK(s,e) brk_ag_char_map_back(s, e, 2)
+#define IS_PERCENT_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000008)
+#define SPN_PERCENT_CHARS(_s) spn_ag_char_map_chars(_s, 3)
+#define BRK_PERCENT_CHARS(_s) brk_ag_char_map_chars(_s, 3)
+#define SPN_PERCENT_BACK(s,e) spn_ag_char_map_back(s, e, 3)
+#define BRK_PERCENT_BACK(s,e) brk_ag_char_map_back(s, e, 3)
+#define IS_COMMA_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000010)
+#define SPN_COMMA_CHARS(_s) spn_ag_char_map_chars(_s, 4)
+#define BRK_COMMA_CHARS(_s) brk_ag_char_map_chars(_s, 4)
+#define SPN_COMMA_BACK(s,e) spn_ag_char_map_back(s, e, 4)
+#define BRK_COMMA_BACK(s,e) brk_ag_char_map_back(s, e, 4)
+#define IS_COLON_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000020)
+#define SPN_COLON_CHARS(_s) spn_ag_char_map_chars(_s, 5)
+#define BRK_COLON_CHARS(_s) brk_ag_char_map_chars(_s, 5)
+#define SPN_COLON_BACK(s,e) spn_ag_char_map_back(s, e, 5)
+#define BRK_COLON_BACK(s,e) brk_ag_char_map_back(s, e, 5)
+#define IS_UNDERSCORE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000040)
+#define SPN_UNDERSCORE_CHARS(_s) spn_ag_char_map_chars(_s, 6)
+#define BRK_UNDERSCORE_CHARS(_s) brk_ag_char_map_chars(_s, 6)
+#define SPN_UNDERSCORE_BACK(s,e) spn_ag_char_map_back(s, e, 6)
+#define BRK_UNDERSCORE_BACK(s,e) brk_ag_char_map_back(s, e, 6)
+#define IS_PLUS_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000080)
+#define SPN_PLUS_CHARS(_s) spn_ag_char_map_chars(_s, 7)
+#define BRK_PLUS_CHARS(_s) brk_ag_char_map_chars(_s, 7)
+#define SPN_PLUS_BACK(s,e) spn_ag_char_map_back(s, e, 7)
+#define BRK_PLUS_BACK(s,e) brk_ag_char_map_back(s, e, 7)
+#define IS_DOLLAR_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000100)
+#define SPN_DOLLAR_CHARS(_s) spn_ag_char_map_chars(_s, 8)
+#define BRK_DOLLAR_CHARS(_s) brk_ag_char_map_chars(_s, 8)
+#define SPN_DOLLAR_BACK(s,e) spn_ag_char_map_back(s, e, 8)
+#define BRK_DOLLAR_BACK(s,e) brk_ag_char_map_back(s, e, 8)
+#define IS_OPTION_MARKER_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000200)
+#define SPN_OPTION_MARKER_CHARS(_s) spn_ag_char_map_chars(_s, 9)
+#define BRK_OPTION_MARKER_CHARS(_s) brk_ag_char_map_chars(_s, 9)
+#define SPN_OPTION_MARKER_BACK(s,e) spn_ag_char_map_back(s, e, 9)
+#define BRK_OPTION_MARKER_BACK(s,e) brk_ag_char_map_back(s, e, 9)
+#define IS_HORIZ_WHITE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000400)
+#define SPN_HORIZ_WHITE_CHARS(_s) spn_ag_char_map_chars(_s, 10)
+#define BRK_HORIZ_WHITE_CHARS(_s) brk_ag_char_map_chars(_s, 10)
+#define SPN_HORIZ_WHITE_BACK(s,e) spn_ag_char_map_back(s, e, 10)
+#define BRK_HORIZ_WHITE_BACK(s,e) brk_ag_char_map_back(s, e, 10)
+#define IS_ALT_WHITE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000800)
+#define SPN_ALT_WHITE_CHARS(_s) spn_ag_char_map_chars(_s, 11)
+#define BRK_ALT_WHITE_CHARS(_s) brk_ag_char_map_chars(_s, 11)
+#define SPN_ALT_WHITE_BACK(s,e) spn_ag_char_map_back(s, e, 11)
+#define BRK_ALT_WHITE_BACK(s,e) brk_ag_char_map_back(s, e, 11)
+#define IS_WHITESPACE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000C01)
+#define SPN_WHITESPACE_CHARS(_s) spn_ag_char_map_chars(_s, 12)
+#define BRK_WHITESPACE_CHARS(_s) brk_ag_char_map_chars(_s, 12)
+#define SPN_WHITESPACE_BACK(s,e) spn_ag_char_map_back(s, e, 12)
+#define BRK_WHITESPACE_BACK(s,e) brk_ag_char_map_back(s, e, 12)
+#define IS_NON_NL_WHITE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000C00)
+#define SPN_NON_NL_WHITE_CHARS(_s) spn_ag_char_map_chars(_s, 13)
+#define BRK_NON_NL_WHITE_CHARS(_s) brk_ag_char_map_chars(_s, 13)
+#define SPN_NON_NL_WHITE_BACK(s,e) spn_ag_char_map_back(s, e, 13)
+#define BRK_NON_NL_WHITE_BACK(s,e) brk_ag_char_map_back(s, e, 13)
+#define IS_QUOTE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00001000)
+#define SPN_QUOTE_CHARS(_s) spn_ag_char_map_chars(_s, 14)
+#define BRK_QUOTE_CHARS(_s) brk_ag_char_map_chars(_s, 14)
+#define SPN_QUOTE_BACK(s,e) spn_ag_char_map_back(s, e, 14)
+#define BRK_QUOTE_BACK(s,e) brk_ag_char_map_back(s, e, 14)
+#define IS_PARENTHESES_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00002000)
+#define SPN_PARENTHESES_CHARS(_s) spn_ag_char_map_chars(_s, 15)
+#define BRK_PARENTHESES_CHARS(_s) brk_ag_char_map_chars(_s, 15)
+#define SPN_PARENTHESES_BACK(s,e) spn_ag_char_map_back(s, e, 15)
+#define BRK_PARENTHESES_BACK(s,e) brk_ag_char_map_back(s, e, 15)
+#define IS_GRAPHIC_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00004000)
+#define SPN_GRAPHIC_CHARS(_s) spn_ag_char_map_chars(_s, 16)
+#define BRK_GRAPHIC_CHARS(_s) brk_ag_char_map_chars(_s, 16)
+#define SPN_GRAPHIC_BACK(s,e) spn_ag_char_map_back(s, e, 16)
+#define BRK_GRAPHIC_BACK(s,e) brk_ag_char_map_back(s, e, 16)
+#define IS_INVERSION_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00008000)
+#define SPN_INVERSION_CHARS(_s) spn_ag_char_map_chars(_s, 17)
+#define BRK_INVERSION_CHARS(_s) brk_ag_char_map_chars(_s, 17)
+#define SPN_INVERSION_BACK(s,e) spn_ag_char_map_back(s, e, 17)
+#define BRK_INVERSION_BACK(s,e) brk_ag_char_map_back(s, e, 17)
+#define IS_OCT_DIGIT_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00010000)
+#define SPN_OCT_DIGIT_CHARS(_s) spn_ag_char_map_chars(_s, 18)
+#define BRK_OCT_DIGIT_CHARS(_s) brk_ag_char_map_chars(_s, 18)
+#define SPN_OCT_DIGIT_BACK(s,e) spn_ag_char_map_back(s, e, 18)
+#define BRK_OCT_DIGIT_BACK(s,e) brk_ag_char_map_back(s, e, 18)
+#define IS_DEC_DIGIT_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00030000)
+#define SPN_DEC_DIGIT_CHARS(_s) spn_ag_char_map_chars(_s, 19)
+#define BRK_DEC_DIGIT_CHARS(_s) brk_ag_char_map_chars(_s, 19)
+#define SPN_DEC_DIGIT_BACK(s,e) spn_ag_char_map_back(s, e, 19)
+#define BRK_DEC_DIGIT_BACK(s,e) brk_ag_char_map_back(s, e, 19)
+#define IS_HEX_DIGIT_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00070000)
+#define SPN_HEX_DIGIT_CHARS(_s) spn_ag_char_map_chars(_s, 20)
+#define BRK_HEX_DIGIT_CHARS(_s) brk_ag_char_map_chars(_s, 20)
+#define SPN_HEX_DIGIT_BACK(s,e) spn_ag_char_map_back(s, e, 20)
+#define BRK_HEX_DIGIT_BACK(s,e) brk_ag_char_map_back(s, e, 20)
+#define IS_LOWER_CASE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00080000)
+#define SPN_LOWER_CASE_CHARS(_s) spn_ag_char_map_chars(_s, 21)
+#define BRK_LOWER_CASE_CHARS(_s) brk_ag_char_map_chars(_s, 21)
+#define SPN_LOWER_CASE_BACK(s,e) spn_ag_char_map_back(s, e, 21)
+#define BRK_LOWER_CASE_BACK(s,e) brk_ag_char_map_back(s, e, 21)
+#define IS_UPPER_CASE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00100000)
+#define SPN_UPPER_CASE_CHARS(_s) spn_ag_char_map_chars(_s, 22)
+#define BRK_UPPER_CASE_CHARS(_s) brk_ag_char_map_chars(_s, 22)
+#define SPN_UPPER_CASE_BACK(s,e) spn_ag_char_map_back(s, e, 22)
+#define BRK_UPPER_CASE_BACK(s,e) brk_ag_char_map_back(s, e, 22)
+#define IS_ALPHABETIC_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00180000)
+#define SPN_ALPHABETIC_CHARS(_s) spn_ag_char_map_chars(_s, 23)
+#define BRK_ALPHABETIC_CHARS(_s) brk_ag_char_map_chars(_s, 23)
+#define SPN_ALPHABETIC_BACK(s,e) spn_ag_char_map_back(s, e, 23)
+#define BRK_ALPHABETIC_BACK(s,e) brk_ag_char_map_back(s, e, 23)
+#define IS_ALPHANUMERIC_CHAR( _c) is_ag_char_map_char((char)(_c), 0x001B0000)
+#define SPN_ALPHANUMERIC_CHARS(_s) spn_ag_char_map_chars(_s, 24)
+#define BRK_ALPHANUMERIC_CHARS(_s) brk_ag_char_map_chars(_s, 24)
+#define SPN_ALPHANUMERIC_BACK(s,e) spn_ag_char_map_back(s, e, 24)
+#define BRK_ALPHANUMERIC_BACK(s,e) brk_ag_char_map_back(s, e, 24)
+#define IS_VAR_FIRST_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00180040)
+#define SPN_VAR_FIRST_CHARS(_s) spn_ag_char_map_chars(_s, 25)
+#define BRK_VAR_FIRST_CHARS(_s) brk_ag_char_map_chars(_s, 25)
+#define SPN_VAR_FIRST_BACK(s,e) spn_ag_char_map_back(s, e, 25)
+#define BRK_VAR_FIRST_BACK(s,e) brk_ag_char_map_back(s, e, 25)
+#define IS_VARIABLE_NAME_CHAR( _c) is_ag_char_map_char((char)(_c), 0x001B0040)
+#define SPN_VARIABLE_NAME_CHARS(_s) spn_ag_char_map_chars(_s, 26)
+#define BRK_VARIABLE_NAME_CHARS(_s) brk_ag_char_map_chars(_s, 26)
+#define SPN_VARIABLE_NAME_BACK(s,e) spn_ag_char_map_back(s, e, 26)
+#define BRK_VARIABLE_NAME_BACK(s,e) brk_ag_char_map_back(s, e, 26)
+#define IS_OPTION_NAME_CHAR( _c) is_ag_char_map_char((char)(_c), 0x003B0040)
+#define SPN_OPTION_NAME_CHARS(_s) spn_ag_char_map_chars(_s, 27)
+#define BRK_OPTION_NAME_CHARS(_s) brk_ag_char_map_chars(_s, 27)
+#define SPN_OPTION_NAME_BACK(s,e) spn_ag_char_map_back(s, e, 27)
+#define BRK_OPTION_NAME_BACK(s,e) brk_ag_char_map_back(s, e, 27)
+#define IS_VALUE_NAME_CHAR( _c) is_ag_char_map_char((char)(_c), 0x003B0060)
+#define SPN_VALUE_NAME_CHARS(_s) spn_ag_char_map_chars(_s, 28)
+#define BRK_VALUE_NAME_CHARS(_s) brk_ag_char_map_chars(_s, 28)
+#define SPN_VALUE_NAME_BACK(s,e) spn_ag_char_map_back(s, e, 28)
+#define BRK_VALUE_NAME_BACK(s,e) brk_ag_char_map_back(s, e, 28)
+#define IS_NAME_SEP_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00400000)
+#define SPN_NAME_SEP_CHARS(_s) spn_ag_char_map_chars(_s, 29)
+#define BRK_NAME_SEP_CHARS(_s) brk_ag_char_map_chars(_s, 29)
+#define SPN_NAME_SEP_BACK(s,e) spn_ag_char_map_back(s, e, 29)
+#define BRK_NAME_SEP_BACK(s,e) brk_ag_char_map_back(s, e, 29)
+#define IS_COMPOUND_NAME_CHAR( _c) is_ag_char_map_char((char)(_c), 0x007B0460)
+#define SPN_COMPOUND_NAME_CHARS(_s) spn_ag_char_map_chars(_s, 30)
+#define BRK_COMPOUND_NAME_CHARS(_s) brk_ag_char_map_chars(_s, 30)
+#define SPN_COMPOUND_NAME_BACK(s,e) spn_ag_char_map_back(s, e, 30)
+#define BRK_COMPOUND_NAME_BACK(s,e) brk_ag_char_map_back(s, e, 30)
+#define IS_SCHEME_NOTE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00003000)
+#define SPN_SCHEME_NOTE_CHARS(_s) spn_ag_char_map_chars(_s, 31)
+#define BRK_SCHEME_NOTE_CHARS(_s) brk_ag_char_map_chars(_s, 31)
+#define SPN_SCHEME_NOTE_BACK(s,e) spn_ag_char_map_back(s, e, 31)
+#define BRK_SCHEME_NOTE_BACK(s,e) brk_ag_char_map_back(s, e, 31)
+#define IS_UNQUOTABLE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00800000)
+#define SPN_UNQUOTABLE_CHARS(_s) spn_ag_char_map_chars(_s, 32)
+#define BRK_UNQUOTABLE_CHARS(_s) brk_ag_char_map_chars(_s, 32)
+#define SPN_UNQUOTABLE_BACK(s,e) spn_ag_char_map_back(s, e, 32)
+#define BRK_UNQUOTABLE_BACK(s,e) brk_ag_char_map_back(s, e, 32)
+#define IS_END_XML_TOKEN_CHAR( _c) is_ag_char_map_char((char)(_c), 0x01000C01)
+#define SPN_END_XML_TOKEN_CHARS(_s) spn_ag_char_map_chars(_s, 33)
+#define BRK_END_XML_TOKEN_CHARS(_s) brk_ag_char_map_chars(_s, 33)
+#define SPN_END_XML_TOKEN_BACK(s,e) spn_ag_char_map_back(s, e, 33)
+#define BRK_END_XML_TOKEN_BACK(s,e) brk_ag_char_map_back(s, e, 33)
+#define IS_PLUS_N_SPACE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000C81)
+#define SPN_PLUS_N_SPACE_CHARS(_s) spn_ag_char_map_chars(_s, 34)
+#define BRK_PLUS_N_SPACE_CHARS(_s) brk_ag_char_map_chars(_s, 34)
+#define SPN_PLUS_N_SPACE_BACK(s,e) spn_ag_char_map_back(s, e, 34)
+#define BRK_PLUS_N_SPACE_BACK(s,e) brk_ag_char_map_back(s, e, 34)
+#define IS_PUNCTUATION_CHAR( _c) is_ag_char_map_char((char)(_c), 0x02000000)
+#define SPN_PUNCTUATION_CHARS(_s) spn_ag_char_map_chars(_s, 35)
+#define BRK_PUNCTUATION_CHARS(_s) brk_ag_char_map_chars(_s, 35)
+#define SPN_PUNCTUATION_BACK(s,e) spn_ag_char_map_back(s, e, 35)
+#define BRK_PUNCTUATION_BACK(s,e) brk_ag_char_map_back(s, e, 35)
+#define IS_SUFFIX_CHAR( _c) is_ag_char_map_char((char)(_c), 0x041B0000)
+#define SPN_SUFFIX_CHARS(_s) spn_ag_char_map_chars(_s, 36)
+#define BRK_SUFFIX_CHARS(_s) brk_ag_char_map_chars(_s, 36)
+#define SPN_SUFFIX_BACK(s,e) spn_ag_char_map_back(s, e, 36)
+#define BRK_SUFFIX_BACK(s,e) brk_ag_char_map_back(s, e, 36)
+#define IS_SUFFIX_FMT_CHAR( _c) is_ag_char_map_char((char)(_c), 0x041B000C)
+#define SPN_SUFFIX_FMT_CHARS(_s) spn_ag_char_map_chars(_s, 37)
+#define BRK_SUFFIX_FMT_CHARS(_s) brk_ag_char_map_chars(_s, 37)
+#define SPN_SUFFIX_FMT_BACK(s,e) spn_ag_char_map_back(s, e, 37)
+#define BRK_SUFFIX_FMT_BACK(s,e) brk_ag_char_map_back(s, e, 37)
+#define IS_FALSE_TYPE_CHAR( _c) is_ag_char_map_char((char)(_c), 0x08000002)
+#define SPN_FALSE_TYPE_CHARS(_s) spn_ag_char_map_chars(_s, 38)
+#define BRK_FALSE_TYPE_CHARS(_s) brk_ag_char_map_chars(_s, 38)
+#define SPN_FALSE_TYPE_BACK(s,e) spn_ag_char_map_back(s, e, 38)
+#define BRK_FALSE_TYPE_BACK(s,e) brk_ag_char_map_back(s, e, 38)
+#define IS_FILE_NAME_CHAR( _c) is_ag_char_map_char((char)(_c), 0x041B0004)
+#define SPN_FILE_NAME_CHARS(_s) spn_ag_char_map_chars(_s, 39)
+#define BRK_FILE_NAME_CHARS(_s) brk_ag_char_map_chars(_s, 39)
+#define SPN_FILE_NAME_BACK(s,e) spn_ag_char_map_back(s, e, 39)
+#define BRK_FILE_NAME_BACK(s,e) brk_ag_char_map_back(s, e, 39)
+#define IS_END_TOKEN_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000C03)
+#define SPN_END_TOKEN_CHARS(_s) spn_ag_char_map_chars(_s, 40)
+#define BRK_END_TOKEN_CHARS(_s) brk_ag_char_map_chars(_s, 40)
+#define SPN_END_TOKEN_BACK(s,e) spn_ag_char_map_back(s, e, 40)
+#define BRK_END_TOKEN_BACK(s,e) brk_ag_char_map_back(s, e, 40)
+#define IS_END_LIST_ENTRY_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000C13)
+#define SPN_END_LIST_ENTRY_CHARS(_s) spn_ag_char_map_chars(_s, 41)
+#define BRK_END_LIST_ENTRY_CHARS(_s) brk_ag_char_map_chars(_s, 41)
+#define SPN_END_LIST_ENTRY_BACK(s,e) spn_ag_char_map_back(s, e, 41)
+#define BRK_END_LIST_ENTRY_BACK(s,e) brk_ag_char_map_back(s, e, 41)
+#define IS_SET_SEPARATOR_CHAR( _c) is_ag_char_map_char((char)(_c), 0x10000C13)
+#define SPN_SET_SEPARATOR_CHARS(_s) spn_ag_char_map_chars(_s, 42)
+#define BRK_SET_SEPARATOR_CHARS(_s) brk_ag_char_map_chars(_s, 42)
+#define SPN_SET_SEPARATOR_BACK(s,e) spn_ag_char_map_back(s, e, 42)
+#define BRK_SET_SEPARATOR_BACK(s,e) brk_ag_char_map_back(s, e, 42)
+#define IS_SIGNED_NUMBER_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00038000)
+#define SPN_SIGNED_NUMBER_CHARS(_s) spn_ag_char_map_chars(_s, 43)
+#define BRK_SIGNED_NUMBER_CHARS(_s) brk_ag_char_map_chars(_s, 43)
+#define SPN_SIGNED_NUMBER_BACK(s,e) spn_ag_char_map_back(s, e, 43)
+#define BRK_SIGNED_NUMBER_BACK(s,e) brk_ag_char_map_back(s, e, 43)
+#define IS_MAKE_SCRIPT_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000101)
+#define SPN_MAKE_SCRIPT_CHARS(_s) spn_ag_char_map_chars(_s, 44)
+#define BRK_MAKE_SCRIPT_CHARS(_s) brk_ag_char_map_chars(_s, 44)
+#define SPN_MAKE_SCRIPT_BACK(s,e) spn_ag_char_map_back(s, e, 44)
+#define BRK_MAKE_SCRIPT_BACK(s,e) brk_ag_char_map_back(s, e, 44)
+#define IS_LOAD_LINE_SKIP_CHAR( _c) is_ag_char_map_char((char)(_c), 0x00000600)
+#define SPN_LOAD_LINE_SKIP_CHARS(_s) spn_ag_char_map_chars(_s, 45)
+#define BRK_LOAD_LINE_SKIP_CHARS(_s) brk_ag_char_map_chars(_s, 45)
+#define SPN_LOAD_LINE_SKIP_BACK(s,e) spn_ag_char_map_back(s, e, 45)
+#define BRK_LOAD_LINE_SKIP_BACK(s,e) brk_ag_char_map_back(s, e, 45)
+
+static ag_char_map_mask_t const ag_char_map_table[128] = {
+ /*NUL*/ 0x00000002, /*x01*/ 0x00000000, /*x02*/ 0x00000000, /*x03*/ 0x00000000,
+ /*x04*/ 0x00000000, /*x05*/ 0x00000000, /*x06*/ 0x00000000, /*BEL*/ 0x00000000,
+ /* BS*/ 0x00000800, /* HT*/ 0x00000400, /* NL*/ 0x00000001, /* VT*/ 0x00000800,
+ /* FF*/ 0x00000800, /* CR*/ 0x00000800, /*x0E*/ 0x00000000, /*x0F*/ 0x00000000,
+ /*x10*/ 0x00000000, /*x11*/ 0x00000000, /*x12*/ 0x00000000, /*x13*/ 0x00000000,
+ /*x14*/ 0x00000000, /*x15*/ 0x00000000, /*x16*/ 0x00000000, /*x17*/ 0x00000000,
+ /*x18*/ 0x00000000, /*x19*/ 0x00000000, /*x1A*/ 0x00000000, /*ESC*/ 0x00000000,
+ /*x1C*/ 0x00000000, /*x1D*/ 0x00000000, /*x1E*/ 0x00000000, /*x1F*/ 0x00000000,
+ /* */ 0x00000400, /* ! */ 0x02804000, /* " */ 0x02005000, /* # */ 0x02004000,
+ /* $ */ 0x02804100, /* % */ 0x02804008, /* & */ 0x02804000, /* ' */ 0x02005000,
+ /* ( */ 0x02006000, /* ) */ 0x02006000, /* * */ 0x02004000, /* + */ 0x12804080,
+ /* , */ 0x02004010, /* - */ 0x06A0C200, /* . */ 0x06C04000, /* / */ 0x03804004,
+ /* 0 */ 0x08814000, /* 1 */ 0x00814000, /* 2 */ 0x00814000, /* 3 */ 0x00814000,
+ /* 4 */ 0x00814000, /* 5 */ 0x00814000, /* 6 */ 0x00814000, /* 7 */ 0x00814000,
+ /* 8 */ 0x00824000, /* 9 */ 0x00824000, /* : */ 0x02804020, /* ; */ 0x02004000,
+ /* < */ 0x02004000, /* = */ 0x02004000, /* > */ 0x03004000, /* ? */ 0x02004000,
+ /* @ */ 0x02804000, /* A */ 0x00944000, /* B */ 0x00944000, /* C */ 0x00944000,
+ /* D */ 0x00944000, /* E */ 0x00944000, /* F */ 0x08944000, /* G */ 0x00904000,
+ /* H */ 0x00904000, /* I */ 0x00904000, /* J */ 0x00904000, /* K */ 0x00904000,
+ /* L */ 0x00904000, /* M */ 0x00904000, /* N */ 0x08904000, /* O */ 0x00904000,
+ /* P */ 0x00904000, /* Q */ 0x00904000, /* R */ 0x00904000, /* S */ 0x00904000,
+ /* T */ 0x00904000, /* U */ 0x00904000, /* V */ 0x00904000, /* W */ 0x00904000,
+ /* X */ 0x00904000, /* Y */ 0x00904000, /* Z */ 0x00904000, /* [ */ 0x02404000,
+ /* \ */ 0x02004004, /* ] */ 0x02404000, /* ^ */ 0x02A04000, /* _ */ 0x04804040,
+ /* ` */ 0x02004000, /* a */ 0x008C4000, /* b */ 0x008C4000, /* c */ 0x008C4000,
+ /* d */ 0x008C4000, /* e */ 0x008C4000, /* f */ 0x088C4000, /* g */ 0x00884000,
+ /* h */ 0x00884000, /* i */ 0x00884000, /* j */ 0x00884000, /* k */ 0x00884000,
+ /* l */ 0x00884000, /* m */ 0x00884000, /* n */ 0x08884000, /* o */ 0x00884000,
+ /* p */ 0x00884000, /* q */ 0x00884000, /* r */ 0x00884000, /* s */ 0x00884000,
+ /* t */ 0x00884000, /* u */ 0x00884000, /* v */ 0x00884000, /* w */ 0x00884000,
+ /* x */ 0x00884000, /* y */ 0x00884000, /* z */ 0x00884000, /* { */ 0x02004000,
+ /* | */ 0x12804000, /* } */ 0x02004000, /* ~ */ 0x0280C000, /*x7F*/ 0x00000000
+};
+
+#include <stdlib.h>
+#include <string.h>
+
+static unsigned char const * ag_char_map_spanners[46];
+/**
+ * Character category masks. Some categories may have multiple bits,
+ * if their definition incorporates other character categories.
+ * This mask array is only used by calc_ag_char_map_spanners().
+ */
+static ag_char_map_mask_t const ag_char_map_masks[46] = {
+ 0x00000001, /* NEWLINE */
+ 0x00000002, /* NUL_BYTE */
+ 0x00000004, /* DIR_SEP */
+ 0x00000008, /* PERCENT */
+ 0x00000010, /* COMMA */
+ 0x00000020, /* COLON */
+ 0x00000040, /* UNDERSCORE */
+ 0x00000080, /* PLUS */
+ 0x00000100, /* DOLLAR */
+ 0x00000200, /* OPTION_MARKER */
+ 0x00000400, /* HORIZ_WHITE */
+ 0x00000800, /* ALT_WHITE */
+ 0x00000C01, /* WHITESPACE */
+ 0x00000C00, /* NON_NL_WHITE */
+ 0x00001000, /* QUOTE */
+ 0x00002000, /* PARENTHESES */
+ 0x00004000, /* GRAPHIC */
+ 0x00008000, /* INVERSION */
+ 0x00010000, /* OCT_DIGIT */
+ 0x00030000, /* DEC_DIGIT */
+ 0x00070000, /* HEX_DIGIT */
+ 0x00080000, /* LOWER_CASE */
+ 0x00100000, /* UPPER_CASE */
+ 0x00180000, /* ALPHABETIC */
+ 0x001B0000, /* ALPHANUMERIC */
+ 0x00180040, /* VAR_FIRST */
+ 0x001B0040, /* VARIABLE_NAME */
+ 0x003B0040, /* OPTION_NAME */
+ 0x003B0060, /* VALUE_NAME */
+ 0x00400000, /* NAME_SEP */
+ 0x007B0460, /* COMPOUND_NAME */
+ 0x00003000, /* SCHEME_NOTE */
+ 0x00800000, /* UNQUOTABLE */
+ 0x01000C01, /* END_XML_TOKEN */
+ 0x00000C81, /* PLUS_N_SPACE */
+ 0x02000000, /* PUNCTUATION */
+ 0x041B0000, /* SUFFIX */
+ 0x041B000C, /* SUFFIX_FMT */
+ 0x08000002, /* FALSE_TYPE */
+ 0x041B0004, /* FILE_NAME */
+ 0x00000C03, /* END_TOKEN */
+ 0x00000C13, /* END_LIST_ENTRY */
+ 0x10000C13, /* SET_SEPARATOR */
+ 0x00038000, /* SIGNED_NUMBER */
+ 0x00000101, /* MAKE_SCRIPT */
+ 0x00000600, /* LOAD_LINE_SKIP */
+};
+
+#define lock_ag_char_map_spanners()
+#define unlock_ag_char_map_spanners()
+
+static unsigned char const *
+calc_ag_char_map_spanners(unsigned int mask_ix)
+{
+ lock_ag_char_map_spanners();
+ if (ag_char_map_spanners[mask_ix] == NULL) {
+ int ix = 1;
+ ag_char_map_mask_t mask = ag_char_map_masks[mask_ix];
+ unsigned char * res = malloc(256 /* 1 << NBBY */);
+ memset(res, 0, 256);
+ for (; ix < 128; ix++)
+ if (ag_char_map_table[ix] & mask)
+ res[ix] = 1;
+ ag_char_map_spanners[mask_ix] = res;
+ }
+ unlock_ag_char_map_spanners();
+ return ag_char_map_spanners[mask_ix];
+}
+#define ag_char_map_masks POISONED_ag_char_map_masks
+
+static inline int
+is_ag_char_map_char(char ch, ag_char_map_mask_t mask)
+{
+ unsigned int ix = (unsigned char)ch;
+ return ((ix < 128) && ((ag_char_map_table[ix] & mask) != 0));
+}
+
+static inline char *
+spn_ag_char_map_chars(char const * p, unsigned int mask_ix)
+{
+ unsigned char const * v = ag_char_map_spanners[mask_ix];
+ if (v == NULL)
+ v = calc_ag_char_map_spanners(mask_ix);
+ while (v[(unsigned)*p]) p++;
+ return (char *)(uintptr_t)p;
+}
+
+static inline char *
+brk_ag_char_map_chars(char const * p, unsigned int mask_ix)
+{
+ unsigned char const * v = ag_char_map_spanners[mask_ix];
+ if (v == NULL)
+ v = calc_ag_char_map_spanners(mask_ix);
+ while ((*p != '\0') && (! v[(unsigned)*p])) p++;
+ return (char *)(uintptr_t)p;
+}
+
+static inline char *
+spn_ag_char_map_back(char const * s, char const * e, unsigned int mask_ix)
+{
+ unsigned char const * v = ag_char_map_spanners[mask_ix];
+ if (v == NULL)
+ v = calc_ag_char_map_spanners(mask_ix);
+ if (s >= e) e = s + strlen(s);
+ while ((e > s) && v[(unsigned)e[-1]]) e--;
+ return (char *)(uintptr_t)e;
+}
+
+static inline char *
+brk_ag_char_map_back(char const * s, char const * e, unsigned int mask_ix)
+{
+ unsigned char const * v = ag_char_map_spanners[mask_ix];
+ if (v == NULL)
+ v = calc_ag_char_map_spanners(mask_ix);
+ if (s == e) e += strlen(e);
+ while ((e > s) && (! v[(unsigned)e[-1]])) e--;
+ return (char *)(uintptr_t)e;
+}
+#endif /* AG_CHAR_MAP_H_GUARD */
diff --git a/autoopts/alias.c b/autoopts/alias.c
new file mode 100644
index 0000000..f42b619
--- /dev/null
+++ b/autoopts/alias.c
@@ -0,0 +1,108 @@
+
+/**
+ * \file alias.c
+ *
+ * Time-stamp: "2012-08-11 08:15:43 bkorb"
+ *
+ * Automated Options Paged Usage module.
+ *
+ * This routine will forward an option alias to the correct option code.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/*=export_func optionAlias
+ * private:
+ *
+ * what: relay an option to its alias
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ * arg: + unsigned int + alias + the aliased-to option index +
+ * ret-type: int
+ *
+ * doc:
+ * Handle one option as if it had been specified as another. Exactly.
+ * Returns "-1" if the aliased-to option has appeared too many times.
+=*/
+int
+optionAlias(tOptions * pOpts, tOptDesc * pOldOD, unsigned int alias)
+{
+ tOptDesc * pOD;
+
+ if (pOpts <= OPTPROC_EMIT_LIMIT)
+ return 0;
+
+ pOD = pOpts->pOptDesc + alias;
+ if ((unsigned)pOpts->optCt <= alias) {
+ fwrite(zAliasRange, strlen (zAliasRange), 1, stderr);
+ exit(EXIT_FAILURE);
+ }
+
+ /*
+ * Copy over the option instance flags
+ */
+ pOD->fOptState &= OPTST_PERSISTENT_MASK;
+ pOD->fOptState |= (pOldOD->fOptState & ~OPTST_PERSISTENT_MASK);
+ pOD->optArg.argString = pOldOD->optArg.argString;
+
+ /*
+ * Keep track of count only for DEFINED (command line) options.
+ * IF we have too many, build up an error message and bail.
+ */
+ if ( (pOD->fOptState & OPTST_DEFINED)
+ && (++pOD->optOccCt > pOD->optMaxCt) ) {
+
+ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) {
+ char const * pzEqv =
+ (pOD->optEquivIndex != NO_EQUIVALENT) ? zEquiv : zNil;
+
+ fputs(zErrOnly, stderr);
+
+ if (pOD->optMaxCt > 1)
+ fprintf(stderr, zAtMost, pOD->optMaxCt, pOD->pz_Name, pzEqv);
+ else
+ fprintf(stderr, zOnlyOne, pOD->pz_Name, pzEqv);
+ }
+
+ return -1;
+ }
+
+ /*
+ * Clear the state bits and counters
+ */
+ pOldOD->fOptState &= OPTST_PERSISTENT_MASK;
+ pOldOD->optOccCt = 0;
+
+ /*
+ * If there is a procedure to call, call it
+ */
+ if (pOD->pOptProc != NULL)
+ (*pOD->pOptProc)(pOpts, pOD);
+ return 0;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/alias.c */
diff --git a/autoopts/ao-strs.c b/autoopts/ao-strs.c
new file mode 100644
index 0000000..5f16caa
--- /dev/null
+++ b/autoopts/ao-strs.c
@@ -0,0 +1,323 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (ao-strs.c)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:13 AM by AutoGen 5.16.2pre7
+ * From the definitions ao-strs.def
+ * and the template file strings
+ *
+ * Copyright (C) 2011-2012 Bruce Korb, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the
+ * Modified (3 clause) Berkeley Software Distribution License
+ * <http://www.xfree86.org/3.3.6/COPYRIGHT2.html>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name ``Bruce Korb'' nor the name of any other
+ * contributor may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * strings IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bruce Korb OR ANY OTHER CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "ao-strs.h"
+
+char const ao_strs_strtable[6265] =
+/* 0 */ " \t\n"
+ ":=\0"
+/* 6 */ "INVALID-%d\0"
+/* 17 */ "*INVALID*\0"
+/* 27 */ "none\0"
+/* 32 */ " + \0"
+/* 36 */ " | \0"
+/* 40 */ "%s\n\0"
+/* 44 */ "PAGER\0"
+/* 50 */ "/tmp/use.%lu\0"
+/* 63 */ "more\0"
+/* 68 */ " --* )\n\0"
+/* 79 */ "%s\n"
+ " \0"
+/* 85 */ " \0"
+/* 88 */ " -* )\n\0"
+/* 98 */ " ;;\n\n\0"
+/* 111 */ "stdout\0"
+/* 118 */ "%A %B %e, %Y at %r %Z\0"
+/* 140 */ "#! %s\n\0"
+/* 147 */ "%s_%s=\0"
+/* 154 */ "\n"
+ "export %s_%s\n\0"
+/* 169 */ "''\0"
+/* 172 */ "\\'\0"
+/* 175 */ "'%s'\0"
+/* 180 */ "%s_%s_%d=\0"
+/* 190 */ "\n"
+ "export %s_%s_%d\n\0"
+/* 208 */ "set --\0"
+/* 215 */ " '%s'\0"
+/* 221 */ "'\\''\0"
+/* 226 */ "\n"
+ "OPTION_CT=0\n\0"
+/* 240 */ "=%1$lu # 0x%1$lX\n\0"
+/* 258 */ "true\0"
+/* 263 */ "false\0"
+/* 269 */ "VERSION\0"
+/* 277 */ "OPT_ARG_NEEDED=OK\0"
+/* 295 */ "OPT_ARG_NEEDED=NO\0"
+/* 313 */ "OPT_ARG_NEEDED=YES\0"
+/* 332 */ "LONGUSAGE\0"
+/* 342 */ "flag\0"
+/* 347 */ "%s_%s_TEXT='\0"
+/* 360 */ "'\n\n\0"
+/* 364 */ "option\0"
+/* 371 */ "\n"
+ "env | grep '^%s_'\n\0"
+/* 391 */ " -- %s\0"
+/* 398 */ "--\0"
+/* 401 */ "\t\t\t\t- \0"
+/* 408 */ "\t\t\t\t \0"
+/* 415 */ "\t\0"
+/* 417 */ " * )\n"
+ " OPT_PROCESS=false\n"
+ " ;;\n"
+ " esac\n\0"
+/* 474 */ " %s\n\0"
+/* 480 */ "%%-%ds\0"
+/* 487 */ "%1$s /tmp/use.%2$lu ; rm -f /tmp/use.%2$lu\0"
+/* 530 */ "# # # # # # # # # # -- do not modify this marker --\n"
+ "#\n"
+ "# DO NOT EDIT THIS SECTION\0"
+/* 612 */ "%s OF %s\n"
+ "#\n"
+ "# From here to the next `-- do not modify this marker --',\n"
+ "# the text has been generated %s\n\0"
+/* 718 */ "# From the %s option definitions\n"
+ "#\n\0"
+/* 755 */ "\n"
+ "if test -z \"${%1$s_%2$s}\"\n"
+ "then\n"
+ " %1$s_%2$s_CT=0\n"
+ "else\n"
+ " %1$s_%2$s_CT=1\n"
+ " %1$s_%2$s_1=${%1$s_%2$s}\n"
+ "fi\n"
+ "export %1$s_%2$s_CT\0"
+/* 876 */ "\n"
+ "%1$s_%2$s=${%1$s_%2$s-'%3$s'}\n"
+ "%1$s_%2$s_set=false\n"
+ "export %1$s_%2$s\0"
+/* 944 */ "\n"
+ "%1$s_%2$s=${%1$s_%2$s}\n"
+ "%1$s_%2$s_set=false\n"
+ "export %1$s_%2$s\n\0"
+/* 1006 */ "\n"
+ "OPT_PROCESS=true\n"
+ "OPT_ARG=$1\n"
+ "while ${OPT_PROCESS} && [ $# -gt 0 ]\n"
+ "do\n"
+ " OPT_ELEMENT=''\n"
+ " OPT_ARG_VAL=''\n\n"
+ " case \"${OPT_ARG}\" in\n"
+ " -- )\n"
+ " OPT_PROCESS=false\n"
+ " shift\n"
+ " ;;\n\0"
+/* 1200 */ "\n"
+ "OPT_ARG=$1\n"
+ "while [ $# -gt 0 ]\n"
+ "do\n"
+ " OPT_ELEMENT=''\n"
+ " OPT_ARG_VAL=''\n"
+ " OPT_ARG=${1}\n\0"
+/* 1290 */ " if [ -n \"${OPT_ARG_VAL}\" ]\n"
+ " then\n"
+ " eval %1$s_${OPT_NAME}${OPT_ELEMENT}=\"'${OPT_ARG_VAL}'\"\n"
+ " export %1$s_${OPT_NAME}${OPT_ELEMENT}\n"
+ " fi\n"
+ "done\n"
+ "unset OPT_PROCESS || :\n"
+ "unset OPT_ELEMENT || :\n"
+ "unset OPT_ARG || :\n"
+ "unset OPT_ARG_NEEDED || :\n"
+ "unset OPT_NAME || :\n"
+ "unset OPT_CODE || :\n"
+ "unset OPT_ARG_VAL || :\n"
+ "%2$s\0"
+/* 1620 */ "\n"
+ "# # # # # # # # # #\n"
+ "#\n"
+ "# END OF AUTOMATED OPTION PROCESSING\n"
+ "#\n"
+ "# # # # # # # # # # -- do not modify this marker --\n\0"
+/* 1736 */ " case \"${OPT_CODE}\" in\n\0"
+/* 1767 */ " '%s' | \\\n\0"
+/* 1785 */ " '%s' )\n\0"
+/* 1801 */ " '%c' )\n\0"
+/* 1817 */ " ;;\n\n\0"
+/* 1834 */ " * )\n"
+ " echo Unknown %s: \"${OPT_CODE}\" >&2\n"
+ " echo \"$%s_USAGE_TEXT\"\n"
+ " exit 1\n"
+ " ;;\n"
+ " esac\n\n\0"
+/* 1976 */ " echo \"$%s_%s_TEXT\"\n"
+ " exit 0\n\0"
+/* 2027 */ " echo \"$%s_LONGUSAGE_TEXT\" | ${PAGER-more}\n"
+ " exit 0\n\0"
+/* 2101 */ " %s\n\0"
+/* 2117 */ " if [ $%1$s_%2$s_CT -ge %3$d ] ; then\n"
+ " echo Error: more than %3$d %2$s options >&2\n"
+ " echo \"$%1$s_USAGE_TEXT\"\n"
+ " exit 1 ; fi\n\0"
+/* 2296 */ " %1$s_%2$s_CT=`expr ${%1$s_%2$s_CT} + 1`\n"
+ " OPT_ELEMENT=\"_${%1$s_%2$s_CT}\"\n"
+ " OPT_NAME='%2$s'\n\0"
+/* 2420 */ " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n"
+ " echo Error: duplicate %2$s option >&2\n"
+ " echo \"$%1$s_USAGE_TEXT\"\n"
+ " exit 1 ; fi\n"
+ " %1$s_%2$s_set=true\n"
+ " OPT_NAME='%2$s'\n\0"
+/* 2667 */ " %1$s_%2$s_CT=0\n"
+ " OPT_ELEMENT=''\n"
+ " %1$s_%2$s='%3$s'\n"
+ " export %1$s_%2$s\n"
+ " OPT_NAME='%2$s'\n\0"
+/* 2808 */ " if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n"
+ " echo 'Error: duplicate %2$s option' >&2\n"
+ " echo \"$%1$s_USAGE_TEXT\"\n"
+ " exit 1 ; fi\n"
+ " %1$s_%2$s_set=true\n"
+ " %1$s_%2$s='%3$s'\n"
+ " export %1$s_%2$s\n"
+ " OPT_NAME='%2$s'\n\0"
+/* 3115 */ " eval %1$s_%2$s${OPT_ELEMENT}=true\n"
+ " export %1$s_%2$s${OPT_ELEMENT}\n"
+ " OPT_ARG_NEEDED=OK\n\0"
+/* 3235 */ " OPT_ARG_NEEDED=YES\n\0"
+/* 3267 */ " eval %1$s_%2$s${OPT_ELEMENT}=true\n"
+ " export %1$s_%2$s${OPT_ELEMENT}\n"
+ " OPT_ARG_NEEDED=NO\n\0"
+/* 3387 */ " OPT_CODE=`echo \"X${OPT_ARG}\"|sed 's/^X-*//'`\n"
+ " shift\n"
+ " OPT_ARG=$1\n"
+ " case \"${OPT_CODE}\" in *=* )\n"
+ " OPT_ARG_VAL=`echo \"${OPT_CODE}\"|sed 's/^[^=]*=//'`\n"
+ " OPT_CODE=`echo \"${OPT_CODE}\"|sed 's/=.*$//'` ;; esac\n\0"
+/* 3638 */ " case \"${OPT_ARG_NEEDED}\" in\n"
+ " NO )\n"
+ " OPT_ARG_VAL=''\n"
+ " ;;\n"
+ " YES )\n"
+ " if [ -z \"${OPT_ARG_VAL}\" ]\n"
+ " then\n"
+ " if [ $# -eq 0 ]\n"
+ " then\n"
+ " echo No argument provided for ${OPT_NAME} option >&2\n"
+ " echo \"$%s_USAGE_TEXT\"\n"
+ " exit 1\n"
+ " fi\n"
+ " OPT_ARG_VAL=${OPT_ARG}\n"
+ " shift\n"
+ " OPT_ARG=$1\n"
+ " fi\n"
+ " ;;\n"
+ " OK )\n"
+ " if [ -z \"${OPT_ARG_VAL}\" ] && [ $# -gt 0 ]\n"
+ " then\n"
+ " case \"${OPT_ARG}\" in -* ) ;; * )\n"
+ " OPT_ARG_VAL=${OPT_ARG}\n"
+ " shift\n"
+ " OPT_ARG=$1 ;; esac\n"
+ " fi\n"
+ " ;;\n"
+ " esac\n\0"
+/* 4417 */ " OPT_CODE=`echo \"X${OPT_ARG}\" | sed 's/X-\\(.\\).*/\\1/'`\n"
+ " OPT_ARG=` echo \"X${OPT_ARG}\" | sed 's/X-.//'`\n\0"
+/* 4534 */ " case \"${OPT_ARG_NEEDED}\" in\n"
+ " NO )\n"
+ " if [ -n \"${OPT_ARG}\" ]\n"
+ " then\n"
+ " OPT_ARG=-${OPT_ARG}\n"
+ " else\n"
+ " shift\n"
+ " OPT_ARG=$1\n"
+ " fi\n"
+ " ;;\n"
+ " YES )\n"
+ " if [ -n \"${OPT_ARG}\" ]\n"
+ " then\n"
+ " OPT_ARG_VAL=${OPT_ARG}\n"
+ " else\n"
+ " if [ $# -eq 0 ]\n"
+ " then\n"
+ " echo No argument provided for ${OPT_NAME} option >&2\n"
+ " echo \"$%s_USAGE_TEXT\"\n"
+ " exit 1\n"
+ " fi\n"
+ " shift\n"
+ " OPT_ARG_VAL=$1\n"
+ " fi\n"
+ " shift\n"
+ " OPT_ARG=$1\n"
+ " ;;\n"
+ " OK )\n"
+ " if [ -n \"${OPT_ARG}\" ]\n"
+ " then\n"
+ " OPT_ARG_VAL=${OPT_ARG}\n"
+ " shift\n"
+ " OPT_ARG=$1\n"
+ " else\n"
+ " shift\n"
+ " if [ $# -gt 0 ]\n"
+ " then\n"
+ " case \"$1\" in -* ) ;; * )\n"
+ " OPT_ARG_VAL=$1\n"
+ " shift ;; esac\n"
+ " OPT_ARG=$1\n"
+ " fi\n"
+ " fi\n"
+ " ;;\n"
+ " esac\n\0"
+/* 5688 */ "%1$s_%2$s=%3$d # 0x%3$X\n"
+ "export %1$s_%2$s\n\0"
+/* 5730 */ "%1$s_%2$s_CT=%3$d\n"
+ "export %1$s_%2$s_CT\n\0"
+/* 5769 */ "OPTION_CT=%d\n"
+ "export OPTION_CT\n\0"
+/* 5800 */ "%1$s_%2$s=%3$s\n"
+ "export %1$s_%2$s\n\0"
+/* 5833 */ "%1$s_%2$s='%3$s'\n"
+ "export %1$s_%2$s\n\0"
+/* 5868 */ "%1$s_%2$s_MODE='%3$s'\n"
+ "export %1$s_%2$s_MODE\n\0"
+/* 5913 */ "echo 'Warning: Cannot load options files' >&2\0"
+/* 5960 */ "echo 'Warning: Cannot save options files' >&2\0"
+/* 6007 */ "echo 'Warning: Cannot suppress the loading of options files' >&2\0"
+/* 6073 */ "%1$s_%2$s_TEXT='no %2$s text'\n\0"
+/* 6104 */ "%s WARNING: cannot save options - \0"
+/* 6140 */ "<%s/>\n\0"
+/* 6147 */ "<%s>\0"
+/* 6152 */ "</%s>\n\0"
+/* 6159 */ "<%s type=%s>\0"
+/* 6172 */ "<%s type=nested>\n\0"
+/* 6190 */ "#x%02X;\0"
+/* 6198 */ "<%1$s type=boolean>%2$s</%1$s>\n\0"
+/* 6230 */ "<%1$s type=integer>0x%2$lX</%1$s>\n";
+
+/* end of ao-strs.c */
diff --git a/autoopts/ao-strs.def b/autoopts/ao-strs.def
new file mode 100644
index 0000000..624f872
--- /dev/null
+++ b/autoopts/ao-strs.def
@@ -0,0 +1,429 @@
+AutoGen Definitions strings;
+
+string = { nm = ARG_BREAK_STR; str = " \t\n:="; };
+string = { nm = INVALID_FMT; str = "INVALID-%d"; };
+string = { nm = INVALID_STR; str = "*INVALID*"; };
+string = { nm = NONE_STR; str = "none"; };
+string = { nm = PLUS_STR; str = " + "; };
+string = { nm = OR_STR; str = " | "; };
+string = { nm = NLSTR_FMT; str = "%s\n"; };
+string = { nm = PAGER_NAME; str = "PAGER"; };
+string = { nm = TMP_USAGE_FMT; str = "/tmp/use.%lu"; };
+string = { nm = MORE_STR; str = "more"; };
+string = { nm = LONG_OPT_MARK; str = " --* )\n"; };
+string = { nm = NLSTR_SPACE_FMT; str = "%s\n "; };
+string = { nm = TWO_SPACES_STR; str = " "; };
+string = { nm = FLAG_OPT_MARK; str = " -* )\n"; };
+string = { nm = END_OPT_SEL_STR; str = " ;;\n\n"; };
+string = { nm = STDOUT; str = "stdout"; };
+string = { nm = TIME_FMT; str = "%A %B %e, %Y at %r %Z"; };
+string = { nm = SHELL_MAGIC; str = "#! %s\n"; };
+string = { nm = OPT_VAL_FMT; str = "%s_%s="; };
+string = { nm = OPT_END_FMT; str = "\nexport %s_%s\n"; };
+string = { nm = EMPTY_ARG; str = "''"; };
+string = { nm = QUOT_APOS; str = "\\'"; };
+string = { nm = QUOT_ARG_FMT; str = "'%s'"; };
+string = { nm = ARG_BY_NUM_FMT; str = "%s_%s_%d="; };
+string = { nm = EXPORT_ARG_FMT; str = "\nexport %s_%s_%d\n"; };
+string = { nm = set_dash; str = "set --"; };
+string = { nm = arg_fmt; str = " '%s'"; };
+string = { nm = apostrophy; str = "'\\''"; };
+string = { nm = init_optct; str = "\nOPTION_CT=0\n"; };
+string = { nm = SHOW_VAL_FMT; str = "=%1$lu # 0x%1$lX\n"; };
+string = { nm = TRUE_STR; str = "true"; };
+string = { nm = FALSE_STR; str = "false"; };
+string = { nm = VER_STR; str = "VERSION"; };
+string = { nm = OK_NEED_OPT_ARG; str = "OPT_ARG_NEEDED=OK"; };
+string = { nm = NO_ARG_NEEDED; str = "OPT_ARG_NEEDED=NO"; };
+string = { nm = YES_NEED_OPT_ARG; str = "OPT_ARG_NEEDED=YES"; };
+string = { nm = LONG_USE_STR; str = "LONGUSAGE"; };
+string = { nm = FLAG_STR; str = "flag"; };
+string = { nm = SET_TEXT_FMT; str = "%s_%s_TEXT='"; };
+string = { nm = END_SET_TEXT; str = "'\n\n"; };
+string = { nm = OPTION_STR; str = "option"; };
+string = { nm = SHOW_PROG_ENV; str = "\nenv | grep '^%s_'\n"; };
+string = { nm = SET_OFF_FMT; str = " -- %s"; };
+string = { nm = LONG_OPT_MARKER; str = "--"; };
+string = { nm = BULLET_STR; str = "\t\t\t\t- "; };
+string = { nm = DEEP_INDENT_STR; str = "\t\t\t\t "; };
+string = { nm = ONE_TAB_STR; str = "\t"; };
+
+string = { nm = NOT_FOUND_STR;
+ str = <<- _EOStr_
+ * )
+ OPT_PROCESS=false
+ ;;
+ esac
+
+ _EOStr_;
+};
+
+string = { nm = ENUM_ERR_SEP_LINE_FMT;
+ str = " %s\n"; };
+
+string = { nm = ENUM_ERR_STR_WIDTH_FMT;
+ str = "%%-%ds"; };
+
+string = { nm = PAGE_USAGE_FMT;
+ str = "%1$s /tmp/use.%2$lu ; rm -f /tmp/use.%2$lu"; };
+
+string = { nm = START_MARK;
+ str = <<- _EOStr_
+ # # # # # # # # # # -- do not modify this marker --
+ #
+ # DO NOT EDIT THIS SECTION
+ _EOStr_;
+};
+
+string = { nm = PREAMBLE_FMT;
+ str = <<- _EOStr_
+ %s OF %s
+ #
+ # From here to the next `-- do not modify this marker --',
+ # the text has been generated %s
+
+ _EOStr_;
+};
+
+string = { nm = END_PRE_FMT;
+ str = "# From the %s option definitions\n#\n"; };
+
+string = { nm = MULTI_DEF_FMT;
+ str = <<- _EOStr_
+
+ if test -z "${%1$s_%2$s}"
+ then
+ %1$s_%2$s_CT=0
+ else
+ %1$s_%2$s_CT=1
+ %1$s_%2$s_1=${%1$s_%2$s}
+ fi
+ export %1$s_%2$s_CT
+ _EOStr_;
+};
+
+string = { nm = SGL_DEF_FMT;
+ str = <<- _EOStr_
+
+ %1$s_%2$s=${%1$s_%2$s-'%3$s'}
+ %1$s_%2$s_set=false
+ export %1$s_%2$s
+ _EOStr_;
+};
+
+string = { nm = SGL_NO_DEF_FMT;
+ str = <<- _EOStr_
+
+ %1$s_%2$s=${%1$s_%2$s}
+ %1$s_%2$s_set=false
+ export %1$s_%2$s
+
+ _EOStr_;
+};
+
+
+string = { nm = LOOP_STR;
+ str = <<- _EOStr_
+
+ OPT_PROCESS=true
+ OPT_ARG=$1
+ while ${OPT_PROCESS} && [ $# -gt 0 ]
+ do
+ OPT_ELEMENT=''
+ OPT_ARG_VAL=''
+
+ case "${OPT_ARG}" in
+ -- )
+ OPT_PROCESS=false
+ shift
+ ;;
+
+ _EOStr_;
+};
+
+string = { nm = ONLY_OPTS_LOOP;
+ str = <<- _EOStr_
+
+ OPT_ARG=$1
+ while [ $# -gt 0 ]
+ do
+ OPT_ELEMENT=''
+ OPT_ARG_VAL=''
+ OPT_ARG=${1}
+
+ _EOStr_;
+};
+
+string = { nm = zLoopEnd;
+ str = <<- _EOStr_
+ if [ -n "${OPT_ARG_VAL}" ]
+ then
+ eval %1$s_${OPT_NAME}${OPT_ELEMENT}="'${OPT_ARG_VAL}'"
+ export %1$s_${OPT_NAME}${OPT_ELEMENT}
+ fi
+ done
+ unset OPT_PROCESS || :
+ unset OPT_ELEMENT || :
+ unset OPT_ARG || :
+ unset OPT_ARG_NEEDED || :
+ unset OPT_NAME || :
+ unset OPT_CODE || :
+ unset OPT_ARG_VAL || :
+ %2$s
+ _EOStr_;
+};
+
+string = { nm = END_MARK;
+ str = <<- _EOStr_
+
+ # # # # # # # # # #
+ #
+ # END OF AUTOMATED OPTION PROCESSING
+ #
+ # # # # # # # # # # -- do not modify this marker --
+
+ _EOStr_;
+};
+
+string = { nm = zOptionCase;
+ str = " case \"${OPT_CODE}\" in\n"; };
+
+string = { nm = zOptionPartName; str = " '%s' | \\\n"; };
+string = { nm = zOptionFullName; str = " '%s' )\n"; };
+string = { nm = zOptionFlag; str = " '%c' )\n"; };
+string = { nm = zOptionEndSelect; str = " ;;\n\n"; };
+
+string = { nm = UNK_OPT_FMT;
+ str =
+" * )\n"
+" echo Unknown %s: \"${OPT_CODE}\" >&2\n"
+" echo \"$%s_USAGE_TEXT\"\n"
+" exit 1\n"
+" ;;\n"
+" esac\n\n"; };
+
+string = { nm = zTextExit;
+ str =
+" echo \"$%s_%s_TEXT\"\n"
+" exit 0\n"; };
+
+string = { nm = zPagedUsageExit;
+ str =
+" echo \"$%s_LONGUSAGE_TEXT\" | ${PAGER-more}\n"
+" exit 0\n"; };
+
+string = { nm = zCmdFmt;
+ str = " %s\n"; };
+
+string = { nm = zCountTest;
+ str =
+" if [ $%1$s_%2$s_CT -ge %3$d ] ; then\n"
+" echo Error: more than %3$d %2$s options >&2\n"
+" echo \"$%1$s_USAGE_TEXT\"\n"
+" exit 1 ; fi\n"; };
+
+string = { nm = MULTI_ARG_FMT;
+ str =
+" %1$s_%2$s_CT=`expr ${%1$s_%2$s_CT} + 1`\n"
+" OPT_ELEMENT=\"_${%1$s_%2$s_CT}\"\n"
+" OPT_NAME='%2$s'\n"; };
+
+string = { nm = SGL_ARG_FMT;
+ str =
+" if [ -n \"${%1$s_%2$s}\" ] && ${%1$s_%2$s_set} ; then\n"
+" echo Error: duplicate %2$s option >&2\n"
+" echo \"$%1$s_USAGE_TEXT\"\n"
+" exit 1 ; fi\n"
+" %1$s_%2$s_set=true\n"
+" OPT_NAME='%2$s'\n"; };
+
+string = { nm = NO_MULTI_ARG_FMT;
+ str =
+" %1$s_%2$s_CT=0\n"
+" OPT_ELEMENT=''\n"
+" %1$s_%2$s='%3$s'\n"
+" export %1$s_%2$s\n"
+" OPT_NAME='%2$s'\n"; };
+
+string = { nm = NO_SGL_ARG_FMT;
+ str = <<- _EOStr_
+ if [ -n "${%1$s_%2$s}" ] && ${%1$s_%2$s_set} ; then
+ echo 'Error: duplicate %2$s option' >&2
+ echo "$%1$s_USAGE_TEXT"
+ exit 1 ; fi
+ %1$s_%2$s_set=true
+ %1$s_%2$s='%3$s'
+ export %1$s_%2$s
+ OPT_NAME='%2$s'
+
+ _EOStr_;
+};
+
+string = { nm = zMayArg;
+ str =
+" eval %1$s_%2$s${OPT_ELEMENT}=true\n"
+" export %1$s_%2$s${OPT_ELEMENT}\n"
+" OPT_ARG_NEEDED=OK\n"; };
+
+string = { nm = zMustArg;
+ str = " OPT_ARG_NEEDED=YES\n"; };
+
+string = { nm = zCantArg;
+ str =
+" eval %1$s_%2$s${OPT_ELEMENT}=true\n"
+" export %1$s_%2$s${OPT_ELEMENT}\n"
+" OPT_ARG_NEEDED=NO\n"; };
+
+string = { nm = INIT_LOPT_STR;
+ str = <<- _EOStr_
+ OPT_CODE=`echo "X${OPT_ARG}"|sed 's/^X-*//'`
+ shift
+ OPT_ARG=$1
+ case "${OPT_CODE}" in *=* )
+ OPT_ARG_VAL=`echo "${OPT_CODE}"|sed 's/^[^=]*=//'`
+ OPT_CODE=`echo "${OPT_CODE}"|sed 's/=.*$//'` ;; esac
+
+ _EOStr_; };
+
+string = { nm = LOPT_ARG_FMT;
+ str = <<- _EOStr_
+ case "${OPT_ARG_NEEDED}" in
+ NO )
+ OPT_ARG_VAL=''
+ ;;
+ YES )
+ if [ -z "${OPT_ARG_VAL}" ]
+ then
+ if [ $# -eq 0 ]
+ then
+ echo No argument provided for ${OPT_NAME} option >&2
+ echo "$%s_USAGE_TEXT"
+ exit 1
+ fi
+ OPT_ARG_VAL=${OPT_ARG}
+ shift
+ OPT_ARG=$1
+ fi
+ ;;
+ OK )
+ if [ -z "${OPT_ARG_VAL}" ] && [ $# -gt 0 ]
+ then
+ case "${OPT_ARG}" in -* ) ;; * )
+ OPT_ARG_VAL=${OPT_ARG}
+ shift
+ OPT_ARG=$1 ;; esac
+ fi
+ ;;
+ esac
+
+ _EOStr_; };
+
+string = { nm = INIT_OPT_STR;
+ str = <<- _EOStr_
+ OPT_CODE=`echo "X${OPT_ARG}" | sed 's/X-\(.\).*/\1/'`
+ OPT_ARG=` echo "X${OPT_ARG}" | sed 's/X-.//'`
+
+ _EOStr_; };
+
+
+string = { nm = OPT_ARG_FMT;
+ str = <<- _EOStr_
+ case "${OPT_ARG_NEEDED}" in
+ NO )
+ if [ -n "${OPT_ARG}" ]
+ then
+ OPT_ARG=-${OPT_ARG}
+ else
+ shift
+ OPT_ARG=$1
+ fi
+ ;;
+ YES )
+ if [ -n "${OPT_ARG}" ]
+ then
+ OPT_ARG_VAL=${OPT_ARG}
+ else
+ if [ $# -eq 0 ]
+ then
+ echo No argument provided for ${OPT_NAME} option >&2
+ echo "$%s_USAGE_TEXT"
+ exit 1
+ fi
+ shift
+ OPT_ARG_VAL=$1
+ fi
+ shift
+ OPT_ARG=$1
+ ;;
+ OK )
+ if [ -n "${OPT_ARG}" ]
+ then
+ OPT_ARG_VAL=${OPT_ARG}
+ shift
+ OPT_ARG=$1
+ else
+ shift
+ if [ $# -gt 0 ]
+ then
+ case "$1" in -* ) ;; * )
+ OPT_ARG_VAL=$1
+ shift ;; esac
+ OPT_ARG=$1
+ fi
+ fi
+ ;;
+ esac
+
+ _EOStr_; };
+
+string = { nm = zOptNumFmt;
+ str = "%1$s_%2$s=%3$d # 0x%3$X\nexport %1$s_%2$s\n"; };
+
+string = { nm = zOptCookieCt;
+ str = "%1$s_%2$s_CT=%3$d\nexport %1$s_%2$s_CT\n"; };
+
+string = { nm = zOptCtFmt;
+ str = "OPTION_CT=%d\nexport OPTION_CT\n"; };
+
+string = { nm = zOptDisabl;
+ str = "%1$s_%2$s=%3$s\nexport %1$s_%2$s\n"; };
+
+string = { nm = zFullOptFmt;
+ str = "%1$s_%2$s='%3$s'\nexport %1$s_%2$s\n"; };
+
+string = { nm = zEquivMode;
+ str = "%1$s_%2$s_MODE='%3$s'\nexport %1$s_%2$s_MODE\n"; };
+
+string = { nm = NO_LOAD_WARN;
+ str = "echo 'Warning: Cannot load options files' >&2"; };
+
+string = { nm = NO_SAVE_OPTS;
+ str = "echo 'Warning: Cannot save options files' >&2"; };
+
+string = { nm = NO_SUPPRESS_LOAD;
+ str = "echo 'Warning: Cannot suppress the loading of options files' >&2"; };
+
+string = { nm = SET_NO_TEXT_FMT;
+ str = "%1$s_%2$s_TEXT='no %2$s text'\n"; };
+
+string = { nm = SAVE_WARN;
+ str = "%s WARNING: cannot save options - "; };
+
+string = { nm = OPEN_CLOSE_FMT; str = "<%s/>\n"; };
+string = { nm = OPEN_XML_FMT; str = "<%s>"; };
+string = { nm = END_XML_FMT; str = "</%s>\n"; };
+string = { nm = TYPE_ATR_FMT; str = "<%s type=%s>"; };
+string = { nm = NULL_ATR_FMT; str = "<%s/>\n"; };
+string = { nm = NESTED_OPT_FMT; str = "<%s type=nested>\n"; };
+string = { nm = XML_HEX_BYTE_FMT; str = "#x%02X;"; };
+
+string = { nm = BOOL_ATR_FMT;
+ str = "<%1$s type=boolean>%2$s</%1$s>\n"; };
+
+string = { nm = NUMB_ATR_FMT;
+ str = "<%1$s type=integer>0x%2$lX</%1$s>\n"; };
+
+#if 0
+string = { nm = ;
+ str = ; };
+#endif
diff --git a/autoopts/ao-strs.h b/autoopts/ao-strs.h
new file mode 100644
index 0000000..62d92ff
--- /dev/null
+++ b/autoopts/ao-strs.h
@@ -0,0 +1,250 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (ao-strs.h)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:13 AM by AutoGen 5.16.2pre7
+ * From the definitions ao-strs.def
+ * and the template file strings
+ *
+ * Copyright (C) 2011-2012 Bruce Korb, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the
+ * Modified (3 clause) Berkeley Software Distribution License
+ * <http://www.xfree86.org/3.3.6/COPYRIGHT2.html>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name ``Bruce Korb'' nor the name of any other
+ * contributor may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * strings IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Bruce Korb OR ANY OTHER CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef STRINGS_AO_STRS_H_GUARD
+#define STRINGS_AO_STRS_H_GUARD 1
+/*
+ * 102 strings in ao_strs_strtable string table
+ */
+#define ARG_BREAK_STR (ao_strs_strtable+0)
+#define ARG_BREAK_STR_LEN 5
+#define ARG_BY_NUM_FMT (ao_strs_strtable+180)
+#define ARG_BY_NUM_FMT_LEN 9
+#define BOOL_ATR_FMT (ao_strs_strtable+6198)
+#define BOOL_ATR_FMT_LEN 31
+#define BULLET_STR (ao_strs_strtable+401)
+#define BULLET_STR_LEN 6
+#define DEEP_INDENT_STR (ao_strs_strtable+408)
+#define DEEP_INDENT_STR_LEN 6
+#define EMPTY_ARG (ao_strs_strtable+169)
+#define EMPTY_ARG_LEN 2
+#define END_MARK (ao_strs_strtable+1620)
+#define END_MARK_LEN 115
+#define END_OPT_SEL_STR (ao_strs_strtable+98)
+#define END_OPT_SEL_STR_LEN 12
+#define END_PRE_FMT (ao_strs_strtable+718)
+#define END_PRE_FMT_LEN 36
+#define END_SET_TEXT (ao_strs_strtable+360)
+#define END_SET_TEXT_LEN 3
+#define END_XML_FMT (ao_strs_strtable+6152)
+#define END_XML_FMT_LEN 6
+#define ENUM_ERR_SEP_LINE_FMT (ao_strs_strtable+474)
+#define ENUM_ERR_SEP_LINE_FMT_LEN 5
+#define ENUM_ERR_STR_WIDTH_FMT (ao_strs_strtable+480)
+#define ENUM_ERR_STR_WIDTH_FMT_LEN 6
+#define EXPORT_ARG_FMT (ao_strs_strtable+190)
+#define EXPORT_ARG_FMT_LEN 17
+#define FALSE_STR (ao_strs_strtable+263)
+#define FALSE_STR_LEN 5
+#define FLAG_OPT_MARK (ao_strs_strtable+88)
+#define FLAG_OPT_MARK_LEN 9
+#define FLAG_STR (ao_strs_strtable+342)
+#define FLAG_STR_LEN 4
+#define INIT_LOPT_STR (ao_strs_strtable+3387)
+#define INIT_LOPT_STR_LEN 250
+#define INIT_OPT_STR (ao_strs_strtable+4417)
+#define INIT_OPT_STR_LEN 116
+#define INVALID_FMT (ao_strs_strtable+6)
+#define INVALID_FMT_LEN 10
+#define INVALID_STR (ao_strs_strtable+17)
+#define INVALID_STR_LEN 9
+#define LONG_OPT_MARK (ao_strs_strtable+68)
+#define LONG_OPT_MARKER (ao_strs_strtable+398)
+#define LONG_OPT_MARKER_LEN 2
+#define LONG_OPT_MARK_LEN 10
+#define LONG_USE_STR (ao_strs_strtable+332)
+#define LONG_USE_STR_LEN 9
+#define LOOP_STR (ao_strs_strtable+1006)
+#define LOOP_STR_LEN 193
+#define LOPT_ARG_FMT (ao_strs_strtable+3638)
+#define LOPT_ARG_FMT_LEN 778
+#define MORE_STR (ao_strs_strtable+63)
+#define MORE_STR_LEN 4
+#define MULTI_ARG_FMT (ao_strs_strtable+2296)
+#define MULTI_ARG_FMT_LEN 123
+#define MULTI_DEF_FMT (ao_strs_strtable+755)
+#define MULTI_DEF_FMT_LEN 120
+#define NESTED_OPT_FMT (ao_strs_strtable+6172)
+#define NESTED_OPT_FMT_LEN 17
+#define NLSTR_FMT (ao_strs_strtable+40)
+#define NLSTR_FMT_LEN 3
+#define NLSTR_SPACE_FMT (ao_strs_strtable+79)
+#define NLSTR_SPACE_FMT_LEN 5
+#define NONE_STR (ao_strs_strtable+27)
+#define NONE_STR_LEN 4
+#define NOT_FOUND_STR (ao_strs_strtable+417)
+#define NOT_FOUND_STR_LEN 56
+#define NO_ARG_NEEDED (ao_strs_strtable+295)
+#define NO_ARG_NEEDED_LEN 17
+#define NO_LOAD_WARN (ao_strs_strtable+5913)
+#define NO_LOAD_WARN_LEN 46
+#define NO_MULTI_ARG_FMT (ao_strs_strtable+2667)
+#define NO_MULTI_ARG_FMT_LEN 140
+#define NO_SAVE_OPTS (ao_strs_strtable+5960)
+#define NO_SAVE_OPTS_LEN 46
+#define NO_SGL_ARG_FMT (ao_strs_strtable+2808)
+#define NO_SGL_ARG_FMT_LEN 306
+#define NO_SUPPRESS_LOAD (ao_strs_strtable+6007)
+#define NO_SUPPRESS_LOAD_LEN 65
+#define NULL_ATR_FMT (ao_strs_strtable+6140)
+#define NULL_ATR_FMT_LEN 6
+#define NUMB_ATR_FMT (ao_strs_strtable+6230)
+#define NUMB_ATR_FMT_LEN 34
+#define OK_NEED_OPT_ARG (ao_strs_strtable+277)
+#define OK_NEED_OPT_ARG_LEN 17
+#define ONE_TAB_STR (ao_strs_strtable+415)
+#define ONE_TAB_STR_LEN 1
+#define ONLY_OPTS_LOOP (ao_strs_strtable+1200)
+#define ONLY_OPTS_LOOP_LEN 89
+#define OPEN_CLOSE_FMT (ao_strs_strtable+6140)
+#define OPEN_CLOSE_FMT_LEN 6
+#define OPEN_XML_FMT (ao_strs_strtable+6147)
+#define OPEN_XML_FMT_LEN 4
+#define OPTION_STR (ao_strs_strtable+364)
+#define OPTION_STR_LEN 6
+#define OPT_ARG_FMT (ao_strs_strtable+4534)
+#define OPT_ARG_FMT_LEN 1153
+#define OPT_END_FMT (ao_strs_strtable+154)
+#define OPT_END_FMT_LEN 14
+#define OPT_VAL_FMT (ao_strs_strtable+147)
+#define OPT_VAL_FMT_LEN 6
+#define OR_STR (ao_strs_strtable+36)
+#define OR_STR_LEN 3
+#define PAGER_NAME (ao_strs_strtable+44)
+#define PAGER_NAME_LEN 5
+#define PAGE_USAGE_FMT (ao_strs_strtable+487)
+#define PAGE_USAGE_FMT_LEN 42
+#define PLUS_STR (ao_strs_strtable+32)
+#define PLUS_STR_LEN 3
+#define PREAMBLE_FMT (ao_strs_strtable+612)
+#define PREAMBLE_FMT_LEN 105
+#define QUOT_APOS (ao_strs_strtable+172)
+#define QUOT_APOS_LEN 2
+#define QUOT_ARG_FMT (ao_strs_strtable+175)
+#define QUOT_ARG_FMT_LEN 4
+#define SAVE_WARN (ao_strs_strtable+6104)
+#define SAVE_WARN_LEN 35
+#define SET_NO_TEXT_FMT (ao_strs_strtable+6073)
+#define SET_NO_TEXT_FMT_LEN 30
+#define SET_OFF_FMT (ao_strs_strtable+391)
+#define SET_OFF_FMT_LEN 6
+#define SET_TEXT_FMT (ao_strs_strtable+347)
+#define SET_TEXT_FMT_LEN 12
+#define SGL_ARG_FMT (ao_strs_strtable+2420)
+#define SGL_ARG_FMT_LEN 246
+#define SGL_DEF_FMT (ao_strs_strtable+876)
+#define SGL_DEF_FMT_LEN 67
+#define SGL_NO_DEF_FMT (ao_strs_strtable+944)
+#define SGL_NO_DEF_FMT_LEN 61
+#define SHELL_MAGIC (ao_strs_strtable+140)
+#define SHELL_MAGIC_LEN 6
+#define SHOW_PROG_ENV (ao_strs_strtable+371)
+#define SHOW_PROG_ENV_LEN 19
+#define SHOW_VAL_FMT (ao_strs_strtable+240)
+#define SHOW_VAL_FMT_LEN 17
+#define START_MARK (ao_strs_strtable+530)
+#define START_MARK_LEN 81
+#define STDOUT (ao_strs_strtable+111)
+#define STDOUT_LEN 6
+#define TIME_FMT (ao_strs_strtable+118)
+#define TIME_FMT_LEN 21
+#define TMP_USAGE_FMT (ao_strs_strtable+50)
+#define TMP_USAGE_FMT_LEN 12
+#define TRUE_STR (ao_strs_strtable+258)
+#define TRUE_STR_LEN 4
+#define TWO_SPACES_STR (ao_strs_strtable+85)
+#define TWO_SPACES_STR_LEN 2
+#define TYPE_ATR_FMT (ao_strs_strtable+6159)
+#define TYPE_ATR_FMT_LEN 12
+#define UNK_OPT_FMT (ao_strs_strtable+1834)
+#define UNK_OPT_FMT_LEN 141
+#define VER_STR (ao_strs_strtable+269)
+#define VER_STR_LEN 7
+#define XML_HEX_BYTE_FMT (ao_strs_strtable+6190)
+#define XML_HEX_BYTE_FMT_LEN 7
+#define YES_NEED_OPT_ARG (ao_strs_strtable+313)
+#define YES_NEED_OPT_ARG_LEN 18
+#define apostrophy (ao_strs_strtable+221)
+#define apostrophy_LEN 4
+#define arg_fmt (ao_strs_strtable+215)
+#define arg_fmt_LEN 5
+#define init_optct (ao_strs_strtable+226)
+#define init_optct_LEN 13
+#define set_dash (ao_strs_strtable+208)
+#define set_dash_LEN 6
+#define zCantArg (ao_strs_strtable+3267)
+#define zCantArg_LEN 119
+#define zCmdFmt (ao_strs_strtable+2101)
+#define zCmdFmt_LEN 15
+#define zCountTest (ao_strs_strtable+2117)
+#define zCountTest_LEN 178
+#define zEquivMode (ao_strs_strtable+5868)
+#define zEquivMode_LEN 44
+#define zFullOptFmt (ao_strs_strtable+5833)
+#define zFullOptFmt_LEN 34
+#define zLoopEnd (ao_strs_strtable+1290)
+#define zLoopEnd_LEN 329
+#define zMayArg (ao_strs_strtable+3115)
+#define zMayArg_LEN 119
+#define zMustArg (ao_strs_strtable+3235)
+#define zMustArg_LEN 31
+#define zOptCookieCt (ao_strs_strtable+5730)
+#define zOptCookieCt_LEN 38
+#define zOptCtFmt (ao_strs_strtable+5769)
+#define zOptCtFmt_LEN 30
+#define zOptDisabl (ao_strs_strtable+5800)
+#define zOptDisabl_LEN 32
+#define zOptNumFmt (ao_strs_strtable+5688)
+#define zOptNumFmt_LEN 41
+#define zOptionCase (ao_strs_strtable+1736)
+#define zOptionCase_LEN 30
+#define zOptionEndSelect (ao_strs_strtable+1817)
+#define zOptionEndSelect_LEN 16
+#define zOptionFlag (ao_strs_strtable+1801)
+#define zOptionFlag_LEN 15
+#define zOptionFullName (ao_strs_strtable+1785)
+#define zOptionFullName_LEN 15
+#define zOptionPartName (ao_strs_strtable+1767)
+#define zOptionPartName_LEN 17
+#define zPagedUsageExit (ao_strs_strtable+2027)
+#define zPagedUsageExit_LEN 73
+#define zTextExit (ao_strs_strtable+1976)
+#define zTextExit_LEN 50
+extern char const ao_strs_strtable[6265];
+
+#endif /* STRINGS_AO_STRS_H_GUARD */
diff --git a/autoopts/ao_string_tokenize.3 b/autoopts/ao_string_tokenize.3
new file mode 100644
index 0000000..5c3e6a2
--- /dev/null
+++ b/autoopts/ao_string_tokenize.3
@@ -0,0 +1,86 @@
+.TH ao_string_tokenize 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (ao_string_tokenize.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+ao_string_tokenize - tokenize an input string
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+token_list_t* \fBao_string_tokenize\fP(char const* \fIstring\fP);
+.sp 1
+.SH DESCRIPTION
+This function will convert one input string into a list of strings.
+The list of strings is derived by separating the input based on
+white space separation. However, if the input contains either single
+or double quote characters, then the text after that character up to
+a matching quote will become the string in the list.
+
+The returned pointer should be deallocated with \fBfree(3C)\fP when
+are done using the data. The data are placed in a single block of
+allocated memory. Do not deallocate individual token/strings.
+
+The structure pointed to will contain at least these two fields:
+.sp
+.IR "tkn_ct"
+The number of tokens found in the input string.
+.sp
+.IR "tok_list"
+An array of \fBtkn_ct + 1\fP pointers to substring tokens, with
+the last pointer set to NULL.
+.br
+
+There are two types of quoted strings: single quoted (\fB'\fP) and
+double quoted (\fB"\fP). Singly quoted strings are fairly raw in that
+escape characters (\fB\\\fP) are simply another character, except when
+preceding the following characters:
+.nf
+ \fB\\\fP double backslashes reduce to one
+ \fB'\fP incorporates the single quote into the string
+ \fB\n\fP suppresses both the backslash and newline character
+.fi
+
+Double quote strings are formed according to the rules of string
+constants in ANSI-C programs.
+.TP
+.IR string
+string to be tokenized
+.sp 1
+.SH RETURN VALUE
+pointer to a structure that lists each token
+.sp 1
+.SH ERRORS
+NULL is returned and \fBerrno\fP will be set to indicate the problem:
+.sp 1ize @bullet
+.sp 1
+\fBEINVAL\fP \- There was an unterminated quoted string.
+.sp 1
+\fBENOENT\fP \- The input string was empty.
+.sp 1
+\fBENOMEM\fP \- There is not enough memory.
+@end itemize
+.sp 1
+.SH EXAMPLES
+.nf
+.in +5
+.nf
+ #include <stdlib.h>
+ int ix;
+ token_list_t* ptl = ao_string_tokenize(some_string)
+ for (ix = 0; ix < ptl->tkn_ct; ix++)
+ do_something_with_tkn(ptl->tkn_list[ix]);
+ free(ptl);
+.fi
+Note that everything is freed with the one call to \fBfree(3C)\fP.
+.in -5
+.fi
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/autogen.map b/autoopts/autogen.map
new file mode 100644
index 0000000..f02c868
--- /dev/null
+++ b/autoopts/autogen.map
@@ -0,0 +1,81 @@
+
+%guard
+%file ag-char-map.h
+%backup
+%optimize
+
+%comment
+ This file contains the character classifications
+ used by AutoGen and AutoOpts for identifying tokens.
+ The table is static scope, so %guard is empty.
+
+ This file is part of AutoOpts, a companion to AutoGen.
+ AutoOpts is free software.
+ AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+
+ AutoOpts is available under any one of two licenses. The license
+ in use must be one of these two and the choice is under the control
+ of the user of the license.
+
+ The GNU Lesser General Public License, version 3 or later
+ See the files "COPYING.lgplv3" and "COPYING.gplv3"
+
+ The Modified Berkeley Software Distribution License
+ See the file "COPYING.mbsd"
+
+ These files have the following md5sums:
+
+ 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+%
+
+newline "\n"
+nul-byte "\x00"
+dir-sep "/\\"
+percent "%"
+comma ","
+colon ":"
+underscore "_"
+plus "+"
+dollar "$"
+option-marker "-"
+
+horiz-white "\t "
+alt-white "\v\f\r\b"
+whitespace +horiz-white +newline +alt-white
+non-nl-white +horiz-white +alt-white
+quote "'\""
+parentheses "()"
+
+graphic "!-~"
+inversion "~-"
+oct-digit "0-7"
+dec-digit "89" +oct-digit
+hex-digit "a-fA-F" +dec-digit
+lower-case "a-z"
+upper-case "A-Z"
+alphabetic +lower-case +upper-case
+alphanumeric +alphabetic +dec-digit
+var-first +underscore +alphabetic
+variable-name +var-first +dec-digit
+option-name "^-" +variable-name
+value-name +colon +option-name
+name-sep "[.]"
+compound-name +value-name +name-sep +horiz-white
+scheme-note +parentheses +quote
+
+unquotable "!-~" -"#,;<=>[\\]`{}?*" -quote -parentheses
+end-xml-token "/>" +whitespace
+plus-n-space +plus +whitespace
+punctuation "!-~" -alphanumeric -"_"
+suffix "-._" +alphanumeric
+suffix-fmt +percent +suffix +dir-sep
+false-type "nNfF0" +nul-byte
+file-name +dir-sep +suffix
+end-token +nul-byte +whitespace
+end-list-entry +comma +end-token
+set-separator "|+" +end-list-entry
+signed-number +inversion +dec-digit
+make-script +dollar +newline
+load-line-skip +horiz-white +option-marker
diff --git a/autoopts/autoopts-config.1 b/autoopts/autoopts-config.1
new file mode 100644
index 0000000..f600e3f
--- /dev/null
+++ b/autoopts/autoopts-config.1
@@ -0,0 +1,161 @@
+\" -*- buffer-read-only: t -*- vi: set ro:
+\"
+\" DO NOT EDIT THIS FILE (autoopts-config.1)
+\"
+\" It has been AutoGen-ed August 11, 2012 at 09:41:23 AM by AutoGen 5.16.2pre7
+\" From the definitions aoconf.def
+\" and the template file aoconf.tpl
+\"
+.TH autoopts-config 1 2012-08-11 "" "Programmer's Manual"
+.SH NAME
+autoopts-config \- script to get information about installed version of
+autoopts
+.SH SYNOPSIS
+.B autoopts-config
+.B { <value-name> [...] | everything }
+.PP
+.SH DESCRIPTION
+\fBautoopts-config\fP is a tool that is used by configure to determine
+the compile and linker flags that should be used to compile and link
+programs that use autoopts. \fIvalue-name\fPs may be preceeded by
+one or more hyphens. They are silently ignored.
+.SH "VALUE NAMES"
+.TP
+.BR autogen
+.sp
+Print the full path name of the autogen executable.
+.br
+The unconfigured value is: ${bindir}/autogen${exeext}
+.TP
+.BR bindir
+.sp
+The destination directory for executable scripts and programs
+installed by the \fIautogen\fP package.
+.br
+The unconfigured value is: @bindir@
+.TP
+.BR cflags
+.sp
+Print the compiler flags that are necessary to compile an autoopts program.
+.br
+The unconfigured value is: -I${includedir}
+.TP
+.BR datadir
+.sp
+The directory for various data directories.
+.br
+The unconfigured value is: @datadir@
+.TP
+.BR datarootdir
+.sp
+The root directory for various data directories.
+In this case, there is only one, "datadir".
+.br
+The unconfigured value is: @datarootdir@
+.TP
+.BR dotver
+.sp
+Print the currently installed version of autoopts, in dotted format.
+.br
+The unconfigured value is: @AO_CURRENT@.@AO_REVISION@.@AO_AGE@
+.TP
+.BR everything
+.sp
+Print the list of all names and values, one per line.
+.TP
+.BR exec_prefix
+.sp
+The installation root for libraries and executables.
+.br
+The unconfigured value is: @exec_prefix@
+.TP
+.BR exeext
+.sp
+The executable file extension used for the autogen executable.
+.br
+The unconfigured value is: @EXEEXT@
+.TP
+.BR includedir
+.sp
+The directory where the AutoOpts headers are stored.
+This does not include the "-I" prefix gotten by specifying "cflags".
+.br
+The unconfigured value is: @includedir@
+.TP
+.BR ldflags
+.sp
+Print the linker flags that are necessary to link an autoopts program
+in the default installation mode (static or dynamic).
+.br
+The unconfigured value is: -L${libdir} -lopts
+.TP
+.BR ldopts
+.sp
+The linker options to use when linking a program to libopts.
+.br
+The unconfigured value is: @AG_LDFLAGS@
+.TP
+.BR libdir
+.sp
+The libopts installation directory.
+.br
+The unconfigured value is: @libdir@
+.TP
+.BR libs
+.sp
+an alternate spelling of "\fIldflags\fP".
+.br
+The unconfigured value is: ${ldflags}
+.TP
+.BR libsrc
+.sp
+The full path of the redistributable, tear-off libopts library source.
+This file is in gzipped-tarball format.
+.br
+The unconfigured value is: ${pkgdatadir}/libopts-${dotver}.tar.gz
+.TP
+.BR package
+.sp
+The name of the package that provides \fBautoopts\fP. This is always
+"\fIautogen\fP".
+.br
+The unconfigured value is: @PACKAGE@
+.TP
+.BR pkgdatadir
+.sp
+The directory containing support files used by autogen.
+.br
+The unconfigured value is: ${datadir}/${package}
+.TP
+.BR prefix
+.sp
+The \fIautogen\fP package installation prefix.
+.br
+The unconfigured value is: @prefix@
+.TP
+.BR static_libs
+.sp
+The name of the AR archive of the libopts object code.
+.br
+The unconfigured value is: ${libdir}/libopts.a
+.TP
+.BR version
+.sp
+Print the currently installed version of autoopts.
+.br
+The unconfigured value is: @AO_CURRENT@:@AO_REVISION@:@AO_AGE@
+.SH "SEE ALSO"
+.IR Autogen
+Info system documentation.
+.SH AUTHORS
+AutoGen is the work of Bruce Korb <bkorb@gnu.org>.
+.br
+Bruce Korb <bkorb@gnu.org> and
+.br
+Luca Filipozzi <lfilipoz@debian.org>
+created this manpage.
+.PP
+AutoOpts is released under either the GNU General Public License with the
+Library exception (LGPL), or else the advertising clause free BSD license.
+Which license used is at the discretion of the licensee.
+\" end of autoopts-config.1
diff --git a/autoopts/autoopts-config.in b/autoopts/autoopts-config.in
new file mode 100644
index 0000000..177cdd4
--- /dev/null
+++ b/autoopts/autoopts-config.in
@@ -0,0 +1,114 @@
+#! @CONFIG_SHELL@
+## ---------------------------------------------------------------------
+## autoopts-config.in -- Describe AutoOpts configuration
+##
+## Autoopts Copyright (c) 1992-2012 by Bruce Korb
+##
+## DO NOT EDIT THIS FILE (autoopts-config.in)
+##
+## It has been AutoGen-ed August 11, 2012 at 09:41:23 AM by AutoGen 5.16.2pre7
+## From the definitions aoconf.def
+## and the template file aoconf.tpl
+##
+ prefix="@prefix@"
+ datarootdir="@datarootdir@"
+ datadir="@datadir@"
+ package="@PACKAGE@"
+ includedir="@includedir@"
+ exec_prefix="@exec_prefix@"
+ bindir="@bindir@"
+ libdir="@libdir@"
+ ldopts="@AG_LDFLAGS@"
+ exeext="@EXEEXT@"
+ version="@AO_CURRENT@:@AO_REVISION@:@AO_AGE@"
+ dotver="@AO_CURRENT@.@AO_REVISION@.@AO_AGE@"
+ pkgdatadir="${datadir}/${package}"
+ autogen="${bindir}/autogen${exeext}"
+ ldflags="-L${libdir} -lopts"
+ libs="${ldflags}"
+ libsrc="${pkgdatadir}/libopts-${dotver}.tar.gz"
+ static_libs="${libdir}/libopts.a"
+ cflags="-I${includedir}"
+test 'X@ENABLE_STATIC@' = Xno && static_libs=''
+case "${libdir}" in
+/lib | /lib64 | /usr/lib | /usr/lib64 )
+ ldopts=''
+ ldflags=-lopts
+ ;;
+
+* )
+ test -n "${ldopts}" && \
+ ldflags="${ldopts}${libdir} ${ldflags}"
+ ;;
+esac
+libs=${ldflags}
+test "${includedir}" = "/usr/include" && cflags=""
+optlist="\
+ autogen bindir cflags datadir datarootdir dotver
+ everything exec_prefix exeext includedir ldflags ldopts
+ libdir libs libsrc package pkgdatadir prefix
+ static_libs version"
+
+usage()
+{
+ test $# -gt 0 && {
+ exec 1>&2
+ echo autoopts-config error: "$*"
+ }
+
+ echo Usage: autoopts-config \<\<OPTION\>\> [ ... ]
+ echo Options may be one or more of:
+
+ for o in $optlist
+ do echo " ${o}"
+ done | sed 's,_,-,g'
+ echo 'NB: "everything" will print out the list of all names and values.'
+ exit $#
+}
+
+test $# -gt 0 || usage "No value specified"
+
+# Figure out what's wanted
+#
+val=''
+for o in "$@" ; do
+ o=`echo ${o} | sed 's,^-*,,;s/-/_/g'`
+ case "$o" in
+ help | h | \? ) usage ;;
+ *[!a-zA-Z0-9_]* ) usage "Invalid name: ${o}" ;;
+
+ prefix ) val="${val} ${prefix}" ;;
+ datarootdir ) val="${val} ${datarootdir}" ;;
+ datadir ) val="${val} ${datadir}" ;;
+ package ) val="${val} ${package}" ;;
+ includedir ) val="${val} ${includedir}" ;;
+ exec_prefix ) val="${val} ${exec_prefix}" ;;
+ bindir ) val="${val} ${bindir}" ;;
+ libdir ) val="${val} ${libdir}" ;;
+ ldopts ) val="${val} ${ldopts}" ;;
+ exeext ) val="${val} ${exeext}" ;;
+ version ) val="${val} ${version}" ;;
+ dotver ) val="${val} ${dotver}" ;;
+ pkgdatadir ) val="${val} ${pkgdatadir}" ;;
+ autogen ) val="${val} ${autogen}" ;;
+ ldflags ) val="${val} ${ldflags}" ;;
+ libs ) val="${val} ${libs}" ;;
+ libsrc ) val="${val} ${libsrc}" ;;
+ static_libs ) val="${val} ${static_libs}" ;;
+ cflags ) val="${val} ${cflags}" ;;
+ everything )
+ for o in ${optlist}
+ do test ${o} = everything && continue
+ eval v=\"\${${o}}\"
+ test -z "${v}" && echo ${o} || \
+ printf "%-12s $v\n" ${o}
+ done
+ exit 0
+ ;;
+
+ * ) usage "Unknown value name: ${o}" ;;
+ esac
+done
+
+echo "${val}"
+## end of autoopts-config.in
diff --git a/autoopts/autoopts.c b/autoopts/autoopts.c
new file mode 100644
index 0000000..1eff700
--- /dev/null
+++ b/autoopts/autoopts.c
@@ -0,0 +1,729 @@
+
+/**
+ * \file autoopts.c
+ *
+ * Time-stamp: "2012-03-04 19:44:56 bkorb"
+ *
+ * This file contains all of the routines that must be linked into
+ * an executable to use the generated option processing. The optional
+ * routines are in separately compiled modules so that they will not
+ * necessarily be linked in.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+#ifndef PKGDATADIR
+# define PKGDATADIR ""
+#endif
+
+static char const zNil[] = "";
+static arg_types_t argTypes = { NULL };
+static char line_fmt_buf[32];
+static bool displayEnum = false;
+static char const pkgdatadir_default[] = PKGDATADIR;
+static char const * program_pkgdatadir = pkgdatadir_default;
+static tOptionLoadMode option_load_mode = OPTION_LOAD_UNCOOKED;
+static tePagerState pagerState = PAGER_STATE_INITIAL;
+
+ FILE * option_usage_fp = NULL;
+
+/* = = = START-STATIC-FORWARD = = = */
+static tSuccess
+next_opt_arg_must(tOptions * pOpts, tOptState* pOptState);
+
+static tSuccess
+next_opt_arg_may(tOptions * pOpts, tOptState * pOptState);
+
+static tSuccess
+next_opt_arg_none(tOptions * pOpts, tOptState* pOptState);
+
+static tSuccess
+next_opt(tOptions * pOpts, tOptState * pOptState);
+
+static tSuccess
+doPresets(tOptions * pOpts);
+/* = = = END-STATIC-FORWARD = = = */
+
+LOCAL void *
+ao_malloc(size_t sz)
+{
+ void * res = malloc(sz);
+ if (res == NULL) {
+ fprintf(stderr, zAO_Alloc, (int)sz);
+ exit(EXIT_FAILURE);
+ }
+ return res;
+}
+#undef malloc
+#define malloc(_s) ao_malloc(_s)
+
+LOCAL void *
+ao_realloc(void *p, size_t sz)
+{
+ void * res = (p == NULL) ? malloc(sz) : realloc(p, sz);
+ if (res == NULL) {
+ fprintf(stderr, zAO_Realloc, (int)sz, p);
+ exit(EXIT_FAILURE);
+ }
+ return res;
+}
+#undef realloc
+#define realloc(_p,_s) ao_realloc(_p,_s)
+
+LOCAL char *
+ao_strdup(char const *str)
+{
+ char * res = strdup(str);
+ if (res == NULL) {
+ fprintf(stderr, zAO_Strdup, (int)strlen(str));
+ exit(EXIT_FAILURE);
+ }
+ return res;
+}
+#undef strdup
+#define strdup(_p) ao_strdup(_p)
+
+#ifndef HAVE_PATHFIND
+# include "compat/pathfind.c"
+#endif
+
+#ifndef HAVE_SNPRINTF
+# include "compat/snprintf.c"
+#endif
+
+#ifndef HAVE_STRDUP
+# include "compat/strdup.c"
+#endif
+
+#ifndef HAVE_STRCHR
+# include "compat/strchr.c"
+#endif
+
+/*
+ * handle_opt
+ *
+ * This routine handles equivalencing, sets the option state flags and
+ * invokes the handler procedure, if any.
+ */
+LOCAL tSuccess
+handle_opt(tOptions * pOpts, tOptState* pOptState)
+{
+ /*
+ * Save a copy of the option procedure pointer.
+ * If this is an equivalence class option, we still want this proc.
+ */
+ tOptDesc* pOD = pOptState->pOD;
+ tOptProc* pOP = pOD->pOptProc;
+ if (pOD->fOptState & OPTST_ALLOC_ARG)
+ AGFREE(pOD->optArg.argString);
+
+ pOD->optArg.argString = pOptState->pzOptArg;
+
+ /*
+ * IF we are presetting options, then we will ignore any un-presettable
+ * options. They are the ones either marked as such.
+ */
+ if ( ((pOpts->fOptSet & OPTPROC_PRESETTING) != 0)
+ && ((pOD->fOptState & OPTST_NO_INIT) != 0)
+ )
+ return PROBLEM;
+
+ /*
+ * IF this is an equivalence class option,
+ * THEN
+ * Save the option value that got us to this option
+ * entry. (It may not be pOD->optChar[0], if this is an
+ * equivalence entry.)
+ * set the pointer to the equivalence class base
+ */
+ if (pOD->optEquivIndex != NO_EQUIVALENT) {
+ tOptDesc* p = pOpts->pOptDesc + pOD->optEquivIndex;
+
+ /*
+ * IF the current option state has not been defined (set on the
+ * command line), THEN we will allow continued resetting of
+ * the value. Once "defined", then it must not change.
+ */
+ if ((pOD->fOptState & OPTST_DEFINED) != 0) {
+ /*
+ * The equivalenced-to option has been found on the command
+ * line before. Make sure new occurrences are the same type.
+ *
+ * IF this option has been previously equivalenced and
+ * it was not the same equivalenced-to option,
+ * THEN we have a usage problem.
+ */
+ if (p->optActualIndex != pOD->optIndex) {
+ fprintf(stderr, (char*)zMultiEquiv, p->pz_Name, pOD->pz_Name,
+ (pOpts->pOptDesc + p->optActualIndex)->pz_Name);
+ return FAILURE;
+ }
+ } else {
+ /*
+ * Set the equivalenced-to actual option index to no-equivalent
+ * so that we set all the entries below. This option may either
+ * never have been selected before, or else it was selected by
+ * some sort of "presetting" mechanism.
+ */
+ p->optActualIndex = NO_EQUIVALENT;
+ }
+
+ if (p->optActualIndex != pOD->optIndex) {
+ /*
+ * First time through, copy over the state
+ * and add in the equivalence flag
+ */
+ p->optActualValue = pOD->optValue;
+ p->optActualIndex = pOD->optIndex;
+ pOptState->flags |= OPTST_EQUIVALENCE;
+ }
+
+ /*
+ * Copy the most recent option argument. set membership state
+ * is kept in ``p->optCookie''. Do not overwrite.
+ */
+ p->optArg.argString = pOD->optArg.argString;
+ pOD = p;
+
+ } else {
+ pOD->optActualValue = pOD->optValue;
+ pOD->optActualIndex = pOD->optIndex;
+ }
+
+ pOD->fOptState &= OPTST_PERSISTENT_MASK;
+ pOD->fOptState |= (pOptState->flags & ~OPTST_PERSISTENT_MASK);
+
+ /*
+ * Keep track of count only for DEFINED (command line) options.
+ * IF we have too many, build up an error message and bail.
+ */
+ if ( (pOD->fOptState & OPTST_DEFINED)
+ && (++pOD->optOccCt > pOD->optMaxCt) ) {
+
+ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) {
+ char const * pzEqv =
+ (pOD->optEquivIndex != NO_EQUIVALENT) ? zEquiv : zNil;
+
+ fputs(zErrOnly, stderr);
+
+ if (pOD->optMaxCt > 1)
+ fprintf(stderr, zAtMost, pOD->optMaxCt, pOD->pz_Name, pzEqv);
+ else
+ fprintf(stderr, zOnlyOne, pOD->pz_Name, pzEqv);
+ }
+
+ return FAILURE;
+ }
+
+ /*
+ * If provided a procedure to call, call it
+ */
+ if (pOP != NULL)
+ (*pOP)(pOpts, pOD);
+
+ return SUCCESS;
+}
+
+static tSuccess
+next_opt_arg_must(tOptions * pOpts, tOptState* pOptState)
+{
+ /*
+ * An option argument is required. Long options can either have
+ * a separate command line argument, or an argument attached by
+ * the '=' character. Figure out which.
+ */
+ switch (pOptState->optType) {
+ case TOPT_SHORT:
+ /*
+ * See if an arg string follows the flag character
+ */
+ if (*++(pOpts->pzCurOpt) == NUL)
+ pOpts->pzCurOpt = pOpts->origArgVect[ pOpts->curOptIdx++ ];
+ pOptState->pzOptArg = pOpts->pzCurOpt;
+ break;
+
+ case TOPT_LONG:
+ /*
+ * See if an arg string has already been assigned (glued on
+ * with an `=' character)
+ */
+ if (pOptState->pzOptArg == NULL)
+ pOptState->pzOptArg = pOpts->origArgVect[ pOpts->curOptIdx++ ];
+ break;
+
+ default:
+#ifdef DEBUG
+ fputs("AutoOpts lib error: option type not selected\n", stderr);
+ exit(EXIT_FAILURE);
+#endif
+
+ case TOPT_DEFAULT:
+ /*
+ * The option was selected by default. The current token is
+ * the option argument.
+ */
+ break;
+ }
+
+ /*
+ * Make sure we did not overflow the argument list.
+ */
+ if (pOpts->curOptIdx > pOpts->origArgCt) {
+ fprintf(stderr, zMisArg, pOpts->pzProgPath, pOptState->pOD->pz_Name);
+ return FAILURE;
+ }
+
+ pOpts->pzCurOpt = NULL; /* next time advance to next arg */
+ return SUCCESS;
+}
+
+/**
+ * Process an optional option argument. For short options, it looks at the
+ * character after the option character, or it consumes the next full argument.
+ * For long options, it looks for an '=' character attachment to the long
+ * option name before deciding to take the next command line argument.
+ *
+ * @param pOpts the option descriptor
+ * @param pOptState a structure for managing the current processing state
+ * @returns SUCCESS or does not return
+ */
+static tSuccess
+next_opt_arg_may(tOptions * pOpts, tOptState * pOptState)
+{
+ /*
+ * An option argument is optional.
+ */
+ switch (pOptState->optType) {
+ case TOPT_SHORT:
+ if (*++pOpts->pzCurOpt != NUL)
+ pOptState->pzOptArg = pOpts->pzCurOpt;
+ else {
+ char* pzLA = pOpts->origArgVect[ pOpts->curOptIdx ];
+
+ /*
+ * BECAUSE it is optional, we must make sure
+ * we did not find another flag and that there
+ * is such an argument.
+ */
+ if ((pzLA == NULL) || (*pzLA == '-'))
+ pOptState->pzOptArg = NULL;
+ else {
+ pOpts->curOptIdx++; /* argument found */
+ pOptState->pzOptArg = pzLA;
+ }
+ }
+ break;
+
+ case TOPT_LONG:
+ /*
+ * Look for an argument if we don't already have one (glued on
+ * with a `=' character) *AND* we are not in named argument mode
+ */
+ if ( (pOptState->pzOptArg == NULL)
+ && (! NAMED_OPTS(pOpts))) {
+ char* pzLA = pOpts->origArgVect[ pOpts->curOptIdx ];
+
+ /*
+ * BECAUSE it is optional, we must make sure
+ * we did not find another flag and that there
+ * is such an argument.
+ */
+ if ((pzLA == NULL) || (*pzLA == '-'))
+ pOptState->pzOptArg = NULL;
+ else {
+ pOpts->curOptIdx++; /* argument found */
+ pOptState->pzOptArg = pzLA;
+ }
+ }
+ break;
+
+ default:
+ case TOPT_DEFAULT:
+ fputs(zAO_Woops, stderr );
+ exit(EX_SOFTWARE);
+ }
+
+ /*
+ * After an option with an optional argument, we will
+ * *always* start with the next option because if there
+ * were any characters following the option name/flag,
+ * they would be interpreted as the argument.
+ */
+ pOpts->pzCurOpt = NULL;
+ return SUCCESS;
+}
+
+
+static tSuccess
+next_opt_arg_none(tOptions * pOpts, tOptState* pOptState)
+{
+ /*
+ * No option argument. Make sure next time around we find
+ * the correct option flag character for short options
+ */
+ if (pOptState->optType == TOPT_SHORT)
+ (pOpts->pzCurOpt)++;
+
+ /*
+ * It is a long option. Make sure there was no ``=xxx'' argument
+ */
+ else if (pOptState->pzOptArg != NULL) {
+ fprintf(stderr, zNoArg, pOpts->pzProgPath, pOptState->pOD->pz_Name);
+ return FAILURE;
+ }
+
+ /*
+ * It is a long option. Advance to next command line argument.
+ */
+ else
+ pOpts->pzCurOpt = NULL;
+ return SUCCESS;
+}
+
+/**
+ * Find the option descriptor and option argument (if any) for the
+ * next command line argument. DO NOT modify the descriptor. Put
+ * all the state in the state argument so that the option can be skipped
+ * without consequence (side effect).
+ *
+ * @param pOpts the program option descriptor
+ * @param pOptState the state of the next found option
+ */
+static tSuccess
+next_opt(tOptions * pOpts, tOptState * pOptState)
+{
+ {
+ tSuccess res = find_opt(pOpts, pOptState);
+ if (! SUCCESSFUL(res))
+ return res;
+ }
+
+ if ( ((pOptState->flags & OPTST_DEFINED) != 0)
+ && ((pOptState->pOD->fOptState & OPTST_NO_COMMAND) != 0)) {
+ fprintf(stderr, zNotCmdOpt, pOptState->pOD->pz_Name);
+ return FAILURE;
+ }
+
+ return get_opt_arg(pOpts, pOptState);
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * DO PRESETS
+ *
+ * The next several routines do the immediate action pass on the command
+ * line options, then the environment variables, then the config files in
+ * reverse order. Once done with that, the order is reversed and all
+ * the config files and environment variables are processed again, this
+ * time only processing the non-immediate action options. doPresets()
+ * will then return for optionProcess() to do the final pass on the command
+ * line arguments.
+ */
+
+/**
+ * scan the command line for immediate action options.
+ * This is only called the first time through.
+ * While this procedure is active, the OPTPROC_IMMEDIATE is true.
+ *
+ * @param pOpts program options descriptor
+ * @returns SUCCESS or FAILURE
+ */
+LOCAL tSuccess
+immediate_opts(tOptions * pOpts)
+{
+ tSuccess res;
+
+ pOpts->fOptSet |= OPTPROC_IMMEDIATE;
+ pOpts->curOptIdx = 1; /* start by skipping program name */
+ pOpts->pzCurOpt = NULL;
+
+ /*
+ * Examine all the options from the start. We process any options that
+ * are marked for immediate processing.
+ */
+ for (;;) {
+ tOptState opt_st = OPTSTATE_INITIALIZER(PRESET);
+
+ res = next_opt(pOpts, &opt_st);
+ switch (res) {
+ case FAILURE: goto failed_option;
+ case PROBLEM: res = SUCCESS; goto leave;
+ case SUCCESS: break;
+ }
+
+ /*
+ * IF this is an immediate-attribute option, then do it.
+ */
+ if (! DO_IMMEDIATELY(opt_st.flags))
+ continue;
+
+ if (! SUCCESSFUL(handle_opt(pOpts, &opt_st)))
+ break;
+ } failed_option:;
+
+ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0)
+ (*pOpts->pUsageProc)(pOpts, EXIT_FAILURE);
+
+leave:
+
+ pOpts->fOptSet &= ~OPTPROC_IMMEDIATE;
+ return res;
+}
+
+/**
+ * Process all the options from our current position onward. (This allows
+ * interspersed options and arguments for the few non-standard programs that
+ * require it.) Thus, do not rewind option indexes because some programs
+ * choose to re-invoke after a non-option.
+ *
+ * @param pOpts program options descriptor
+ * @returns SUCCESS or FAILURE
+ */
+LOCAL tSuccess
+regular_opts(tOptions * pOpts)
+{
+ /* assert: pOpts->fOptSet & OPTPROC_IMMEDIATE == 0 */
+ for (;;) {
+ tOptState opt_st = OPTSTATE_INITIALIZER(DEFINED);
+
+ switch (next_opt(pOpts, &opt_st)) {
+ case FAILURE: goto failed_option;
+ case PROBLEM: return SUCCESS; /* no more args */
+ case SUCCESS: break;
+ }
+
+ /*
+ * IF this is an immediate action option,
+ * THEN skip it (unless we are supposed to do it a second time).
+ */
+ if (! DO_NORMALLY(opt_st.flags)) {
+ if (! DO_SECOND_TIME(opt_st.flags))
+ continue;
+ opt_st.pOD->optOccCt--; /* don't count this repetition */
+ }
+
+ if (! SUCCESSFUL(handle_opt(pOpts, &opt_st)))
+ break;
+ } failed_option:;
+
+ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0)
+ (*pOpts->pUsageProc)(pOpts, EXIT_FAILURE);
+
+ return FAILURE;
+}
+
+
+/**
+ * check for preset values from a config files or envrionment variables
+ */
+static tSuccess
+doPresets(tOptions * pOpts)
+{
+ tOptDesc * pOD = NULL;
+
+ if (! SUCCESSFUL(immediate_opts(pOpts)))
+ return FAILURE;
+
+ /*
+ * IF this option set has a --save-opts option, then it also
+ * has a --load-opts option. See if a command line option has disabled
+ * option presetting.
+ */
+ if ( (pOpts->specOptIdx.save_opts != NO_EQUIVALENT)
+ && (pOpts->specOptIdx.save_opts != 0)) {
+ pOD = pOpts->pOptDesc + pOpts->specOptIdx.save_opts + 1;
+ if (DISABLED_OPT(pOD))
+ return SUCCESS;
+ }
+
+ /*
+ * Until we return from this procedure, disable non-presettable opts
+ */
+ pOpts->fOptSet |= OPTPROC_PRESETTING;
+ /*
+ * IF there are no config files,
+ * THEN do any environment presets and leave.
+ */
+ if (pOpts->papzHomeList == NULL) {
+ env_presets(pOpts, ENV_ALL);
+ }
+ else {
+ env_presets(pOpts, ENV_IMM);
+
+ /*
+ * Check to see if environment variables have disabled presetting.
+ */
+ if ((pOD != NULL) && ! DISABLED_OPT(pOD))
+ intern_file_load(pOpts);
+
+ /*
+ * ${PROGRAM_LOAD_OPTS} value of "no" cannot disable other environment
+ * variable options. Only the loading of .rc files.
+ */
+ env_presets(pOpts, ENV_NON_IMM);
+ }
+ pOpts->fOptSet &= ~OPTPROC_PRESETTING;
+
+ return SUCCESS;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * THESE ROUTINES ARE CALLABLE FROM THE GENERATED OPTION PROCESSING CODE
+ */
+/*=--subblock=arg=arg_type,arg_name,arg_desc =*/
+/*=*
+ * library: opts
+ * header: your-opts.h
+ *
+ * lib_description:
+ *
+ * These are the routines that libopts users may call directly from their
+ * code. There are several other routines that can be called by code
+ * generated by the libopts option templates, but they are not to be
+ * called from any other user code. The @file{options.h} header is
+ * fairly clear about this, too.
+=*/
+
+/*=export_func optionProcess
+ *
+ * what: this is the main option processing routine
+ *
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + int + argc + program arg count +
+ * arg: + char** + argv + program arg vector +
+ *
+ * ret_type: int
+ * ret_desc: the count of the arguments processed
+ *
+ * doc:
+ *
+ * This is the main entry point for processing options. It is intended
+ * that this procedure be called once at the beginning of the execution of
+ * a program. Depending on options selected earlier, it is sometimes
+ * necessary to stop and restart option processing, or to select completely
+ * different sets of options. This can be done easily, but you generally
+ * do not want to do this.
+ *
+ * The number of arguments processed always includes the program name.
+ * If one of the arguments is "--", then it is counted and the processing
+ * stops. If an error was encountered and errors are to be tolerated, then
+ * the returned value is the index of the argument causing the error.
+ * A hyphen by itself ("-") will also cause processing to stop and will
+ * @emph{not} be counted among the processed arguments. A hyphen by itself
+ * is treated as an operand. Encountering an operand stops option
+ * processing.
+ *
+ * err: Errors will cause diagnostics to be printed. @code{exit(3)} may
+ * or may not be called. It depends upon whether or not the options
+ * were generated with the "allow-errors" attribute, or if the
+ * ERRSKIP_OPTERR or ERRSTOP_OPTERR macros were invoked.
+=*/
+int
+optionProcess(tOptions * pOpts, int argCt, char ** argVect)
+{
+ if (! SUCCESSFUL(validate_struct(pOpts, argVect[0])))
+ exit(EX_SOFTWARE);
+
+ /*
+ * Establish the real program name, the program full path,
+ * and do all the presetting the first time thru only.
+ */
+ if ((pOpts->fOptSet & OPTPROC_INITDONE) == 0) {
+ pOpts->origArgCt = (unsigned int)argCt;
+ pOpts->origArgVect = argVect;
+ pOpts->fOptSet |= OPTPROC_INITDONE;
+ if (HAS_pzPkgDataDir(pOpts))
+ program_pkgdatadir = pOpts->pzPkgDataDir;
+
+ if (! SUCCESSFUL(doPresets(pOpts)))
+ return 0;
+
+ /*
+ * IF option name conversion was suppressed but it is not suppressed
+ * for the command line, then it's time to translate option names.
+ * Usage text will not get retranslated.
+ */
+ if ( ((pOpts->fOptSet & OPTPROC_TRANSLATE) != 0)
+ && (pOpts->pTransProc != NULL)
+ && ((pOpts->fOptSet & OPTPROC_NO_XLAT_MASK)
+ == OPTPROC_NXLAT_OPT_CFG) ) {
+
+ pOpts->fOptSet &= ~OPTPROC_NXLAT_OPT_CFG;
+ (*pOpts->pTransProc)();
+ }
+
+ if ((pOpts->fOptSet & OPTPROC_REORDER) != 0)
+ optionSort(pOpts);
+
+ pOpts->curOptIdx = 1;
+ pOpts->pzCurOpt = NULL;
+ }
+
+ /*
+ * IF we are (re)starting,
+ * THEN reset option location
+ */
+ else if (pOpts->curOptIdx <= 0) {
+ pOpts->curOptIdx = 1;
+ pOpts->pzCurOpt = NULL;
+ }
+
+ if (! SUCCESSFUL(regular_opts(pOpts)))
+ return pOpts->origArgCt;
+
+ /*
+ * IF there were no errors
+ * AND we have RC/INI files
+ * AND there is a request to save the files
+ * THEN do that now before testing for conflicts.
+ * (conflicts are ignored in preset options)
+ */
+ if ( (pOpts->specOptIdx.save_opts != NO_EQUIVALENT)
+ && (pOpts->specOptIdx.save_opts != 0)) {
+ tOptDesc* pOD = pOpts->pOptDesc + pOpts->specOptIdx.save_opts;
+
+ if (SELECTED_OPT(pOD)) {
+ optionSaveFile(pOpts);
+ exit(EXIT_SUCCESS);
+ }
+ }
+
+ /*
+ * IF we are checking for errors,
+ * THEN look for too few occurrences of required options
+ */
+ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) {
+ if (! is_consistent(pOpts))
+ (*pOpts->pUsageProc)(pOpts, EXIT_FAILURE);
+ }
+
+ return pOpts->curOptIdx;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/autoopts.c */
diff --git a/autoopts/autoopts.h b/autoopts/autoopts.h
new file mode 100644
index 0000000..194ea5a
--- /dev/null
+++ b/autoopts/autoopts.h
@@ -0,0 +1,335 @@
+
+/*
+ * \file autoopts.h
+ *
+ * Time-stamp: "2012-03-04 19:05:01 bkorb"
+ *
+ * This file defines all the global structures and special values
+ * used in the automated option processing library.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+#ifndef AUTOGEN_AUTOOPTS_H
+#define AUTOGEN_AUTOOPTS_H
+
+#define AO_NAME_LIMIT 127
+#define AO_NAME_SIZE ((size_t)(AO_NAME_LIMIT + 1))
+
+#ifndef AG_PATH_MAX
+# ifdef PATH_MAX
+# define AG_PATH_MAX ((size_t)PATH_MAX)
+# else
+# define AG_PATH_MAX ((size_t)4096)
+# endif
+#else
+# if defined(PATH_MAX) && (PATH_MAX > MAXPATHLEN)
+# undef AG_PATH_MAX
+# define AG_PATH_MAX ((size_t)PATH_MAX)
+# endif
+#endif
+
+#undef EXPORT
+#define EXPORT
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+# define DIRCH '\\'
+#else
+# define DIRCH '/'
+#endif
+
+#define AO_EXIT_REQ_USAGE 64
+#ifndef EX_NOINPUT
+ /**
+ * option state was requested from a file that cannot be loaded.
+ */
+# define EX_NOINPUT 66
+#endif
+#ifndef EX_SOFTWARE
+ /**
+ * AutoOpts Software failure.
+ */
+# define EX_SOFTWARE 70
+#endif
+
+#define NL '\n'
+
+/*
+ * Convert the number to a list usable in a printf call
+ */
+#define NUM_TO_VER(n) ((n) >> 12), ((n) >> 7) & 0x001F, (n) & 0x007F
+
+#define NAMED_OPTS(po) \
+ (((po)->fOptSet & (OPTPROC_SHORTOPT | OPTPROC_LONGOPT)) == 0)
+
+#define SKIP_OPT(p) (((p)->fOptState & OPTST_IMMUTABLE_MASK) != 0)
+
+typedef int tDirection;
+#define DIRECTION_PRESET -1
+#define DIRECTION_PROCESS 1
+#define DIRECTION_CALLED 0
+
+#define PROCESSING(d) ((d)>0)
+#define PRESETTING(d) ((d)<0)
+
+/*
+ * When loading a line (or block) of text as an option, the value can
+ * be processed in any of several modes:
+ *
+ * @table @samp
+ * @item keep
+ * Every part of the value between the delimiters is saved.
+ *
+ * @item uncooked
+ * Even if the value begins with quote characters, do not do quote processing.
+ *
+ * @item cooked
+ * If the value looks like a quoted string, then process it.
+ * Double quoted strings are processed the way strings are in "C" programs,
+ * except they are treated as regular characters if the following character
+ * is not a well-established escape sequence.
+ * Single quoted strings (quoted with apostrophies) are handled the way
+ * strings are handled in shell scripts, *except* that backslash escapes
+ * are honored before backslash escapes and apostrophies.
+ * @end table
+ */
+typedef enum {
+ OPTION_LOAD_COOKED,
+ OPTION_LOAD_UNCOOKED,
+ OPTION_LOAD_KEEP
+} tOptionLoadMode;
+
+static tOptionLoadMode option_load_mode;
+
+/*
+ * The pager state is used by optionPagedUsage() procedure.
+ * When it runs, it sets itself up to be called again on exit.
+ * If, however, a routine needs a child process to do some work
+ * before it is done, then 'pagerState' must be set to
+ * 'PAGER_STATE_CHILD' so that optionPagedUsage() will not try
+ * to run the pager program before its time.
+ */
+typedef enum {
+ PAGER_STATE_INITIAL,
+ PAGER_STATE_READY,
+ PAGER_STATE_CHILD
+} tePagerState;
+
+typedef enum {
+ ENV_ALL,
+ ENV_IMM,
+ ENV_NON_IMM
+} teEnvPresetType;
+
+typedef enum {
+ TOPT_UNDEFINED = 0,
+ TOPT_SHORT,
+ TOPT_LONG,
+ TOPT_DEFAULT
+} teOptType;
+
+typedef struct {
+ tOptDesc* pOD;
+ tCC* pzOptArg;
+ tAoUL flags;
+ teOptType optType;
+} tOptState;
+#define OPTSTATE_INITIALIZER(st) \
+ { NULL, NULL, OPTST_ ## st, TOPT_UNDEFINED }
+
+#define TEXTTO_TABLE \
+ _TT_(LONGUSAGE) \
+ _TT_(USAGE) \
+ _TT_(VERSION)
+#define _TT_(n) \
+ TT_ ## n ,
+
+typedef enum { TEXTTO_TABLE COUNT_TT } teTextTo;
+
+#undef _TT_
+
+typedef struct {
+ char const * pzStr;
+ char const * pzReq;
+ char const * pzNum;
+ char const * pzFile;
+ char const * pzKey;
+ char const * pzKeyL;
+ char const * pzBool;
+ char const * pzNest;
+ char const * pzOpt;
+ char const * pzNo;
+ char const * pzBrk;
+ char const * pzNoF;
+ char const * pzSpc;
+ char const * pzOptFmt;
+ char const * pzTime;
+} arg_types_t;
+
+#define AGALOC(c, w) ao_malloc((size_t)c)
+#define AGREALOC(p, c, w) ao_realloc((void*)p, (size_t)c)
+#define AGFREE(_p) free((void *)_p)
+#define AGDUPSTR(p, s, w) (p = ao_strdup(s))
+
+static void *
+ao_malloc(size_t sz);
+
+static void *
+ao_realloc(void *p, size_t sz);
+
+#define ao_free(_p) free((void *)_p)
+
+static char *
+ao_strdup(char const *str);
+
+/*
+ * DO option handling?
+ *
+ * Options are examined at two times: at immediate handling time and at
+ * normal handling time. If an option is disabled, the timing may be
+ * different from the handling of the undisabled option. The OPTST_DIABLED
+ * bit indicates the state of the currently discovered option.
+ * So, here's how it works:
+ *
+ * A) handling at "immediate" time, either 1 or 2:
+ *
+ * 1. OPTST_DISABLED is not set:
+ * IMM must be set
+ * DISABLE_IMM don't care
+ * TWICE don't care
+ * DISABLE_TWICE don't care
+ * 0 -and- 1 x x x
+ *
+ * 2. OPTST_DISABLED is set:
+ * IMM don't care
+ * DISABLE_IMM must be set
+ * TWICE don't care
+ * DISABLE_TWICE don't care
+ * 1 -and- x 1 x x
+ */
+#define DO_IMMEDIATELY(_flg) \
+ ( (((_flg) & (OPTST_DISABLED|OPTST_IMM)) == OPTST_IMM) \
+ || ( ((_flg) & (OPTST_DISABLED|OPTST_DISABLE_IMM)) \
+ == (OPTST_DISABLED|OPTST_DISABLE_IMM) ))
+
+/* B) handling at "regular" time because it was not immediate
+ *
+ * 1. OPTST_DISABLED is not set:
+ * IMM must *NOT* be set
+ * DISABLE_IMM don't care
+ * TWICE don't care
+ * DISABLE_TWICE don't care
+ * 0 -and- 0 x x x
+ *
+ * 2. OPTST_DISABLED is set:
+ * IMM don't care
+ * DISABLE_IMM don't care
+ * TWICE must be set
+ * DISABLE_TWICE don't care
+ * 1 -and- x x 1 x
+ */
+#define DO_NORMALLY(_flg) ( \
+ (((_flg) & (OPTST_DISABLED|OPTST_IMM)) == 0) \
+ || (((_flg) & (OPTST_DISABLED|OPTST_DISABLE_IMM)) == \
+ OPTST_DISABLED) )
+
+/* C) handling at "regular" time because it is to be handled twice.
+ * The immediate bit was already tested and found to be set:
+ *
+ * 3. OPTST_DISABLED is not set:
+ * IMM is set (but don't care)
+ * DISABLE_IMM don't care
+ * TWICE must be set
+ * DISABLE_TWICE don't care
+ * 0 -and- ? x 1 x
+ *
+ * 4. OPTST_DISABLED is set:
+ * IMM don't care
+ * DISABLE_IMM is set (but don't care)
+ * TWICE don't care
+ * DISABLE_TWICE must be set
+ * 1 -and- x ? x 1
+ */
+#define DO_SECOND_TIME(_flg) ( \
+ (((_flg) & (OPTST_DISABLED|OPTST_TWICE)) == \
+ OPTST_TWICE) \
+ || (((_flg) & (OPTST_DISABLED|OPTST_DISABLE_TWICE)) == \
+ (OPTST_DISABLED|OPTST_DISABLE_TWICE) ))
+
+/*
+ * text_mmap structure. Only active on platforms with mmap(2).
+ */
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#else
+# ifndef PROT_READ
+# define PROT_READ 0x01
+# endif
+# ifndef PROT_WRITE
+# define PROT_WRITE 0x02
+# endif
+# ifndef MAP_SHARED
+# define MAP_SHARED 0x01
+# endif
+# ifndef MAP_PRIVATE
+# define MAP_PRIVATE 0x02
+# endif
+#endif
+
+#ifndef MAP_FAILED
+# define MAP_FAILED ((void*)-1)
+#endif
+
+#ifndef _SC_PAGESIZE
+# ifdef _SC_PAGE_SIZE
+# define _SC_PAGESIZE _SC_PAGE_SIZE
+# endif
+#endif
+
+#ifndef HAVE_STRCHR
+extern char* strchr(char const *s, int c);
+extern char* strrchr(char const *s, int c);
+#endif
+
+/*
+ * Define and initialize all the user visible strings.
+ * We do not do translations. If translations are to be done, then
+ * the client will provide a callback for that purpose.
+ */
+#undef DO_TRANSLATIONS
+#include "autoopts/usage-txt.h"
+
+/*
+ * File pointer for usage output
+ */
+FILE * option_usage_fp;
+static char const * program_pkgdatadir;
+
+extern tOptProc optionPrintVersion, optionPagedUsage, optionLoadOpt;
+
+#endif /* AUTOGEN_AUTOOPTS_H */
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/autoopts.h */
diff --git a/autoopts/autoopts.m4 b/autoopts/autoopts.m4
new file mode 100644
index 0000000..718f497
--- /dev/null
+++ b/autoopts/autoopts.m4
@@ -0,0 +1,225 @@
+dnl -*- Mode: M4 -*-
+dnl --------------------------------------------------------------------
+dnl autoopts.m4 --- Configure paths for autoopts
+dnl
+dnl Author: Gary V. Vaughan <gvaughan@localhost>
+dnl Time-stamp: "2011-12-13 09:45:03 bkorb"
+dnl
+dnl This file is part of AutoOpts, a companion to AutoGen.
+dnl AutoOpts is free software.
+dnl AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+dnl
+dnl AutoOpts is available under any one of two licenses. The license
+dnl in use must be one of these two and the choice is under the control
+dnl of the user of the license.
+dnl
+dnl The GNU Lesser General Public License, version 3 or later
+dnl See the files "COPYING.lgplv3" and "COPYING.gplv3"
+dnl
+dnl The Modified Berkeley Software Distribution License
+dnl See the file "COPYING.mbsd"
+dnl
+dnl These files have the following md5sums:
+dnl
+dnl 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+dnl 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+dnl 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+dnl --------------------------------------------------------------------
+dnl Code:
+
+# serial 1
+
+dnl AG_PATH_AUTOOPTS([MIN-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for AUTOOPTS, and define AUTOGEN, AUTOOPTS_CFLAGS, AUTOGEN_LDFLAGS
+dnl and AUTOOPTS_LIBS.
+dnl
+AC_DEFUN([AG_PATH_AUTOOPTS],
+[dnl Get the cflags and libraries from the autoopts-config script
+AC_ARG_WITH(opts-prefix,
+[ --with-opts-prefix=PFX Prefix where autoopts is installed (optional)])
+
+AC_ARG_WITH(opts-exec-prefix,
+[ --with-opts-exec-prefix=PFX
+ Exec prefix where autoopts is installed (optional)])
+
+AC_ARG_ENABLE(opts-test,
+[ --disable-opts-test Do not try to run a test AutoOpts program])
+
+ if test x$with_opts_exec_prefix != x ; then
+ aocfg_args="$aocfg_args --exec-prefix=$with_opts_exec_prefix"
+ if test x${AUTOOPTS_CONFIG+set} != xset ; then
+ AUTOOPTS_CONFIG=$with_opts_exec_prefix/bin/autoopts-config
+ fi
+ fi
+ if test x$with_opts_prefix != x ; then
+ aocfg_args="$aocfg_args --prefix=$with_opts_prefix"
+ if test x${AUTOOPTS_CONFIG+set} != xset ; then
+ AUTOOPTS_CONFIG=$with_opts_prefix/bin/autoopts-config
+ fi
+ fi
+ if test -n "$AUTOOPTS_CONFIG"; then
+ :
+ else
+ AC_PATH_PROG(AUTOOPTS_CONFIG, autoopts-config, no)
+ fi
+ AC_MSG_CHECKING(for compatible autoopts version)[
+ no_autoopts=""
+ if test "$AUTOOPTS_CONFIG" = "no" ; then
+ no_autoopts=yes
+ else
+ AUTOGEN=`$AUTOOPTS_CONFIG $aocfg_args --autogen`
+ AUTOOPTS_CFLAGS=`$AUTOOPTS_CONFIG $aocfg_args --cflags`
+ AUTOGEN_LDFLAGS=`$AUTOOPTS_CONFIG $aocfg_args --pkgdatadir`
+ AUTOOPTS_LIBS=`$AUTOOPTS_CONFIG $aocfg_args --libs`
+ aocfg_version=`$AUTOOPTS_CONFIG $aocfg_args --version`
+ save_IFS=$IFS
+ IFS=' :'
+ set -- $aocfg_version
+ IFS=$save_IFS
+ aocfg_current=$1
+ aocfg_revision=$2
+ aocfg_age=$3
+ aocfg_currev=$1.$2
+ if test "x$enable_opts_test" != "xno" ; then
+ AC_LANG_SAVE
+ AC_LANG_C
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LDFLAGS="$LDFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $AUTOOPTS_CFLAGS"
+ LDFLAGS="$LDFLAGS $AUTOOPTS $CFLAGS"
+ LIBS="$LIBS $AUTOOPTS_LIBS"]
+ dnl
+ dnl Now check if the installed AUTOOPTS is sufficiently new. (Also
+ dnl sanity checks the results of autoopts-config to some extent.
+ dnl
+ rm -f confopts.def conf.optstest
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <autoopts/options.h>
+#ifndef OPTIONS_VER_TO_NUM
+#define OPTIONS_VER_TO_NUM(_v, _r) (((_v) * 4096) + (_r))
+#endif
+
+static char const zBadVer[] = "\n\\
+*** 'autoopts-config --version' returned $aocfg_version,\n\\
+*** but autoopts returned %d:%d:0\n\\
+*** and the header file says %s\n\\
+*** These should all be consistent.\n\n\\
+*** If autoopts-config was correct, then it is best to remove the old version\n\\
+*** of autoopts. You may also be able to fix the error by modifying your\n\\
+*** LD_LIBRARY_PATH enviroment variable, or by editing /etc/ld.so.conf.\n\\
+*** Make sure you have run ldconfig if that is required on your system.\n\\
+*** Otherwise, set the environment variable AUTOOPTS_CONFIG to point to\n\\
+*** the correct copy of autoopts-config, and remove the file config.cache\n\\
+*** before re-running configure.\n";
+
+int
+main (int argc, char ** argv)
+{
+ int current, revision, ct;
+ char tmp_version[256];
+
+ system ("touch conf.optstest");
+
+ /*
+ * Test liked library against header file
+ */
+ strcpy(tmp_version, optionVersion());
+ ct = sscanf(tmp_version, "%d.%d", &current, &revision);
+ if (ct != 2) {
+ printf("bad version string: -->>%s<<-- != -->>$aocfg_currev<<--\n",
+ optionVersion());
+ return 1;
+ }
+
+ if (OPTIONS_VER_TO_NUM(current, revision) != OPTIONS_STRUCT_VERSION) {
+ printf(zBadVer, current, revision, OPTIONS_VERSION_STRING);
+ return 1;
+ }
+
+ /*
+ * Test autoopts-config against header version
+ */
+ if ( OPTIONS_VER_TO_NUM($aocfg_current, $aocfg_revision)
+ != OPTIONS_STRUCT_VERSION) {
+ printf("*** autoopts header file version "OPTIONS_VERSION_STRING"\n"
+ "*** does not match autoopts-config value $aocfg_version\n"
+ "*** library version is %d:%d\n", current, revision);
+ return 1;
+ }
+
+ return 0;
+}
+],, no_autoopts=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LDFLAGS="$ac_save_LDFLAGS"
+ LIBS="$ac_save_LIBS"
+ AC_LANG_RESTORE
+ fi
+ fi
+
+ if test "x$no_autoopts" = x ; then
+ AC_MSG_RESULT(yes)
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ if test "$AUTOOPTS_CONFIG" = "no" ; then
+ cat <<- _EOF_
+ *** The autoopts-config script installed by AutoGen could not be found
+ *** If AutoGen was installed in PREFIX, make sure PREFIX/bin is in
+ *** your path, or set the AUTOOPTS_CONFIG environment variable to the
+ *** full path to autoopts-config.
+ _EOF_
+ else
+ if test -f conf.optstest ; then
+ :
+ else
+ echo "*** Could not run autoopts test program, checking why..."
+ CFLAGS="$CFLAGS $AUTOOPTS_CFLAGS"
+ LIBS="$LIBS $AUTOOPTS_LIBS"
+ AC_LANG_SAVE
+ AC_LANG_C
+ AC_TRY_LINK([
+#include <autoopts/options.h>
+#include <stdio.h>
+], [return strcmp("$aocfg_current:$aocfg_revision:$aocfg_age", optionVersion());],
+ [ cat << _EOF_
+*** The test program compiled, but did not run. This usually means that
+*** the run-time linker is not finding libopts or finding the wrong version
+*** of libopts. If it is not finding libopts, you'll need to set your
+*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
+*** to the installed location Also, make sure you have run ldconfig if that
+*** is required on your system
+***
+*** If you have an old version installed, it is best to remove it, although
+*** you may also be able to get things to work by modifying LD_LIBRARY_PATH
+_EOF_
+], [cat << _EOF_
+*** The test program failed to compile or link. See the file config.log for
+*** the exact error that occured. This usually means AutoGen was incorrectly
+*** installed or that you have moved libopts since it was installed. In the
+*** latter case, you may want to edit the autoopts-config script:
+*** $AUTOOPTS_CONFIG
+_EOF_
+])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ AC_LANG_RESTORE
+ fi
+ fi
+ AUTOGEN=:
+ AUTOOPTS_CFLAGS=""
+ AUTOOPTS_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(AUTOGEN)
+ AC_SUBST(AUTOOPTS_CFLAGS)
+ AC_SUBST(AUTOGEN_LDFLAGS)
+ AC_SUBST(AUTOOPTS_LIBS)
+ rm -f confopts.def conf.optstest
+])
+dnl
+dnl autoopts.m4 ends here
diff --git a/autoopts/autoopts/options.h b/autoopts/autoopts/options.h
new file mode 100644
index 0000000..c16d91b
--- /dev/null
+++ b/autoopts/autoopts/options.h
@@ -0,0 +1,1110 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (options.h)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:18 AM by AutoGen 5.16.2pre7
+ * From the definitions funcs.def
+ * and the template file options_h
+ *
+ * This file defines all the global structures and special values
+ * used in the automated option processing library.
+ *
+ * Automated Options Copyright (C) 1992-2012 by Bruce Korb
+ *
+ * * AutoOpts is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoOpts is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.";
+ */
+#ifndef AUTOOPTS_OPTIONS_H_GUARD
+#define AUTOOPTS_OPTIONS_H_GUARD 1
+#include <sys/types.h>
+#include <stdio.h>
+
+#ifndef COMPAT_H_GUARD
+/*
+ * This is needed for test compilations where the "compat.h"
+ * header is not usually available.
+ */
+# if defined(HAVE_STDINT_H)
+# include <stdint.h>
+# elif defined(HAVE_INTTYPES_H)
+# include <inttypes.h>
+# endif /* HAVE_STDINT/INTTYPES_H */
+
+# if defined(HAVE_LIMITS_H)
+# include <limits.h>
+# elif defined(HAVE_SYS_LIMITS_H)
+# include <sys/limits.h>
+# endif /* HAVE_LIMITS/SYS_LIMITS_H */
+
+# if defined(HAVE_SYSEXITS_H)
+# include <sysexits.h>
+# endif /* HAVE_SYSEXITS_H */
+
+# if defined(HAVE_STDBOOL_H)
+# include <stdbool.h>
+# else
+ typedef enum { false = 0, true = 1 } _Bool;
+# define bool _Bool
+
+ /* The other macros must be usable in preprocessor directives. */
+# define false 0
+# define true 1
+# endif /* HAVE_SYSEXITS_H */
+#endif /* COMPAT_H_GUARD */
+// END-CONFIGURED-HEADERS
+
+/**
+ * Defined to normal value of EX_USAGE. Used to indicate that paged usage
+ * was requested. It is used to distinguish a --usage from a --help request.
+ * --usage is abbreviated and --help gives as much help as possible.
+ */
+#define AO_EXIT_REQ_USAGE 64
+
+/*
+ * PUBLIC DEFINES
+ *
+ * The following defines may be used in applications that need to test the
+ * state of an option. To test against these masks and values, a pointer
+ * to an option descriptor must be obtained. There are two ways:
+ *
+ * 1. inside an option processing procedure, it is the second argument,
+ * conventionally "tOptDesc* pOD".
+ *
+ * 2. Outside of an option procedure (or to reference a different option
+ * descriptor), use either "&DESC( opt_name )" or "&pfx_DESC( opt_name )".
+ *
+ * See the relevant generated header file to determine which and what
+ * values for "opt_name" are available.
+ */
+#define OPTIONS_STRUCT_VERSION 147461
+#define OPTIONS_VERSION_STRING "36:5:11"
+#define OPTIONS_MINIMUM_VERSION 102400
+#define OPTIONS_MIN_VER_STRING "25:0:0"
+#define OPTIONS_VER_TO_NUM(_v, _r) (((_v) * 4096) + (_r))
+
+typedef enum {
+ OPARG_TYPE_NONE = 0,
+ OPARG_TYPE_STRING = 1, /* default type/ vanilla string */
+ OPARG_TYPE_ENUMERATION = 2, /* opt arg is an enum (keyword list) */
+ OPARG_TYPE_BOOLEAN = 3, /* opt arg is boolean-valued */
+ OPARG_TYPE_MEMBERSHIP = 4, /* opt arg sets set membership bits */
+ OPARG_TYPE_NUMERIC = 5, /* opt arg is a long int */
+ OPARG_TYPE_HIERARCHY = 6, /* option arg is hierarchical value */
+ OPARG_TYPE_FILE = 7, /* option arg names a file */
+ OPARG_TYPE_TIME = 8, /* opt arg is a time duration */
+ OPARG_TYPE_FLOAT = 9, /* opt arg is a floating point num */
+ OPARG_TYPE_DOUBLE = 10, /* opt arg is a double prec. float */
+ OPARG_TYPE_LONG_DOUBLE = 11, /* opt arg is a long double prec. */
+ OPARG_TYPE_LONG_LONG = 12 /* opt arg is a long long int */
+} teOptArgType;
+
+typedef struct optionValue {
+ teOptArgType valType;
+ char* pzName;
+ union {
+ char strVal[1]; /* OPARG_TYPE_STRING */
+ unsigned int enumVal; /* OPARG_TYPE_ENUMERATION */
+ unsigned int boolVal; /* OPARG_TYPE_BOOLEAN */
+ unsigned long setVal; /* OPARG_TYPE_MEMBERSHIP */
+ long longVal; /* OPARG_TYPE_NUMERIC */
+ void* nestVal; /* OPARG_TYPE_HIERARCHY */
+ } v;
+} tOptionValue;
+
+typedef enum {
+ FTYPE_MODE_MAY_EXIST = 0x00,
+ FTYPE_MODE_MUST_EXIST = 0x01,
+ FTYPE_MODE_MUST_NOT_EXIST = 0x02,
+ FTYPE_MODE_EXIST_MASK = 0x03,
+ FTYPE_MODE_NO_OPEN = 0x00,
+ FTYPE_MODE_OPEN_FD = 0x10,
+ FTYPE_MODE_FOPEN_FP = 0x20,
+ FTYPE_MODE_OPEN_MASK = 0x30
+} teOptFileType;
+
+typedef union {
+ int file_flags;
+ char const * file_mode;
+} tuFileMode;
+
+typedef struct argList tArgList;
+#define MIN_ARG_ALLOC_CT 6
+#define INCR_ARG_ALLOC_CT 8
+struct argList {
+ int useCt;
+ int allocCt;
+ char const * apzArgs[MIN_ARG_ALLOC_CT];
+};
+
+/*
+ * Bits in the fOptState option descriptor field.
+ */
+typedef enum {
+ OPTST_SET_ID = 0, /* Set via the "SET_OPT()" macro */
+ OPTST_PRESET_ID = 1, /* Set via an RC/INI file */
+ OPTST_DEFINED_ID = 2, /* Set via a command line option */
+ OPTST_RESET_ID = 3, /* Reset via command line option */
+ OPTST_EQUIVALENCE_ID = 4, /* selected by equiv'ed option */
+ OPTST_DISABLED_ID = 5, /* option is in disabled state */
+ OPTST_ALLOC_ARG_ID = 6, /* pzOptArg was allocated */
+ OPTST_NO_INIT_ID = 8, /* option cannot be preset */
+ OPTST_NUMBER_OPT_ID = 9, /* opt value (flag) is any digit */
+ OPTST_STACKED_ID = 10, /* opt uses optionStackArg proc */
+ OPTST_INITENABLED_ID = 11, /* option defaults to enabled */
+ OPTST_ARG_TYPE_1_ID = 12, /* bit 1 of arg type enum */
+ OPTST_ARG_TYPE_2_ID = 13, /* bit 2 of arg type enum */
+ OPTST_ARG_TYPE_3_ID = 14, /* bit 3 of arg type enum */
+ OPTST_ARG_TYPE_4_ID = 15, /* bit 4 of arg type enum */
+ OPTST_ARG_OPTIONAL_ID = 16, /* the option arg not required */
+ OPTST_IMM_ID = 17, /* process opt on first pass */
+ OPTST_DISABLE_IMM_ID = 18, /* process disablement immed. */
+ OPTST_OMITTED_ID = 19, /* compiled out of program */
+ OPTST_MUST_SET_ID = 20, /* must be set or pre-set */
+ OPTST_DOCUMENT_ID = 21, /* opt is for doc only */
+ OPTST_TWICE_ID = 22, /* process opt twice - imm + reg */
+ OPTST_DISABLE_TWICE_ID = 23, /* process disabled option twice */
+ OPTST_SCALED_NUM_ID = 24, /* scaled integer value */
+ OPTST_NO_COMMAND_ID = 25, /* disable from cmd line */
+ OPTST_DEPRECATED_ID = 26, /* support is being removed */
+ OPTST_ALIAS_ID = 27 /* alias for other option */
+} opt_state_enum_t;
+
+#define OPTST_INIT 0U
+#define OPTST_SET (1U << OPTST_SET_ID)
+#define OPTST_PRESET (1U << OPTST_PRESET_ID)
+#define OPTST_DEFINED (1U << OPTST_DEFINED_ID)
+#define OPTST_RESET (1U << OPTST_RESET_ID)
+#define OPTST_EQUIVALENCE (1U << OPTST_EQUIVALENCE_ID)
+#define OPTST_DISABLED (1U << OPTST_DISABLED_ID)
+#define OPTST_ALLOC_ARG (1U << OPTST_ALLOC_ARG_ID)
+#define OPTST_NO_INIT (1U << OPTST_NO_INIT_ID)
+#define OPTST_NUMBER_OPT (1U << OPTST_NUMBER_OPT_ID)
+#define OPTST_STACKED (1U << OPTST_STACKED_ID)
+#define OPTST_INITENABLED (1U << OPTST_INITENABLED_ID)
+#define OPTST_ARG_TYPE_1 (1U << OPTST_ARG_TYPE_1_ID)
+#define OPTST_ARG_TYPE_2 (1U << OPTST_ARG_TYPE_2_ID)
+#define OPTST_ARG_TYPE_3 (1U << OPTST_ARG_TYPE_3_ID)
+#define OPTST_ARG_TYPE_4 (1U << OPTST_ARG_TYPE_4_ID)
+#define OPTST_ARG_OPTIONAL (1U << OPTST_ARG_OPTIONAL_ID)
+#define OPTST_IMM (1U << OPTST_IMM_ID)
+#define OPTST_DISABLE_IMM (1U << OPTST_DISABLE_IMM_ID)
+#define OPTST_OMITTED (1U << OPTST_OMITTED_ID)
+#define OPTST_MUST_SET (1U << OPTST_MUST_SET_ID)
+#define OPTST_DOCUMENT (1U << OPTST_DOCUMENT_ID)
+#define OPTST_TWICE (1U << OPTST_TWICE_ID)
+#define OPTST_DISABLE_TWICE (1U << OPTST_DISABLE_TWICE_ID)
+#define OPTST_SCALED_NUM (1U << OPTST_SCALED_NUM_ID)
+#define OPTST_NO_COMMAND (1U << OPTST_NO_COMMAND_ID)
+#define OPTST_DEPRECATED (1U << OPTST_DEPRECATED_ID)
+#define OPTST_ALIAS (1U << OPTST_ALIAS_ID)
+#define OPT_STATE_MASK 0x0FFFFF7FU
+
+#define OPTST_SET_MASK ( \
+ OPTST_DEFINED | OPTST_PRESET | OPTST_RESET | \
+ OPTST_SET \
+ /* 0x0000000FU */ )
+
+#define OPTST_MUTABLE_MASK ( \
+ OPTST_ALLOC_ARG | OPTST_DEFINED | \
+ OPTST_DISABLED | OPTST_EQUIVALENCE | \
+ OPTST_PRESET | OPTST_RESET | \
+ OPTST_SET \
+ /* 0x0000007FU */ )
+
+#define OPTST_SELECTED_MASK ( \
+ OPTST_DEFINED | OPTST_SET \
+ /* 0x00000005U */ )
+
+#define OPTST_ARG_TYPE_MASK ( \
+ OPTST_ARG_TYPE_1 | OPTST_ARG_TYPE_2 | OPTST_ARG_TYPE_3 | \
+ OPTST_ARG_TYPE_4 \
+ /* 0x0000F000U */ )
+
+#define OPTST_NO_USAGE_MASK ( \
+ OPTST_DEPRECATED | OPTST_NO_COMMAND | OPTST_OMITTED \
+ /* 0x06080000U */ )
+
+#define OPTST_IMMUTABLE_MASK ( \
+ OPTST_DOCUMENT | OPTST_OMITTED \
+ /* 0x00280000U */ )
+
+#define OPTST_DO_NOT_SAVE_MASK ( \
+ OPTST_DOCUMENT | OPTST_NO_INIT | OPTST_OMITTED \
+ /* 0x00280100U */ )
+
+#define OPTST_NO_OUTPUT_MASK ( \
+ OPTST_ALIAS | OPTST_DOCUMENT | OPTST_OMITTED \
+ /* 0x08280000U */ )
+
+#ifdef NO_OPTIONAL_OPT_ARGS
+# undef OPTST_ARG_OPTIONAL
+# define OPTST_ARG_OPTIONAL 0
+#endif
+
+#define VENDOR_OPTION_VALUE 'W'
+
+#define OPTST_PERSISTENT_MASK (~OPTST_MUTABLE_MASK)
+
+#define SELECTED_OPT(_od) ((_od)->fOptState & OPTST_SELECTED_MASK)
+#define UNUSED_OPT( _od) (((_od)->fOptState & OPTST_SET_MASK) == 0)
+#define DISABLED_OPT(_od) ((_od)->fOptState & OPTST_DISABLED)
+#define OPTION_STATE(_od) ((_od)->fOptState)
+#define OPTST_SET_ARGTYPE(_n) ((_n) << OPTST_ARG_TYPE_1_ID)
+#define OPTST_GET_ARGTYPE(_f) (((_f)&OPTST_ARG_TYPE_MASK)>>OPTST_ARG_TYPE_1_ID)
+
+/*
+ * PRIVATE INTERFACES
+ *
+ * The following values are used in the generated code to communicate
+ * with the option library procedures. They are not for public use
+ * and may be subject to change.
+ */
+
+/*
+ * Define the processing state flags
+ */
+typedef enum {
+ OPTPROC_LONGOPT_ID = 0, /* Process long style options */
+ OPTPROC_SHORTOPT_ID = 1, /* Process short style "flags" */
+ OPTPROC_ERRSTOP_ID = 2, /* Stop on argument errors */
+ OPTPROC_DISABLEDOPT_ID = 3, /* Current option is disabled */
+ OPTPROC_NO_REQ_OPT_ID = 4, /* no options are required */
+ OPTPROC_NUM_OPT_ID = 5, /* there is a number option */
+ OPTPROC_INITDONE_ID = 6, /* have inits been done? */
+ OPTPROC_NEGATIONS_ID = 7, /* any negation options? */
+ OPTPROC_ENVIRON_ID = 8, /* check environment? */
+ OPTPROC_NO_ARGS_ID = 9, /* Disallow remaining arguments */
+ OPTPROC_ARGS_REQ_ID = 10, /* Require args after options */
+ OPTPROC_REORDER_ID = 11, /* reorder operands after opts */
+ OPTPROC_GNUUSAGE_ID = 12, /* emit usage in GNU style */
+ OPTPROC_TRANSLATE_ID = 13, /* Translate strings in tOptions */
+ OPTPROC_MISUSE_ID = 14, /* no usage on usage error */
+ OPTPROC_IMMEDIATE_ID = 15, /* immediate options active */
+ OPTPROC_NXLAT_OPT_CFG_ID = 16, /* suppress for config only */
+ OPTPROC_NXLAT_OPT_ID = 17, /* suppress xlation always */
+ OPTPROC_VENDOR_OPT_ID = 18, /* vendor options active */
+ OPTPROC_PRESETTING_ID = 19 /* opt processing in preset state */
+} optproc_state_enum_t;
+
+#define OPTPROC_NONE 0U
+#define OPTPROC_LONGOPT (1U << OPTPROC_LONGOPT_ID)
+#define OPTPROC_SHORTOPT (1U << OPTPROC_SHORTOPT_ID)
+#define OPTPROC_ERRSTOP (1U << OPTPROC_ERRSTOP_ID)
+#define OPTPROC_DISABLEDOPT (1U << OPTPROC_DISABLEDOPT_ID)
+#define OPTPROC_NO_REQ_OPT (1U << OPTPROC_NO_REQ_OPT_ID)
+#define OPTPROC_NUM_OPT (1U << OPTPROC_NUM_OPT_ID)
+#define OPTPROC_INITDONE (1U << OPTPROC_INITDONE_ID)
+#define OPTPROC_NEGATIONS (1U << OPTPROC_NEGATIONS_ID)
+#define OPTPROC_ENVIRON (1U << OPTPROC_ENVIRON_ID)
+#define OPTPROC_NO_ARGS (1U << OPTPROC_NO_ARGS_ID)
+#define OPTPROC_ARGS_REQ (1U << OPTPROC_ARGS_REQ_ID)
+#define OPTPROC_REORDER (1U << OPTPROC_REORDER_ID)
+#define OPTPROC_GNUUSAGE (1U << OPTPROC_GNUUSAGE_ID)
+#define OPTPROC_TRANSLATE (1U << OPTPROC_TRANSLATE_ID)
+#define OPTPROC_MISUSE (1U << OPTPROC_MISUSE_ID)
+#define OPTPROC_IMMEDIATE (1U << OPTPROC_IMMEDIATE_ID)
+#define OPTPROC_NXLAT_OPT_CFG (1U << OPTPROC_NXLAT_OPT_CFG_ID)
+#define OPTPROC_NXLAT_OPT (1U << OPTPROC_NXLAT_OPT_ID)
+#define OPTPROC_VENDOR_OPT (1U << OPTPROC_VENDOR_OPT_ID)
+#define OPTPROC_PRESETTING (1U << OPTPROC_PRESETTING_ID)
+#define OPTPROC_STATE_MASK 0x000FFFFFU
+
+#define OPTPROC_NO_XLAT_MASK ( \
+ OPTPROC_NXLAT_OPT | OPTPROC_NXLAT_OPT_CFG \
+ /* 0x00030000U */ )
+
+#define STMTS(s) do { s; } while (false)
+
+/*
+ * The following must be #defined instead of typedef-ed
+ * because "static const" cannot both be applied to a type,
+ * tho each individually can...so they all are
+ */
+#define tSCC static char const
+#define tCC char const
+#define tAoSC static char
+#define tAoUC unsigned char
+#define tAoUI unsigned int
+#define tAoUL unsigned long
+#define tAoUS unsigned short
+
+/*
+ * It is so disgusting that there must be so many ways
+ * of specifying TRUE and FALSE.
+ */
+typedef enum { AG_FALSE = 0, AG_TRUE } ag_bool;
+
+/*
+ * Define a structure that describes each option and
+ * a pointer to the procedure that handles it.
+ * The argument is the count of this flag previously seen.
+ */
+typedef struct options tOptions;
+typedef struct optDesc tOptDesc;
+typedef struct optNames tOptNames;
+#define OPTPROC_EMIT_USAGE ((tOptions *)0x01UL)
+#define OPTPROC_EMIT_SHELL ((tOptions *)0x02UL)
+#define OPTPROC_RETURN_VALNAME ((tOptions *)0x03UL)
+#define OPTPROC_EMIT_LIMIT ((tOptions *)0x0FUL)
+
+/*
+ * The option procedures do the special processing for each
+ * option flag that needs it.
+ */
+typedef void (tOptProc)(tOptions* pOpts, tOptDesc* pOptDesc);
+typedef tOptProc* tpOptProc;
+
+/*
+ * The usage procedure will never return. It calls "exit(2)"
+ * with the "exitCode" argument passed to it.
+ */
+// coverity[+kill]
+typedef void (tUsageProc)(tOptions* pOpts, int exitCode);
+typedef tUsageProc * tpUsageProc;
+
+/*
+ * Special definitions. "NOLIMIT" is the 'max' value to use when
+ * a flag may appear multiple times without limit. "NO_EQUIVALENT"
+ * is an illegal value for 'optIndex' (option description index).
+ */
+#define NOLIMIT USHRT_MAX
+#define OPTION_LIMIT SHRT_MAX
+#define NO_EQUIVALENT (OPTION_LIMIT+1)
+
+typedef union {
+ char const * argString;
+ uintptr_t argEnum;
+ uintptr_t argIntptr;
+ long argInt;
+ unsigned long argUint;
+ unsigned int argBool;
+ FILE * argFp;
+ int argFd;
+} optArgBucket_t;
+
+#define pzLastArg optArg.argString
+
+/*
+ * Descriptor structure for each option.
+ * Only the fields marked "PUBLIC" are for public use.
+ */
+struct optDesc {
+ tAoUS const optIndex; /* PUBLIC */
+ tAoUS const optValue; /* PUBLIC */
+ tAoUS optActualIndex; /* PUBLIC */
+ tAoUS optActualValue; /* PUBLIC */
+
+ tAoUS const optEquivIndex; /* PUBLIC */
+ tAoUS const optMinCt;
+ tAoUS const optMaxCt;
+ tAoUS optOccCt; /* PUBLIC */
+
+ tAoUI fOptState; /* PUBLIC */
+ tAoUI reserved;
+ optArgBucket_t optArg; /* PUBLIC */
+ void* optCookie; /* PUBLIC */
+
+ int const * const pOptMust;
+ int const * const pOptCant;
+ tpOptProc const pOptProc;
+ char const* const pzText;
+
+ char const* const pz_NAME;
+ char const* const pz_Name;
+ char const* const pz_DisableName;
+ char const* const pz_DisablePfx;
+};
+
+/*
+ * Some options need special processing, so we store their
+ * indexes in a known place:
+ */
+typedef struct optSpecIndex tOptSpecIndex;
+struct optSpecIndex {
+ const tAoUS more_help;
+ const tAoUS save_opts;
+ const tAoUS number_option;
+ const tAoUS default_opt;
+};
+
+/*
+ * The procedure generated for translating option text
+ */
+typedef void (tOptionXlateProc)(void);
+
+/*
+ * Everything marked "PUBLIC" is also marked "const". Public access is not
+ * a license to modify. Other fields are used and modified by the library.
+ * They are also subject to change without any notice.
+ * Do not even look at these outside of libopts.
+ */
+struct options {
+ int const structVersion;
+ unsigned int origArgCt;
+ char** origArgVect;
+ unsigned int fOptSet;
+ unsigned int curOptIdx;
+ char* pzCurOpt;
+
+ char const* const pzProgPath; /* PUBLIC */
+ char const* const pzProgName; /* PUBLIC */
+ char const* const pzPROGNAME; /* PUBLIC */
+ char const* const pzRcName; /* PUBLIC */
+ char const* const pzCopyright; /* PUBLIC */
+ char const* const pzCopyNotice; /* PUBLIC */
+ char const* const pzFullVersion; /* PUBLIC */
+ char const* const* const papzHomeList;
+ char const* const pzUsageTitle;
+ char const* const pzExplain;
+ char const* const pzDetail;
+ tOptDesc* const pOptDesc; /* PUBLIC */
+ char const* const pzBugAddr; /* PUBLIC */
+
+ void* pExtensions;
+ void* pSavedState;
+
+ // coverity[+kill]
+ tpUsageProc pUsageProc;
+ tOptionXlateProc* pTransProc;
+
+ tOptSpecIndex specOptIdx;
+ int const optCt;
+ int const presetOptCt;
+ char const * pzFullUsage;
+ char const * pzShortUsage;
+ /* PUBLIC: */
+ optArgBucket_t const * const originalOptArgArray;
+ void * const * const originalOptArgCookie;
+ char const * const pzPkgDataDir;
+ char const * const pzPackager;
+};
+
+/*
+ * Versions where in various fields first appear:
+ * ($AO_CURRENT * 4096 + $AO_REVISION, but $AO_REVISION must be zero)
+ */
+#define originalOptArgArray_STRUCT_VERSION 131072 /* AO_CURRENT = 32 */
+#define HAS_originalOptArgArray(_opt) \
+ ((_opt)->structVersion >= originalOptArgArray_STRUCT_VERSION)
+
+#define pzPkgDataDir_STRUCT_VERSION 139264 /* AO_CURRENT = 34 */
+#define HAS_pzPkgDataDir(_opt) \
+ ((_opt)->structVersion >= pzPkgDataDir_STRUCT_VERSION)
+
+/*
+ * "token list" structure returned by "string_tokenize()"
+ */
+typedef struct {
+ unsigned long tkn_ct;
+ unsigned char* tkn_list[1];
+} token_list_t;
+
+/*
+ * Hide the interface - it pollutes a POSIX claim, but leave it for
+ * anyone #include-ing this header
+ */
+#define strneqvcmp option_strneqvcmp
+#define streqvcmp option_streqvcmp
+#define streqvmap option_streqvmap
+#define strequate option_strequate
+#define strtransform option_strtransform
+
+/**
+ * Everything needed to be known about an mmap-ed file.
+ *
+ * This is an output only structure used by text_mmap and text_munmap.
+ * Clients must not alter the contents and must provide it to both
+ * the text_mmap and text_munmap procedures. BE ADVISED: if you are
+ * mapping the file with PROT_WRITE the NUL byte at the end MIGHT NOT
+ * BE WRITABLE. In any event, that byte is not be written back
+ * to the source file. ALSO: if "txt_data" is valid and "txt_errno"
+ * is not zero, then there *may* not be a terminating NUL.
+ */
+typedef struct {
+ void * txt_data; /*@< text file data */
+ size_t txt_size; /*@< actual file size */
+ size_t txt_full_size; /*@< mmaped mem size */
+ int txt_fd; /*@< file descriptor */
+ int txt_zero_fd; /*@< fd for /dev/zero */
+ int txt_errno; /*@< warning code */
+ int txt_prot; /*@< "prot" flags */
+ int txt_flags; /*@< mapping type */
+} tmap_info_t;
+
+#define TEXT_MMAP_FAILED_ADDR(a) ((void*)(a) == (void*)MAP_FAILED)
+
+#ifdef __cplusplus
+#define CPLUSPLUS_OPENER extern "C" {
+CPLUSPLUS_OPENER
+#define CPLUSPLUS_CLOSER }
+#else
+#define CPLUSPLUS_CLOSER
+#endif
+
+/*
+ * The following routines may be coded into AutoOpts client code:
+ */
+
+/* From: tokenize.c line 164
+ *
+ * ao_string_tokenize - tokenize an input string
+ *
+ * Arguments:
+ * string string to be tokenized
+ *
+ * Returns: token_list_t* - pointer to a structure that lists each token
+ *
+ * This function will convert one input string into a list of strings.
+ * The list of strings is derived by separating the input based on
+ * white space separation. However, if the input contains either single
+ * or double quote characters, then the text after that character up to
+ * a matching quote will become the string in the list.
+ *
+ * The returned pointer should be deallocated with @code{free(3C)} when
+ * are done using the data. The data are placed in a single block of
+ * allocated memory. Do not deallocate individual token/strings.
+ *
+ * The structure pointed to will contain at least these two fields:
+ * @table @samp
+ * @item tkn_ct
+ * The number of tokens found in the input string.
+ * @item tok_list
+ * An array of @code{tkn_ct + 1} pointers to substring tokens, with
+ * the last pointer set to NULL.
+ * @end table
+ *
+ * There are two types of quoted strings: single quoted (@code{'}) and
+ * double quoted (@code{"}). Singly quoted strings are fairly raw in that
+ * escape characters (@code{\\}) are simply another character, except when
+ * preceding the following characters:
+ * @example
+ * @code{\\} double backslashes reduce to one
+ * @code{'} incorporates the single quote into the string
+ * @code{\n} suppresses both the backslash and newline character
+ * @end example
+ *
+ * Double quote strings are formed according to the rules of string
+ * constants in ANSI-C programs.
+ */
+extern token_list_t* ao_string_tokenize(char const*);
+
+
+/* From: configfile.c line 77
+ *
+ * configFileLoad - parse a configuration file
+ *
+ * Arguments:
+ * pzFile the file to load
+ *
+ * Returns: const tOptionValue* - An allocated, compound value structure
+ *
+ * This routine will load a named configuration file and parse the
+ * text as a hierarchically valued option. The option descriptor
+ * created from an option definition file is not used via this interface.
+ * The returned value is "named" with the input file name and is of
+ * type "@code{OPARG_TYPE_HIERARCHY}". It may be used in calls to
+ * @code{optionGetValue()}, @code{optionNextValue()} and
+ * @code{optionUnloadNested()}.
+ */
+extern const tOptionValue* configFileLoad(char const*);
+
+
+/* From: configfile.c line 1066
+ *
+ * optionFileLoad - Load the locatable config files, in order
+ *
+ * Arguments:
+ * pOpts program options descriptor
+ * pzProg program name
+ *
+ * Returns: int - 0 -> SUCCESS, -1 -> FAILURE
+ *
+ * This function looks in all the specified directories for a configuration
+ * file ("rc" file or "ini" file) and processes any found twice. The first
+ * time through, they are processed in reverse order (last file first). At
+ * that time, only "immediate action" configurables are processed. For
+ * example, if the last named file specifies not processing any more
+ * configuration files, then no more configuration files will be processed.
+ * Such an option in the @strong{first} named directory will have no effect.
+ *
+ * Once the immediate action configurables have been handled, then the
+ * directories are handled in normal, forward order. In that way, later
+ * config files can override the settings of earlier config files.
+ *
+ * See the AutoOpts documentation for a thorough discussion of the
+ * config file format.
+ *
+ * Configuration files not found or not decipherable are simply ignored.
+ */
+extern int optionFileLoad(tOptions*, char const*);
+
+
+/* From: configfile.c line 211
+ *
+ * optionFindNextValue - find a hierarcicaly valued option instance
+ *
+ * Arguments:
+ * pOptDesc an option with a nested arg type
+ * pPrevVal the last entry
+ * name name of value to find
+ * value the matching value
+ *
+ * Returns: const tOptionValue* - a compound value structure
+ *
+ * This routine will find the next entry in a nested value option or
+ * configurable. It will search through the list and return the next entry
+ * that matches the criteria.
+ */
+extern const tOptionValue* optionFindNextValue(const tOptDesc*, const tOptionValue*, char const*, char const*);
+
+
+/* From: configfile.c line 137
+ *
+ * optionFindValue - find a hierarcicaly valued option instance
+ *
+ * Arguments:
+ * pOptDesc an option with a nested arg type
+ * name name of value to find
+ * value the matching value
+ *
+ * Returns: const tOptionValue* - a compound value structure
+ *
+ * This routine will find an entry in a nested value option or configurable.
+ * It will search through the list and return a matching entry.
+ */
+extern const tOptionValue* optionFindValue(const tOptDesc*, char const*, char const*);
+
+
+/* From: restore.c line 166
+ *
+ * optionFree - free allocated option processing memory
+ *
+ * Arguments:
+ * pOpts program options descriptor
+ *
+ * AutoOpts sometimes allocates memory and puts pointers to it in the
+ * option state structures. This routine deallocates all such memory.
+ */
+extern void optionFree(tOptions*);
+
+
+/* From: configfile.c line 280
+ *
+ * optionGetValue - get a specific value from a hierarcical list
+ *
+ * Arguments:
+ * pOptValue a hierarchcal value
+ * valueName name of value to get
+ *
+ * Returns: const tOptionValue* - a compound value structure
+ *
+ * This routine will find an entry in a nested value option or configurable.
+ * If "valueName" is NULL, then the first entry is returned. Otherwise,
+ * the first entry with a name that exactly matches the argument will be
+ * returned. If there is no matching value, NULL is returned and errno is
+ * set to ENOENT. If the provided option value is not a hierarchical value,
+ * NULL is also returned and errno is set to EINVAL.
+ */
+extern const tOptionValue* optionGetValue(const tOptionValue*, char const*);
+
+
+/* From: load.c line 478
+ *
+ * optionLoadLine - process a string for an option name and value
+ *
+ * Arguments:
+ * opts program options descriptor
+ * line NUL-terminated text
+ *
+ * This is a client program callable routine for setting options from, for
+ * example, the contents of a file that they read in. Only one option may
+ * appear in the text. It will be treated as a normal (non-preset) option.
+ *
+ * When passed a pointer to the option struct and a string, it will find
+ * the option named by the first token on the string and set the option
+ * argument to the remainder of the string. The caller must NUL terminate
+ * the string. The caller need not skip over any introductory hyphens.
+ * Any embedded new lines will be included in the option
+ * argument. If the input looks like one or more quoted strings, then the
+ * input will be "cooked". The "cooking" is identical to the string
+ * formation used in AutoGen definition files (@pxref{basic expression}),
+ * except that you may not use backquotes.
+ */
+extern void optionLoadLine(tOptions*, char const*);
+
+
+/* From: configfile.c line 340
+ *
+ * optionNextValue - get the next value from a hierarchical list
+ *
+ * Arguments:
+ * pOptValue a hierarchcal list value
+ * pOldValue a value from this list
+ *
+ * Returns: const tOptionValue* - a compound value structure
+ *
+ * This routine will return the next entry after the entry passed in. At the
+ * end of the list, NULL will be returned. If the entry is not found on the
+ * list, NULL will be returned and "@var{errno}" will be set to EINVAL.
+ * The "@var{pOldValue}" must have been gotten from a prior call to this
+ * routine or to "@code{opitonGetValue()}".
+ */
+extern const tOptionValue* optionNextValue(const tOptionValue*, const tOptionValue*);
+
+
+/* From: usage.c line 201
+ *
+ * optionOnlyUsage - Print usage text for just the options
+ *
+ * Arguments:
+ * pOpts program options descriptor
+ * ex_code exit code for calling exit(3)
+ *
+ * This routine will print only the usage for each option.
+ * This function may be used when the emitted usage must incorporate
+ * information not available to AutoOpts.
+ */
+extern void optionOnlyUsage(tOptions*, int);
+
+
+/* From: autoopts.c line 607
+ *
+ * optionProcess - this is the main option processing routine
+ *
+ * Arguments:
+ * pOpts program options descriptor
+ * argc program arg count
+ * argv program arg vector
+ *
+ * Returns: int - the count of the arguments processed
+ *
+ * This is the main entry point for processing options. It is intended
+ * that this procedure be called once at the beginning of the execution of
+ * a program. Depending on options selected earlier, it is sometimes
+ * necessary to stop and restart option processing, or to select completely
+ * different sets of options. This can be done easily, but you generally
+ * do not want to do this.
+ *
+ * The number of arguments processed always includes the program name.
+ * If one of the arguments is "--", then it is counted and the processing
+ * stops. If an error was encountered and errors are to be tolerated, then
+ * the returned value is the index of the argument causing the error.
+ * A hyphen by itself ("-") will also cause processing to stop and will
+ * @emph{not} be counted among the processed arguments. A hyphen by itself
+ * is treated as an operand. Encountering an operand stops option
+ * processing.
+ */
+extern int optionProcess(tOptions*, int, char**);
+
+
+/* From: restore.c line 123
+ *
+ * optionRestore - restore option state from memory copy
+ *
+ * Arguments:
+ * pOpts program options descriptor
+ *
+ * Copy back the option state from saved memory.
+ * The allocated memory is left intact, so this routine can be
+ * called repeatedly without having to call optionSaveState again.
+ * If you are restoring a state that was saved before the first call
+ * to optionProcess(3AO), then you may change the contents of the
+ * argc/argv parameters to optionProcess.
+ */
+extern void optionRestore(tOptions*);
+
+
+/* From: save.c line 648
+ *
+ * optionSaveFile - saves the option state to a file
+ *
+ * Arguments:
+ * pOpts program options descriptor
+ *
+ * This routine will save the state of option processing to a file. The name
+ * of that file can be specified with the argument to the @code{--save-opts}
+ * option, or by appending the @code{rcfile} attribute to the last
+ * @code{homerc} attribute. If no @code{rcfile} attribute was specified, it
+ * will default to @code{.@i{programname}rc}. If you wish to specify another
+ * file, you should invoke the @code{SET_OPT_SAVE_OPTS(@i{filename})} macro.
+ *
+ * The recommend usage is as follows:
+ * @example
+ * optionProcess(&progOptions, argc, argv);
+ * if (i_want_a_non_standard_place_for_this)
+ * SET_OPT_SAVE_OPTS("myfilename");
+ * optionSaveFile(&progOptions);
+ * @end example
+ */
+extern void optionSaveFile(tOptions*);
+
+
+/* From: restore.c line 71
+ *
+ * optionSaveState - saves the option state to memory
+ *
+ * Arguments:
+ * pOpts program options descriptor
+ *
+ * This routine will allocate enough memory to save the current option
+ * processing state. If this routine has been called before, that memory
+ * will be reused. You may only save one copy of the option state. This
+ * routine may be called before optionProcess(3AO). If you do call it
+ * before the first call to optionProcess, then you may also change the
+ * contents of argc/argv after you call optionRestore(3AO)
+ *
+ * In fact, more strongly put: it is safest to only use this function
+ * before having processed any options. In particular, the saving and
+ * restoring of stacked string arguments and hierarchical values is
+ * disabled. The values are not saved.
+ */
+extern void optionSaveState(tOptions*);
+
+
+/* From: nested.c line 563
+ *
+ * optionUnloadNested - Deallocate the memory for a nested value
+ *
+ * Arguments:
+ * pOptVal the hierarchical value
+ *
+ * A nested value needs to be deallocated. The pointer passed in should
+ * have been gotten from a call to @code{configFileLoad()} (See
+ * @pxref{libopts-configFileLoad}).
+ */
+extern void optionUnloadNested(tOptionValue const *);
+
+
+/* From: version.c line 31
+ *
+ * optionVersion - return the compiled AutoOpts version number
+ *
+ * Returns: char const* - the version string in constant memory
+ *
+ * Returns the full version string compiled into the library.
+ * The returned string cannot be modified.
+ */
+extern char const* optionVersion(void);
+
+
+/* From: ../compat/pathfind.c line 29
+ *
+ * pathfind - fild a file in a list of directories
+ *
+ * Arguments:
+ * path colon separated list of search directories
+ * file the name of the file to look for
+ * mode the mode bits that must be set to match
+ *
+ * Returns: char* - the path to the located file
+ *
+ * the pathfind function is available only if HAVE_PATHFIND is not defined
+ *
+ * pathfind looks for a a file with name "FILE" and "MODE" access
+ * along colon delimited "PATH", and returns the full pathname as a
+ * string, or NULL if not found. If "FILE" contains a slash, then
+ * it is treated as a relative or absolute path and "PATH" is ignored.
+ *
+ * @strong{NOTE}: this function is compiled into @file{libopts} only if
+ * it is not natively supplied.
+ *
+ * The "MODE" argument is a string of option letters chosen from the
+ * list below:
+ * @example
+ * Letter Meaning
+ * r readable
+ * w writable
+ * x executable
+ * f normal file (NOT IMPLEMENTED)
+ * b block special (NOT IMPLEMENTED)
+ * c character special (NOT IMPLEMENTED)
+ * d directory (NOT IMPLEMENTED)
+ * p FIFO (pipe) (NOT IMPLEMENTED)
+ * u set user ID bit (NOT IMPLEMENTED)
+ * g set group ID bit (NOT IMPLEMENTED)
+ * k sticky bit (NOT IMPLEMENTED)
+ * s size nonzero (NOT IMPLEMENTED)
+ * @end example
+ */
+#ifndef HAVE_PATHFIND
+extern char* pathfind(char const*, char const*, char const*);
+#endif /* HAVE_PATHFIND */
+
+
+/* From: streqvcmp.c line 209
+ *
+ * strequate - map a list of characters to the same value
+ *
+ * Arguments:
+ * ch_list characters to equivalence
+ *
+ * Each character in the input string get mapped to the first character
+ * in the string.
+ * This function name is mapped to option_strequate so as to not conflict
+ * with the POSIX name space.
+ */
+extern void strequate(char const*);
+
+
+/* From: streqvcmp.c line 119
+ *
+ * streqvcmp - compare two strings with an equivalence mapping
+ *
+ * Arguments:
+ * str1 first string
+ * str2 second string
+ *
+ * Returns: int - the difference between two differing characters
+ *
+ * Using a character mapping, two strings are compared for "equivalence".
+ * Each input character is mapped to a comparison character and the
+ * mapped-to characters are compared for the two NUL terminated input strings.
+ * This function name is mapped to option_streqvcmp so as to not conflict
+ * with the POSIX name space.
+ */
+extern int streqvcmp(char const*, char const*);
+
+
+/* From: streqvcmp.c line 156
+ *
+ * streqvmap - Set the character mappings for the streqv functions
+ *
+ * Arguments:
+ * From Input character
+ * To Mapped-to character
+ * ct compare length
+ *
+ * Set the character mapping. If the count (@code{ct}) is set to zero, then
+ * the map is cleared by setting all entries in the map to their index
+ * value. Otherwise, the "@code{From}" character is mapped to the "@code{To}"
+ * character. If @code{ct} is greater than 1, then @code{From} and @code{To}
+ * are incremented and the process repeated until @code{ct} entries have been
+ * set. For example,
+ * @example
+ * streqvmap('a', 'A', 26);
+ * @end example
+ * @noindent
+ * will alter the mapping so that all English lower case letters
+ * will map to upper case.
+ *
+ * This function name is mapped to option_streqvmap so as to not conflict
+ * with the POSIX name space.
+ */
+extern void streqvmap(char, char, int);
+
+
+/* From: streqvcmp.c line 78
+ *
+ * strneqvcmp - compare two strings with an equivalence mapping
+ *
+ * Arguments:
+ * str1 first string
+ * str2 second string
+ * ct compare length
+ *
+ * Returns: int - the difference between two differing characters
+ *
+ * Using a character mapping, two strings are compared for "equivalence".
+ * Each input character is mapped to a comparison character and the
+ * mapped-to characters are compared for the two NUL terminated input strings.
+ * The comparison is limited to @code{ct} bytes.
+ * This function name is mapped to option_strneqvcmp so as to not conflict
+ * with the POSIX name space.
+ */
+extern int strneqvcmp(char const*, char const*, int);
+
+
+/* From: streqvcmp.c line 235
+ *
+ * strtransform - convert a string into its mapped-to value
+ *
+ * Arguments:
+ * dest output string
+ * src input string
+ *
+ * Each character in the input string is mapped and the mapped-to
+ * character is put into the output.
+ * This function name is mapped to option_strtransform so as to not conflict
+ * with the POSIX name space.
+ *
+ * The source and destination may be the same.
+ */
+extern void strtransform(char*, char const*);
+
+/* AutoOpts PRIVATE FUNCTIONS: */
+tOptProc optionStackArg, optionUnstackArg, optionBooleanVal, optionNumericVal;
+
+extern char* ao_string_cook(char*, int*);
+
+extern unsigned int ao_string_cook_escape_char(char const*, char*, unsigned int);
+
+extern void genshelloptUsage(tOptions*, int);
+
+extern int optionAlias(tOptions*, tOptDesc*, unsigned int);
+
+extern void optionBooleanVal(tOptions*, tOptDesc*);
+
+extern uintptr_t optionEnumerationVal(tOptions*, tOptDesc*, char const * const *, unsigned int);
+
+extern void optionFileCheck(tOptions*, tOptDesc*, teOptFileType, tuFileMode);
+
+extern char const * optionKeywordName(tOptDesc*, unsigned int);
+
+extern void optionLoadOpt(tOptions*, tOptDesc*);
+
+extern bool optionMakePath(char*, int, char const*, char const*);
+
+extern void optionNestedVal(tOptions*, tOptDesc*);
+
+extern void optionNumericVal(tOptions*, tOptDesc*);
+
+extern void optionPagedUsage(tOptions*, tOptDesc*);
+
+extern void optionParseShell(tOptions*);
+
+extern void optionPrintVersion(tOptions*, tOptDesc*);
+
+extern void optionPutShell(tOptions*);
+
+extern void optionResetOpt(tOptions*, tOptDesc*);
+
+extern void optionSetMembers(tOptions*, tOptDesc*, char const * const *, unsigned int);
+
+extern void optionShowRange(tOptions*, tOptDesc*, void *, int);
+
+extern void optionStackArg(tOptions*, tOptDesc*);
+
+extern void optionTimeDate(tOptions*, tOptDesc*);
+
+extern void optionTimeVal(tOptions*, tOptDesc*);
+
+extern void optionUnstackArg(tOptions*, tOptDesc*);
+
+extern void optionUsage(tOptions*, int);
+
+extern void optionVendorOption(tOptions *, tOptDesc *);
+
+extern void optionVersionStderr(tOptions*, tOptDesc*);
+
+extern void* text_mmap(char const*, int, int, tmap_info_t*);
+
+extern int text_munmap(tmap_info_t*);
+
+CPLUSPLUS_CLOSER
+#endif /* AUTOOPTS_OPTIONS_H_GUARD */
+/*
+ * Local Variables:
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * options.h ends here */
diff --git a/autoopts/autoopts/usage-txt.h b/autoopts/autoopts/usage-txt.h
new file mode 100644
index 0000000..0200b84
--- /dev/null
+++ b/autoopts/autoopts/usage-txt.h
@@ -0,0 +1,435 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (usage-txt.h)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:15 AM by AutoGen 5.16.2pre7
+ * From the definitions usage-txt.def
+ * and the template file usage-txt.tpl
+ *
+ * This file handles all the bookkeeping required for tracking all the little
+ * tiny strings used by the AutoOpts library. There are 146
+ * of them. This is not versioned because it is entirely internal to the
+ * library and accessed by client code only in a very well-controlled way:
+ * they may substitute translated strings using a procedure that steps through
+ * all the string pointers.
+ *
+ * Copyright (C) 1992-2012 Bruce Korb, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the
+ * GNU Lesser General Public License, version 3 or later
+ * <http://gnu.org/licenses/lgpl.html>
+ *
+ * AutoOpts is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoOpts is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.";
+ */
+#ifndef AUTOOPTS_USAGE_TXT_H_GUARD
+#define AUTOOPTS_USAGE_TXT_H_GUARD 1
+
+#undef cch_t
+#define cch_t char const
+
+/*
+ * One structure to hold all the pointers to all the stringlets.
+ */
+typedef struct {
+ int field_ct;
+ char* utpz_GnuBoolArg;
+ char* utpz_GnuKeyArg;
+ char* utpz_GnuFileArg;
+ char* utpz_GnuKeyLArg;
+ char* utpz_GnuTimeArg;
+ char* utpz_GnuNumArg;
+ char* utpz_GnuStrArg;
+ cch_t* apz_str[ 139 ];
+} usage_text_t;
+
+/*
+ * Declare the global structure with all the pointers to translated
+ * strings. This is then used by the usage generation procedure.
+ */
+extern usage_text_t option_usage_text;
+
+#if defined(AUTOOPTS_INTERNAL) /* DEFINE ALL THE STRINGS = = = = = */
+/*
+ * Provide a mapping from a short name to fields in this structure.
+ */
+#define zAO_Alloc (option_usage_text.apz_str[ 0])
+#define zAO_Bad (option_usage_text.apz_str[ 1])
+#define zAO_Big (option_usage_text.apz_str[ 2])
+#define zAO_Err (option_usage_text.apz_str[ 3])
+#define zAO_Realloc (option_usage_text.apz_str[ 4])
+#define zAO_Sml (option_usage_text.apz_str[ 5])
+#define zAO_Strdup (option_usage_text.apz_str[ 6])
+#define zAO_Ver (option_usage_text.apz_str[ 7])
+#define zAO_Woops (option_usage_text.apz_str[ 8])
+#define zAliasRange (option_usage_text.apz_str[ 9])
+#define zAll (option_usage_text.apz_str[ 10])
+#define zAlt (option_usage_text.apz_str[ 11])
+#define zAmbigKey (option_usage_text.apz_str[ 12])
+#define zAmbigList (option_usage_text.apz_str[ 13])
+#define zAmbigOptStr (option_usage_text.apz_str[ 14])
+#define zAmbiguous (option_usage_text.apz_str[ 15])
+#define zArgsMust (option_usage_text.apz_str[ 16])
+#define zAtMost (option_usage_text.apz_str[ 17])
+#define zAuto (option_usage_text.apz_str[ 18])
+#define zBadPipe (option_usage_text.apz_str[ 19])
+#define zBadVerArg (option_usage_text.apz_str[ 20])
+#define zCantFmt (option_usage_text.apz_str[ 21])
+#define zCantSave (option_usage_text.apz_str[ 22])
+#define zCfgAO_Flags (option_usage_text.apz_str[ 23])
+#define zCfgProg (option_usage_text.apz_str[ 24])
+#define zDefaultOpt (option_usage_text.apz_str[ 25])
+#define zDis (option_usage_text.apz_str[ 26])
+#define zDisabledErr (option_usage_text.apz_str[ 27])
+#define zDisabledOpt (option_usage_text.apz_str[ 28])
+#define zDisabledWhy (option_usage_text.apz_str[ 29])
+#define zEnab (option_usage_text.apz_str[ 30])
+#define zEquiv (option_usage_text.apz_str[ 31])
+#define zErrOnly (option_usage_text.apz_str[ 32])
+#define zExamineFmt (option_usage_text.apz_str[ 33])
+#define zFiveSpaces (option_usage_text.apz_str[ 34])
+#define zFlagOkay (option_usage_text.apz_str[ 35])
+#define zFmtFmt (option_usage_text.apz_str[ 36])
+#define zForkFail (option_usage_text.apz_str[ 37])
+#define zFreopenFail (option_usage_text.apz_str[ 38])
+#define zFSErrOptLoad (option_usage_text.apz_str[ 39])
+#define zFSErrReadFile (option_usage_text.apz_str[ 40])
+#define zFSOptError (option_usage_text.apz_str[ 41])
+#define zFSOptErrMayExist (option_usage_text.apz_str[ 42])
+#define zFSOptErrMustExist (option_usage_text.apz_str[ 43])
+#define zFSOptErrNoExist (option_usage_text.apz_str[ 44])
+#define zFSOptErrOpen (option_usage_text.apz_str[ 45])
+#define zFSOptErrFopen (option_usage_text.apz_str[ 46])
+#define zFileCannotExist (option_usage_text.apz_str[ 47])
+#define zFileMustExist (option_usage_text.apz_str[ 48])
+#define zGenshell (option_usage_text.apz_str[ 49])
+#define zGnuBoolArg (option_usage_text.utpz_GnuBoolArg)
+#define zGnuBreak (option_usage_text.apz_str[ 50])
+#define zGnuKeyArg (option_usage_text.utpz_GnuKeyArg)
+#define zGnuFileArg (option_usage_text.utpz_GnuFileArg)
+#define zGnuKeyLArg (option_usage_text.utpz_GnuKeyLArg)
+#define zGnuTimeArg (option_usage_text.utpz_GnuTimeArg)
+#define zGnuNestArg (option_usage_text.apz_str[ 51])
+#define zGnuNumArg (option_usage_text.utpz_GnuNumArg)
+#define zGnuOptArg (option_usage_text.apz_str[ 52])
+#define zGnuOptFmt (option_usage_text.apz_str[ 53])
+#define zGnuStrArg (option_usage_text.utpz_GnuStrArg)
+#define zIllOptChr (option_usage_text.apz_str[ 54])
+#define zIllOptStr (option_usage_text.apz_str[ 55])
+#define zIllVendOptStr (option_usage_text.apz_str[ 56])
+#define zIntRange (option_usage_text.apz_str[ 57])
+#define zInvalOptDesc (option_usage_text.apz_str[ 58])
+#define zInvalOptName (option_usage_text.apz_str[ 59])
+#define zLowerBits (option_usage_text.apz_str[ 60])
+#define zMembers (option_usage_text.apz_str[ 61])
+#define zMisArg (option_usage_text.apz_str[ 62])
+#define zMultiEquiv (option_usage_text.apz_str[ 63])
+#define zMust (option_usage_text.apz_str[ 64])
+#define zNeedOne (option_usage_text.apz_str[ 65])
+#define zNoArg (option_usage_text.apz_str[ 66])
+#define zNoArgs (option_usage_text.apz_str[ 67])
+#define zNoCreat (option_usage_text.apz_str[ 68])
+#define zNoFlags (option_usage_text.apz_str[ 69])
+#define zNoKey (option_usage_text.apz_str[ 70])
+#define zNoLim (option_usage_text.apz_str[ 71])
+#define zNoPreset (option_usage_text.apz_str[ 72])
+#define zNoResetArg (option_usage_text.apz_str[ 73])
+#define zNoRq_NoShrtTtl (option_usage_text.apz_str[ 74])
+#define zNoRq_ShrtTtl (option_usage_text.apz_str[ 75])
+#define zNoStat (option_usage_text.apz_str[ 76])
+#define zNoState (option_usage_text.apz_str[ 77])
+#define zNone (option_usage_text.apz_str[ 78])
+#define zNotDef (option_usage_text.apz_str[ 79])
+#define zNotCmdOpt (option_usage_text.apz_str[ 80])
+#define zNotEnough (option_usage_text.apz_str[ 81])
+#define zNotFile (option_usage_text.apz_str[ 82])
+#define zNotNumber (option_usage_text.apz_str[ 83])
+#define zNotDate (option_usage_text.apz_str[ 84])
+#define zNotDuration (option_usage_text.apz_str[ 85])
+#define zNrmOptFmt (option_usage_text.apz_str[ 86])
+#define zNumberOpt (option_usage_text.apz_str[ 87])
+#define zOnlyOne (option_usage_text.apz_str[ 88])
+#define zOptsOnly (option_usage_text.apz_str[ 89])
+#define zOutputFail (option_usage_text.apz_str[ 90])
+#define zPathFmt (option_usage_text.apz_str[ 91])
+#define zPlsSendBugs (option_usage_text.apz_str[ 92])
+#define zPreset (option_usage_text.apz_str[ 93])
+#define zPresetFile (option_usage_text.apz_str[ 94])
+#define zPresetIntro (option_usage_text.apz_str[ 95])
+#define zProhib (option_usage_text.apz_str[ 96])
+#define zReorder (option_usage_text.apz_str[ 97])
+#define zRange (option_usage_text.apz_str[ 98])
+#define zRangeAbove (option_usage_text.apz_str[ 99])
+#define zRangeLie (option_usage_text.apz_str[100])
+#define zRangeOnly (option_usage_text.apz_str[101])
+#define zRangeOr (option_usage_text.apz_str[102])
+#define zRangeErr (option_usage_text.apz_str[103])
+#define zRangeExact (option_usage_text.apz_str[104])
+#define zRangeScaled (option_usage_text.apz_str[105])
+#define zRangeUpto (option_usage_text.apz_str[106])
+#define zResetNotConfig (option_usage_text.apz_str[107])
+#define zReqFmt (option_usage_text.apz_str[108])
+#define zReqOptFmt (option_usage_text.apz_str[109])
+#define zReqThese (option_usage_text.apz_str[110])
+#define zReq_NoShrtTtl (option_usage_text.apz_str[111])
+#define zReq_ShrtTtl (option_usage_text.apz_str[112])
+#define zSepChars (option_usage_text.apz_str[113])
+#define zSetMemberSettings (option_usage_text.apz_str[114])
+#define zShrtGnuOptFmt (option_usage_text.apz_str[115])
+#define zSixSpaces (option_usage_text.apz_str[116])
+#define zStdBoolArg (option_usage_text.apz_str[117])
+#define zStdBreak (option_usage_text.apz_str[118])
+#define zStdFileArg (option_usage_text.apz_str[119])
+#define zStdKeyArg (option_usage_text.apz_str[120])
+#define zStdKeyLArg (option_usage_text.apz_str[121])
+#define zStdTimeArg (option_usage_text.apz_str[122])
+#define zStdNestArg (option_usage_text.apz_str[123])
+#define zStdNoArg (option_usage_text.apz_str[124])
+#define zStdNumArg (option_usage_text.apz_str[125])
+#define zStdOptArg (option_usage_text.apz_str[126])
+#define zStdReqArg (option_usage_text.apz_str[127])
+#define zStdStrArg (option_usage_text.apz_str[128])
+#define zTabHyp (option_usage_text.apz_str[129])
+#define zTabHypAnd (option_usage_text.apz_str[130])
+#define zTabout (option_usage_text.apz_str[131])
+#define zThreeSpaces (option_usage_text.apz_str[132])
+#define zTooLarge (option_usage_text.apz_str[133])
+#define zTwoSpaces (option_usage_text.apz_str[134])
+#define zUpTo (option_usage_text.apz_str[135])
+#define zValidKeys (option_usage_text.apz_str[136])
+#define zVendOptsAre (option_usage_text.apz_str[137])
+#define zVendIntro (option_usage_text.apz_str[138])
+
+ /*
+ * First, set up the strings. Some of these are writable. These are all in
+ * English. This gets compiled into libopts and is distributed here so that
+ * xgettext (or equivalents) can extract these strings for translation.
+ */
+
+ static char eng_zGnuBoolArg[] = "=T/F";
+ static char eng_zGnuKeyArg[] = "=KWd";
+ static char eng_zGnuFileArg[] = "=file";
+ static char eng_zGnuKeyLArg[] = "=Mbr";
+ static char eng_zGnuTimeArg[] = "=Tim";
+ static char eng_zGnuNumArg[] = "=num";
+ static char eng_zGnuStrArg[] = "=str";
+static char const usage_txt[4660] =
+/* 0 */ "malloc of %d bytes failed\n\0"
+/* 27 */ "AutoOpts function called without option descriptor\n\0"
+/* 79 */ "\tThis exceeds the compiled library version: \0"
+/* 125 */ "Automated Options Processing Error!\n"
+ "\t%s called AutoOpts function with structure version %d:%d:%d.\n\0"
+/* 224 */ "realloc of %d bytes at 0x%p failed\n\0"
+/* 260 */ "\tThis is less than the minimum library version: \0"
+/* 310 */ "strdup of %d byte string failed\n\0"
+/* 343 */ "Automated Options version %s\n"
+ "\tcopyright (c) 1999-2012 by Bruce Korb - all rights reserved\n\0"
+/* 434 */ "AutoOpts lib error: defaulted to option with optional arg\n\0"
+/* 493 */ "(AutoOpts bug): Aliasing option is out of range.\0"
+/* 543 */ "all\0"
+/* 547 */ "\t\t\t\t- an alternate for %s\n\0"
+/* 574 */ "%s error: the keyword `%s' is ambiguous for %s\n\0"
+/* 623 */ " The following options match:\n\0"
+/* 655 */ "%s: ambiguous option name: %s (matches %d options)\n\0"
+/* 707 */ " %s%s\n\0"
+/* 715 */ "%s: Command line arguments required\n\0"
+/* 752 */ "%d %s%s options allowed\n\0"
+/* 777 */ "version, usage and configuration options:\0"
+/* 819 */ "Error %d (%s) from the pipe(2) syscall\n\0"
+/* 859 */ "ERROR: version option argument '%c' invalid. Use:\n"
+ "\t'v' - version only\n"
+ "\t'c' - version and copyright\n"
+ "\t'n' - version and copyright notice\n\0"
+/* 996 */ "ERROR: %s option conflicts with the %s option\n\0"
+/* 1044 */ "%s(optionSaveState): error: cannot allocate %d bytes\n\0"
+/* 1098 */ "auto-options\0"
+/* 1111 */ "program\0"
+/* 1119 */ "\t\t\t\t- default option for unnamed options\n\0"
+/* 1161 */ "\t\t\t\t- disabled as --%s\n\0"
+/* 1185 */ "%s: The ``%s'' option has been disabled\0"
+/* 1225 */ " --- %-14s %s\n\0"
+/* 1240 */ "This option has been disabled\0"
+/* 1270 */ "\t\t\t\t- enabled by default\n\0"
+/* 1296 */ "-equivalence\0"
+/* 1309 */ "ERROR: only \0"
+/* 1323 */ " - examining environment variables named %s_*\n\0"
+/* 1370 */ " \0"
+/* 1376 */ "Options are specified by doubled hyphens and their name or by a single\n"
+ "hyphen and the flag character.\n\0"
+/* 1479 */ "%%-%ds %%s\n\0"
+/* 1491 */ "fs error %d (%s) on fork - cannot obtain %s usage\n\0"
+/* 1542 */ "fs error %d (%s) on freopen\n\0"
+/* 1571 */ "File error %d (%s) opening %s for loading options\n\0"
+/* 1622 */ "fs error %d (%s) reading file %s\n\0"
+/* 1656 */ "fs error %d (%s) on %s %s for option %s\n\0"
+/* 1697 */ "stat-ing for directory\0"
+/* 1720 */ "stat-ing for regular file\0"
+/* 1746 */ "stat-ing for non-existant file\0"
+/* 1777 */ "open-ing file\0"
+/* 1791 */ "fopen-ing file\0"
+/* 1806 */ "\t\t\t\t- file must not pre-exist\n\0"
+/* 1837 */ "\t\t\t\t- file must pre-exist\n\0"
+/* 1864 */ "\n"
+ "= = = = = = = =\n\n"
+ "This incarnation of genshell will produce\n"
+ "a shell script to parse the options for %s:\n\n\0"
+/* 1970 */ "\n"
+ "%s\n\n\0"
+/* 1976 */ "=Cplx\0"
+/* 1982 */ "[=arg]\0"
+/* 1989 */ "--%2$s%1$s\0"
+/* 2000 */ "%s: illegal option -- %c\n\0"
+/* 2026 */ "%s: illegal option -- %s\n\0"
+/* 2052 */ "%s: unknown vendor extension option -- %s\n\0"
+/* 2095 */ " or an integer from %d through %d\n\0"
+/* 2131 */ "AutoOpts ERROR: invalid option descriptor for %s\n\0"
+/* 2182 */ "%s: invalid option name: %s\n\0"
+/* 2211 */ " or an integer mask with any of the lower %d bits set\n\0"
+/* 2267 */ "\t\t\t\t- is a set membership option\n\0"
+/* 2301 */ "%s: option `%s' requires an argument\n\0"
+/* 2339 */ "Equivalenced option '%s' was equivalenced to both\n"
+ "\t'%s' and '%s'\0"
+/* 2404 */ "\t\t\t\t- must appear between %d and %d times\n\0"
+/* 2447 */ "ERROR: The %s option is required\n\0"
+/* 2482 */ "%s: option `%s' cannot have an argument\n\0"
+/* 2523 */ "%s: Command line arguments not allowed\n\0"
+/* 2563 */ "error %d (%s) creating %s\n\0"
+/* 2590 */ "Options are specified by single or double hyphens and their name.\n\0"
+/* 2657 */ "%s error: `%s' does not match any %s keywords\n\0"
+/* 2705 */ "\t\t\t\t- may appear multiple times\n\0"
+/* 2738 */ "\t\t\t\t- may not be preset\n\0"
+/* 2763 */ "The 'reset-option' option requires an argument\n\0"
+/* 2811 */ " Arg Option-Name Description\n\0"
+/* 2846 */ " Flg Arg Option-Name Description\n\0"
+/* 2884 */ "error %d (%s) stat-ing %s\n\0"
+/* 2911 */ "%s(optionRestore): error: no saved option state\n\0"
+/* 2960 */ "none\0"
+/* 2965 */ "'%s' not defined\n\0"
+/* 2983 */ "'%s' is not a command line option\n\0"
+/* 3018 */ "ERROR: The %s option must appear %d times\n\0"
+/* 3062 */ "error: cannot load options from non-regular file %s\n\0"
+/* 3116 */ "%s error: `%s' is not a recognizable number\n\0"
+/* 3162 */ "%s error: `%s' is not a recognizable date/time\n\0"
+/* 3211 */ "%s error: `%s' is not a recognizable time duration\n\0"
+/* 3264 */ " %3s %s\0"
+/* 3272 */ "The '-#<number>' option may omit the hash char\n\0"
+/* 3320 */ "one %s%s option allowed\n\0"
+/* 3345 */ "All arguments are named options.\n\0"
+/* 3379 */ "Write failure to output file\0"
+/* 3408 */ " - reading file %s\0"
+/* 3427 */ "\n"
+ "please send bug reports to: %s\n\0"
+/* 3461 */ "\t\t\t\t- may NOT appear - preset only\n\0"
+/* 3497 */ "# preset/initialization file\n"
+ "# %s#\n\0"
+/* 3535 */ "\n"
+ "The following option preset mechanisms are supported:\n\0"
+/* 3591 */ "prohibits these options:\n\0"
+/* 3617 */ "Operands and options may be intermixed. They will be reordered.\n\0"
+/* 3683 */ "%s%ld to %ld\0"
+/* 3696 */ "%sgreater than or equal to %ld\0"
+/* 3727 */ "%sIt must lie in one of the ranges:\n\0"
+/* 3764 */ "%sIt must be in the range:\n\0"
+/* 3792 */ ", or\n\0"
+/* 3798 */ "%s error: %s option value %ld is out of range.\n\0"
+/* 3847 */ "%s%ld exactly\0"
+/* 3861 */ "%sis scalable with a suffix: k/K/m/M/g/G/t/T\n\0"
+/* 3907 */ "%sless than or equal to %ld\0"
+/* 3935 */ "The --reset-option has not been configured.\n\0"
+/* 3980 */ "ERROR: %s option requires the %s option\n\0"
+/* 4022 */ " %3s %-14s %s\0"
+/* 4036 */ "requires these options:\n\0"
+/* 4061 */ " Arg Option-Name Req? Description\n\0"
+/* 4101 */ " Flg Arg Option-Name Req? Description\n\0"
+/* 4144 */ "-_^\0"
+/* 4148 */ "or you may use a numeric representation. Preceding these with a '!' will\n"
+ "clear the bits, specifying 'none' will clear all bits, and 'all' will set them\n"
+ "all. Multiple entries may be passed as an option argument list.\n\0"
+/* 4367 */ "%s\0"
+/* 4370 */ " \0"
+/* 4377 */ "T/F\0"
+/* 4381 */ "\n"
+ "%s\n\n"
+ "%s\0"
+/* 4389 */ "Fil\0"
+/* 4393 */ "KWd\0"
+/* 4397 */ "Mbr\0"
+/* 4401 */ "Tim\0"
+/* 4405 */ "Cpx\0"
+/* 4409 */ "no \0"
+/* 4413 */ "Num\0"
+/* 4417 */ "opt\0"
+/* 4421 */ "YES\0"
+/* 4425 */ "Str\0"
+/* 4429 */ "\t\t\t\t- \0"
+/* 4436 */ "\t\t\t\t-- and \0"
+/* 4448 */ "\t\t\t\t%s\n\0"
+/* 4456 */ " \0"
+/* 4460 */ "%s error: %s exceeds %s keyword count\n\0"
+/* 4500 */ " \0"
+/* 4503 */ "\t\t\t\t- may appear up to %d times\n\0"
+/* 4536 */ "The valid \"%s\" option keywords are:\n\0"
+/* 4573 */ "These additional options are:\0"
+/* 4603 */ "The next option supports vendor supported extra options:";
+
+
+ /*
+ * Now, define (and initialize) the structure that contains
+ * the pointers to all these strings.
+ * Aren't you glad you don't maintain this by hand?
+ */
+ usage_text_t option_usage_text = {
+ 146,
+ eng_zGnuBoolArg, eng_zGnuKeyArg, eng_zGnuFileArg, eng_zGnuKeyLArg,
+ eng_zGnuTimeArg, eng_zGnuNumArg, eng_zGnuStrArg,
+ {
+ usage_txt + 0, usage_txt + 27, usage_txt + 79, usage_txt + 125,
+ usage_txt + 224, usage_txt + 260, usage_txt + 310, usage_txt + 343,
+ usage_txt + 434, usage_txt + 493, usage_txt + 543, usage_txt + 547,
+ usage_txt + 574, usage_txt + 623, usage_txt + 655, usage_txt + 707,
+ usage_txt + 715, usage_txt + 752, usage_txt + 777, usage_txt + 819,
+ usage_txt + 859, usage_txt + 996, usage_txt +1044, usage_txt +1098,
+ usage_txt +1111, usage_txt +1119, usage_txt +1161, usage_txt +1185,
+ usage_txt +1225, usage_txt +1240, usage_txt +1270, usage_txt +1296,
+ usage_txt +1309, usage_txt +1323, usage_txt +1370, usage_txt +1376,
+ usage_txt +1479, usage_txt +1491, usage_txt +1542, usage_txt +1571,
+ usage_txt +1622, usage_txt +1656, usage_txt +1697, usage_txt +1720,
+ usage_txt +1746, usage_txt +1777, usage_txt +1791, usage_txt +1806,
+ usage_txt +1837, usage_txt +1864, usage_txt +1970, usage_txt +1976,
+ usage_txt +1982, usage_txt +1989, usage_txt +2000, usage_txt +2026,
+ usage_txt +2052, usage_txt +2095, usage_txt +2131, usage_txt +2182,
+ usage_txt +2211, usage_txt +2267, usage_txt +2301, usage_txt +2339,
+ usage_txt +2404, usage_txt +2447, usage_txt +2482, usage_txt +2523,
+ usage_txt +2563, usage_txt +2590, usage_txt +2657, usage_txt +2705,
+ usage_txt +2738, usage_txt +2763, usage_txt +2811, usage_txt +2846,
+ usage_txt +2884, usage_txt +2911, usage_txt +2960, usage_txt +2965,
+ usage_txt +2983, usage_txt +3018, usage_txt +3062, usage_txt +3116,
+ usage_txt +3162, usage_txt +3211, usage_txt +3264, usage_txt +3272,
+ usage_txt +3320, usage_txt +3345, usage_txt +3379, usage_txt +3408,
+ usage_txt +3427, usage_txt +3461, usage_txt +3497, usage_txt +3535,
+ usage_txt +3591, usage_txt +3617, usage_txt +3683, usage_txt +3696,
+ usage_txt +3727, usage_txt +3764, usage_txt +3792, usage_txt +3798,
+ usage_txt +3847, usage_txt +3861, usage_txt +3907, usage_txt +3935,
+ usage_txt +3980, usage_txt +4022, usage_txt +4036, usage_txt +4061,
+ usage_txt +4101, usage_txt +4144, usage_txt +4148, usage_txt +4367,
+ usage_txt +4370, usage_txt +4377, usage_txt +4381, usage_txt +4389,
+ usage_txt +4393, usage_txt +4397, usage_txt +4401, usage_txt +4405,
+ usage_txt +4409, usage_txt +4413, usage_txt +4417, usage_txt +4421,
+ usage_txt +4425, usage_txt +4429, usage_txt +4436, usage_txt +4448,
+ usage_txt +4456, usage_txt +4460, usage_txt +4500, usage_txt +4503,
+ usage_txt +4536, usage_txt +4573, usage_txt +4603
+ }
+ };
+
+#endif /* DO_TRANSLATIONS */
+#endif /* AUTOOPTS_USAGE_TXT_H_GUARD */
diff --git a/autoopts/boolean.c b/autoopts/boolean.c
new file mode 100644
index 0000000..c463778
--- /dev/null
+++ b/autoopts/boolean.c
@@ -0,0 +1,97 @@
+
+/**
+ * \file boolean.c
+ *
+ * Time-stamp: "2012-08-11 08:34:39 bkorb"
+ *
+ * Automated Options Paged Usage module.
+ *
+ * This routine will run run-on options through a pager so the
+ * user may examine, print or edit them at their leisure.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/*=export_func optionBooleanVal
+ * private:
+ *
+ * what: Decipher a boolean value
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ *
+ * doc:
+ * Decipher a true or false value for a boolean valued option argument.
+ * The value is true, unless it starts with 'n' or 'f' or "#f" or
+ * it is an empty string or it is a number that evaluates to zero.
+=*/
+void
+optionBooleanVal(tOptions * pOpts, tOptDesc * pOD )
+{
+ char* pz;
+ bool res = true;
+
+ (void)pOpts;
+
+ if (pOpts <= OPTPROC_EMIT_LIMIT)
+ return;
+
+ if ((pOD->fOptState & OPTST_RESET) != 0)
+ return;
+
+ if (pOD->optArg.argString == NULL) {
+ pOD->optArg.argBool = false;
+ return;
+ }
+
+ switch (*(pOD->optArg.argString)) {
+ case '0':
+ {
+ long val = strtol( pOD->optArg.argString, &pz, 0 );
+ if ((val != 0) || (*pz != NUL))
+ break;
+ /* FALLTHROUGH */
+ }
+ case 'N':
+ case 'n':
+ case 'F':
+ case 'f':
+ case NUL:
+ res = false;
+ break;
+ case '#':
+ if (pOD->optArg.argString[1] != 'f')
+ break;
+ res = false;
+ }
+
+ if (pOD->fOptState & OPTST_ALLOC_ARG) {
+ AGFREE(pOD->optArg.argString);
+ pOD->fOptState &= ~OPTST_ALLOC_ARG;
+ }
+ pOD->optArg.argBool = res;
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/boolean.c */
diff --git a/autoopts/bootstrap.dir b/autoopts/bootstrap.dir
new file mode 100644
index 0000000..d86a9aa
--- /dev/null
+++ b/autoopts/bootstrap.dir
@@ -0,0 +1,232 @@
+#! /bin/echo This_file_must_be_sourced,_not_executed
+# Time-stamp: "2012-04-14 14:12:20 bkorb"
+#
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+
+burn_aover() {
+ agvars=$(egrep '^A[GO]_' ../VERSION)
+ eval "${agvars}"
+ vers_curr=$(expr '(' $AO_CURRENT '*' 4096 ')' + $AO_REVISION)
+
+ cd tpl
+ for f in *.sh *.pl
+ do g=${f%.sh} ; g=${g%.pl}
+ cat $f > $g
+ chmod +x $g
+ done
+ cd -
+}
+
+add_files_to_mf() {
+ # Regenerate the "genshell.h" 'cuz we just altered the template to
+ # contain the header version number.
+ #
+ ${AGexe} -Tagman3.tpl funcs.def || \
+ die "FAILED: ${AGexe} -Tagman3.tpl funcs.def"
+
+ local tmpl=$(
+ ndst=""
+ sfil=''
+
+ for f in man mdoc texi
+ do
+ for g in man mdoc texi
+ do
+ sfil=${sfil}tpl/${f}2${g}${nl}
+ test -f tpl/${f}2${g}.sh || \
+ ndst=${ndst}tpl/${f}2${g}${nl}
+ done
+ done
+
+ pdta="autoopts.m4${nl}tpl/usage.tlib${nl}"
+ edta="bootstrap.dir${nl}autoopts-config.in${nl}autogen.map${nl}"
+ edta="${edta}mk-tpl-config.sh${nl}mk-autoopts-pc.in${nl}"
+ edta="${edta}install-hook.sh${nl}po${nl}tpl/usage-txt.tpl${nl}"
+
+ for f in tpl/*.*
+ do
+ case $f in
+ ( *.in | *.pl | *.sh )
+ g=$(echo $f | sed 's/\...$//;s/-tlib$/.tlib/')
+ ndst=${ndst}${g}${nl} # installed file
+ edta=${edta}${f}${nl} # distributed file
+ ;;
+
+ ( *tpl-config.tlib | *tpl/usage* ) : ;;
+
+ ( *.tlib | *.tpl | *.def | *.lic )
+ pdta=${pdta}${f}${nl} ;; # installed & distributed file
+ esac
+ done
+
+ echo "local ndst='${ndst%${nl}}'"
+ echo "local pdta='${pdta%${nl}}'"
+ echo "local edta='${edta%${nl}}'"
+ echo "local sfil='${sfil%${nl}}'"
+ )
+
+ eval "$tmpl"
+
+ {
+ ls -1 *.3 | \
+ sed '/^pathfind.3$/d' | \
+ columns -I4 --spread=1 --line=' \'
+
+ printf '\nnodist_pkgdata_DATA = $(libsrc) \\\n'
+ echo "${ndst}" | sort -u | columns -I4 --spread=1 --line=' \'
+
+ printf '\npkgdata_DATA = \\\n'
+ echo "${pdta}" | sort -u | columns -I4 --spread=1 --line=' \'
+
+ printf '\nEXTRA_DATA = $(pkgdata_DATA) \\\n'
+ echo "${edta}" | sort -u | columns -I4 --spread=1 --line=' \'
+
+ printf '\nGENSCRIPTS = $(srcdir)/funcs.def \\\n'
+ echo "${sfil}" | columns -I4 --spread=1 --line=' \'
+ echo
+
+ sed -n '/^## begin/,/^## end/{
+ s/^##.*//
+ /^$/d
+ p
+ }' gnulib.mk
+
+ } > Makefile.lists
+
+ sed '/^GENMAN /r Makefile.lists' Makefile.am > Makefile.tmp
+ mv -f Makefile.tmp Makefile.am
+
+ rm -f Makefile.lists gnulib.mk *.3
+}
+
+make_funcs_def()
+{
+ $noag && exit 1
+ s2enum=`which mk-str2enum` 2>/dev/null || :
+ test -x "${s2enum}" || \
+ s2enum="bash ${top_srcdir}/add-on/char-mapper/mk-str2enum.sh"
+
+ ${char_mapper:-char-mapper} autogen.map || die "FAILED: char-mapper"
+ ${AGexe} ao-strs.def || die "cannot make strings - exited $?"
+
+ ${s2enum} --base-name=xat-attribute -n \
+ type words members cooked uncooked keep || \
+ die "FAILED: ${s2enum} --base-name=xat-attribute"
+
+ ${s2enum} --base-name=value-type --prefix=vtp -n string integer \
+ boolean bool keyword set set-membership nested hierarchy || \
+ die "FAILED: ${s2enum} --base-name=value-type"
+ burn_aover
+
+ test -d autoopts || mkdir autoopts
+ test -d po || mkdir po
+ ${AGexe} genshell.def || \
+ die "FAILED: ${AGexe} genshell.def"
+ ${AGexe} usage-txt.def || \
+ die "FAILED: ${AGexe} usage-txt.def"
+ mv usage-txt.h autoopts/.
+ mv usage-txt.pot po/.
+
+ files=$(sed -n '/^CSRC/,/\.c$/p' Makefile.am | \
+ sed '/^CSRC/d;s/[=\\]//'
+ echo ../compat/pathfind.c)
+ getdefs linenum srcfile template=options_h output=funcs.def $files
+ chmod u+w funcs.def
+ vers_min=$( expr '(' $AO_CURRENT - $AO_AGE ')' '*' 4096)
+ cat >> funcs.def <<- _END_VERS_INFO_
+ vers-curr = "${vers_curr}";
+ vers-min = "${vers_min}";
+ vers-min-str = "$(expr $AO_CURRENT - $AO_AGE):0:0";
+ vers-sovers = "${AO_SOVERS}";
+ library = opts;
+
+ /*
+ * THIS FILE IS DISTRIBUTED
+ *
+ * This file is used to construct options.h + doc files. Because it is
+ * such a nuisance to get the build ordering correct, we distribute
+ * this. It should be constructed after all binaries are built.
+ */
+ _END_VERS_INFO_
+ ${AGexe} funcs.def || die "FAILED: ${AGexe} funcs.def"
+ test -f options.h || die "options.h not created"
+ mv options.h autoopts/.
+ cp project.h autoopts/.
+ add_files_to_mf
+ make_proto
+
+ ${AGexe} aoconf.def || die "FAILED: ${AGexe} aoconf.def"
+}
+
+test "X${mainpid}" = X && {
+ \cd ${top_srcdir-..}
+ top_srcdir=`pwd`
+ . config/bootstrap.shlib
+ cd autoopts
+ free_trap=true
+} || {
+ free_trap=false
+}
+
+export AGexe=${AGexe-autogen}\ -L${top_srcdir}/autoopts/tpl
+noag=`${AGexe} -v > /dev/null 2>&1 && echo false || echo true`
+nl=$'\n'
+
+case "$1" in
+*genshell.c )
+ if ${noag}
+ then
+ test -f ${top_srcdir}/autoopts/genshell.c || \
+ die "No autogen for building genshell.c"
+ else
+ ${AGexe} genshell.def || \
+ die "FAILED: ${AGexe} genshell.def"
+ fi
+ ;;
+
+*libopts.texi )
+ if ${noag}
+ then
+ test -f ${top_srcdir}/autoopts/libopts.texi || \
+ die "No autogen for building libopts.texi"
+ else
+ agopts='-Taginfo3.tpl -DLEVEL=subsection -blibopts funcs.def'
+ ${AGexe} ${agopts} || \
+ die "FAILED: ${AGexe} ${agopts}"
+ fi
+ ;;
+
+aoconf )
+ make_funcs_def
+ ;;
+esac
+
+${free_trap} && trap '' 0
+true
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:4
+# sh-basic-offset:4
+# indent-tabs-mode: nil
+# End:
+
+# bootstrap.dir ends here
diff --git a/autoopts/check.c b/autoopts/check.c
new file mode 100644
index 0000000..019a235
--- /dev/null
+++ b/autoopts/check.c
@@ -0,0 +1,166 @@
+/**
+ * @file check.c
+ *
+ * @brief consistency checks.
+ *
+ * Time-stamp: "2012-03-31 13:46:35 bkorb"
+ *
+ * This file contains the routines that deal with processing quoted strings
+ * into an internal format.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/**
+ * Check for conflicts based on "must" and "cannot" attributes.
+ */
+static bool
+has_conflict(tOptions * pOpts, tOptDesc * pOD)
+{
+ if (pOD->pOptMust != NULL) {
+ int const * pMust = pOD->pOptMust;
+
+ while (*pMust != NO_EQUIVALENT) {
+ tOptDesc * p = pOpts->pOptDesc + *(pMust++);
+ if (UNUSED_OPT(p)) {
+ const tOptDesc * pN = pOpts->pOptDesc + pMust[-1];
+ fprintf(stderr, zReqFmt, pOD->pz_Name, pN->pz_Name);
+ return true;
+ }
+ }
+ }
+
+ if (pOD->pOptCant != NULL) {
+ int const * pCant = pOD->pOptCant;
+
+ while (*pCant != NO_EQUIVALENT) {
+ tOptDesc * p = pOpts->pOptDesc + *(pCant++);
+ if (SELECTED_OPT(p)) {
+ const tOptDesc* pN = pOpts->pOptDesc + pCant[-1];
+ fprintf(stderr, zCantFmt, pOD->pz_Name, pN->pz_Name);
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+/**
+ * Check that the option occurs often enough. Too often is already checked.
+ */
+static bool
+occurs_enough(tOptions * pOpts, tOptDesc * pOD)
+{
+ (void)pOpts;
+
+ /*
+ * IF the occurrence counts have been satisfied,
+ * THEN there is no problem.
+ */
+ if (pOD->optOccCt >= pOD->optMinCt)
+ return true;
+
+ /*
+ * IF MUST_SET means SET and PRESET are okay,
+ * so min occurrence count doesn't count
+ */
+ if ( (pOD->fOptState & OPTST_MUST_SET)
+ && (pOD->fOptState & (OPTST_PRESET | OPTST_SET)) )
+ return true;
+
+ if (pOD->optMinCt > 1)
+ fprintf(stderr, zNotEnough, pOD->pz_Name, pOD->optMinCt);
+ else fprintf(stderr, zNeedOne, pOD->pz_Name);
+ return false;
+}
+
+/**
+ * Verify option consistency.
+ *
+ * Make sure that the argument list passes our consistency tests.
+ */
+LOCAL bool
+is_consistent(tOptions * pOpts)
+{
+ tOptDesc * pOD = pOpts->pOptDesc;
+ int oCt = pOpts->presetOptCt;
+
+ /*
+ * FOR each of "oCt" options, ...
+ */
+ for (;;) {
+ /*
+ * IF the current option was provided on the command line
+ * THEN ensure that any "MUST" requirements are not
+ * "DEFAULT" (unspecified) *AND* ensure that any
+ * "CANT" options have not been SET or DEFINED.
+ */
+ if (SELECTED_OPT(pOD)) {
+ if (has_conflict(pOpts, pOD))
+ return false;
+ }
+
+ /*
+ * IF this option is not equivalenced to another,
+ * OR it is equivalenced to itself (is the equiv. root)
+ * THEN we need to make sure it occurs often enough.
+ */
+ if ( (pOD->optEquivIndex == NO_EQUIVALENT)
+ || (pOD->optEquivIndex == pOD->optIndex) )
+
+ if (! occurs_enough(pOpts, pOD))
+ return false;
+
+ if (--oCt <= 0)
+ break;
+ pOD++;
+ }
+
+ /*
+ * IF we are stopping on errors, check to see if any remaining
+ * arguments are required to be there or prohibited from being there.
+ */
+ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) {
+
+ /*
+ * Check for prohibition
+ */
+ if ((pOpts->fOptSet & OPTPROC_NO_ARGS) != 0) {
+ if (pOpts->origArgCt > pOpts->curOptIdx) {
+ fprintf(stderr, zNoArgs, pOpts->pzProgName);
+ return false;
+ }
+ }
+
+ /*
+ * ELSE not prohibited, check for being required
+ */
+ else if ((pOpts->fOptSet & OPTPROC_ARGS_REQ) != 0) {
+ if (pOpts->origArgCt <= pOpts->curOptIdx) {
+ fprintf(stderr, zArgsMust, pOpts->pzProgName);
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
diff --git a/autoopts/configFileLoad.3 b/autoopts/configFileLoad.3
new file mode 100644
index 0000000..83c3d7e
--- /dev/null
+++ b/autoopts/configFileLoad.3
@@ -0,0 +1,50 @@
+.TH configFileLoad 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (configFileLoad.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+configFileLoad - parse a configuration file
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+const tOptionValue* \fBconfigFileLoad\fP(char const* \fIpzFile\fP);
+.sp 1
+.SH DESCRIPTION
+This routine will load a named configuration file and parse the
+text as a hierarchically valued option. The option descriptor
+created from an option definition file is not used via this interface.
+The returned value is "named" with the input file name and is of
+type "\fBOPARG_TYPE_HIERARCHY\fP". It may be used in calls to
+\fBoptionGetValue()\fP, \fBoptionNextValue()\fP and
+\fBoptionUnloadNested()\fP.
+.TP
+.IR pzFile
+the file to load
+.sp 1
+.SH RETURN VALUE
+An allocated, compound value structure
+.sp 1
+.SH ERRORS
+If the file cannot be loaded or processed, \fBNULL\fP is returned and
+\fBerrno\fP is set. It may be set by a call to either \fBopen(2)\fP
+\fBmmap(2)\fP or other file system calls, or it may be:
+.sp 1ize @bullet
+.sp 1
+\fBENOENT\fP \- the file was not found.
+.sp 1
+\fBENOMSG\fP \- the file was empty.
+.sp 1
+\fBEINVAL\fP \- the file contents are invalid \-- not properly formed.
+.sp 1
+\fBENOMEM\fP \- not enough memory to allocate the needed structures.
+@end itemize
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/configfile.c b/autoopts/configfile.c
new file mode 100644
index 0000000..3f98e31
--- /dev/null
+++ b/autoopts/configfile.c
@@ -0,0 +1,1433 @@
+/**
+ * \file configfile.c
+ *
+ * Time-stamp: "2012-08-11 08:34:55 bkorb"
+ *
+ * configuration/rc/ini file handling.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+file_preset(tOptions * opts, char const * fname, int dir);
+
+static char*
+handle_comment(char* pzText);
+
+static char *
+handle_cfg(tOptions * pOpts, tOptState * pOS, char * pzText, int dir);
+
+static char *
+handle_directive(tOptions * pOpts, char * pzText);
+
+static char *
+aoflags_directive(tOptions * pOpts, char * pzText);
+
+static char *
+program_directive(tOptions * pOpts, char * pzText);
+
+static char *
+handle_section(tOptions * pOpts, char * pzText);
+
+static int
+parse_xml_encoding(char ** ppz);
+
+static char *
+trim_xml_text(char * intxt, char const * pznm, tOptionLoadMode mode);
+
+static void
+cook_xml_text(char * pzData);
+
+static char *
+handle_struct(tOptions * pOpts, tOptState * pOS, char * pzText, int dir);
+
+static char*
+parse_keyword(tOptions * pOpts, char * pzText, tOptionValue * pType);
+
+static char*
+parse_set_mem(tOptions * pOpts, char * pzText, tOptionValue * pType);
+
+static char *
+parse_value(char * pzText, tOptionValue * pType);
+
+static char *
+skip_unkn(char* pzText);
+/* = = = END-STATIC-FORWARD = = = */
+
+
+/*=export_func configFileLoad
+ *
+ * what: parse a configuration file
+ * arg: + char const* + pzFile + the file to load +
+ *
+ * ret_type: const tOptionValue*
+ * ret_desc: An allocated, compound value structure
+ *
+ * doc:
+ * This routine will load a named configuration file and parse the
+ * text as a hierarchically valued option. The option descriptor
+ * created from an option definition file is not used via this interface.
+ * The returned value is "named" with the input file name and is of
+ * type "@code{OPARG_TYPE_HIERARCHY}". It may be used in calls to
+ * @code{optionGetValue()}, @code{optionNextValue()} and
+ * @code{optionUnloadNested()}.
+ *
+ * err:
+ * If the file cannot be loaded or processed, @code{NULL} is returned and
+ * @var{errno} is set. It may be set by a call to either @code{open(2)}
+ * @code{mmap(2)} or other file system calls, or it may be:
+ * @itemize @bullet
+ * @item
+ * @code{ENOENT} - the file was not found.
+ * @item
+ * @code{ENOMSG} - the file was empty.
+ * @item
+ * @code{EINVAL} - the file contents are invalid -- not properly formed.
+ * @item
+ * @code{ENOMEM} - not enough memory to allocate the needed structures.
+ * @end itemize
+=*/
+const tOptionValue*
+configFileLoad(char const* pzFile)
+{
+ tmap_info_t cfgfile;
+ tOptionValue* pRes = NULL;
+ tOptionLoadMode save_mode = option_load_mode;
+
+ char* pzText =
+ text_mmap(pzFile, PROT_READ, MAP_PRIVATE, &cfgfile);
+
+ if (TEXT_MMAP_FAILED_ADDR(pzText))
+ return NULL; /* errno is set */
+
+ option_load_mode = OPTION_LOAD_COOKED;
+ pRes = optionLoadNested(pzText, pzFile, strlen(pzFile));
+
+ if (pRes == NULL) {
+ int err = errno;
+ text_munmap(&cfgfile);
+ errno = err;
+ } else
+ text_munmap(&cfgfile);
+
+ option_load_mode = save_mode;
+ return pRes;
+}
+
+
+/*=export_func optionFindValue
+ *
+ * what: find a hierarcicaly valued option instance
+ * arg: + const tOptDesc* + pOptDesc + an option with a nested arg type +
+ * arg: + char const* + name + name of value to find +
+ * arg: + char const* + value + the matching value +
+ *
+ * ret_type: const tOptionValue*
+ * ret_desc: a compound value structure
+ *
+ * doc:
+ * This routine will find an entry in a nested value option or configurable.
+ * It will search through the list and return a matching entry.
+ *
+ * err:
+ * The returned result is NULL and errno is set:
+ * @itemize @bullet
+ * @item
+ * @code{EINVAL} - the @code{pOptValue} does not point to a valid
+ * hierarchical option value.
+ * @item
+ * @code{ENOENT} - no entry matched the given name.
+ * @end itemize
+=*/
+const tOptionValue*
+optionFindValue(const tOptDesc* pOptDesc, char const* pzName,
+ char const* pzVal)
+{
+ const tOptionValue* pRes = NULL;
+
+ if ( (pOptDesc == NULL)
+ || (OPTST_GET_ARGTYPE(pOptDesc->fOptState) != OPARG_TYPE_HIERARCHY)) {
+ errno = EINVAL;
+ }
+
+ else if (pOptDesc->optCookie == NULL) {
+ errno = ENOENT;
+ }
+
+ else do {
+ tArgList* pAL = pOptDesc->optCookie;
+ int ct = pAL->useCt;
+ void** ppOV = (void**)(pAL->apzArgs);
+
+ if (ct == 0) {
+ errno = ENOENT;
+ break;
+ }
+
+ if (pzName == NULL) {
+ pRes = (tOptionValue*)*ppOV;
+ break;
+ }
+
+ while (--ct >= 0) {
+ const tOptionValue* pOV = *(ppOV++);
+ const tOptionValue* pRV = optionGetValue(pOV, pzName);
+
+ if (pRV == NULL)
+ continue;
+
+ if (pzVal == NULL) {
+ pRes = pOV;
+ break;
+ }
+ }
+ if (pRes == NULL)
+ errno = ENOENT;
+ } while (false);
+
+ return pRes;
+}
+
+
+/*=export_func optionFindNextValue
+ *
+ * FIXME: the handling of 'pzName' and 'pzVal' is just wrong.
+ *
+ * what: find a hierarcicaly valued option instance
+ * arg: + const tOptDesc* + pOptDesc + an option with a nested arg type +
+ * arg: + const tOptionValue* + pPrevVal + the last entry +
+ * arg: + char const* + name + name of value to find +
+ * arg: + char const* + value + the matching value +
+ *
+ * ret_type: const tOptionValue*
+ * ret_desc: a compound value structure
+ *
+ * doc:
+ * This routine will find the next entry in a nested value option or
+ * configurable. It will search through the list and return the next entry
+ * that matches the criteria.
+ *
+ * err:
+ * The returned result is NULL and errno is set:
+ * @itemize @bullet
+ * @item
+ * @code{EINVAL} - the @code{pOptValue} does not point to a valid
+ * hierarchical option value.
+ * @item
+ * @code{ENOENT} - no entry matched the given name.
+ * @end itemize
+=*/
+tOptionValue const *
+optionFindNextValue(const tOptDesc * pOptDesc, const tOptionValue * pPrevVal,
+ char const * pzName, char const * pzVal)
+{
+ bool old_found = false;
+ tOptionValue* pRes = NULL;
+
+ (void)pzName;
+ (void)pzVal;
+
+ if ( (pOptDesc == NULL)
+ || (OPTST_GET_ARGTYPE(pOptDesc->fOptState) != OPARG_TYPE_HIERARCHY)) {
+ errno = EINVAL;
+ }
+
+ else if (pOptDesc->optCookie == NULL) {
+ errno = ENOENT;
+ }
+
+ else do {
+ tArgList* pAL = pOptDesc->optCookie;
+ int ct = pAL->useCt;
+ void** ppOV = (void**)pAL->apzArgs;
+
+ while (--ct >= 0) {
+ tOptionValue* pOV = *(ppOV++);
+ if (old_found) {
+ pRes = pOV;
+ break;
+ }
+ if (pOV == pPrevVal)
+ old_found = true;
+ }
+ if (pRes == NULL)
+ errno = ENOENT;
+ } while (false);
+
+ return pRes;
+}
+
+
+/*=export_func optionGetValue
+ *
+ * what: get a specific value from a hierarcical list
+ * arg: + const tOptionValue* + pOptValue + a hierarchcal value +
+ * arg: + char const* + valueName + name of value to get +
+ *
+ * ret_type: const tOptionValue*
+ * ret_desc: a compound value structure
+ *
+ * doc:
+ * This routine will find an entry in a nested value option or configurable.
+ * If "valueName" is NULL, then the first entry is returned. Otherwise,
+ * the first entry with a name that exactly matches the argument will be
+ * returned. If there is no matching value, NULL is returned and errno is
+ * set to ENOENT. If the provided option value is not a hierarchical value,
+ * NULL is also returned and errno is set to EINVAL.
+ *
+ * err:
+ * The returned result is NULL and errno is set:
+ * @itemize @bullet
+ * @item
+ * @code{EINVAL} - the @code{pOptValue} does not point to a valid
+ * hierarchical option value.
+ * @item
+ * @code{ENOENT} - no entry matched the given name.
+ * @end itemize
+=*/
+const tOptionValue*
+optionGetValue(tOptionValue const * pOld, char const * pzValName)
+{
+ tArgList * pAL;
+ tOptionValue * pRes = NULL;
+
+ if ((pOld == NULL) || (pOld->valType != OPARG_TYPE_HIERARCHY)) {
+ errno = EINVAL;
+ return pRes;
+ }
+ pAL = pOld->v.nestVal;
+
+ if (pAL->useCt > 0) {
+ int ct = pAL->useCt;
+ void ** papOV = (void**)(pAL->apzArgs);
+
+ if (pzValName == NULL) {
+ pRes = (tOptionValue*)*papOV;
+
+ } else do {
+ tOptionValue * pOV = *(papOV++);
+ if (strcmp(pOV->pzName, pzValName) == 0) {
+ pRes = pOV;
+ break;
+ }
+ } while (--ct > 0);
+ }
+ if (pRes == NULL)
+ errno = ENOENT;
+ return pRes;
+}
+
+
+/*=export_func optionNextValue
+ *
+ * what: get the next value from a hierarchical list
+ * arg: + const tOptionValue* + pOptValue + a hierarchcal list value +
+ * arg: + const tOptionValue* + pOldValue + a value from this list +
+ *
+ * ret_type: const tOptionValue*
+ * ret_desc: a compound value structure
+ *
+ * doc:
+ * This routine will return the next entry after the entry passed in. At the
+ * end of the list, NULL will be returned. If the entry is not found on the
+ * list, NULL will be returned and "@var{errno}" will be set to EINVAL.
+ * The "@var{pOldValue}" must have been gotten from a prior call to this
+ * routine or to "@code{opitonGetValue()}".
+ *
+ * err:
+ * The returned result is NULL and errno is set:
+ * @itemize @bullet
+ * @item
+ * @code{EINVAL} - the @code{pOptValue} does not point to a valid
+ * hierarchical option value or @code{pOldValue} does not point to a
+ * member of that option value.
+ * @item
+ * @code{ENOENT} - the supplied @code{pOldValue} pointed to the last entry.
+ * @end itemize
+=*/
+tOptionValue const *
+optionNextValue(tOptionValue const * pOVList,tOptionValue const * pOldOV )
+{
+ tArgList* pAL;
+ tOptionValue* pRes = NULL;
+ int err = EINVAL;
+
+ if ((pOVList == NULL) || (pOVList->valType != OPARG_TYPE_HIERARCHY)) {
+ errno = EINVAL;
+ return NULL;
+ }
+ pAL = pOVList->v.nestVal;
+ {
+ int ct = pAL->useCt;
+ void** papNV = (void**)(pAL->apzArgs);
+
+ while (ct-- > 0) {
+ tOptionValue* pNV = *(papNV++);
+ if (pNV == pOldOV) {
+ if (ct == 0) {
+ err = ENOENT;
+
+ } else {
+ err = 0;
+ pRes = (tOptionValue*)*papNV;
+ }
+ break;
+ }
+ }
+ }
+ if (err != 0)
+ errno = err;
+ return pRes;
+}
+
+
+/**
+ * Load a file containing presetting information (a configuration file).
+ */
+static void
+file_preset(tOptions * opts, char const * fname, int dir)
+{
+ tmap_info_t cfgfile;
+ tOptState optst = OPTSTATE_INITIALIZER(PRESET);
+ unsigned long st_flags = optst.flags;
+ char * ftext =
+ text_mmap(fname, PROT_READ|PROT_WRITE, MAP_PRIVATE, &cfgfile);
+
+ if (TEXT_MMAP_FAILED_ADDR(ftext))
+ return;
+
+ if (dir == DIRECTION_CALLED) {
+ st_flags = OPTST_DEFINED;
+ dir = DIRECTION_PROCESS;
+ }
+
+ /*
+ * IF this is called via "optionProcess", then we are presetting.
+ * This is the default and the PRESETTING bit will be set.
+ * If this is called via "optionFileLoad", then the bit is not set
+ * and we consider stuff set herein to be "set" by the client program.
+ */
+ if ((opts->fOptSet & OPTPROC_PRESETTING) == 0)
+ st_flags = OPTST_SET;
+
+ do {
+ optst.flags = st_flags;
+ ftext = SPN_WHITESPACE_CHARS(ftext);
+
+ if (IS_VAR_FIRST_CHAR(*ftext)) {
+ ftext = handle_cfg(opts, &optst, ftext, dir);
+
+ } else switch (*ftext) {
+ case '<':
+ if (IS_VAR_FIRST_CHAR(ftext[1]))
+ ftext = handle_struct(opts, &optst, ftext, dir);
+
+ else switch (ftext[1]) {
+ case '?':
+ ftext = handle_directive(opts, ftext);
+ break;
+
+ case '!':
+ ftext = handle_comment(ftext);
+ break;
+
+ case '/':
+ ftext = strchr(ftext + 2, '>');
+ if (ftext++ != NULL)
+ break;
+
+ default:
+ goto all_done;
+ }
+ break;
+
+ case '[':
+ ftext = handle_section(opts, ftext);
+ break;
+
+ case '#':
+ ftext = strchr(ftext + 1, NL);
+ break;
+
+ default:
+ goto all_done; /* invalid format */
+ }
+ } while (ftext != NULL);
+
+all_done:
+ text_munmap(&cfgfile);
+}
+
+
+/**
+ * "pzText" points to a "<!" sequence.
+ * Theoretically, we should ensure that it begins with "<!--",
+ * but actually I don't care that much. It ends with "-->".
+ */
+static char*
+handle_comment(char* pzText)
+{
+ char* pz = strstr(pzText, "-->");
+ if (pz != NULL)
+ pz += 3;
+ return pz;
+}
+
+
+/**
+ * "pzText" points to the start of some value name.
+ * The end of the entry is the end of the line that is not preceded by
+ * a backslash escape character. The string value is always processed
+ * in "cooked" mode.
+ */
+static char *
+handle_cfg(tOptions * pOpts, tOptState * pOS, char * pzText, int dir)
+{
+ char* pzName = pzText++;
+ char* pzEnd = strchr(pzText, NL);
+
+ if (pzEnd == NULL)
+ return pzText + strlen(pzText);
+
+ pzText = SPN_VALUE_NAME_CHARS(pzText);
+ pzText = SPN_WHITESPACE_CHARS(pzText);
+ if (pzText > pzEnd) {
+ name_only:
+ *pzEnd++ = NUL;
+ loadOptionLine(pOpts, pOS, pzName, dir, OPTION_LOAD_UNCOOKED);
+ return pzEnd;
+ }
+
+ /*
+ * Either the first character after the name is a ':' or '=',
+ * or else we must have skipped over white space. Anything else
+ * is an invalid format and we give up parsing the text.
+ */
+ if ((*pzText == '=') || (*pzText == ':')) {
+ pzText = SPN_WHITESPACE_CHARS(pzText+1);
+ if (pzText > pzEnd)
+ goto name_only;
+ } else if (! IS_WHITESPACE_CHAR(pzText[-1]))
+ return NULL;
+
+ /*
+ * IF the value is continued, remove the backslash escape and push "pzEnd"
+ * on to a newline *not* preceded by a backslash.
+ */
+ if (pzEnd[-1] == '\\') {
+ char* pcD = pzEnd-1;
+ char* pcS = pzEnd;
+
+ for (;;) {
+ char ch = *(pcS++);
+ switch (ch) {
+ case NUL:
+ pcS = NULL;
+ /* FALLTHROUGH */
+
+ case NL:
+ *pcD = NUL;
+ pzEnd = pcS;
+ goto copy_done;
+
+ case '\\':
+ if (*pcS == NL)
+ ch = *(pcS++);
+ /* FALLTHROUGH */
+ default:
+ *(pcD++) = ch;
+ }
+ } copy_done:;
+
+ } else {
+ /*
+ * The newline was not preceded by a backslash. NUL it out
+ */
+ *(pzEnd++) = NUL;
+ }
+
+ /*
+ * "pzName" points to what looks like text for one option/configurable.
+ * It is NUL terminated. Process it.
+ */
+ loadOptionLine(pOpts, pOS, pzName, dir, OPTION_LOAD_UNCOOKED);
+
+ return pzEnd;
+}
+
+
+/**
+ * "pzText" points to a "<?" sequence.
+ * We handle "<?program" and "<?auto-options" directives.
+ * All others are treated as comments.
+ */
+static char *
+handle_directive(tOptions * pOpts, char * pzText)
+{
+# define DIRECTIVE_TABLE \
+ _dt_(zCfgProg, program_directive) \
+ _dt_(zCfgAO_Flags, aoflags_directive)
+
+ typedef char * (directive_func_t)(tOptions *, char *);
+# define _dt_(_s, _fn) _fn,
+ static directive_func_t * dir_disp[] = {
+ DIRECTIVE_TABLE
+ };
+# undef _dt_
+
+# define _dt_(_s, _fn) 1 +
+ static int const dir_ct = DIRECTIVE_TABLE 0;
+ static char const * dir_names[DIRECTIVE_TABLE 0];
+# undef _dt_
+
+ int ix;
+
+ if (dir_names[0] == NULL) {
+ ix = 0;
+# define _dt_(_s, _fn) dir_names[ix++] = _s;
+ DIRECTIVE_TABLE;
+# undef _dt_
+ }
+
+ for (ix = 0; ix < dir_ct; ix++) {
+ size_t len = strlen(dir_names[ix]);
+ if ( (strncmp(pzText + 2, dir_names[ix], len) == 0)
+ && (! IS_VALUE_NAME_CHAR(pzText[len+2])) )
+ return dir_disp[ix](pOpts, pzText + len + 2);
+ }
+
+ /*
+ * We don't know what this is. Skip it.
+ */
+ pzText = strchr(pzText+2, '>');
+ if (pzText != NULL)
+ pzText++;
+ return pzText;
+}
+
+/**
+ * handle AutoOpts mode flags
+ */
+static char *
+aoflags_directive(tOptions * pOpts, char * pzText)
+{
+ char * pz;
+
+ pz = SPN_WHITESPACE_CHARS(pzText+1);
+ pzText = strchr(pz, '>');
+ if (pzText != NULL) {
+
+ size_t len = pzText - pz;
+ char * ftxt = AGALOC(len + 1, "aoflags");
+
+ memcpy(ftxt, pz, len);
+ ftxt[len] = NUL;
+ set_usage_flags(pOpts, ftxt);
+ AGFREE(ftxt);
+
+ pzText++;
+ }
+
+ return pzText;
+}
+
+/**
+ * handle program segmentation of config file.
+ */
+static char *
+program_directive(tOptions * pOpts, char * pzText)
+{
+ static char const ttlfmt[] = "<?";
+ size_t ttl_len = sizeof(ttlfmt) + strlen(zCfgProg);
+ char * ttl = AGALOC(ttl_len, "prog title");
+ size_t name_len = strlen(pOpts->pzProgName);
+
+ memcpy(ttl, ttlfmt, sizeof(ttlfmt) - 1);
+ memcpy(ttl + sizeof(ttlfmt) - 1, zCfgProg, ttl_len - (sizeof(ttlfmt) - 1));
+
+ do {
+ pzText = SPN_WHITESPACE_CHARS(pzText+1);
+
+ if ( (strneqvcmp(pzText, pOpts->pzProgName, (int)name_len) == 0)
+ && (IS_END_XML_TOKEN_CHAR(pzText[name_len])) ) {
+ pzText += name_len;
+ break;
+ }
+
+ pzText = strstr(pzText, ttl);
+ } while (pzText != NULL);
+
+ AGFREE(ttl);
+ if (pzText != NULL)
+ for (;;) {
+ if (*pzText == NUL) {
+ pzText = NULL;
+ break;
+ }
+ if (*(pzText++) == '>')
+ break;
+ }
+
+ return pzText;
+}
+
+
+/**
+ * "pzText" points to a '[' character.
+ * The "traditional" [PROG_NAME] segmentation of the config file.
+ * Do not ever mix with the "<?program prog-name>" variation.
+ */
+static char *
+handle_section(tOptions * pOpts, char * pzText)
+{
+ size_t len = strlen(pOpts->pzPROGNAME);
+ if ( (strncmp(pzText+1, pOpts->pzPROGNAME, len) == 0)
+ && (pzText[len+1] == ']'))
+ return strchr(pzText + len + 2, NL);
+
+ if (len > 16)
+ return NULL;
+
+ {
+ char z[24];
+ sprintf(z, "[%s]", pOpts->pzPROGNAME);
+ pzText = strstr(pzText, z);
+ }
+
+ if (pzText != NULL)
+ pzText = strchr(pzText, NL);
+ return pzText;
+}
+
+/**
+ * parse XML encodings
+ */
+static int
+parse_xml_encoding(char ** ppz)
+{
+# define XMLTABLE \
+ _xmlNm_(amp, '&') \
+ _xmlNm_(lt, '<') \
+ _xmlNm_(gt, '>') \
+ _xmlNm_(ff, '\f') \
+ _xmlNm_(ht, '\t') \
+ _xmlNm_(cr, '\r') \
+ _xmlNm_(vt, '\v') \
+ _xmlNm_(bel, '\a') \
+ _xmlNm_(nl, NL) \
+ _xmlNm_(space, ' ') \
+ _xmlNm_(quot, '"') \
+ _xmlNm_(apos, '\'')
+
+ static struct {
+ char const * const nm_str;
+ unsigned short nm_len;
+ short nm_val;
+ } const xml_names[] = {
+# define _xmlNm_(_n, _v) { #_n ";", sizeof(#_n), _v },
+ XMLTABLE
+# undef _xmlNm_
+# undef XMLTABLE
+ };
+
+ static int const nm_ct = sizeof(xml_names) / sizeof(xml_names[0]);
+ int base = 10;
+
+ char * pz = *ppz;
+
+ if (*pz == '#') {
+ pz++;
+ goto parse_number;
+ }
+
+ if (IS_DEC_DIGIT_CHAR(*pz)) {
+ unsigned long v;
+
+ parse_number:
+ switch (*pz) {
+ case 'x': case 'X':
+ /*
+ * Some forms specify hex with: &#xNN;
+ */
+ base = 16;
+ pz++;
+ break;
+
+ case '0':
+ /*
+ * &#0022; is hex and &#22; is decimal. Cool.
+ * Ya gotta love it.
+ */
+ if (pz[1] == '0')
+ base = 16;
+ break;
+ }
+
+ v = strtoul(pz, &pz, base);
+ if ((*pz != ';') || (v > 0x7F))
+ return NUL;
+ *ppz = pz + 1;
+ return (int)v;
+ }
+
+ {
+ int ix = 0;
+ do {
+ if (strncmp(pz, xml_names[ix].nm_str, xml_names[ix].nm_len)
+ == 0) {
+ *ppz = pz + xml_names[ix].nm_len;
+ return xml_names[ix].nm_val;
+ }
+ } while (++ix < nm_ct);
+ }
+
+ return NUL;
+}
+
+/**
+ * Find the end marker for the named section of XML.
+ * Trim that text there, trimming trailing white space for all modes
+ * except for OPTION_LOAD_UNCOOKED.
+ */
+static char *
+trim_xml_text(char * intxt, char const * pznm, tOptionLoadMode mode)
+{
+ static char const fmt[] = "</%s>";
+ size_t len = strlen(pznm) + sizeof(fmt) - 2 /* for %s */;
+ char * etext;
+
+ {
+ char z[64], *pz = z;
+ if (len >= sizeof(z))
+ pz = AGALOC(len, "scan name");
+
+ len = sprintf(pz, fmt, pznm);
+ *intxt = ' ';
+ etext = strstr(intxt, pz);
+ if (pz != z) AGFREE(pz);
+ }
+
+ if (etext == NULL)
+ return etext;
+
+ {
+ char * result = etext + len;
+
+ if (mode != OPTION_LOAD_UNCOOKED)
+ etext = SPN_WHITESPACE_BACK(intxt, etext);
+
+ *etext = NUL;
+ return result;
+ }
+}
+
+/**
+ */
+static void
+cook_xml_text(char * pzData)
+{
+ char * pzs = pzData;
+ char * pzd = pzData;
+ char bf[4];
+ bf[2] = NUL;
+
+ for (;;) {
+ int ch = ((int)*(pzs++)) & 0xFF;
+ switch (ch) {
+ case NUL:
+ *pzd = NUL;
+ return;
+
+ case '&':
+ ch = parse_xml_encoding(&pzs);
+ *(pzd++) = (char)ch;
+ if (ch == NUL)
+ return;
+ break;
+
+ case '%':
+ bf[0] = *(pzs++);
+ bf[1] = *(pzs++);
+ if ((bf[0] == NUL) || (bf[1] == NUL)) {
+ *pzd = NUL;
+ return;
+ }
+
+ ch = strtoul(bf, NULL, 16);
+ /* FALLTHROUGH */
+
+ default:
+ *(pzd++) = (char)ch;
+ }
+ }
+}
+
+/**
+ * "pzText" points to a '<' character, followed by an alpha.
+ * The end of the entry is either the "/>" following the name, or else a
+ * "</name>" string.
+ */
+static char *
+handle_struct(tOptions * pOpts, tOptState * pOS, char * pzText, int dir)
+{
+ tOptionLoadMode mode = option_load_mode;
+ tOptionValue valu;
+
+ char* pzName = ++pzText;
+ char* pzData;
+ char* pcNulPoint;
+
+ pzText = SPN_VALUE_NAME_CHARS(pzText);
+ pcNulPoint = pzText;
+ valu.valType = OPARG_TYPE_STRING;
+
+ switch (*pzText) {
+ case ' ':
+ case '\t':
+ pzText = parse_attrs(pOpts, pzText, &mode, &valu);
+ if (*pzText == '>')
+ break;
+ if (*pzText != '/')
+ return NULL;
+ /* FALLTHROUGH */
+
+ case '/':
+ if (pzText[1] != '>')
+ return NULL;
+ *pzText = NUL;
+ pzText += 2;
+ loadOptionLine(pOpts, pOS, pzName, dir, mode);
+ return pzText;
+
+ case '>':
+ break;
+
+ default:
+ pzText = strchr(pzText, '>');
+ if (pzText != NULL)
+ pzText++;
+ return pzText;
+ }
+
+ /*
+ * If we are here, we have a value. "pzText" points to a closing angle
+ * bracket. Separate the name from the value for a moment.
+ */
+ *pcNulPoint = NUL;
+ pzData = ++pzText;
+ pzText = trim_xml_text(pzText, pzName, mode);
+ if (pzText == NULL)
+ return pzText;
+
+ /*
+ * Rejoin the name and value for parsing by "loadOptionLine()".
+ * Erase any attributes parsed by "parse_attrs()".
+ */
+ memset(pcNulPoint, ' ', pzData - pcNulPoint);
+
+ /*
+ * If we are getting a "string" value that is to be cooked,
+ * then process the XML-ish &xx; XML-ish and %XX hex characters.
+ */
+ if ( (valu.valType == OPARG_TYPE_STRING)
+ && (mode == OPTION_LOAD_COOKED))
+ cook_xml_text(pzData);
+
+ /*
+ * "pzName" points to what looks like text for one option/configurable.
+ * It is NUL terminated. Process it.
+ */
+ loadOptionLine(pOpts, pOS, pzName, dir, mode);
+
+ return pzText;
+}
+
+
+/**
+ * Load a configuration file. This may be invoked either from
+ * scanning the "homerc" list, or from a specific file request.
+ * (see "optionFileLoad()", the implementation for --load-opts)
+ */
+LOCAL void
+intern_file_load(tOptions* pOpts)
+{
+ uint32_t svfl;
+ int idx;
+ int inc;
+ char zFileName[ AG_PATH_MAX+1 ];
+
+ if (pOpts->papzHomeList == NULL)
+ return;
+
+ svfl = pOpts->fOptSet;
+ inc = DIRECTION_PRESET;
+
+ /*
+ * Never stop on errors in config files.
+ */
+ pOpts->fOptSet &= ~OPTPROC_ERRSTOP;
+
+ /*
+ * Find the last RC entry (highest priority entry)
+ */
+ for (idx = 0; pOpts->papzHomeList[ idx+1 ] != NULL; ++idx) ;
+
+ /*
+ * For every path in the home list, ... *TWICE* We start at the last
+ * (highest priority) entry, work our way down to the lowest priority,
+ * handling the immediate options.
+ * Then we go back up, doing the normal options.
+ */
+ for (;;) {
+ struct stat StatBuf;
+ cch_t* pzPath;
+
+ /*
+ * IF we've reached the bottom end, change direction
+ */
+ if (idx < 0) {
+ inc = DIRECTION_PROCESS;
+ idx = 0;
+ }
+
+ pzPath = pOpts->papzHomeList[ idx ];
+
+ /*
+ * IF we've reached the top end, bail out
+ */
+ if (pzPath == NULL)
+ break;
+
+ idx += inc;
+
+ if (! optionMakePath(zFileName, (int)sizeof(zFileName),
+ pzPath, pOpts->pzProgPath))
+ continue;
+
+ /*
+ * IF the file name we constructed is a directory,
+ * THEN append the Resource Configuration file name
+ * ELSE we must have the complete file name
+ */
+ if (stat(zFileName, &StatBuf) != 0)
+ continue; /* bogus name - skip the home list entry */
+
+ if (S_ISDIR(StatBuf.st_mode)) {
+ size_t len = strlen(zFileName);
+ size_t nln = strlen(pOpts->pzRcName) + 1;
+ char * pz = zFileName + len;
+
+ if (len + 1 + nln >= sizeof(zFileName))
+ continue;
+
+ if (pz[-1] != DIRCH)
+ *(pz++) = DIRCH;
+ memcpy(pz, pOpts->pzRcName, nln);
+ }
+
+ file_preset(pOpts, zFileName, inc);
+
+ /*
+ * IF we are now to skip config files AND we are presetting,
+ * THEN change direction. We must go the other way.
+ */
+ {
+ tOptDesc * pOD = pOpts->pOptDesc + pOpts->specOptIdx.save_opts+1;
+ if (DISABLED_OPT(pOD) && PRESETTING(inc)) {
+ idx -= inc; /* go back and reprocess current file */
+ inc = DIRECTION_PROCESS;
+ }
+ }
+ } /* twice for every path in the home list, ... */
+
+ pOpts->fOptSet = svfl;
+}
+
+
+/*=export_func optionFileLoad
+ *
+ * what: Load the locatable config files, in order
+ *
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + char const* + pzProg + program name +
+ *
+ * ret_type: int
+ * ret_desc: 0 -> SUCCESS, -1 -> FAILURE
+ *
+ * doc:
+ *
+ * This function looks in all the specified directories for a configuration
+ * file ("rc" file or "ini" file) and processes any found twice. The first
+ * time through, they are processed in reverse order (last file first). At
+ * that time, only "immediate action" configurables are processed. For
+ * example, if the last named file specifies not processing any more
+ * configuration files, then no more configuration files will be processed.
+ * Such an option in the @strong{first} named directory will have no effect.
+ *
+ * Once the immediate action configurables have been handled, then the
+ * directories are handled in normal, forward order. In that way, later
+ * config files can override the settings of earlier config files.
+ *
+ * See the AutoOpts documentation for a thorough discussion of the
+ * config file format.
+ *
+ * Configuration files not found or not decipherable are simply ignored.
+ *
+ * err: Returns the value, "-1" if the program options descriptor
+ * is out of date or indecipherable. Otherwise, the value "0" will
+ * always be returned.
+=*/
+int
+optionFileLoad(tOptions * pOpts, char const * pzProgram)
+{
+ if (! SUCCESSFUL(validate_struct(pOpts, pzProgram)))
+ return -1;
+
+ {
+ char const ** pp =
+ (char const **)(void *)&(pOpts->pzProgName);
+ *pp = pzProgram;
+ }
+
+ intern_file_load(pOpts);
+ return 0;
+}
+
+
+/*=export_func optionLoadOpt
+ * private:
+ *
+ * what: Load an option rc/ini file
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ *
+ * doc:
+ * Processes the options found in the file named with
+ * pOptDesc->optArg.argString.
+=*/
+void
+optionLoadOpt(tOptions * pOpts, tOptDesc * pOptDesc)
+{
+ struct stat sb;
+
+ if (pOpts <= OPTPROC_EMIT_LIMIT)
+ return;
+
+ /*
+ * IF the option is not being disabled, THEN load the file. There must
+ * be a file. (If it is being disabled, then the disablement processing
+ * already took place. It must be done to suppress preloading of ini/rc
+ * files.)
+ */
+ if ( DISABLED_OPT(pOptDesc)
+ || ((pOptDesc->fOptState & OPTST_RESET) != 0))
+ return;
+
+ if (stat(pOptDesc->optArg.argString, &sb) != 0) {
+ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) == 0)
+ return;
+
+ fprintf(stderr, zFSErrOptLoad, errno, strerror(errno),
+ pOptDesc->optArg.argString);
+ exit(EX_NOINPUT);
+ /* NOT REACHED */
+ }
+
+ if (! S_ISREG(sb.st_mode)) {
+ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) == 0)
+ return;
+
+ fprintf(stderr, zNotFile, pOptDesc->optArg.argString);
+ exit(EX_NOINPUT);
+ /* NOT REACHED */
+ }
+
+ file_preset(pOpts, pOptDesc->optArg.argString, DIRECTION_CALLED);
+}
+
+
+/**
+ * Parse the various attributes of an XML-styled config file entry
+ */
+LOCAL char*
+parse_attrs(tOptions * pOpts, char * pzText, tOptionLoadMode * pMode,
+ tOptionValue * pType)
+{
+ size_t len;
+
+ do {
+ if (! IS_WHITESPACE_CHAR(*pzText))
+ switch (*pzText) {
+ case '/': pType->valType = OPARG_TYPE_NONE;
+ /* FALLTHROUGH */
+ case '>': return pzText;
+
+ default:
+ case NUL: return NULL;
+ }
+
+ pzText = SPN_WHITESPACE_CHARS(pzText+1);
+ len = SPN_LOWER_CASE_CHARS(pzText) - pzText;
+
+ switch (find_xat_attribute_id(pzText, len)) {
+ case XAT_KWD_TYPE:
+ pzText = parse_value(pzText+len, pType);
+ break;
+
+ case XAT_KWD_WORDS:
+ pzText = parse_keyword(pOpts, pzText+len, pType);
+ break;
+
+ case XAT_KWD_MEMBERS:
+ pzText = parse_set_mem(pOpts, pzText+len, pType);
+ break;
+
+ case XAT_KWD_COOKED:
+ pzText += len;
+ if (! IS_END_XML_TOKEN_CHAR(*pzText))
+ goto invalid_kwd;
+
+ *pMode = OPTION_LOAD_COOKED;
+ break;
+
+ case XAT_KWD_UNCOOKED:
+ pzText += len;
+ if (! IS_END_XML_TOKEN_CHAR(*pzText))
+ goto invalid_kwd;
+
+ *pMode = OPTION_LOAD_UNCOOKED;
+ break;
+
+ case XAT_KWD_KEEP:
+ pzText += len;
+ if (! IS_END_XML_TOKEN_CHAR(*pzText))
+ goto invalid_kwd;
+
+ *pMode = OPTION_LOAD_KEEP;
+ break;
+
+ default:
+ case XAT_KWD_INVALID:
+ invalid_kwd:
+ pType->valType = OPARG_TYPE_NONE;
+ return skip_unkn(pzText);
+ }
+ } while (pzText != NULL);
+
+ return pzText;
+}
+
+
+/**
+ * "pzText" points to the character after "words=".
+ * What should follow is a name of a keyword (enumeration) list.
+ */
+static char*
+parse_keyword(tOptions * pOpts, char * pzText, tOptionValue * pType)
+{
+ (void)pOpts;
+ (void)pType;
+
+ return skip_unkn(pzText);
+}
+
+
+/**
+ * "pzText" points to the character after "members="
+ * What should follow is a name of a "set membership".
+ * A collection of bit flags.
+ */
+static char*
+parse_set_mem(tOptions * pOpts, char * pzText, tOptionValue * pType)
+{
+ (void)pOpts;
+ (void)pType;
+
+ return skip_unkn(pzText);
+}
+
+
+/**
+ * "pzText" points to the character after "type="
+ */
+static char *
+parse_value(char * pzText, tOptionValue * pType)
+{
+ size_t len = 0;
+
+ if (*(pzText++) != '=')
+ goto woops;
+
+ len = SPN_OPTION_NAME_CHARS(pzText) - pzText;
+
+ if ((len == 0) || (! IS_END_XML_TOKEN_CHAR(pzText[len]))) {
+ woops:
+ pType->valType = OPARG_TYPE_NONE;
+ return skip_unkn(pzText + len);
+ }
+
+ switch (find_value_type_id(pzText, len)) {
+ default:
+ case VTP_KWD_INVALID: goto woops;
+
+ case VTP_KWD_STRING:
+ pType->valType = OPARG_TYPE_STRING;
+ break;
+
+ case VTP_KWD_INTEGER:
+ pType->valType = OPARG_TYPE_NUMERIC;
+ break;
+
+ case VTP_KWD_BOOL:
+ case VTP_KWD_BOOLEAN:
+ pType->valType = OPARG_TYPE_BOOLEAN;
+ break;
+
+ case VTP_KWD_KEYWORD:
+ pType->valType = OPARG_TYPE_ENUMERATION;
+ break;
+
+ case VTP_KWD_SET:
+ case VTP_KWD_SET_MEMBERSHIP:
+ pType->valType = OPARG_TYPE_MEMBERSHIP;
+ break;
+
+ case VTP_KWD_NESTED:
+ case VTP_KWD_HIERARCHY:
+ pType->valType = OPARG_TYPE_HIERARCHY;
+ }
+
+ return pzText + len;
+}
+
+
+/**
+ * Skip over some unknown attribute
+ */
+static char *
+skip_unkn(char* pzText)
+{
+ for (;; pzText++) {
+ if (IS_END_XML_TOKEN_CHAR(*pzText)) return pzText;
+ if (*pzText == NUL) return NULL;
+ }
+}
+
+
+/**
+ * Make sure the option descriptor is there and that we understand it.
+ * This should be called from any user entry point where one needs to
+ * worry about validity. (Some entry points are free to assume that
+ * the call is not the first to the library and, thus, that this has
+ * already been called.)
+ *
+ * Upon successful completion, pzProgName and pzProgPath are set.
+ *
+ * @param pOpts program options descriptor
+ * @param pzProgram name of program, from argv[]
+ * @returns SUCCESS or FAILURE
+ */
+LOCAL tSuccess
+validate_struct(tOptions * pOpts, char const * pzProgram)
+{
+ if (pOpts == NULL) {
+ fputs(zAO_Bad, stderr);
+ return FAILURE;
+ }
+
+ /*
+ * IF the client has enabled translation and the translation procedure
+ * is available, then go do it.
+ */
+ if ( ((pOpts->fOptSet & OPTPROC_TRANSLATE) != 0)
+ && (pOpts->pTransProc != NULL) ) {
+ /*
+ * If option names are not to be translated at all, then do not do
+ * it for configuration parsing either. (That is the bit that really
+ * gets tested anyway.)
+ */
+ if ((pOpts->fOptSet & OPTPROC_NO_XLAT_MASK) == OPTPROC_NXLAT_OPT)
+ pOpts->fOptSet |= OPTPROC_NXLAT_OPT_CFG;
+ (*pOpts->pTransProc)();
+ pOpts->fOptSet &= ~OPTPROC_TRANSLATE;
+ }
+
+ /*
+ * IF the struct version is not the current, and also
+ * either too large (?!) or too small,
+ * THEN emit error message and fail-exit
+ */
+ if ( ( pOpts->structVersion != OPTIONS_STRUCT_VERSION )
+ && ( (pOpts->structVersion > OPTIONS_STRUCT_VERSION )
+ || (pOpts->structVersion < OPTIONS_MINIMUM_VERSION )
+ ) ) {
+ static char const aover[] =
+ STR(AO_CURRENT)":"STR(AO_REVISION)":"STR(AO_AGE)"\n";
+
+ fprintf(stderr, zAO_Err, pzProgram, NUM_TO_VER(pOpts->structVersion));
+ if (pOpts->structVersion > OPTIONS_STRUCT_VERSION )
+ fputs(zAO_Big, stderr);
+ else
+ fputs(zAO_Sml, stderr);
+
+ fwrite(aover, sizeof(aover) - 1, 1, stderr);
+ return FAILURE;
+ }
+
+ /*
+ * If the program name hasn't been set, then set the name and the path
+ * and the set of equivalent characters.
+ */
+ if (pOpts->pzProgName == NULL) {
+ char const * pz = strrchr(pzProgram, DIRCH);
+ char const ** pp =
+ (char const **)(void **)&(pOpts->pzProgName);
+
+ if (pz != NULL) {
+ *pp = pz+1;
+ } else {
+ *pp = pzProgram;
+ pz = pathfind(getenv("PATH"), (char *)pzProgram, "rx");
+ if (pz != NULL)
+ pzProgram = (void *)pz;
+ }
+
+ pp = (char const **)(void **)&(pOpts->pzProgPath);
+ *pp = pzProgram;
+
+ /*
+ * when comparing long names, these are equivalent
+ */
+ strequate(zSepChars);
+ }
+
+ return SUCCESS;
+}
+
+
+/**
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/configfile.c */
diff --git a/autoopts/cook.c b/autoopts/cook.c
new file mode 100644
index 0000000..f34a6ed
--- /dev/null
+++ b/autoopts/cook.c
@@ -0,0 +1,311 @@
+/**
+ * \file cook.c
+ *
+ * Time-stamp: "2012-02-28 19:40:47 bkorb"
+ *
+ * This file contains the routines that deal with processing quoted strings
+ * into an internal format.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static bool
+contiguous_quote(char ** pps, char * pq, int * lnct_p);
+/* = = = END-STATIC-FORWARD = = = */
+
+/*=export_func ao_string_cook_escape_char
+ * private:
+ *
+ * what: escape-process a string fragment
+ * arg: + char const* + pzScan + points to character after the escape +
+ * arg: + char* + pRes + Where to put the result byte +
+ * arg: + unsigned int + nl_ch + replacement char if scanned char is \n +
+ *
+ * ret-type: unsigned int
+ * ret-desc: The number of bytes consumed processing the escaped character.
+ *
+ * doc:
+ *
+ * This function converts "t" into "\t" and all your other favorite
+ * escapes, including numeric ones: hex and ocatal, too.
+ * The returned result tells the caller how far to advance the
+ * scan pointer (passed in). The default is to just pass through the
+ * escaped character and advance the scan by one.
+ *
+ * Some applications need to keep an escaped newline, others need to
+ * suppress it. This is accomplished by supplying a '\n' replacement
+ * character that is different from \n, if need be. For example, use
+ * 0x7F and never emit a 0x7F.
+ *
+ * err: @code{NULL} is returned if the string is mal-formed.
+=*/
+unsigned int
+ao_string_cook_escape_char(char const* pzIn, char* pRes, uint_t nl)
+{
+ unsigned int res = 1;
+
+ switch (*pRes = *pzIn++) {
+ case NUL: /* NUL - end of input string */
+ return 0;
+ case '\r':
+ if (*pzIn != NL)
+ return 1;
+ res++;
+ /* FALLTHROUGH */
+ case NL: /* NL - emit newline */
+ *pRes = (char)nl;
+ return res;
+
+ case 'a': *pRes = '\a'; break;
+ case 'b': *pRes = '\b'; break;
+ case 'f': *pRes = '\f'; break;
+ case 'n': *pRes = NL; break;
+ case 'r': *pRes = '\r'; break;
+ case 't': *pRes = '\t'; break;
+ case 'v': *pRes = '\v'; break;
+
+ case 'x':
+ case 'X': /* HEX Escape */
+ if (IS_HEX_DIGIT_CHAR(*pzIn)) {
+ char z[4], *pz = z;
+
+ do *(pz++) = *(pzIn++);
+ while (IS_HEX_DIGIT_CHAR(*pzIn) && (pz < z + 2));
+ *pz = NUL;
+ *pRes = (unsigned char)strtoul(z, NULL, 16);
+ res += pz - z;
+ }
+ break;
+
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
+ {
+ /*
+ * IF the character copied was an octal digit,
+ * THEN set the output character to an octal value
+ */
+ char z[4], *pz = z + 1;
+ unsigned long val;
+ z[0] = *pRes;
+
+ while (IS_OCT_DIGIT_CHAR(*pzIn) && (pz < z + 3))
+ *(pz++) = *(pzIn++);
+ *pz = NUL;
+ val = strtoul(z, NULL, 8);
+ if (val > 0xFF)
+ val = 0xFF;
+ *pRes = (unsigned char)val;
+ res = pz - z;
+ break;
+ }
+
+ default: ;
+ }
+
+ return res;
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * A quoted string has been found.
+ * Find the end of it and compress any escape sequences.
+ */
+static bool
+contiguous_quote(char ** pps, char * pq, int * lnct_p)
+{
+ char * ps = *pps + 1;
+
+ for (;;) {
+ while (IS_WHITESPACE_CHAR(*ps))
+ if (*(ps++) == NL)
+ (*lnct_p)++;
+
+ /*
+ * IF the next character is a quote character,
+ * THEN we will concatenate the strings.
+ */
+ switch (*ps) {
+ case '"':
+ case '\'':
+ *pq = *(ps++); /* assign new quote character and return */
+ *pps = ps;
+ return true;
+
+ case '/':
+ /*
+ * Allow for a comment embedded in the concatenated string.
+ */
+ switch (ps[1]) {
+ default:
+ *pps = NULL;
+ return false;
+
+ case '/':
+ /*
+ * Skip to end of line
+ */
+ ps = strchr(ps, NL);
+ if (ps == NULL) {
+ *pps = NULL;
+ return false;
+ }
+ break;
+
+ case '*':
+ {
+ char* p = strstr( ps+2, "*/" );
+ /*
+ * Skip to terminating star slash
+ */
+ if (p == NULL) {
+ *pps = NULL;
+ return false;
+ }
+
+ while (ps < p) {
+ if (*(ps++) == NL)
+ (*lnct_p)++;
+ }
+
+ ps = p + 2;
+ }
+ }
+ continue;
+
+ default:
+ /*
+ * The next non-whitespace character is not a quote.
+ * The series of quoted strings has come to an end.
+ */
+ *pps = ps;
+ return false;
+ }
+ }
+}
+
+/*=export_func ao_string_cook
+ * private:
+ *
+ * what: concatenate and escape-process strings
+ * arg: + char* + pzScan + The *MODIFIABLE* input buffer +
+ * arg: + int* + lnct_p + The (possibly NULL) pointer to a line count +
+ *
+ * ret-type: char*
+ * ret-desc: The address of the text following the processed strings.
+ * The return value is NULL if the strings are ill-formed.
+ *
+ * doc:
+ *
+ * A series of one or more quoted strings are concatenated together.
+ * If they are quoted with double quotes (@code{"}), then backslash
+ * escapes are processed per the C programming language. If they are
+ * single quote strings, then the backslashes are honored only when they
+ * precede another backslash or a single quote character.
+ *
+ * err: @code{NULL} is returned if the string(s) is/are mal-formed.
+=*/
+char *
+ao_string_cook(char * pzScan, int * lnct_p)
+{
+ int l = 0;
+ char q = *pzScan;
+
+ /*
+ * It is a quoted string. Process the escape sequence characters
+ * (in the set "abfnrtv") and make sure we find a closing quote.
+ */
+ char* pzD = pzScan++;
+ char* pzS = pzScan;
+
+ if (lnct_p == NULL)
+ lnct_p = &l;
+
+ for (;;) {
+ /*
+ * IF the next character is the quote character, THEN we may end the
+ * string. We end it unless the next non-blank character *after* the
+ * string happens to also be a quote. If it is, then we will change
+ * our quote character to the new quote character and continue
+ * condensing text.
+ */
+ while (*pzS == q) {
+ *pzD = NUL; /* This is probably the end of the line */
+ if (! contiguous_quote(&pzS, &q, lnct_p))
+ return pzS;
+ }
+
+ /*
+ * We are inside a quoted string. Copy text.
+ */
+ switch (*(pzD++) = *(pzS++)) {
+ case NUL:
+ return NULL;
+
+ case NL:
+ (*lnct_p)++;
+ break;
+
+ case '\\':
+ /*
+ * IF we are escaping a new line,
+ * THEN drop both the escape and the newline from
+ * the result string.
+ */
+ if (*pzS == NL) {
+ pzS++;
+ pzD--;
+ (*lnct_p)++;
+ }
+
+ /*
+ * ELSE IF the quote character is '"' or '`',
+ * THEN we do the full escape character processing
+ */
+ else if (q != '\'') {
+ int ct = ao_string_cook_escape_char(pzS, pzD-1, (uint_t)NL);
+ if (ct == 0)
+ return NULL;
+
+ pzS += ct;
+ } /* if (q != '\'') */
+
+ /*
+ * OTHERWISE, we only process "\\", "\'" and "\#" sequences.
+ * The latter only to easily hide preprocessing directives.
+ */
+ else switch (*pzS) {
+ case '\\':
+ case '\'':
+ case '#':
+ pzD[-1] = *pzS++;
+ }
+ } /* switch (*(pzD++) = *(pzS++)) */
+ } /* for (;;) */
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/cook.c */
diff --git a/autoopts/enum.c b/autoopts/enum.c
new file mode 100644
index 0000000..dff5df8
--- /dev/null
+++ b/autoopts/enum.c
@@ -0,0 +1,546 @@
+
+/**
+ * \file enumeration.c
+ *
+ * Time-stamp: "2012-08-11 08:12:58 bkorb"
+ *
+ * Automated Options Paged Usage module.
+ *
+ * This routine will run run-on options through a pager so the
+ * user may examine, print or edit them at their leisure.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+static char const * pz_enum_err_fmt;
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+enum_err(tOptions * pOpts, tOptDesc * pOD,
+ char const * const * paz_names, int name_ct);
+
+static uintptr_t
+find_name(char const * pzName, tOptions * pOpts, tOptDesc * pOD,
+ char const * const * paz_names, unsigned int name_ct);
+
+static void
+set_memb_usage(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names,
+ unsigned int name_ct);
+
+static void
+set_memb_shell(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names,
+ unsigned int name_ct);
+
+static void
+set_memb_names(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names,
+ unsigned int name_ct);
+/* = = = END-STATIC-FORWARD = = = */
+
+static void
+enum_err(tOptions * pOpts, tOptDesc * pOD,
+ char const * const * paz_names, int name_ct)
+{
+ size_t max_len = 0;
+ size_t ttl_len = 0;
+ int ct_down = name_ct;
+ int hidden = 0;
+
+ /*
+ * A real "pOpts" pointer means someone messed up. Give a real error.
+ */
+ if (pOpts > OPTPROC_EMIT_LIMIT)
+ fprintf(option_usage_fp, pz_enum_err_fmt, pOpts->pzProgName,
+ pOD->optArg.argString, pOD->pz_Name);
+
+ fprintf(option_usage_fp, zValidKeys, pOD->pz_Name);
+
+ /*
+ * If the first name starts with this funny character, then we have
+ * a first value with an unspellable name. You cannot specify it.
+ * So, we don't list it either.
+ */
+ if (**paz_names == 0x7F) {
+ paz_names++;
+ hidden = 1;
+ ct_down = --name_ct;
+ }
+
+ /*
+ * Figure out the maximum length of any name, plus the total length
+ * of all the names.
+ */
+ {
+ char const * const * paz = paz_names;
+
+ do {
+ size_t len = strlen(*(paz++)) + 1;
+ if (len > max_len)
+ max_len = len;
+ ttl_len += len;
+ } while (--ct_down > 0);
+
+ ct_down = name_ct;
+ }
+
+ /*
+ * IF any one entry is about 1/2 line or longer, print one per line
+ */
+ if (max_len > 35) {
+ do {
+ fprintf(option_usage_fp, ENUM_ERR_SEP_LINE_FMT, *(paz_names++));
+ } while (--ct_down > 0);
+ }
+
+ /*
+ * ELSE IF they all fit on one line, then do so.
+ */
+ else if (ttl_len < 76) {
+ fputc(' ', option_usage_fp);
+ do {
+ fputc(' ', option_usage_fp);
+ fputs(*(paz_names++), option_usage_fp);
+ } while (--ct_down > 0);
+ fputc(NL, option_usage_fp);
+ }
+
+ /*
+ * Otherwise, columnize the output
+ */
+ else {
+ unsigned int ent_no = 0;
+ char zFmt[16]; /* format for all-but-last entries on a line */
+
+ sprintf(zFmt, ENUM_ERR_STR_WIDTH_FMT, (int)max_len);
+ max_len = 78 / max_len; /* max_len is now max entries on a line */
+ fputs(TWO_SPACES_STR, option_usage_fp);
+
+ /*
+ * Loop through all but the last entry
+ */
+ ct_down = name_ct;
+ while (--ct_down > 0) {
+ if (++ent_no == max_len) {
+ /*
+ * Last entry on a line. Start next line, too.
+ */
+ fprintf(option_usage_fp, NLSTR_SPACE_FMT, *(paz_names++));
+ ent_no = 0;
+ }
+
+ else
+ fprintf(option_usage_fp, zFmt, *(paz_names++) );
+ }
+ fprintf(option_usage_fp, NLSTR_FMT, *paz_names);
+ }
+
+ if (pOpts > OPTPROC_EMIT_LIMIT) {
+ fprintf(option_usage_fp, zIntRange, hidden, name_ct - 1 + hidden);
+
+ (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+ }
+
+ if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_MEMBERSHIP) {
+ fprintf(option_usage_fp, zLowerBits, name_ct);
+ fputs(zSetMemberSettings, option_usage_fp);
+ } else {
+ fprintf(option_usage_fp, zIntRange, hidden, name_ct - 1 + hidden);
+ }
+}
+
+/**
+ * Convert a name or number into a binary number.
+ * "~0" and "-1" will be converted to the largest value in the enumeration.
+ *
+ * @param pzName the keyword name (number) to convert
+ * @param pOpts the program's option descriptor
+ * @param pOD the option descriptor for this option
+ * @param paz_names the list of keywords for this option
+ * @param name_ct the count of keywords
+ */
+static uintptr_t
+find_name(char const * pzName, tOptions * pOpts, tOptDesc * pOD,
+ char const * const * paz_names, unsigned int name_ct)
+{
+ /*
+ * Return the matching index as a pointer sized integer.
+ * The result gets stashed in a char* pointer.
+ */
+ uintptr_t res = name_ct;
+ size_t len = strlen((char*)pzName);
+ uintptr_t idx;
+
+ if (IS_DEC_DIGIT_CHAR(*pzName)) {
+ char * pz = (char *)(void *)pzName;
+ unsigned long val = strtoul(pz, &pz, 0);
+ if ((*pz == NUL) && (val < name_ct))
+ return (uintptr_t)val;
+ pz_enum_err_fmt = zTooLarge;
+ option_usage_fp = stderr;
+ enum_err(pOpts, pOD, paz_names, (int)name_ct);
+ return name_ct;
+ }
+
+ if (IS_INVERSION_CHAR(*pzName) && (pzName[2] == NUL)) {
+ if ( ((pzName[0] == '~') && (pzName[1] == '0'))
+ || ((pzName[0] == '-') && (pzName[1] == '1')))
+ return (uintptr_t)(name_ct - 1);
+ goto oops;
+ }
+
+ /*
+ * Look for an exact match, but remember any partial matches.
+ * Multiple partial matches means we have an ambiguous match.
+ */
+ for (idx = 0; idx < name_ct; idx++) {
+ if (strncmp((char*)paz_names[idx], (char*)pzName, len) == 0) {
+ if (paz_names[idx][len] == NUL)
+ return idx; /* full match */
+
+ if (res == name_ct)
+ res = idx; /* save partial match */
+ else
+ res = ~0; /* may yet find full match */
+ }
+ }
+
+ if (res < name_ct)
+ return res; /* partial match */
+
+oops:
+
+ pz_enum_err_fmt = (res == name_ct) ? zNoKey : zAmbigKey;
+ option_usage_fp = stderr;
+ enum_err(pOpts, pOD, paz_names, (int)name_ct);
+ return name_ct;
+}
+
+
+/*=export_func optionKeywordName
+ * what: Convert between enumeration values and strings
+ * private:
+ *
+ * arg: tOptDesc*, pOD, enumeration option description
+ * arg: unsigned int, enum_val, the enumeration value to map
+ *
+ * ret_type: char const *
+ * ret_desc: the enumeration name from const memory
+ *
+ * doc: This converts an enumeration value into the matching string.
+=*/
+char const *
+optionKeywordName(tOptDesc * pOD, unsigned int enum_val)
+{
+ tOptDesc od = {
+ .optArg.argEnum = enum_val };
+
+ (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, &od );
+ return od.optArg.argString;
+}
+
+
+/*=export_func optionEnumerationVal
+ * what: Convert from a string to an enumeration value
+ * private:
+ *
+ * arg: tOptions*, pOpts, the program options descriptor
+ * arg: tOptDesc*, pOD, enumeration option description
+ * arg: char const * const *, paz_names, list of enumeration names
+ * arg: unsigned int, name_ct, number of names in list
+ *
+ * ret_type: uintptr_t
+ * ret_desc: the enumeration value
+ *
+ * doc: This converts the optArg.argString string from the option description
+ * into the index corresponding to an entry in the name list.
+ * This will match the generated enumeration value.
+ * Full matches are always accepted. Partial matches are accepted
+ * if there is only one partial match.
+=*/
+uintptr_t
+optionEnumerationVal(tOptions * pOpts, tOptDesc * pOD,
+ char const * const * paz_names, unsigned int name_ct)
+{
+ uintptr_t res = 0UL;
+
+ /*
+ * IF the program option descriptor pointer is invalid,
+ * then it is some sort of special request.
+ */
+ switch ((uintptr_t)pOpts) {
+ case (uintptr_t)OPTPROC_EMIT_USAGE:
+ /*
+ * print the list of enumeration names.
+ */
+ enum_err(pOpts, pOD, paz_names, (int)name_ct);
+ break;
+
+ case (uintptr_t)OPTPROC_EMIT_SHELL:
+ {
+ unsigned int ix = pOD->optArg.argEnum;
+ /*
+ * print the name string.
+ */
+ if (ix >= name_ct)
+ printf(INVALID_FMT, ix);
+ else
+ fputs(paz_names[ ix ], stdout);
+
+ break;
+ }
+
+ case (uintptr_t)OPTPROC_RETURN_VALNAME:
+ {
+ unsigned int ix = pOD->optArg.argEnum;
+ /*
+ * Replace the enumeration value with the name string.
+ */
+ if (ix >= name_ct)
+ return (uintptr_t)INVALID_STR;
+
+ pOD->optArg.argString = paz_names[ix];
+ break;
+ }
+
+ default:
+ if ((pOD->fOptState & OPTST_RESET) != 0)
+ break;
+
+ res = find_name(pOD->optArg.argString, pOpts, pOD, paz_names, name_ct);
+
+ if (pOD->fOptState & OPTST_ALLOC_ARG) {
+ AGFREE(pOD->optArg.argString);
+ pOD->fOptState &= ~OPTST_ALLOC_ARG;
+ pOD->optArg.argString = NULL;
+ }
+ }
+
+ return res;
+}
+
+static void
+set_memb_usage(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names,
+ unsigned int name_ct)
+{
+ /*
+ * print the list of enumeration names.
+ */
+ (void)pOpts;
+ enum_err(OPTPROC_EMIT_USAGE, pOD, paz_names, (int)name_ct );
+}
+
+static void
+set_memb_shell(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names,
+ unsigned int name_ct)
+{
+ /*
+ * print the name string.
+ */
+ unsigned int ix = 0;
+ uintptr_t bits = (uintptr_t)pOD->optCookie;
+ size_t len = 0;
+
+ (void)pOpts;
+ bits &= ((uintptr_t)1 << (uintptr_t)name_ct) - (uintptr_t)1;
+
+ while (bits != 0) {
+ if (bits & 1) {
+ if (len++ > 0) fputs(OR_STR, stdout);
+ fputs(paz_names[ix], stdout);
+ }
+ if (++ix >= name_ct) break;
+ bits >>= 1;
+ }
+}
+
+static void
+set_memb_names(tOptions * pOpts, tOptDesc * pOD, char const * const * paz_names,
+ unsigned int name_ct)
+{
+ char * pz;
+ uintptr_t bits = (uintptr_t)pOD->optCookie;
+ unsigned int ix = 0;
+ size_t len = NONE_STR_LEN + 1;
+
+ (void)pOpts;
+ bits &= ((uintptr_t)1 << (uintptr_t)name_ct) - (uintptr_t)1;
+
+ /*
+ * Replace the enumeration value with the name string.
+ * First, determine the needed length, then allocate and fill in.
+ */
+ while (bits != 0) {
+ if (bits & 1)
+ len += strlen(paz_names[ix]) + PLUS_STR_LEN + 1;
+ if (++ix >= name_ct) break;
+ bits >>= 1;
+ }
+
+ pOD->optArg.argString = pz = AGALOC(len, "enum");
+
+ /*
+ * Start by clearing all the bits. We want to turn off any defaults
+ * because we will be restoring to current state, not adding to
+ * the default set of bits.
+ */
+ memcpy(pz, NONE_STR, NONE_STR_LEN);
+ pz += NONE_STR_LEN;
+ bits = (uintptr_t)pOD->optCookie;
+ bits &= ((uintptr_t)1 << (uintptr_t)name_ct) - (uintptr_t)1;
+ ix = 0;
+
+ while (bits != 0) {
+ if (bits & 1) {
+ size_t nln = strlen(paz_names[ix]);
+ memcpy(pz, PLUS_STR, PLUS_STR_LEN);
+ memcpy(pz+PLUS_STR_LEN, paz_names[ix], nln);
+ pz += nln + PLUS_STR_LEN;
+ }
+ if (++ix >= name_ct) break;
+ bits >>= 1;
+ }
+ *pz = NUL;
+}
+
+/*=export_func optionSetMembers
+ * what: Convert between bit flag values and strings
+ * private:
+ *
+ * arg: tOptions*, pOpts, the program options descriptor
+ * arg: tOptDesc*, pOD, enumeration option description
+ * arg: char const * const *,
+ * paz_names, list of enumeration names
+ * arg: unsigned int, name_ct, number of names in list
+ *
+ * doc: This converts the optArg.argString string from the option description
+ * into the index corresponding to an entry in the name list.
+ * This will match the generated enumeration value.
+ * Full matches are always accepted. Partial matches are accepted
+ * if there is only one partial match.
+=*/
+void
+optionSetMembers(tOptions * pOpts, tOptDesc * pOD,
+ char const* const * paz_names, unsigned int name_ct)
+{
+ /*
+ * IF the program option descriptor pointer is invalid,
+ * then it is some sort of special request.
+ */
+ switch ((uintptr_t)pOpts) {
+ case (uintptr_t)OPTPROC_EMIT_USAGE:
+ set_memb_usage(pOpts, pOD, paz_names, name_ct);
+ return;
+
+ case (uintptr_t)OPTPROC_EMIT_SHELL:
+ set_memb_shell(pOpts, pOD, paz_names, name_ct);
+ return;
+
+ case (uintptr_t)OPTPROC_RETURN_VALNAME:
+ set_memb_names(pOpts, pOD, paz_names, name_ct);
+ return;
+
+ default:
+ break;
+ }
+
+ if ((pOD->fOptState & OPTST_RESET) != 0)
+ return;
+
+ {
+ char const * pzArg = pOD->optArg.argString;
+ uintptr_t res;
+ if ((pzArg == NULL) || (*pzArg == NUL)) {
+ pOD->optCookie = (void*)0;
+ return;
+ }
+
+ res = (uintptr_t)pOD->optCookie;
+ for (;;) {
+ int iv, len;
+
+ pzArg = SPN_SET_SEPARATOR_CHARS(pzArg);
+ iv = (*pzArg == '!');
+ if (iv)
+ pzArg = SPN_WHITESPACE_CHARS(pzArg+1);
+
+ len = BRK_SET_SEPARATOR_CHARS(pzArg) - pzArg;
+ if (len == 0)
+ break;
+
+ if ((len == 3) && (strncmp(pzArg, zAll, 3) == 0)) {
+ if (iv)
+ res = 0;
+ else res = ~0UL;
+ }
+ else if ((len == 4) && (strncmp(pzArg, zNone, 4) == 0)) {
+ if (! iv)
+ res = 0;
+ }
+ else do {
+ char* pz;
+ uintptr_t bit = strtoul(pzArg, &pz, 0);
+
+ if (pz != pzArg + len) {
+ char z[ AO_NAME_SIZE ];
+ char const* p;
+ unsigned int shift_ct;
+
+ if (*pz != NUL) {
+ if (len >= AO_NAME_LIMIT)
+ break;
+ memcpy(z, pzArg, (size_t)len);
+ z[len] = NUL;
+ p = z;
+ } else {
+ p = pzArg;
+ }
+
+ shift_ct = find_name(p, pOpts, pOD, paz_names, name_ct);
+ if (shift_ct >= name_ct) {
+ pOD->optCookie = (void*)0;
+ return;
+ }
+ bit = 1UL << shift_ct;
+ }
+ if (iv)
+ res &= ~bit;
+ else res |= bit;
+ } while (false);
+
+ if (pzArg[len] == NUL)
+ break;
+ pzArg += len + 1;
+ }
+ if (name_ct < (8 * sizeof(uintptr_t))) {
+ res &= (1UL << name_ct) - 1UL;
+ }
+
+ pOD->optCookie = (void*)res;
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/enumeration.c */
diff --git a/autoopts/env.c b/autoopts/env.c
new file mode 100644
index 0000000..2b55137
--- /dev/null
+++ b/autoopts/env.c
@@ -0,0 +1,264 @@
+
+/**
+ * \file environment.c
+ *
+ * Time-stamp: "2012-08-11 08:18:25 bkorb"
+ *
+ * This file contains all of the routines that must be linked into
+ * an executable to use the generated option processing. The optional
+ * routines are in separately compiled modules so that they will not
+ * necessarily be linked in.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+do_env_opt(tOptState * os, char * env_name,
+ tOptions * pOpts, teEnvPresetType type);
+/* = = = END-STATIC-FORWARD = = = */
+
+/*
+ * doPrognameEnv - check for preset values from the ${PROGNAME}
+ * environment variable. This is accomplished by parsing the text into
+ * tokens, temporarily replacing the arg vector and calling
+ * immediate_opts and/or regular_opts.
+ */
+LOCAL void
+doPrognameEnv(tOptions * pOpts, teEnvPresetType type)
+{
+ char const * pczOptStr = getenv(pOpts->pzPROGNAME);
+ token_list_t* pTL;
+ int sv_argc;
+ tAoUI sv_flag;
+ char ** sv_argv;
+
+ /*
+ * No such beast? Then bail now.
+ */
+ if (pczOptStr == NULL)
+ return;
+
+ /*
+ * Tokenize the string. If there's nothing of interest, we'll bail
+ * here immediately.
+ */
+ pTL = ao_string_tokenize(pczOptStr);
+ if (pTL == NULL)
+ return;
+
+ /*
+ * Substitute our $PROGNAME argument list for the real one
+ */
+ sv_argc = pOpts->origArgCt;
+ sv_argv = pOpts->origArgVect;
+ sv_flag = pOpts->fOptSet;
+
+ /*
+ * We add a bogus pointer to the start of the list. The program name
+ * has already been pulled from "argv", so it won't get dereferenced.
+ * The option scanning code will skip the "program name" at the start
+ * of this list of tokens, so we accommodate this way ....
+ */
+ {
+ uintptr_t v = (uintptr_t)(pTL->tkn_list);
+ pOpts->origArgVect = (void *)(v - sizeof(char *));
+ }
+ pOpts->origArgCt = pTL->tkn_ct + 1;
+ pOpts->fOptSet &= ~OPTPROC_ERRSTOP;
+
+ pOpts->curOptIdx = 1;
+ pOpts->pzCurOpt = NULL;
+
+ switch (type) {
+ case ENV_IMM:
+ (void)immediate_opts(pOpts);
+ break;
+
+ case ENV_ALL:
+ (void)immediate_opts(pOpts);
+ pOpts->curOptIdx = 1;
+ pOpts->pzCurOpt = NULL;
+ /* FALLTHROUGH */
+
+ case ENV_NON_IMM:
+ (void)regular_opts(pOpts);
+ }
+
+ /*
+ * Free up the temporary arg vector and restore the original program args.
+ */
+ free(pTL);
+ pOpts->origArgVect = sv_argv;
+ pOpts->origArgCt = sv_argc;
+ pOpts->fOptSet = sv_flag;
+}
+
+static void
+do_env_opt(tOptState * os, char * env_name,
+ tOptions * pOpts, teEnvPresetType type)
+{
+ os->pzOptArg = getenv(env_name);
+ if (os->pzOptArg == NULL)
+ return;
+
+ os->flags = OPTST_PRESET | OPTST_ALLOC_ARG | os->pOD->fOptState;
+ os->optType = TOPT_UNDEFINED;
+
+ if ( (os->pOD->pz_DisablePfx != NULL)
+ && (streqvcmp(os->pzOptArg, os->pOD->pz_DisablePfx) == 0)) {
+ os->flags |= OPTST_DISABLED;
+ os->pzOptArg = NULL;
+ handle_opt(pOpts, os);
+ return;
+ }
+
+ switch (type) {
+ case ENV_IMM:
+ /*
+ * Process only immediate actions
+ */
+ if (DO_IMMEDIATELY(os->flags))
+ break;
+ return;
+
+ case ENV_NON_IMM:
+ /*
+ * Process only NON immediate actions
+ */
+ if (DO_NORMALLY(os->flags) || DO_SECOND_TIME(os->flags))
+ break;
+ return;
+
+ default: /* process everything */
+ break;
+ }
+
+ /*
+ * Make sure the option value string is persistent and consistent.
+ *
+ * The interpretation of the option value depends
+ * on the type of value argument the option takes
+ */
+ if (OPTST_GET_ARGTYPE(os->pOD->fOptState) == OPARG_TYPE_NONE) {
+ /*
+ * Ignore any value.
+ */
+ os->pzOptArg = NULL;
+
+ } else if (os->pzOptArg[0] == NUL) {
+ /*
+ * If the argument is the empty string and the argument is
+ * optional, then treat it as if the option was not specified.
+ */
+ if ((os->pOD->fOptState & OPTST_ARG_OPTIONAL) == 0)
+ return;
+ os->pzOptArg = NULL;
+
+ } else {
+ AGDUPSTR(os->pzOptArg, os->pzOptArg, "option argument");
+ os->flags |= OPTST_ALLOC_ARG;
+ }
+
+ handle_opt(pOpts, os);
+}
+
+/*
+ * env_presets - check for preset values from the envrionment
+ * This routine should process in all, immediate or normal modes....
+ */
+LOCAL void
+env_presets(tOptions * pOpts, teEnvPresetType type)
+{
+ int ct;
+ tOptState st;
+ char* pzFlagName;
+ size_t spaceLeft;
+ char zEnvName[ AO_NAME_SIZE ];
+
+ /*
+ * Finally, see if we are to look at the environment
+ * variables for initial values.
+ */
+ if ((pOpts->fOptSet & OPTPROC_ENVIRON) == 0)
+ return;
+
+ doPrognameEnv(pOpts, type);
+
+ ct = pOpts->presetOptCt;
+ st.pOD = pOpts->pOptDesc;
+
+ pzFlagName = zEnvName
+ + snprintf(zEnvName, sizeof(zEnvName), "%s_", pOpts->pzPROGNAME);
+ spaceLeft = AO_NAME_SIZE - (pzFlagName - zEnvName) - 1;
+
+ for (;ct-- > 0; st.pOD++) {
+ size_t nln;
+
+ /*
+ * If presetting is disallowed, then skip this entry
+ */
+ if ( ((st.pOD->fOptState & OPTST_NO_INIT) != 0)
+ || (st.pOD->optEquivIndex != NO_EQUIVALENT) )
+ continue;
+
+ /*
+ * IF there is no such environment variable,
+ * THEN skip this entry, too.
+ */
+ nln = strlen(st.pOD->pz_NAME) + 1;
+ if (nln <= spaceLeft) {
+ /*
+ * Set up the option state
+ */
+ memcpy(pzFlagName, st.pOD->pz_NAME, nln);
+ do_env_opt(&st, zEnvName, pOpts, type);
+ }
+ }
+
+ /*
+ * Special handling for ${PROGNAME_LOAD_OPTS}
+ */
+ if ( (pOpts->specOptIdx.save_opts != NO_EQUIVALENT)
+ && (pOpts->specOptIdx.save_opts != 0)) {
+ size_t nln;
+ st.pOD = pOpts->pOptDesc + pOpts->specOptIdx.save_opts + 1;
+
+ if (st.pOD->pz_NAME == NULL)
+ return;
+
+ nln = strlen(st.pOD->pz_NAME) + 1;
+
+ if (nln > spaceLeft)
+ return;
+
+ memcpy(pzFlagName, st.pOD->pz_NAME, nln);
+ do_env_opt(&st, zEnvName, pOpts, type);
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/environment.c */
diff --git a/autoopts/file.c b/autoopts/file.c
new file mode 100644
index 0000000..5a5b3eb
--- /dev/null
+++ b/autoopts/file.c
@@ -0,0 +1,208 @@
+
+/**
+ * \file file.c
+ *
+ * Time-stamp: "2011-08-06 08:49:35 bkorb"
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/**
+ * Make sure the directory containing the subject file exists and that
+ * the file exists or does not exist, per the option requirements.
+ *
+ * @param ftype file existence type flags
+ * @param pOpts program option descriptor
+ * @param pOD the option descriptor
+ */
+static void
+check_existence(teOptFileType ftype, tOptions * pOpts, tOptDesc * pOD)
+{
+ char const * fname = pOD->optArg.argString;
+ struct stat sb;
+
+ errno = 0;
+
+ switch (ftype & FTYPE_MODE_EXIST_MASK) {
+ case FTYPE_MODE_MUST_NOT_EXIST:
+ if ((stat(fname, &sb) == 0) || (errno != ENOENT)) {
+ if (errno == 0)
+ errno = EINVAL;
+ fprintf(stderr, zFSOptError, errno, strerror(errno),
+ zFSOptErrNoExist, fname, pOD->pz_Name);
+ pOpts->pUsageProc(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+ }
+ /* FALLTHROUGH */
+
+ default:
+ case FTYPE_MODE_MAY_EXIST:
+ {
+ char * p = strrchr(fname, DIRCH);
+ size_t l;
+
+ if (p == NULL)
+ /*
+ * The file may or may not exist and its directory is ".".
+ * Assume that "." exists.
+ */
+ break;
+
+ l = p - fname;
+ p = AGALOC(l + 1, "fname");
+ memcpy(p, fname, l);
+ p[l] = NUL;
+
+ if ((stat(p, &sb) != 0) || (errno = EINVAL, ! S_ISDIR(sb.st_mode))) {
+ fprintf(stderr, zFSOptError, errno, strerror(errno),
+ zFSOptErrMayExist, fname, pOD->pz_Name);
+ pOpts->pUsageProc(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+ }
+ AGFREE(p);
+ break;
+ }
+
+ case FTYPE_MODE_MUST_EXIST:
+ if ( (stat(fname, &sb) != 0)
+ || (errno = EINVAL, ! S_ISREG(sb.st_mode)) ) {
+ fprintf(stderr, zFSOptError, errno, strerror(errno),
+ zFSOptErrMustExist, fname,
+ pOD->pz_Name);
+ pOpts->pUsageProc(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+ }
+ break;
+ }
+}
+
+/**
+ * Open the specified file with open(2) and save the FD.
+ *
+ * @param pOpts program option descriptor
+ * @param pOD the option descriptor
+ * @param mode the open mode (uses int flags value)
+ */
+static void
+open_file_fd(tOptions * pOpts, tOptDesc * pOD, tuFileMode mode)
+{
+ int fd = open(pOD->optArg.argString, mode.file_flags);
+ if (fd < 0) {
+ fprintf(stderr, zFSOptError, errno, strerror(errno),
+ zFSOptErrOpen, pOD->optArg.argString, pOD->pz_Name);
+ pOpts->pUsageProc(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+ }
+
+ if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0)
+ pOD->optCookie = (void *)pOD->optArg.argString;
+ else
+ AGDUPSTR(pOD->optCookie, pOD->optArg.argString, "file name");
+
+ pOD->optArg.argFd = fd;
+ pOD->fOptState &= ~OPTST_ALLOC_ARG;
+}
+
+/**
+ * Open the specified file with open(2) and save the FD.
+ *
+ * @param pOpts program option descriptor
+ * @param pOD the option descriptor
+ * @param mode the open mode (uses "char *" mode value)
+ */
+static void
+fopen_file_fp(tOptions * pOpts, tOptDesc * pOD, tuFileMode mode)
+{
+ FILE* fp = fopen(pOD->optArg.argString, mode.file_mode);
+ if (fp == NULL) {
+ fprintf(stderr, zFSOptError, errno, strerror(errno),
+ zFSOptErrFopen, pOD->optArg.argString, pOD->pz_Name);
+ pOpts->pUsageProc(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+ }
+
+ if ((pOD->fOptState & OPTST_ALLOC_ARG) != 0)
+ pOD->optCookie = (void *)pOD->optArg.argString;
+ else
+ AGDUPSTR(pOD->optCookie, pOD->optArg.argString, "file name");
+
+ pOD->optArg.argFp = fp;
+ pOD->fOptState &= ~OPTST_ALLOC_ARG;
+}
+
+/*=export_func optionFileCheck
+ * private:
+ *
+ * what: Decipher a boolean value
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ * arg: + teOptFileType + ftype + File handling type +
+ * arg: + tuFileMode + mode + file open mode (if needed) +
+ *
+ * doc:
+ * Make sure the named file conforms with the file type mode.
+ * The mode specifies if the file must exist, must not exist or may
+ * (or may not) exist. The mode may also specify opening the
+ * file: don't, open just the descriptor (fd), or open as a stream
+ * (FILE* pointer).
+=*/
+void
+optionFileCheck(tOptions * pOpts, tOptDesc * pOD,
+ teOptFileType ftype, tuFileMode mode)
+{
+ if (pOpts <= OPTPROC_EMIT_LIMIT) {
+ if (pOpts != OPTPROC_EMIT_USAGE)
+ return;
+
+ switch (ftype & FTYPE_MODE_EXIST_MASK) {
+ case FTYPE_MODE_MUST_NOT_EXIST:
+ fputs(zFileCannotExist, option_usage_fp);
+ break;
+
+ case FTYPE_MODE_MUST_EXIST:
+ fputs(zFileMustExist, option_usage_fp);
+ break;
+ }
+ return;
+ }
+
+ if ((pOD->fOptState & OPTST_RESET) != 0) {
+ if (pOD->optCookie != NULL)
+ AGFREE(pOD->optCookie);
+ return;
+ }
+
+ check_existence(ftype, pOpts, pOD);
+
+ switch (ftype & FTYPE_MODE_OPEN_MASK) {
+ default:
+ case FTYPE_MODE_NO_OPEN: break;
+ case FTYPE_MODE_OPEN_FD: open_file_fd( pOpts, pOD, mode); break;
+ case FTYPE_MODE_FOPEN_FP: fopen_file_fp(pOpts, pOD, mode); break;
+ }
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/file.c */
diff --git a/autoopts/find.c b/autoopts/find.c
new file mode 100644
index 0000000..b9e88d5
--- /dev/null
+++ b/autoopts/find.c
@@ -0,0 +1,579 @@
+/**
+ * @file check.c
+ *
+ * @brief Hunt for options in the option descriptor list
+ *
+ * Time-stamp: "2012-08-11 08:36:11 bkorb"
+ *
+ * This file contains the routines that deal with processing quoted strings
+ * into an internal format.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/**
+ * find the name and name length we are looking for
+ */
+static int
+parse_opt(char const ** nm_pp, char ** arg_pp, char * buf, size_t bufsz)
+{
+ int res = 0;
+ char const * p = *nm_pp;
+ *arg_pp = NULL;
+
+ for (;;) {
+ switch (*(p++)) {
+ case NUL: return res;
+
+ case '=':
+ memcpy(buf, *nm_pp, res);
+
+ buf[res] = NUL;
+ *nm_pp = buf;
+ *arg_pp = (char *)p;
+ return res;
+
+ default:
+ if (++res >= (int)bufsz)
+ return -1;
+ }
+ }
+}
+
+/**
+ * print out the options that match the given name.
+ *
+ * @param pOpts option data
+ * @param opt_name name of option to look for
+ */
+static void
+opt_ambiguities(tOptions * opts, char const * name, int nm_len)
+{
+ char const * const hyph =
+ NAMED_OPTS(opts) ? "" : LONG_OPT_MARKER;
+
+ tOptDesc * pOD = opts->pOptDesc;
+ int idx = 0;
+
+ fputs(zAmbigList, stderr);
+ do {
+ if (strneqvcmp(name, pOD->pz_Name, nm_len) == 0)
+ fprintf(stderr, zAmbiguous, hyph, pOD->pz_Name);
+
+ else if ( (pOD->pz_DisableName != NULL)
+ && (strneqvcmp(name, pOD->pz_DisableName, nm_len) == 0)
+ )
+ fprintf(stderr, zAmbiguous, hyph, pOD->pz_DisableName);
+ } while (pOD++, (++idx < opts->optCt));
+}
+
+/**
+ * Determine the number of options that match the name
+ *
+ * @param pOpts option data
+ * @param opt_name name of option to look for
+ * @param nm_len length of provided name
+ * @param index pointer to int for option index
+ * @param disable pointer to bool to mark disabled option
+ * @return count of options that match
+ */
+static int
+opt_match_ct(tOptions * opts, char const * name, int nm_len,
+ int * ixp, bool * disable)
+{
+ int matchCt = 0;
+ int idx = 0;
+ int idxLim = opts->optCt;
+ tOptDesc * pOD = opts->pOptDesc;
+
+ do {
+ /*
+ * If option disabled or a doc option, skip to next
+ */
+ if (pOD->pz_Name == NULL)
+ continue;
+
+ if ( SKIP_OPT(pOD)
+ && (pOD->fOptState != (OPTST_OMITTED | OPTST_NO_INIT)))
+ continue;
+
+ if (strneqvcmp(name, pOD->pz_Name, nm_len) == 0) {
+ /*
+ * IF we have a complete match
+ * THEN it takes priority over any already located partial
+ */
+ if (pOD->pz_Name[ nm_len ] == NUL) {
+ *ixp = idx;
+ return 1;
+ }
+ }
+
+ /*
+ * IF there is a disable name
+ * *AND* the option name matches the disable name
+ * THEN ...
+ */
+ else if ( (pOD->pz_DisableName != NULL)
+ && (strneqvcmp(name, pOD->pz_DisableName, nm_len) == 0)
+ ) {
+ *disable = true;
+
+ /*
+ * IF we have a complete match
+ * THEN it takes priority over any already located partial
+ */
+ if (pOD->pz_DisableName[ nm_len ] == NUL) {
+ *ixp = idx;
+ return 1;
+ }
+ }
+
+ else
+ continue; /* does not match any option */
+
+ /*
+ * We found a full or partial match, either regular or disabling.
+ * Remember the index for later.
+ */
+ *ixp = idx;
+ ++matchCt;
+
+ } while (pOD++, (++idx < idxLim));
+
+ return matchCt;
+}
+
+/**
+ * Set the option to the indicated option number.
+ *
+ * @param opts option data
+ * @param arg option argument (if glued to name)
+ * @param idx option index
+ * @param disable mark disabled option
+ * @param st state about current option
+ */
+static tSuccess
+opt_set(tOptions * opts, char * arg, int idx, bool disable, tOptState * st)
+{
+ tOptDesc * pOD = opts->pOptDesc + idx;
+
+ if (SKIP_OPT(pOD)) {
+ if ((opts->fOptSet & OPTPROC_ERRSTOP) == 0)
+ return FAILURE;
+
+ fprintf(stderr, zDisabledErr, opts->pzProgName, pOD->pz_Name);
+ if (pOD->pzText != NULL)
+ fprintf(stderr, SET_OFF_FMT, pOD->pzText);
+ fputc(NL, stderr);
+ (*opts->pUsageProc)(opts, EXIT_FAILURE);
+ /* NOTREACHED */
+ _exit(EXIT_FAILURE); /* to be certain */
+ }
+
+ /*
+ * IF we found a disablement name,
+ * THEN set the bit in the callers' flag word
+ */
+ if (disable)
+ st->flags |= OPTST_DISABLED;
+
+ st->pOD = pOD;
+ st->pzOptArg = arg;
+ st->optType = TOPT_LONG;
+
+ return SUCCESS;
+}
+
+/**
+ * An option was not found. Check for default option and set it
+ * if there is one. Otherwise, handle the error.
+ *
+ * @param opts option data
+ * @param name name of option to look for
+ * @param arg option argument
+ * @param st state about current option
+ *
+ * @return success status
+ */
+static tSuccess
+opt_unknown(tOptions * opts, char const * name, char * arg, tOptState * st)
+{
+ /*
+ * IF there is no equal sign
+ * *AND* we are using named arguments
+ * *AND* there is a default named option,
+ * THEN return that option.
+ */
+ if ( (arg == NULL)
+ && NAMED_OPTS(opts)
+ && (opts->specOptIdx.default_opt != NO_EQUIVALENT)) {
+
+ st->pOD = opts->pOptDesc + opts->specOptIdx.default_opt;
+ st->pzOptArg = name;
+ st->optType = TOPT_DEFAULT;
+ return SUCCESS;
+ }
+
+ if ((opts->fOptSet & OPTPROC_ERRSTOP) != 0) {
+ fprintf(stderr, zIllOptStr, opts->pzProgPath, name);
+ (*opts->pUsageProc)(opts, EXIT_FAILURE);
+ /* NOTREACHED */
+ _exit(EXIT_FAILURE); /* to be certain */
+ }
+
+ return FAILURE;
+}
+
+/**
+ * Several options match the provided name.
+ *
+ * @param opts option data
+ * @param name name of option to look for
+ * @param match_ct number of matching options
+ *
+ * @return success status (always FAILURE, if it returns)
+ */
+static tSuccess
+opt_ambiguous(tOptions * opts, char const * name, int match_ct)
+{
+ if ((opts->fOptSet & OPTPROC_ERRSTOP) != 0) {
+ fprintf(stderr, zAmbigOptStr, opts->pzProgPath, name, match_ct);
+ if (match_ct <= 4)
+ opt_ambiguities(opts, name, strlen(name));
+ (*opts->pUsageProc)(opts, EXIT_FAILURE);
+ /* NOTREACHED */
+ _exit(EXIT_FAILURE); /* to be certain */
+ }
+ return FAILURE;
+}
+
+/*=export_func optionVendorOption
+ * private:
+ *
+ * what: Process a vendor option
+ * arg: + tOptions * + pOpts + program options descriptor +
+ * arg: + tOptDesc * + pOptDesc + the descriptor for this arg +
+ *
+ * doc:
+ * For POSIX specified utilities, the options are constrained to the options,
+ * @xref{config attributes, Program Configuration}. AutoOpts clients should
+ * never specify this directly. It gets referenced when the option
+ * definitions contain a "vendor-opt" attribute.
+=*/
+void
+optionVendorOption(tOptions * pOpts, tOptDesc * pOD)
+{
+ tOptState opt_st = OPTSTATE_INITIALIZER(PRESET);
+ char const * vopt_str = pOD->optArg.argString;
+
+ if (pOpts <= OPTPROC_EMIT_LIMIT)
+ return;
+
+ if ((pOD->fOptState & OPTST_RESET) != 0)
+ return;
+
+ if ((pOD->fOptState & OPTPROC_IMMEDIATE) == 0)
+ opt_st.flags = OPTST_DEFINED;
+
+ if ( ((pOpts->fOptSet & OPTPROC_VENDOR_OPT) == 0)
+ || ! SUCCESSFUL(opt_find_long(pOpts, vopt_str, &opt_st))
+ || ! SUCCESSFUL(get_opt_arg(pOpts, &opt_st)) )
+ {
+ fprintf(stderr, zIllVendOptStr, pOpts->pzProgName, vopt_str);
+ (*pOpts->pUsageProc)(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+ _exit(EXIT_FAILURE); /* to be certain */
+ }
+
+ /*
+ * See if we are in immediate handling state.
+ */
+ if (pOpts->fOptSet & OPTPROC_IMMEDIATE) {
+ /*
+ * See if the enclosed option is okay with that state.
+ */
+ if (DO_IMMEDIATELY(opt_st.flags))
+ (void)handle_opt(pOpts, &opt_st);
+
+ } else {
+ /*
+ * non-immediate direction.
+ * See if the enclosed option is okay with that state.
+ */
+ if (DO_NORMALLY(opt_st.flags) || DO_SECOND_TIME(opt_st.flags))
+ (void)handle_opt(pOpts, &opt_st);
+ }
+}
+
+/**
+ * Find the option descriptor by full name.
+ *
+ * @param opts option data
+ * @param opt_name name of option to look for
+ * @param state state about current option
+ *
+ * @return success status
+ */
+LOCAL tSuccess
+opt_find_long(tOptions * opts, char const * opt_name, tOptState * state)
+{
+ char name_buf[128];
+ char * opt_arg;
+ int nm_len = parse_opt(&opt_name, &opt_arg, name_buf, sizeof(name_buf));
+
+ int idx = 0;
+ bool disable = false;
+ int ct;
+
+ if (nm_len <= 0) {
+ fprintf(stderr, zInvalOptName, opts->pzProgName, opt_name);
+ (*opts->pUsageProc)(opts, EXIT_FAILURE);
+ /* NOTREACHED */
+ _exit(EXIT_FAILURE); /* to be certain */
+ }
+
+ ct = opt_match_ct(opts, opt_name, nm_len, &idx, &disable);
+
+ /*
+ * See if we found one match, no matches or multiple matches.
+ */
+ switch (ct) {
+ case 1: return opt_set(opts, opt_arg, idx, disable, state);
+ case 0: return opt_unknown(opts, opt_name, opt_arg, state);
+ default: return opt_ambiguous(opts, opt_name, ct);
+ }
+}
+
+
+/**
+ * Find the short option descriptor for the current option
+ *
+ * @param pOpts option data
+ * @param optValue option flag character
+ * @param pOptState state about current option
+ */
+LOCAL tSuccess
+opt_find_short(tOptions* pOpts, uint_t optValue, tOptState* pOptState)
+{
+ tOptDesc* pRes = pOpts->pOptDesc;
+ int ct = pOpts->optCt;
+
+ /*
+ * Search the option list
+ */
+ do {
+ if (optValue != pRes->optValue)
+ continue;
+
+ if (SKIP_OPT(pRes)) {
+ if ( (pRes->fOptState == (OPTST_OMITTED | OPTST_NO_INIT))
+ && (pRes->pz_Name != NULL)) {
+ fprintf(stderr, zDisabledErr, pOpts->pzProgPath, pRes->pz_Name);
+ if (pRes->pzText != NULL)
+ fprintf(stderr, SET_OFF_FMT, pRes->pzText);
+ fputc(NL, stderr);
+ (*pOpts->pUsageProc)(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+ _exit(EXIT_FAILURE); /* to be certain */
+ }
+ goto short_opt_error;
+ }
+
+ pOptState->pOD = pRes;
+ pOptState->optType = TOPT_SHORT;
+ return SUCCESS;
+
+ } while (pRes++, --ct > 0);
+
+ /*
+ * IF the character value is a digit
+ * AND there is a special number option ("-n")
+ * THEN the result is the "option" itself and the
+ * option is the specially marked "number" option.
+ */
+ if ( IS_DEC_DIGIT_CHAR(optValue)
+ && (pOpts->specOptIdx.number_option != NO_EQUIVALENT) ) {
+ pOptState->pOD = \
+ pRes = pOpts->pOptDesc + pOpts->specOptIdx.number_option;
+ (pOpts->pzCurOpt)--;
+ pOptState->optType = TOPT_SHORT;
+ return SUCCESS;
+ }
+
+short_opt_error:
+
+ /*
+ * IF we are to stop on errors (the default, actually)
+ * THEN call the usage procedure.
+ */
+ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0) {
+ fprintf(stderr, zIllOptChr, pOpts->pzProgPath, optValue);
+ (*pOpts->pUsageProc)(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+ _exit(EXIT_FAILURE); /* to be certain */
+ }
+
+ return FAILURE;
+}
+
+LOCAL tSuccess
+get_opt_arg(tOptions * pOpts, tOptState * pOptState)
+{
+ pOptState->flags |= (pOptState->pOD->fOptState & OPTST_PERSISTENT_MASK);
+
+ /*
+ * Figure out what to do about option arguments. An argument may be
+ * required, not associated with the option, or be optional. We detect the
+ * latter by examining for an option marker on the next possible argument.
+ * Disabled mode option selection also disables option arguments.
+ */
+ {
+ enum { ARG_NONE, ARG_MAY, ARG_MUST } arg_type = ARG_NONE;
+ tSuccess res;
+
+ if ((pOptState->flags & OPTST_DISABLED) != 0)
+ arg_type = ARG_NONE;
+
+ else if (OPTST_GET_ARGTYPE(pOptState->flags) == OPARG_TYPE_NONE)
+ arg_type = ARG_NONE;
+
+ else if (pOptState->flags & OPTST_ARG_OPTIONAL)
+ arg_type = ARG_MAY;
+
+ else
+ arg_type = ARG_MUST;
+
+ switch (arg_type) {
+ case ARG_MUST: res = next_opt_arg_must(pOpts, pOptState); break;
+ case ARG_MAY: res = next_opt_arg_may( pOpts, pOptState); break;
+ case ARG_NONE: res = next_opt_arg_none(pOpts, pOptState); break;
+ }
+
+ return res;
+ }
+}
+
+/**
+ * Find the option descriptor for the current option
+ */
+LOCAL tSuccess
+find_opt(tOptions * pOpts, tOptState * pOptState)
+{
+ /*
+ * IF we are continuing a short option list (e.g. -xyz...)
+ * THEN continue a single flag option.
+ * OTHERWISE see if there is room to advance and then do so.
+ */
+ if ((pOpts->pzCurOpt != NULL) && (*pOpts->pzCurOpt != NUL))
+ return opt_find_short(pOpts, (tAoUC)*(pOpts->pzCurOpt), pOptState);
+
+ if (pOpts->curOptIdx >= pOpts->origArgCt)
+ return PROBLEM; /* NORMAL COMPLETION */
+
+ pOpts->pzCurOpt = pOpts->origArgVect[ pOpts->curOptIdx ];
+
+ /*
+ * IF all arguments must be named options, ...
+ */
+ if (NAMED_OPTS(pOpts)) {
+ char * pz = pOpts->pzCurOpt;
+ int def;
+ tSuccess res;
+ tAoUS * def_opt;
+
+ pOpts->curOptIdx++;
+
+ if (*pz != '-')
+ return opt_find_long(pOpts, pz, pOptState);
+
+ /*
+ * The name is prefixed with one or more hyphens. Strip them off
+ * and disable the "default_opt" setting. Use heavy recasting to
+ * strip off the "const" quality of the "default_opt" field.
+ */
+ while (*(++pz) == '-') ;
+ def_opt = (void *)&(pOpts->specOptIdx.default_opt);
+ def = *def_opt;
+ *def_opt = NO_EQUIVALENT;
+ res = opt_find_long(pOpts, pz, pOptState);
+ *def_opt = def;
+ return res;
+ }
+
+ /*
+ * Note the kind of flag/option marker
+ */
+ if (*((pOpts->pzCurOpt)++) != '-')
+ return PROBLEM; /* NORMAL COMPLETION - this + rest are operands */
+
+ /*
+ * Special hack for a hyphen by itself
+ */
+ if (*(pOpts->pzCurOpt) == NUL)
+ return PROBLEM; /* NORMAL COMPLETION - this + rest are operands */
+
+ /*
+ * The current argument is to be processed as an option argument
+ */
+ pOpts->curOptIdx++;
+
+ /*
+ * We have an option marker.
+ * Test the next character for long option indication
+ */
+ if (pOpts->pzCurOpt[0] == '-') {
+ if (*++(pOpts->pzCurOpt) == NUL)
+ /*
+ * NORMAL COMPLETION - NOT this arg, but rest are operands
+ */
+ return PROBLEM;
+
+ /*
+ * We do not allow the hyphen to be used as a flag value.
+ * Therefore, if long options are not to be accepted, we punt.
+ */
+ if ((pOpts->fOptSet & OPTPROC_LONGOPT) == 0) {
+ fprintf(stderr, zIllOptStr, pOpts->pzProgPath,
+ pOpts->pzCurOpt-2);
+ return FAILURE;
+ }
+
+ return opt_find_long(pOpts, pOpts->pzCurOpt, pOptState);
+ }
+
+ /*
+ * If short options are not allowed, then do long
+ * option processing. Otherwise the character must be a
+ * short (i.e. single character) option.
+ */
+ if ((pOpts->fOptSet & OPTPROC_SHORTOPT) != 0)
+ return opt_find_short(pOpts, (tAoUC)*(pOpts->pzCurOpt), pOptState);
+
+ return opt_find_long(pOpts, pOpts->pzCurOpt, pOptState);
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/find.c */
diff --git a/autoopts/funcs.def b/autoopts/funcs.def
new file mode 100644
index 0000000..3696339
--- /dev/null
+++ b/autoopts/funcs.def
@@ -0,0 +1,1620 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ *
+ * DO NOT EDIT THIS FILE (funcs.def)
+ *
+ * It has been extracted by getdefs from the following files:
+ *
+ * autoopts.c
+ * alias.c
+ * boolean.c
+ * check.c
+ * configfile.c
+ * cook.c
+ * enum.c
+ * env.c
+ * file.c
+ * find.c
+ * genshell.c
+ * load.c
+ * makeshell.c
+ * nested.c
+ * numeric.c
+ * pgusage.c
+ * putshell.c
+ * reset.c
+ * restore.c
+ * save.c
+ * sort.c
+ * stack.c
+ * streqvcmp.c
+ * text_mmap.c
+ * time.c
+ * tokenize.c
+ * usage.c
+ * version.c
+ * ../compat/pathfind.c
+ */
+autogen definitions options_h;
+
+/* GLOBALDEFS */
+
+#line 594 "autoopts.c"
+ library = 'opts';
+ header = 'your-opts.h';
+ lib_description =
+'These are the routines that libopts users may call directly from their
+code. There are several other routines that can be called by code
+generated by the libopts option templates, but they are not to be
+called from any other user code. The @file{options.h} header is
+fairly clear about this, too.';
+
+
+#line 206 "cook.c"
+export_func = {
+ name = 'ao_string_cook';
+ private;
+ what = 'concatenate and escape-process strings';
+ arg = {
+ arg_type = 'char*';
+ arg_name = 'pzScan';
+ arg_desc = 'The *MODIFIABLE* input buffer';
+ };
+ arg = {
+ arg_type = 'int*';
+ arg_name = 'lnct_p';
+ arg_desc = 'The (possibly NULL) pointer to a line count';
+ };
+ ret-type = 'char*';
+ ret-desc = 'The address of the text following the processed strings.
+The return value is NULL if the strings are ill-formed.';
+ doc =
+'A series of one or more quoted strings are concatenated together.
+If they are quoted with double quotes (@code{"}), then backslash
+escapes are processed per the C programming language. If they are
+single quote strings, then the backslashes are honored only when they
+precede another backslash or a single quote character.';
+ err = '@code{NULL} is returned if the string(s) is/are mal-formed.';
+ srcfile = 'cook.c';
+ linenum = '206';
+};
+
+
+#line 35 "cook.c"
+export_func = {
+ name = 'ao_string_cook_escape_char';
+ private;
+ what = 'escape-process a string fragment';
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'pzScan';
+ arg_desc = 'points to character after the escape';
+ };
+ arg = {
+ arg_type = 'char*';
+ arg_name = 'pRes';
+ arg_desc = 'Where to put the result byte';
+ };
+ arg = {
+ arg_type = 'unsigned int';
+ arg_name = 'nl_ch';
+ arg_desc = 'replacement char if scanned char is \n';
+ };
+ ret-type = 'unsigned int';
+ ret-desc = 'The number of bytes consumed processing the escaped character.';
+ doc =
+'This function converts "t" into "\\t" and all your other favorite
+escapes, including numeric ones: hex and ocatal, too.
+The returned result tells the caller how far to advance the
+scan pointer (passed in). The default is to just pass through the
+escaped character and advance the scan by one.
+
+Some applications need to keep an escaped newline, others need to
+suppress it. This is accomplished by supplying a \'\\n\' replacement
+character that is different from \\n, if need be. For example, use
+0x7F and never emit a 0x7F.';
+ err = '@code{NULL} is returned if the string is mal-formed.';
+ srcfile = 'cook.c';
+ linenum = '35';
+};
+
+
+#line 164 "tokenize.c"
+export_func = {
+ name = 'ao_string_tokenize';
+ what = 'tokenize an input string';
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'string';
+ arg_desc = 'string to be tokenized';
+ };
+ ret_type = 'token_list_t*';
+ ret_desc = 'pointer to a structure that lists each token';
+ doc =
+'This function will convert one input string into a list of strings.
+The list of strings is derived by separating the input based on
+white space separation. However, if the input contains either single
+or double quote characters, then the text after that character up to
+a matching quote will become the string in the list.
+
+The returned pointer should be deallocated with @code{free(3C)} when
+are done using the data. The data are placed in a single block of
+allocated memory. Do not deallocate individual token/strings.
+
+The structure pointed to will contain at least these two fields:
+@table @samp
+@item tkn_ct
+The number of tokens found in the input string.
+@item tok_list
+An array of @code{tkn_ct + 1} pointers to substring tokens, with
+the last pointer set to NULL.
+@end table
+
+There are two types of quoted strings: single quoted (@code{\'}) and
+double quoted (@code{"}). Singly quoted strings are fairly raw in that
+escape characters (@code{\\\\}) are simply another character, except when
+preceding the following characters:
+@example
+@code{\\\\} double backslashes reduce to one
+@code{\'} incorporates the single quote into the string
+@code{\\n} suppresses both the backslash and newline character
+@end example
+
+Double quote strings are formed according to the rules of string
+constants in ANSI-C programs.';
+ example =
+'@example
+#include <stdlib.h>
+int ix;
+token_list_t* ptl = ao_string_tokenize(some_string)
+for (ix = 0; ix < ptl->tkn_ct; ix++)
+do_something_with_tkn(ptl->tkn_list[ix]);
+free(ptl);
+@end example
+Note that everything is freed with the one call to @code{free(3C)}.';
+ err =
+'NULL is returned and @code{errno} will be set to indicate the problem:
+@itemize @bullet
+@item
+@code{EINVAL} - There was an unterminated quoted string.
+@item
+@code{ENOENT} - The input string was empty.
+@item
+@code{ENOMEM} - There is not enough memory.
+@end itemize';
+ srcfile = 'tokenize.c';
+ linenum = '164';
+};
+
+
+#line 77 "configfile.c"
+export_func = {
+ name = 'configFileLoad';
+ what = 'parse a configuration file';
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'pzFile';
+ arg_desc = 'the file to load';
+ };
+ ret_type = 'const tOptionValue*';
+ ret_desc = 'An allocated, compound value structure';
+ doc =
+'This routine will load a named configuration file and parse the
+text as a hierarchically valued option. The option descriptor
+created from an option definition file is not used via this interface.
+The returned value is "named" with the input file name and is of
+type "@code{OPARG_TYPE_HIERARCHY}". It may be used in calls to
+@code{optionGetValue()}, @code{optionNextValue()} and
+@code{optionUnloadNested()}.';
+ err =
+'If the file cannot be loaded or processed, @code{NULL} is returned and
+@var{errno} is set. It may be set by a call to either @code{open(2)}
+@code{mmap(2)} or other file system calls, or it may be:
+@itemize @bullet
+@item
+@code{ENOENT} - the file was not found.
+@item
+@code{ENOMSG} - the file was empty.
+@item
+@code{EINVAL} - the file contents are invalid -- not properly formed.
+@item
+@code{ENOMEM} - not enough memory to allocate the needed structures.
+@end itemize';
+ srcfile = 'configfile.c';
+ linenum = '77';
+};
+
+
+#line 765 "makeshell.c"
+export_func = {
+ name = 'genshelloptUsage';
+ private;
+ what = 'The usage function for the genshellopt generated program';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'int';
+ arg_name = 'exitCode';
+ arg_desc = 'usage text type to produce';
+ };
+ doc =
+'This function is used to create the usage strings for the option
+processing shell script code. Two child processes are spawned
+each emitting the usage text in either the short (error exit)
+style or the long style. The generated program will capture this
+and create shell script variables containing the two types of text.';
+ srcfile = 'makeshell.c';
+ linenum = '765';
+};
+
+
+#line 32 "alias.c"
+export_func = {
+ name = 'optionAlias';
+ private;
+ what = 'relay an option to its alias';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ arg = {
+ arg_type = 'unsigned int';
+ arg_name = 'alias';
+ arg_desc = 'the aliased-to option index';
+ };
+ ret-type = 'int';
+ doc =
+'Handle one option as if it had been specified as another. Exactly.
+Returns "-1" if the aliased-to option has appeared too many times.';
+ srcfile = 'alias.c';
+ linenum = '32';
+};
+
+
+#line 33 "boolean.c"
+export_func = {
+ name = 'optionBooleanVal';
+ private;
+ what = 'Decipher a boolean value';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ doc =
+'Decipher a true or false value for a boolean valued option argument.
+The value is true, unless it starts with \'n\' or \'f\' or "#f" or
+it is an empty string or it is a number that evaluates to zero.';
+ srcfile = 'boolean.c';
+ linenum = '33';
+};
+
+
+#line 260 "enum.c"
+export_func = {
+ name = 'optionEnumerationVal';
+ what = 'Convert from a string to an enumeration value';
+ private;
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'the program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOD';
+ arg_desc = 'enumeration option description';
+ };
+ arg = {
+ arg_type = 'char const * const *';
+ arg_name = 'paz_names';
+ arg_desc = 'list of enumeration names';
+ };
+ arg = {
+ arg_type = 'unsigned int';
+ arg_name = 'name_ct';
+ arg_desc = 'number of names in list';
+ };
+ ret_type = 'uintptr_t';
+ ret_desc = 'the enumeration value';
+ doc = 'This converts the optArg.argString string from the option description
+into the index corresponding to an entry in the name list.
+This will match the generated enumeration value.
+Full matches are always accepted. Partial matches are accepted
+if there is only one partial match.';
+ srcfile = 'enum.c';
+ linenum = '260';
+};
+
+
+#line 151 "file.c"
+export_func = {
+ name = 'optionFileCheck';
+ private;
+ what = 'Decipher a boolean value';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ arg = {
+ arg_type = 'teOptFileType';
+ arg_name = 'ftype';
+ arg_desc = 'File handling type';
+ };
+ arg = {
+ arg_type = 'tuFileMode';
+ arg_name = 'mode';
+ arg_desc = 'file open mode (if needed)';
+ };
+ doc =
+'Make sure the named file conforms with the file type mode.
+The mode specifies if the file must exist, must not exist or may
+(or may not) exist. The mode may also specify opening the';
+ file = 'don\'t, open just the descriptor (fd), or open as a stream
+(FILE* pointer).';
+ srcfile = 'file.c';
+ linenum = '151';
+};
+
+
+#line 1066 "configfile.c"
+export_func = {
+ name = 'optionFileLoad';
+ what = 'Load the locatable config files, in order';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'pzProg';
+ arg_desc = 'program name';
+ };
+ ret_type = 'int';
+ ret_desc = '0 -> SUCCESS, -1 -> FAILURE';
+ doc =
+'This function looks in all the specified directories for a configuration
+file ("rc" file or "ini" file) and processes any found twice. The first
+time through, they are processed in reverse order (last file first). At
+that time, only "immediate action" configurables are processed. For
+example, if the last named file specifies not processing any more
+configuration files, then no more configuration files will be processed.
+Such an option in the @strong{first} named directory will have no effect.
+
+Once the immediate action configurables have been handled, then the
+directories are handled in normal, forward order. In that way, later
+config files can override the settings of earlier config files.
+
+See the AutoOpts documentation for a thorough discussion of the
+config file format.
+
+Configuration files not found or not decipherable are simply ignored.';
+ err = 'Returns the value, "-1" if the program options descriptor
+is out of date or indecipherable. Otherwise, the value "0" will
+always be returned.';
+ srcfile = 'configfile.c';
+ linenum = '1066';
+};
+
+
+#line 211 "configfile.c"
+export_func = {
+ name = 'optionFindNextValue';
+ FIXME = 'the handling of \'pzName\' and \'pzVal\' is just wrong.';
+ what = 'find a hierarcicaly valued option instance';
+ arg = {
+ arg_type = 'const tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'an option with a nested arg type';
+ };
+ arg = {
+ arg_type = 'const tOptionValue*';
+ arg_name = 'pPrevVal';
+ arg_desc = 'the last entry';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'name';
+ arg_desc = 'name of value to find';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'value';
+ arg_desc = 'the matching value';
+ };
+ ret_type = 'const tOptionValue*';
+ ret_desc = 'a compound value structure';
+ doc =
+'This routine will find the next entry in a nested value option or
+configurable. It will search through the list and return the next entry
+that matches the criteria.';
+ err =
+'The returned result is NULL and errno is set:
+@itemize @bullet
+@item
+@code{EINVAL} - the @code{pOptValue} does not point to a valid
+hierarchical option value.
+@item
+@code{ENOENT} - no entry matched the given name.
+@end itemize';
+ srcfile = 'configfile.c';
+ linenum = '211';
+};
+
+
+#line 137 "configfile.c"
+export_func = {
+ name = 'optionFindValue';
+ what = 'find a hierarcicaly valued option instance';
+ arg = {
+ arg_type = 'const tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'an option with a nested arg type';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'name';
+ arg_desc = 'name of value to find';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'value';
+ arg_desc = 'the matching value';
+ };
+ ret_type = 'const tOptionValue*';
+ ret_desc = 'a compound value structure';
+ doc =
+'This routine will find an entry in a nested value option or configurable.
+It will search through the list and return a matching entry.';
+ err =
+'The returned result is NULL and errno is set:
+@itemize @bullet
+@item
+@code{EINVAL} - the @code{pOptValue} does not point to a valid
+hierarchical option value.
+@item
+@code{ENOENT} - no entry matched the given name.
+@end itemize';
+ srcfile = 'configfile.c';
+ linenum = '137';
+};
+
+
+#line 166 "restore.c"
+export_func = {
+ name = 'optionFree';
+ what = 'free allocated option processing memory';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ doc = 'AutoOpts sometimes allocates memory and puts pointers to it in the
+option state structures. This routine deallocates all such memory.';
+ err = 'As long as memory has not been corrupted,
+this routine is always successful.';
+ srcfile = 'restore.c';
+ linenum = '166';
+};
+
+
+#line 280 "configfile.c"
+export_func = {
+ name = 'optionGetValue';
+ what = 'get a specific value from a hierarcical list';
+ arg = {
+ arg_type = 'const tOptionValue*';
+ arg_name = 'pOptValue';
+ arg_desc = 'a hierarchcal value';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'valueName';
+ arg_desc = 'name of value to get';
+ };
+ ret_type = 'const tOptionValue*';
+ ret_desc = 'a compound value structure';
+ doc =
+'This routine will find an entry in a nested value option or configurable.
+If "valueName" is NULL, then the first entry is returned. Otherwise,
+the first entry with a name that exactly matches the argument will be
+returned. If there is no matching value, NULL is returned and errno is
+set to ENOENT. If the provided option value is not a hierarchical value,
+NULL is also returned and errno is set to EINVAL.';
+ err =
+'The returned result is NULL and errno is set:
+@itemize @bullet
+@item
+@code{EINVAL} - the @code{pOptValue} does not point to a valid
+hierarchical option value.
+@item
+@code{ENOENT} - no entry matched the given name.
+@end itemize';
+ srcfile = 'configfile.c';
+ linenum = '280';
+};
+
+
+#line 237 "enum.c"
+export_func = {
+ name = 'optionKeywordName';
+ what = 'Convert between enumeration values and strings';
+ private;
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOD';
+ arg_desc = 'enumeration option description';
+ };
+ arg = {
+ arg_type = 'unsigned int';
+ arg_name = 'enum_val';
+ arg_desc = 'the enumeration value to map';
+ };
+ ret_type = 'char const *';
+ ret_desc = 'the enumeration name from const memory';
+ doc = 'This converts an enumeration value into the matching string.';
+ srcfile = 'enum.c';
+ linenum = '237';
+};
+
+
+#line 478 "load.c"
+export_func = {
+ name = 'optionLoadLine';
+ what = 'process a string for an option name and value';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'opts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'line';
+ arg_desc = 'NUL-terminated text';
+ };
+ doc =
+'This is a client program callable routine for setting options from, for
+example, the contents of a file that they read in. Only one option may
+appear in the text. It will be treated as a normal (non-preset) option.
+
+When passed a pointer to the option struct and a string, it will find
+the option named by the first token on the string and set the option
+argument to the remainder of the string. The caller must NUL terminate
+the string. The caller need not skip over any introductory hyphens.
+Any embedded new lines will be included in the option
+argument. If the input looks like one or more quoted strings, then the
+input will be "cooked". The "cooking" is identical to the string
+formation used in AutoGen definition files (@pxref{basic expression}),
+except that you may not use backquotes.';
+ err = 'Invalid options are silently ignored. Invalid option arguments
+will cause a warning to print, but the function should return.';
+ srcfile = 'load.c';
+ linenum = '478';
+};
+
+
+#line 1116 "configfile.c"
+export_func = {
+ name = 'optionLoadOpt';
+ private;
+ what = 'Load an option rc/ini file';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ doc =
+'Processes the options found in the file named with
+pOptDesc->optArg.argString.';
+ srcfile = 'configfile.c';
+ linenum = '1116';
+};
+
+
+#line 43 "load.c"
+export_func = {
+ name = 'optionMakePath';
+ private;
+ what = 'translate and construct a path';
+ arg = {
+ arg_type = 'char*';
+ arg_name = 'pzBuf';
+ arg_desc = 'The result buffer';
+ };
+ arg = {
+ arg_type = 'int';
+ arg_name = 'bufSize';
+ arg_desc = 'The size of this buffer';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'pzName';
+ arg_desc = 'The input name';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'pzProgPath';
+ arg_desc = 'The full path of the current program';
+ };
+ ret-type = 'bool';
+ ret-desc = 'true if the name was handled, otherwise false.
+If the name does not start with ``$\'\', then it is handled
+simply by copying the input name to the output buffer and
+resolving the name with either
+@code{canonicalize_file_name(3GLIBC)} or @code{realpath(3C)}.';
+ doc =
+'This routine will copy the @code{pzName} input name into the
+@code{pzBuf} output buffer, not exceeding @code{bufSize} bytes. If the
+first character of the input name is a @code{\'$\'} character, then there
+is special handling:
+@*
+@code{$$} is replaced with the directory name of the @code{pzProgPath},
+searching @code{$PATH} if necessary.
+@*
+@code{$@} is replaced with the AutoGen package data installation directory
+(aka @code{pkgdatadir}).
+@*
+@code{$NAME} is replaced by the contents of the @code{NAME} environment
+variable. If not found, the search fails.
+
+Please note: both @code{$$} and @code{$NAME} must be at the start of the
+@code{pzName} string and must either be the entire string or be followed
+by the @code{\'/\'} (backslash on windows) character.';
+ err = '@code{false} is returned if:
+@*
+@bullet{} The input name exceeds @code{bufSize} bytes.
+@*
+@bullet{} @code{$$}, @code{$@@} or @code{$NAME} is not the full string
+and the next character is not \'/\'.
+@*
+@bullet{} libopts was built without PKGDATADIR defined and @code{$@@}
+was specified.
+@*
+@bullet{} @code{NAME} is not a known environment variable
+@*
+@bullet{} @code{canonicalize_file_name} or @code{realpath} return
+errors (cannot resolve the resulting path).';
+ srcfile = 'load.c';
+ linenum = '43';
+};
+
+
+#line 727 "nested.c"
+export_func = {
+ name = 'optionNestedVal';
+ private;
+ what = 'parse a hierarchical option argument';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ doc =
+'Nested value was found on the command line';
+ srcfile = 'nested.c';
+ linenum = '727';
+};
+
+
+#line 340 "configfile.c"
+export_func = {
+ name = 'optionNextValue';
+ what = 'get the next value from a hierarchical list';
+ arg = {
+ arg_type = 'const tOptionValue*';
+ arg_name = 'pOptValue';
+ arg_desc = 'a hierarchcal list value';
+ };
+ arg = {
+ arg_type = 'const tOptionValue*';
+ arg_name = 'pOldValue';
+ arg_desc = 'a value from this list';
+ };
+ ret_type = 'const tOptionValue*';
+ ret_desc = 'a compound value structure';
+ doc =
+'This routine will return the next entry after the entry passed in. At the
+end of the list, NULL will be returned. If the entry is not found on the
+list, NULL will be returned and "@var{errno}" will be set to EINVAL.
+The "@var{pOldValue}" must have been gotten from a prior call to this
+routine or to "@code{opitonGetValue()}".';
+ err =
+'The returned result is NULL and errno is set:
+@itemize @bullet
+@item
+@code{EINVAL} - the @code{pOptValue} does not point to a valid
+hierarchical option value or @code{pOldValue} does not point to a
+member of that option value.
+@item
+@code{ENOENT} - the supplied @code{pOldValue} pointed to the last entry.
+@end itemize';
+ srcfile = 'configfile.c';
+ linenum = '340';
+};
+
+
+#line 90 "numeric.c"
+export_func = {
+ name = 'optionNumericVal';
+ private;
+ what = 'process an option with a numeric value.';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ doc =
+'Decipher a numeric value.';
+ srcfile = 'numeric.c';
+ linenum = '90';
+};
+
+
+#line 201 "usage.c"
+export_func = {
+ name = 'optionOnlyUsage';
+ what = 'Print usage text for just the options';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'int';
+ arg_name = 'ex_code';
+ arg_desc = 'exit code for calling exit(3)';
+ };
+ doc =
+'This routine will print only the usage for each option.
+This function may be used when the emitted usage must incorporate
+information not available to AutoOpts.';
+ srcfile = 'usage.c';
+ linenum = '201';
+};
+
+
+#line 33 "pgusage.c"
+export_func = {
+ name = 'optionPagedUsage';
+ private;
+ what = 'Decipher a boolean value';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ doc =
+'Run the usage output through a pager.
+This is very handy if it is very long.
+This is disabled on platforms without a working fork() function.';
+ srcfile = 'pgusage.c';
+ linenum = '33';
+};
+
+
+#line 73 "makeshell.c"
+export_func = {
+ name = 'optionParseShell';
+ private;
+ what = 'Decipher a boolean value';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ doc =
+'Emit a shell script that will parse the command line options.';
+ srcfile = 'makeshell.c';
+ linenum = '73';
+};
+
+
+#line 176 "version.c"
+export_func = {
+ name = 'optionPrintVersion';
+ private;
+ what = 'Print the program version';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'opts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'od';
+ arg_desc = 'the descriptor for this arg';
+ };
+ doc =
+'This routine will print the version to stdout.';
+ srcfile = 'version.c';
+ linenum = '176';
+};
+
+
+#line 607 "autoopts.c"
+export_func = {
+ name = 'optionProcess';
+ what = 'this is the main option processing routine';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'int';
+ arg_name = 'argc';
+ arg_desc = 'program arg count';
+ };
+ arg = {
+ arg_type = 'char**';
+ arg_name = 'argv';
+ arg_desc = 'program arg vector';
+ };
+ ret_type = 'int';
+ ret_desc = 'the count of the arguments processed';
+ doc =
+'This is the main entry point for processing options. It is intended
+that this procedure be called once at the beginning of the execution of
+a program. Depending on options selected earlier, it is sometimes
+necessary to stop and restart option processing, or to select completely
+different sets of options. This can be done easily, but you generally
+do not want to do this.
+
+The number of arguments processed always includes the program name.
+If one of the arguments is "--", then it is counted and the processing
+stops. If an error was encountered and errors are to be tolerated, then
+the returned value is the index of the argument causing the error.
+A hyphen by itself ("-") will also cause processing to stop and will
+@emph{not} be counted among the processed arguments. A hyphen by itself
+is treated as an operand. Encountering an operand stops option
+processing.';
+ err = 'Errors will cause diagnostics to be printed. @code{exit(3)} may
+or may not be called. It depends upon whether or not the options
+were generated with the "allow-errors" attribute, or if the
+ERRSKIP_OPTERR or ERRSTOP_OPTERR macros were invoked.';
+ srcfile = 'autoopts.c';
+ linenum = '607';
+};
+
+
+#line 214 "putshell.c"
+export_func = {
+ name = 'optionPutShell';
+ what = 'write a portable shell script to parse options';
+ private;
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'the program options descriptor';
+ };
+ doc = 'This routine will emit portable shell script text for parsing
+the options described in the option definitions.';
+ srcfile = 'putshell.c';
+ linenum = '214';
+};
+
+
+#line 58 "reset.c"
+export_func = {
+ name = 'optionResetOpt';
+ private;
+ what = 'Reset the value of an option';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ doc =
+'This code will cause another option to be reset to its initial state.
+For example, --reset=foo will cause the --foo option to be reset.';
+ srcfile = 'reset.c';
+ linenum = '58';
+};
+
+
+#line 123 "restore.c"
+export_func = {
+ name = 'optionRestore';
+ what = 'restore option state from memory copy';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ doc = 'Copy back the option state from saved memory.
+The allocated memory is left intact, so this routine can be
+called repeatedly without having to call optionSaveState again.
+If you are restoring a state that was saved before the first call
+to optionProcess(3AO), then you may change the contents of the
+argc/argv parameters to optionProcess.';
+ err = 'If you have not called @code{optionSaveState} before, a diagnostic is
+printed to @code{stderr} and exit is called.';
+ srcfile = 'restore.c';
+ linenum = '123';
+};
+
+
+#line 648 "save.c"
+export_func = {
+ name = 'optionSaveFile';
+ what = 'saves the option state to a file';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ doc =
+'This routine will save the state of option processing to a file. The name
+of that file can be specified with the argument to the @code{--save-opts}
+option, or by appending the @code{rcfile} attribute to the last
+@code{homerc} attribute. If no @code{rcfile} attribute was specified, it
+will default to @code{.@i{programname}rc}. If you wish to specify another
+file, you should invoke the @code{SET_OPT_SAVE_OPTS(@i{filename})} macro.
+
+The recommend usage is as follows:
+@example
+optionProcess(&progOptions, argc, argv);
+if (i_want_a_non_standard_place_for_this)
+SET_OPT_SAVE_OPTS("myfilename");
+optionSaveFile(&progOptions);
+@end example';
+ err =
+'If no @code{homerc} file was specified, this routine will silently return
+and do nothing. If the output file cannot be created or updated, a message
+will be printed to @code{stderr} and the routine will return.';
+ srcfile = 'save.c';
+ linenum = '648';
+};
+
+
+#line 71 "restore.c"
+export_func = {
+ name = 'optionSaveState';
+ what = 'saves the option state to memory';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ doc =
+'This routine will allocate enough memory to save the current option
+processing state. If this routine has been called before, that memory
+will be reused. You may only save one copy of the option state. This
+routine may be called before optionProcess(3AO). If you do call it
+before the first call to optionProcess, then you may also change the
+contents of argc/argv after you call optionRestore(3AO)
+
+In fact, more strongly put: it is safest to only use this function
+before having processed any options. In particular, the saving and
+restoring of stacked string arguments and hierarchical values is
+disabled. The values are not saved.';
+ err = 'If it fails to allocate the memory,
+it will print a message to stderr and exit.
+Otherwise, it will always succeed.';
+ srcfile = 'restore.c';
+ linenum = '71';
+};
+
+
+#line 423 "enum.c"
+export_func = {
+ name = 'optionSetMembers';
+ what = 'Convert between bit flag values and strings';
+ private;
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'the program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOD';
+ arg_desc = 'enumeration option description';
+ };
+ arg = {
+ arg_type = 'char const * const *';
+ arg_name = 'paz_names';
+ arg_desc = 'list of enumeration names';
+ };
+ arg = {
+ arg_type = 'unsigned int';
+ arg_name = 'name_ct';
+ arg_desc = 'number of names in list';
+ };
+ doc = 'This converts the optArg.argString string from the option description
+into the index corresponding to an entry in the name list.
+This will match the generated enumeration value.
+Full matches are always accepted. Partial matches are accepted
+if there is only one partial match.';
+ srcfile = 'enum.c';
+ linenum = '423';
+};
+
+
+#line 28 "numeric.c"
+export_func = {
+ name = 'optionShowRange';
+ private;
+ what;
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ arg = {
+ arg_type = 'void *';
+ arg_name = 'rng_table';
+ arg_desc = 'the value range tables';
+ };
+ arg = {
+ arg_type = 'int';
+ arg_name = 'rng_count';
+ arg_desc = 'the number of entries';
+ };
+ doc =
+'Show information about a numeric option with range constraints.';
+ srcfile = 'numeric.c';
+ linenum = '28';
+};
+
+
+#line 226 "stack.c"
+export_func = {
+ name = 'optionStackArg';
+ private;
+ what = 'put option args on a stack';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ doc =
+'Keep an entry-ordered list of option arguments.';
+ srcfile = 'stack.c';
+ linenum = '226';
+};
+
+
+#line 64 "time.c"
+export_func = {
+ name = 'optionTimeDate';
+ private;
+ what = 'process an option with a time and date.';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ doc =
+'Decipher a time and date value.';
+ srcfile = 'time.c';
+ linenum = '64';
+};
+
+
+#line 28 "time.c"
+export_func = {
+ name = 'optionTimeVal';
+ private;
+ what = 'process an option with a time duration.';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ doc =
+'Decipher a time duration value.';
+ srcfile = 'time.c';
+ linenum = '28';
+};
+
+
+#line 563 "nested.c"
+export_func = {
+ name = 'optionUnloadNested';
+ what = 'Deallocate the memory for a nested value';
+ arg = {
+ arg_type = 'tOptionValue const *';
+ arg_name = 'pOptVal';
+ arg_desc = 'the hierarchical value';
+ };
+ doc =
+'A nested value needs to be deallocated. The pointer passed in should
+have been gotten from a call to @code{configFileLoad()} (See
+@pxref{libopts-configFileLoad}).';
+ srcfile = 'nested.c';
+ linenum = '563';
+};
+
+
+#line 35 "stack.c"
+export_func = {
+ name = 'optionUnstackArg';
+ private;
+ what = 'Remove option args from a stack';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ doc =
+'Invoked for options that are equivalenced to stacked options.';
+ srcfile = 'stack.c';
+ linenum = '35';
+};
+
+
+#line 315 "usage.c"
+export_func = {
+ name = 'optionUsage';
+ private;
+ what = 'Print usage text';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'pOptions';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'int';
+ arg_name = 'exitCode';
+ arg_desc = 'exit code for calling exit(3)';
+ };
+ doc =
+'This routine will print usage in both GNU-standard and AutoOpts-expanded
+formats. The descriptor specifies the default, but AUTOOPTS_USAGE will
+over-ride this, providing the value of it is set to either "gnu" or
+"autoopts". This routine will @strong{not} return.
+
+If "exitCode" is "AO_EXIT_REQ_USAGE" (normally 64), then output will to
+to stdout and the actual exit code will be "EXIT_SUCCESS".';
+ srcfile = 'usage.c';
+ linenum = '315';
+};
+
+
+#line 268 "find.c"
+export_func = {
+ name = 'optionVendorOption';
+ private;
+ what = 'Process a vendor option';
+ arg = {
+ arg_type = 'tOptions *';
+ arg_name = 'pOpts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc *';
+ arg_name = 'pOptDesc';
+ arg_desc = 'the descriptor for this arg';
+ };
+ doc =
+'For POSIX specified utilities, the options are constrained to the options,
+@xref{config attributes, Program Configuration}. AutoOpts clients should
+never specify this directly. It gets referenced when the option
+definitions contain a "vendor-opt" attribute.';
+ srcfile = 'find.c';
+ linenum = '268';
+};
+
+
+#line 31 "version.c"
+export_func = {
+ name = 'optionVersion';
+ what = 'return the compiled AutoOpts version number';
+ ret_type = 'char const*';
+ ret_desc = 'the version string in constant memory';
+ doc =
+'Returns the full version string compiled into the library.
+The returned string cannot be modified.';
+ srcfile = 'version.c';
+ linenum = '31';
+};
+
+
+#line 192 "version.c"
+export_func = {
+ name = 'optionVersionStderr';
+ private;
+ what = 'Print the program version to stderr';
+ arg = {
+ arg_type = 'tOptions*';
+ arg_name = 'opts';
+ arg_desc = 'program options descriptor';
+ };
+ arg = {
+ arg_type = 'tOptDesc*';
+ arg_name = 'od';
+ arg_desc = 'the descriptor for this arg';
+ };
+ doc =
+'This routine will print the version to stderr.';
+ srcfile = 'version.c';
+ linenum = '192';
+};
+
+
+#line 29 "../compat/pathfind.c"
+export_func = {
+ name = 'pathfind';
+ what = 'fild a file in a list of directories';
+ ifndef = 'HAVE_PATHFIND';
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'path';
+ arg_desc = 'colon separated list of search directories';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'file';
+ arg_desc = 'the name of the file to look for';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'mode';
+ arg_desc = 'the mode bits that must be set to match';
+ };
+ ret_type = 'char*';
+ ret_desc = 'the path to the located file';
+ doc =
+'pathfind looks for a a file with name "FILE" and "MODE" access
+along colon delimited "PATH", and returns the full pathname as a
+string, or NULL if not found. If "FILE" contains a slash, then
+it is treated as a relative or absolute path and "PATH" is ignored.
+
+@strong{NOTE}: this function is compiled into @file{libopts} only if
+it is not natively supplied.
+
+The "MODE" argument is a string of option letters chosen from the
+list below:
+@example
+Letter Meaning
+r readable
+w writable
+x executable
+f normal file (NOT IMPLEMENTED)
+b block special (NOT IMPLEMENTED)
+c character special (NOT IMPLEMENTED)
+d directory (NOT IMPLEMENTED)
+p FIFO (pipe) (NOT IMPLEMENTED)
+u set user ID bit (NOT IMPLEMENTED)
+g set group ID bit (NOT IMPLEMENTED)
+k sticky bit (NOT IMPLEMENTED)
+s size nonzero (NOT IMPLEMENTED)
+@end example';
+ example =
+'To find the "ls" command using the "PATH" environment variable:
+@example
+#include <stdlib.h>
+char* pz_ls = pathfind( getenv("PATH"), "ls", "rx" );
+<<do whatever with pz_ls>>
+free( pz_ls );
+@end example
+The path is allocated with @code{malloc(3C)}, so you must @code{free(3C)}
+the result. Also, do not use unimplemented file modes. :-)';
+ err = 'returns NULL if the file is not found.';
+ srcfile = '../compat/pathfind.c';
+ linenum = '29';
+};
+
+
+#line 209 "streqvcmp.c"
+export_func = {
+ name = 'strequate';
+ what = 'map a list of characters to the same value';
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'ch_list';
+ arg_desc = 'characters to equivalence';
+ };
+ doc =
+'Each character in the input string get mapped to the first character
+in the string.
+This function name is mapped to option_strequate so as to not conflict
+with the POSIX name space.';
+ err = 'none.';
+ srcfile = 'streqvcmp.c';
+ linenum = '209';
+};
+
+
+#line 119 "streqvcmp.c"
+export_func = {
+ name = 'streqvcmp';
+ what = 'compare two strings with an equivalence mapping';
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'str1';
+ arg_desc = 'first string';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'str2';
+ arg_desc = 'second string';
+ };
+ ret_type = 'int';
+ ret_desc = 'the difference between two differing characters';
+ doc =
+'Using a character mapping, two strings are compared for "equivalence".
+Each input character is mapped to a comparison character and the
+mapped-to characters are compared for the two NUL terminated input strings.
+This function name is mapped to option_streqvcmp so as to not conflict
+with the POSIX name space.';
+ err = 'none checked. Caller responsible for seg faults.';
+ srcfile = 'streqvcmp.c';
+ linenum = '119';
+};
+
+
+#line 156 "streqvcmp.c"
+export_func = {
+ name = 'streqvmap';
+ what = 'Set the character mappings for the streqv functions';
+ arg = {
+ arg_type = 'char';
+ arg_name = 'From';
+ arg_desc = 'Input character';
+ };
+ arg = {
+ arg_type = 'char';
+ arg_name = 'To';
+ arg_desc = 'Mapped-to character';
+ };
+ arg = {
+ arg_type = 'int';
+ arg_name = 'ct';
+ arg_desc = 'compare length';
+ };
+ doc =
+'Set the character mapping. If the count (@code{ct}) is set to zero, then
+the map is cleared by setting all entries in the map to their index
+value. Otherwise, the "@code{From}" character is mapped to the "@code{To}"
+character. If @code{ct} is greater than 1, then @code{From} and @code{To}
+are incremented and the process repeated until @code{ct} entries have been
+set. For example,
+@example
+streqvmap(\'a\', \'A\', 26);
+@end example
+@noindent
+will alter the mapping so that all English lower case letters
+will map to upper case.
+
+This function name is mapped to option_streqvmap so as to not conflict
+with the POSIX name space.';
+ err = 'none.';
+ srcfile = 'streqvcmp.c';
+ linenum = '156';
+};
+
+
+#line 78 "streqvcmp.c"
+export_func = {
+ name = 'strneqvcmp';
+ what = 'compare two strings with an equivalence mapping';
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'str1';
+ arg_desc = 'first string';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'str2';
+ arg_desc = 'second string';
+ };
+ arg = {
+ arg_type = 'int';
+ arg_name = 'ct';
+ arg_desc = 'compare length';
+ };
+ ret_type = 'int';
+ ret_desc = 'the difference between two differing characters';
+ doc =
+'Using a character mapping, two strings are compared for "equivalence".
+Each input character is mapped to a comparison character and the
+mapped-to characters are compared for the two NUL terminated input strings.
+The comparison is limited to @code{ct} bytes.
+This function name is mapped to option_strneqvcmp so as to not conflict
+with the POSIX name space.';
+ err = 'none checked. Caller responsible for seg faults.';
+ srcfile = 'streqvcmp.c';
+ linenum = '78';
+};
+
+
+#line 235 "streqvcmp.c"
+export_func = {
+ name = 'strtransform';
+ what = 'convert a string into its mapped-to value';
+ arg = {
+ arg_type = 'char*';
+ arg_name = 'dest';
+ arg_desc = 'output string';
+ };
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'src';
+ arg_desc = 'input string';
+ };
+ doc =
+'Each character in the input string is mapped and the mapped-to
+character is put into the output.
+This function name is mapped to option_strtransform so as to not conflict
+with the POSIX name space.
+
+The source and destination may be the same.';
+ err = 'none.';
+ srcfile = 'streqvcmp.c';
+ linenum = '235';
+};
+
+
+#line 244 "text_mmap.c"
+export_func = {
+ name = 'text_mmap';
+ private;
+ what = 'map a text file with terminating NUL';
+ arg = {
+ arg_type = 'char const*';
+ arg_name = 'pzFile';
+ arg_desc = 'name of the file to map';
+ };
+ arg = {
+ arg_type = 'int';
+ arg_name = 'prot';
+ arg_desc = 'mmap protections (see mmap(2))';
+ };
+ arg = {
+ arg_type = 'int';
+ arg_name = 'flags';
+ arg_desc = 'mmap flags (see mmap(2))';
+ };
+ arg = {
+ arg_type = 'tmap_info_t*';
+ arg_name = 'mapinfo';
+ arg_desc = 'returned info about the mapping';
+ };
+ ret-type = 'void*';
+ ret-desc = 'The mmaped data address';
+ doc =
+'This routine will mmap a file into memory ensuring that there is at least
+one @file{NUL} character following the file data. It will return the
+address where the file contents have been mapped into memory. If there is a
+problem, then it will return @code{MAP_FAILED} and set @code{errno}
+appropriately.
+
+The named file does not exist, @code{stat(2)} will set @code{errno} as it
+will. If the file is not a regular file, @code{errno} will be
+@code{EINVAL}. At that point, @code{open(2)} is attempted with the access
+bits set appropriately for the requested @code{mmap(2)} protections and flag
+bits. On failure, @code{errno} will be set according to the documentation
+for @code{open(2)}. If @code{mmap(2)} fails, @code{errno} will be set as
+that routine sets it. If @code{text_mmap} works to this point, a valid
+address will be returned, but there may still be ``issues\'\'.
+
+If the file size is not an even multiple of the system page size, then
+@code{text_map} will return at this point and @code{errno} will be zero.
+Otherwise, an anonymous map is attempted. If not available, then an attempt
+is made to @code{mmap(2)} @file{/dev/zero}. If any of these fail, the
+address of the file\'s data is returned, bug @code{no} @file{NUL} characters
+are mapped after the end of the data.';
+ see = 'mmap(2), open(2), stat(2)';
+ err = 'Any error code issued by mmap(2), open(2), stat(2) is possible.
+Additionally, if the specified file is not a regular file, then
+errno will be set to @code{EINVAL}.';
+ example =
+'#include <mylib.h>
+tmap_info_t mi;
+int no_nul;
+void* data = text_mmap("file", PROT_WRITE, MAP_PRIVATE, &mi);
+if (data == MAP_FAILED) return;
+no_nul = (mi.txt_size == mi.txt_full_size);
+<< use the data >>
+text_munmap(&mi);';
+ srcfile = 'text_mmap.c';
+ linenum = '244';
+};
+
+
+#line 317 "text_mmap.c"
+export_func = {
+ name = 'text_munmap';
+ private;
+ what = 'unmap the data mapped in by text_mmap';
+ arg = {
+ arg_type = 'tmap_info_t*';
+ arg_name = 'mapinfo';
+ arg_desc = 'info about the mapping';
+ };
+ ret-type = 'int';
+ ret-desc = '-1 or 0. @code{errno} will have the error code.';
+ doc =
+'This routine will unmap the data mapped in with @code{text_mmap} and close
+the associated file descriptors opened by that function.';
+ see = 'munmap(2), close(2)';
+ err = 'Any error code issued by munmap(2) or close(2) is possible.';
+ srcfile = 'text_mmap.c';
+ linenum = '317';
+};
+vers-curr = "147461";
+vers-min = "102400";
+vers-min-str = "25:0:0";
+vers-sovers = "36:5:11";
+library = opts;
+
+/*
+ * THIS FILE IS DISTRIBUTED
+ *
+ * This file is used to construct options.h + doc files. Because it is
+ * such a nuisance to get the build ordering correct, we distribute
+ * this. It should be constructed after all binaries are built.
+ */
diff --git a/autoopts/genshell.c b/autoopts/genshell.c
new file mode 100644
index 0000000..2762088
--- /dev/null
+++ b/autoopts/genshell.c
@@ -0,0 +1,452 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (genshell.c)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:14 AM by AutoGen 5.16.2pre7
+ * From the definitions genshell.def
+ * and the template file options
+ *
+ * Generated from AutoOpts 36:5:11 templates.
+ *
+ * AutoOpts is a copyrighted work. This source file is not encumbered
+ * by AutoOpts licensing, but is provided under the licensing terms chosen
+ * by the genshellopt author or copyright holder. AutoOpts is
+ * licensed under the terms of the LGPL. The redistributable library
+ * (``libopts'') is licensed under the terms of either the LGPL or, at the
+ * users discretion, the BSD license. See the AutoOpts and/or libopts sources
+ * for details.
+ *
+ * The genshellopt program is copyrighted and licensed
+ * under the following terms:
+ *
+ * Copyright (C) 1999-2012 Bruce Korb, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the
+ * GNU General Public License, version 3 or later
+ * <http://gnu.org/licenses/gpl.html>
+ *
+ * genshellopt is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * genshellopt is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __doxygen__
+#define OPTION_CODE_COMPILE 1
+#include "genshell.h"
+#include <sys/types.h>
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern FILE * option_usage_fp;
+
+/* TRANSLATORS: choose the translation for option names wisely because you
+ cannot ever change your mind. */
+#define zCopyright (genshellopt_opt_strs+0)
+#define zLicenseDescrip (genshellopt_opt_strs+260)
+
+extern tUsageProc genshelloptUsage;
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+/*
+ * genshellopt option static const strings
+ */
+static char const genshellopt_opt_strs[1690] =
+/* 0 */ "genshellopt 1\n"
+ "Copyright (C) 1999-2012 Bruce Korb, all rights reserved.\n"
+ "This is free software. It is licensed for use, modification and\n"
+ "redistribution under the terms of the\n"
+ "GNU General Public License, version 3 or later\n"
+ " <http://gnu.org/licenses/gpl.html>\n\0"
+/* 260 */ "genshellopt is free software: you can redistribute it and/or modify it\n"
+ "under the terms of the GNU General Public License as published by the Free\n"
+ "Software Foundation, either version 3 of the License, or (at your option)\n"
+ "any later version.\n\n"
+ "genshellopt is distributed in the hope that it will be useful, but WITHOUT\n"
+ "ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n"
+ "FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\n"
+ "more details.\n\n"
+ "You should have received a copy of the GNU General Public License along\n"
+ "with this program. If not, see <http://www.gnu.org/licenses/>.\n\0"
+/* 871 */ "Output Script File\0"
+/* 890 */ "SCRIPT\0"
+/* 897 */ "script\0"
+/* 904 */ "Shell name (follows \"#!\" magic)\0"
+/* 936 */ "SHELL\0"
+/* 942 */ "no-shell\0"
+/* 951 */ "no\0"
+/* 954 */ "Display extended usage information and exit\0"
+/* 998 */ "help\0"
+/* 1003 */ "Extended usage information passed thru pager\0"
+/* 1048 */ "more-help\0"
+/* 1058 */ "Output version information and exit\0"
+/* 1094 */ "version\0"
+/* 1102 */ "GENSHELLOPT\0"
+/* 1114 */ "genshellopt - Generate Shell Option Processing Script - Ver. 1\n"
+ "USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
+/* 1235 */ "autogen-users@lists.sourceforge.net\0"
+/* 1271 */ "\n"
+ "Note that ``shell'' is only useful if the output file does not already\n"
+ "exist. If it does, then the shell name and optional first argument will be\n"
+ "extracted from the script file.\n\0"
+/* 1452 */ "\n"
+ "If the script file already exists and contains Automated Option Processing\n"
+ "text, the second line of the file through the ending tag will be replaced\n"
+ "by the newly generated text. The first ``#!'' line will be regenerated.\n\0"
+/* 1676 */ "genshellopt 1";
+
+/*
+ * script option description:
+ */
+#define SCRIPT_DESC (genshellopt_opt_strs+871)
+#define SCRIPT_NAME (genshellopt_opt_strs+890)
+#define SCRIPT_name (genshellopt_opt_strs+897)
+#define SCRIPT_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * shell option description:
+ */
+#define SHELL_DESC (genshellopt_opt_strs+904)
+#define SHELL_NAME (genshellopt_opt_strs+936)
+#define NOT_SHELL_name (genshellopt_opt_strs+942)
+#define NOT_SHELL_PFX (genshellopt_opt_strs+951)
+#define SHELL_name (NOT_SHELL_name + 3)
+#define SHELL_FLAGS (OPTST_INITENABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * Help/More_Help/Version option descriptions:
+ */
+#define HELP_DESC (genshellopt_opt_strs+954)
+#define HELP_name (genshellopt_opt_strs+998)
+#ifdef HAVE_WORKING_FORK
+#define MORE_HELP_DESC (genshellopt_opt_strs+1003)
+#define MORE_HELP_name (genshellopt_opt_strs+1048)
+#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
+#else
+#define MORE_HELP_DESC NULL
+#define MORE_HELP_name NULL
+#define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
+#endif
+#ifdef NO_OPTIONAL_OPT_ARGS
+# define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
+#else
+# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
+ OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
+#endif
+#define VER_DESC (genshellopt_opt_strs+1058)
+#define VER_name (genshellopt_opt_strs+1094)
+/*
+ * Declare option callback procedures
+ */
+extern tOptProc
+ optionBooleanVal, optionNestedVal, optionNumericVal,
+ optionPagedUsage, optionPrintVersion, optionResetOpt,
+ optionStackArg, optionTimeDate, optionTimeVal,
+ optionUnstackArg, optionVendorOption;
+static tOptProc
+ doUsageOpt;
+#define VER_PROC optionPrintVersion
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Define the genshellopt Option Descriptions.
+ * This is an array of GENSHELL_OPTION_CT entries, one for each
+ * option that the genshellopt program responds to.
+ */
+static tOptDesc optDesc[GENSHELL_OPTION_CT] = {
+ { /* entry idx, value */ 0, VALUE_GENSHELL_OPT_SCRIPT,
+ /* equiv idx, value */ 0, VALUE_GENSHELL_OPT_SCRIPT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ SCRIPT_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --script */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ SCRIPT_DESC, SCRIPT_NAME, SCRIPT_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 1, VALUE_GENSHELL_OPT_SHELL,
+ /* equiv idx, value */ 1, VALUE_GENSHELL_OPT_SHELL,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ SHELL_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --shell */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ SHELL_DESC, SHELL_NAME, SHELL_name,
+ /* disablement strs */ NOT_SHELL_name, NOT_SHELL_PFX },
+
+ { /* entry idx, value */ INDEX_GENSHELL_OPT_VERSION, VALUE_GENSHELL_OPT_VERSION,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_GENSHELL_OPT_VERSION,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ VER_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ VER_PROC,
+ /* desc, NAME, name */ VER_DESC, NULL, VER_name,
+ /* disablement strs */ NULL, NULL },
+
+
+
+ { /* entry idx, value */ INDEX_GENSHELL_OPT_HELP, VALUE_GENSHELL_OPT_HELP,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_GENSHELL_OPT_HELP,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doUsageOpt,
+ /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ INDEX_GENSHELL_OPT_MORE_HELP, VALUE_GENSHELL_OPT_MORE_HELP,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_GENSHELL_OPT_MORE_HELP,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ MORE_HELP_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionPagedUsage,
+ /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
+ /* disablement strs */ NULL, NULL }
+};
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Define the genshellopt Option Environment
+ */
+#define zPROGNAME (genshellopt_opt_strs+1102)
+#define zUsageTitle (genshellopt_opt_strs+1114)
+#define zRcName NULL
+#define apzHomeList NULL
+#define zBugsAddr (genshellopt_opt_strs+1235)
+#define zExplain (genshellopt_opt_strs+1271)
+#define zDetail (genshellopt_opt_strs+1452)
+#define zFullVersion (genshellopt_opt_strs+1676)
+/* extracted from optcode.tlib near line 350 */
+
+#if defined(ENABLE_NLS)
+# define OPTPROC_BASE OPTPROC_TRANSLATE
+ static tOptionXlateProc translate_option_strings;
+#else
+# define OPTPROC_BASE OPTPROC_NONE
+# define translate_option_strings NULL
+#endif /* ENABLE_NLS */
+
+
+#define genshellopt_full_usage (NULL)
+
+#define genshellopt_short_usage (NULL)
+
+#endif /* not defined __doxygen__ */
+
+/*
+ * Create the static procedure(s) declared above.
+ */
+/**
+ * The callout function that invokes the genshelloptUsage function.
+ *
+ * @param pOptions the AutoOpts option description structure
+ * @param pOptDesc the descriptor for the "help" (usage) option.
+ * @noreturn
+ */
+static void
+doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
+{
+ genshelloptUsage(&genshelloptOptions, GENSHELLOPT_EXIT_SUCCESS);
+ /* NOTREACHED */
+ (void)pOptDesc;
+ (void)pOptions;
+}
+/* extracted from optmain.tlib near line 1146 */
+
+/**
+ * The directory containing the data associated with genshellopt.
+ */
+#ifndef PKGDATADIR
+# define PKGDATADIR ""
+#endif
+
+/**
+ * Information about the person or institution that packaged genshellopt
+ * for the current distribution.
+ */
+#ifndef WITH_PACKAGER
+# define genshellopt_packager_info NULL
+#else
+static char const genshellopt_packager_info[] =
+ "Packaged by " WITH_PACKAGER
+
+# ifdef WITH_PACKAGER_VERSION
+ " ("WITH_PACKAGER_VERSION")"
+# endif
+
+# ifdef WITH_PACKAGER_BUG_REPORTS
+ "\nReport genshellopt bugs to " WITH_PACKAGER_BUG_REPORTS
+# endif
+ "\n";
+#endif
+#ifndef __doxygen__
+
+#endif /* __doxygen__ */
+/**
+ * The option definitions for genshellopt. The one structure that
+ * binds them all.
+ */
+tOptions genshelloptOptions = {
+ OPTIONS_STRUCT_VERSION,
+ 0, NULL, /* original argc + argv */
+ ( OPTPROC_BASE
+ + OPTPROC_ERRSTOP
+ + OPTPROC_SHORTOPT
+ + OPTPROC_LONGOPT
+ + OPTPROC_NO_REQ_OPT
+ + OPTPROC_NEGATIONS
+ + OPTPROC_NO_ARGS ),
+ 0, NULL, /* current option index, current option */
+ NULL, NULL, zPROGNAME,
+ zRcName, zCopyright, zLicenseDescrip,
+ zFullVersion, apzHomeList, zUsageTitle,
+ zExplain, zDetail, optDesc,
+ zBugsAddr, /* address to send bugs to */
+ NULL, NULL, /* extensions/saved state */
+ genshelloptUsage, /* usage procedure */
+ translate_option_strings, /* translation procedure */
+ /*
+ * Indexes to special options
+ */
+ { INDEX_GENSHELL_OPT_MORE_HELP, /* more-help option index */
+ NO_EQUIVALENT, /* save option index */
+ NO_EQUIVALENT, /* '-#' option index */
+ NO_EQUIVALENT /* index of default opt */
+ },
+ 5 /* full option count */, 2 /* user option count */,
+ genshellopt_full_usage, genshellopt_short_usage,
+ NULL, NULL,
+ PKGDATADIR, genshellopt_packager_info
+};
+
+#if ENABLE_NLS
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <autoopts/usage-txt.h>
+
+static char* AO_gettext(char const* pz);
+static void coerce_it(void** s);
+
+/**
+ * AutoGen specific wrapper function for gettext.
+ * It relies on the macro _() to convert from English to the target
+ * language, then strdup-duplicates the result string.
+ *
+ * @param[in] pz the input text used as a lookup key.
+ * @returns the translated text (if there is one),
+ * or the original text (if not).
+ */
+static char *
+AO_gettext(char const* pz)
+{
+ char* pzRes;
+ if (pz == NULL)
+ return NULL;
+ pzRes = _(pz);
+ if (pzRes == pz)
+ return pzRes;
+ pzRes = strdup(pzRes);
+ if (pzRes == NULL) {
+ fputs(_("No memory for duping translated strings\n"), stderr);
+ exit(GENSHELLOPT_EXIT_FAILURE);
+ }
+ return pzRes;
+}
+
+static void coerce_it(void** s) { *s = AO_gettext(*s);
+}
+
+/**
+ * Translate all the translatable strings in the genshelloptOptions
+ * structure defined above. This is done only once.
+ */
+static void
+translate_option_strings(void)
+{
+ tOptions * const pOpt = &genshelloptOptions;
+
+ /*
+ * Guard against re-translation. It won't work. The strings will have
+ * been changed by the first pass through this code. One shot only.
+ */
+ if (option_usage_text.field_ct != 0) {
+ /*
+ * Do the translations. The first pointer follows the field count
+ * field. The field count field is the size of a pointer.
+ */
+ tOptDesc * pOD = pOpt->pOptDesc;
+ char ** ppz = (char**)(void*)&(option_usage_text);
+ int ix = option_usage_text.field_ct;
+
+ do {
+ ppz++;
+ *ppz = AO_gettext(*ppz);
+ } while (--ix > 0);
+
+ coerce_it((void*)&(pOpt->pzCopyright));
+ coerce_it((void*)&(pOpt->pzCopyNotice));
+ coerce_it((void*)&(pOpt->pzFullVersion));
+ coerce_it((void*)&(pOpt->pzUsageTitle));
+ coerce_it((void*)&(pOpt->pzExplain));
+ coerce_it((void*)&(pOpt->pzDetail));
+ coerce_it((void*)&(pOpt->pzPackager));
+ option_usage_text.field_ct = 0;
+
+ for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
+ coerce_it((void*)&(pOD->pzText));
+ }
+
+ if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
+ tOptDesc * pOD = pOpt->pOptDesc;
+ int ix;
+
+ for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
+ coerce_it((void*)&(pOD->pz_Name));
+ coerce_it((void*)&(pOD->pz_DisableName));
+ coerce_it((void*)&(pOD->pz_DisablePfx));
+ }
+ /* prevent re-translation */
+ genshelloptOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
+ }
+}
+
+#endif /* ENABLE_NLS */
+
+#ifdef __cplusplus
+}
+#endif
+/* genshell.c ends here */
diff --git a/autoopts/genshell.def b/autoopts/genshell.def
new file mode 100644
index 0000000..e679b5f
--- /dev/null
+++ b/autoopts/genshell.def
@@ -0,0 +1,79 @@
+
+autogen definitions options;
+
+/**
+ * \file genshell.def
+ *
+ * Time-stamp: "2012-01-29 13:32:43 bkorb"
+ *
+ * This module generates shell scripts with AutoOpts supported command line
+ * option processing. This program is licensed separately from the AutoOpts
+ * library and is _only_ available under the terms of the GNU General
+ * Public License.
+ *
+ * Genshell Copyright (c) 1999-2012 by Bruce Korb - all rights reserved
+ * Genshell is free software.
+ * This file is part of AutoGen.
+ *
+ * AutoGen copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+copyright = {
+ date = "1999-2012";
+ owner = "Bruce Korb";
+ eaddr = "autogen-users@lists.sourceforge.net";
+ type = gpl;
+};
+
+owner = "Bruce Korb";
+prog-name = "genshellopt";
+prog-title = "Generate Shell Option Processing Script";
+long-opts;
+usage = genshelloptUsage;
+prefix = genshell;
+
+version = 1;
+
+flag = {
+ name = script;
+ value = o;
+ arg-type = string;
+ descrip = "Output Script File";
+};
+
+flag = {
+ name = shell;
+ disable = no;
+ enabled;
+ value = s;
+ arg-type = string;
+ descrip = 'Shell name (follows "#!" magic)';
+};
+
+option-doc-format = texi;
+
+explain =<<- _EOF_
+ Note that @code{shell} is only useful if the output file does not
+ already exist. If it does, then the shell name and optional first
+ argument will be extracted from the script file.
+ _EOF_;
+
+detail =<<- _EOF_
+ If the script file already exists and contains Automated Option
+ Processing text, the second line of the file through the ending tag
+ will be replaced by the newly generated text. The first @code{#!}
+ line will be regenerated.
+ _EOF_;
diff --git a/autoopts/genshell.h b/autoopts/genshell.h
new file mode 100644
index 0000000..2b28efb
--- /dev/null
+++ b/autoopts/genshell.h
@@ -0,0 +1,184 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (genshell.h)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:14 AM by AutoGen 5.16.2pre7
+ * From the definitions genshell.def
+ * and the template file options
+ *
+ * Generated from AutoOpts 36:5:11 templates.
+ *
+ * AutoOpts is a copyrighted work. This header file is not encumbered
+ * by AutoOpts licensing, but is provided under the licensing terms chosen
+ * by the genshellopt author or copyright holder. AutoOpts is
+ * licensed under the terms of the LGPL. The redistributable library
+ * (``libopts'') is licensed under the terms of either the LGPL or, at the
+ * users discretion, the BSD license. See the AutoOpts and/or libopts sources
+ * for details.
+ *
+ * The genshellopt program is copyrighted and licensed
+ * under the following terms:
+ *
+ * Copyright (C) 1999-2012 Bruce Korb, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the
+ * GNU General Public License, version 3 or later
+ * <http://gnu.org/licenses/gpl.html>
+ *
+ * genshellopt is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * genshellopt is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+/*
+ * This file contains the programmatic interface to the Automated
+ * Options generated for the genshellopt program.
+ * These macros are documented in the AutoGen info file in the
+ * "AutoOpts" chapter. Please refer to that doc for usage help.
+ */
+#ifndef AUTOOPTS_GENSHELL_H_GUARD
+#define AUTOOPTS_GENSHELL_H_GUARD 1
+#include <autoopts/options.h>
+
+/*
+ * Ensure that the library used for compiling this generated header is at
+ * least as new as the version current when the header template was released
+ * (not counting patch version increments). Also ensure that the oldest
+ * tolerable version is at least as old as what was current when the header
+ * template was released.
+ */
+#define AO_TEMPLATE_VERSION 147461
+#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
+ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
+# error option template version mismatches autoopts/options.h header
+ Choke Me.
+#endif
+
+/*
+ * Enumeration of each option:
+ */
+typedef enum {
+ INDEX_GENSHELL_OPT_SCRIPT = 0,
+ INDEX_GENSHELL_OPT_SHELL = 1,
+ INDEX_GENSHELL_OPT_VERSION = 2,
+ INDEX_GENSHELL_OPT_HELP = 3,
+ INDEX_GENSHELL_OPT_MORE_HELP = 4
+} teGenshell_OptIndex;
+
+#define GENSHELL_OPTION_CT 5
+#define GENSHELLOPT_VERSION "1"
+#define GENSHELLOPT_FULL_VERSION "genshellopt 1"
+
+/*
+ * Interface defines for all options. Replace "n" with the UPPER_CASED
+ * option name (as in the teGenshell_OptIndex enumeration above).
+ * e.g. HAVE_GENSHELL_OPT(SCRIPT)
+ */
+#define GENSHELL_DESC(n) (genshelloptOptions.pOptDesc[INDEX_GENSHELL_OPT_## n])
+#define HAVE_GENSHELL_OPT(n) (! UNUSED_OPT(& GENSHELL_DESC(n)))
+#define GENSHELL_OPT_ARG(n) (GENSHELL_DESC(n).optArg.argString)
+#define STATE_GENSHELL_OPT(n) (GENSHELL_DESC(n).fOptState & OPTST_SET_MASK)
+#define COUNT_GENSHELL_OPT(n) (GENSHELL_DESC(n).optOccCt)
+#define ISSEL_GENSHELL_OPT(n) (SELECTED_OPT(&GENSHELL_DESC(n)))
+#define ISUNUSED_GENSHELL_OPT(n) (UNUSED_OPT(& GENSHELL_DESC(n)))
+#define ENABLED_GENSHELL_OPT(n) (! DISABLED_OPT(& GENSHELL_DESC(n)))
+#define STACKCT_GENSHELL_OPT(n) (((tArgList*)(GENSHELL_DESC(n).optCookie))->useCt)
+#define STACKLST_GENSHELL_OPT(n) (((tArgList*)(GENSHELL_DESC(n).optCookie))->apzArgs)
+#define CLEAR_GENSHELL_OPT(n) STMTS( \
+ GENSHELL_DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
+ if ((GENSHELL_DESC(n).fOptState & OPTST_INITENABLED) == 0) \
+ GENSHELL_DESC(n).fOptState |= OPTST_DISABLED; \
+ GENSHELL_DESC(n).optCookie = NULL )
+
+/* * * * * *
+ *
+ * Enumeration of genshellopt exit codes
+ */
+typedef enum {
+ GENSHELLOPT_EXIT_SUCCESS = 0,
+ GENSHELLOPT_EXIT_FAILURE = 1,
+ GENSHELLOPT_EXIT_LIBOPTS_FAILURE = 70
+} genshellopt_exit_code_t;
+/* * * * * *
+ *
+ * Interface defines for specific options.
+ */
+#define VALUE_GENSHELL_OPT_SCRIPT 'o'
+#define VALUE_GENSHELL_OPT_SHELL 's'
+#define VALUE_GENSHELL_OPT_HELP '?'
+#define VALUE_GENSHELL_OPT_MORE_HELP '!'
+#define VALUE_GENSHELL_OPT_VERSION 'v'
+/*
+ * Interface defines not associated with particular options
+ */
+#define ERRSKIP_GENSHELL_OPTERR STMTS(genshelloptOptions.fOptSet &= ~OPTPROC_ERRSTOP)
+#define ERRSTOP_GENSHELL_OPTERR STMTS(genshelloptOptions.fOptSet |= OPTPROC_ERRSTOP)
+#define RESTART_GENSHELL_OPT(n) STMTS( \
+ genshelloptOptions.curOptIdx = (n); \
+ genshelloptOptions.pzCurOpt = NULL )
+#define START_GENSHELL_OPT RESTART_GENSHELL_OPT(1)
+#define GENSHELL_USAGE(c) (*genshelloptOptions.pUsageProc)(&genshelloptOptions, c)
+/* extracted from opthead.tlib near line 484 */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* * * * * *
+ *
+ * Declare the genshellopt option descriptor.
+ */
+extern tOptions genshelloptOptions;
+
+#if defined(ENABLE_NLS)
+# ifndef _
+# include <stdio.h>
+# ifndef HAVE_GETTEXT
+ extern char * gettext(char const *);
+# else
+# include <libintl.h>
+# endif
+
+static inline char* aoGetsText(char const* pz) {
+ if (pz == NULL) return NULL;
+ return (char*)gettext(pz);
+}
+# define _(s) aoGetsText(s)
+# endif /* _() */
+
+# define OPT_NO_XLAT_CFG_NAMES STMTS(genshelloptOptions.fOptSet |= \
+ OPTPROC_NXLAT_OPT_CFG;)
+# define OPT_NO_XLAT_OPT_NAMES STMTS(genshelloptOptions.fOptSet |= \
+ OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
+
+# define OPT_XLAT_CFG_NAMES STMTS(genshelloptOptions.fOptSet &= \
+ ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
+# define OPT_XLAT_OPT_NAMES STMTS(genshelloptOptions.fOptSet &= \
+ ~OPTPROC_NXLAT_OPT;)
+
+#else /* ENABLE_NLS */
+# define OPT_NO_XLAT_CFG_NAMES
+# define OPT_NO_XLAT_OPT_NAMES
+
+# define OPT_XLAT_CFG_NAMES
+# define OPT_XLAT_OPT_NAMES
+
+# ifndef _
+# define _(_s) _s
+# endif
+#endif /* ENABLE_NLS */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* AUTOOPTS_GENSHELL_H_GUARD */
+/* genshell.h ends here */
diff --git a/autoopts/gettext.h b/autoopts/gettext.h
new file mode 100644
index 0000000..151ba4f
--- /dev/null
+++ b/autoopts/gettext.h
@@ -0,0 +1,288 @@
+/* Convenience header for conditional use of GNU <libintl.h>.
+ Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2012 Free Software
+ Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License along
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _LIBGETTEXT_H
+#define _LIBGETTEXT_H 1
+
+/* NLS can be disabled through the configure --disable-nls option. */
+#if ENABLE_NLS
+
+/* Get declarations of GNU message catalog functions. */
+# include <libintl.h>
+
+/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
+ the gettext() and ngettext() macros. This is an alternative to calling
+ textdomain(), and is useful for libraries. */
+# ifdef DEFAULT_TEXT_DOMAIN
+# undef gettext
+# define gettext(Msgid) \
+ dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
+# undef ngettext
+# define ngettext(Msgid1, Msgid2, N) \
+ dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
+# endif
+
+#else
+
+/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
+ chokes if dcgettext is defined as a macro. So include it now, to make
+ later inclusions of <locale.h> a NOP. We don't include <libintl.h>
+ as well because people using "gettext.h" will not include <libintl.h>,
+ and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
+ is OK. */
+#if defined(__sun)
+# include <locale.h>
+#endif
+
+/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
+ <libintl.h>, which chokes if dcgettext is defined as a macro. So include
+ it now, to make later inclusions of <libintl.h> a NOP. */
+#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
+# include <cstdlib>
+# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H
+# include <libintl.h>
+# endif
+#endif
+
+/* Disabled NLS.
+ The casts to 'const char *' serve the purpose of producing warnings
+ for invalid uses of the value returned from these functions.
+ On pre-ANSI systems without 'const', the config.h file is supposed to
+ contain "#define const". */
+# undef gettext
+# define gettext(Msgid) ((const char *) (Msgid))
+# undef dgettext
+# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
+# undef dcgettext
+# define dcgettext(Domainname, Msgid, Category) \
+ ((void) (Category), dgettext (Domainname, Msgid))
+# undef ngettext
+# define ngettext(Msgid1, Msgid2, N) \
+ ((N) == 1 \
+ ? ((void) (Msgid2), (const char *) (Msgid1)) \
+ : ((void) (Msgid1), (const char *) (Msgid2)))
+# undef dngettext
+# define dngettext(Domainname, Msgid1, Msgid2, N) \
+ ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
+# undef dcngettext
+# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
+ ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N))
+# undef textdomain
+# define textdomain(Domainname) ((const char *) (Domainname))
+# undef bindtextdomain
+# define bindtextdomain(Domainname, Dirname) \
+ ((void) (Domainname), (const char *) (Dirname))
+# undef bind_textdomain_codeset
+# define bind_textdomain_codeset(Domainname, Codeset) \
+ ((void) (Domainname), (const char *) (Codeset))
+
+#endif
+
+/* Prefer gnulib's setlocale override over libintl's setlocale override. */
+#ifdef GNULIB_defined_setlocale
+# undef setlocale
+# define setlocale rpl_setlocale
+#endif
+
+/* A pseudo function call that serves as a marker for the automated
+ extraction of messages, but does not call gettext(). The run-time
+ translation is done at a different place in the code.
+ The argument, String, should be a literal string. Concatenated strings
+ and other string expressions won't work.
+ The macro's expansion is not parenthesized, so that it is suitable as
+ initializer for static 'char[]' or 'const char[]' variables. */
+#define gettext_noop(String) String
+
+/* The separator between msgctxt and msgid in a .mo file. */
+#define GETTEXT_CONTEXT_GLUE "\004"
+
+/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
+ MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be
+ short and rarely need to change.
+ The letter 'p' stands for 'particular' or 'special'. */
+#ifdef DEFAULT_TEXT_DOMAIN
+# define pgettext(Msgctxt, Msgid) \
+ pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
+#else
+# define pgettext(Msgctxt, Msgid) \
+ pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
+#endif
+#define dpgettext(Domainname, Msgctxt, Msgid) \
+ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
+#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
+ pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
+#ifdef DEFAULT_TEXT_DOMAIN
+# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
+ npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
+#else
+# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
+ npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
+#endif
+#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
+ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
+#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
+ npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
+
+#ifdef __GNUC__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static const char *
+pgettext_aux (const char *domain,
+ const char *msg_ctxt_id, const char *msgid,
+ int category)
+{
+ const char *translation = dcgettext (domain, msg_ctxt_id, category);
+ if (translation == msg_ctxt_id)
+ return msgid;
+ else
+ return translation;
+}
+
+#ifdef __GNUC__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static const char *
+npgettext_aux (const char *domain,
+ const char *msg_ctxt_id, const char *msgid,
+ const char *msgid_plural, unsigned long int n,
+ int category)
+{
+ const char *translation =
+ dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
+ if (translation == msg_ctxt_id || translation == msgid_plural)
+ return (n == 1 ? msgid : msgid_plural);
+ else
+ return translation;
+}
+
+/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
+ can be arbitrary expressions. But for string literals these macros are
+ less efficient than those above. */
+
+#include <string.h>
+
+#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
+ /* || __STDC_VERSION__ >= 199901L */ )
+# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
+#else
+# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
+#endif
+
+#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+#include <stdlib.h>
+#endif
+
+#define pgettext_expr(Msgctxt, Msgid) \
+ dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
+#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
+ dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
+
+#ifdef __GNUC__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static const char *
+dcpgettext_expr (const char *domain,
+ const char *msgctxt, const char *msgid,
+ int category)
+{
+ size_t msgctxt_len = strlen (msgctxt) + 1;
+ size_t msgid_len = strlen (msgid) + 1;
+ const char *translation;
+#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+ char msg_ctxt_id[msgctxt_len + msgid_len];
+#else
+ char buf[1024];
+ char *msg_ctxt_id =
+ (msgctxt_len + msgid_len <= sizeof (buf)
+ ? buf
+ : (char *) malloc (msgctxt_len + msgid_len));
+ if (msg_ctxt_id != NULL)
+#endif
+ {
+ memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
+ msg_ctxt_id[msgctxt_len - 1] = '\004';
+ memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
+ translation = dcgettext (domain, msg_ctxt_id, category);
+#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+ if (msg_ctxt_id != buf)
+ free (msg_ctxt_id);
+#endif
+ if (translation != msg_ctxt_id)
+ return translation;
+ }
+ return msgid;
+}
+
+#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
+ dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
+#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
+ dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
+
+#ifdef __GNUC__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static const char *
+dcnpgettext_expr (const char *domain,
+ const char *msgctxt, const char *msgid,
+ const char *msgid_plural, unsigned long int n,
+ int category)
+{
+ size_t msgctxt_len = strlen (msgctxt) + 1;
+ size_t msgid_len = strlen (msgid) + 1;
+ const char *translation;
+#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+ char msg_ctxt_id[msgctxt_len + msgid_len];
+#else
+ char buf[1024];
+ char *msg_ctxt_id =
+ (msgctxt_len + msgid_len <= sizeof (buf)
+ ? buf
+ : (char *) malloc (msgctxt_len + msgid_len));
+ if (msg_ctxt_id != NULL)
+#endif
+ {
+ memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
+ msg_ctxt_id[msgctxt_len - 1] = '\004';
+ memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
+ translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
+#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
+ if (msg_ctxt_id != buf)
+ free (msg_ctxt_id);
+#endif
+ if (!(translation == msg_ctxt_id || translation == msgid_plural))
+ return translation;
+ }
+ return (n == 1 ? msgid : msgid_plural);
+}
+
+#endif /* _LIBGETTEXT_H */
diff --git a/autoopts/install-hook.sh b/autoopts/install-hook.sh
new file mode 100644
index 0000000..a987b7b
--- /dev/null
+++ b/autoopts/install-hook.sh
@@ -0,0 +1,124 @@
+#! /bin/sh
+
+# Time-stamp: "2012-08-11 08:13:30 bkorb"
+#
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under either of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+
+egrep '#undef +AUTOOPTS_ENABLED' ${top_builddir}/config.h >/dev/null && \
+ exit 0
+
+srcdir=`dirname $0`
+srcdir=`cd ${srcdir} ; pwd`
+
+. ${top_builddir}/autoopts/test/defs
+
+test -z "${POSIX_SHELL}" && exit 1
+
+rm -f ${DESTdestdir}/options.h
+opthdrsrc=${srcdir}/autoopts/options.h
+cfgf=${top_builddir}/config.h
+
+{
+ sed '/^#include <stdio/q' ${opthdrsrc}
+
+ if ${EGREP} 'define +HAVE_STDINT_H' ${cfgf} >/dev/null
+ then echo '#include <stdint.h>'
+ else echo '#include <inttypes.h>' ; fi
+
+ if ${EGREP} 'define +HAVE_LIMITS_H' ${cfgf} >/dev/null
+ then echo '#include <limits.h>'
+ else echo '#include <sys/limits.h>' ; fi
+
+ if ${EGREP} 'define +HAVE_STDBOOL_H' ${cfgf} >/dev/null
+ then echo '#include <stdbool.h>'
+ else cat <<- _EOF_
+ typedef enum { false = 0, true = 1 } _Bool;
+ #define bool _Bool
+ #define true 1
+ #define false 0
+ _EOF_
+ fi
+
+ ${EGREP} 'define +NO_OPTIONAL_OPT_ARGS' ${cfgf}
+
+ if ${EGREP} 'define +HAVE_INTPTR_T' ${cfgf} >/dev/null
+ then :
+ else
+ sizeof_charp=`${EGREP} 'define +SIZEOF_CHARP ' ${cfgf} | \
+ sed 's/.*SIZEOF_CHARP *//'`
+ sizeof_long=` ${EGREP} 'define +SIZEOF_LONG ' ${cfgf} | \
+ sed 's/.*SIZEOF_LONG *//'`
+ if test "X${sizeof_charp}" = "X${sizeof_long}"
+ then ptrtype=long
+ else ptrtype=int
+ fi
+ cat <<- _EOF_
+ #ifndef HAVE_UINTPTR_T
+ #define HAVE_UINTPTR_T 1
+ #define HAVE_INTPTR_T 1
+ typedef $ptrtype intptr_t;
+ typedef unsigned $ptrtype uintptr_t;
+ #endif /* HAVE_UINTPTR_T */
+ _EOF_
+ fi
+
+ sedcmd='1,/END-CONFIGURED-HEADERS/d'
+
+ if ${EGREP} 'define +HAVE_PATHFIND' ${cfgf} >/dev/null
+ then nopathfind='/From:.*pathfind\.c/,/#endif.*HAVE_PATHFIND/d'
+ else nopathfind='/HAVE_PATHFIND/d' ; fi
+
+ sed "${sedcmd};${nopathfind}" ${opthdrsrc}
+} > ${DESTdestdir}/options.h
+
+test -d "${DESTpkgdatadir}" && {
+ rmbuild='/# *START-BUILDTREE-ISMS/,/# *END-BUILDTREE-ISMS/d
+ /# *END-INSTALL-ONLY-CODE/d
+ /^##/d'
+
+ cd ${DESTpkgdatadir}
+ for f in *
+ do case "$f" in
+ optlib.tlib | getopt.tpl | usage.tlib | cmd-doc.tlib | \
+ agtexi-cmd.tpl | agman1.tpl | aginfo.tpl )
+ sed "${rmbuild}" $f > $f.tmp
+ mv -f $f.tmp $f
+ ;;
+
+ *.* ) : ;;
+ * )
+ chmod a+x $f
+ ;;
+ esac
+ done
+}
+
+## Local Variables:
+## Mode: shell-script
+## indent-tabs-mode: nil
+## sh-basic-offset: 4
+## sh-indent-after-do: 4
+## sh-indentation: 4
+## sh-indent-for-case-label: 0
+## sh-indent-for-case-alt: 4
+## End:
+
+# end of install-hook.sh
diff --git a/autoopts/load.c b/autoopts/load.c
new file mode 100644
index 0000000..06b0079
--- /dev/null
+++ b/autoopts/load.c
@@ -0,0 +1,519 @@
+
+/**
+ * \file load.c
+ * Time-stamp: "2012-08-11 08:20:09 bkorb"
+ *
+ * This file contains the routines that deal with processing text strings
+ * for options, either from a NUL-terminated string passed in or from an
+ * rc/ini file.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static bool
+add_prog_path(char * pzBuf, int bufSize, char const * pzName,
+ char const * pzProgPath);
+
+static bool
+add_env_val(char * buf, int buf_sz, char const * name);
+
+static char *
+assemble_arg_val(char * txt, tOptionLoadMode mode);
+/* = = = END-STATIC-FORWARD = = = */
+
+/*=export_func optionMakePath
+ * private:
+ *
+ * what: translate and construct a path
+ * arg: + char* + pzBuf + The result buffer +
+ * arg: + int + bufSize + The size of this buffer +
+ * arg: + char const* + pzName + The input name +
+ * arg: + char const* + pzProgPath + The full path of the current program +
+ *
+ * ret-type: bool
+ * ret-desc: true if the name was handled, otherwise false.
+ * If the name does not start with ``$'', then it is handled
+ * simply by copying the input name to the output buffer and
+ * resolving the name with either
+ * @code{canonicalize_file_name(3GLIBC)} or @code{realpath(3C)}.
+ *
+ * doc:
+ *
+ * This routine will copy the @code{pzName} input name into the
+ * @code{pzBuf} output buffer, not exceeding @code{bufSize} bytes. If the
+ * first character of the input name is a @code{'$'} character, then there
+ * is special handling:
+ * @*
+ * @code{$$} is replaced with the directory name of the @code{pzProgPath},
+ * searching @code{$PATH} if necessary.
+ * @*
+ * @code{$@} is replaced with the AutoGen package data installation directory
+ * (aka @code{pkgdatadir}).
+ * @*
+ * @code{$NAME} is replaced by the contents of the @code{NAME} environment
+ * variable. If not found, the search fails.
+ *
+ * Please note: both @code{$$} and @code{$NAME} must be at the start of the
+ * @code{pzName} string and must either be the entire string or be followed
+ * by the @code{'/'} (backslash on windows) character.
+ *
+ * err: @code{false} is returned if:
+ * @*
+ * @bullet{} The input name exceeds @code{bufSize} bytes.
+ * @*
+ * @bullet{} @code{$$}, @code{$@@} or @code{$NAME} is not the full string
+ * and the next character is not '/'.
+ * @*
+ * @bullet{} libopts was built without PKGDATADIR defined and @code{$@@}
+ * was specified.
+ * @*
+ * @bullet{} @code{NAME} is not a known environment variable
+ * @*
+ * @bullet{} @code{canonicalize_file_name} or @code{realpath} return
+ * errors (cannot resolve the resulting path).
+=*/
+bool
+optionMakePath(char * pzBuf, int bufSize, char const * pzName,
+ char const * pzProgPath)
+{
+ size_t name_len = strlen(pzName);
+
+ if (((size_t)bufSize <= name_len) || (name_len == 0))
+ return false;
+
+ /*
+ * IF not an environment variable, just copy the data
+ */
+ if (*pzName != '$') {
+ char const* pzS = pzName;
+ char* pzD = pzBuf;
+ int ct = bufSize;
+
+ for (;;) {
+ if ( (*(pzD++) = *(pzS++)) == NUL)
+ break;
+ if (--ct <= 0)
+ return false;
+ }
+ }
+
+ /*
+ * IF the name starts with "$$", then it must be "$$" or
+ * it must start with "$$/". In either event, replace the "$$"
+ * with the path to the executable and append a "/" character.
+ */
+ else switch (pzName[1]) {
+ case NUL:
+ return false;
+
+ case '$':
+ if (! add_prog_path(pzBuf, bufSize, pzName, pzProgPath))
+ return false;
+ break;
+
+ case '@':
+ if (program_pkgdatadir[0] == NUL)
+ return false;
+
+ if (snprintf(pzBuf, bufSize, "%s%s", program_pkgdatadir, pzName + 2)
+ >= bufSize)
+ return false;
+ break;
+
+ default:
+ if (! add_env_val(pzBuf, bufSize, pzName))
+ return false;
+ }
+
+#if defined(HAVE_CANONICALIZE_FILE_NAME)
+ {
+ char * pz = canonicalize_file_name(pzBuf);
+ if (pz == NULL)
+ return false;
+
+ name_len = strlen(pz);
+ if (name_len >= (size_t)bufSize) {
+ free(pz);
+ return false;
+ }
+
+ memcpy(pzBuf, pz, name_len + 1);
+ free(pz);
+ }
+
+#elif defined(HAVE_REALPATH)
+ {
+ char z[PATH_MAX+1];
+
+ if (realpath(pzBuf, z) == NULL)
+ return false;
+
+ name_len = strlen(z);
+ if (name_len >= bufSize)
+ return false;
+
+ memcpy(pzBuf, z, name_len + 1);
+ }
+#endif
+
+ return true;
+}
+
+static bool
+add_prog_path(char * pzBuf, int bufSize, char const * pzName,
+ char const * pzProgPath)
+{
+ char const* pzPath;
+ char const* pz;
+ int skip = 2;
+
+ switch (pzName[2]) {
+ case DIRCH:
+ skip = 3;
+ case NUL:
+ break;
+ default:
+ return false;
+ }
+
+ /*
+ * See if the path is included in the program name.
+ * If it is, we're done. Otherwise, we have to hunt
+ * for the program using "pathfind".
+ */
+ if (strchr(pzProgPath, DIRCH) != NULL)
+ pzPath = pzProgPath;
+ else {
+ pzPath = pathfind(getenv("PATH"), (char*)pzProgPath, "rx");
+
+ if (pzPath == NULL)
+ return false;
+ }
+
+ pz = strrchr(pzPath, DIRCH);
+
+ /*
+ * IF we cannot find a directory name separator,
+ * THEN we do not have a path name to our executable file.
+ */
+ if (pz == NULL)
+ return false;
+
+ pzName += skip;
+
+ /*
+ * Concatenate the file name to the end of the executable path.
+ * The result may be either a file or a directory.
+ */
+ if ((pz - pzPath)+1 + strlen(pzName) >= (unsigned)bufSize)
+ return false;
+
+ memcpy(pzBuf, pzPath, (size_t)((pz - pzPath)+1));
+ strcpy(pzBuf + (pz - pzPath) + 1, pzName);
+
+ /*
+ * If the "pzPath" path was gotten from "pathfind()", then it was
+ * allocated and we need to deallocate it.
+ */
+ if (pzPath != pzProgPath)
+ AGFREE(pzPath);
+ return true;
+}
+
+static bool
+add_env_val(char * buf, int buf_sz, char const * name)
+{
+ char * dir_part = buf;
+
+ for (;;) {
+ int ch = (int)*++name;
+ if (! IS_VALUE_NAME_CHAR(ch))
+ break;
+ *(dir_part++) = (char)ch;
+ }
+
+ if (dir_part == buf)
+ return false;
+
+ *dir_part = NUL;
+
+ dir_part = getenv(buf);
+
+ /*
+ * Environment value not found -- skip the home list entry
+ */
+ if (dir_part == NULL)
+ return false;
+
+ if (strlen(dir_part) + 1 + strlen(name) >= (unsigned)buf_sz)
+ return false;
+
+ sprintf(buf, "%s%s", dir_part, name);
+ return true;
+}
+
+LOCAL void
+mungeString(char * txt, tOptionLoadMode mode)
+{
+ char * pzE;
+
+ if (mode == OPTION_LOAD_KEEP)
+ return;
+
+ if (IS_WHITESPACE_CHAR(*txt)) {
+ char * pzS = SPN_WHITESPACE_CHARS(txt+1);
+ size_t l = strlen(pzS) + 1;
+ memmove(txt, pzS, l);
+ pzE = txt + l - 1;
+
+ } else
+ pzE = txt + strlen(txt);
+
+ pzE = SPN_WHITESPACE_BACK(txt, pzE);
+ *pzE = NUL;
+
+ if (mode == OPTION_LOAD_UNCOOKED)
+ return;
+
+ switch (*txt) {
+ default: return;
+ case '"':
+ case '\'': break;
+ }
+
+ switch (pzE[-1]) {
+ default: return;
+ case '"':
+ case '\'': break;
+ }
+
+ (void)ao_string_cook(txt, NULL);
+}
+
+static char *
+assemble_arg_val(char * txt, tOptionLoadMode mode)
+{
+ char* pzEnd = strpbrk(txt, ARG_BREAK_STR);
+ int space_break;
+
+ /*
+ * Not having an argument to a configurable name is okay.
+ */
+ if (pzEnd == NULL)
+ return txt + strlen(txt);
+
+ /*
+ * If we are keeping all whitespace, then the modevalue starts with the
+ * character that follows the end of the configurable name, regardless
+ * of which character caused it.
+ */
+ if (mode == OPTION_LOAD_KEEP) {
+ *(pzEnd++) = NUL;
+ return pzEnd;
+ }
+
+ /*
+ * If the name ended on a white space character, remember that
+ * because we'll have to skip over an immediately following ':' or '='
+ * (and the white space following *that*).
+ */
+ space_break = IS_WHITESPACE_CHAR(*pzEnd);
+ *(pzEnd++) = NUL;
+
+ pzEnd = SPN_WHITESPACE_CHARS(pzEnd);
+ if (space_break && ((*pzEnd == ':') || (*pzEnd == '=')))
+ pzEnd = SPN_WHITESPACE_CHARS(pzEnd+1);
+
+ return pzEnd;
+}
+
+/**
+ * Load an option from a block of text. The text must start with the
+ * configurable/option name and be followed by its associated value.
+ * That value may be processed in any of several ways. See "tOptionLoadMode"
+ * in autoopts.h.
+ *
+ * @param[in,out] opts program options descriptor
+ * @param[in,out] opt_state option processing state
+ * @param[in,out] line source line with long option name in it
+ * @param[in] direction current processing direction (preset or not)
+ * @param[in] load_mode option loading mode (OPTION_LOAD_*)
+ */
+LOCAL void
+loadOptionLine(
+ tOptions * opts,
+ tOptState * opt_state,
+ char * line,
+ tDirection direction,
+ tOptionLoadMode load_mode )
+{
+ line = SPN_LOAD_LINE_SKIP_CHARS(line);
+
+ {
+ char * arg = assemble_arg_val(line, load_mode);
+
+ if (! SUCCESSFUL(opt_find_long(opts, line, opt_state)))
+ return;
+
+ if (opt_state->flags & OPTST_NO_INIT)
+ return;
+
+ opt_state->pzOptArg = arg;
+ }
+
+ switch (opt_state->flags & (OPTST_IMM|OPTST_DISABLE_IMM)) {
+ case 0:
+ /*
+ * The selected option has no immediate action.
+ * THEREFORE, if the direction is PRESETTING
+ * THEN we skip this option.
+ */
+ if (PRESETTING(direction))
+ return;
+ break;
+
+ case OPTST_IMM:
+ if (PRESETTING(direction)) {
+ /*
+ * We are in the presetting direction with an option we handle
+ * immediately for enablement, but normally for disablement.
+ * Therefore, skip if disabled.
+ */
+ if ((opt_state->flags & OPTST_DISABLED) == 0)
+ return;
+ } else {
+ /*
+ * We are in the processing direction with an option we handle
+ * immediately for enablement, but normally for disablement.
+ * Therefore, skip if NOT disabled.
+ */
+ if ((opt_state->flags & OPTST_DISABLED) != 0)
+ return;
+ }
+ break;
+
+ case OPTST_DISABLE_IMM:
+ if (PRESETTING(direction)) {
+ /*
+ * We are in the presetting direction with an option we handle
+ * immediately for disablement, but normally for disablement.
+ * Therefore, skip if NOT disabled.
+ */
+ if ((opt_state->flags & OPTST_DISABLED) != 0)
+ return;
+ } else {
+ /*
+ * We are in the processing direction with an option we handle
+ * immediately for disablement, but normally for disablement.
+ * Therefore, skip if disabled.
+ */
+ if ((opt_state->flags & OPTST_DISABLED) == 0)
+ return;
+ }
+ break;
+
+ case OPTST_IMM|OPTST_DISABLE_IMM:
+ /*
+ * The selected option is always for immediate action.
+ * THEREFORE, if the direction is PROCESSING
+ * THEN we skip this option.
+ */
+ if (PROCESSING(direction))
+ return;
+ break;
+ }
+
+ /*
+ * Fix up the args.
+ */
+ if (OPTST_GET_ARGTYPE(opt_state->pOD->fOptState) == OPARG_TYPE_NONE) {
+ if (*opt_state->pzOptArg != NUL)
+ return;
+ opt_state->pzOptArg = NULL;
+
+ } else if (opt_state->pOD->fOptState & OPTST_ARG_OPTIONAL) {
+ if (*opt_state->pzOptArg == NUL)
+ opt_state->pzOptArg = NULL;
+ else {
+ AGDUPSTR(opt_state->pzOptArg, opt_state->pzOptArg, "opt arg");
+ opt_state->flags |= OPTST_ALLOC_ARG;
+ }
+
+ } else {
+ if (*opt_state->pzOptArg == NUL)
+ opt_state->pzOptArg = zNil;
+ else {
+ AGDUPSTR(opt_state->pzOptArg, opt_state->pzOptArg, "opt arg");
+ opt_state->flags |= OPTST_ALLOC_ARG;
+ }
+ }
+
+ {
+ tOptionLoadMode sv = option_load_mode;
+ option_load_mode = load_mode;
+ handle_opt(opts, opt_state);
+ option_load_mode = sv;
+ }
+}
+
+/*=export_func optionLoadLine
+ *
+ * what: process a string for an option name and value
+ *
+ * arg: tOptions*, opts, program options descriptor
+ * arg: char const*, line, NUL-terminated text
+ *
+ * doc:
+ *
+ * This is a client program callable routine for setting options from, for
+ * example, the contents of a file that they read in. Only one option may
+ * appear in the text. It will be treated as a normal (non-preset) option.
+ *
+ * When passed a pointer to the option struct and a string, it will find
+ * the option named by the first token on the string and set the option
+ * argument to the remainder of the string. The caller must NUL terminate
+ * the string. The caller need not skip over any introductory hyphens.
+ * Any embedded new lines will be included in the option
+ * argument. If the input looks like one or more quoted strings, then the
+ * input will be "cooked". The "cooking" is identical to the string
+ * formation used in AutoGen definition files (@pxref{basic expression}),
+ * except that you may not use backquotes.
+ *
+ * err: Invalid options are silently ignored. Invalid option arguments
+ * will cause a warning to print, but the function should return.
+=*/
+void
+optionLoadLine(tOptions * opts, char const * line)
+{
+ tOptState st = OPTSTATE_INITIALIZER(SET);
+ char* pz;
+ AGDUPSTR(pz, line, "user option line");
+ loadOptionLine(opts, &st, pz, DIRECTION_PROCESS, OPTION_LOAD_COOKED);
+ AGFREE(pz);
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/load.c */
diff --git a/autoopts/makeshell.c b/autoopts/makeshell.c
new file mode 100644
index 0000000..5ba949d
--- /dev/null
+++ b/autoopts/makeshell.c
@@ -0,0 +1,873 @@
+
+/**
+ * \file makeshell.c
+ *
+ * Time-stamp: "2012-08-11 08:51:32 bkorb"
+ *
+ * This module will interpret the options set in the tOptions
+ * structure and create a Bourne shell script capable of parsing them.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+tOptions * optionParseShellOptions = NULL;
+
+static char const * shell_prog = NULL;
+static char * script_leader = NULL;
+static char * script_trailer = NULL;
+static char * script_text = NULL;
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+emit_var_text(char const * prog, char const * var, int fdin);
+
+static void
+text_to_var(tOptions * pOpts, teTextTo whichVar, tOptDesc * pOD);
+
+static void
+emit_usage(tOptions * pOpts);
+
+static void
+emit_setup(tOptions * pOpts);
+
+static void
+emit_action(tOptions * pOpts, tOptDesc* pOptDesc);
+
+static void
+emit_inaction(tOptions * pOpts, tOptDesc* pOptDesc);
+
+static void
+emit_flag(tOptions * pOpts);
+
+static void
+emit_match_expr(char const * pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts);
+
+static void
+emit_long(tOptions * pOpts);
+
+static char *
+load_old_output(char const * fname);
+
+static void
+open_out(char const * fname);
+/* = = = END-STATIC-FORWARD = = = */
+
+/*=export_func optionParseShell
+ * private:
+ *
+ * what: Decipher a boolean value
+ * arg: + tOptions* + pOpts + program options descriptor +
+ *
+ * doc:
+ * Emit a shell script that will parse the command line options.
+=*/
+void
+optionParseShell(tOptions * pOpts)
+{
+ /*
+ * Check for our SHELL option now.
+ * IF the output file contains the "#!" magic marker,
+ * it will override anything we do here.
+ */
+ if (HAVE_GENSHELL_OPT(SHELL))
+ shell_prog = GENSHELL_OPT_ARG(SHELL);
+
+ else if (! ENABLED_GENSHELL_OPT(SHELL))
+ shell_prog = NULL;
+
+ else if ((shell_prog = getenv("SHELL")),
+ shell_prog == NULL)
+
+ shell_prog = POSIX_SHELL;
+
+ /*
+ * Check for a specified output file
+ */
+ if (HAVE_GENSHELL_OPT(SCRIPT))
+ open_out(GENSHELL_OPT_ARG(SCRIPT));
+
+ emit_usage(pOpts);
+ emit_setup(pOpts);
+
+ /*
+ * There are four modes of option processing.
+ */
+ switch (pOpts->fOptSet & (OPTPROC_LONGOPT|OPTPROC_SHORTOPT)) {
+ case OPTPROC_LONGOPT:
+ fputs(LOOP_STR, stdout);
+
+ fputs(LONG_OPT_MARK, stdout);
+ fputs(INIT_LOPT_STR, stdout);
+ emit_long(pOpts);
+ printf(LOPT_ARG_FMT, pOpts->pzPROGNAME);
+ fputs(END_OPT_SEL_STR, stdout);
+
+ fputs(NOT_FOUND_STR, stdout);
+ break;
+
+ case 0:
+ fputs(ONLY_OPTS_LOOP, stdout);
+ fputs(INIT_LOPT_STR, stdout);
+ emit_long(pOpts);
+ printf(LOPT_ARG_FMT, pOpts->pzPROGNAME);
+ break;
+
+ case OPTPROC_SHORTOPT:
+ fputs(LOOP_STR, stdout);
+
+ fputs(FLAG_OPT_MARK, stdout);
+ fputs(INIT_OPT_STR, stdout);
+ emit_flag(pOpts);
+ printf(OPT_ARG_FMT, pOpts->pzPROGNAME);
+ fputs(END_OPT_SEL_STR, stdout);
+
+ fputs(NOT_FOUND_STR, stdout);
+ break;
+
+ case OPTPROC_LONGOPT|OPTPROC_SHORTOPT:
+ fputs(LOOP_STR, stdout);
+
+ fputs(LONG_OPT_MARK, stdout);
+ fputs(INIT_LOPT_STR, stdout);
+ emit_long(pOpts);
+ printf(LOPT_ARG_FMT, pOpts->pzPROGNAME);
+ fputs(END_OPT_SEL_STR, stdout);
+
+ fputs(FLAG_OPT_MARK, stdout);
+ fputs(INIT_OPT_STR, stdout);
+ emit_flag(pOpts);
+ printf(OPT_ARG_FMT, pOpts->pzPROGNAME);
+ fputs(END_OPT_SEL_STR, stdout);
+
+ fputs(NOT_FOUND_STR, stdout);
+ break;
+ }
+
+ printf(zLoopEnd, pOpts->pzPROGNAME, END_MARK);
+ if ((script_trailer != NULL) && (*script_trailer != NUL))
+ fputs(script_trailer, stdout);
+ else if (ENABLED_GENSHELL_OPT(SHELL))
+ printf(SHOW_PROG_ENV, pOpts->pzPROGNAME);
+
+#ifdef HAVE_FCHMOD
+ fchmod(STDOUT_FILENO, 0755);
+#endif
+ fclose(stdout);
+
+ if (ferror(stdout)) {
+ fputs(zOutputFail, stderr);
+ exit(EXIT_FAILURE);
+ }
+
+ AGFREE(script_text);
+ script_leader = NULL;
+ script_trailer = NULL;
+ script_text = NULL;
+}
+
+#ifdef HAVE_WORKING_FORK
+static void
+emit_var_text(char const * prog, char const * var, int fdin)
+{
+ FILE * fp = fdopen(fdin, "r" FOPEN_BINARY_FLAG);
+ int nlct = 0; /* defer newlines and skip trailing ones */
+
+ printf(SET_TEXT_FMT, prog, var);
+ if (fp == NULL)
+ goto skip_text;
+
+ for (;;) {
+ int ch = fgetc(fp);
+ switch (ch) {
+
+ case NL:
+ nlct++;
+ break;
+
+ case '\'':
+ while (nlct > 0) {
+ fputc(NL, stdout);
+ nlct--;
+ }
+ fputs(apostrophy, stdout);
+ break;
+
+ case EOF:
+ goto endCharLoop;
+
+ default:
+ while (nlct > 0) {
+ fputc(NL, stdout);
+ nlct--;
+ }
+ fputc(ch, stdout);
+ break;
+ }
+ } endCharLoop:;
+
+ fclose(fp);
+
+skip_text:
+
+ fputs(END_SET_TEXT, stdout);
+}
+
+#endif
+
+/*
+ * The purpose of this function is to assign "long usage", short usage
+ * and version information to a shell variable. Rather than wind our
+ * way through all the logic necessary to emit the text directly, we
+ * fork(), have our child process emit the text the normal way and
+ * capture the output in the parent process.
+ */
+static void
+text_to_var(tOptions * pOpts, teTextTo whichVar, tOptDesc * pOD)
+{
+# define _TT_(n) static char const z ## n [] = #n;
+ TEXTTO_TABLE
+# undef _TT_
+# define _TT_(n) z ## n ,
+ static char const * apzTTNames[] = { TEXTTO_TABLE };
+# undef _TT_
+
+#if ! defined(HAVE_WORKING_FORK)
+ printf(SET_NO_TEXT_FMT, pOpts->pzPROGNAME, apzTTNames[ whichVar]);
+#else
+ int pipeFd[2];
+
+ fflush(stdout);
+ fflush(stderr);
+
+ if (pipe(pipeFd) != 0) {
+ fprintf(stderr, zBadPipe, errno, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
+ switch (fork()) {
+ case -1:
+ fprintf(stderr, zForkFail, errno, strerror(errno), pOpts->pzProgName);
+ exit(EXIT_FAILURE);
+ break;
+
+ case 0:
+ /*
+ * Send both stderr and stdout to the pipe. No matter which
+ * descriptor is used, we capture the output on the read end.
+ */
+ dup2(pipeFd[1], STDERR_FILENO);
+ dup2(pipeFd[1], STDOUT_FILENO);
+ close(pipeFd[0]);
+
+ switch (whichVar) {
+ case TT_LONGUSAGE:
+ (*(pOpts->pUsageProc))(pOpts, EXIT_SUCCESS);
+ /* NOTREACHED */
+
+ case TT_USAGE:
+ (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+
+ case TT_VERSION:
+ if (pOD->fOptState & OPTST_ALLOC_ARG) {
+ AGFREE(pOD->optArg.argString);
+ pOD->fOptState &= ~OPTST_ALLOC_ARG;
+ }
+ pOD->optArg.argString = "c";
+ optionPrintVersion(pOpts, pOD);
+ /* NOTREACHED */
+
+ default:
+ exit(EXIT_FAILURE);
+ }
+
+ default:
+ close(pipeFd[1]);
+ }
+
+ emit_var_text(pOpts->pzPROGNAME, apzTTNames[whichVar], pipeFd[0]);
+#endif
+}
+
+
+static void
+emit_usage(tOptions * pOpts)
+{
+ char zTimeBuf[AO_NAME_SIZE];
+
+ /*
+ * First, switch stdout to the output file name.
+ * Then, change the program name to the one defined
+ * by the definitions (rather than the current
+ * executable name). Down case the upper cased name.
+ */
+ if (script_leader != NULL)
+ fputs(script_leader, stdout);
+
+ {
+ char const * out_nm;
+
+ {
+ time_t c_tim = time(NULL);
+ struct tm * ptm = localtime(&c_tim);
+ strftime(zTimeBuf, AO_NAME_SIZE, TIME_FMT, ptm );
+ }
+
+ if (HAVE_GENSHELL_OPT(SCRIPT))
+ out_nm = GENSHELL_OPT_ARG(SCRIPT);
+ else out_nm = STDOUT;
+
+ if ((script_leader == NULL) && (shell_prog != NULL))
+ printf(SHELL_MAGIC, shell_prog);
+
+ printf(PREAMBLE_FMT, START_MARK, out_nm, zTimeBuf);
+ }
+
+ printf(END_PRE_FMT, pOpts->pzPROGNAME);
+
+ /*
+ * Get a copy of the original program name in lower case and
+ * fill in an approximation of the program name from it.
+ */
+ {
+ char * pzPN = zTimeBuf;
+ char const * pz = pOpts->pzPROGNAME;
+ char ** pp;
+
+ for (;;) {
+ if ((*pzPN++ = (char)tolower(*pz++)) == NUL)
+ break;
+ }
+
+ pp = (char **)(void *)&(pOpts->pzProgPath);
+ *pp = zTimeBuf;
+ pp = (char **)(void *)&(pOpts->pzProgName);
+ *pp = zTimeBuf;
+ }
+
+ text_to_var(pOpts, TT_LONGUSAGE, NULL);
+ text_to_var(pOpts, TT_USAGE, NULL);
+
+ {
+ tOptDesc* pOptDesc = pOpts->pOptDesc;
+ int optionCt = pOpts->optCt;
+
+ for (;;) {
+ if (pOptDesc->pOptProc == optionPrintVersion) {
+ text_to_var(pOpts, TT_VERSION, pOptDesc);
+ break;
+ }
+
+ if (--optionCt <= 0)
+ break;
+ pOptDesc++;
+ }
+ }
+}
+
+
+static void
+emit_setup(tOptions * pOpts)
+{
+ tOptDesc * pOptDesc = pOpts->pOptDesc;
+ int optionCt = pOpts->presetOptCt;
+ char const * pzFmt;
+ char const * pzDefault;
+
+ for (;optionCt > 0; pOptDesc++, --optionCt) {
+ char zVal[32];
+
+ /*
+ * Options that are either usage documentation or are compiled out
+ * are not to be processed.
+ */
+ if (SKIP_OPT(pOptDesc) || (pOptDesc->pz_NAME == NULL))
+ continue;
+
+ if (pOptDesc->optMaxCt > 1)
+ pzFmt = MULTI_DEF_FMT;
+ else pzFmt = SGL_DEF_FMT;
+
+ /*
+ * IF this is an enumeration/bitmask option, then convert the value
+ * to a string before printing the default value.
+ */
+ switch (OPTST_GET_ARGTYPE(pOptDesc->fOptState)) {
+ case OPARG_TYPE_ENUMERATION:
+ (*(pOptDesc->pOptProc))(OPTPROC_EMIT_SHELL, pOptDesc );
+ pzDefault = pOptDesc->optArg.argString;
+ break;
+
+ /*
+ * Numeric and membership bit options are just printed as a number.
+ */
+ case OPARG_TYPE_NUMERIC:
+ snprintf(zVal, sizeof(zVal), "%d",
+ (int)pOptDesc->optArg.argInt);
+ pzDefault = zVal;
+ break;
+
+ case OPARG_TYPE_MEMBERSHIP:
+ snprintf(zVal, sizeof(zVal), "%lu",
+ (unsigned long)pOptDesc->optArg.argIntptr);
+ pzDefault = zVal;
+ break;
+
+ case OPARG_TYPE_BOOLEAN:
+ pzDefault = (pOptDesc->optArg.argBool) ? TRUE_STR : FALSE_STR;
+ break;
+
+ default:
+ if (pOptDesc->optArg.argString == NULL) {
+ if (pzFmt == SGL_DEF_FMT)
+ pzFmt = SGL_NO_DEF_FMT;
+ pzDefault = NULL;
+ }
+ else
+ pzDefault = pOptDesc->optArg.argString;
+ }
+
+ printf(pzFmt, pOpts->pzPROGNAME, pOptDesc->pz_NAME, pzDefault);
+ }
+}
+
+static void
+emit_action(tOptions * pOpts, tOptDesc* pOptDesc)
+{
+ if (pOptDesc->pOptProc == optionPrintVersion)
+ printf(zTextExit, pOpts->pzPROGNAME, VER_STR);
+
+ else if (pOptDesc->pOptProc == optionPagedUsage)
+ printf(zPagedUsageExit, pOpts->pzPROGNAME);
+
+ else if (pOptDesc->pOptProc == optionLoadOpt) {
+ printf(zCmdFmt, NO_LOAD_WARN);
+ printf(zCmdFmt, YES_NEED_OPT_ARG);
+
+ } else if (pOptDesc->pz_NAME == NULL) {
+
+ if (pOptDesc->pOptProc == NULL) {
+ printf(zCmdFmt, NO_SAVE_OPTS);
+ printf(zCmdFmt, OK_NEED_OPT_ARG);
+ } else
+ printf(zTextExit, pOpts->pzPROGNAME, LONG_USE_STR);
+
+ } else {
+ if (pOptDesc->optMaxCt == 1)
+ printf(SGL_ARG_FMT, pOpts->pzPROGNAME, pOptDesc->pz_NAME);
+ else {
+ if ((unsigned)pOptDesc->optMaxCt < NOLIMIT)
+ printf(zCountTest, pOpts->pzPROGNAME,
+ pOptDesc->pz_NAME, pOptDesc->optMaxCt);
+
+ printf(MULTI_ARG_FMT, pOpts->pzPROGNAME, pOptDesc->pz_NAME);
+ }
+
+ /*
+ * Fix up the args.
+ */
+ if (OPTST_GET_ARGTYPE(pOptDesc->fOptState) == OPARG_TYPE_NONE) {
+ printf(zCantArg, pOpts->pzPROGNAME, pOptDesc->pz_NAME);
+
+ } else if (pOptDesc->fOptState & OPTST_ARG_OPTIONAL) {
+ printf(zMayArg, pOpts->pzPROGNAME, pOptDesc->pz_NAME);
+
+ } else {
+ fputs(zMustArg, stdout);
+ }
+ }
+ fputs(zOptionEndSelect, stdout);
+}
+
+
+static void
+emit_inaction(tOptions * pOpts, tOptDesc* pOptDesc)
+{
+ if (pOptDesc->pOptProc == optionLoadOpt) {
+ printf(zCmdFmt, NO_SUPPRESS_LOAD);
+
+ } else if (pOptDesc->optMaxCt == 1)
+ printf(NO_SGL_ARG_FMT, pOpts->pzPROGNAME,
+ pOptDesc->pz_NAME, pOptDesc->pz_DisablePfx);
+ else
+ printf(NO_MULTI_ARG_FMT, pOpts->pzPROGNAME,
+ pOptDesc->pz_NAME, pOptDesc->pz_DisablePfx);
+
+ printf(zCmdFmt, NO_ARG_NEEDED);
+ fputs(zOptionEndSelect, stdout);
+}
+
+
+static void
+emit_flag(tOptions * pOpts)
+{
+ tOptDesc* pOptDesc = pOpts->pOptDesc;
+ int optionCt = pOpts->optCt;
+
+ fputs(zOptionCase, stdout);
+
+ for (;optionCt > 0; pOptDesc++, --optionCt) {
+
+ if (SKIP_OPT(pOptDesc))
+ continue;
+
+ if (IS_GRAPHIC_CHAR(pOptDesc->optValue)) {
+ printf(zOptionFlag, pOptDesc->optValue);
+ emit_action(pOpts, pOptDesc);
+ }
+ }
+ printf(UNK_OPT_FMT, FLAG_STR, pOpts->pzPROGNAME);
+}
+
+
+/*
+ * Emit the match text for a long option
+ */
+static void
+emit_match_expr(char const * pzMatchName, tOptDesc* pCurOpt, tOptions* pOpts)
+{
+ tOptDesc* pOD = pOpts->pOptDesc;
+ int oCt = pOpts->optCt;
+ int min = 1;
+ char zName[ 256 ];
+ char* pz = zName;
+
+ for (;;) {
+ int matchCt = 0;
+
+ /*
+ * Omit the current option, Documentation opts and compiled out opts.
+ */
+ if ((pOD == pCurOpt) || SKIP_OPT(pOD)){
+ if (--oCt <= 0)
+ break;
+ pOD++;
+ continue;
+ }
+
+ /*
+ * Check each character of the name case insensitively.
+ * They must not be the same. They cannot be, because it would
+ * not compile correctly if they were.
+ */
+ while ( toupper(pOD->pz_Name[matchCt])
+ == toupper(pzMatchName[matchCt]))
+ matchCt++;
+
+ if (matchCt > min)
+ min = matchCt;
+
+ /*
+ * Check the disablement name, too.
+ */
+ if (pOD->pz_DisableName != NULL) {
+ matchCt = 0;
+ while ( toupper(pOD->pz_DisableName[matchCt])
+ == toupper(pzMatchName[matchCt]))
+ matchCt++;
+ if (matchCt > min)
+ min = matchCt;
+ }
+ if (--oCt <= 0)
+ break;
+ pOD++;
+ }
+
+ /*
+ * IF the 'min' is all or one short of the name length,
+ * THEN the entire string must be matched.
+ */
+ if ( (pzMatchName[min ] == NUL)
+ || (pzMatchName[min+1] == NUL) )
+ printf(zOptionFullName, pzMatchName);
+
+ else {
+ int matchCt = 0;
+ for (; matchCt <= min; matchCt++)
+ *pz++ = pzMatchName[matchCt];
+
+ for (;;) {
+ *pz = NUL;
+ printf(zOptionPartName, zName);
+ *pz++ = pzMatchName[matchCt++];
+ if (pzMatchName[matchCt] == NUL) {
+ *pz = NUL;
+ printf(zOptionFullName, zName);
+ break;
+ }
+ }
+ }
+}
+
+
+/**
+ * Emit GNU-standard long option handling code.
+ */
+static void
+emit_long(tOptions * pOpts)
+{
+ tOptDesc* pOD = pOpts->pOptDesc;
+ int ct = pOpts->optCt;
+
+ fputs(zOptionCase, stdout);
+
+ /*
+ * do each option, ...
+ */
+ do {
+ /*
+ * Documentation & compiled-out options
+ */
+ if (SKIP_OPT(pOD))
+ continue;
+
+ emit_match_expr(pOD->pz_Name, pOD, pOpts);
+ emit_action(pOpts, pOD);
+
+ /*
+ * Now, do the same thing for the disablement version of the option.
+ */
+ if (pOD->pz_DisableName != NULL) {
+ emit_match_expr(pOD->pz_DisableName, pOD, pOpts);
+ emit_inaction(pOpts, pOD);
+ }
+ } while (pOD++, --ct > 0);
+
+ printf(UNK_OPT_FMT, OPTION_STR, pOpts->pzPROGNAME);
+}
+
+/**
+ * Load the previous shell script output file. We need to preserve any
+ * hand-edited additions outside of the START_MARK and END_MARKs.
+ *
+ * @param[in] fname the output file name
+ */
+static char *
+load_old_output(char const * fname)
+{
+ /*
+ * IF we cannot stat the file,
+ * THEN assume we are creating a new file.
+ * Skip the loading of the old data.
+ */
+ FILE * fp = fopen(fname, "r" FOPEN_BINARY_FLAG);
+ struct stat stbf;
+ char * text;
+ char * scan;
+
+ if (fp == NULL)
+ return NULL;
+
+ /*
+ * If we opened it, we should be able to stat it and it needs
+ * to be a regular file
+ */
+ if ((fstat(fileno(fp), &stbf) != 0) || (! S_ISREG(stbf.st_mode))) {
+ fprintf(stderr, zNotFile, fname);
+ exit(EXIT_FAILURE);
+ }
+
+ scan = text = AGALOC(stbf.st_size + 1, "f data");
+
+ /*
+ * Read in all the data as fast as our OS will let us.
+ */
+ for (;;) {
+ int inct = fread((void*)scan, (size_t)1, stbf.st_size, fp);
+ if (inct == 0)
+ break;
+
+ stbf.st_size -= inct;
+
+ if (stbf.st_size == 0)
+ break;
+
+ scan += inct;
+ }
+
+ *scan = NUL;
+ fclose(fp);
+
+ return text;
+}
+
+/**
+ * Open the specified output file. If it already exists, load its
+ * contents and save the non-generated (hand edited) portions.
+ * If a "start mark" is found, everything before it is preserved leader.
+ * If not, the entire thing is a trailer. Assuming the start is found,
+ * then everything after the end marker is the trailer. If the end
+ * mark is not found, the file is actually corrupt, but we take the
+ * remainder to be the trailer.
+ *
+ * @param[in] fname the output file name
+ */
+static void
+open_out(char const * fname)
+{
+
+ do {
+ char * txt = script_text = load_old_output(fname);
+ char * scn;
+
+ if (txt == NULL)
+ break;
+
+ scn = strstr(txt, START_MARK);
+ if (scn == NULL) {
+ script_trailer = txt;
+ break;
+ }
+
+ *(scn++) = NUL;
+ scn = strstr(scn, END_MARK);
+ if (scn == NULL) {
+ /*
+ * The file is corrupt.
+ */
+ script_trailer = txt + strlen(txt) + START_MARK_LEN + 1;
+ break;
+ }
+
+ /*
+ * Check to see if the data contains our marker.
+ * If it does, then we will skip over it
+ */
+ script_trailer = scn + END_MARK_LEN;
+ script_leader = txt;
+ } while (false);
+
+ if (freopen(fname, "w" FOPEN_BINARY_FLAG, stdout) != stdout) {
+ fprintf(stderr, zFreopenFail, errno, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+}
+
+
+/*=export_func genshelloptUsage
+ * private:
+ * what: The usage function for the genshellopt generated program
+ *
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + int + exitCode + usage text type to produce +
+ *
+ * doc:
+ * This function is used to create the usage strings for the option
+ * processing shell script code. Two child processes are spawned
+ * each emitting the usage text in either the short (error exit)
+ * style or the long style. The generated program will capture this
+ * and create shell script variables containing the two types of text.
+=*/
+void
+genshelloptUsage(tOptions * pOpts, int exitCode)
+{
+#if ! defined(HAVE_WORKING_FORK)
+ optionUsage(pOpts, exitCode);
+#else
+ /*
+ * IF not EXIT_SUCCESS,
+ * THEN emit the short form of usage.
+ */
+ if (exitCode != EXIT_SUCCESS)
+ optionUsage(pOpts, exitCode);
+ fflush(stderr);
+ fflush(stdout);
+ if (ferror(stdout) || ferror(stderr))
+ exit(EXIT_FAILURE);
+
+ option_usage_fp = stdout;
+
+ /*
+ * First, print our usage
+ */
+ switch (fork()) {
+ case -1:
+ optionUsage(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+
+ case 0:
+ pagerState = PAGER_STATE_CHILD;
+ optionUsage(pOpts, EXIT_SUCCESS);
+ /* NOTREACHED */
+ _exit(EXIT_FAILURE);
+
+ default:
+ {
+ int sts;
+ wait(&sts);
+ }
+ }
+
+ /*
+ * Generate the pzProgName, since optionProcess() normally
+ * gets it from the command line
+ */
+ {
+ char * pz;
+ char ** pp = (char **)(void *)&(optionParseShellOptions->pzProgName);
+ AGDUPSTR(pz, optionParseShellOptions->pzPROGNAME, "prog name");
+ *pp = pz;
+ while (*pz != NUL) {
+ *pz = tolower(*pz);
+ pz++;
+ }
+ }
+
+ /*
+ * Separate the makeshell usage from the client usage
+ */
+ fprintf(option_usage_fp, zGenshell, optionParseShellOptions->pzProgName);
+ fflush(option_usage_fp);
+
+ /*
+ * Now, print the client usage.
+ */
+ switch (fork()) {
+ case 0:
+ pagerState = PAGER_STATE_CHILD;
+ /*FALLTHROUGH*/
+ case -1:
+ optionUsage(optionParseShellOptions, EXIT_FAILURE);
+
+ default:
+ {
+ int sts;
+ wait(&sts);
+ }
+ }
+
+ fflush(stdout);
+ if (ferror(stdout)) {
+ fputs(zOutputFail, stderr);
+ exit(EXIT_FAILURE);
+ }
+
+ exit(EXIT_SUCCESS);
+#endif
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/makeshell.c */
diff --git a/autoopts/mk-autoopts-pc.in b/autoopts/mk-autoopts-pc.in
new file mode 100644
index 0000000..e14d396
--- /dev/null
+++ b/autoopts/mk-autoopts-pc.in
@@ -0,0 +1,78 @@
+#! @CONFIG_SHELL@
+## ---------------------------------------------------------------------
+## mk-autoopts-pc.in -- Describe AutoOpts configuration
+##
+## Autoopts Copyright (c) 1992-2012 by Bruce Korb
+##
+## DO NOT EDIT THIS FILE (mk-autoopts-pc.in)
+##
+## It has been AutoGen-ed August 11, 2012 at 09:41:23 AM by AutoGen 5.16.2pre7
+## From the definitions aoconf.def
+## and the template file aoconf.tpl
+##
+ prefix="@prefix@"
+ datarootdir="@datarootdir@"
+ datadir="@datadir@"
+ package="@PACKAGE@"
+ includedir="@includedir@"
+ exec_prefix="@exec_prefix@"
+ bindir="@bindir@"
+ libdir="@libdir@"
+ ldopts="@AG_LDFLAGS@"
+ exeext="@EXEEXT@"
+ version="@AO_CURRENT@:@AO_REVISION@:@AO_AGE@"
+ dotver="@AO_CURRENT@.@AO_REVISION@.@AO_AGE@"
+ pkgdatadir="${datadir}/${package}"
+ autogen="${bindir}/autogen${exeext}"
+ ldflags="-L${libdir} -lopts"
+ libs="${ldflags}"
+ libsrc="${pkgdatadir}/libopts-${dotver}.tar.gz"
+ static_libs="${libdir}/libopts.a"
+ cflags="-I${includedir}"
+test 'X@ENABLE_STATIC@' = Xno && static_libs=''
+case "${libdir}" in
+/lib | /lib64 | /usr/lib | /usr/lib64 )
+ ldopts=''
+ ldflags=-lopts
+ ;;
+
+* )
+ test -n "${ldopts}" && \
+ ldflags="${ldopts}${libdir} ${ldflags}"
+ ;;
+esac
+libs=${ldflags}
+test "${includedir}" = "/usr/include" && cflags=""
+PS4='>mk-aopc> '
+dirname=`dirname ${1}`
+test -d ${dirname} || mkdir -p ${dirname} || exit 1
+
+cat > ${1} <<- _EOF_
+ # pkg-config information for AutoOpts ${dotver}
+ #
+ prefix="${prefix}"
+ datarootdir="${datarootdir}"
+ datadir="${datadir}"
+ package="${package}"
+ includedir="${includedir}"
+ exec_prefix="${exec_prefix}"
+ bindir="${bindir}"
+ libdir="${libdir}"
+ ldopts="${ldopts}"
+ exeext="${exeext}"
+ version="${version}"
+ dotver="${dotver}"
+ pkgdatadir="${pkgdatadir}"
+ autogen="${autogen}"
+ libs="${libs}"
+ libsrc="${libsrc}"
+ static_libs="${static_libs}"
+
+ Name: AutoOpts
+ Description: A semi-automated generated/library option parser
+ URL: http://www.gnu.org/software/autogen
+ Version: ${dotver}
+ Libs: ${ldflags}
+ Cflags: ${cflags}
+ _EOF_
+## end of mk-autoopts-pc.in
diff --git a/autoopts/mk-tpl-config.sh b/autoopts/mk-tpl-config.sh
new file mode 100755
index 0000000..5c37b29
--- /dev/null
+++ b/autoopts/mk-tpl-config.sh
@@ -0,0 +1,140 @@
+#! /bin/sh
+
+prog=`basename $0 .sh`
+
+die() {
+ echo "$prog failure: $*"
+ kill -TERM $progpid
+ sleep 1
+ exit 1
+}
+
+init() {
+ PS4='>tpc-${FUNCNAME}> '
+ set -e
+ progpid=$$
+ prog=`basename $0`
+ progdir=`\cd \`dirname $0\` >/dev/null ; pwd`
+ readonly progpid progdir prog
+
+ for d in top_srcdir srcdir top_builddir builddir
+ do
+ eval v=\${$d}
+ test -d "$v" || die "$d does not reference a directory"
+ v=`cd $v >/dev/null && pwd`
+ eval ${d}=${v}
+ done
+ . ${top_builddir}/config/shdefs
+}
+
+collect_src() {
+ exec 8>&1 1>&2
+ cd ${builddir}
+ sentinel_file=${1} ; shift
+ cat 1>&8 <<- _EOF_
+ #define AUTOOPTS_INTERNAL 1
+ #include "autoopts/project.h"
+ #define LOCAL static
+ #include "ao-strs.h"
+ _EOF_
+
+ for f in "$@"
+ do test "X$f" = "Xproject.h" || \
+ printf '#include "%s"\n' $f
+ done 1>&8
+}
+
+extension_defines() {
+ cd ${builddir}/tpl
+
+ test -f tpl-config.tlib || die "tpl-config.tlib not configured"
+ test -f ${top_builddir}/config.h || die "config.h missing"
+ ${GREP} 'extension-defines' tpl-config.tlib >/dev/null && return
+
+ txt=`sed -n '/POSIX.*SOURCE/,/does not conform to ANSI C/{
+ /^#/p
+ }
+ /does not conform to ANSI C/q' ${top_builddir}/config.h`
+
+ {
+ sed '/define *top-build-dir/d;/^;;;/d' tpl-config.tlib
+ cat <<- _EOF_
+ (define top-build-dir "`cd ${top_builddir} >/dev/null
+ pwd`")
+ (define top-src-dir "`cd ${top_srcdir} >/dev/null
+ pwd`")
+ (define extension-defines
+ "${txt}") \\=]
+ _EOF_
+ } > tpl-config.$$
+ mv -f tpl-config.$$ tpl-config.tlib
+}
+
+set_shell_prog() {
+ case `uname -s` in
+ SunOS )
+ while : ; do
+ POSIX_SHELL=`which bash`
+ test -x "${POSIX_SHELL}" && break
+ POSIX_SHELL=/usr/xpg4/bin/sh
+ test -x "${POSIX_SHELL}" && break
+ die "You are hosed. You are on Solaris and have no usable shell."
+ done
+ ;;
+ esac
+
+ for f in ${srcdir}/tpl/*.sh ${srcdir}/tpl/*.pl
+ do
+ d=`basename $f | sed 's/\.[sp][hl]$//'`
+ st=`sed 1q $f`
+
+ case "$st" in
+ *perl ) echo '#!' `which perl`
+ sed 1d $f
+ ;;
+
+ */sh ) echo '#!' ${POSIX_SHELL}
+ sed 1d $f
+ ;;
+
+ * ) die "Invalid script type: $st"
+ ;;
+ esac > $d
+ chmod 755 $d
+ done
+}
+
+set_cat_prog() {
+ while :
+ do
+ \unalias -a
+ unset -f command cat which
+ POSIX_CAT=`which cat`
+ test -x "$POSIX_CAT" && break
+ POSIX_CAT=`
+ PATH=\`command -p getconf CS_PATH\`
+ command -v cat `
+ test -x "${POSIX_CAT}" && break
+ die "cannot locate 'cat' command"
+ done
+
+ formats='man mdoc texi'
+ for f in $formats
+ do
+ for g in $formats
+ do
+ test -f ${f}2${g} || {
+ printf "#! ${POSIX_SHELL}\nexec ${POSIX_CAT} "'${1+"$@"}\n' \
+ > ${f}2${g}
+ chmod 755 ${f}2${g}
+ }
+ done
+ done
+}
+
+init
+collect_src "$@" > ${builddir}/libopts.c
+extension_defines
+set_shell_prog
+set_cat_prog
+touch ${sentinel_file}
diff --git a/autoopts/nested.c b/autoopts/nested.c
new file mode 100644
index 0000000..ed23fd2
--- /dev/null
+++ b/autoopts/nested.c
@@ -0,0 +1,849 @@
+
+/**
+ * \file nested.c
+ *
+ * Time-stamp: "2012-03-04 13:30:07 bkorb"
+ *
+ * Automated Options Nested Values module.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+typedef struct {
+ int xml_ch;
+ int xml_len;
+ char xml_txt[8];
+} xml_xlate_t;
+
+static xml_xlate_t const xml_xlate[] = {
+ { '&', 4, "amp;" },
+ { '<', 3, "lt;" },
+ { '>', 3, "gt;" },
+ { '"', 5, "quot;" },
+ { '\'',5, "apos;" }
+};
+
+#ifndef ENOMSG
+#define ENOMSG ENOENT
+#endif
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+remove_continuation(char* pzSrc);
+
+static char const*
+scan_q_str(char const* pzTxt);
+
+static tOptionValue *
+add_string(void ** pp, char const * pzName, size_t nameLen,
+ char const* pzValue, size_t dataLen);
+
+static tOptionValue *
+add_bool(void ** pp, char const * pzName, size_t nameLen,
+ char const* pzValue, size_t dataLen);
+
+static tOptionValue*
+add_number(void** pp, char const* pzName, size_t nameLen,
+ char const* pzValue, size_t dataLen);
+
+static tOptionValue*
+add_nested(void** pp, char const* pzName, size_t nameLen,
+ char* pzValue, size_t dataLen);
+
+static char const *
+scan_name(char const* pzName, tOptionValue* pRes);
+
+static char const*
+scan_xml(char const* pzName, tOptionValue* pRes);
+
+static void
+sort_list(tArgList* pAL);
+/* = = = END-STATIC-FORWARD = = = */
+
+/**
+ * Backslashes are used for line continuations. We keep the newline
+ * characters, but trim out the backslash:
+ */
+static void
+remove_continuation(char* pzSrc)
+{
+ char* pzD;
+
+ do {
+ while (*pzSrc == NL) pzSrc++;
+ pzD = strchr(pzSrc, NL);
+ if (pzD == NULL)
+ return;
+
+ /*
+ * pzD has skipped at least one non-newline character and now
+ * points to a newline character. It now becomes the source and
+ * pzD goes to the previous character.
+ */
+ pzSrc = pzD--;
+ if (*pzD != '\\')
+ pzD++;
+ } while (pzD == pzSrc);
+
+ /*
+ * Start shifting text.
+ */
+ for (;;) {
+ char ch = ((*pzD++) = *(pzSrc++));
+ switch (ch) {
+ case NUL: return;
+ case '\\':
+ if (*pzSrc == NL)
+ --pzD; /* rewrite on next iteration */
+ }
+ }
+}
+
+/**
+ * Find the end of a quoted string, skipping escaped quote characters.
+ */
+static char const*
+scan_q_str(char const* pzTxt)
+{
+ char q = *(pzTxt++); /* remember the type of quote */
+
+ for (;;) {
+ char ch = *(pzTxt++);
+ if (ch == NUL)
+ return pzTxt-1;
+
+ if (ch == q)
+ return pzTxt;
+
+ if (ch == '\\') {
+ ch = *(pzTxt++);
+ /*
+ * IF the next character is NUL, drop the backslash, too.
+ */
+ if (ch == NUL)
+ return pzTxt - 2;
+
+ /*
+ * IF the quote character or the escape character were escaped,
+ * then skip both, as long as the string does not end.
+ */
+ if ((ch == q) || (ch == '\\')) {
+ if (*(pzTxt++) == NUL)
+ return pzTxt-1;
+ }
+ }
+ }
+}
+
+
+/**
+ * Associate a name with either a string or no value.
+ */
+static tOptionValue *
+add_string(void ** pp, char const * pzName, size_t nameLen,
+ char const* pzValue, size_t dataLen)
+{
+ tOptionValue* pNV;
+ size_t sz = nameLen + dataLen + sizeof(*pNV);
+
+ pNV = AGALOC(sz, "option name/str value pair");
+ if (pNV == NULL)
+ return NULL;
+
+ if (pzValue == NULL) {
+ pNV->valType = OPARG_TYPE_NONE;
+ pNV->pzName = pNV->v.strVal;
+
+ } else {
+ pNV->valType = OPARG_TYPE_STRING;
+ if (dataLen > 0) {
+ char const * pzSrc = pzValue;
+ char * pzDst = pNV->v.strVal;
+ int ct = dataLen;
+ do {
+ int ch = *(pzSrc++) & 0xFF;
+ if (ch == NUL) goto data_copy_done;
+ if (ch == '&')
+ ch = get_special_char(&pzSrc, &ct);
+ *(pzDst++) = (char)ch;
+ } while (--ct > 0);
+ data_copy_done:
+ *pzDst = NUL;
+
+ } else {
+ pNV->v.strVal[0] = NUL;
+ }
+
+ pNV->pzName = pNV->v.strVal + dataLen + 1;
+ }
+
+ memcpy(pNV->pzName, pzName, nameLen);
+ pNV->pzName[ nameLen ] = NUL;
+ addArgListEntry(pp, pNV);
+ return pNV;
+}
+
+/**
+ * Associate a name with either a string or no value.
+ */
+static tOptionValue *
+add_bool(void ** pp, char const * pzName, size_t nameLen,
+ char const* pzValue, size_t dataLen)
+{
+ tOptionValue * pNV;
+
+ {
+ size_t sz = nameLen + sizeof(tOptionValue) + 1;
+ pNV = AGALOC(sz, "name/bool value");
+ }
+
+ {
+ char * p = SPN_WHITESPACE_CHARS(pzValue);
+ dataLen -= p - pzValue;
+ pzValue = p;
+ }
+
+ if (dataLen == 0)
+ pNV->v.boolVal = 0;
+
+ else if (IS_DEC_DIGIT_CHAR(*pzValue))
+ pNV->v.boolVal = atoi(pzValue);
+
+ else pNV->v.boolVal = ! IS_FALSE_TYPE_CHAR(*pzValue);
+
+ pNV->valType = OPARG_TYPE_BOOLEAN;
+ pNV->pzName = (char*)(pNV + 1);
+ memcpy(pNV->pzName, pzName, nameLen);
+ pNV->pzName[ nameLen ] = NUL;
+ addArgListEntry(pp, pNV);
+ return pNV;
+}
+
+/**
+ * Associate a name with either a string or no value.
+ */
+static tOptionValue*
+add_number(void** pp, char const* pzName, size_t nameLen,
+ char const* pzValue, size_t dataLen)
+{
+ tOptionValue* pNV;
+ size_t sz = nameLen + sizeof(*pNV) + 1;
+
+ pNV = AGALOC(sz, "option name/bool value pair");
+ if (pNV == NULL)
+ return NULL;
+ while (IS_WHITESPACE_CHAR(*pzValue) && (dataLen > 0)) {
+ dataLen--; pzValue++;
+ }
+ if (dataLen == 0)
+ pNV->v.longVal = 0;
+ else
+ pNV->v.longVal = strtol(pzValue, 0, 0);
+
+ pNV->valType = OPARG_TYPE_NUMERIC;
+ pNV->pzName = (char*)(pNV + 1);
+ memcpy(pNV->pzName, pzName, nameLen);
+ pNV->pzName[ nameLen ] = NUL;
+ addArgListEntry(pp, pNV);
+ return pNV;
+}
+
+/**
+ * Associate a name with either a string or no value.
+ */
+static tOptionValue*
+add_nested(void** pp, char const* pzName, size_t nameLen,
+ char* pzValue, size_t dataLen)
+{
+ tOptionValue* pNV;
+
+ if (dataLen == 0) {
+ size_t sz = nameLen + sizeof(*pNV) + 1;
+ pNV = AGALOC(sz, "empty nested value pair");
+ if (pNV == NULL)
+ return NULL;
+ pNV->v.nestVal = NULL;
+ pNV->valType = OPARG_TYPE_HIERARCHY;
+ pNV->pzName = (char*)(pNV + 1);
+ memcpy(pNV->pzName, pzName, nameLen);
+ pNV->pzName[ nameLen ] = NUL;
+
+ } else {
+ pNV = optionLoadNested(pzValue, pzName, nameLen);
+ }
+
+ if (pNV != NULL)
+ addArgListEntry(pp, pNV);
+
+ return pNV;
+}
+
+/**
+ * We have an entry that starts with a name. Find the end of it, cook it
+ * (if called for) and create the name/value association.
+ */
+static char const *
+scan_name(char const* pzName, tOptionValue* pRes)
+{
+ tOptionValue* pNV;
+ char const * pzScan = pzName+1; /* we know first char is a name char */
+ char const * pzVal;
+ size_t nameLen = 1;
+ size_t dataLen = 0;
+
+ /*
+ * Scan over characters that name a value. These names may not end
+ * with a colon, but they may contain colons.
+ */
+ pzScan = SPN_VALUE_NAME_CHARS(pzName + 1);
+ if (pzScan[-1] == ':')
+ pzScan--;
+ nameLen = pzScan - pzName;
+
+ pzScan = SPN_HORIZ_WHITE_CHARS(pzScan);
+
+ re_switch:
+
+ switch (*pzScan) {
+ case '=':
+ case ':':
+ pzScan = SPN_HORIZ_WHITE_CHARS(pzScan + 1);
+ if ((*pzScan == '=') || (*pzScan == ':'))
+ goto default_char;
+ goto re_switch;
+
+ case NL:
+ case ',':
+ pzScan++;
+ /* FALLTHROUGH */
+
+ case NUL:
+ add_string(&(pRes->v.nestVal), pzName, nameLen, NULL, (size_t)0);
+ break;
+
+ case '"':
+ case '\'':
+ pzVal = pzScan;
+ pzScan = scan_q_str(pzScan);
+ dataLen = pzScan - pzVal;
+ pNV = add_string(&(pRes->v.nestVal), pzName, nameLen, pzVal,
+ dataLen);
+ if ((pNV != NULL) && (option_load_mode == OPTION_LOAD_COOKED))
+ ao_string_cook(pNV->v.strVal, NULL);
+ break;
+
+ default:
+ default_char:
+ /*
+ * We have found some strange text value. It ends with a newline
+ * or a comma.
+ */
+ pzVal = pzScan;
+ for (;;) {
+ char ch = *(pzScan++);
+ switch (ch) {
+ case NUL:
+ pzScan--;
+ dataLen = pzScan - pzVal;
+ goto string_done;
+ /* FALLTHROUGH */
+
+ case NL:
+ if ( (pzScan > pzVal + 2)
+ && (pzScan[-2] == '\\')
+ && (pzScan[ 0] != NUL))
+ continue;
+ /* FALLTHROUGH */
+
+ case ',':
+ dataLen = (pzScan - pzVal) - 1;
+ string_done:
+ pNV = add_string(&(pRes->v.nestVal), pzName, nameLen,
+ pzVal, dataLen);
+ if (pNV != NULL)
+ remove_continuation(pNV->v.strVal);
+ goto leave_scan_name;
+ }
+ }
+ break;
+ } leave_scan_name:;
+
+ return pzScan;
+}
+
+/**
+ * We've found a '<' character. We ignore this if it is a comment or a
+ * directive. If it is something else, then whatever it is we are looking
+ * at is bogus. Returning NULL stops processing.
+ */
+static char const*
+scan_xml(char const* pzName, tOptionValue* pRes)
+{
+ size_t nameLen;
+ size_t valLen;
+ char const* pzScan = ++pzName;
+ char const* pzVal;
+ tOptionValue valu;
+ tOptionValue* pNewVal;
+ tOptionLoadMode save_mode = option_load_mode;
+
+ if (! IS_VAR_FIRST_CHAR(*pzName)) {
+ switch (*pzName) {
+ default:
+ pzName = NULL;
+ break;
+
+ case '!':
+ pzName = strstr(pzName, "-->");
+ if (pzName != NULL)
+ pzName += 3;
+ break;
+
+ case '?':
+ pzName = strchr(pzName, '>');
+ if (pzName != NULL)
+ pzName++;
+ break;
+ }
+ return pzName;
+ }
+
+ pzScan = SPN_VALUE_NAME_CHARS(pzName+1);
+ nameLen = pzScan - pzName;
+ if (nameLen > 64)
+ return NULL;
+ valu.valType = OPARG_TYPE_STRING;
+
+ switch (*pzScan) {
+ case ' ':
+ case '\t':
+ pzScan = parse_attrs(
+ NULL, (char*)pzScan, &option_load_mode, &valu );
+ if (*pzScan == '>') {
+ pzScan++;
+ break;
+ }
+
+ if (*pzScan != '/') {
+ option_load_mode = save_mode;
+ return NULL;
+ }
+ /* FALLTHROUGH */
+
+ case '/':
+ if (*++pzScan != '>') {
+ option_load_mode = save_mode;
+ return NULL;
+ }
+ add_string(&(pRes->v.nestVal), pzName, nameLen, NULL, (size_t)0);
+ option_load_mode = save_mode;
+ return pzScan+1;
+
+ default:
+ option_load_mode = save_mode;
+ return NULL;
+
+ case '>':
+ pzScan++;
+ break;
+ }
+
+ pzVal = pzScan;
+
+ {
+ char z[68];
+ char* pzD = z;
+ int ct = nameLen;
+ char const* pzS = pzName;
+
+ *(pzD++) = '<';
+ *(pzD++) = '/';
+
+ do {
+ *(pzD++) = *(pzS++);
+ } while (--ct > 0);
+ *(pzD++) = '>';
+ *pzD = NUL;
+
+ pzScan = strstr(pzScan, z);
+ if (pzScan == NULL) {
+ option_load_mode = save_mode;
+ return NULL;
+ }
+ valLen = (pzScan - pzVal);
+ pzScan += nameLen + 3;
+ pzScan = SPN_WHITESPACE_CHARS(pzScan);
+ }
+
+ switch (valu.valType) {
+ case OPARG_TYPE_NONE:
+ add_string(&(pRes->v.nestVal), pzName, nameLen, NULL, (size_t)0);
+ break;
+
+ case OPARG_TYPE_STRING:
+ pNewVal = add_string(
+ &(pRes->v.nestVal), pzName, nameLen, pzVal, valLen);
+
+ if (option_load_mode == OPTION_LOAD_KEEP)
+ break;
+ mungeString(pNewVal->v.strVal, option_load_mode);
+ break;
+
+ case OPARG_TYPE_BOOLEAN:
+ add_bool(&(pRes->v.nestVal), pzName, nameLen, pzVal, valLen);
+ break;
+
+ case OPARG_TYPE_NUMERIC:
+ add_number(&(pRes->v.nestVal), pzName, nameLen, pzVal, valLen);
+ break;
+
+ case OPARG_TYPE_HIERARCHY:
+ {
+ char* pz = AGALOC(valLen+1, "hierarchical scan");
+ if (pz == NULL)
+ break;
+ memcpy(pz, pzVal, valLen);
+ pz[valLen] = NUL;
+ add_nested(&(pRes->v.nestVal), pzName, nameLen, pz, valLen);
+ AGFREE(pz);
+ break;
+ }
+
+ case OPARG_TYPE_ENUMERATION:
+ case OPARG_TYPE_MEMBERSHIP:
+ default:
+ break;
+ }
+
+ option_load_mode = save_mode;
+ return pzScan;
+}
+
+
+/**
+ * Deallocate a list of option arguments. This must have been gotten from
+ * a hierarchical option argument, not a stacked list of strings. It is
+ * an internal call, so it is not validated. The caller is responsible for
+ * knowing what they are doing.
+ */
+LOCAL void
+unload_arg_list(tArgList* pAL)
+{
+ int ct = pAL->useCt;
+ tCC** ppNV = pAL->apzArgs;
+
+ while (ct-- > 0) {
+ tOptionValue* pNV = (tOptionValue*)(void*)*(ppNV++);
+ if (pNV->valType == OPARG_TYPE_HIERARCHY)
+ unload_arg_list(pNV->v.nestVal);
+ AGFREE(pNV);
+ }
+
+ AGFREE((void*)pAL);
+}
+
+/*=export_func optionUnloadNested
+ *
+ * what: Deallocate the memory for a nested value
+ * arg: + tOptionValue const * + pOptVal + the hierarchical value +
+ *
+ * doc:
+ * A nested value needs to be deallocated. The pointer passed in should
+ * have been gotten from a call to @code{configFileLoad()} (See
+ * @pxref{libopts-configFileLoad}).
+=*/
+void
+optionUnloadNested(tOptionValue const * pOV)
+{
+ if (pOV == NULL) return;
+ if (pOV->valType != OPARG_TYPE_HIERARCHY) {
+ errno = EINVAL;
+ return;
+ }
+
+ unload_arg_list(pOV->v.nestVal);
+
+ AGFREE((void*)pOV);
+}
+
+/**
+ * This is a _stable_ sort. The entries are sorted alphabetically,
+ * but within entries of the same name the ordering is unchanged.
+ * Typically, we also hope the input is sorted.
+ */
+static void
+sort_list(tArgList* pAL)
+{
+ int ix;
+ int lm = pAL->useCt;
+
+ /*
+ * This loop iterates "useCt" - 1 times.
+ */
+ for (ix = 0; ++ix < lm;) {
+ int iy = ix-1;
+ tOptionValue* pNewNV = (tOptionValue*)(void*)(pAL->apzArgs[ix]);
+ tOptionValue* pOldNV = (tOptionValue*)(void*)(pAL->apzArgs[iy]);
+
+ /*
+ * For as long as the new entry precedes the "old" entry,
+ * move the old pointer. Stop before trying to extract the
+ * "-1" entry.
+ */
+ while (strcmp(pOldNV->pzName, pNewNV->pzName) > 0) {
+ pAL->apzArgs[iy+1] = (void*)pOldNV;
+ pOldNV = (tOptionValue*)(void*)(pAL->apzArgs[--iy]);
+ if (iy < 0)
+ break;
+ }
+
+ /*
+ * Always store the pointer. Sometimes it is redundant,
+ * but the redundancy is cheaper than a test and branch sequence.
+ */
+ pAL->apzArgs[iy+1] = (void*)pNewNV;
+ }
+}
+
+/*=
+ * private:
+ *
+ * what: parse a hierarchical option argument
+ * arg: + char const* + pzTxt + the text to scan +
+ * arg: + char const* + pzName + the name for the text +
+ * arg: + size_t + nameLen + the length of "name" +
+ *
+ * ret_type: tOptionValue*
+ * ret_desc: An allocated, compound value structure
+ *
+ * doc:
+ * A block of text represents a series of values. It may be an
+ * entire configuration file, or it may be an argument to an
+ * option that takes a hierarchical value.
+ *
+ * If NULL is returned, errno will be set:
+ * @itemize @bullet
+ * @item
+ * @code{EINVAL} the input text was NULL.
+ * @item
+ * @code{ENOMEM} the storage structures could not be allocated
+ * @item
+ * @code{ENOMSG} no configuration values were found
+ * @end itemize
+=*/
+LOCAL tOptionValue*
+optionLoadNested(char const* pzTxt, char const* pzName, size_t nameLen)
+{
+ tOptionValue* pRes;
+
+ /*
+ * Make sure we have some data and we have space to put what we find.
+ */
+ if (pzTxt == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
+ pzTxt = SPN_WHITESPACE_CHARS(pzTxt);
+ if (*pzTxt == NUL) {
+ errno = ENOMSG;
+ return NULL;
+ }
+ pRes = AGALOC(sizeof(*pRes) + nameLen + 1, "nested args");
+ if (pRes == NULL) {
+ errno = ENOMEM;
+ return NULL;
+ }
+ pRes->valType = OPARG_TYPE_HIERARCHY;
+ pRes->pzName = (char*)(pRes + 1);
+ memcpy(pRes->pzName, pzName, nameLen);
+ pRes->pzName[nameLen] = NUL;
+
+ {
+ tArgList * pAL = AGALOC(sizeof(*pAL), "nested arg list");
+ if (pAL == NULL) {
+ AGFREE(pRes);
+ return NULL;
+ }
+
+ pRes->v.nestVal = pAL;
+ pAL->useCt = 0;
+ pAL->allocCt = MIN_ARG_ALLOC_CT;
+ }
+
+ /*
+ * Scan until we hit a NUL.
+ */
+ do {
+ pzTxt = SPN_WHITESPACE_CHARS(pzTxt);
+ if (IS_VAR_FIRST_CHAR(*pzTxt))
+ pzTxt = scan_name(pzTxt, pRes);
+
+ else switch (*pzTxt) {
+ case NUL: goto scan_done;
+ case '<': pzTxt = scan_xml(pzTxt, pRes);
+ if (pzTxt == NULL) goto woops;
+ if (*pzTxt == ',') pzTxt++; break;
+ case '#': pzTxt = strchr(pzTxt, NL); break;
+ default: goto woops;
+ }
+ } while (pzTxt != NULL); scan_done:;
+
+ {
+ tArgList * al = pRes->v.nestVal;
+ if (al->useCt == 0) {
+ errno = ENOMSG;
+ goto woops;
+ }
+ if (al->useCt > 1)
+ sort_list(al);
+ }
+
+ return pRes;
+
+ woops:
+ AGFREE(pRes->v.nestVal);
+ AGFREE(pRes);
+ return NULL;
+}
+
+/*=export_func optionNestedVal
+ * private:
+ *
+ * what: parse a hierarchical option argument
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ *
+ * doc:
+ * Nested value was found on the command line
+=*/
+void
+optionNestedVal(tOptions* pOpts, tOptDesc* pOD)
+{
+ if (pOpts < OPTPROC_EMIT_LIMIT)
+ return;
+
+ if (pOD->fOptState & OPTST_RESET) {
+ tArgList* pAL = pOD->optCookie;
+ int ct;
+ tCC ** av;
+
+ if (pAL == NULL)
+ return;
+ ct = pAL->useCt;
+ av = pAL->apzArgs;
+
+ while (--ct >= 0) {
+ void * p = (void *)*(av++);
+ optionUnloadNested((tOptionValue const *)p);
+ }
+
+ AGFREE(pOD->optCookie);
+
+ } else {
+ tOptionValue* pOV = optionLoadNested(
+ pOD->optArg.argString, pOD->pz_Name, strlen(pOD->pz_Name));
+
+ if (pOV != NULL)
+ addArgListEntry(&(pOD->optCookie), (void*)pOV);
+ }
+}
+
+/*
+ * get_special_char
+ */
+LOCAL int
+get_special_char(char const ** ppz, int * ct)
+{
+ char const * pz = *ppz;
+
+ if (*ct < 3)
+ return '&';
+
+ if (*pz == '#') {
+ int base = 10;
+ int retch;
+
+ pz++;
+ if (*pz == 'x') {
+ base = 16;
+ pz++;
+ }
+ retch = (int)strtoul(pz, (char **)&pz, base);
+ if (*pz != ';')
+ return '&';
+ base = ++pz - *ppz;
+ if (base > *ct)
+ return '&';
+
+ *ct -= base;
+ *ppz = pz;
+ return retch;
+ }
+
+ {
+ int ctr = sizeof(xml_xlate) / sizeof(xml_xlate[0]);
+ xml_xlate_t const * xlatp = xml_xlate;
+
+ for (;;) {
+ if ( (*ct >= xlatp->xml_len)
+ && (strncmp(pz, xlatp->xml_txt, xlatp->xml_len) == 0)) {
+ *ppz += xlatp->xml_len;
+ *ct -= xlatp->xml_len;
+ return xlatp->xml_ch;
+ }
+
+ if (--ctr <= 0)
+ break;
+ xlatp++;
+ }
+ }
+ return '&';
+}
+
+/*
+ * emit_special_char
+ */
+LOCAL void
+emit_special_char(FILE * fp, int ch)
+{
+ int ctr = sizeof(xml_xlate) / sizeof(xml_xlate[0]);
+ xml_xlate_t const * xlatp = xml_xlate;
+
+ putc('&', fp);
+ for (;;) {
+ if (ch == xlatp->xml_ch) {
+ fputs(xlatp->xml_txt, fp);
+ return;
+ }
+ if (--ctr <= 0)
+ break;
+ xlatp++;
+ }
+ fprintf(fp, XML_HEX_BYTE_FMT, (ch & 0xFF));
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/nested.c */
diff --git a/autoopts/numeric.c b/autoopts/numeric.c
new file mode 100644
index 0000000..b709d07
--- /dev/null
+++ b/autoopts/numeric.c
@@ -0,0 +1,165 @@
+
+/**
+ * \file numeric.c
+ *
+ * Time-stamp: "2012-02-25 12:54:32 bkorb"
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/*=export_func optionShowRange
+ * private:
+ *
+ * what:
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ * arg: + void * + rng_table + the value range tables +
+ * arg: + int + rng_count + the number of entries +
+ *
+ * doc:
+ * Show information about a numeric option with range constraints.
+=*/
+void
+optionShowRange(tOptions * pOpts, tOptDesc * pOD, void * rng_table, int rng_ct)
+{
+ const struct {long const rmin, rmax;} * rng = rng_table;
+
+ char const * pz_indent = BULLET_STR;
+
+ /*
+ * The range is shown only for full usage requests and an error
+ * in this particular option.
+ */
+ if (pOpts != OPTPROC_EMIT_USAGE) {
+ if (pOpts <= OPTPROC_EMIT_LIMIT)
+ return;
+ pz_indent = ONE_TAB_STR;
+
+ fprintf(option_usage_fp, zRangeErr, pOpts->pzProgName,
+ pOD->pz_Name, pOD->optArg.argInt);
+ pz_indent = "";
+ }
+
+ if (pOD->fOptState & OPTST_SCALED_NUM)
+ fprintf(option_usage_fp, zRangeScaled, pz_indent);
+
+ fprintf(option_usage_fp, (rng_ct > 1) ? zRangeLie : zRangeOnly, pz_indent);
+ pz_indent = (pOpts != OPTPROC_EMIT_USAGE) ? ONE_TAB_STR : DEEP_INDENT_STR;
+
+ for (;;) {
+ if (rng->rmax == LONG_MIN)
+ fprintf(option_usage_fp, zRangeExact, pz_indent, rng->rmin);
+ else if (rng->rmin == LONG_MIN)
+ fprintf(option_usage_fp, zRangeUpto, pz_indent, rng->rmax);
+ else if (rng->rmax == LONG_MAX)
+ fprintf(option_usage_fp, zRangeAbove, pz_indent, rng->rmin);
+ else
+ fprintf(option_usage_fp, zRange, pz_indent, rng->rmin,
+ rng->rmax);
+
+ if (--rng_ct <= 0) {
+ fputc(NL, option_usage_fp);
+ break;
+ }
+ fputs(zRangeOr, option_usage_fp);
+ rng++;
+ }
+
+ if (pOpts > OPTPROC_EMIT_LIMIT)
+ pOpts->pUsageProc(pOpts, EXIT_FAILURE);
+}
+
+/*=export_func optionNumericVal
+ * private:
+ *
+ * what: process an option with a numeric value.
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ *
+ * doc:
+ * Decipher a numeric value.
+=*/
+void
+optionNumericVal(tOptions* pOpts, tOptDesc* pOD )
+{
+ char* pz;
+ long val;
+
+ /*
+ * Numeric options may have a range associated with it.
+ * If it does, the usage procedure requests that it be
+ * emitted by passing a NULL pOD pointer. Also bail out
+ * if there is no option argument or if we are being reset.
+ */
+ if ( (pOD == NULL)
+ || (pOD->optArg.argString == NULL)
+ || ((pOD->fOptState & OPTST_RESET) != 0))
+ return;
+
+ errno = 0;
+ val = strtol(pOD->optArg.argString, &pz, 0);
+ if ((pz == pOD->optArg.argString) || (errno != 0))
+ goto bad_number;
+
+ if ((pOD->fOptState & OPTST_SCALED_NUM) != 0)
+ switch (*(pz++)) {
+ case NUL: pz--; break;
+ case 't': val *= 1000;
+ case 'g': val *= 1000;
+ case 'm': val *= 1000;
+ case 'k': val *= 1000; break;
+
+ case 'T': val *= 1024;
+ case 'G': val *= 1024;
+ case 'M': val *= 1024;
+ case 'K': val *= 1024; break;
+
+ default: goto bad_number;
+ }
+
+ if (*pz != NUL)
+ goto bad_number;
+
+ if (pOD->fOptState & OPTST_ALLOC_ARG) {
+ AGFREE(pOD->optArg.argString);
+ pOD->fOptState &= ~OPTST_ALLOC_ARG;
+ }
+
+ pOD->optArg.argInt = val;
+ return;
+
+ bad_number:
+
+ fprintf( stderr, zNotNumber, pOpts->pzProgName, pOD->optArg.argString );
+ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0)
+ (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE);
+
+ errno = EINVAL;
+ pOD->optArg.argInt = ~0;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/numeric.c */
diff --git a/autoopts/optionFileLoad.3 b/autoopts/optionFileLoad.3
new file mode 100644
index 0000000..4e30fa5
--- /dev/null
+++ b/autoopts/optionFileLoad.3
@@ -0,0 +1,52 @@
+.TH optionFileLoad 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionFileLoad.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionFileLoad - Load the locatable config files, in order
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+int \fBoptionFileLoad\fP(tOptions* \fIpOpts\fP, char const* \fIpzProg\fP);
+.sp 1
+.SH DESCRIPTION
+This function looks in all the specified directories for a configuration
+file ("rc" file or "ini" file) and processes any found twice. The first
+time through, they are processed in reverse order (last file first). At
+that time, only "immediate action" configurables are processed. For
+example, if the last named file specifies not processing any more
+configuration files, then no more configuration files will be processed.
+Such an option in the \fBfirst\fP named directory will have no effect.
+
+Once the immediate action configurables have been handled, then the
+directories are handled in normal, forward order. In that way, later
+config files can override the settings of earlier config files.
+
+See the AutoOpts documentation for a thorough discussion of the
+config file format.
+
+Configuration files not found or not decipherable are simply ignored.
+.TP
+.IR pOpts
+program options descriptor
+.TP
+.IR pzProg
+program name
+.sp 1
+.SH RETURN VALUE
+0 \-> SUCCESS, \-1 \-> FAILURE
+.sp 1
+.SH ERRORS
+Returns the value, "-1" if the program options descriptor
+is out of date or indecipherable. Otherwise, the value "0" will
+always be returned.
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/optionFindNextValue.3 b/autoopts/optionFindNextValue.3
new file mode 100644
index 0000000..1a51859
--- /dev/null
+++ b/autoopts/optionFindNextValue.3
@@ -0,0 +1,50 @@
+.TH optionFindNextValue 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionFindNextValue.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionFindNextValue - find a hierarcicaly valued option instance
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+const tOptionValue* \fBoptionFindNextValue\fP(const tOptDesc* \fIpOptDesc\fP, const tOptionValue* \fIpPrevVal\fP, char const* \fIname\fP, char const* \fIvalue\fP);
+.sp 1
+.SH DESCRIPTION
+This routine will find the next entry in a nested value option or
+configurable. It will search through the list and return the next entry
+that matches the criteria.
+.TP
+.IR pOptDesc
+an option with a nested arg type
+.TP
+.IR pPrevVal
+the last entry
+.TP
+.IR name
+name of value to find
+.TP
+.IR value
+the matching value
+.sp 1
+.SH RETURN VALUE
+a compound value structure
+.sp 1
+.SH ERRORS
+The returned result is NULL and errno is set:
+.sp 1ize @bullet
+.sp 1
+\fBEINVAL\fP \- the \fBpOptValue\fP does not point to a valid
+hierarchical option value.
+.sp 1
+\fBENOENT\fP \- no entry matched the given name.
+@end itemize
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/optionFindValue.3 b/autoopts/optionFindValue.3
new file mode 100644
index 0000000..2c729f2
--- /dev/null
+++ b/autoopts/optionFindValue.3
@@ -0,0 +1,46 @@
+.TH optionFindValue 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionFindValue.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionFindValue - find a hierarcicaly valued option instance
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+const tOptionValue* \fBoptionFindValue\fP(const tOptDesc* \fIpOptDesc\fP, char const* \fIname\fP, char const* \fIvalue\fP);
+.sp 1
+.SH DESCRIPTION
+This routine will find an entry in a nested value option or configurable.
+It will search through the list and return a matching entry.
+.TP
+.IR pOptDesc
+an option with a nested arg type
+.TP
+.IR name
+name of value to find
+.TP
+.IR value
+the matching value
+.sp 1
+.SH RETURN VALUE
+a compound value structure
+.sp 1
+.SH ERRORS
+The returned result is NULL and errno is set:
+.sp 1ize @bullet
+.sp 1
+\fBEINVAL\fP \- the \fBpOptValue\fP does not point to a valid
+hierarchical option value.
+.sp 1
+\fBENOENT\fP \- no entry matched the given name.
+@end itemize
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/optionFree.3 b/autoopts/optionFree.3
new file mode 100644
index 0000000..a8ea0cb
--- /dev/null
+++ b/autoopts/optionFree.3
@@ -0,0 +1,31 @@
+.TH optionFree 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionFree.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionFree - free allocated option processing memory
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+void \fBoptionFree\fP(tOptions* \fIpOpts\fP);
+.sp 1
+.SH DESCRIPTION
+AutoOpts sometimes allocates memory and puts pointers to it in the
+option state structures. This routine deallocates all such memory.
+.TP
+.IR pOpts
+program options descriptor
+.sp 1
+.SH ERRORS
+As long as memory has not been corrupted,
+this routine is always successful.
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/optionGetValue.3 b/autoopts/optionGetValue.3
new file mode 100644
index 0000000..3a908b8
--- /dev/null
+++ b/autoopts/optionGetValue.3
@@ -0,0 +1,47 @@
+.TH optionGetValue 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionGetValue.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionGetValue - get a specific value from a hierarcical list
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+const tOptionValue* \fBoptionGetValue\fP(const tOptionValue* \fIpOptValue\fP, char const* \fIvalueName\fP);
+.sp 1
+.SH DESCRIPTION
+This routine will find an entry in a nested value option or configurable.
+If "valueName" is NULL, then the first entry is returned. Otherwise,
+the first entry with a name that exactly matches the argument will be
+returned. If there is no matching value, NULL is returned and errno is
+set to ENOENT. If the provided option value is not a hierarchical value,
+NULL is also returned and errno is set to EINVAL.
+.TP
+.IR pOptValue
+a hierarchcal value
+.TP
+.IR valueName
+name of value to get
+.sp 1
+.SH RETURN VALUE
+a compound value structure
+.sp 1
+.SH ERRORS
+The returned result is NULL and errno is set:
+.sp 1ize @bullet
+.sp 1
+\fBEINVAL\fP \- the \fBpOptValue\fP does not point to a valid
+hierarchical option value.
+.sp 1
+\fBENOENT\fP \- no entry matched the given name.
+@end itemize
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/optionLoadLine.3 b/autoopts/optionLoadLine.3
new file mode 100644
index 0000000..83556a7
--- /dev/null
+++ b/autoopts/optionLoadLine.3
@@ -0,0 +1,45 @@
+.TH optionLoadLine 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionLoadLine.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionLoadLine - process a string for an option name and value
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+void \fBoptionLoadLine\fP(tOptions* \fIopts\fP, char const* \fIline\fP);
+.sp 1
+.SH DESCRIPTION
+This is a client program callable routine for setting options from, for
+example, the contents of a file that they read in. Only one option may
+appear in the text. It will be treated as a normal (non-preset) option.
+
+When passed a pointer to the option struct and a string, it will find
+the option named by the first token on the string and set the option
+argument to the remainder of the string. The caller must NUL terminate
+the string. The caller need not skip over any introductory hyphens.
+Any embedded new lines will be included in the option
+argument. If the input looks like one or more quoted strings, then the
+input will be "cooked". The "cooking" is identical to the string
+formation used in AutoGen definition files (@pxref{basic expression}),
+except that you may not use backquotes.
+.TP
+.IR opts
+program options descriptor
+.TP
+.IR line
+NUL-terminated text
+.sp 1
+.SH ERRORS
+Invalid options are silently ignored. Invalid option arguments
+will cause a warning to print, but the function should return.
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/optionNextValue.3 b/autoopts/optionNextValue.3
new file mode 100644
index 0000000..7b332a1
--- /dev/null
+++ b/autoopts/optionNextValue.3
@@ -0,0 +1,47 @@
+.TH optionNextValue 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionNextValue.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionNextValue - get the next value from a hierarchical list
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+const tOptionValue* \fBoptionNextValue\fP(const tOptionValue* \fIpOptValue\fP, const tOptionValue* \fIpOldValue\fP);
+.sp 1
+.SH DESCRIPTION
+This routine will return the next entry after the entry passed in. At the
+end of the list, NULL will be returned. If the entry is not found on the
+list, NULL will be returned and "\fBerrno\fP" will be set to EINVAL.
+The "\fBpOldValue\fP" must have been gotten from a prior call to this
+routine or to "\fBopitonGetValue()\fP".
+.TP
+.IR pOptValue
+a hierarchcal list value
+.TP
+.IR pOldValue
+a value from this list
+.sp 1
+.SH RETURN VALUE
+a compound value structure
+.sp 1
+.SH ERRORS
+The returned result is NULL and errno is set:
+.sp 1ize @bullet
+.sp 1
+\fBEINVAL\fP \- the \fBpOptValue\fP does not point to a valid
+hierarchical option value or \fBpOldValue\fP does not point to a
+member of that option value.
+.sp 1
+\fBENOENT\fP \- the supplied \fBpOldValue\fP pointed to the last entry.
+@end itemize
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/optionOnlyUsage.3 b/autoopts/optionOnlyUsage.3
new file mode 100644
index 0000000..a48ddb5
--- /dev/null
+++ b/autoopts/optionOnlyUsage.3
@@ -0,0 +1,31 @@
+.TH optionOnlyUsage 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionOnlyUsage.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionOnlyUsage - Print usage text for just the options
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+void \fBoptionOnlyUsage\fP(tOptions* \fIpOpts\fP, int \fIex_code\fP);
+.sp 1
+.SH DESCRIPTION
+This routine will print only the usage for each option.
+This function may be used when the emitted usage must incorporate
+information not available to AutoOpts.
+.TP
+.IR pOpts
+program options descriptor
+.TP
+.IR ex_code
+exit code for calling exit(3)
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/optionProcess.3 b/autoopts/optionProcess.3
new file mode 100644
index 0000000..f0d047d
--- /dev/null
+++ b/autoopts/optionProcess.3
@@ -0,0 +1,55 @@
+.TH optionProcess 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionProcess.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionProcess - this is the main option processing routine
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+int \fBoptionProcess\fP(tOptions* \fIpOpts\fP, int \fIargc\fP, char** \fIargv\fP);
+.sp 1
+.SH DESCRIPTION
+This is the main entry point for processing options. It is intended
+that this procedure be called once at the beginning of the execution of
+a program. Depending on options selected earlier, it is sometimes
+necessary to stop and restart option processing, or to select completely
+different sets of options. This can be done easily, but you generally
+do not want to do this.
+
+The number of arguments processed always includes the program name.
+If one of the arguments is "--", then it is counted and the processing
+stops. If an error was encountered and errors are to be tolerated, then
+the returned value is the index of the argument causing the error.
+A hyphen by itself ("-") will also cause processing to stop and will
+\fInot\fP be counted among the processed arguments. A hyphen by itself
+is treated as an operand. Encountering an operand stops option
+processing.
+.TP
+.IR pOpts
+program options descriptor
+.TP
+.IR argc
+program arg count
+.TP
+.IR argv
+program arg vector
+.sp 1
+.SH RETURN VALUE
+the count of the arguments processed
+.sp 1
+.SH ERRORS
+Errors will cause diagnostics to be printed. \fBexit(3)\fP may
+or may not be called. It depends upon whether or not the options
+were generated with the "allow-errors" attribute, or if the
+ERRSKIP_OPTERR or ERRSTOP_OPTERR macros were invoked.
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/optionRestore.3 b/autoopts/optionRestore.3
new file mode 100644
index 0000000..0e21e50
--- /dev/null
+++ b/autoopts/optionRestore.3
@@ -0,0 +1,35 @@
+.TH optionRestore 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionRestore.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionRestore - restore option state from memory copy
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+void \fBoptionRestore\fP(tOptions* \fIpOpts\fP);
+.sp 1
+.SH DESCRIPTION
+Copy back the option state from saved memory.
+The allocated memory is left intact, so this routine can be
+called repeatedly without having to call optionSaveState again.
+If you are restoring a state that was saved before the first call
+to optionProcess(3AO), then you may change the contents of the
+argc/argv parameters to optionProcess.
+.TP
+.IR pOpts
+program options descriptor
+.sp 1
+.SH ERRORS
+If you have not called \fBoptionSaveState\fP before, a diagnostic is
+printed to \fBstderr\fP and exit is called.
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/optionSaveFile.3 b/autoopts/optionSaveFile.3
new file mode 100644
index 0000000..b443471
--- /dev/null
+++ b/autoopts/optionSaveFile.3
@@ -0,0 +1,44 @@
+.TH optionSaveFile 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionSaveFile.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionSaveFile - saves the option state to a file
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+void \fBoptionSaveFile\fP(tOptions* \fIpOpts\fP);
+.sp 1
+.SH DESCRIPTION
+This routine will save the state of option processing to a file. The name
+of that file can be specified with the argument to the \fB--save-opts\fP
+option, or by appending the \fBrcfile\fP attribute to the last
+\fBhomerc\fP attribute. If no \fBrcfile\fP attribute was specified, it
+will default to \fB.\fIprogramname\fPrc\fP. If you wish to specify another
+file, you should invoke the \fBSET_OPT_SAVE_OPTS(\fIfilename\fP)\fP macro.
+
+The recommend usage is as follows:
+.nf
+ optionProcess(&progOptions, argc, argv);
+ if (i_want_a_non_standard_place_for_this)
+ SET_OPT_SAVE_OPTS("myfilename");
+ optionSaveFile(&progOptions);
+.fi
+.TP
+.IR pOpts
+program options descriptor
+.sp 1
+.SH ERRORS
+If no \fBhomerc\fP file was specified, this routine will silently return
+and do nothing. If the output file cannot be created or updated, a message
+will be printed to \fBstderr\fP and the routine will return.
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/optionSaveState.3 b/autoopts/optionSaveState.3
new file mode 100644
index 0000000..57567db
--- /dev/null
+++ b/autoopts/optionSaveState.3
@@ -0,0 +1,41 @@
+.TH optionSaveState 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionSaveState.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionSaveState - saves the option state to memory
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+void \fBoptionSaveState\fP(tOptions* \fIpOpts\fP);
+.sp 1
+.SH DESCRIPTION
+This routine will allocate enough memory to save the current option
+processing state. If this routine has been called before, that memory
+will be reused. You may only save one copy of the option state. This
+routine may be called before optionProcess(3AO). If you do call it
+before the first call to optionProcess, then you may also change the
+contents of argc/argv after you call optionRestore(3AO)
+
+In fact, more strongly put: it is safest to only use this function
+before having processed any options. In particular, the saving and
+restoring of stacked string arguments and hierarchical values is
+disabled. The values are not saved.
+.TP
+.IR pOpts
+program options descriptor
+.sp 1
+.SH ERRORS
+If it fails to allocate the memory,
+it will print a message to stderr and exit.
+Otherwise, it will always succeed.
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/optionUnloadNested.3 b/autoopts/optionUnloadNested.3
new file mode 100644
index 0000000..ffa30c8
--- /dev/null
+++ b/autoopts/optionUnloadNested.3
@@ -0,0 +1,28 @@
+.TH optionUnloadNested 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionUnloadNested.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionUnloadNested - Deallocate the memory for a nested value
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+void \fBoptionUnloadNested\fP(tOptionValue const * \fIpOptVal\fP);
+.sp 1
+.SH DESCRIPTION
+A nested value needs to be deallocated. The pointer passed in should
+have been gotten from a call to \fBconfigFileLoad()\fP (See
+@pxref{libopts-configFileLoad}).
+.TP
+.IR pOptVal
+the hierarchical value
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/optionVersion.3 b/autoopts/optionVersion.3
new file mode 100644
index 0000000..9de5a36
--- /dev/null
+++ b/autoopts/optionVersion.3
@@ -0,0 +1,27 @@
+.TH optionVersion 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (optionVersion.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+optionVersion - return the compiled AutoOpts version number
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+char const* \fBoptionVersion\fP(void);
+.sp 1
+.SH DESCRIPTION
+Returns the full version string compiled into the library.
+The returned string cannot be modified.
+.sp 1
+.SH RETURN VALUE
+the version string in constant memory
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/parse-duration.c b/autoopts/parse-duration.c
new file mode 100644
index 0000000..7f1fb49
--- /dev/null
+++ b/autoopts/parse-duration.c
@@ -0,0 +1,601 @@
+/* Parse a time duration and return a seconds count
+ Copyright (C) 2008-2012 Free Software Foundation, Inc.
+ Written by Bruce Korb <bkorb@gnu.org>, 2008.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include "parse-duration.h"
+
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef NUL
+#define NUL '\0'
+#endif
+
+#define cch_t char const
+
+typedef enum {
+ NOTHING_IS_DONE,
+ YEAR_IS_DONE,
+ MONTH_IS_DONE,
+ WEEK_IS_DONE,
+ DAY_IS_DONE,
+ HOUR_IS_DONE,
+ MINUTE_IS_DONE,
+ SECOND_IS_DONE
+} whats_done_t;
+
+#define SEC_PER_MIN 60
+#define SEC_PER_HR (SEC_PER_MIN * 60)
+#define SEC_PER_DAY (SEC_PER_HR * 24)
+#define SEC_PER_WEEK (SEC_PER_DAY * 7)
+#define SEC_PER_MONTH (SEC_PER_DAY * 30)
+#define SEC_PER_YEAR (SEC_PER_DAY * 365)
+
+#define TIME_MAX 0x7FFFFFFF
+
+/* Wrapper around strtoul that does not require a cast. */
+static unsigned long inline
+str_const_to_ul (cch_t * str, cch_t ** ppz, int base)
+{
+ return strtoul (str, (char **)ppz, base);
+}
+
+/* Wrapper around strtol that does not require a cast. */
+static long inline
+str_const_to_l (cch_t * str, cch_t ** ppz, int base)
+{
+ return strtol (str, (char **)ppz, base);
+}
+
+/* Returns BASE + VAL * SCALE, interpreting BASE = BAD_TIME
+ with errno set as an error situation, and returning BAD_TIME
+ with errno set in an error situation. */
+static time_t inline
+scale_n_add (time_t base, time_t val, int scale)
+{
+ if (base == BAD_TIME)
+ {
+ if (errno == 0)
+ errno = EINVAL;
+ return BAD_TIME;
+ }
+
+ if (val > TIME_MAX / scale)
+ {
+ errno = ERANGE;
+ return BAD_TIME;
+ }
+
+ val *= scale;
+ if (base > TIME_MAX - val)
+ {
+ errno = ERANGE;
+ return BAD_TIME;
+ }
+
+ return base + val;
+}
+
+/* After a number HH has been parsed, parse subsequent :MM or :MM:SS. */
+static time_t
+parse_hr_min_sec (time_t start, cch_t * pz)
+{
+ int lpct = 0;
+
+ errno = 0;
+
+ /* For as long as our scanner pointer points to a colon *AND*
+ we've not looped before, then keep looping. (two iterations max) */
+ while ((*pz == ':') && (lpct++ <= 1))
+ {
+ unsigned long v = str_const_to_ul (pz+1, &pz, 10);
+
+ if (errno != 0)
+ return BAD_TIME;
+
+ start = scale_n_add (v, start, 60);
+
+ if (errno != 0)
+ return BAD_TIME;
+ }
+
+ /* allow for trailing spaces */
+ while (isspace ((unsigned char)*pz))
+ pz++;
+ if (*pz != NUL)
+ {
+ errno = EINVAL;
+ return BAD_TIME;
+ }
+
+ return start;
+}
+
+/* Parses a value and returns BASE + value * SCALE, interpreting
+ BASE = BAD_TIME with errno set as an error situation, and returning
+ BAD_TIME with errno set in an error situation. */
+static time_t
+parse_scaled_value (time_t base, cch_t ** ppz, cch_t * endp, int scale)
+{
+ cch_t * pz = *ppz;
+ time_t val;
+
+ if (base == BAD_TIME)
+ return base;
+
+ errno = 0;
+ val = str_const_to_ul (pz, &pz, 10);
+ if (errno != 0)
+ return BAD_TIME;
+ while (isspace ((unsigned char)*pz))
+ pz++;
+ if (pz != endp)
+ {
+ errno = EINVAL;
+ return BAD_TIME;
+ }
+
+ *ppz = pz;
+ return scale_n_add (base, val, scale);
+}
+
+/* Parses the syntax YEAR-MONTH-DAY.
+ PS points into the string, after "YEAR", before "-MONTH-DAY". */
+static time_t
+parse_year_month_day (cch_t * pz, cch_t * ps)
+{
+ time_t res = 0;
+
+ res = parse_scaled_value (0, &pz, ps, SEC_PER_YEAR);
+
+ pz++; /* over the first '-' */
+ ps = strchr (pz, '-');
+ if (ps == NULL)
+ {
+ errno = EINVAL;
+ return BAD_TIME;
+ }
+ res = parse_scaled_value (res, &pz, ps, SEC_PER_MONTH);
+
+ pz++; /* over the second '-' */
+ ps = pz + strlen (pz);
+ return parse_scaled_value (res, &pz, ps, SEC_PER_DAY);
+}
+
+/* Parses the syntax YYYYMMDD. */
+static time_t
+parse_yearmonthday (cch_t * in_pz)
+{
+ time_t res = 0;
+ char buf[8];
+ cch_t * pz;
+
+ if (strlen (in_pz) != 8)
+ {
+ errno = EINVAL;
+ return BAD_TIME;
+ }
+
+ memcpy (buf, in_pz, 4);
+ buf[4] = NUL;
+ pz = buf;
+ res = parse_scaled_value (0, &pz, buf + 4, SEC_PER_YEAR);
+
+ memcpy (buf, in_pz + 4, 2);
+ buf[2] = NUL;
+ pz = buf;
+ res = parse_scaled_value (res, &pz, buf + 2, SEC_PER_MONTH);
+
+ memcpy (buf, in_pz + 6, 2);
+ buf[2] = NUL;
+ pz = buf;
+ return parse_scaled_value (res, &pz, buf + 2, SEC_PER_DAY);
+}
+
+/* Parses the syntax yy Y mm M ww W dd D. */
+static time_t
+parse_YMWD (cch_t * pz)
+{
+ time_t res = 0;
+ cch_t * ps = strchr (pz, 'Y');
+ if (ps != NULL)
+ {
+ res = parse_scaled_value (0, &pz, ps, SEC_PER_YEAR);
+ pz++;
+ }
+
+ ps = strchr (pz, 'M');
+ if (ps != NULL)
+ {
+ res = parse_scaled_value (res, &pz, ps, SEC_PER_MONTH);
+ pz++;
+ }
+
+ ps = strchr (pz, 'W');
+ if (ps != NULL)
+ {
+ res = parse_scaled_value (res, &pz, ps, SEC_PER_WEEK);
+ pz++;
+ }
+
+ ps = strchr (pz, 'D');
+ if (ps != NULL)
+ {
+ res = parse_scaled_value (res, &pz, ps, SEC_PER_DAY);
+ pz++;
+ }
+
+ while (isspace ((unsigned char)*pz))
+ pz++;
+ if (*pz != NUL)
+ {
+ errno = EINVAL;
+ return BAD_TIME;
+ }
+
+ return res;
+}
+
+/* Parses the syntax HH:MM:SS.
+ PS points into the string, after "HH", before ":MM:SS". */
+static time_t
+parse_hour_minute_second (cch_t * pz, cch_t * ps)
+{
+ time_t res = 0;
+
+ res = parse_scaled_value (0, &pz, ps, SEC_PER_HR);
+
+ pz++;
+ ps = strchr (pz, ':');
+ if (ps == NULL)
+ {
+ errno = EINVAL;
+ return BAD_TIME;
+ }
+
+ res = parse_scaled_value (res, &pz, ps, SEC_PER_MIN);
+
+ pz++;
+ ps = pz + strlen (pz);
+ return parse_scaled_value (res, &pz, ps, 1);
+}
+
+/* Parses the syntax HHMMSS. */
+static time_t
+parse_hourminutesecond (cch_t * in_pz)
+{
+ time_t res = 0;
+ char buf[4];
+ cch_t * pz;
+
+ if (strlen (in_pz) != 6)
+ {
+ errno = EINVAL;
+ return BAD_TIME;
+ }
+
+ memcpy (buf, in_pz, 2);
+ buf[2] = NUL;
+ pz = buf;
+ res = parse_scaled_value (0, &pz, buf + 2, SEC_PER_HR);
+
+ memcpy (buf, in_pz + 2, 2);
+ buf[2] = NUL;
+ pz = buf;
+ res = parse_scaled_value (res, &pz, buf + 2, SEC_PER_MIN);
+
+ memcpy (buf, in_pz + 4, 2);
+ buf[2] = NUL;
+ pz = buf;
+ return parse_scaled_value (res, &pz, buf + 2, 1);
+}
+
+/* Parses the syntax hh H mm M ss S. */
+static time_t
+parse_HMS (cch_t * pz)
+{
+ time_t res = 0;
+ cch_t * ps = strchr (pz, 'H');
+ if (ps != NULL)
+ {
+ res = parse_scaled_value (0, &pz, ps, SEC_PER_HR);
+ pz++;
+ }
+
+ ps = strchr (pz, 'M');
+ if (ps != NULL)
+ {
+ res = parse_scaled_value (res, &pz, ps, SEC_PER_MIN);
+ pz++;
+ }
+
+ ps = strchr (pz, 'S');
+ if (ps != NULL)
+ {
+ res = parse_scaled_value (res, &pz, ps, 1);
+ pz++;
+ }
+
+ while (isspace ((unsigned char)*pz))
+ pz++;
+ if (*pz != NUL)
+ {
+ errno = EINVAL;
+ return BAD_TIME;
+ }
+
+ return res;
+}
+
+/* Parses a time (hours, minutes, seconds) specification in either syntax. */
+static time_t
+parse_time (cch_t * pz)
+{
+ cch_t * ps;
+ time_t res = 0;
+
+ /*
+ * Scan for a hyphen
+ */
+ ps = strchr (pz, ':');
+ if (ps != NULL)
+ {
+ res = parse_hour_minute_second (pz, ps);
+ }
+
+ /*
+ * Try for a 'H', 'M' or 'S' suffix
+ */
+ else if (ps = strpbrk (pz, "HMS"),
+ ps == NULL)
+ {
+ /* Its a YYYYMMDD format: */
+ res = parse_hourminutesecond (pz);
+ }
+
+ else
+ res = parse_HMS (pz);
+
+ return res;
+}
+
+/* Returns a substring of the given string, with spaces at the beginning and at
+ the end destructively removed, per SNOBOL. */
+static char *
+trim (char * pz)
+{
+ /* trim leading white space */
+ while (isspace ((unsigned char)*pz))
+ pz++;
+
+ /* trim trailing white space */
+ {
+ char * pe = pz + strlen (pz);
+ while ((pe > pz) && isspace ((unsigned char)pe[-1]))
+ pe--;
+ *pe = NUL;
+ }
+
+ return pz;
+}
+
+/*
+ * Parse the year/months/days of a time period
+ */
+static time_t
+parse_period (cch_t * in_pz)
+{
+ char * pT;
+ char * ps;
+ char * pz = strdup (in_pz);
+ void * fptr = pz;
+ time_t res = 0;
+
+ if (pz == NULL)
+ {
+ errno = ENOMEM;
+ return BAD_TIME;
+ }
+
+ pT = strchr (pz, 'T');
+ if (pT != NULL)
+ {
+ *(pT++) = NUL;
+ pz = trim (pz);
+ pT = trim (pT);
+ }
+
+ /*
+ * Scan for a hyphen
+ */
+ ps = strchr (pz, '-');
+ if (ps != NULL)
+ {
+ res = parse_year_month_day (pz, ps);
+ }
+
+ /*
+ * Try for a 'Y', 'M' or 'D' suffix
+ */
+ else if (ps = strpbrk (pz, "YMWD"),
+ ps == NULL)
+ {
+ /* Its a YYYYMMDD format: */
+ res = parse_yearmonthday (pz);
+ }
+
+ else
+ res = parse_YMWD (pz);
+
+ if ((errno == 0) && (pT != NULL))
+ {
+ time_t val = parse_time (pT);
+ res = scale_n_add (res, val, 1);
+ }
+
+ free (fptr);
+ return res;
+}
+
+static time_t
+parse_non_iso8601 (cch_t * pz)
+{
+ whats_done_t whatd_we_do = NOTHING_IS_DONE;
+
+ time_t res = 0;
+
+ do {
+ time_t val;
+
+ errno = 0;
+ val = str_const_to_l (pz, &pz, 10);
+ if (errno != 0)
+ goto bad_time;
+
+ /* IF we find a colon, then we're going to have a seconds value.
+ We will not loop here any more. We cannot already have parsed
+ a minute value and if we've parsed an hour value, then the result
+ value has to be less than an hour. */
+ if (*pz == ':')
+ {
+ if (whatd_we_do >= MINUTE_IS_DONE)
+ break;
+
+ val = parse_hr_min_sec (val, pz);
+
+ if ((whatd_we_do == HOUR_IS_DONE) && (val >= SEC_PER_HR))
+ break;
+
+ return scale_n_add (res, val, 1);
+ }
+
+ {
+ unsigned int mult;
+
+ /* Skip over white space following the number we just parsed. */
+ while (isspace ((unsigned char)*pz))
+ pz++;
+
+ switch (*pz)
+ {
+ default: goto bad_time;
+ case NUL:
+ return scale_n_add (res, val, 1);
+
+ case 'y': case 'Y':
+ if (whatd_we_do >= YEAR_IS_DONE)
+ goto bad_time;
+ mult = SEC_PER_YEAR;
+ whatd_we_do = YEAR_IS_DONE;
+ break;
+
+ case 'M':
+ if (whatd_we_do >= MONTH_IS_DONE)
+ goto bad_time;
+ mult = SEC_PER_MONTH;
+ whatd_we_do = MONTH_IS_DONE;
+ break;
+
+ case 'W':
+ if (whatd_we_do >= WEEK_IS_DONE)
+ goto bad_time;
+ mult = SEC_PER_WEEK;
+ whatd_we_do = WEEK_IS_DONE;
+ break;
+
+ case 'd': case 'D':
+ if (whatd_we_do >= DAY_IS_DONE)
+ goto bad_time;
+ mult = SEC_PER_DAY;
+ whatd_we_do = DAY_IS_DONE;
+ break;
+
+ case 'h':
+ if (whatd_we_do >= HOUR_IS_DONE)
+ goto bad_time;
+ mult = SEC_PER_HR;
+ whatd_we_do = HOUR_IS_DONE;
+ break;
+
+ case 'm':
+ if (whatd_we_do >= MINUTE_IS_DONE)
+ goto bad_time;
+ mult = SEC_PER_MIN;
+ whatd_we_do = MINUTE_IS_DONE;
+ break;
+
+ case 's':
+ mult = 1;
+ whatd_we_do = SECOND_IS_DONE;
+ break;
+ }
+
+ res = scale_n_add (res, val, mult);
+
+ pz++;
+ while (isspace ((unsigned char)*pz))
+ pz++;
+ if (*pz == NUL)
+ return res;
+
+ if (! isdigit ((unsigned char)*pz))
+ break;
+ }
+
+ } while (whatd_we_do < SECOND_IS_DONE);
+
+ bad_time:
+ errno = EINVAL;
+ return BAD_TIME;
+}
+
+time_t
+parse_duration (char const * pz)
+{
+ while (isspace ((unsigned char)*pz))
+ pz++;
+
+ switch (*pz)
+ {
+ case 'P':
+ return parse_period (pz + 1);
+
+ case 'T':
+ return parse_time (pz + 1);
+
+ default:
+ if (isdigit ((unsigned char)*pz))
+ return parse_non_iso8601 (pz);
+
+ errno = EINVAL;
+ return BAD_TIME;
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "gnu"
+ * indent-tabs-mode: nil
+ * End:
+ * end of parse-duration.c */
diff --git a/autoopts/parse-duration.h b/autoopts/parse-duration.h
new file mode 100644
index 0000000..05570a0
--- /dev/null
+++ b/autoopts/parse-duration.h
@@ -0,0 +1,90 @@
+/* Parse a time duration and return a seconds count
+ Copyright (C) 2008-2012 Free Software Foundation, Inc.
+ Written by Bruce Korb <bkorb@gnu.org>, 2008.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/*
+
+ Readers and users of this function are referred to the ISO-8601
+ specification, with particular attention to "Durations".
+
+ At the time of writing, this worked:
+
+ http://en.wikipedia.org/wiki/ISO_8601#Durations
+
+ The string must start with a 'P', 'T' or a digit.
+
+ ==== if it is a digit
+
+ the string may contain: NNN Y NNN M NNN W NNN d NNN h NNN m NNN s
+ This represents NNN years, NNN months, NNN weeks, NNN days, NNN hours,
+ NNN minutes and NNN seconds.
+ The embedded white space is optional.
+ These terms must appear in this order.
+ Case is significant: 'M' is months and 'm' is minutes.
+ The final "s" is optional.
+ All of the terms ("NNN" plus designator) are optional.
+ Minutes and seconds may optionally be represented as NNN:NNN.
+ Also, hours, minute and seconds may be represented as NNN:NNN:NNN.
+ There is no limitation on the value of any of the terms, except
+ that the final result must fit in a time_t value.
+
+ ==== if it is a 'P' or 'T', please see ISO-8601 for a rigorous definition.
+
+ The 'P' term may be followed by any of three formats:
+ yyyymmdd
+ yy-mm-dd
+ yy Y mm M ww W dd D
+
+ or it may be empty and followed by a 'T'. The "yyyymmdd" must be eight
+ digits long.
+
+ NOTE! Months are always 30 days and years are always 365 days long.
+ 5 years is always 1825 days, not 1826 or 1827 depending on leap year
+ considerations. 3 months is always 90 days. There is no consideration
+ for how many days are in the current, next or previous months.
+
+ For the final format:
+ * Embedded white space is allowed, but it is optional.
+ * All of the terms are optional. Any or all-but-one may be omitted.
+ * The meanings are yy years, mm months, ww weeks and dd days.
+ * The terms must appear in this order.
+
+ ==== The 'T' term may be followed by any of these formats:
+
+ hhmmss
+ hh:mm:ss
+ hh H mm M ss S
+
+ For the final format:
+ * Embedded white space is allowed, but it is optional.
+ * All of the terms are optional. Any or all-but-one may be omitted.
+ * The terms must appear in this order.
+
+ */
+#ifndef GNULIB_PARSE_DURATION_H
+#define GNULIB_PARSE_DURATION_H
+
+#include <time.h>
+
+/* Return value when a valid duration cannot be parsed. */
+#define BAD_TIME ((time_t)~0)
+
+/* Parses the given string. If it has the syntax of a valid duration,
+ this duration is returned. Otherwise, the return value is BAD_TIME,
+ and errno is set to either EINVAL (bad syntax) or ERANGE (out of range). */
+extern time_t parse_duration (char const * in_pz);
+
+#endif /* GNULIB_PARSE_DURATION_H */
diff --git a/autoopts/pgusage.c b/autoopts/pgusage.c
new file mode 100644
index 0000000..7eae2b0
--- /dev/null
+++ b/autoopts/pgusage.c
@@ -0,0 +1,132 @@
+
+/**
+ * \file pgusage.c
+ *
+ * Time-stamp: "2012-02-28 19:49:32 bkorb"
+ *
+ * Automated Options Paged Usage module.
+ *
+ * This routine will run run-on options through a pager so the
+ * user may examine, print or edit them at their leisure.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/*=export_func optionPagedUsage
+ * private:
+ *
+ * what: Decipher a boolean value
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ *
+ * doc:
+ * Run the usage output through a pager.
+ * This is very handy if it is very long.
+ * This is disabled on platforms without a working fork() function.
+=*/
+void
+optionPagedUsage(tOptions * pOptions, tOptDesc * pOD)
+{
+#if ! defined(HAVE_WORKING_FORK)
+ if ((pOD->fOptState & OPTST_RESET) != 0)
+ return;
+
+ (*pOptions->pUsageProc)(pOptions, EXIT_SUCCESS);
+#else
+ static pid_t my_pid;
+ char zPageUsage[ 1024 ];
+
+ /*
+ * IF we are being called after the usage proc is done
+ * (and thus has called "exit(2)")
+ * THEN invoke the pager to page through the usage file we created.
+ */
+ switch (pagerState) {
+ case PAGER_STATE_INITIAL:
+ {
+ if ((pOD->fOptState & OPTST_RESET) != 0)
+ return;
+
+ my_pid = getpid();
+ snprintf(zPageUsage, sizeof(zPageUsage), TMP_USAGE_FMT, (tAoUL)my_pid);
+ unlink(zPageUsage);
+
+ /*
+ * Set usage output to this temporary file
+ */
+ option_usage_fp = fopen(zPageUsage, "w" FOPEN_BINARY_FLAG);
+ if (option_usage_fp == NULL)
+ _exit(EXIT_FAILURE);
+
+ pagerState = PAGER_STATE_READY;
+
+ /*
+ * Set up so this routine gets called during the exit logic
+ */
+ atexit((void(*)(void))optionPagedUsage);
+
+ /*
+ * The usage procedure will now put the usage information into
+ * the temporary file we created above.
+ */
+ (*pOptions->pUsageProc)(pOptions, EXIT_SUCCESS);
+
+ /* NOTREACHED */
+ _exit(EXIT_FAILURE);
+ }
+
+ case PAGER_STATE_READY:
+ {
+ tCC* pzPager = (tCC*)getenv(PAGER_NAME);
+
+ /*
+ * Use the "more(1)" program if "PAGER" has not been defined
+ */
+ if (pzPager == NULL)
+ pzPager = MORE_STR;
+
+ /*
+ * Page the file and remove it when done.
+ */
+ snprintf(zPageUsage, sizeof(zPageUsage), PAGE_USAGE_FMT, pzPager,
+ (tAoUL)my_pid);
+ fclose(stderr);
+ dup2(STDOUT_FILENO, STDERR_FILENO);
+
+ (void)system(zPageUsage);
+ }
+
+ case PAGER_STATE_CHILD:
+ /*
+ * This is a child process used in creating shell script usage.
+ */
+ break;
+ }
+#endif
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/pgusage.c */
diff --git a/autoopts/po/usage-txt.pot b/autoopts/po/usage-txt.pot
new file mode 100644
index 0000000..0b2fe6c
--- /dev/null
+++ b/autoopts/po/usage-txt.pot
@@ -0,0 +1,474 @@
+# Automated Option parsing usage text.
+# copyright (c) 1999-2012 by Bruce Korb - all rights reserved
+# This file is distributed under the same license as the AutoOpts package.
+# Bruce Korb <bkorb@gnu.org> 2012
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: autogen 5.16.2\n"
+"Report-Msgid-Bugs-To: autogen-users@lists.sourceforge.net\n"
+"POT-Creation-Date: 2012-08-11 09:41-0700\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: autoopts.c:70
+msgid "malloc of %d bytes failed\n"
+
+#: configfile.c:1353
+msgid "AutoOpts function called without option descriptor\n"
+
+#: configfile.c:1388
+msgid "\tThis exceeds the compiled library version: "
+
+#: configfile.c:1386
+msgid "Automated Options Processing Error!\n"
+ "\t%s called AutoOpts function with structure version %d:%d:%d.\n"
+
+#: autoopts.c:83
+msgid "realloc of %d bytes at 0x%p failed\n"
+
+#: configfile.c:1390
+msgid "\tThis is less than the minimum library version: "
+
+#: autoopts.c:96
+msgid "strdup of %d byte string failed\n"
+
+#: version.c:124
+msgid "Automated Options version %s\n"
+ "\tcopyright (c) 1999-2012 by Bruce Korb - all rights reserved\n"
+
+#: autoopts.c:360
+msgid "AutoOpts lib error: defaulted to option with optional arg\n"
+
+#: alias.c:55
+msgid "(AutoOpts bug): Aliasing option is out of range."
+
+#: enum.c:488
+msgid "all"
+
+#: usage.c:607
+msgid "\t\t\t\t- an alternate for %s\n"
+
+#: enum.c:230
+msgid "%s error: the keyword `%s' is ambiguous for %s\n"
+
+#: find.c:76
+msgid " The following options match:\n"
+
+#: find.c:258
+msgid "%s: ambiguous option name: %s (matches %d options)\n"
+
+#: find.c:79 find.c:84
+msgid " %s%s\n"
+
+#: check.c:159
+msgid "%s: Command line arguments required\n"
+
+#: alias.c:80 autoopts.c:228
+msgid "%d %s%s options allowed\n"
+
+#: usage.c:867
+msgid "version, usage and configuration options:"
+
+#: makeshell.c:261
+msgid "Error %d (%s) from the pipe(2) syscall\n"
+
+#: version.c:164
+msgid "ERROR: version option argument '%c' invalid. Use:\n"
+ "\t'v' - version only\n"
+ "\t'c' - version and copyright\n"
+ "\t'n' - version and copyright notice\n"
+
+#: check.c:58
+msgid "ERROR: %s option conflicts with the %s option\n"
+
+#: restore.c:109
+msgid "%s(optionSaveState): error: cannot allocate %d bytes\n"
+
+#: configfile.c:588
+msgid "auto-options"
+
+#: configfile.c:587 configfile.c:660 configfile.c:665
+msgid "program"
+
+#: usage.c:656
+msgid "\t\t\t\t- default option for unnamed options\n"
+
+#: usage.c:571
+msgid "\t\t\t\t- disabled as --%s\n"
+
+#: find.c:182 find.c:389
+msgid "%s: The ``%s'' option has been disabled"
+
+#: usage.c:836
+msgid " --- %-14s %s\n"
+
+#: usage.c:834
+msgid "This option has been disabled"
+
+#: usage.c:598
+msgid "\t\t\t\t- enabled by default\n"
+
+#: alias.c:75 autoopts.c:223
+msgid "-equivalence"
+
+#: alias.c:77 autoopts.c:225
+msgid "ERROR: only "
+
+#: usage.c:911
+msgid " - examining environment variables named %s_*\n"
+
+#: usage.c:1015
+msgid " "
+
+#: usage.c:275
+msgid "Options are specified by doubled hyphens and their name or by a single\n"
+ "hyphen and the flag character.\n"
+
+#: usage.c:250 usage.c:255
+msgid "%%-%ds %%s\n"
+
+#: makeshell.c:267
+msgid "fs error %d (%s) on fork - cannot obtain %s usage\n"
+
+#: makeshell.c:759
+msgid "fs error %d (%s) on freopen\n"
+
+#: configfile.c:1149
+msgid "File error %d (%s) opening %s for loading options\n"
+
+#: text_mmap.c:100
+msgid "fs error %d (%s) reading file %s\n"
+
+#: file.c:49 file.c:75 file.c:87 file.c:109 file.c:136
+msgid "fs error %d (%s) on %s %s for option %s\n"
+
+#: file.c:76
+msgid "stat-ing for directory"
+
+#: file.c:88
+msgid "stat-ing for regular file"
+
+#: file.c:50
+msgid "stat-ing for non-existant file"
+
+#: file.c:110
+msgid "open-ing file"
+
+#: file.c:137
+msgid "fopen-ing file"
+
+#: file.c:177
+msgid "\t\t\t\t- file must not pre-exist\n"
+
+#: file.c:181
+msgid "\t\t\t\t- file must pre-exist\n"
+
+#: makeshell.c:837
+msgid "\n"
+ "= = = = = = = =\n\n"
+ "This incarnation of genshell will produce\n"
+ "a shell script to parse the options for %s:\n\n"
+
+#: usage.c:971 usage.c:985
+msgid "=T/F"
+
+#: usage.c:975
+msgid "\n"
+ "%s\n\n"
+
+#: usage.c:967 usage.c:985
+msgid "=KWd"
+
+#: usage.c:970
+msgid "=file"
+
+#: usage.c:968
+msgid "=Mbr"
+
+#: usage.c:969
+msgid "=Tim"
+
+#: usage.c:972
+msgid "=Cplx"
+
+#: usage.c:966 usage.c:985
+msgid "=num"
+
+#: usage.c:973
+msgid "[=arg]"
+
+#: usage.c:980 usage.c:981 usage.c:982
+msgid "--%2$s%1$s"
+
+#: usage.c:964 usage.c:985
+msgid "=str"
+
+#: find.c:428 reset.c:108
+msgid "%s: illegal option -- %c\n"
+
+#: find.c:236 find.c:554 reset.c:116
+msgid "%s: illegal option -- %s\n"
+
+#: find.c:300
+msgid "%s: unknown vendor extension option -- %s\n"
+
+#: enum.c:155 enum.c:165
+msgid " or an integer from %d through %d\n"
+
+#: usage.c:486 usage.c:800
+msgid "AutoOpts ERROR: invalid option descriptor for %s\n"
+
+#: find.c:347
+msgid "%s: invalid option name: %s\n"
+
+#: enum.c:162
+msgid " or an integer mask with any of the lower %d bits set\n"
+
+#: usage.c:631
+msgid "\t\t\t\t- is a set membership option\n"
+
+#: autoopts.c:290
+msgid "%s: option `%s' requires an argument\n"
+
+#: autoopts.c:175
+msgid "Equivalenced option '%s' was equivalenced to both\n"
+ "\t'%s' and '%s'"
+
+#: usage.c:651
+msgid "\t\t\t\t- must appear between %d and %d times\n"
+
+#: check.c:92
+msgid "ERROR: The %s option is required\n"
+
+#: autoopts.c:389
+msgid "%s: option `%s' cannot have an argument\n"
+
+#: check.c:149
+msgid "%s: Command line arguments not allowed\n"
+
+#: save.c:512
+msgid "error %d (%s) creating %s\n"
+
+#: usage.c:277
+msgid "Options are specified by single or double hyphens and their name.\n"
+
+#: enum.c:230
+msgid "%s error: `%s' does not match any %s keywords\n"
+
+#: usage.c:638
+msgid "\t\t\t\t- may appear multiple times\n"
+
+#: usage.c:625
+msgid "\t\t\t\t- may not be preset\n"
+
+#: reset.c:91
+msgid "The 'reset-option' option requires an argument\n"
+
+#: usage.c:1026
+msgid " Arg Option-Name Description\n"
+
+#: usage.c:962 usage.c:1020
+msgid " Flg Arg Option-Name Description\n"
+
+#: save.c:179 save.c:233
+msgid "error %d (%s) stat-ing %s\n"
+
+#: restore.c:150
+msgid "%s(optionRestore): error: no saved option state\n"
+
+#: enum.c:493
+msgid "none"
+
+#: save.c:128
+msgid "'%s' not defined\n"
+
+#: autoopts.c:421
+msgid "'%s' is not a command line option\n"
+
+#: check.c:91
+msgid "ERROR: The %s option must appear %d times\n"
+
+#: configfile.c:1159 makeshell.c:684 save.c:252
+msgid "error: cannot load options from non-regular file %s\n"
+
+#: numeric.c:151
+msgid "%s error: `%s' is not a recognizable number\n"
+
+#: time.c:112
+msgid "%s error: `%s' is not a recognizable date/time\n"
+
+#: time.c:51
+msgid "%s error: `%s' is not a recognizable time duration\n"
+
+#: usage.c:1021 usage.c:1027
+msgid " %3s %s"
+
+#: usage.c:282
+msgid "The '-#<number>' option may omit the hash char\n"
+
+#: alias.c:82 autoopts.c:230
+msgid "one %s%s option allowed\n"
+
+#: usage.c:278
+msgid "All arguments are named options.\n"
+
+#: makeshell.c:176 makeshell.c:859 usage.c:234 usage.c:309 version.c:170
+msgid "Write failure to output file"
+
+#: usage.c:703
+msgid " - reading file %s"
+
+#: usage.c:304 version.c:108 version.c:130
+msgid "\n"
+ "please send bug reports to: %s\n"
+
+#: usage.c:637
+msgid "\t\t\t\t- may NOT appear - preset only\n"
+
+#: save.c:532
+msgid "# preset/initialization file\n"
+ "# %s#\n"
+
+#: usage.c:675 usage.c:909
+msgid "\n"
+ "The following option preset mechanisms are supported:\n"
+
+#: usage.c:421
+msgid "prohibits these options:\n"
+
+#: usage.c:285
+msgid "Operands and options may be intermixed. They will be reordered.\n"
+
+#: numeric.c:75
+msgid "%s%ld to %ld"
+
+#: numeric.c:73
+msgid "%sgreater than or equal to %ld"
+
+#: numeric.c:64
+msgid "%sIt must lie in one of the ranges:\n"
+
+#: numeric.c:64
+msgid "%sIt must be in the range:\n"
+
+#: numeric.c:82
+msgid ", or\n"
+
+#: numeric.c:56
+msgid "%s error: %s option value %ld is out of range.\n"
+
+#: numeric.c:69
+msgid "%s%ld exactly"
+
+#: numeric.c:62
+msgid "%sis scalable with a suffix: k/K/m/M/g/G/t/T\n"
+
+#: numeric.c:71
+msgid "%sless than or equal to %ld"
+
+#: reset.c:86
+msgid "The --reset-option has not been configured.\n"
+
+#: check.c:45
+msgid "ERROR: %s option requires the %s option\n"
+
+#: usage.c:1033 usage.c:1039
+msgid " %3s %-14s %s"
+
+#: usage.c:403
+msgid "requires these options:\n"
+
+#: usage.c:1038
+msgid " Arg Option-Name Req? Description\n"
+
+#: usage.c:1032
+msgid " Flg Arg Option-Name Req? Description\n"
+
+#: configfile.c:1420
+msgid "-_^"
+
+#: enum.c:163
+msgid "or you may use a numeric representation. Preceding these with a '!' will\n"
+ "clear the bits, specifying 'none' will clear all bits, and 'all' will set them\n"
+ "all. Multiple entries may be passed as an option argument list.\n"
+
+#: usage.c:984
+msgid "%s"
+
+#: usage.c:976
+msgid " "
+
+#: usage.c:1010
+msgid "T/F"
+
+#: usage.c:1014
+msgid "\n"
+ "%s\n\n"
+ "%s"
+
+#: usage.c:1009
+msgid "Fil"
+
+#: usage.c:1006
+msgid "KWd"
+
+#: usage.c:1007
+msgid "Mbr"
+
+#: usage.c:1008
+msgid "Tim"
+
+#: usage.c:1011
+msgid "Cpx"
+
+#: usage.c:1013
+msgid "no "
+
+#: usage.c:1005
+msgid "Num"
+
+#: usage.c:1012
+msgid "opt"
+
+#: usage.c:1004
+msgid "YES"
+
+#: usage.c:1003
+msgid "Str"
+
+#: usage.c:395
+msgid "\t\t\t\t- "
+
+#: usage.c:412
+msgid "\t\t\t\t-- and "
+
+#: usage.c:405 usage.c:423 usage.c:514
+msgid "\t\t\t\t%s\n"
+
+#: usage.c:977
+msgid " "
+
+#: enum.c:196
+msgid "%s error: %s exceeds %s keyword count\n"
+
+#: usage.c:1016
+msgid " "
+
+#: usage.c:643
+msgid "\t\t\t\t- may appear up to %d times\n"
+
+#: enum.c:73
+msgid "The valid \"%s\" option keywords are:\n"
+
+#: usage.c:514
+msgid "These additional options are:"
+
+#: usage.c:871
+msgid "The next option supports vendor supported extra options:"
+
diff --git a/autoopts/project.h b/autoopts/project.h
new file mode 100644
index 0000000..c0df391
--- /dev/null
+++ b/autoopts/project.h
@@ -0,0 +1,50 @@
+
+#ifndef AUTOGEN_PROJECT_H
+#define AUTOGEN_PROJECT_H
+
+#include "config.h"
+#include "compat/compat.h"
+#include "ag-char-map.h"
+
+/*
+ * Procedure success codes
+ *
+ * USAGE: define procedures to return "tSuccess". Test their results
+ * with the SUCCEEDED, FAILED and HADGLITCH macros.
+ *
+ * Microsoft sticks its nose into user space here, so for Windows' sake,
+ * make sure all of these are undefined.
+ */
+#undef SUCCESS
+#undef FAILURE
+#undef PROBLEM
+#undef SUCCEEDED
+#undef SUCCESSFUL
+#undef FAILED
+#undef HADGLITCH
+
+#define SUCCESS ((tSuccess) 0)
+#define FAILURE ((tSuccess)-1)
+#define PROBLEM ((tSuccess) 1)
+
+typedef int tSuccess;
+
+#define SUCCEEDED(p) ((p) == SUCCESS)
+#define SUCCESSFUL(p) SUCCEEDED(p)
+#define FAILED(p) ((p) < SUCCESS)
+#define HADGLITCH(p) ((p) > SUCCESS)
+
+#ifndef STR
+# define __STR(s) #s
+# define STR(s) __STR(s)
+#endif
+
+#ifdef DEFINING
+# define VALUE(s) = s
+# define MODE
+#else
+# define VALUE(s)
+# define MODE extern
+#endif
+
+#endif /* AUTOGEN_PROJECT_H */
diff --git a/autoopts/proto.h b/autoopts/proto.h
new file mode 100644
index 0000000..f52c74a
--- /dev/null
+++ b/autoopts/proto.h
@@ -0,0 +1,130 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * Prototypes for autoopts
+ * Generated Sat Aug 11 09:41:23 PDT 2012
+ */
+#ifndef AUTOOPTS_PROTO_H_GUARD
+#define AUTOOPTS_PROTO_H_GUARD 1
+
+#ifndef LOCAL
+# define LOCAL extern
+# define REDEF_LOCAL 1
+#else
+# undef REDEF_LOCAL
+#endif
+/*
+ * Extracted from autoopts.c
+ */
+LOCAL void *
+ao_malloc(size_t sz);
+
+LOCAL void *
+ao_realloc(void *p, size_t sz);
+
+LOCAL char *
+ao_strdup(char const *str);
+
+LOCAL tSuccess
+handle_opt(tOptions * pOpts, tOptState* pOptState);
+
+LOCAL tSuccess
+immediate_opts(tOptions * pOpts);
+
+LOCAL tSuccess
+regular_opts(tOptions * pOpts);
+
+/*
+ * Extracted from check.c
+ */
+LOCAL bool
+is_consistent(tOptions * pOpts);
+
+/*
+ * Extracted from configfile.c
+ */
+LOCAL void
+intern_file_load(tOptions* pOpts);
+
+LOCAL char*
+parse_attrs(tOptions * pOpts, char * pzText, tOptionLoadMode * pMode,
+ tOptionValue * pType);
+
+LOCAL tSuccess
+validate_struct(tOptions * pOpts, char const * pzProgram);
+
+/*
+ * Extracted from env.c
+ */
+LOCAL void
+doPrognameEnv(tOptions * pOpts, teEnvPresetType type);
+
+LOCAL void
+env_presets(tOptions * pOpts, teEnvPresetType type);
+
+/*
+ * Extracted from find.c
+ */
+LOCAL tSuccess
+opt_find_long(tOptions * opts, char const * opt_name, tOptState * state);
+
+LOCAL tSuccess
+opt_find_short(tOptions* pOpts, uint_t optValue, tOptState* pOptState);
+
+LOCAL tSuccess
+get_opt_arg(tOptions * pOpts, tOptState * pOptState);
+
+LOCAL tSuccess
+find_opt(tOptions * pOpts, tOptState * pOptState);
+
+/*
+ * Extracted from load.c
+ */
+LOCAL void
+mungeString(char * txt, tOptionLoadMode mode);
+
+LOCAL void
+loadOptionLine(
+ tOptions * opts,
+ tOptState * opt_state,
+ char * line,
+ tDirection direction,
+ tOptionLoadMode load_mode );
+
+/*
+ * Extracted from nested.c
+ */
+LOCAL void
+unload_arg_list(tArgList* pAL);
+
+LOCAL tOptionValue*
+optionLoadNested(char const* pzTxt, char const* pzName, size_t nameLen);
+
+LOCAL int
+get_special_char(char const ** ppz, int * ct);
+
+LOCAL void
+emit_special_char(FILE * fp, int ch);
+
+/*
+ * Extracted from sort.c
+ */
+LOCAL void
+optionSort(tOptions* pOpts);
+
+/*
+ * Extracted from stack.c
+ */
+LOCAL void
+addArgListEntry(void** ppAL, void* entry);
+
+/*
+ * Extracted from usage.c
+ */
+LOCAL void
+set_usage_flags(tOptions * opts, char const * flg_txt);
+
+#ifdef REDEF_LOCAL
+# undef LOCAL
+# define LOCAL
+#endif
+#endif /* AUTOOPTS_PROTO_H_GUARD */
diff --git a/autoopts/putshell.c b/autoopts/putshell.c
new file mode 100644
index 0000000..d8e2d91
--- /dev/null
+++ b/autoopts/putshell.c
@@ -0,0 +1,361 @@
+
+/**
+ * \file putshell.c
+ *
+ * Time-stamp: "2012-03-31 13:14:18 bkorb"
+ *
+ * This module will interpret the options set in the tOptions
+ * structure and print them to standard out in a fashion that
+ * will allow them to be interpreted by the Bourne or Korn shells.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+print_quot_str(char const * pzStr);
+
+static void
+print_enumeration(tOptions * pOpts, tOptDesc * pOD);
+
+static void
+print_membership(tOptions * pOpts, tOptDesc * pOD);
+
+static void
+print_stacked_arg(tOptions * pOpts, tOptDesc * pOD);
+
+static void
+print_reordering(tOptions * pOpts);
+/* = = = END-STATIC-FORWARD = = = */
+
+/*
+ * Make sure embedded single quotes come out okay. The initial quote has
+ * been emitted and the closing quote will be upon return.
+ */
+static void
+print_quot_str(char const * pzStr)
+{
+ /*
+ * Handle empty strings to make the rest of the logic simpler.
+ */
+ if ((pzStr == NULL) || (*pzStr == NUL)) {
+ fputs(EMPTY_ARG, stdout);
+ return;
+ }
+
+ /*
+ * Emit any single quotes/apostrophes at the start of the string and
+ * bail if that is all we need to do.
+ */
+ while (*pzStr == '\'') {
+ fputs(QUOT_APOS, stdout);
+ pzStr++;
+ }
+ if (*pzStr == NUL)
+ return;
+
+ /*
+ * Start the single quote string
+ */
+ fputc('\'', stdout);
+ for (;;) {
+ char const * pz = strchr(pzStr, '\'');
+ if (pz == NULL)
+ break;
+
+ /*
+ * Emit the string up to the single quote (apostrophe) we just found.
+ */
+ (void)fwrite(pzStr, (size_t)(pz - pzStr), (size_t)1, stdout);
+ fputc('\'', stdout);
+ pzStr = pz;
+
+ /*
+ * Emit an escaped apostrophe for every one we find.
+ * If that ends the string, do not re-open the single quotes.
+ */
+ while (*++pzStr == '\'') fputs("\\'", stdout);
+ if (*pzStr == NUL)
+ return;
+
+ fputc('\'', stdout);
+ }
+
+ /*
+ * If we broke out of the loop, we must still emit the remaining text
+ * and then close the single quote string.
+ */
+ fputs(pzStr, stdout);
+ fputc('\'', stdout);
+}
+
+static void
+print_enumeration(tOptions * pOpts, tOptDesc * pOD)
+{
+ uintptr_t e_val = pOD->optArg.argEnum;
+ printf(OPT_VAL_FMT, pOpts->pzPROGNAME, pOD->pz_NAME);
+
+ /*
+ * Convert value to string, print that and restore numeric value.
+ */
+ (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD);
+ printf(QUOT_ARG_FMT, pOD->optArg.argString);
+ if (pOD->fOptState & OPTST_ALLOC_ARG)
+ AGFREE(pOD->optArg.argString);
+ pOD->optArg.argEnum = e_val;
+
+ printf(OPT_END_FMT, pOpts->pzPROGNAME, pOD->pz_NAME);
+}
+
+static void
+print_membership(tOptions * pOpts, tOptDesc * pOD)
+{
+ char const * pz;
+ uintptr_t val = 1;
+ printf(zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME,
+ (int)(uintptr_t)(pOD->optCookie));
+ pOD->optCookie = (void*)(uintptr_t)~0UL;
+ (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD);
+
+ /*
+ * We are building the typeset list. The list returned starts with
+ * 'none + ' for use by option saving stuff. We must ignore that.
+ */
+ pz = pOD->optArg.argString + 7;
+ while (*pz != NUL) {
+ printf("typeset -x -i %s_", pOD->pz_NAME);
+ pz = SPN_PLUS_N_SPACE_CHARS(pz);
+
+ for (;;) {
+ int ch = *(pz++);
+ if (IS_LOWER_CASE_CHAR(ch)) fputc(toupper(ch), stdout);
+ else if (IS_UPPER_CASE_CHAR(ch)) fputc(ch, stdout);
+ else if (IS_PLUS_N_SPACE_CHAR(ch)) goto name_done;
+ else if (ch == NUL) { pz--; goto name_done; }
+ else fputc('_', stdout);
+ } name_done:;
+ printf(SHOW_VAL_FMT, (unsigned long)val);
+ val <<= 1;
+ }
+
+ AGFREE(pOD->optArg.argString);
+ pOD->optArg.argString = NULL;
+ pOD->fOptState &= ~OPTST_ALLOC_ARG;
+}
+
+static void
+print_stacked_arg(tOptions * pOpts, tOptDesc * pOD)
+{
+ tArgList* pAL = (tArgList*)pOD->optCookie;
+ tCC** ppz = pAL->apzArgs;
+ int ct = pAL->useCt;
+
+ printf(zOptCookieCt, pOpts->pzPROGNAME, pOD->pz_NAME, ct);
+
+ while (--ct >= 0) {
+ printf(ARG_BY_NUM_FMT, pOpts->pzPROGNAME, pOD->pz_NAME,
+ pAL->useCt - ct);
+ print_quot_str(*(ppz++));
+ printf(EXPORT_ARG_FMT, pOpts->pzPROGNAME, pOD->pz_NAME,
+ pAL->useCt - ct);
+ }
+}
+
+static void
+print_reordering(tOptions * pOpts)
+{
+ unsigned int optIx;
+
+ fputs(set_dash, stdout);
+
+ for (optIx = pOpts->curOptIdx;
+ optIx < pOpts->origArgCt;
+ optIx++) {
+
+ char* pzArg = pOpts->origArgVect[ optIx ];
+
+ if (strchr(pzArg, '\'') == NULL)
+ printf(arg_fmt, pzArg);
+
+ else {
+ fputs(" '", stdout);
+ for (;;) {
+ char ch = *(pzArg++);
+ switch (ch) {
+ case '\'': fputs(apostrophy, stdout); break;
+ case NUL: goto arg_done;
+ default: fputc(ch, stdout); break;
+ }
+ } arg_done:;
+ fputc('\'', stdout);
+ }
+ }
+ fputs(init_optct, stdout);
+}
+
+/*=export_func optionPutShell
+ * what: write a portable shell script to parse options
+ * private:
+ * arg: tOptions*, pOpts, the program options descriptor
+ * doc: This routine will emit portable shell script text for parsing
+ * the options described in the option definitions.
+=*/
+void
+optionPutShell(tOptions* pOpts)
+{
+ int optIx = 0;
+
+ printf(zOptCtFmt, pOpts->curOptIdx-1);
+
+ do {
+ tOptDesc* pOD = pOpts->pOptDesc + optIx;
+
+ if ((pOD->fOptState & OPTST_NO_OUTPUT_MASK) != 0)
+ continue;
+
+ /*
+ * Equivalence classes are hard to deal with. Where the
+ * option data wind up kind of squishes around. For the purposes
+ * of emitting shell state, they are not recommended, but we'll
+ * do something. I guess we'll emit the equivalenced-to option
+ * at the point in time when the base option is found.
+ */
+ if (pOD->optEquivIndex != NO_EQUIVALENT)
+ continue; /* equivalence to a different option */
+
+ /*
+ * Equivalenced to a different option. Process the current option
+ * as the equivalenced-to option. Keep the persistent state bits,
+ * but copy over the set-state bits.
+ */
+ if (pOD->optActualIndex != optIx) {
+ tOptDesc* p = pOpts->pOptDesc + pOD->optActualIndex;
+ p->optArg = pOD->optArg;
+ p->fOptState &= OPTST_PERSISTENT_MASK;
+ p->fOptState |= pOD->fOptState & ~OPTST_PERSISTENT_MASK;
+ printf(zEquivMode, pOpts->pzPROGNAME, pOD->pz_NAME, p->pz_NAME);
+ pOD = p;
+ }
+
+ /*
+ * If the argument type is a set membership bitmask, then we always
+ * emit the thing. We do this because it will always have some sort
+ * of bitmask value and we need to emit the bit values.
+ */
+ if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_MEMBERSHIP) {
+ print_membership(pOpts, pOD);
+ continue;
+ }
+
+ /*
+ * IF the option was either specified or it wakes up enabled,
+ * then we will emit information. Otherwise, skip it.
+ * The idea is that if someone defines an option to initialize
+ * enabled, we should tell our shell script that it is enabled.
+ */
+ if (UNUSED_OPT(pOD) && DISABLED_OPT(pOD))
+ continue;
+
+ /*
+ * Handle stacked arguments
+ */
+ if ( (pOD->fOptState & OPTST_STACKED)
+ && (pOD->optCookie != NULL) ) {
+ print_stacked_arg(pOpts, pOD);
+ continue;
+ }
+
+ /*
+ * If the argument has been disabled,
+ * Then set its value to the disablement string
+ */
+ if ((pOD->fOptState & OPTST_DISABLED) != 0) {
+ printf(zOptDisabl, pOpts->pzPROGNAME, pOD->pz_NAME,
+ (pOD->pz_DisablePfx != NULL)
+ ? pOD->pz_DisablePfx : "false");
+ continue;
+ }
+
+ /*
+ * If the argument type is numeric, the last arg pointer
+ * is really the VALUE of the string that was pointed to.
+ */
+ if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_NUMERIC) {
+ printf(zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME,
+ (int)pOD->optArg.argInt);
+ continue;
+ }
+
+ /*
+ * If the argument type is an enumeration, then it is much
+ * like a text value, except we call the callback function
+ * to emit the value corresponding to the "optArg" number.
+ */
+ if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_ENUMERATION) {
+ print_enumeration(pOpts, pOD);
+ continue;
+ }
+
+ /*
+ * If the argument type is numeric, the last arg pointer
+ * is really the VALUE of the string that was pointed to.
+ */
+ if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_BOOLEAN) {
+ printf(zFullOptFmt, pOpts->pzPROGNAME, pOD->pz_NAME,
+ (pOD->optArg.argBool == 0) ? "false" : "true");
+ continue;
+ }
+
+ /*
+ * IF the option has an empty value,
+ * THEN we set the argument to the occurrence count.
+ */
+ if ( (pOD->optArg.argString == NULL)
+ || (pOD->optArg.argString[0] == NUL) ) {
+
+ printf(zOptNumFmt, pOpts->pzPROGNAME, pOD->pz_NAME,
+ pOD->optOccCt);
+ continue;
+ }
+
+ /*
+ * This option has a text value
+ */
+ printf(OPT_VAL_FMT, pOpts->pzPROGNAME, pOD->pz_NAME);
+ print_quot_str(pOD->optArg.argString);
+ printf(OPT_END_FMT, pOpts->pzPROGNAME, pOD->pz_NAME);
+
+ } while (++optIx < pOpts->presetOptCt );
+
+ if ( ((pOpts->fOptSet & OPTPROC_REORDER) != 0)
+ && (pOpts->curOptIdx < pOpts->origArgCt))
+ print_reordering(pOpts);
+
+ fflush(stdout);
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/putshell.c */
diff --git a/autoopts/reset.c b/autoopts/reset.c
new file mode 100644
index 0000000..ba61d12
--- /dev/null
+++ b/autoopts/reset.c
@@ -0,0 +1,138 @@
+
+/**
+ * \file reset.c
+ *
+ * Time-stamp: "2012-08-11 08:35:11 bkorb"
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+static void
+optionReset( tOptions* pOpts, tOptDesc* pOD )
+{
+ pOD->fOptState &= OPTST_PERSISTENT_MASK;
+ pOD->fOptState |= OPTST_RESET;
+ if (pOD->pOptProc != NULL)
+ pOD->pOptProc(pOpts, pOD);
+ pOD->optArg.argString =
+ pOpts->originalOptArgArray[ pOD->optIndex ].argString;
+ pOD->optCookie = pOpts->originalOptArgCookie[ pOD->optIndex ];
+ pOD->fOptState &= OPTST_PERSISTENT_MASK;
+}
+
+
+static void
+optionResetEverything(tOptions * pOpts)
+{
+ tOptDesc * pOD = pOpts->pOptDesc;
+ int ct = pOpts->presetOptCt;
+
+ for (;;) {
+ optionReset(pOpts, pOD);
+
+ if (--ct <= 0)
+ break;
+ pOD++;
+ }
+}
+
+
+/*=export_func optionResetOpt
+ * private:
+ *
+ * what: Reset the value of an option
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ *
+ * doc:
+ * This code will cause another option to be reset to its initial state.
+ * For example, --reset=foo will cause the --foo option to be reset.
+=*/
+void
+optionResetOpt( tOptions* pOpts, tOptDesc* pOD )
+{
+ static bool reset_active = false;
+
+ tOptState opt_state = OPTSTATE_INITIALIZER(DEFINED);
+ char const * pzArg = pOD->optArg.argString;
+ tSuccess succ;
+
+ if (pOpts <= OPTPROC_EMIT_LIMIT)
+ return;
+
+ if (reset_active)
+ return;
+
+ if ( (! HAS_originalOptArgArray(pOpts))
+ || (pOpts->originalOptArgCookie == NULL)) {
+ fputs(zResetNotConfig, stderr);
+ _exit(EX_SOFTWARE);
+ }
+
+ if ((pzArg == NULL) || (*pzArg == NUL)) {
+ fputs(zNoResetArg, stderr);
+ pOpts->pUsageProc(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+ assert(0 == 1);
+ }
+
+ reset_active = true;
+
+ if (pzArg[1] == NUL) {
+ if (*pzArg == '*') {
+ optionResetEverything(pOpts);
+ reset_active = false;
+ return;
+ }
+
+ succ = opt_find_short(pOpts, (tAoUC)*pzArg, &opt_state);
+ if (! SUCCESSFUL(succ)) {
+ fprintf(stderr, zIllOptChr, pOpts->pzProgPath, *pzArg);
+ pOpts->pUsageProc(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+ assert(0 == 1);
+ }
+ } else {
+ succ = opt_find_long(pOpts, (char *)pzArg, &opt_state);
+ if (! SUCCESSFUL(succ)) {
+ fprintf(stderr, zIllOptStr, pOpts->pzProgPath, pzArg);
+ pOpts->pUsageProc(pOpts, EXIT_FAILURE);
+ /* NOTREACHED */
+ assert(0 == 1);
+ }
+ }
+
+ /*
+ * We've found the indicated option. Turn off all non-persistent
+ * flags because we're forcing the option back to its initialized state.
+ * Call any callout procedure to handle whatever it needs to.
+ * Finally, clear the reset flag, too.
+ */
+ optionReset(pOpts, opt_state.pOD);
+ reset_active = false;
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/reset.c */
diff --git a/autoopts/restore.c b/autoopts/restore.c
new file mode 100644
index 0000000..4fd76f8
--- /dev/null
+++ b/autoopts/restore.c
@@ -0,0 +1,228 @@
+
+/*
+ * \file restore.c
+ *
+ * Time-stamp: "2010-08-22 11:04:00 bkorb"
+ *
+ * This module's routines will save the current option state to memory
+ * and restore it. If saved prior to the initial optionProcess call,
+ * then the initial state will be restored.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/*
+ * optionFixupSavedOpts Really, it just wipes out option state for
+ * options that are troublesome to copy. viz., stacked strings and
+ * hierarcicaly valued option args. We do duplicate string args that
+ * have been marked as allocated though.
+ */
+static void
+fixupSavedOptionArgs(tOptions* pOpts)
+{
+ tOptions* p = pOpts->pSavedState;
+ tOptDesc* pOD = pOpts->pOptDesc;
+ int ct = pOpts->optCt;
+
+ /*
+ * Make sure that allocated stuff is only referenced in the
+ * archived copy of the data.
+ */
+ for (; ct-- > 0; pOD++) {
+ switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
+ case OPARG_TYPE_STRING:
+ if (pOD->fOptState & OPTST_STACKED) {
+ tOptDesc* q = p->pOptDesc + (pOD - pOpts->pOptDesc);
+ q->optCookie = NULL;
+ }
+ if (pOD->fOptState & OPTST_ALLOC_ARG) {
+ tOptDesc* q = p->pOptDesc + (pOD - pOpts->pOptDesc);
+ AGDUPSTR(q->optArg.argString, pOD->optArg.argString, "arg");
+ }
+ break;
+
+ case OPARG_TYPE_HIERARCHY:
+ {
+ tOptDesc* q = p->pOptDesc + (pOD - pOpts->pOptDesc);
+ q->optCookie = NULL;
+ }
+ }
+ }
+}
+
+/*=export_func optionSaveState
+ *
+ * what: saves the option state to memory
+ * arg: tOptions*, pOpts, program options descriptor
+ *
+ * doc:
+ *
+ * This routine will allocate enough memory to save the current option
+ * processing state. If this routine has been called before, that memory
+ * will be reused. You may only save one copy of the option state. This
+ * routine may be called before optionProcess(3AO). If you do call it
+ * before the first call to optionProcess, then you may also change the
+ * contents of argc/argv after you call optionRestore(3AO)
+ *
+ * In fact, more strongly put: it is safest to only use this function
+ * before having processed any options. In particular, the saving and
+ * restoring of stacked string arguments and hierarchical values is
+ * disabled. The values are not saved.
+ *
+ * err: If it fails to allocate the memory,
+ * it will print a message to stderr and exit.
+ * Otherwise, it will always succeed.
+=*/
+void
+optionSaveState(tOptions* pOpts)
+{
+ tOptions* p = (tOptions*)pOpts->pSavedState;
+
+ if (p == NULL) {
+ size_t sz = sizeof(*pOpts) + (pOpts->optCt * sizeof(tOptDesc));
+ p = AGALOC(sz, "saved option state");
+ if (p == NULL) {
+ tCC* pzName = pOpts->pzProgName;
+ if (pzName == NULL) {
+ pzName = pOpts->pzPROGNAME;
+ if (pzName == NULL)
+ pzName = zNil;
+ }
+ fprintf(stderr, zCantSave, pzName, sz);
+ exit(EXIT_FAILURE);
+ }
+
+ pOpts->pSavedState = p;
+ }
+
+ memcpy(p, pOpts, sizeof(*p));
+ memcpy(p + 1, pOpts->pOptDesc, p->optCt * sizeof(tOptDesc));
+
+ fixupSavedOptionArgs(pOpts);
+}
+
+
+/*=export_func optionRestore
+ *
+ * what: restore option state from memory copy
+ * arg: tOptions*, pOpts, program options descriptor
+ *
+ * doc: Copy back the option state from saved memory.
+ * The allocated memory is left intact, so this routine can be
+ * called repeatedly without having to call optionSaveState again.
+ * If you are restoring a state that was saved before the first call
+ * to optionProcess(3AO), then you may change the contents of the
+ * argc/argv parameters to optionProcess.
+ *
+ * err: If you have not called @code{optionSaveState} before, a diagnostic is
+ * printed to @code{stderr} and exit is called.
+=*/
+void
+optionRestore(tOptions* pOpts)
+{
+ tOptions* p = (tOptions*)pOpts->pSavedState;
+
+ if (p == NULL) {
+ tCC* pzName = pOpts->pzProgName;
+ if (pzName == NULL) {
+ pzName = pOpts->pzPROGNAME;
+ if (pzName == NULL)
+ pzName = zNil;
+ }
+ fprintf(stderr, zNoState, pzName);
+ exit(EXIT_FAILURE);
+ }
+
+ pOpts->pSavedState = NULL;
+ optionFree(pOpts);
+
+ memcpy(pOpts, p, sizeof(*p));
+ memcpy(pOpts->pOptDesc, p+1, p->optCt * sizeof(tOptDesc));
+ pOpts->pSavedState = p;
+
+ fixupSavedOptionArgs(pOpts);
+}
+
+/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
+
+/*=export_func optionFree
+ *
+ * what: free allocated option processing memory
+ * arg: tOptions*, pOpts, program options descriptor
+ *
+ * doc: AutoOpts sometimes allocates memory and puts pointers to it in the
+ * option state structures. This routine deallocates all such memory.
+ *
+ * err: As long as memory has not been corrupted,
+ * this routine is always successful.
+=*/
+void
+optionFree(tOptions* pOpts)
+{
+ free_saved_state:
+ {
+ tOptDesc* p = pOpts->pOptDesc;
+ int ct = pOpts->optCt;
+ do {
+ if (p->fOptState & OPTST_ALLOC_ARG) {
+ AGFREE(p->optArg.argString);
+ p->optArg.argString = NULL;
+ p->fOptState &= ~OPTST_ALLOC_ARG;
+ }
+
+ switch (OPTST_GET_ARGTYPE(p->fOptState)) {
+ case OPARG_TYPE_STRING:
+#ifdef WITH_LIBREGEX
+ if ( (p->fOptState & OPTST_STACKED)
+ && (p->optCookie != NULL)) {
+ p->optArg.argString = ".*";
+ optionUnstackArg(pOpts, p);
+ }
+#else
+ /* leak memory */;
+#endif
+ break;
+
+ case OPARG_TYPE_HIERARCHY:
+ if (p->optCookie != NULL)
+ unload_arg_list(p->optCookie);
+ break;
+ }
+
+ p->optCookie = NULL;
+ } while (p++, --ct > 0);
+ }
+ if (pOpts->pSavedState != NULL) {
+ tOptions * p = (tOptions*)pOpts->pSavedState;
+ memcpy(pOpts, p, sizeof(*p));
+ memcpy(pOpts->pOptDesc, p+1, p->optCt * sizeof(tOptDesc));
+ AGFREE(pOpts->pSavedState);
+ pOpts->pSavedState = NULL;
+ goto free_saved_state;
+ }
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/restore.c */
diff --git a/autoopts/save.c b/autoopts/save.c
new file mode 100644
index 0000000..9e95056
--- /dev/null
+++ b/autoopts/save.c
@@ -0,0 +1,768 @@
+
+/*
+ * \file save.c
+ *
+ * Time-stamp: "2012-03-31 13:15:19 bkorb"
+ *
+ * This module's routines will take the currently set options and
+ * store them into an ".rc" file for re-interpretation the next
+ * time the invoking program is run.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static char const *
+find_dir_name(tOptions * pOpts, int * p_free);
+
+static char const *
+find_file_name(tOptions * pOpts, int * p_free_name);
+
+static void
+prt_entry(FILE * fp, tOptDesc * p, char const * pzLA);
+
+static void
+prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp);
+
+static void
+prt_string(FILE * fp, char const * name, char const * pz);
+
+static void
+prt_val_list(FILE * fp, char const * name, tArgList * al);
+
+static void
+prt_nested(FILE * fp, tOptDesc * p);
+
+static FILE *
+open_sv_file(tOptions* pOpts);
+
+static void
+prt_no_arg_opt(FILE * fp, tOptDesc * p, tOptDesc * pOD);
+
+static void
+prt_str_arg(FILE * fp, tOptDesc * pOD);
+
+static void
+prt_enum_arg(FILE * fp, tOptDesc * pOD);
+
+static void
+prt_set_arg(FILE * fp, tOptDesc * pOD);
+
+static void
+prt_file_arg(FILE * fp, tOptDesc * pOD, tOptions* pOpts);
+/* = = = END-STATIC-FORWARD = = = */
+
+static char const *
+find_dir_name(tOptions * pOpts, int * p_free)
+{
+ char const * pzDir;
+
+ if ( (pOpts->specOptIdx.save_opts == NO_EQUIVALENT)
+ || (pOpts->specOptIdx.save_opts == 0))
+ return NULL;
+
+ pzDir = pOpts->pOptDesc[ pOpts->specOptIdx.save_opts ].optArg.argString;
+ if ((pzDir != NULL) && (*pzDir != NUL))
+ return pzDir;
+
+ /*
+ * This function only works if there is a directory where
+ * we can stash the RC (INI) file.
+ */
+ {
+ char const * const* papz = pOpts->papzHomeList;
+ if (papz == NULL)
+ return NULL;
+
+ while (papz[1] != NULL) papz++;
+ pzDir = *papz;
+ }
+
+ /*
+ * IF it does not require deciphering an env value, then just copy it
+ */
+ if (*pzDir != '$')
+ return pzDir;
+
+ {
+ char const * pzEndDir = strchr(++pzDir, DIRCH);
+ char * pzFileName;
+ char * pzEnv;
+
+ if (pzEndDir != NULL) {
+ char z[ AO_NAME_SIZE ];
+ if ((pzEndDir - pzDir) > AO_NAME_LIMIT )
+ return NULL;
+ memcpy(z, pzDir, (size_t)(pzEndDir - pzDir));
+ z[pzEndDir - pzDir] = NUL;
+ pzEnv = getenv(z);
+ } else {
+
+ /*
+ * Make sure we can get the env value (after stripping off
+ * any trailing directory or file names)
+ */
+ pzEnv = getenv(pzDir);
+ }
+
+ if (pzEnv == NULL) {
+ fprintf(stderr, SAVE_WARN, pOpts->pzProgName);
+ fprintf(stderr, zNotDef, pzDir);
+ return NULL;
+ }
+
+ if (pzEndDir == NULL)
+ return pzEnv;
+
+ {
+ size_t sz = strlen(pzEnv) + strlen(pzEndDir) + 2;
+ pzFileName = (char*)AGALOC(sz, "dir name");
+ }
+
+ if (pzFileName == NULL)
+ return NULL;
+
+ *p_free = 1;
+ /*
+ * Glue together the full name into the allocated memory.
+ * FIXME: We lose track of this memory.
+ */
+ sprintf(pzFileName, "%s/%s", pzEnv, pzEndDir);
+ return pzFileName;
+ }
+}
+
+
+static char const *
+find_file_name(tOptions * pOpts, int * p_free_name)
+{
+ struct stat stBuf;
+ int free_dir_name = 0;
+
+ char const * pzDir = find_dir_name(pOpts, &free_dir_name);
+ if (pzDir == NULL)
+ return NULL;
+
+ /*
+ * See if we can find the specified directory. We use a once-only loop
+ * structure so we can bail out early.
+ */
+ if (stat(pzDir, &stBuf) != 0) do {
+ char z[AG_PATH_MAX];
+ char * dirchp;
+
+ /*
+ * IF we could not, check to see if we got a full
+ * path to a file name that has not been created yet.
+ */
+ if (errno != ENOENT) {
+ bogus_name:
+ fprintf(stderr, SAVE_WARN, pOpts->pzProgName);
+ fprintf(stderr, zNoStat, errno, strerror(errno), pzDir);
+ if (free_dir_name)
+ AGFREE((void*)pzDir);
+ return NULL;
+ }
+
+ /*
+ * Strip off the last component, stat the remaining string and
+ * that string must name a directory
+ */
+ dirchp = strrchr(pzDir, DIRCH);
+ if (dirchp == NULL) {
+ stBuf.st_mode = S_IFREG;
+ break; /* found directory -- viz., "." */
+ }
+
+ if ((size_t)(dirchp - pzDir) >= sizeof(z))
+ goto bogus_name;
+
+ memcpy(z, pzDir, (size_t)(dirchp - pzDir));
+ z[dirchp - pzDir] = NUL;
+
+ if ((stat(z, &stBuf) != 0) || ! S_ISDIR(stBuf.st_mode))
+ goto bogus_name;
+ stBuf.st_mode = S_IFREG; /* file within this directory */
+ } while (false);
+
+ /*
+ * IF what we found was a directory,
+ * THEN tack on the config file name
+ */
+ if (S_ISDIR(stBuf.st_mode)) {
+ size_t sz = strlen(pzDir) + strlen(pOpts->pzRcName) + 2;
+
+ {
+ char * pzPath = (char*)AGALOC(sz, "file name");
+#ifdef HAVE_SNPRINTF
+ snprintf(pzPath, sz, "%s/%s", pzDir, pOpts->pzRcName);
+#else
+ sprintf(pzPath, "%s/%s", pzDir, pOpts->pzRcName);
+#endif
+ if (free_dir_name)
+ AGFREE((void*)pzDir);
+ pzDir = pzPath;
+ free_dir_name = 1;
+ }
+
+ /*
+ * IF we cannot stat the object for any reason other than
+ * it does not exist, then we bail out
+ */
+ if (stat(pzDir, &stBuf) != 0) {
+ if (errno != ENOENT) {
+ fprintf(stderr, SAVE_WARN, pOpts->pzProgName);
+ fprintf(stderr, zNoStat, errno, strerror(errno),
+ pzDir);
+ AGFREE((void*)pzDir);
+ return NULL;
+ }
+
+ /*
+ * It does not exist yet, but it will be a regular file
+ */
+ stBuf.st_mode = S_IFREG;
+ }
+ }
+
+ /*
+ * Make sure that whatever we ultimately found, that it either is
+ * or will soon be a file.
+ */
+ if (! S_ISREG(stBuf.st_mode)) {
+ fprintf(stderr, SAVE_WARN, pOpts->pzProgName);
+ fprintf(stderr, zNotFile, pzDir);
+ if (free_dir_name)
+ AGFREE((void*)pzDir);
+ return NULL;
+ }
+
+ /*
+ * Get rid of the old file
+ */
+ unlink(pzDir);
+ *p_free_name = free_dir_name;
+ return pzDir;
+}
+
+
+static void
+prt_entry(FILE * fp, tOptDesc * p, char const * pzLA)
+{
+ /*
+ * There is an argument. Pad the name so values line up.
+ * Not disabled *OR* this got equivalenced to another opt,
+ * then use current option name.
+ * Otherwise, there must be a disablement name.
+ */
+ {
+ char const * pz;
+ if (! DISABLED_OPT(p) || (p->optEquivIndex != NO_EQUIVALENT))
+ pz = p->pz_Name;
+ else
+ pz = p->pz_DisableName;
+
+ fprintf(fp, "%-18s", pz);
+ }
+ /*
+ * IF the option is numeric only,
+ * THEN the char pointer is really the number
+ */
+ if (OPTST_GET_ARGTYPE(p->fOptState) == OPARG_TYPE_NUMERIC)
+ fprintf(fp, " %d\n", (int)(t_word)pzLA);
+
+ /*
+ * OTHERWISE, FOR each line of the value text, ...
+ */
+ else if (pzLA == NULL)
+ fputc(NL, fp);
+
+ else {
+ fputc(' ', fp); fputc(' ', fp);
+ for (;;) {
+ char const * pzNl = strchr(pzLA, NL);
+
+ /*
+ * IF this is the last line
+ * THEN bail and print it
+ */
+ if (pzNl == NULL)
+ break;
+
+ /*
+ * Print the continuation and the text from the current line
+ */
+ (void)fwrite(pzLA, (size_t)(pzNl - pzLA), (size_t)1, fp);
+ pzLA = pzNl+1; /* advance the Last Arg pointer */
+ fputs("\\\n", fp);
+ }
+
+ /*
+ * Terminate the entry
+ */
+ fputs(pzLA, fp);
+ fputc(NL, fp);
+ }
+}
+
+
+static void
+prt_value(FILE * fp, int depth, tOptDesc * pOD, tOptionValue const * ovp)
+{
+ while (--depth >= 0)
+ putc(' ', fp), putc(' ', fp);
+
+ switch (ovp->valType) {
+ default:
+ case OPARG_TYPE_NONE:
+ fprintf(fp, NULL_ATR_FMT, ovp->pzName);
+ break;
+
+ case OPARG_TYPE_STRING:
+ prt_string(fp, ovp->pzName, ovp->v.strVal);
+ break;
+
+ case OPARG_TYPE_ENUMERATION:
+ case OPARG_TYPE_MEMBERSHIP:
+ if (pOD != NULL) {
+ tAoUI opt_state = pOD->fOptState;
+ uintptr_t val = pOD->optArg.argEnum;
+ char const * typ = (ovp->valType == OPARG_TYPE_ENUMERATION)
+ ? "keyword" : "set-membership";
+
+ fprintf(fp, TYPE_ATR_FMT, ovp->pzName, typ);
+
+ /*
+ * This is a magic incantation that will convert the
+ * bit flag values back into a string suitable for printing.
+ */
+ (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD );
+ if (pOD->optArg.argString != NULL) {
+ fputs(pOD->optArg.argString, fp);
+
+ if (ovp->valType != OPARG_TYPE_ENUMERATION) {
+ /*
+ * set membership strings get allocated
+ */
+ AGFREE((void*)pOD->optArg.argString);
+ }
+ }
+
+ pOD->optArg.argEnum = val;
+ pOD->fOptState = opt_state;
+ fprintf(fp, END_XML_FMT, ovp->pzName);
+ break;
+ }
+ /* FALLTHROUGH */
+
+ case OPARG_TYPE_NUMERIC:
+ fprintf(fp, NUMB_ATR_FMT, ovp->pzName, ovp->v.longVal);
+ break;
+
+ case OPARG_TYPE_BOOLEAN:
+ fprintf(fp, BOOL_ATR_FMT, ovp->pzName,
+ ovp->v.boolVal ? "true" : "false");
+ break;
+
+ case OPARG_TYPE_HIERARCHY:
+ prt_val_list(fp, ovp->pzName, ovp->v.nestVal);
+ break;
+ }
+}
+
+
+static void
+prt_string(FILE * fp, char const * name, char const * pz)
+{
+ fprintf(fp, OPEN_XML_FMT, name);
+ for (;;) {
+ int ch = ((int)*(pz++)) & 0xFF;
+
+ switch (ch) {
+ case NUL: goto string_done;
+
+ case '&':
+ case '<':
+ case '>':
+#if __GNUC__ >= 4
+ case 1 ... (' ' - 1):
+ case ('~' + 1) ... 0xFF:
+#endif
+ emit_special_char(fp, ch);
+ break;
+
+ default:
+#if __GNUC__ < 4
+ if ( ((ch >= 1) && (ch <= (' ' - 1)))
+ || ((ch >= ('~' + 1)) && (ch <= 0xFF)) ) {
+ emit_special_char(fp, ch);
+ break;
+ }
+#endif
+ putc(ch, fp);
+ }
+ } string_done:;
+ fprintf(fp, END_XML_FMT, name);
+}
+
+
+static void
+prt_val_list(FILE * fp, char const * name, tArgList * al)
+{
+ static int depth = 1;
+
+ int sp_ct;
+ int opt_ct;
+ void ** opt_list;
+
+ if (al == NULL)
+ return;
+ opt_ct = al->useCt;
+ opt_list = (void **)al->apzArgs;
+
+ if (opt_ct <= 0) {
+ fprintf(fp, OPEN_CLOSE_FMT, name);
+ return;
+ }
+
+ fprintf(fp, NESTED_OPT_FMT, name);
+
+ depth++;
+ while (--opt_ct >= 0) {
+ tOptionValue const * ovp = *(opt_list++);
+
+ prt_value(fp, depth, NULL, ovp);
+ }
+ depth--;
+
+ for (sp_ct = depth; --sp_ct >= 0;)
+ putc(' ', fp), putc(' ', fp);
+ fprintf(fp, "</%s>\n", name);
+}
+
+
+static void
+prt_nested(FILE * fp, tOptDesc * p)
+{
+ int opt_ct;
+ tArgList * al = p->optCookie;
+ void ** opt_list;
+
+ if (al == NULL)
+ return;
+
+ opt_ct = al->useCt;
+ opt_list = (void **)al->apzArgs;
+
+ if (opt_ct <= 0)
+ return;
+
+ do {
+ tOptionValue const * base = *(opt_list++);
+ tOptionValue const * ovp = optionGetValue(base, NULL);
+
+ if (ovp == NULL)
+ continue;
+
+ fprintf(fp, NESTED_OPT_FMT, p->pz_Name);
+
+ do {
+ prt_value(fp, 1, p, ovp);
+
+ } while (ovp = optionNextValue(base, ovp),
+ ovp != NULL);
+
+ fprintf(fp, "</%s>\n", p->pz_Name);
+ } while (--opt_ct > 0);
+}
+
+
+static FILE *
+open_sv_file(tOptions* pOpts)
+{
+ FILE * fp;
+
+ {
+ int free_name = 0;
+ char const * pzFName = find_file_name(pOpts, &free_name);
+ if (pzFName == NULL)
+ return NULL;
+
+ fp = fopen(pzFName, "w" FOPEN_BINARY_FLAG);
+ if (fp == NULL) {
+ fprintf(stderr, SAVE_WARN, pOpts->pzProgName);
+ fprintf(stderr, zNoCreat, errno, strerror(errno), pzFName);
+ if (free_name)
+ AGFREE((void*) pzFName );
+ return fp;
+ }
+
+ if (free_name)
+ AGFREE((void*)pzFName);
+ }
+
+ {
+ char const * pz = pOpts->pzUsageTitle;
+ fputs("# ", fp);
+ do { fputc(*pz, fp); } while (*(pz++) != NL);
+ }
+
+ {
+ time_t timeVal = time(NULL);
+ char * pzTime = ctime(&timeVal);
+
+ fprintf(fp, zPresetFile, pzTime);
+#ifdef HAVE_ALLOCATED_CTIME
+ /*
+ * The return values for ctime(), localtime(), and gmtime()
+ * normally point to static data that is overwritten by each call.
+ * The test to detect allocated ctime, so we leak the memory.
+ */
+ AGFREE((void*)pzTime);
+#endif
+ }
+
+ return fp;
+}
+
+static void
+prt_no_arg_opt(FILE * fp, tOptDesc * p, tOptDesc * pOD)
+{
+ /*
+ * The aliased to argument indicates whether or not the option
+ * is "disabled". However, the original option has the name
+ * string, so we get that there, not with "p".
+ */
+ char const * pznm =
+ (DISABLED_OPT(p)) ? pOD->pz_DisableName : pOD->pz_Name;
+ /*
+ * If the option was disabled and the disablement name is NULL,
+ * then the disablement was caused by aliasing.
+ * Use the name as the string to emit.
+ */
+ if (pznm == NULL)
+ pznm = pOD->pz_Name;
+
+ fprintf(fp, "%s\n", pznm);
+}
+
+static void
+prt_str_arg(FILE * fp, tOptDesc * pOD)
+{
+ if (pOD->fOptState & OPTST_STACKED) {
+ tArgList * pAL = (tArgList*)pOD->optCookie;
+ int uct = pAL->useCt;
+ char const ** ppz = pAL->apzArgs;
+
+ /*
+ * un-disable multiple copies of disabled options.
+ */
+ if (uct > 1)
+ pOD->fOptState &= ~OPTST_DISABLED;
+
+ while (uct-- > 0)
+ prt_entry(fp, pOD, *(ppz++));
+ } else {
+ prt_entry(fp, pOD, pOD->optArg.argString);
+ }
+}
+
+static void
+prt_enum_arg(FILE * fp, tOptDesc * pOD)
+{
+ uintptr_t val = pOD->optArg.argEnum;
+
+ /*
+ * This is a magic incantation that will convert the
+ * bit flag values back into a string suitable for printing.
+ */
+ (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD);
+ prt_entry(fp, pOD, (void*)(pOD->optArg.argString));
+
+ pOD->optArg.argEnum = val;
+}
+
+static void
+prt_set_arg(FILE * fp, tOptDesc * pOD)
+{
+ uintptr_t val = pOD->optArg.argEnum;
+
+ /*
+ * This is a magic incantation that will convert the
+ * bit flag values back into a string suitable for printing.
+ */
+ (*(pOD->pOptProc))(OPTPROC_RETURN_VALNAME, pOD);
+ prt_entry(fp, pOD, (void*)(pOD->optArg.argString));
+
+ if (pOD->optArg.argString != NULL) {
+ /*
+ * set membership strings get allocated
+ */
+ AGFREE((void*)pOD->optArg.argString);
+ pOD->fOptState &= ~OPTST_ALLOC_ARG;
+ }
+
+ pOD->optArg.argEnum = val;
+}
+
+static void
+prt_file_arg(FILE * fp, tOptDesc * pOD, tOptions* pOpts)
+{
+ /*
+ * If the cookie is not NULL, then it has the file name, period.
+ * Otherwise, if we have a non-NULL string argument, then....
+ */
+ if (pOD->optCookie != NULL)
+ prt_entry(fp, pOD, pOD->optCookie);
+
+ else if (HAS_originalOptArgArray(pOpts)) {
+ char const * orig =
+ pOpts->originalOptArgArray[pOD->optIndex].argString;
+
+ if (pOD->optArg.argString == orig)
+ return;
+
+ prt_entry(fp, pOD, pOD->optArg.argString);
+ }
+}
+
+
+/*=export_func optionSaveFile
+ *
+ * what: saves the option state to a file
+ *
+ * arg: tOptions*, pOpts, program options descriptor
+ *
+ * doc:
+ *
+ * This routine will save the state of option processing to a file. The name
+ * of that file can be specified with the argument to the @code{--save-opts}
+ * option, or by appending the @code{rcfile} attribute to the last
+ * @code{homerc} attribute. If no @code{rcfile} attribute was specified, it
+ * will default to @code{.@i{programname}rc}. If you wish to specify another
+ * file, you should invoke the @code{SET_OPT_SAVE_OPTS(@i{filename})} macro.
+ *
+ * The recommend usage is as follows:
+ * @example
+ * optionProcess(&progOptions, argc, argv);
+ * if (i_want_a_non_standard_place_for_this)
+ * SET_OPT_SAVE_OPTS("myfilename");
+ * optionSaveFile(&progOptions);
+ * @end example
+ *
+ * err:
+ *
+ * If no @code{homerc} file was specified, this routine will silently return
+ * and do nothing. If the output file cannot be created or updated, a message
+ * will be printed to @code{stderr} and the routine will return.
+=*/
+void
+optionSaveFile(tOptions* pOpts)
+{
+ tOptDesc* pOD;
+ int ct;
+ FILE * fp = open_sv_file(pOpts);
+
+ if (fp == NULL)
+ return;
+
+ /*
+ * FOR each of the defined options, ...
+ */
+ ct = pOpts->presetOptCt;
+ pOD = pOpts->pOptDesc;
+ do {
+ tOptDesc * p;
+
+ /*
+ * IF the option has not been defined
+ * OR it does not take an initialization value
+ * OR it is equivalenced to another option
+ * THEN continue (ignore it)
+ *
+ * Equivalenced options get picked up when the equivalenced-to
+ * option is processed.
+ */
+ if (UNUSED_OPT(pOD))
+ continue;
+
+ if ((pOD->fOptState & OPTST_DO_NOT_SAVE_MASK) != 0)
+ continue;
+
+ if ( (pOD->optEquivIndex != NO_EQUIVALENT)
+ && (pOD->optEquivIndex != pOD->optIndex))
+ continue;
+
+ /*
+ * The option argument data are found at the equivalenced-to option,
+ * but the actual option argument type comes from the original
+ * option descriptor. Be careful!
+ */
+ p = ((pOD->fOptState & OPTST_EQUIVALENCE) != 0)
+ ? (pOpts->pOptDesc + pOD->optActualIndex) : pOD;
+
+ switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
+ case OPARG_TYPE_NONE:
+ prt_no_arg_opt(fp, p, pOD);
+ break;
+
+ case OPARG_TYPE_NUMERIC:
+ prt_entry(fp, p, (void*)(p->optArg.argInt));
+ break;
+
+ case OPARG_TYPE_STRING:
+ prt_str_arg(fp, p);
+ break;
+
+ case OPARG_TYPE_ENUMERATION:
+ prt_enum_arg(fp, p);
+ break;
+
+ case OPARG_TYPE_MEMBERSHIP:
+ prt_set_arg(fp, p);
+ break;
+
+ case OPARG_TYPE_BOOLEAN:
+ prt_entry(fp, p, p->optArg.argBool ? "true" : "false");
+ break;
+
+ case OPARG_TYPE_HIERARCHY:
+ prt_nested(fp, p);
+ break;
+
+ case OPARG_TYPE_FILE:
+ prt_file_arg(fp, p, pOpts);
+ break;
+
+ default:
+ break; /* cannot handle - skip it */
+ }
+ } while (pOD++, (--ct > 0));
+
+ fclose(fp);
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/save.c */
diff --git a/autoopts/sort.c b/autoopts/sort.c
new file mode 100644
index 0000000..a05588d
--- /dev/null
+++ b/autoopts/sort.c
@@ -0,0 +1,336 @@
+
+/*
+ * \file sort.c
+ *
+ * Time-stamp: "2011-05-24 18:07:14 bkorb"
+ *
+ * This module implements argument sorting.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static tSuccess
+mustHandleArg(tOptions* pOpts, char* pzArg, tOptState* pOS,
+ char** ppzOpts, int* pOptsIdx);
+
+static tSuccess
+mayHandleArg(tOptions* pOpts, char* pzArg, tOptState* pOS,
+ char** ppzOpts, int* pOptsIdx);
+
+static tSuccess
+checkShortOpts(tOptions* pOpts, char* pzArg, tOptState* pOS,
+ char** ppzOpts, int* pOptsIdx);
+/* = = = END-STATIC-FORWARD = = = */
+
+/*
+ * "mustHandleArg" and "mayHandleArg" are really similar. The biggest
+ * difference is that "may" will consume the next argument only if it
+ * does not start with a hyphen and "must" will consume it, hyphen or not.
+ */
+static tSuccess
+mustHandleArg(tOptions* pOpts, char* pzArg, tOptState* pOS,
+ char** ppzOpts, int* pOptsIdx)
+{
+ /*
+ * An option argument is required. Long options can either have
+ * a separate command line argument, or an argument attached by
+ * the '=' character. Figure out which.
+ */
+ switch (pOS->optType) {
+ case TOPT_SHORT:
+ /*
+ * See if an arg string follows the flag character. If not,
+ * the next arg must be the option argument.
+ */
+ if (*pzArg != NUL)
+ return SUCCESS;
+ break;
+
+ case TOPT_LONG:
+ /*
+ * See if an arg string has already been assigned (glued on
+ * with an `=' character). If not, the next is the opt arg.
+ */
+ if (pOS->pzOptArg != NULL)
+ return SUCCESS;
+ break;
+
+ default:
+ return FAILURE;
+ }
+ if (pOpts->curOptIdx >= pOpts->origArgCt)
+ return FAILURE;
+
+ ppzOpts[ (*pOptsIdx)++ ] = pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ return SUCCESS;
+}
+
+static tSuccess
+mayHandleArg(tOptions* pOpts, char* pzArg, tOptState* pOS,
+ char** ppzOpts, int* pOptsIdx)
+{
+ /*
+ * An option argument is optional.
+ */
+ switch (pOS->optType) {
+ case TOPT_SHORT:
+ /*
+ * IF nothing is glued on after the current flag character,
+ * THEN see if there is another argument. If so and if it
+ * does *NOT* start with a hyphen, then it is the option arg.
+ */
+ if (*pzArg != NUL)
+ return SUCCESS;
+ break;
+
+ case TOPT_LONG:
+ /*
+ * Look for an argument if we don't already have one (glued on
+ * with a `=' character)
+ */
+ if (pOS->pzOptArg != NULL)
+ return SUCCESS;
+ break;
+
+ default:
+ return FAILURE;
+ }
+ if (pOpts->curOptIdx >= pOpts->origArgCt)
+ return PROBLEM;
+
+ pzArg = pOpts->origArgVect[ pOpts->curOptIdx ];
+ if (*pzArg != '-')
+ ppzOpts[ (*pOptsIdx)++ ] = pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ return SUCCESS;
+}
+
+/*
+ * Process a string of short options glued together. If the last one
+ * does or may take an argument, the do the argument processing and leave.
+ */
+static tSuccess
+checkShortOpts(tOptions* pOpts, char* pzArg, tOptState* pOS,
+ char** ppzOpts, int* pOptsIdx)
+{
+ while (*pzArg != NUL) {
+ if (FAILED(opt_find_short(pOpts, (tAoUC)*pzArg, pOS)))
+ return FAILURE;
+
+ /*
+ * See if we can have an arg.
+ */
+ if (OPTST_GET_ARGTYPE(pOS->pOD->fOptState) == OPARG_TYPE_NONE) {
+ pzArg++;
+
+ } else if (pOS->pOD->fOptState & OPTST_ARG_OPTIONAL) {
+ /*
+ * Take an argument if it is not attached and it does not
+ * start with a hyphen.
+ */
+ if (pzArg[1] != NUL)
+ return SUCCESS;
+
+ pzArg = pOpts->origArgVect[ pOpts->curOptIdx ];
+ if (*pzArg != '-')
+ ppzOpts[ (*pOptsIdx)++ ] =
+ pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ return SUCCESS;
+
+ } else {
+ /*
+ * IF we need another argument, be sure it is there and
+ * take it.
+ */
+ if (pzArg[1] == NUL) {
+ if (pOpts->curOptIdx >= pOpts->origArgCt)
+ return FAILURE;
+ ppzOpts[ (*pOptsIdx)++ ] =
+ pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ }
+ return SUCCESS;
+ }
+ }
+ return SUCCESS;
+}
+
+/*
+ * If the program wants sorted options (separated operands and options),
+ * then this routine will to the trick.
+ */
+LOCAL void
+optionSort(tOptions* pOpts)
+{
+ char** ppzOpts;
+ char** ppzOpds;
+ int optsIdx = 0;
+ int opdsIdx = 0;
+
+ tOptState os = OPTSTATE_INITIALIZER(DEFINED);
+
+ /*
+ * Disable for POSIX conformance, or if there are no operands.
+ */
+ if ( (getenv("POSIXLY_CORRECT") != NULL)
+ || NAMED_OPTS(pOpts))
+ return;
+
+ /*
+ * Make sure we can allocate two full-sized arg vectors.
+ */
+ ppzOpts = malloc(pOpts->origArgCt * sizeof(char*));
+ if (ppzOpts == NULL)
+ goto exit_no_mem;
+
+ ppzOpds = malloc(pOpts->origArgCt * sizeof(char*));
+ if (ppzOpds == NULL) {
+ free(ppzOpts);
+ goto exit_no_mem;
+ }
+
+ pOpts->curOptIdx = 1;
+ pOpts->pzCurOpt = NULL;
+
+ /*
+ * Now, process all the options from our current position onward.
+ * (This allows interspersed options and arguments for the few
+ * non-standard programs that require it.)
+ */
+ for (;;) {
+ char* pzArg;
+ tSuccess res;
+
+ /*
+ * If we're out of arguments, we're done. Join the option and
+ * operand lists into the original argument vector.
+ */
+ if (pOpts->curOptIdx >= pOpts->origArgCt) {
+ errno = 0;
+ goto joinLists;
+ }
+
+ pzArg = pOpts->origArgVect[ pOpts->curOptIdx ];
+ if (*pzArg != '-') {
+ ppzOpds[ opdsIdx++ ] = pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ continue;
+ }
+
+ switch (pzArg[1]) {
+ case NUL:
+ /*
+ * A single hyphen is an operand.
+ */
+ ppzOpds[ opdsIdx++ ] = pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ continue;
+
+ case '-':
+ /*
+ * Two consecutive hypens. Put them on the options list and then
+ * _always_ force the remainder of the arguments to be operands.
+ */
+ if (pzArg[2] == NUL) {
+ ppzOpts[ optsIdx++ ] =
+ pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+ goto restOperands;
+ }
+ res = opt_find_long(pOpts, pzArg+2, &os);
+ break;
+
+ default:
+ /*
+ * If short options are not allowed, then do long
+ * option processing. Otherwise the character must be a
+ * short (i.e. single character) option.
+ */
+ if ((pOpts->fOptSet & OPTPROC_SHORTOPT) == 0) {
+ res = opt_find_long(pOpts, pzArg+1, &os);
+ } else {
+ res = opt_find_short(pOpts, (tAoUC)pzArg[1], &os);
+ }
+ break;
+ }
+ if (FAILED(res)) {
+ errno = EINVAL;
+ goto freeTemps;
+ }
+
+ /*
+ * We've found an option. Add the argument to the option list.
+ * Next, we have to see if we need to pull another argument to be
+ * used as the option argument.
+ */
+ ppzOpts[ optsIdx++ ] = pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+
+ if (OPTST_GET_ARGTYPE(os.pOD->fOptState) == OPARG_TYPE_NONE) {
+ /*
+ * No option argument. If we have a short option here,
+ * then scan for short options until we get to the end
+ * of the argument string.
+ */
+ if ( (os.optType == TOPT_SHORT)
+ && FAILED(checkShortOpts(pOpts, pzArg+2, &os, ppzOpts,
+ &optsIdx)) ) {
+ errno = EINVAL;
+ goto freeTemps;
+ }
+
+ } else if (os.pOD->fOptState & OPTST_ARG_OPTIONAL) {
+ switch (mayHandleArg(pOpts, pzArg+2, &os, ppzOpts, &optsIdx)) {
+ case FAILURE: errno = EIO; goto freeTemps;
+ case PROBLEM: errno = 0; goto joinLists;
+ }
+
+ } else {
+ switch (mustHandleArg(pOpts, pzArg+2, &os, ppzOpts, &optsIdx)) {
+ case PROBLEM:
+ case FAILURE: errno = EIO; goto freeTemps;
+ }
+ }
+ } /* for (;;) */
+
+ restOperands:
+ while (pOpts->curOptIdx < pOpts->origArgCt)
+ ppzOpds[ opdsIdx++ ] = pOpts->origArgVect[ (pOpts->curOptIdx)++ ];
+
+ joinLists:
+ if (optsIdx > 0)
+ memcpy(pOpts->origArgVect + 1, ppzOpts, optsIdx * sizeof(char*));
+ if (opdsIdx > 0)
+ memcpy(pOpts->origArgVect + 1 + optsIdx, ppzOpds,
+ opdsIdx * sizeof(char*));
+
+ freeTemps:
+ free(ppzOpts);
+ free(ppzOpds);
+ return;
+
+ exit_no_mem:
+ errno = ENOMEM;
+ return;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/sort.c */
diff --git a/autoopts/stack.c b/autoopts/stack.c
new file mode 100644
index 0000000..ecf52ab
--- /dev/null
+++ b/autoopts/stack.c
@@ -0,0 +1,269 @@
+
+/**
+ * \file stack.c
+ *
+ * Time-stamp: "2012-08-11 08:35:28 bkorb"
+ *
+ * This is a special option processing routine that will save the
+ * argument to an option in a FIFO queue.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+#ifdef WITH_LIBREGEX
+# include REGEX_HEADER
+#endif
+
+/*=export_func optionUnstackArg
+ * private:
+ *
+ * what: Remove option args from a stack
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ *
+ * doc:
+ * Invoked for options that are equivalenced to stacked options.
+=*/
+void
+optionUnstackArg(tOptions * pOpts, tOptDesc * pOptDesc)
+{
+ tArgList * pAL;
+
+ (void)pOpts;
+
+ if (pOpts <= OPTPROC_EMIT_LIMIT)
+ return;
+
+ if ((pOptDesc->fOptState & OPTST_RESET) != 0)
+ return;
+
+ pAL = (tArgList*)pOptDesc->optCookie;
+
+ /*
+ * IF we don't have any stacked options,
+ * THEN indicate that we don't have any of these options
+ */
+ if (pAL == NULL) {
+ pOptDesc->fOptState &= OPTST_PERSISTENT_MASK;
+ if ((pOptDesc->fOptState & OPTST_INITENABLED) == 0)
+ pOptDesc->fOptState |= OPTST_DISABLED;
+ return;
+ }
+
+#ifdef WITH_LIBREGEX
+ {
+ regex_t re;
+ int i, ct, dIdx;
+
+ if (regcomp(&re, pOptDesc->optArg.argString, REG_NOSUB) != 0)
+ return;
+
+ /*
+ * search the list for the entry(s) to remove. Entries that
+ * are removed are *not* copied into the result. The source
+ * index is incremented every time. The destination only when
+ * we are keeping a define.
+ */
+ for (i = 0, dIdx = 0, ct = pAL->useCt; --ct >= 0; i++) {
+ char const * pzSrc = pAL->apzArgs[ i ];
+ char * pzEq = strchr(pzSrc, '=');
+ int res;
+
+
+ if (pzEq != NULL)
+ *pzEq = NUL;
+
+ res = regexec(&re, pzSrc, (size_t)0, NULL, 0);
+ switch (res) {
+ case 0:
+ /*
+ * Remove this entry by reducing the in-use count
+ * and *not* putting the string pointer back into
+ * the list.
+ */
+ AGFREE(pzSrc);
+ pAL->useCt--;
+ break;
+
+ default:
+ case REG_NOMATCH:
+ if (pzEq != NULL)
+ *pzEq = '=';
+
+ /*
+ * IF we have dropped an entry
+ * THEN we have to move the current one.
+ */
+ if (dIdx != i)
+ pAL->apzArgs[ dIdx ] = pzSrc;
+ dIdx++;
+ }
+ }
+
+ regfree(&re);
+ }
+#else /* not WITH_LIBREGEX */
+ {
+ int i, ct, dIdx;
+
+ /*
+ * search the list for the entry(s) to remove. Entries that
+ * are removed are *not* copied into the result. The source
+ * index is incremented every time. The destination only when
+ * we are keeping a define.
+ */
+ for (i = 0, dIdx = 0, ct = pAL->useCt; --ct >= 0; i++) {
+ tCC* pzSrc = pAL->apzArgs[ i ];
+ char* pzEq = strchr(pzSrc, '=');
+
+ if (pzEq != NULL)
+ *pzEq = NUL;
+
+ if (strcmp(pzSrc, pOptDesc->optArg.argString) == 0) {
+ /*
+ * Remove this entry by reducing the in-use count
+ * and *not* putting the string pointer back into
+ * the list.
+ */
+ AGFREE(pzSrc);
+ pAL->useCt--;
+ } else {
+ if (pzEq != NULL)
+ *pzEq = '=';
+
+ /*
+ * IF we have dropped an entry
+ * THEN we have to move the current one.
+ */
+ if (dIdx != i)
+ pAL->apzArgs[ dIdx ] = pzSrc;
+ dIdx++;
+ }
+ }
+ }
+#endif /* WITH_LIBREGEX */
+ /*
+ * IF we have unstacked everything,
+ * THEN indicate that we don't have any of these options
+ */
+ if (pAL->useCt == 0) {
+ pOptDesc->fOptState &= OPTST_PERSISTENT_MASK;
+ if ((pOptDesc->fOptState & OPTST_INITENABLED) == 0)
+ pOptDesc->fOptState |= OPTST_DISABLED;
+ AGFREE((void*)pAL);
+ pOptDesc->optCookie = NULL;
+ }
+}
+
+
+/*
+ * Put an entry into an argument list. The first argument points to
+ * a pointer to the argument list structure. It gets passed around
+ * as an opaque address.
+ */
+LOCAL void
+addArgListEntry(void** ppAL, void* entry)
+{
+ tArgList* pAL = *(void**)ppAL;
+
+ /*
+ * IF we have never allocated one of these,
+ * THEN allocate one now
+ */
+ if (pAL == NULL) {
+ pAL = (tArgList*)AGALOC(sizeof(*pAL), "new option arg stack");
+ if (pAL == NULL)
+ return;
+ pAL->useCt = 0;
+ pAL->allocCt = MIN_ARG_ALLOC_CT;
+ *ppAL = (void*)pAL;
+ }
+
+ /*
+ * ELSE if we are out of room
+ * THEN make it bigger
+ */
+ else if (pAL->useCt >= pAL->allocCt) {
+ size_t sz = sizeof(*pAL);
+ pAL->allocCt += INCR_ARG_ALLOC_CT;
+
+ /*
+ * The base structure contains space for MIN_ARG_ALLOC_CT
+ * pointers. We subtract it off to find our augment size.
+ */
+ sz += sizeof(char*) * (pAL->allocCt - MIN_ARG_ALLOC_CT);
+ pAL = (tArgList*)AGREALOC((void*)pAL, sz, "expanded opt arg stack");
+ if (pAL == NULL)
+ return;
+ *ppAL = (void*)pAL;
+ }
+
+ /*
+ * Insert the new argument into the list
+ */
+ pAL->apzArgs[ (pAL->useCt)++ ] = entry;
+}
+
+
+/*=export_func optionStackArg
+ * private:
+ *
+ * what: put option args on a stack
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ *
+ * doc:
+ * Keep an entry-ordered list of option arguments.
+=*/
+void
+optionStackArg(tOptions * pOpts, tOptDesc * pOD)
+{
+ char * pz;
+
+ if (pOpts <= OPTPROC_EMIT_LIMIT)
+ return;
+
+ if ((pOD->fOptState & OPTST_RESET) != 0) {
+ tArgList* pAL = (void*)pOD->optCookie;
+ int ix;
+ if (pAL == NULL)
+ return;
+
+ ix = pAL->useCt;
+ while (--ix >= 0)
+ AGFREE(pAL->apzArgs[ix]);
+ AGFREE(pAL);
+
+ } else {
+ if (pOD->optArg.argString == NULL)
+ return;
+
+ AGDUPSTR(pz, pOD->optArg.argString, "stack arg");
+ addArgListEntry(&(pOD->optCookie), (void*)pz);
+ }
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/stack.c */
diff --git a/autoopts/strequate.3 b/autoopts/strequate.3
new file mode 100644
index 0000000..fee20a1
--- /dev/null
+++ b/autoopts/strequate.3
@@ -0,0 +1,32 @@
+.TH strequate 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (strequate.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+strequate - map a list of characters to the same value
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+void \fBstrequate\fP(char const* \fIch_list\fP);
+.sp 1
+.SH DESCRIPTION
+Each character in the input string get mapped to the first character
+in the string.
+This function name is mapped to option_strequate so as to not conflict
+with the POSIX name space.
+.TP
+.IR ch_list
+characters to equivalence
+.sp 1
+.SH ERRORS
+none.
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), streqvcmp(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/streqvcmp.3 b/autoopts/streqvcmp.3
new file mode 100644
index 0000000..5e8077f
--- /dev/null
+++ b/autoopts/streqvcmp.3
@@ -0,0 +1,39 @@
+.TH streqvcmp 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (streqvcmp.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+streqvcmp - compare two strings with an equivalence mapping
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+int \fBstreqvcmp\fP(char const* \fIstr1\fP, char const* \fIstr2\fP);
+.sp 1
+.SH DESCRIPTION
+Using a character mapping, two strings are compared for "equivalence".
+Each input character is mapped to a comparison character and the
+mapped-to characters are compared for the two NUL terminated input strings.
+This function name is mapped to option_streqvcmp so as to not conflict
+with the POSIX name space.
+.TP
+.IR str1
+first string
+.TP
+.IR str2
+second string
+.sp 1
+.SH RETURN VALUE
+the difference between two differing characters
+.sp 1
+.SH ERRORS
+none checked. Caller responsible for seg faults.
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvmap(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/streqvcmp.c b/autoopts/streqvcmp.c
new file mode 100644
index 0000000..54a063a
--- /dev/null
+++ b/autoopts/streqvcmp.c
@@ -0,0 +1,267 @@
+
+/**
+ * \file streqvcmp.c
+ *
+ * Time-stamp: "2012-03-31 13:17:39 bkorb"
+ *
+ * String Equivalence Comparison
+ *
+ * These routines allow any character to be mapped to any other
+ * character before comparison. In processing long option names,
+ * the characters "-", "_" and "^" all need to be equivalent
+ * (because they are treated so by different development environments).
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ *
+ * This array is designed for mapping upper and lower case letter
+ * together for a case independent comparison. The mappings are
+ * based upon ascii character sequences.
+ */
+static unsigned char charmap[] = {
+ NUL, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, '\a',
+ '\b', '\t', NL, '\v', '\f', '\r', 0x0E, 0x0F,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+ 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
+
+ ' ', '!', '"', '#', '$', '%', '&', '\'',
+ '(', ')', '*', '+', ',', '-', '.', '/',
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', ':', ';', '<', '=', '>', '?',
+
+ '@', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+ 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
+ 'x', 'y', 'z', '[', '\\', ']', '^', '_',
+ '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+ 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
+ 'x', 'y', 'z', '{', '|', '}', '~', 0x7f,
+
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
+ 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
+ 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
+ 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7,
+ 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
+
+ 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
+ 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
+ 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
+ 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
+};
+
+
+/*=export_func strneqvcmp
+ *
+ * what: compare two strings with an equivalence mapping
+ *
+ * arg: + char const* + str1 + first string +
+ * arg: + char const* + str2 + second string +
+ * arg: + int + ct + compare length +
+ *
+ * ret_type: int
+ * ret_desc: the difference between two differing characters
+ *
+ * doc:
+ *
+ * Using a character mapping, two strings are compared for "equivalence".
+ * Each input character is mapped to a comparison character and the
+ * mapped-to characters are compared for the two NUL terminated input strings.
+ * The comparison is limited to @code{ct} bytes.
+ * This function name is mapped to option_strneqvcmp so as to not conflict
+ * with the POSIX name space.
+ *
+ * err: none checked. Caller responsible for seg faults.
+=*/
+int
+strneqvcmp(tCC* s1, tCC* s2, int ct)
+{
+ for (; ct > 0; --ct) {
+ unsigned char u1 = (unsigned char) *s1++;
+ unsigned char u2 = (unsigned char) *s2++;
+ int dif = charmap[ u1 ] - charmap[ u2 ];
+
+ if (dif != 0)
+ return dif;
+
+ if (u1 == NUL)
+ return 0;
+ }
+
+ return 0;
+}
+
+
+/*=export_func streqvcmp
+ *
+ * what: compare two strings with an equivalence mapping
+ *
+ * arg: + char const* + str1 + first string +
+ * arg: + char const* + str2 + second string +
+ *
+ * ret_type: int
+ * ret_desc: the difference between two differing characters
+ *
+ * doc:
+ *
+ * Using a character mapping, two strings are compared for "equivalence".
+ * Each input character is mapped to a comparison character and the
+ * mapped-to characters are compared for the two NUL terminated input strings.
+ * This function name is mapped to option_streqvcmp so as to not conflict
+ * with the POSIX name space.
+ *
+ * err: none checked. Caller responsible for seg faults.
+=*/
+int
+streqvcmp(tCC* s1, tCC* s2)
+{
+ for (;;) {
+ unsigned char u1 = (unsigned char) *s1++;
+ unsigned char u2 = (unsigned char) *s2++;
+ int dif = charmap[ u1 ] - charmap[ u2 ];
+
+ if (dif != 0)
+ return dif;
+
+ if (u1 == NUL)
+ return 0;
+ }
+}
+
+
+/*=export_func streqvmap
+ *
+ * what: Set the character mappings for the streqv functions
+ *
+ * arg: + char + From + Input character +
+ * arg: + char + To + Mapped-to character +
+ * arg: + int + ct + compare length +
+ *
+ * doc:
+ *
+ * Set the character mapping. If the count (@code{ct}) is set to zero, then
+ * the map is cleared by setting all entries in the map to their index
+ * value. Otherwise, the "@code{From}" character is mapped to the "@code{To}"
+ * character. If @code{ct} is greater than 1, then @code{From} and @code{To}
+ * are incremented and the process repeated until @code{ct} entries have been
+ * set. For example,
+ * @example
+ * streqvmap('a', 'A', 26);
+ * @end example
+ * @noindent
+ * will alter the mapping so that all English lower case letters
+ * will map to upper case.
+ *
+ * This function name is mapped to option_streqvmap so as to not conflict
+ * with the POSIX name space.
+ *
+ * err: none.
+=*/
+void
+streqvmap(char From, char To, int ct)
+{
+ if (ct == 0) {
+ ct = sizeof(charmap) - 1;
+ do {
+ charmap[ct] = (unsigned char)ct;
+ } while (--ct >= 0);
+ }
+
+ else {
+ unsigned int chTo = (int)To & 0xFF;
+ unsigned int chFrom = (int)From & 0xFF;
+
+ do {
+ charmap[chFrom] = (unsigned char)chTo;
+ chFrom++;
+ chTo++;
+ if ((chFrom >= sizeof(charmap)) || (chTo >= sizeof(charmap)))
+ break;
+ } while (--ct > 0);
+ }
+}
+
+
+/*=export_func strequate
+ *
+ * what: map a list of characters to the same value
+ *
+ * arg: + char const* + ch_list + characters to equivalence +
+ *
+ * doc:
+ *
+ * Each character in the input string get mapped to the first character
+ * in the string.
+ * This function name is mapped to option_strequate so as to not conflict
+ * with the POSIX name space.
+ *
+ * err: none.
+=*/
+void
+strequate(char const* s)
+{
+ if ((s != NULL) && (*s != NUL)) {
+ unsigned char equiv = (unsigned)*s;
+ while (*s != NUL)
+ charmap[ (unsigned)*(s++) ] = equiv;
+ }
+}
+
+
+/*=export_func strtransform
+ *
+ * what: convert a string into its mapped-to value
+ *
+ * arg: + char* + dest + output string +
+ * arg: + char const* + src + input string +
+ *
+ * doc:
+ *
+ * Each character in the input string is mapped and the mapped-to
+ * character is put into the output.
+ * This function name is mapped to option_strtransform so as to not conflict
+ * with the POSIX name space.
+ *
+ * The source and destination may be the same.
+ *
+ * err: none.
+=*/
+void
+strtransform(char* d, char const* s)
+{
+ do {
+ *(d++) = (char)charmap[ (unsigned)*s ];
+ } while (*(s++) != NUL);
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/streqvcmp.c */
diff --git a/autoopts/streqvmap.3 b/autoopts/streqvmap.3
new file mode 100644
index 0000000..a4c3518
--- /dev/null
+++ b/autoopts/streqvmap.3
@@ -0,0 +1,48 @@
+.TH streqvmap 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (streqvmap.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+streqvmap - Set the character mappings for the streqv functions
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+void \fBstreqvmap\fP(char \fIFrom\fP, char \fITo\fP, int \fIct\fP);
+.sp 1
+.SH DESCRIPTION
+Set the character mapping. If the count (\fBct\fP) is set to zero, then
+the map is cleared by setting all entries in the map to their index
+value. Otherwise, the "\fBFrom\fP" character is mapped to the "\fBTo\fP"
+character. If \fBct\fP is greater than 1, then \fBFrom\fP and \fBTo\fP
+are incremented and the process repeated until \fBct\fP entries have been
+set. For example,
+.nf
+ streqvmap('a', 'A', 26);
+.fi
+will alter the mapping so that all English lower case letters
+will map to upper case.
+
+This function name is mapped to option_streqvmap so as to not conflict
+with the POSIX name space.
+.TP
+.IR From
+Input character
+.TP
+.IR To
+Mapped-to character
+.TP
+.IR ct
+compare length
+.sp 1
+.SH ERRORS
+none.
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), strneqvcmp(3), strtransform(3),
diff --git a/autoopts/strneqvcmp.3 b/autoopts/strneqvcmp.3
new file mode 100644
index 0000000..9433439
--- /dev/null
+++ b/autoopts/strneqvcmp.3
@@ -0,0 +1,43 @@
+.TH strneqvcmp 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (strneqvcmp.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+strneqvcmp - compare two strings with an equivalence mapping
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+int \fBstrneqvcmp\fP(char const* \fIstr1\fP, char const* \fIstr2\fP, int \fIct\fP);
+.sp 1
+.SH DESCRIPTION
+Using a character mapping, two strings are compared for "equivalence".
+Each input character is mapped to a comparison character and the
+mapped-to characters are compared for the two NUL terminated input strings.
+The comparison is limited to \fBct\fP bytes.
+This function name is mapped to option_strneqvcmp so as to not conflict
+with the POSIX name space.
+.TP
+.IR str1
+first string
+.TP
+.IR str2
+second string
+.TP
+.IR ct
+compare length
+.sp 1
+.SH RETURN VALUE
+the difference between two differing characters
+.sp 1
+.SH ERRORS
+none checked. Caller responsible for seg faults.
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strtransform(3),
diff --git a/autoopts/strtransform.3 b/autoopts/strtransform.3
new file mode 100644
index 0000000..6a89b1b
--- /dev/null
+++ b/autoopts/strtransform.3
@@ -0,0 +1,37 @@
+.TH strtransform 3 2012-08-11 "" "Programmer's Manual"
+.\" DO NOT EDIT THIS FILE (strtransform.3)
+.\"
+.\" It has been AutoGen-ed August 11, 2012 at 09:44:56 AM by AutoGen 5.16.2
+.\" From the definitions ./funcs.def
+.\" and the template file agman3.tpl
+.SH NAME
+strtransform - convert a string into its mapped-to value
+.sp 1
+.SH SYNOPSIS
+
+#include <\fIyour-opts.h\fP>
+.br
+cc [...] -o outfile infile.c -l\fBopts\fP [...]
+.sp 1
+void \fBstrtransform\fP(char* \fIdest\fP, char const* \fIsrc\fP);
+.sp 1
+.SH DESCRIPTION
+Each character in the input string is mapped and the mapped-to
+character is put into the output.
+This function name is mapped to option_strtransform so as to not conflict
+with the POSIX name space.
+
+The source and destination may be the same.
+.TP
+.IR dest
+output string
+.TP
+.IR src
+input string
+.sp 1
+.SH ERRORS
+none.
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fIopts\fP library.
+.br
+ao_string_tokenize(3), configFileLoad(3), optionFileLoad(3), optionFindNextValue(3), optionFindValue(3), optionFree(3), optionGetValue(3), optionLoadLine(3), optionNextValue(3), optionOnlyUsage(3), optionProcess(3), optionRestore(3), optionSaveFile(3), optionSaveState(3), optionUnloadNested(3), optionVersion(3), pathfind(3), strequate(3), streqvcmp(3), streqvmap(3), strneqvcmp(3),
diff --git a/autoopts/test/Makefile.am b/autoopts/test/Makefile.am
new file mode 100644
index 0000000..ce8ea2d
--- /dev/null
+++ b/autoopts/test/Makefile.am
@@ -0,0 +1,53 @@
+## -*- Mode: Makefile -*-
+##
+## Makefile.am
+##
+## Time-stamp: "2012-05-13 16:02:42 bkorb"
+## Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+
+EXTRA_DIST = defs.in stdopts.def $(TESTS)
+TESTS = \
+ alias.test argument.test cfg-edit.test cond.test \
+ config.test doc.test enums.test equiv.test \
+ errors.test getopt.test handler.test immediate.test \
+ keyword.test library.test main.test nested.test \
+ nls.test rc.test shell.test stdopts.test \
+ time.test usage.test vendor.test vers.test
+
+testsubdir = ./testdir
+
+TESTS_ENVIRONMENT = TERM='' top_builddir="$(top_builddir)"
+
+distclean-local:
+ -rm -rf $(testsubdir) FAILURES
+
+check : perm-stamp
+
+perm-stamp :
+ @-cd $(srcdir) ; chmod +x *.test 2>/dev/null
+
+verbose :
+ rm -rf FAILURES testdir ; VERBOSE=true ; export VERBOSE ; \
+ $(MAKE) check TESTS="$(TESTS)"
+
+# Makefile.am ends here
diff --git a/autoopts/test/Makefile.in b/autoopts/test/Makefile.in
new file mode 100644
index 0000000..a5a0d5b
--- /dev/null
+++ b/autoopts/test/Makefile.in
@@ -0,0 +1,560 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = autoopts/test
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/defs.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = defs
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = @AGexe@
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = @CLexe@
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = defs.in stdopts.def $(TESTS)
+TESTS = \
+ alias.test argument.test cfg-edit.test cond.test \
+ config.test doc.test enums.test equiv.test \
+ errors.test getopt.test handler.test immediate.test \
+ keyword.test library.test main.test nested.test \
+ nls.test rc.test shell.test stdopts.test \
+ time.test usage.test vendor.test vers.test
+
+testsubdir = ./testdir
+TESTS_ENVIRONMENT = TERM='' top_builddir="$(top_builddir)"
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu autoopts/test/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu autoopts/test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+defs: $(top_builddir)/config.status $(srcdir)/defs.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ fi; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-local
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am check check-TESTS check-am clean clean-generic \
+ clean-libtool distclean distclean-generic distclean-libtool \
+ distclean-local distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am
+
+
+distclean-local:
+ -rm -rf $(testsubdir) FAILURES
+
+check : perm-stamp
+
+perm-stamp :
+ @-cd $(srcdir) ; chmod +x *.test 2>/dev/null
+
+verbose :
+ rm -rf FAILURES testdir ; VERBOSE=true ; export VERBOSE ; \
+ $(MAKE) check TESTS="$(TESTS)"
+
+# Makefile.am ends here
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/autoopts/test/alias.test b/autoopts/test/alias.test
new file mode 100755
index 0000000..1cde083
--- /dev/null
+++ b/autoopts/test/alias.test
@@ -0,0 +1,120 @@
+#! /bin/sh
+#
+# alias.test --- test option aliasing
+#
+# Time-stamp: "2012-05-12 19:56:13 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+
+. ./defs
+failure() { exit 1 ; }
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating ${testname}.def in `pwd`"
+testname="${testname}" test_main="YES" \
+argument="arg [...]" long_opts="YES" use_flags=true \
+${SHELLX} ${stdopts} option:'opt init' second=020 || \
+ failure "Could not run stdopts.def"
+: add defs
+cat >> ${testname}.def <<- \_EOF_
+
+ flag = {
+ name = a-opt;
+ value = a;
+ aliases = option;
+ };
+
+ flag = {
+ name = b-second;
+ value = b;
+ aliases = second;
+ };
+ _EOF_
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+compile "-?"
+
+# # # # # # # # # # FIRST TEST # # # # # # # # #
+
+echo creating ${testname}-1.help
+clean_help > ${testname}-1.help <<'_EOF_'
+test_alias - Test AutoOpts for alias
+USAGE: alias [ -<flag> [<val>] | --<name>[{=| }<val>] ]... arg [...]
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s Num second The second option descrip
+ -a Str a-opt This is an alias for 'option'
+ -b Num b-second This is an alias for 'second'
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+_EOF_
+
+cmp -s ${testname}-1.help ${testname}.help || \
+ failure "`diff ${testname}-1.help ${testname}.help`"
+
+./${testname} -o foo -a bar && \
+ failure "both -o and -a were accepted"
+
+./${testname} -a bar fumble > ${testname}.out
+cat > ${testname}.base <<- \_EOF_
+ OPTION_CT=2
+ export OPTION_CT
+ TEST_ALIAS_OPTION='bar'
+ export TEST_ALIAS_OPTION
+ _EOF_
+
+cmp -s ${testname}.out ${testname}.base || \
+ failure "`diff ${testname}.out ${testname}.base`"
+
+run_ag als -T agtexi-cmd.tpl ${testname}.def
+test -f invoke-test_${testname}.menu || \
+ failure "no menu entry output"
+rm -f invoke-test_${testname}.menu
+test -f invoke-test_${testname}.texi || \
+ failure "no texi output"
+mv -f invoke-test_${testname}.texi ${testname}.texi
+
+run_ag als -T agmdoc-cmd.tpl ${testname}.def
+test -f test_${testname}.1 || failure "no man page output"
+mv test_${testname}.1 ${testname}.1
+lnct=`
+ ${EGREP} '^This is an alias for the (option|second) option[,.]$' \
+ ${testname}.texi ${testname}.1 | \
+ wc -l`
+test $lnct -eq 4 || \
+ failure "bad documentation output"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of cond.test
diff --git a/autoopts/test/argument.test b/autoopts/test/argument.test
new file mode 100755
index 0000000..ee7fa0d
--- /dev/null
+++ b/autoopts/test/argument.test
@@ -0,0 +1,209 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# argument.test --- test argument program attribute
+# make sure that when it is not specified
+# then option processing consumes all args.
+#
+# Time-stamp: "2012-08-11 08:12:41 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating ${testname}.def in `pwd`"
+export testname test_main argument long_opts
+${SHELLX} ${stdopts} option:'opt init' second=020 || \
+ failure "Could not run stdopts.def"
+
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+compile "-?"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+basehlp=${testname}.hlp
+echo creating ${basehlp}
+clean_help > ${basehlp} <<'_EOF_'
+test_argument - Test AutoOpts for argument
+USAGE: argument [ -<flag> [<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s Num second The second option descrip
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+_EOF_
+
+cmp -s ${testname}.h*lp || \
+ failure "`diff ${basehlp} ${testname}.help`"
+
+./${testname} mumble 2> /dev/null && \
+ failure ${testname} should not accept non-options
+
+./${testname} -s mumble 2> /dev/null && \
+ failure ${testname} should not accept bad options
+
+./${testname} -o string -s 99 > /dev/null || \
+ failure ${testname} did not handle its options
+
+# # # # # # # # # # T E S T 2 # # # # # # # # # # #
+
+exec 3> ${testname}2.def
+${SED} '/arg-type = number/q' ${testname}.def >&3
+cat >&3 <<- _EOF_
+ arg-range = "-1";
+ arg-range = "3->021";
+ arg-range = "040->0x1FFF";
+ scaled;
+ flag-code[0] = ' /* no-op zero */;';
+ flag-code[1] = ' /* no-op one */;';
+ };
+ include = '#include <stdlib.h>';
+ _EOF_
+exec 3>&-
+
+${AG_L} ${testname}2.def || \
+ failure AutoGen could not process
+{
+ ${SED} '/^#if.*TEST MAIN PROCEDURE:/,/#endif.*defined TEST_/d
+ /^#/s/_ARGUMENT_/_ARGUMENT2_/' \
+ ${testname}2.c
+ cat <<EOF
+int main( int argc, char** argv ) {
+ optionProcess( &test_argumentOptions, argc, argv );
+ return 0; }
+EOF
+} > XX
+mv ${testname}2.c ${testname}2.c.save
+mv -f XX ${testname}2.c
+
+Csrc=${testname}2
+compile "-?"
+
+clean_help > ${testname}2.hlp <<'_EOF_'
+test_argument - Test AutoOpts for argument
+USAGE: argument2 [ -<flag> [<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s Num second The second option descrip
+ - is scalable with a suffix: k/K/m/M/g/G/t/T
+ - It must lie in one of the ranges:
+ -1 exactly, or
+ 3 to 17, or
+ 32 to 8191
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+_EOF_
+
+cmp -s ${testname}2.hlp ${testname}2.help || \
+ failure "`diff ${testname}2.hlp ${testname}2.help`"
+
+./${testname}2 -o string -s 037 > /dev/null && \
+ failure ${testname} handled wrong sized option
+
+./${testname}2 -o string -s 0x37 > /dev/null || \
+ failure ${testname} did not handle its options
+
+./${testname}2 -o string -s 8k > /dev/null || \
+ failure ${testname} could not handle 8k
+
+./${testname}2 -o string -s 8K > ${testname}2-bad.out 2>&1 && \
+ failure ${testname} did handle 8K
+
+${GREP} 'error:.* value .* is out of range\.$' ${testname}2-bad.out || \
+ failure "missing 'is out of range' message"
+
+# # # # # # # # # # T E S T 3 # # # # # # # # # # #
+
+exec 3> ${testname}3.def
+${SED} '/value = .s.;/q' ${testname}.def >&3
+cat >&3 <<- _EOF_
+ arg-type = file;
+ file-exists = yes;
+ open-file = fopen;
+ file-mode = "r";
+ };
+ _EOF_
+exec 3>&-
+
+${AG_L} ${testname}3.def || \
+ failure AutoGen could not process
+{
+ ${SED} '/^#if.*TEST MAIN PROCEDURE:/,/#endif.*defined TEST_/d
+ /^#/s/_ARGUMENT_/_ARGUMENT3_/' \
+ ${testname}3.c
+ cat <<EOF
+int main( int argc, char** argv ) {
+ optionProcess( &test_argumentOptions, argc, argv );
+ for (;;) { int ch = getc(OPT_VALUE_SECOND);
+ if (ch == EOF) break;
+ putc(ch, stdout); }
+ return fclose(OPT_VALUE_SECOND); }
+EOF
+} > XX
+mv ${testname}3.c ${testname}3.c.save
+mv -f XX ${testname}3.c
+
+Csrc=${testname}3
+compile "-?"
+
+clean_help > ${testname}3.hlp <<'_EOF_'
+test_argument - Test AutoOpts for argument
+USAGE: argument3 [ -<flag> [<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s Fil second The second option descrip
+ - file must pre-exist
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+_EOF_
+
+cmp -s ${testname}3.hlp ${testname}3.help || \
+ failure "`diff ${testname}3.hlp ${testname}3.help`"
+
+./${testname}3 -o string -s `pwd`/bogusfilename.c > /dev/null && \
+ failure ${testname} handled non-existent file
+
+./${testname}3 -o string -s `pwd`/${testname}3.hlp > ${testname}3-a.hlp || \
+ failure ${testname} could not handle existing file
+
+cmp -s ${testname}3.hlp ${testname}3-a.hlp || \
+ failure "`diff ${testname}3.hlp ${testname}3-a.hlp`"
+# # # # # # # # # # T E S T E N D # # # # # # # # # #
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of argument.test
diff --git a/autoopts/test/cfg-edit.test b/autoopts/test/cfg-edit.test
new file mode 100755
index 0000000..506ca10
--- /dev/null
+++ b/autoopts/test/cfg-edit.test
@@ -0,0 +1,330 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# rc.test --- test loading and saving of rc files
+#
+# Time-stamp: "2012-03-31 13:10:38 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+test_name=`echo ${testname} | ${SED} 's/-/_/g'`
+cfg_file=`basename ${TMPDIR}`/${testname}.cfg
+
+exec 5> ${testname}.def
+cat >&5 <<- _EOF_
+
+ AutoGen definitions options;
+
+ config-header = 'config.h';
+ prog-name = "test_${testname}";
+ prog-title = "Test AutoOpts for ${testname}";
+ homerc = ${cfg_file};
+ resettable;
+ argument = '[ <output-config-file> ]';
+
+ flag = {
+ name = struct;
+ value = s;
+ max = NOLIMIT;
+ descrip = 'structured argument val';
+ arg-type = nested;
+ };
+
+ flag = {
+ name = members;
+ value = m;
+ descrip = 'membership set';
+ keyword = one, two, three, four, five, six, seven, eight, nine, ten;
+ arg-default = five;
+ arg-type = set;
+ };
+
+ flag = {
+ name = enumerate;
+ value = e;
+ descrip = 'a test enumeration';
+ keyword = uno, dos, tres, quatro, cinco, seis, siete, ocho;
+ arg-default = cinco;
+ arg-type = keyword;
+ };
+
+ flag = {
+ name = stacking;
+ value = k;
+ descrip = 'stack up a list';
+ arg-default = initialized;
+ arg-type = string;
+ stack-arg; max = NOLIMIT;
+ };
+
+ flag = {
+ name = number;
+ value = n;
+ descrip = 'a range constrained int';
+ arg-default = 32;
+ arg-type = number;
+ arg-range = '->-1', '1->31', '33', '64->';
+ };
+
+ flag = {
+ name = boolean;
+ value = b;
+ descrip = 'a boolean value';
+ arg-default = true;
+ arg-type = boolean;
+ };
+
+ flag = {
+ name = in-file;
+ value = I;
+ descrip = 'an input file';
+ arg-type = file;
+ open-file = descriptor;
+ file-mode = O_RDONLY;
+ file-exists = yes;
+ };
+
+ flag = {
+ name = out-file;
+ value = O;
+ descrip = 'an output file';
+ arg-type = file;
+ open-file = fopen;
+ file-mode = w;
+ file-exists = no;
+ };
+
+ flag = {
+ name = test-file;
+ value = T;
+ descrip = 'a test file';
+ arg-type = file;
+ };
+
+ main = {
+ main-type = main;
+ _EOF_
+
+asl='<''<'
+cat >&5 <<- _EOF_
+ main-text = ${asl}- _EOCode_
+ {
+ tOptions * const pOpts = &test_${test_name}Options;
+ int svix = pOpts->specOptIdx.save_opts;
+ char const * pzFile = "${cfg_file}-default";
+
+ if (argc > 0)
+ pzFile = *argv;
+ if (svix == 0) exit(1);
+ SET_OPT_SAVE_OPTS(pzFile);
+ optionSaveFile(pOpts);
+ }
+ _EOF_
+
+echo "_EOCode_; };" >&5
+
+exec 5>&-
+
+# # # # # # # # # # CREATE PROGRAM # # # # # # # # #
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+compile "-?"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+basehelp=${testname}-base.help
+echo creating ${basehelp}
+clean_help > ${basehelp} <<_EOF_
+test_${testname} - Test AutoOpts for ${testname}
+USAGE: ${testname} [ -<flag> [<val>] ]... [ <output-config-file> ]
+ Flg Arg Option-Name Description
+ -s Cpx struct structured argument val
+ - may appear multiple times
+ -m Mbr members membership set
+ - is a set membership option
+ -e KWd enumerate a test enumeration
+ -k Str stacking stack up a list
+ - may appear multiple times
+ -n Num number a range constrained int
+ - It must lie in one of the ranges:
+ less than or equal to -1, or
+ 1 to 31, or
+ 33 exactly, or
+ greater than or equal to 64
+ -b T/F boolean a boolean value
+ -I Fil in-file an input file
+ - file must pre-exist
+ -O Fil out-file an output file
+ - file must not pre-exist
+ -T Fil test-file a test file
+ -R Str reset-option Reset an option's state
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+
+The following option preset mechanisms are supported:
+ - reading file ${testname}.cfg
+
+The valid "members" option keywords are:
+ one two three four five six seven eight nine ten
+ or an integer mask with any of the lower 10 bits set
+or you may use a numeric representation. Preceding these with a '!' will
+clear the bits, specifying 'none' will clear all bits, and 'all' will set them
+all. Multiple entries may be passed as an option argument list.
+The valid "enumerate" option keywords are:
+ uno dos tres quatro cinco seis siete ocho
+ or an integer from 0 through 7
+_EOF_
+
+${SED} "/ - reading file/s/ file .*/ file ${testname}.cfg/" \
+ ${testname}.help > X$$
+mv -f X$$ ${testname}.help
+cmp -s ${basehelp} ${testname}.help || \
+ failure "`diff ${basehelp} ${testname}.help`"
+
+./${testname} -m 'one + three + seven' '->'
+members=`${SED} -n 's/^members *//p' ${cfg_file}`
+case "${members}" in
+'none + one + three + five + seven' ) : ;;
+* ) failure "members not set to one, three, five and seven" ;;
+esac
+
+./${testname} -R '*' '->'
+members=`${SED} -n 's/^members *//p' ${cfg_file}` 2>/dev/null
+case "${members}" in
+'' ) : ;;
+* ) failure "members entry not removed"
+esac
+
+arg1="stumble, <foo>foo${ht}lish</foo>, <bar type=integer>1234</bar>, able"
+arg2='foo, <bar type=integer>4321</bar> <gr type=nested>one, two=2, three</gr>'
+dir=`echo ${TMPDIR} | ${SED} "s@^\`pwd\`//*@@"`
+out_file=${dir}/${testname}-out-file
+rm -f ${out_file}
+./${testname} -m 'one + three' -b true -m 'seven' \
+ -s "${arg1}" -n -200 -s "${arg2}" -e ocho \
+ -I ${srcdir}/${testname}.test \
+ -O ${out_file} \
+ -T ${dir}/${testname}-test-file \
+ '->'
+${SED} '/^#/d' ${cfg_file} > ${testname}-X
+mv -f ${testname}-X ${cfg_file}
+cat > ${testname}.sample-cfg <<- \_EOF_
+ <struct type=nested>
+ <able/>
+ <bar type=integer>0x4D2</bar>
+ <foo>foo&#x09;lish</foo>
+ <stumble/>
+ </struct>
+ <struct type=nested>
+ <bar type=integer>0x10E1</bar>
+ <foo/>
+ <gr type=nested>
+ <one/>
+ <three/>
+ <two>2</two>
+ </gr>
+ </struct>
+ members none + one + three + five + seven
+ enumerate ocho
+ number -200
+ boolean true
+ _EOF_
+
+cat >> ${testname}.sample-cfg <<- _EOF_
+ in-file ${srcdir}/${testname}.test
+ out-file ${out_file}
+ test-file ${dir}/${testname}-test-file
+ _EOF_
+pair=${testname}.sample-cfg\ ${cfg_file}
+cmp ${pair} || \
+ failure "improperly saved state:${nl}`diff ${pair}`"
+
+rm -f ${out_file}
+./${testname} ${cfg_file}-2
+${SED} '/^#/d' ${cfg_file}-2 > ${testname}-X
+mv -f ${testname}-X ${cfg_file}-2
+cmp ${cfg_file} ${cfg_file}-2 || \
+ failure "mismatched: re-saved config${nl}`diff ${cfg_file} ${cfg_file}-2`"
+
+rm -f ${cfg_file}-2
+rm -f ${out_file}
+./${testname} -R struct ${cfg_file}-2
+test "X`egrep -v '^#' ${cfg_file}-2`" = "X`egrep '^[a-z]' ${cfg_file}`" || \
+ failure "structure not erased${nl}`cat ${cfg_file}-2`"
+
+opt_ct=7
+mv -f ${cfg_file}-2 ${cfg_file}
+ct=`egrep '^[a-z]' ${cfg_file} | wc -l`
+test ${ct} -eq ${opt_ct} || failure "wrong line count${nl}`cat ${cfg_file}`"
+
+rm -f ${out_file}
+
+remove_opt() {
+ opt_ct=`expr $opt_ct - 1`
+ ./${testname} -R ${1} '->'
+ ct=`egrep '^[a-z]' ${cfg_file} | wc -l`
+ test ${ct} -eq ${opt_ct} || \
+ failure "${1} is still there${nl}`cat ${cfg_file}`"
+}
+
+for f in out-file in-file test-file boolean members enumerate number
+do
+ remove_opt $f
+done
+
+./${testname} -k alpha -k beta -k omega ${cfg_file}-XX
+${SED} '/^#/d' ${cfg_file}-XX > ${cfg_file}-2
+cat > ${cfg_file}-3 <<- _EOF_
+ stacking alpha
+ stacking beta
+ stacking omega
+ _EOF_
+cmp ${cfg_file}-[23] || \
+ failure "missing stacking args:${nl}`diff -c ${cfg_file}-[23]`"
+./${testname} -R k ${cfg_file}-2
+ct=`egrep '^[a-z]' ${cfg_file}-2 | wc -l`
+test ${ct} -eq 0 || failure "arg values still stacked"
+
+# # # # # # # # # # TEST OPERATION # # # # # # # # # #
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of cfg-edit.test
diff --git a/autoopts/test/cond.test b/autoopts/test/cond.test
new file mode 100755
index 0000000..8767eda
--- /dev/null
+++ b/autoopts/test/cond.test
@@ -0,0 +1,194 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# cond.test --- test conditionally compiled option
+#
+# Time-stamp: "2012-03-31 13:09:15 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating ${testname}.def in `pwd`"
+testname="${testname}" test_main="${test_main}" \
+argument="${argument}" long_opts="${long_opts}" \
+${SHELLX} ${stdopts} option:'opt init' second=020 || \
+ failure "Could not run stdopts.def"
+cat >> ${testname}.def <<EOF
+flag = {
+ name = condition;
+ value = c;
+ ifdef = COND;
+ descrip = "cond test";
+ arg-type = number;
+ doc = mumble;
+};
+
+flag = {
+ name = interfere;
+ value = I;
+ descrip = "cond interference test";
+ arg-type = number;
+ doc = stumble;
+};
+EOF
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+# # # # # # # # # # FIRST TEST # # # # # # # # #
+
+compile "-?"
+mv ${testname} ${testname}-1
+echo creating ${testname}-1.help
+clean_help > ${testname}-1.help <<'_EOF_'
+test_cond - Test AutoOpts for cond
+USAGE: cond [ -<flag> [<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s Num second The second option descrip
+ -I Num interfere cond interference test
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+_EOF_
+
+cmp -s ${testname}-1.help ${testname}.help || \
+ failure "TEST 1 FAILED${nl}`diff ${testname}-1.help ${testname}.help`"
+
+./${testname}-1 -c 123 2>/dev/null && \
+ failure "*DID* process -c option"
+
+# # # # # # # # # # SECOND TEST # # # # # # # # #
+
+INC="${INC} -DCOND=1"
+compile "-?"
+mv ${testname} ${testname}-2
+clean_help > ${testname}-2.help <<'_EOF_'
+test_cond - Test AutoOpts for cond
+USAGE: cond [ -<flag> [<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s Num second The second option descrip
+ -c Num condition cond test
+ -I Num interfere cond interference test
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+_EOF_
+
+cmp -s ${testname}-2.help ${testname}.help || \
+ failure "TEST 2 FAILED${nl}`diff ${testname}-2.help ${testname}.help`"
+
+# # # # # # # # # # THIRD TEST # # # # # # # # #
+
+echo guard-option-names\; >> ${testname}.def
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || failure AutoGen could not process
+
+( cc_cmd=`echo ${cc_cmd} | \
+ ${SED} "s/-DTEST_TEST/-DSECOND -DTEST_TEST/" `
+ eval "$cc_cmd" 2>&1 ) \
+ | ${SED} -n '/undefining SECOND due to option name conflict/p' \
+ > ${testname}-cc.log
+
+test -s ${testname}-cc.log || \
+ failure "warning diffs: 'undefining SECOND' not found"
+
+# # # # # # # # # # FOURTH TEST # # # # # # # # #
+
+${SED} '/value = c/s/$/ deprecated;/' ${testname}.def > ${testname}.def4
+
+echo ${AG_L} ${testname}.def4
+${AG_L} ${testname}.def4 || \
+ failure AutoGen could not process ${testname}.def4
+
+compile "-?"
+mv ${testname} ${testname}-4
+cmp -s ${testname}-1.help ${testname}.help || \
+ failure "TEST 4 FAILED${nl}`diff ${testname}-1.help ${testname}.help`"
+
+./${testname}-4 -c 123 || \
+ failure "could not process -c option"
+
+# # # # # # # # # # FIFTH TEST # # # # # # # # #
+
+${SED} '/deprecated/s/deprecated.*/arg-range = "0->1000";/' \
+ ${testname}.def4 > ${testname}.def5
+
+echo ${AG_L} ${testname}.def5
+${AG_L} ${testname}.def5 || \
+ failure AutoGen could not process ${testname}.def5
+
+compile "-?"
+mv ${testname} ${testname}-5
+clean_help > ${testname}-5.help <<'_EOF_'
+test_cond - Test AutoOpts for cond
+USAGE: cond [ -<flag> [<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s Num second The second option descrip
+ -c Num condition cond test
+ - It must be in the range:
+ 0 to 1000
+ -I Num interfere cond interference test
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+_EOF_
+
+cmp -s ${testname}-5.help ${testname}.help || \
+ failure "TEST 5 FAILED${nl}`diff -u ${testname}-5.help ${testname}.help`"
+
+# # # # # # # # # # SIXTH TEST # # # # # # # # #
+
+INC=`echo ${INC} | sed 's/ -DCOND=1//'`
+compile "-?"
+mv ${testname} ${testname}-6
+clean_help > ${testname}-6.help <<'_EOF_'
+test_cond - Test AutoOpts for cond
+USAGE: cond [ -<flag> [<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s Num second The second option descrip
+ -I Num interfere cond interference test
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+_EOF_
+
+cmp -s ${testname}-6.help ${testname}.help || \
+ failure "TEST 6 FAILED${nl}`diff -u ${testname}-6.help ${testname}.help`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of cond.test
diff --git a/autoopts/test/config.test b/autoopts/test/config.test
new file mode 100755
index 0000000..d8b6280
--- /dev/null
+++ b/autoopts/test/config.test
@@ -0,0 +1,201 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# rc.test --- test loading and saving of rc files
+#
+# Time-stamp: "2011-02-02 12:10:27 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+. ./defs
+
+# # # # # # # # # # PROGRAM FILE # # # # # # # # #
+
+cat > ${testname}.c <<- _EOTest_
+ #include <stdio.h>
+ #include "config.h"
+ #include <autoopts/options.h>
+
+ int print_entry( const tOptionValue* pGV );
+ int print_entry( const tOptionValue* pGV ) {
+ if (pGV == NULL) {
+ fprintf( stderr, "ENTRY NOT FOUND\n" );
+ return 1;
+ }
+ printf( "%-8s -- ", pGV->pzName );
+ switch (pGV->valType) {
+ case OPARG_TYPE_NONE:
+ fputs( "no value\n", stdout ); break;
+
+ case OPARG_TYPE_STRING:
+ printf( "string: %s\n", pGV->v.strVal ); break;
+
+ case OPARG_TYPE_ENUMERATION:
+ printf( "enum: %d\n", pGV->v.enumVal ); break;
+
+ case OPARG_TYPE_BOOLEAN:
+ printf( "bool: %s\n",
+ pGV->v.boolVal ? "TRUE" : "false" ); break;
+
+ case OPARG_TYPE_MEMBERSHIP:
+ printf( "members: 0x%08lX\n", (unsigned long)pGV->v.setVal ); break;
+
+ case OPARG_TYPE_NUMERIC:
+ printf( "integer: %ld\n", pGV->v.longVal ); break;
+
+ case OPARG_TYPE_HIERARCHY:
+ printf( "nested: 0x%08lX\n", (unsigned long)pGV->v.nestVal ); break;
+
+ default:
+ printf( "bad type: %d\n", pGV->valType );
+ return 1;
+ }
+ return 0;
+ }
+
+ int main( int argc, char** argv ) {
+ int res = 0;
+ const tOptionValue* pOV;
+ if ((argc < 3) || (argv[1][0] == '-')) {
+ fputs( "help\n", stdout );
+ return 0;
+ }
+ pOV = configFileLoad( *++argv );
+ if (pOV == NULL) {
+ fprintf( stderr, "Could not load: %s\n", *argv );
+ return 1;
+ }
+ argc -= 2;
+ while (argc-- > 0) {
+ const tOptionValue* pGV = optionGetValue( pOV, *++argv );
+ res |= print_entry( pGV );
+ }
+
+ {
+ const tOptionValue* pGV = optionGetValue( pOV, "n4_ty" );
+ pGV = optionGetValue( pGV, "b4r" );
+ if (pGV->valType != OPARG_TYPE_BOOLEAN) {
+ res = 1;
+ } else if (pGV->v.boolVal) {
+ fputs( "YES!!\n", stdout );
+ } else {
+ fputs( "oops!!\n", stdout );
+ res = 1;
+ }
+ }
+
+ {
+ const tOptionValue* pGV = optionGetValue( pOV, NULL );
+ while (pGV != NULL) {
+ res |= print_entry( pGV );
+ pGV = optionNextValue( pOV, pGV );
+ }
+ }
+
+ print_entry( pOV );
+ optionUnloadNested( pOV );
+ return res;
+ }
+ _EOTest_
+
+compile --help
+
+# # # # # # # # # # RUN TESTS # # # # # # # # #
+
+echo Constructing test ${testname} files
+cat > ${testname}.cfg <<- \_EOConfig_
+ mumble = grumble
+ grumble : rumble
+
+ stumble "The\tquick\
+ brown fox\tjumped\n\
+ over everything."
+
+ stumble2 The\
+ quick\
+ brown\
+ \
+ fix.
+
+ <n4_ty type=nested>
+ foo : foolish
+ <b4r type=bool> YES!! </b4r>
+ </n4_ty>
+ alpha, beta ', gamma'
+ <beta cooked> "Carol\tTine\n"
+ </beta>
+ <zzyzx type=integer> 42 </zzyzx>
+ _EOConfig_
+
+cat > ${testname}.res <<- \_EOResult_
+ mumble -- string: grumble
+ grumble -- string: rumble
+ stumble -- string: The quickbrown fox jumped
+ over everything.
+ alpha -- no value
+ beta -- string: , gamma
+ zzyzx -- integer: 42
+ YES!!
+ alpha -- no value
+ beta -- string: , gamma
+ beta -- string: Carol Tine
+
+ grumble -- string: rumble
+ mumble -- string: grumble
+ n4_ty -- nested: 0xXXXXXXXX
+ stumble -- string: The quickbrown fox jumped
+ over everything.
+ stumble2 -- string: The
+ quick
+ brown
+
+ fix.
+ zzyzx -- integer: 42
+ ./config.cfg -- nested: 0xXXXXXXXX
+ _EOResult_
+
+./${testname} ./${testname}.cfg mumble grumble stumble alpha beta zzyzx \
+ > ${testname}.tmp-out || {
+ failure "Cannot run ${testname}"
+}
+
+${SED} '/ -- nested:/s/0x.*/0xXXXXXXXX/' \
+ ${testname}.tmp-out > ${testname}.out
+cmp ${testname}.out ${testname}.res || {
+ failure "`diff -c ${testname}.out ${testname}.res`"
+}
+
+./${testname} ${testname}.cfg gamma >/dev/null && \
+ failure "found non-existent value"
+
+# # # # # # # # # # CLEANUP # # # # # # # # #
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of config.test
diff --git a/autoopts/test/defs.in b/autoopts/test/defs.in
new file mode 100644
index 0000000..d7669ab
--- /dev/null
+++ b/autoopts/test/defs.in
@@ -0,0 +1,351 @@
+#! /bin/echo this_file_should_be_sourced,_not_executed
+# -*- Mode: Shell-script -*-
+#
+# defs --- define the environment for autogen tests.
+#
+# Time-stamp: "2012-05-13 16:02:07 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+#
+# C O N F I G U R E D V A L U E S
+#
+# Make sure srcdir is an absolute path. Supply the variable
+# if it does not exist. We want to be able to run the tests
+# stand-alone!!
+#
+cfg_vals()
+{
+ case `uname -s` in
+ SunOS )
+ if test "X$BASH_VERSION" = X
+ then
+ # On Solaris, make certain we do not use /bin/sh
+ sh=`which bash`
+ test "X$sh" = X && sh=/usr/xpg4/bin/sh
+ BASH_VERSION=not-good-enough
+ export BASH_VERSION
+ exec $sh "$0" "$@"
+ fi
+ ;;
+ esac
+
+ script_name=$1
+ set -a
+ . ${top_builddir}/config/shdefs
+ progname=`echo "$script_name" | ${SED} 's,^.*/,,'`
+ testname=`echo "$progname" | ${SED} 's,\..*$,,'`
+ test_name=`echo ${testname} | ${SED} 's/-/_/g'`
+ PS4=">${testname}-\${FUNCNAME}> "
+ test -z "$srcdir" && exit 1
+ srcdir=`cd $srcdir >/dev/null && pwd`
+ ( exec 2>/dev/null; ulimit -c unlimited ) && \
+ ulimit -c unlimited
+
+ test -z "${CFLAGS}" && CFLAGS='@CFLAGS@'
+ CFLAGS="${CFLAGS} @DEFS@"
+ test -z "${testsubdir}" && testsubdir=testdir
+ test -z "${PAGER}" && PAGER=more
+ nl='
+' ht=' '
+
+ stdopts=${top_srcdir}/autoopts/test/stdopts.def
+ test_main=yes
+ use_flags=true
+ sed_omit_license="/-\*- buffer-read-only:/,/^ \*\//d"
+ TERM=''
+ set +a
+
+ (
+ test_local() {
+ local local_works=yes
+ }
+ test_local
+ ) || eval 'local() { : ; }'
+
+ vars=`set | ${SED} -n '/^\(LANG\|LC_[A-Z_]*\)=/s/=.*//p'` 2>/dev/null
+ test "X$vars" = X || unset $vars
+}
+
+# If only the "rm(1)" command could be relied upon....
+#
+purge()
+{
+ rm -rf ${*} 2>/dev/null
+ bad=''
+ for f
+ do test -f ${f} -o -d ${f} && bad="${bad} ${f}"
+ done
+ test -z "$bad" && return 0
+
+ set -- $bad
+ test "x${RANDOM}" = "x${RANDOM}" && RANDOM=`expr 0${RANDOM} + 1 2>/dev/null`
+
+ f=ZZPURGE-${1}-${RANDOM}-$$
+ if test $# -gt 1
+ then mkdir ${f}
+ mv $* ${f}/.
+ else mv $1 ${f}
+ fi
+}
+
+init_tests()
+{
+ logfile=`pwd`/testdir/${testname}.log
+ exec 8>&2 1>${logfile} 2>&1
+
+ TMPDIR=`pwd`/testdir/${testname}-tmpd
+ mkdir ${TMPDIR}
+
+ f=`\cd ${LIBGUILE_PATH}/../bin && pwd`
+ PATH=${f}:${PATH}
+ echo PATH is ${PATH} >&2
+
+ builddir=`pwd`
+ testsubdir=testdir
+ CFLAGS=`echo ${CFLAGS} | \
+ ${SED} "s/-Werror[^ ${ht}]*//g;s/-Wextra//g"`
+
+ lo_dir=${top_builddir}/autoopts
+ test -d ${lo_dir}/.libs && lo_dir=${lo_dir}/.libs
+ test "X${LD_LIBRARY_PATH}" = X || LD_LIBRARY_PATH=:${LD_LIBRARY_PATH}
+ LD_LIBRARY_PATH=${lo_dir}:${LIBGUILE_PATH}${LD_LIBRARY_PATH}
+
+ case ${AG_VERSION} in
+ *pre* ) GUILE_WARN_DEPRECATED=detailed ;;
+ * ) GUILE_WARN_DEPRECATED=no ;;
+ esac
+
+ case "$LIB" in
+ *-lgen* ) : ;;
+ * )
+ for f in /usr/lib*/libgen.so /lib*/libgen.so
+ do
+ test -f $f && {
+ LIB="${LIB} -lgen"
+ break
+ }
+ done
+ ;;
+ esac
+ lo_lib=`find ${lo_dir} -type f -name libopts*.${OBJEXT}`
+ LIB="${lo_lib} ${LIB}"
+
+ AG_L=run_ag\ ao
+ agl_opts="-L${top_builddir}/autoopts/tpl -L${top_srcdir}/autoopts/tpl"
+
+ export TMPDIR PATH LD_LIBRARY_PATH \
+ GUILE_WARN_DEPRECATED LIB AG_L agl_opts \
+ CC LIBGUILE AG_VERSION
+}
+
+be_silent()
+{
+ setx=:
+ VERBOSE=false
+ purge testdir
+
+ # Sometimes, MSDos FS cannot even rename the directory!!
+ #
+ if test -d testdir
+ then purge testdir/* testdir/.??*
+ else msg=echo
+ mkdir testdir || exit 1
+ fi
+
+ run_ag()
+ {
+ local opts=''
+ shift
+
+ case " $* " in
+ *' -L'* ) : ;;
+ * ) opts="${agl_opts}" ;;
+ esac
+
+ ${AGexe} ${opts} "$@"
+ }
+
+ init_tests
+}
+
+be_verbose()
+{
+ set -x
+ setx='set -x'
+ msg=:
+ VERBOSE=true
+ test -d testdir || mkdir testdir || exit 1
+
+ run_ag()
+ {
+ local tfile=${testname}-aglog-${1}-$$.log
+ shift
+ local opts=''
+ local tr="--trace=every --trace-out=>>${tfile}"
+
+ case " $* " in
+ *' -L'* ) : ;;
+ * ) opts="${agl_opts}" ;;
+ esac
+
+ MALLOC_CHECK_=2 \
+ ${AGexe} ${opts} ${tr} "$@"
+ }
+
+ init_tests
+}
+
+cfg_inc()
+{
+ cd testdir || {
+ echo "Cannot make or change into testdir" >&8
+ exit 1
+ }
+ testsubdir=`pwd`
+
+ dirs=`
+ for f in ${top_builddir} ${top_srcdir}
+ do
+ for d in . autoopts agen5
+ do
+ cd $f/$d
+ pwd >&9
+ cd -
+ done 9>&1 1>/dev/null
+ done | sort -u | ${SED} 's/^/-I/'`
+
+ INC=`echo ${dirs} ${CPPFLAGS}`
+
+ : "=== Running $progname for ${testname} using ${SHELL} ==="
+ chmod +w * > /dev/null 2>&1 || :
+ ${VERBOSE} && SHELLX="${SHELL} -x" || SHELLX="${SHELL}"
+}
+
+clean_help() {
+ test -z "$sedcmd" && s= || s="${sedcmd}${nl}"
+ s="${s}/^Packaged by/d${nl}"
+ s="${s}/^Report .* bugs to/d${nl}"
+ s="${s}/[Pp]lease send bug reports/d${nl}"
+ s="${s}/^[ ${ht}]*\$/d"
+
+ ${SED} "${s}"
+}
+
+compile()
+{
+ ${setx}
+ test "X${Csrc}" = "X" && Csrc="${testname}"
+ test "X${Cexe}" = "X" && Cexe="${Csrc}"
+ test "X${Dnam}" = "X" && Dnam="${testname}"
+
+ d=`echo TEST_TEST_${Dnam}_OPTS | /usr/bin/tr '[a-z]-' '[A-Z]_'`
+ cc_cmd="${CC} ${CFLAGS} -D$d ${INC} -o ${Cexe} ${Csrc}.c ${LIB}"
+ eval ${cc_cmd} || \
+ failure cannot compile ${Csrc}.c
+ if test $# -gt 0
+ then
+ ./${Cexe} ${*} ${dosed} || \
+ failure cannot obtain help output for ${Csrc}
+ fi | clean_help > ${Csrc}.help
+ Csrc='' Cexe='' Dnam=''
+}
+
+cleanup()
+{
+ trap '' 15
+ ${setx}
+ ${VERBOSE} || {
+ cd ${builddir}
+ purge testdir
+ test -d testdir && mv testdir ZZJUNK-$$
+ }
+ ${msg} ${testname} done
+}
+
+# A standard failure function
+#
+failure()
+{
+ trap '' 15
+ ${setx}
+ cd ${testsubdir}
+ if test -d ../FAILURES
+ then ( \cd ../FAILURES ; purge -rf ${testname}* .*${testname}* )
+ else mkdir ../FAILURES ; fi
+
+ exec > /dev/tty 2>&8
+ cat ${logfile} >&2
+
+ {
+ mv -f ${testname}* .*${testname}* ../FAILURES || :
+ } 2>/dev/null
+ for f in core*
+ do test -f ${f} && mv -f ${f} ../FAILURES/${testname}-${f} ; done
+
+ echo FAILURE: "$*" >&8
+ exit 1
+}
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+cfg_vals $0
+
+case "${VERBOSE}" in
+'' | [Nn]* | 0 | [Ff]* )
+ be_silent ;;
+
+[Yy]* | [0-9] | [Tt]* )
+ be_verbose ;;
+
+* )
+ case "$-" in
+ *x* ) be_verbose ;;
+ * ) be_silent ;;
+ esac
+esac
+
+cfg_inc
+
+trap "failure 'test ${testname} killed on timeout'" 15
+( ( exec > /dev/null 2>&1 </dev/null
+ test -z "${kill_delay}" && kill_delay=3
+ kill_delay=`expr $kill_delay '*' $AG_TIMEOUT`
+ sleep ${kill_delay}
+ ps -p $$ || exit
+ kill -15 $$
+ sleep 1
+ ps -p $$ || exit
+ mv -f `dirname $logfile` ${builddir}/FAILED-${testname}
+ kill -9 $$
+) &
+)
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# defs.in ends here
diff --git a/autoopts/test/doc.test b/autoopts/test/doc.test
new file mode 100755
index 0000000..d0c2989
--- /dev/null
+++ b/autoopts/test/doc.test
@@ -0,0 +1,848 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+#
+# doc.test --- test doc templates
+#
+# Time-stamp: "2012-08-11 08:54:27 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+#
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+
+. ./defs
+
+test_src=${srcdir}/${testname}.test
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+echo make defs from test file
+sed "1,/^##* *BEGIN-DEFS/d
+ /^prog-name/s/=.*/= ${testname};/
+ \\@^// *END-DEFS@q" \
+ ${test_src} > ${testname}.def
+
+# # # # # # # # # # TEXI DOC CHECK # # # # # # # # #
+${AGexe} ${agl_opts} -Tagtexi-cmd ${testname}.def
+test -f invoke-${testname}.menu -a -f invoke-${testname}.texi || \
+ failure "invoke-${testname}.{menu,texi} not built"
+sed '/^@ignore/,/^@end ignore/d' \
+ invoke-${testname}.texi > ${testname}-res.texi
+rm -f invoke-${testname}.menu invoke-${testname}.texi
+
+sed "1,/^##* *BEGIN-TEXI/d
+ /^@ignore/,/^@end ignore/d
+ /^## END-TEXI/{;s/.*//;q;}" \
+ ${test_src} > ${testname}-base.texi
+
+outfiles="${testname}-res.texi ${testname}-base.texi"
+cmp -s ${outfiles} || \
+ failure "Differences: ${outfiles}${nl}`diff ${outfiles}`"
+
+# # # # # # # # # # MAN DOC CHECK # # # # # # # # #
+${AGexe} ${agl_opts} -Tagman-cmd ${testname}.def
+test -f ${testname}.1 || \
+ failure "${testname}.1 not built"
+
+{
+ sed '/^\.\\"/d;/^\.TH/s/ *".*//' ${testname}.1
+ rm -f ${testname}.1
+ echo
+} > ${testname}-res.1
+
+sed "1,/^##* *BEGIN-MAN/d
+ /^## END-MAN/{;s/.*//;q;}" ${test_src} > ${testname}-base.1
+
+outfiles="${testname}-base.1 ${testname}-res.1"
+cmp -s ${outfiles} || \
+ failure "Differences: ${outfiles}${nl}`diff ${outfiles}`"
+
+# # # # # # # # # # MDOC DOC CHECK # # # # # # # # #
+${AGexe} ${agl_opts} -Tagmdoc-cmd ${testname}.def
+test -f ${testname}.1 || \
+ failure "${testname}.1 not built"
+
+{
+ ${EGREP} -v '^\.(Dd |Os |\\")' ${testname}.1
+ echo
+} > ${testname}-mdoc-res.1
+
+sed "1,/^##* *BEGIN-MDOC/d
+ /^## END-MDOC/{;s/.*//;q;}" ${test_src} > ${testname}-mdoc-base.1
+
+outfiles="${testname}-mdoc-base.1 ${testname}-mdoc-res.1"
+cmp -s ${outfiles} || \
+ failure "Differences: ${outfiles}${nl}`diff ${outfiles}`"
+
+# # # # # # # # # # POT CHECK # # # # # # # # #
+${AGexe} ${agl_opts} -Tdef2pot ${testname}.def
+test -s ${testname}.pot || \
+ failure "${testname}.pot not built"
+
+{
+ sed -e '/^# *Copyright/s/).*/)/' \
+ -e '/^$/d' \
+ -e 's/>, 20[0-9][0-9]\./>./' \
+ -e '/POT-Creation-Date:/s/ 2[0-9].*/\\n"/' \
+ ${testname}.pot
+ echo
+} > ${testname}-res.pot
+
+sed "1,/^##* *BEGIN-POT/d
+ /^$/d
+ /^## END-POT/{;s/.*//;q;}" ${test_src} > ${testname}-base.pot
+
+outfiles="${testname}-base.pot ${testname}-res.pot"
+cmp -s ${outfiles} || \
+ failure "Differences: ${outfiles}${nl}`diff ${outfiles}`"
+
+# # # # # # # # # # # FINISH # # # # # # # # # # #
+
+cleanup
+
+exit 0
+
+# # # # # # # # # # # OPTION DEFS
+
+cat <<_End_Of_Definitions_
+## BEGIN-DEFS
+AutoGen Definitions options;
+prog-name = gnutls-cli;
+prog-title = "GnuTLS client";
+prog-desc = "Simple client program to set up a TLS connection.";
+short-usage = <<- _EOUsage_
+ Usage: gnutls-cli [options] hostname
+ gnutls-cli --help for usage instructions.
+ _EOUsage_;
+prog-group = "GnuTLS";
+detail = <<- _EODetail_
+ Simple client program to set up a TLS connection to some other computer.
+ It sets up a TLS connection and forwards data from the standard input
+ to the secured socket and vice versa.
+ _EODetail_;
+
+gnu-usage;
+no-misuse-usage;
+disable-save;
+reorder-args;
+no-xlate = opt;
+argument = "[hostname]";
+long-opts;
+
+copyright = {
+ date = "2000-2012";
+ owner = "Free Software Foundation";
+ author = "Nikos Mavrogiannopoulos, Simon Josefsson and others; "
+ "see /usr/share/doc/gnutls-bin/AUTHORS for a complete list.";
+ eaddr = "bug-gnutls@gnu.org";
+ type = gpl;
+};
+version = "3.0.12";
+help-value = h;
+more-help-value = M;
+
+flag = {
+ name = debug;
+ value = d;
+ arg-type = number;
+ arg-range = "0->9999";
+ descrip = "Enable @code{debugging}";
+ doc = 'really enable debugging';
+};
+
+flag = {
+ name = mtu;
+ arg-type = number;
+ arg-range = "0->17000";
+ descrip = "Set MTU for datagram TLS";
+ doc = "Really set MTU for datagram TLS";
+};
+
+flag = {
+ name = group-2;
+ descrip = "second group of options";
+ documentation;
+};
+
+flag = {
+ name = crlf;
+ descrip = "Send CR LF instead of LF";
+ doc = "Really send CR LF instead of LF";
+};
+
+flag = {
+ name = x509fmtder;
+ descrip = "Use DER format for certificates to read from";
+ doc = "Really use DER format for certificates to read from";
+};
+
+flag = {
+ name = group-3;
+ descrip = "third group of options";
+ documentation;
+};
+
+flag = {
+ name = recordsize;
+ arg-type = number;
+ arg-range = "0->4096";
+ descrip = "The maximum record size to advertize";
+ doc = "Really the maximum record size to advertize";
+};
+
+flag = {
+ name = priority;
+ arg-type = string;
+ descrip = "Priorities string";
+ doc = <<- _EODoc_
+ TLS algorithms and protocols to enable. You can
+ use predefined sets of ciphersuites such as PERFORMANCE,
+ NORMAL, SECURE128, SECURE256.
+
+ Check the GnuTLS manual on section ``Priority strings'' for more
+ information on allowed keywords
+ _EODoc_;
+};
+
+
+doc-section = {
+ ds-type = 'SEE ALSO';
+ ds-format = texi;
+ omit-texi;
+ ds-text = 'gnutls-cli-debug(1), gnutls-serv(1)';
+};
+
+doc-section = {
+ ds-type = EXAMPLES;
+ ds-format = texi;
+ ds-text = <<- _EOT_
+ To connect to a server using PSK authentication, you need to enable
+ the choice of PSK by using a cipher priority parameter such as in the
+ example below.
+ @example
+ $ ./gnutls-cli -p 5556 localhost --pskusername psk_identity \\
+ --pskkey 88f3824b3e5659f52d00e959bacab954b6540344 \\
+ --priority NORMAL:-KX-ALL:+ECDHE-PSK:+DHE-PSK:+PSK
+ Resolving 'localhost'...
+ Connecting to '127.0.0.1:5556'...
+ - PSK authentication.
+ - Version: TLS1.1
+ - Key Exchange: PSK
+ - Cipher: AES-128-CBC
+ - MAC: SHA1
+ - Compression: NULL
+ - Handshake was completed
+
+ - Simple Client Mode:
+ @end example
+ By keeping the --pskusername parameter and removing the --pskkey
+ parameter, it will query only for the password during the handshake.
+
+ To list the ciphersuites in a priority string:
+ @example
+ $ ./gnutls-cli --priority SECURE192 -l
+ Cipher suites for SECURE192
+ TLS_ECDHE_ECDSA_AES_256_CBC_SHA384 0xc0, 0x24 TLS1.2
+ TLS_ECDHE_ECDSA_AES_256_GCM_SHA384 0xc0, 0x2e TLS1.2
+ TLS_ECDHE_RSA_AES_256_GCM_SHA384 0xc0, 0x30 TLS1.2
+ TLS_DHE_RSA_AES_256_CBC_SHA256 0x00, 0x6b TLS1.2
+ TLS_DHE_DSS_AES_256_CBC_SHA256 0x00, 0x6a TLS1.2
+ TLS_RSA_AES_256_CBC_SHA256 0x00, 0x3d TLS1.2
+ @end example
+ _EOT_;
+};
+// END-DEFS
+_End_Of_Definitions_
+
+# # # # # # # # # # # TEXI TEXT
+
+cat <<_End_Of_TexInfo_
+## BEGIN-TEXI
+@node doc Invocation
+@section Invoking doc
+@pindex doc
+@cindex GnuTLS client
+Simple client program to set up a TLS connection to some other computer.
+It sets up a TLS connection and forwards data from the standard input
+to the secured socket and vice versa.
+
+This section was generated by @strong{AutoGen},
+using the @code{agtexi-cmd} template and the option descriptions for the @code{doc} program.
+This software is released under the GNU General Public License, version 3 or later.
+
+@menu
+* doc usage:: doc help/usage (@option{--help})
+* doc base-options:: Base options
+* doc group-2:: group-2 options
+* doc group-3:: group-3 options
+* doc exit status:: exit status
+* doc Examples:: Examples
+@end menu
+
+@node doc usage
+@subsection doc help/usage (@option{--help})
+@cindex doc help
+
+This is the automatically generated usage text for doc.
+
+The text printed is the same whether selected with the @code{help} option
+(@option{--help}) or the @code{more-help} option (@option{--more-help}). @code{more-help} will print
+the usage text by passing it through a pager program.
+@code{more-help} is disabled on platforms without a working
+@code{fork(2)} function. The @code{PAGER} environment variable is
+used to select the program, defaulting to @file{more}. Both will exit
+with a status code of 0.
+
+@exampleindent 0
+@example
+doc is unavailable - no --help
+@end example
+@exampleindent 4
+
+@node doc
+@subsection Base options
+@subsubheading debug option (-d).
+@anchor{doc debug}
+@cindex doc-debug
+
+This is the ``enable @code{debugging}'' option.
+This option takes an argument number.
+really enable debugging
+@subsubheading mtu option.
+@anchor{doc mtu}
+@cindex doc-mtu
+
+This is the ``set mtu for datagram tls'' option.
+This option takes an argument number.
+Really set MTU for datagram TLS
+@node doc group-2
+@subsection group-2 options
+second group of options.
+@subsubheading crlf option.
+@anchor{doc crlf}
+@cindex doc-crlf
+
+This is the ``send cr lf instead of lf'' option.
+Really send CR LF instead of LF
+@subsubheading x509fmtder option.
+@anchor{doc x509fmtder}
+@cindex doc-x509fmtder
+
+This is the ``use der format for certificates to read from'' option.
+Really use DER format for certificates to read from
+@node doc group-3
+@subsection group-3 options
+third group of options.
+@subsubheading recordsize option.
+@anchor{doc recordsize}
+@cindex doc-recordsize
+
+This is the ``the maximum record size to advertize'' option.
+This option takes an argument number.
+Really the maximum record size to advertize
+@subsubheading priority option.
+@anchor{doc priority}
+@cindex doc-priority
+
+This is the ``priorities string'' option.
+This option takes an argument string.
+TLS algorithms and protocols to enable. You can
+use predefined sets of ciphersuites such as PERFORMANCE,
+NORMAL, SECURE128, SECURE256.
+
+Check the GnuTLS manual on section ``Priority strings'' for more
+information on allowed keywords
+@node doc exit status
+@subsection doc exit status
+
+One of the following exit values will be returned:
+@table @samp
+@item 0 (EXIT_SUCCESS)
+Successful program execution.
+@item 1 (EXIT_FAILURE)
+The operation failed or the command syntax was not valid.
+@end table
+@node doc Examples
+@subsection doc Examples
+To connect to a server using PSK authentication, you need to enable
+the choice of PSK by using a cipher priority parameter such as in the
+example below.
+@example
+$ ./gnutls-cli -p 5556 localhost --pskusername psk_identity \\
+ --pskkey 88f3824b3e5659f52d00e959bacab954b6540344 \\
+ --priority NORMAL:-KX-ALL:+ECDHE-PSK:+DHE-PSK:+PSK
+Resolving 'localhost'...
+Connecting to '127.0.0.1:5556'...
+- PSK authentication.
+- Version: TLS1.1
+- Key Exchange: PSK
+- Cipher: AES-128-CBC
+- MAC: SHA1
+- Compression: NULL
+- Handshake was completed
+
+- Simple Client Mode:
+@end example
+By keeping the --pskusername parameter and removing the --pskkey
+parameter, it will query only for the password during the handshake.
+
+To list the ciphersuites in a priority string:
+@example
+$ ./gnutls-cli --priority SECURE192 -l
+Cipher suites for SECURE192
+TLS_ECDHE_ECDSA_AES_256_CBC_SHA384 0xc0, 0x24 TLS1.2
+TLS_ECDHE_ECDSA_AES_256_GCM_SHA384 0xc0, 0x2e TLS1.2
+TLS_ECDHE_RSA_AES_256_GCM_SHA384 0xc0, 0x30 TLS1.2
+TLS_DHE_RSA_AES_256_CBC_SHA256 0x00, 0x6b TLS1.2
+TLS_DHE_DSS_AES_256_CBC_SHA256 0x00, 0x6a TLS1.2
+TLS_RSA_AES_256_CBC_SHA256 0x00, 0x3d TLS1.2
+@end example
+## END-TEXI
+_End_Of_TexInfo_
+
+# # # # # # # # # # # MAN PAGE
+
+cat <<_End_Of_ManPage_
+## BEGIN-MAN
+.TH doc 1
+.SH NAME
+doc \- GnuTLS client
+.SH SYNOPSIS
+.B doc
+.RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \-\-\fIopt\-name\fP " [[=| ]\fIvalue\fP]]..." [hostname]
+.PP
+Operands and options may be intermixed. They will be reordered.
+.SH "DESCRIPTION"
+Simple client program to set up a TLS connection to some other computer.
+It sets up a TLS connection and forwards data from the standard input
+to the secured socket and vice versa.
+.SH "OPTIONS"
+.TP
+.BR \-d " \fInumber\fP, " \-\-debug "=" \fInumber\fP
+Enable \fBdebugging\fP.
+This option takes an integer number as its argument.
+The value of \fInumber\fP is constrained to being:
+.in +4
+.nf
+.na
+in the range 0 through 9999
+.fi
+.in -4
+.sp
+really enable debugging
+.TP
+.BR \-\-mtu "=\fInumber\fP"
+Set MTU for datagram TLS.
+This option takes an integer number as its argument.
+The value of \fInumber\fP is constrained to being:
+.in +4
+.nf
+.na
+in the range 0 through 17000
+.fi
+.in -4
+.sp
+Really set MTU for datagram TLS
+.SS "second group of options"
+.TP
+.BR \-\-crlf
+Send CR LF instead of LF.
+.sp
+Really send CR LF instead of LF
+.TP
+.BR \-\-x509fmtder
+Use DER format for certificates to read from.
+.sp
+Really use DER format for certificates to read from
+.SS "third group of options"
+.TP
+.BR \-\-recordsize "=\fInumber\fP"
+The maximum record size to advertize.
+This option takes an integer number as its argument.
+The value of \fInumber\fP is constrained to being:
+.in +4
+.nf
+.na
+in the range 0 through 4096
+.fi
+.in -4
+.sp
+Really the maximum record size to advertize
+.TP
+.BR \-\-priority "=\fIstring\fP"
+Priorities string.
+.sp
+TLS algorithms and protocols to enable. You can
+use predefined sets of ciphersuites such as PERFORMANCE,
+NORMAL, SECURE128, SECURE256.
+Check the GnuTLS manual on section \(lqPriority strings\(rq for more
+information on allowed keywords
+.TP
+.BR \-h , " \-\-help"
+Display usage information and exit.
+.TP
+.BR \-M , " \-\-more-help"
+Pass the extended usage information through a pager.
+.TP
+.BR \-v " [{\fIv|c|n\fP}]," " \-\-version" "[=\fI{v|c|n}\fP]"
+Output version of program and exit. The default mode is `v', a simple
+version. The `c' mode will print copyright information and `n' will
+print the full copyright notice.
+.SH EXAMPLES
+To connect to a server using PSK authentication, you need to enable
+the choice of PSK by using a cipher priority parameter such as in the
+example below.
+.br
+.in +4
+.nf
+$ ./gnutls\-cli \-p 5556 localhost \-\-pskusername psk_identity \\
+ \-\-pskkey 88f3824b3e5659f52d00e959bacab954b6540344 \\
+ \-\-priority NORMAL:\-KX\-ALL:+ECDHE\-PSK:+DHE\-PSK:+PSK
+Resolving 'localhost'...
+Connecting to '127.0.0.1:5556'...
+- PSK authentication.
+- Version: TLS1.1
+- Key Exchange: PSK
+- Cipher: AES\-128\-CBC
+- MAC: SHA1
+- Compression: NULL
+- Handshake was completed
+- Simple Client Mode:
+.in -4
+.fi
+By keeping the \-\-pskusername parameter and removing the \-\-pskkey
+parameter, it will query only for the password during the handshake.
+.sp
+To list the ciphersuites in a priority string:
+.br
+.in +4
+.nf
+$ ./gnutls\-cli \-\-priority SECURE192 \-l
+Cipher suites for SECURE192
+TLS_ECDHE_ECDSA_AES_256_CBC_SHA384 0xc0, 0x24 TLS1.2
+TLS_ECDHE_ECDSA_AES_256_GCM_SHA384 0xc0, 0x2e TLS1.2
+TLS_ECDHE_RSA_AES_256_GCM_SHA384 0xc0, 0x30 TLS1.2
+TLS_DHE_RSA_AES_256_CBC_SHA256 0x00, 0x6b TLS1.2
+TLS_DHE_DSS_AES_256_CBC_SHA256 0x00, 0x6a TLS1.2
+TLS_RSA_AES_256_CBC_SHA256 0x00, 0x3d TLS1.2
+.in -4
+.fi
+.SH "EXIT STATUS"
+One of the following exit values will be returned:
+.TP
+.BR 0 " (EXIT_SUCCESS)"
+Successful program execution.
+.TP
+.BR 1 " (EXIT_FAILURE)"
+The operation failed or the command syntax was not valid.
+.SH "SEE ALSO"
+gnutls\-cli\-debug(1), gnutls\-serv(1)
+.SH "AUTHORS"
+Nikos Mavrogiannopoulos, Simon Josefsson and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list.
+.SH "COPYRIGHT"
+Copyright (C) 2000-2012 Free Software Foundation all rights reserved.
+This program is released under the terms of the GNU General Public License, version 3 or later.
+.SH "BUGS"
+Please send bug reports to: bug-gnutls@gnu.org
+.SH "NOTES"
+This manual page was \fIAutoGen\fP-erated from the \fBdoc\fP
+option definitions.
+## END-MAN
+_End_Of_ManPage_
+
+# # # # # # # # # # # MAN PAGE
+
+cat <<_End_Of_MdocPage_
+## BEGIN-MDOC
+.Dt DOC 1 User Commands
+.Sh NAME
+.Nm doc
+.Nd GnuTLS client
+.Sh SYNOPSIS
+.Nm
+.Op Fl flags
+.Op Fl flag Ar value
+.Op Fl \-option-name Ar value
+[hostname]
+.Pp
+Operands and options may be intermixed. They will be reordered.
+.Pp
+.Sh "DESCRIPTION"
+Simple client program to set up a TLS connection to some other computer.
+It sets up a TLS connection and forwards data from the standard input
+to the secured socket and vice versa.
+.Sh "OPTIONS"
+.Bl -tag
+.It \-d " \fInumber\fP, " \-\-debug "=" \fInumber\fP
+Enable \fBdebugging\fP.
+This option takes an integer number as its argument.
+The value of \fInumber\fP is constrained to being:
+.in +4
+.nf
+.na
+in the range 0 through 9999
+.fi
+.in -4
+.sp
+really enable debugging
+.It \-\-mtu "=\fInumber\fP"
+Set MTU for datagram TLS.
+This option takes an integer number as its argument.
+The value of \fInumber\fP is constrained to being:
+.in +4
+.nf
+.na
+in the range 0 through 17000
+.fi
+.in -4
+.sp
+Really set MTU for datagram TLS
+.Ss "second group of options"
+.It \-\-crlf
+Send CR LF instead of LF.
+.sp
+Really send CR LF instead of LF
+.It \-\-x509fmtder
+Use DER format for certificates to read from.
+.sp
+Really use DER format for certificates to read from
+.Ss "third group of options"
+.It \-\-recordsize "=\fInumber\fP"
+The maximum record size to advertize.
+This option takes an integer number as its argument.
+The value of \fInumber\fP is constrained to being:
+.in +4
+.nf
+.na
+in the range 0 through 4096
+.fi
+.in -4
+.sp
+Really the maximum record size to advertize
+.It \-\-priority "=\fIstring\fP"
+Priorities string.
+.sp
+TLS algorithms and protocols to enable. You can
+use predefined sets of ciphersuites such as PERFORMANCE,
+NORMAL, SECURE128, SECURE256.
+.sp
+Check the GnuTLS manual on section \(lqPriority strings\(rq for more
+information on allowed keywords
+.It \-h , " \-\-help"
+Display usage information and exit.
+.It \-M , " \-\-more-help"
+Pass the extended usage information through a pager.
+.It \-v " [{\fIv|c|n\fP}]," " \-\-version" "[=\fI{v|c|n}\fP]"
+Output version of program and exit. The default mode is `v', a simple
+version. The `c' mode will print copyright information and `n' will
+print the full copyright notice.
+.El
+.Sh EXAMPLES
+To connect to a server using PSK authentication, you need to enable
+the choice of PSK by using a cipher priority parameter such as in the
+example below.
+.Bd -literal -offset indent
+$ ./gnutls\-cli \-p 5556 localhost \-\-pskusername psk_identity \\
+ \-\-pskkey 88f3824b3e5659f52d00e959bacab954b6540344 \\
+ \-\-priority NORMAL:\-KX\-ALL:+ECDHE\-PSK:+DHE\-PSK:+PSK
+Resolving 'localhost'...
+Connecting to '127.0.0.1:5556'...
+- PSK authentication.
+- Version: TLS1.1
+- Key Exchange: PSK
+- Cipher: AES\-128\-CBC
+- MAC: SHA1
+- Compression: NULL
+- Handshake was completed
+- Simple Client Mode:
+.Ed
+By keeping the \-\-pskusername parameter and removing the \-\-pskkey
+parameter, it will query only for the password during the handshake.
+.sp
+To list the ciphersuites in a priority string:
+.Bd -literal -offset indent
+$ ./gnutls\-cli \-\-priority SECURE192 \-l
+Cipher suites for SECURE192
+TLS_ECDHE_ECDSA_AES_256_CBC_SHA384 0xc0, 0x24 TLS1.2
+TLS_ECDHE_ECDSA_AES_256_GCM_SHA384 0xc0, 0x2e TLS1.2
+TLS_ECDHE_RSA_AES_256_GCM_SHA384 0xc0, 0x30 TLS1.2
+TLS_DHE_RSA_AES_256_CBC_SHA256 0x00, 0x6b TLS1.2
+TLS_DHE_DSS_AES_256_CBC_SHA256 0x00, 0x6a TLS1.2
+TLS_RSA_AES_256_CBC_SHA256 0x00, 0x3d TLS1.2
+.Ed
+.Sh "EXIT STATUS"
+One of the following exit values will be returned:
+.Bl -tag
+.It 0 " (EXIT_SUCCESS)"
+Successful program execution.
+.It 1 " (EXIT_FAILURE)"
+The operation failed or the command syntax was not valid.
+.El
+.Sh "SEE ALSO"
+gnutls\-cli\-debug(1), gnutls\-serv(1)
+.Sh "AUTHORS"
+Nikos Mavrogiannopoulos, Simon Josefsson and others; see /usr/share/doc/gnutls-bin/AUTHORS for a complete list.
+.Sh "COPYRIGHT"
+Copyright (C) 2000-2012 Free Software Foundation all rights reserved.
+This program is released under the terms of the GNU General Public License, version 3 or later.
+.Sh "BUGS"
+Please send bug reports to: bug-gnutls@gnu.org
+.Sh "NOTES"
+This manual page was \fIAutoGen\fP-erated from the \fBdoc\fP
+option definitions.
+## END-MDOC
+_End_Of_MdocPage_
+
+# # # # # # # # # # # POT PAGE
+
+cat <<_End_Of_PotPage_
+## BEGIN-POT
+# localization template (.pot) for doc.def of doc,
+# this file is used to generate localized manual for doc.
+# Copyright (C)
+# This file is distributed under the terms of the
+# the GNU General Public License, version 3 or later
+# The program owners may be reached via:
+# Free Software Foundation <bug-gnutls@gnu.org>.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: doc 3.0.12\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date:\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: doc.def:3
+msgid "GnuTLS client"
+msgstr ""
+
+#: doc.def:41
+msgid "Enable debugging"
+msgstr ""
+
+#: doc.def:42
+msgid "really enable debugging"
+msgstr ""
+
+#: doc.def:49
+msgid "Set MTU for datagram TLS"
+msgstr ""
+
+#: doc.def:50
+msgid "Really set MTU for datagram TLS"
+msgstr ""
+
+#: doc.def:55
+msgid "second group of options"
+msgstr ""
+
+#: doc.def:61
+msgid "Send CR LF instead of LF"
+msgstr ""
+
+#: doc.def:62
+msgid "Really send CR LF instead of LF"
+msgstr ""
+
+#: doc.def:67
+msgid "Use DER format for certificates to read from"
+msgstr ""
+
+#: doc.def:68
+msgid "Really use DER format for certificates to read from"
+msgstr ""
+
+#: doc.def:73
+msgid "third group of options"
+msgstr ""
+
+#: doc.def:81
+msgid "The maximum record size to advertize"
+msgstr ""
+
+#: doc.def:82
+msgid "Really the maximum record size to advertize"
+msgstr ""
+
+#: doc.def:88
+msgid "Priorities string"
+msgstr ""
+
+#: doc.def:90
+msgid "TLS algorithms and protocols to enable. You can use predefined sets of\n"
+ "ciphersuites such as PERFORMANCE, NORMAL, SECURE128, SECURE256.\n\n"
+ "Check the GnuTLS manual on section ``Priority strings'' for more\n"
+ "information on allowed keywords"
+msgstr ""
+
+#: doc.def:104
+msgid "gnutls-cli-debug(1), gnutls-serv(1)"
+msgstr ""
+
+#: doc.def:111
+msgid "To connect to a server using PSK authentication, you need to enable the\n"
+ "choice of PSK by using a cipher priority parameter such as in the\n"
+ "example below. @example $ ./gnutls-cli -p 5556 localhost --pskusername\n"
+ "psk_identity \\\\ --pskkey 88f3824b3e5659f52d00e959bacab954b6540344 \\\\\n"
+ "--priority NORMAL:-KX-ALL:+ECDHE-PSK:+DHE-PSK:+PSK Resolving\n"
+ "'localhost'... Connecting to '127.0.0.1:5556'... - PSK authentication.\n"
+ "- Version: TLS1.1 - Key Exchange: PSK - Cipher: AES-128-CBC - MAC: SHA1\n"
+ "- Compression: NULL - Handshake was completed\n\n"
+ "- Simple Client Mode: @end example By keeping the --pskusername\n"
+ "parameter and removing the --pskkey parameter, it will query only for\n"
+ "the password during the handshake.\n\n"
+ "To list the ciphersuites in a priority string: @example $ ./gnutls-cli\n"
+ "--priority SECURE192 -l Cipher suites for SECURE192\n"
+ "TLS_ECDHE_ECDSA_AES_256_CBC_SHA384 0xc0, 0x24 TLS1.2\n"
+ "TLS_ECDHE_ECDSA_AES_256_GCM_SHA384 0xc0, 0x2e TLS1.2\n"
+ "TLS_ECDHE_RSA_AES_256_GCM_SHA384 0xc0, 0x30 TLS1.2\n"
+ "TLS_DHE_RSA_AES_256_CBC_SHA256 0x00, 0x6b TLS1.2\n"
+ "TLS_DHE_DSS_AES_256_CBC_SHA256 0x00, 0x6a TLS1.2\n"
+ "TLS_RSA_AES_256_CBC_SHA256 0x00, 0x3d TLS1.2 @end example"
+msgstr ""
+
+#: doc.def:11
+msgid "Simple client program to set up a TLS connection to some other computer.\n"
+ "It sets up a TLS connection and forwards data from the standard input to\n"
+ "the secured socket and vice versa."
+msgstr ""
+
+#:
+msgid "This program is released under the terms of the GNU General Public License, version 3 or later."
+msgstr ""
+
+#: doc.def:21
+msgid "[hostname]"
+msgstr ""
+## END-POT
+_End_Of_PotPage_
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of doc.test
diff --git a/autoopts/test/enums.test b/autoopts/test/enums.test
new file mode 100755
index 0000000..d3edf55
--- /dev/null
+++ b/autoopts/test/enums.test
@@ -0,0 +1,309 @@
+#! /bin/sh
+# -*- Mode: shell-script -*-
+# ----------------------------------------------------------------------
+# enums.test --- test enums program attribute
+# make sure that when it is not specified
+# then option processing consumes all args.
+#
+# Time-stamp: "2012-08-11 08:31:49 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+cat > ${testname}.def <<- _EOF_
+ autogen definitions options;
+
+ prog-name = ${testname}-test;
+ prog-title = 'test complex main procedure';
+ config-header = config.h;
+
+ argument = '[ <node> ]';
+ long-opts;
+
+ flag = {
+ name = print;
+ value = p;
+ descrip = 'Print operational info';
+ arg-type = keyword;
+ arg-name = type;
+ min = 1;
+ equivalence = print;
+ keyword = one, two, three, four, five, six, seven, eight, nine, ten;
+ };
+
+ flag = {
+ name = dump-log;
+ value = D;
+ descrip = 'Dump the program log';
+ equivalence = print;
+ };
+
+ flag = {
+ name = all-dump;
+ value = A;
+ equivalence = print;
+ descrip = 'Dump everything we\'ve got';
+ };
+
+ flag = {
+ name = set;
+ value = s;
+ descrip = 'set options';
+ arg-type = set;
+ arg-name = 'opt[, ...]';
+ arg-default = first,fifth,ninth,thirteenth;
+ equivalence = print;
+ keyword = first, second, third, fourth, fifth, sixth, seventh,
+ eighth, ninth, tenth, eleventh, twelfth, thirteenth,
+ fourteenth, fifteenth, sixteenth;
+ };
+
+ flag = {
+ name = unset;
+ value = u;
+ descrip = 'unset debug options';
+ arg-type = string;
+ arg-name = 'opt[, ...]';
+ equivalence = print;
+ flag-proc = set;
+ };
+
+ flag = {
+ name = msg-num;
+ value = m;
+ descrip = 'message number';
+ no-preset;
+ arg-type = string;
+ arg-name = id;
+ max = NOLIMIT;
+
+ flag-code = <<- _EndOfFlagCode_
+ /*
+ * 'set' and 'unset' must be acted upon immediately
+ * -- we may get more of them.
+ */
+ switch (WHICH_IDX_PRINT) {
+ case NO_EQUIVALENT:
+ case INDEX_OPT_PRINT:
+ case INDEX_OPT_DUMP_LOG:
+ case INDEX_OPT_ALL_DUMP:
+ if (COUNT_OPT( MSG_NUM ) > 1) {
+ fputs("Except for 'set' and 'unset' functions, "
+ "only one 'msg-num' is allowed\n", stderr);
+ USAGE(EXIT_FAILURE);
+ }
+ break;
+ case INDEX_OPT_SET:
+ set_options(1, pOptDesc->pzLastArg);
+ break;
+ case INDEX_OPT_UNSET:
+ set_options(0, pOptDesc->pzLastArg);
+ break;
+ };
+ _EndOfFlagCode_;
+ };
+ /*
+ cat <<_EOF_
+ * for emacs */
+
+ export = "#include <sys/types.h>\n"
+ "#include <sys/stat.h>\n"
+ "#include <stdio.h>\n"
+ "#include <stdlib.h>\n"
+ "#include <fcntl.h>\n"
+ "#include \"config.h\"\n"
+ "#include \"compat/compat.h\"";
+
+ include = 'void set_options(int mode, char const* pzArg);';
+
+ main = {
+ main-type = include;
+ tpl = ${testname}.tpl;
+ };
+ _EOF_
+
+# # # # # # # # # # TEMPLATE FILE # # # # # # # # #
+#
+# In one case we must not use built in echo.
+#
+cat > ${testname}.tpl <<- \__EOF
+ [= AutoGen5 Template -*- Mode: C -*- =]
+ [=(define proc-list "")=]
+ typedef int (do_proc_t)(void);
+ extern do_proc_t
+ [= (set! proc-list (string-append "do_print_undefined,\ndo_print_"
+ (join ",\ndo_print_" (stack "flag[0].keyword")) ))
+ (set! proc-list
+ (shell (string-append "${CLexe} -I4 --spread=1 <<_EOF_\n"
+ proc-list "\n_EOF_")) )
+ proc-list =];
+ do_proc_t* do_proc[] = {
+ [= (. proc-list) =] };
+
+ [=(shellf "procs='%s' ; ix=0 ; for p in ${procs}
+ do
+ p=`echo $p | sed s/,//`
+ echo int ${p}'(void) {'
+ printf ' fputs(\"'${p}'\\\\n\", stdout);\n'
+ echo \" return ${ix}; }\"
+ ix=`expr $ix + 1`
+ done" proc-list) =]
+
+ int
+ do_dump_log(void)
+ {
+ return WHICH_IDX_PRINT != INDEX_OPT_DUMP_LOG;
+ }
+
+ int
+ do_all_dump(void)
+ {
+ return WHICH_IDX_PRINT != INDEX_OPT_ALL_DUMP;
+ }
+
+ int
+ do_set(int which_way)
+ {
+ printf("PRINT = 0x%lX\n", (unsigned long)DESC(PRINT).optCookie);
+ printf("SET = 0x%lX\n", (unsigned long)DESC(SET).optCookie);
+ if (which_way)
+ printf("0x%lX\n", OPT_VALUE_SET);
+ else
+ printf("0x%lX\n", (~ OPT_VALUE_SET) & SET_MEMBERSHIP_MASK);
+ return 0;
+ }
+
+ void
+ set_options(int mode, char const* pzArg)
+ {
+ exit(atoi(pzArg));
+ }
+ __EOF
+
+cat >> ${testname}.tpl <<- __EOF
+ int
+ main( int argc, char** argv )
+ {
+ {
+ int ct = optionProcess(&${testname}_testOptions, argc, argv);
+ argc -= ct;
+ argv += ct;
+ }
+
+ if (argc > 1)
+ return EXIT_FAILURE;
+
+ /*
+ * Invoke the proper operational procedure.
+ */
+ {
+ int res = 0;
+ switch (WHICH_IDX_PRINT) {
+ case INDEX_OPT_PRINT: res = do_proc[OPT_VALUE_PRINT](); break;
+ case INDEX_OPT_DUMP_LOG: res = do_dump_log(); break;
+ case INDEX_OPT_ALL_DUMP: res = do_all_dump(); break;
+ case INDEX_OPT_SET: res = do_set(1); break;
+ case INDEX_OPT_UNSET: res = do_set(0); break;
+ }
+ return res;
+ }
+ }
+ __EOF
+
+# # # # # # # # # # CREATE PROGRAM # # # # # # # # #
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+compile "-?"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+basehlp=${testname}.hlp
+echo creating ${basehlp}
+clean_help > ${basehlp} <<_EOF_
+${testname}-test - test complex main procedure
+USAGE: ${testname} { -<flag> [<val>] | --<name>[{=| }<val>] }... [ <node> ]
+ Flg Arg Option-Name Req? Description
+ -p KWd print YES Print operational info
+ -D no dump-log opt Dump the program log
+ - an alternate for print
+ -A no all-dump opt Dump everything we've got
+ - an alternate for print
+ -s Mbr set opt set options
+ - an alternate for print
+ -u Str unset opt unset debug options
+ - an alternate for print
+ -m Str msg-num opt message number
+ - may not be preset
+ - may appear multiple times
+ -? no help opt Display extended usage information and exit
+ -! no more-help opt Extended usage information passed thru pager
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+The valid "print" option keywords are:
+ one two three four five six seven eight nine ten
+ or an integer from 1 through 10
+The valid "set" option keywords are:
+ first second third fourth fifth sixth seventh
+ eighth ninth tenth eleventh twelfth thirteenth fourteenth
+ fifteenth sixteenth
+ or an integer mask with any of the lower 16 bits set
+or you may use a numeric representation. Preceding these with a '!' will
+clear the bits, specifying 'none' will clear all bits, and 'all' will set them
+all. Multiple entries may be passed as an option argument list.
+_EOF_
+
+cmp -s ${testname}.h*lp || \
+ failure "`diff ${basehlp} ${testname}.help`"
+
+# # # # # # # # # # TEST OPERATION # # # # # # # # # #
+
+ix=0
+for f in one two three four five six seven eight nine ten
+do
+ ix=`expr $ix + 1`
+ txt=`./${testname} -p $f`
+ test $? -eq $ix || \
+ failure "'./${testname} -p $f' did not yield $ix"
+ test "${txt}" = "do_print_${f}" || \
+ failure "'./${testname} -p $f' did not print 'do_print_${f}'"
+done
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of enums.test
diff --git a/autoopts/test/equiv.test b/autoopts/test/equiv.test
new file mode 100755
index 0000000..2c4cc74
--- /dev/null
+++ b/autoopts/test/equiv.test
@@ -0,0 +1,274 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+#
+# equiv.test --- test option equivivalence classes
+#
+# Time-stamp: "2012-02-12 09:28:59 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating ${testname}.def in `pwd`"
+CFLAGS="-g -static" \
+testname="${testname}" test_main="${test_main}" \
+argument="${argument}" long_opts="${long_opts}" \
+${SHELLX} ${stdopts} option:'opt init' second=020 || \
+ failure "Could not run stdopts.def"
+cat >> ${testname}.def <<'_EOF_'
+long-opts;
+
+flag = {
+ name = alpha;
+ descrip = "alpha opt";
+ equivalence = alpha;
+ doc = 'alpha mumbling';
+ arg-type = str;
+ arg-optional;
+};
+
+flag = {
+ name = beta;
+ descrip = "beta opt";
+ equivalence = alpha;
+ doc = 'beta mumbling';
+ arg-type = num;
+};
+
+flag = {
+ name = gamma;
+ descrip = "gamma opt";
+ equivalence = alpha;
+ doc = 'gamma mumbling';
+ arg-type = bool;
+};
+
+flag = {
+ name = omega;
+ descrip = "omega opt";
+ equivalence = alpha;
+ doc = 'omega mumbling';
+ arg-type = key;
+ keyword = uno, dos, tres, mucho;
+ arg-optional;
+ arg-default = mucho;
+};
+_EOF_
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure "AutoGen could not process - exited $?"
+
+compile "-?"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+echo creating ${testname}-base.help
+clean_help > ${testname}-base.help <<_EOF_
+test_${testname} - Test AutoOpts for ${testname}
+USAGE: equiv [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s Num second The second option descrip
+ opt alpha alpha opt
+ Num beta beta opt
+ - an alternate for alpha
+ T/F gamma gamma opt
+ - an alternate for alpha
+ opt omega omega opt
+ - an alternate for alpha
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+The valid "omega" option keywords are:
+ uno dos tres mucho
+ or an integer from 0 through 3
+_EOF_
+
+cmp -s ${testname}*.help || \
+ failure "`diff ${testname}-base.help ${testname}.help`"
+
+cat > ${testname}-base.out <<_EOF_
+OPTION_CT=3
+export OPTION_CT
+TEST_EQUIV_SECOND=2 # 0x2
+export TEST_EQUIV_SECOND
+TEST_EQUIV_ALPHA=1 # 0x1
+export TEST_EQUIV_ALPHA
+=== --beta 5 -o opt ===
+OPTION_CT=4
+export OPTION_CT
+TEST_EQUIV_OPTION='opt'
+export TEST_EQUIV_OPTION
+TEST_EQUIV_ALPHA_MODE='BETA'
+export TEST_EQUIV_ALPHA_MODE
+TEST_EQUIV_BETA=5 # 0x5
+export TEST_EQUIV_BETA
+=== --gamma Yes! ===
+OPTION_CT=2
+export OPTION_CT
+TEST_EQUIV_ALPHA_MODE='GAMMA'
+export TEST_EQUIV_ALPHA_MODE
+TEST_EQUIV_GAMMA='true'
+export TEST_EQUIV_GAMMA
+=== --gamma false ===
+OPTION_CT=2
+export OPTION_CT
+TEST_EQUIV_ALPHA_MODE='GAMMA'
+export TEST_EQUIV_ALPHA_MODE
+TEST_EQUIV_GAMMA='false'
+export TEST_EQUIV_GAMMA
+=== --omega tres ===
+OPTION_CT=2
+export OPTION_CT
+TEST_EQUIV_ALPHA_MODE='OMEGA'
+export TEST_EQUIV_ALPHA_MODE
+TEST_EQUIV_OMEGA='tres'
+export TEST_EQUIV_OMEGA
+_EOF_
+
+( set -e +x
+ ./${testname} --alpha -s 2
+ echo === --beta 5 -o opt ===
+ ./${testname} --beta 5 -o opt
+ echo === --gamma Yes! ===
+ ./${testname} --gamma Yes!
+ echo === --gamma false ===
+ ./${testname} --gamma false
+ echo === --omega tres ===
+ ./${testname} --omega tres ) > ${testname}.out
+
+cmp -s ${testname}-base.out ${testname}.out || \
+ failure "`
+ diff -c ${testname}-base.out ${testname}.out`"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+echo creating ${testname}-base2.help
+clean_help > ${testname}-base2.help <<_EOF_
+test_${testname} - Test AutoOpts for ${testname}
+USAGE: equiv [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s Num second The second option descrip
+ opt alpha alpha opt
+ Num beta beta opt
+ - an alternate for alpha
+ T/F gamma gamma opt
+ - an alternate for alpha
+ opt omega omega opt
+ - an alternate for alpha
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+The following option preset mechanisms are supported:
+ - reading file ..../testdir/.test_equivrc
+
+The valid "omega" option keywords are:
+ uno dos tres mucho
+ or an integer from 0 through 3
+_EOF_
+
+echo 'homerc = "$$";' >> ${testname}.def
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+compile "-?"
+${SED} '/^ - reading file/s, file .*/testdir/, file ..../testdir/,' \
+ ${testname}.help > ${testname}-test2.help
+cmp -s ${testname}-base2.help ${testname}-test2.help || \
+ failure "`diff ${testname}-base2.help ${testname}-test2.help`"
+
+echo 'gamma Yes' > .test_equivrc
+
+cat > ${testname}-base.out2 <<_EOF_
+=== -o opt ===
+OPTION_CT=2
+export OPTION_CT
+TEST_EQUIV_OPTION='opt'
+export TEST_EQUIV_OPTION
+TEST_EQUIV_ALPHA_MODE='GAMMA'
+export TEST_EQUIV_ALPHA_MODE
+TEST_EQUIV_GAMMA='true'
+export TEST_EQUIV_GAMMA
+=== --gamma Yes! ===
+OPTION_CT=2
+export OPTION_CT
+TEST_EQUIV_ALPHA_MODE='GAMMA'
+export TEST_EQUIV_ALPHA_MODE
+TEST_EQUIV_GAMMA='true'
+export TEST_EQUIV_GAMMA
+=== --gamma false ===
+OPTION_CT=2
+export OPTION_CT
+TEST_EQUIV_ALPHA_MODE='GAMMA'
+export TEST_EQUIV_ALPHA_MODE
+TEST_EQUIV_GAMMA='false'
+export TEST_EQUIV_GAMMA
+=== --omega tres ===
+OPTION_CT=2
+export OPTION_CT
+TEST_EQUIV_ALPHA_MODE='OMEGA'
+export TEST_EQUIV_ALPHA_MODE
+TEST_EQUIV_OMEGA='tres'
+export TEST_EQUIV_OMEGA
+_EOF_
+
+( set -e
+ echo === -o opt ===
+ ./${testname} -o opt
+ echo === --gamma Yes! ===
+ ./${testname} --gamma Yes!
+ echo === --gamma false ===
+ ./${testname} --gamma false
+ echo === --omega tres ===
+ ./${testname} --omega tres ) > ${testname}.out2
+
+cmp -s ${testname}-base.out2 ${testname}.out2 || \
+ failure "`
+ diff -c ${testname}-base.out2 ${testname}.out2`"
+
+./${testname} --omega tres --beta 12 2>/dev/null && \
+ failure "${testname}-2 ERROR: conflicting options accepted"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of equiv.test
diff --git a/autoopts/test/errors.test b/autoopts/test/errors.test
new file mode 100755
index 0000000..89f508e
--- /dev/null
+++ b/autoopts/test/errors.test
@@ -0,0 +1,232 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# errors.test --- test argument program attribute
+# make sure that when it is not specified
+# then option processing consumes all args.
+#
+# Time-stamp: "2011-08-07 17:37:02 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating ${testname}.def in `pwd`"
+
+testname="${testname}" \
+test_main="${test_main}" \
+argument="arg ..." \
+long_opts="yes" \
+${SHELLX} ${stdopts} option second:fumble ignored || \
+ failure "Could not run stdopts.def"
+
+echo 'reorder-args;' >> ${testname}.def
+${SED} -e '/"second"/a\
+ must-set;' \
+ -e '/"ignored"/a\
+ omitted-usage = "we have dumped this"; ifdef = IGNORE_THIS;' \
+ ${testname}.def > ${testname}.tmp
+mv -f ${testname}.tmp ${testname}.def
+echo "homerc = ${testname}RC;" >> ${testname}.def
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+mkdir ${testname}RC
+compile "--help"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+echo creating ${testname}.res-help
+clean_help > ${testname}.res-help <<'_EOF_'
+test_errors - Test AutoOpts for errors
+USAGE: errors [ -<flag> [<val>] | --<name>[{=| }<val>] ]... arg ...
+ Flg Arg Option-Name Description
+ -o no option The option option descrip
+ -s Str second The second option descrip
+ -i --- ignored we have dumped this
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+Operands and options may be intermixed. They will be reordered.
+
+The following option preset mechanisms are supported:
+ - reading file errorsRC/.test_errorsrc
+_EOF_
+
+clean_help > ${testname}.ignored-expected <<\_EOF_
+errors: The ``ignored'' option has been disabled -- we have dumped this
+test_errors - Test AutoOpts for errors
+USAGE: errors [ -<flag> [<val>] | --<name>[{=| }<val>] ]... arg ...
+ Flg Arg Option-Name Description
+ -o no option The option option descrip
+ -s Str second The second option descrip
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+Operands and options may be intermixed. They will be reordered.
+_EOF_
+
+dir=`pwd -P` || dir=`pwd`
+${SED} "s#${dir}/##" ${testname}.help > ${testname}.bas-help
+cmp -s ${testname}.*-help || \
+ failure "help output: `diff ${testname}.*-help`"
+
+./${testname} -s foo -o -s bar 2> /dev/null && \
+ failure ${testname} should not accept multiple options
+
+./${testname} -o -s foo > /dev/null 2>&1 && \
+ failure ${testname} must have arguments
+
+./${testname} -o -s foo mumble > /dev/null || \
+ failure ${testname} stumbled somehow
+
+./${testname} -o > /dev/null 2>&1 && \
+ failure ${testname} "'option'" must have argument
+
+./${testname} -o mumble > /dev/null 2>&1 && \
+ failure ${testname} must have second argument
+
+echo "second bumble" > ${testname}RC/.test_errorsrc
+./${testname} -o mumble > /dev/null || \
+ failure ${testname} did not see errorsRC/.test_errorsrc
+
+./${testname} --ignored > ${testname}.ignored 2>&1 && \
+ failure "${testname} accepted --ignored"
+
+clean_help < ${testname}.ignored > ${testname}.ignored-result
+cmp -s ${testname}.ignored-* || \
+ failure "${testname}.ignored error: `diff ${testname}.ignored-*`"
+
+mv ${testname}RC/.test_errorsrc ${testname}RC/test_errors.rc
+./${testname} --load=${testname}RC/test_errors.rc -o mumble > /dev/null || \
+ failure ${testname} did not see errorsRC/test_errors.rc
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "allow_errors;" >> ${testname}.def
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process allow-errors
+
+compile "--help"
+
+${SED} "s#${dir}/##" ${testname}.help > ${testname}.bas-help
+cmp -s ${testname}.*-help || \
+ failure "help output: `diff ${testname}.*-help`"
+
+# This time, having a duplicate should be ignored...
+#
+./${testname} -s foo -o -s bar mumble 2> /dev/null 1>&2 || \
+ failure ${testname} should not object to multiple options
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+${SED} '/second option/a\
+ max = "10";' ${testname}.def > XX
+mv -f XX ${testname}.def
+cat >> ${testname}.def << '_EOF_'
+flag = {
+ name = "another";
+ max = '5';
+ descrip = "Another option descrip";
+ value = 'X';
+};
+
+_EOF_
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process gnu-usage
+
+compile "--help"
+
+# # # # # # # # # # SORTED ARGS OUTPUT FILE # # # # # # # # #
+test -n "${POSIXLY_CORRECT}" && {
+ POSIXLY_CORRECT=''
+ unset POSIXLY_CORRECT
+}
+
+echo creating ${testname}-sh.samp
+cat > ${testname}-sh.samp <<'_EOF_'
+OPTION_CT=4
+export OPTION_CT
+TEST_ERRORS_OPTION=1 # 0x1
+export TEST_ERRORS_OPTION
+TEST_ERRORS_SECOND='foo'
+export TEST_ERRORS_SECOND
+TEST_ERRORS_ANOTHER=1 # 0x1
+export TEST_ERRORS_ANOTHER
+set -- 'mum'\''ble' '-X' 'stumble'
+OPTION_CT=0
+_EOF_
+
+./${testname} "mum'ble" -os foo -X -- -X stumble > ${testname}-sh.out
+
+cmp -s ${testname}-sh.out ${testname}-sh.samp || \
+ failure "`diff ${testname}-sh.samp ${testname}-sh.out`"
+
+cat >> ${testname}.def << '_EOF_'
+flag = {
+ name = "still-another";
+ ifdef = true ; ifndef = false;
+ descrip = "Another option descrip";
+ value = 'Y';
+};
+_EOF_
+
+case "${BASH_VERSION}" in
+not-good-enough )
+ echo "You are running Solaris without bash available."
+ echo "duplicate option flags cannot be tested."
+ ;;
+
+* )
+ ${SED} '/ value /s/Y/X/;s/ ifndef =.*//' ${testname}.def > ${testname}-2.def
+ ${AG_L} ${testname}-2.def && \
+ failure AutoGen processed conflicting flag values
+ ;;
+esac
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of errors.test
diff --git a/autoopts/test/getopt.test b/autoopts/test/getopt.test
new file mode 100755
index 0000000..383c6fc
--- /dev/null
+++ b/autoopts/test/getopt.test
@@ -0,0 +1,668 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+#
+# getopt.test --- test getopt_long argument processing
+#
+# Time-stamp: "2012-05-12 19:54:26 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+#
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+
+. ./defs
+
+set -x
+PS4='>${FUNCNAME:-go}> '
+
+CC="${CC} ${CFLAGS} ${INC}"
+CFLAGS=''
+INC=''
+export AUTOGEN_TEMPL_DIRS=${TMPDIR}
+
+compile_getopt() {
+ run_ag opts -b${testname}-bn ${testname}.def || \
+ failure "AutoGen could not process ${testname}.def #${1}"
+
+ # Remove the variable comments so we can test against the expected result
+ #
+ ${SED} '2,/and the template file/d
+ /\$''Id.*\$/d
+ /Last template edit:/d' getopt-test_${testname}.c \
+ > ${testname}${1}-getopt.c
+
+ # Finally, compile this thing:
+ #
+ ${CC} ${CFLAGS} -c ${testname}${1}-getopt.c || \
+ failure "could not compile ${testname}1-getopt.c"
+
+ ${SED} "${sed_omit_license}"'
+ /Packaged by /d
+ s@^Report .* bugs to.*"@\\n"@
+ s@^please send bug.*"@\\n"@
+ s@\\n\\n\\n\\$@\\n\\n\\@
+ s@\(and the flag character\.\\n.\)n\\$@\1@' ${testname}${1}-getopt.c \
+ > ${testname}${1}-res.c
+ cmp -s ${testname}${1}-base.c ${testname}${1}-res.c || { set +x ; \
+ failure "`diff -c ${testname}${1}-base.c ${testname}${1}-res.c`" ; }
+}
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+#
+# Fix up a test-specific include directory:
+#
+# The getopt template presumes that everything has been installed.
+# However, we have to work with the local stuff. So, remove the
+# "autoopts-config" probing and replace with local stuff:
+#
+go_init()
+{
+ mkdir -p ${TMPDIR}/autoopts
+
+ CFLAGS="-I${TMPDIR}"
+ LDFLAGS="${LDFLAGS} ${LIB}"
+ export CFLAGS LDFLAGS TMPDIR
+
+ aolib=`find ${top_builddir}/autoopts -type f -name libopts.a`
+ case " ${LDFLAGS} " in
+ *' -lgen '* ) aolib=${aolib}\ -lgen ;;
+ esac
+
+ cd ${top_srcdir}/autoopts/tpl
+ cp *.* ${TMPDIR}/.
+ chmod u+w ${TMPDIR}/*
+
+ cd ${top_builddir}/autoopts/tpl
+ cp *.* ${TMPDIR}/.
+ chmod u+w ${TMPDIR}/*
+
+ cd ${builddir}/testdir
+ ${SED} -e "/^cflags=/s@=.*@='-I${TMPDIR}/autoopts -I${top_builddir}'@" \
+ -e "/^ldflags=/s@=.*@='${aolib}'@" \
+ ${TMPDIR}/usage.tlib > ${TMPDIR}/usage.tlib-XX
+ mv -f ${TMPDIR}/usage.tlib-XX ${TMPDIR}/usage.tlib
+
+ # In order to compile correctly, we have to temporarily install the options.h
+ # header in our TMPDIR. We also must find that header first. Tweak CFLAGS:
+ #
+ DESTdestdir=${TMPDIR}/autoopts \
+ top_builddir=${top_builddir} \
+ CONFIG_SHELL="${SHELL}" \
+ ${SHELLX} -x ${top_srcdir}/autoopts/install-hook.sh
+ AUTOGEN_TEMPL_DIRS=${TMPDIR}
+ export AUTOGEN_TEMPL_DIRS
+}
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+go_samples() {
+
+echo "creating ${testname}.def in `pwd`"
+
+cat >> ${testname}.def <<_EOF_
+AutoGen definitions getopt;
+
+prog-name = "test_${testname}";
+prog-title = "Test AutoOpts for ${testname}";
+test-main = 'yes';
+config-header = 'config.h';
+
+settable;
+version = '1.2.3';
+help-value = 'h';
+gnu-usage;
+no-libopts;
+
+copyright = {
+ date = "2003-2012";
+ owner = "Odyssey Computing Concepts, Inc.";
+ author= "Bruce Korb";
+ eaddr = "bkorb@gnu.org";
+ type = lgpl;
+};
+
+flag = {
+ name = "option";
+ descrip = "The option option descrip";
+ value = 'o';
+ arg_type = string; arg_default = 'opt init';
+};
+
+flag = {
+ name = "second";
+ descrip = "The second option descrip";
+ value = 's';
+ arg_type = string; arg_default = '020';
+};
+
+flag = {
+ name = no_val;
+ descrip = 'option with no flag';
+ value = 'F'; /* REMOVE */
+ flags-must = max_val;
+};
+
+flag = {
+ name = max_val;
+ descrip = 'option with max ct';
+ value = 'X'; /* REMOVE */
+ max = '5';
+};
+
+flag = {
+ name = min2_val;
+ descrip = 'option with min ct';
+ value = 'M'; /* REMOVE */
+ max = '50';
+ flags-cant = max_val;
+ min = '5';
+};
+
+flag = {
+ name = min_val;
+ descrip = 'option with min ct';
+ value = '2'; /* REMOVE */
+ max = '50';
+ min = '5';
+};
+_EOF_
+
+# # # # # # # # # # BASE-1 OUTPUT FILE # # # # # # # # #
+
+echo creating ${testname}1-base.c
+
+cat > ${testname}1-base.c <<\_EndOfSample_
+#include "getopt-test_getopt.h"
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include "getopt-bn.h"
+
+#ifndef DIRCH
+# if defined(_WIN32) && !defined(__CYGWIN__)
+# define DIRCH '\\'
+# else
+# define DIRCH '/'
+# endif
+#endif
+/*
+ * Option flag character list
+ */
+static char z_opts[] = "o:s:FXM2hv";
+
+/*
+ * AutoOpts library replacement routines:
+ */
+void
+optionUsage (tOptions* pOptions, int status)
+{
+ if (status != 0)
+ fprintf (stderr, _("Try `%s -h' for more information.\n"),
+ test_getoptOptions.pzProgName);
+ else
+ {
+ fputs (_("test_getopt - Test AutoOpts for getopt - Ver. 1.2.3\n\
+USAGE: test_getopt { -<flag> [<val>] }...\n\n\
+ -o str The option option descrip\n\
+ -s str The second option descrip\n\
+ -F option with no flag\n\
+ -X option with max ct\n\
+ -M option with min ct\n\
+ -2 option with min ct\n\
+ -v Output version information and exit\n\
+ -h Display extended usage information and exit\n\n\
+\n"), stdout);
+ }
+
+ exit (status);
+}
+
+void
+optionPrintVersion(
+ tOptions* pOptions,
+ tOptDesc* pOptDesc )
+{
+ char const * pz_by =
+ _("test_getopt 1.2.3\n\
+Written by Bruce Korb.\n\n\
+copyright (c) 2003-2012 Odyssey Computing Concepts, Inc.\n\
+This is free software; see the source for copying conditions. There is NO\n\
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
+
+ fputs (pz_by, stdout);
+ exit (EXIT_SUCCESS);
+}
+
+/*
+ * If an option appears more often than is allowed, ...
+ */
+static void
+usage_too_many (tOptDesc* pOptDesc)
+{
+ char const * pz =
+ _("test_getopt error: the '%s' option appears more than %d times\n");
+ fprintf (stderr, pz, pOptDesc->pz_Name, pOptDesc->optMaxCt);
+ USAGE(EXIT_FAILURE);
+}
+
+/*
+ * There is at least one option that must appear.
+ */
+static void
+usage_too_few (tOptDesc* pOptDesc)
+{
+ char const * pz =
+ _("test_getopt error: the '%s' option must appear %d times\n");
+ fprintf (stderr, pz, pOptDesc->pz_Name, pOptDesc->optMinCt);
+ USAGE(EXIT_FAILURE);
+}
+
+/*
+ * There is at least one pair of options that may not appear together
+ * on the command line.
+ */
+static void
+usage_cannot (char const* pz_what, char const* pz_cant)
+{
+ char const * pz =
+ _("test_getopt error: the `%s' option conflicts with the `%s' option.\n");
+ fprintf (stderr, pz, pz_what, pz_cant);
+ USAGE(EXIT_FAILURE);
+}
+
+/*
+ * There is at least one pair of options that are required to appear
+ * together on the command line.
+ */
+static void
+usage_must (char const* pz_what, char const* pz_must)
+{
+ char const * pz =
+ _("test_getopt error: the `%s' option requires the `%s' option.\n");
+ fprintf (stderr, pz, pz_what, pz_must);
+ USAGE(EXIT_FAILURE);
+}
+
+/*
+ * Process the options for the "test_getopt" program.
+ * This function was generated to use the getopt(3posix) function.
+ * There are 8 options for this program,
+ * including "help (usage)" and "version".
+ */
+int
+process_test_getopt_opts (int argc, char** argv)
+{
+ {
+ char * pz_prog = strrchr (argv[0], DIRCH);
+ /*
+ * This violates the const-ness of the pzProgName field.
+ * The const-ness is to prevent accidents. This is not accidental.
+ */
+ char ** pp = (char **)(void *)&(test_getoptOptions.pzProgName);
+
+ if (pz_prog != NULL)
+ pz_prog++;
+ else
+ pz_prog = argv[0];
+ *pp = pz_prog;
+ }
+
+ for (;;) {
+ switch (getopt (argc, argv, z_opts)) {
+ case -1: goto leave_processing;
+ case 0: break;
+
+ case VALUE_OPT_OPTION:
+ if (HAVE_OPT( OPTION ))
+ usage_too_many (&DESC(OPTION));
+ SET_OPT_OPTION(optarg);
+ break;
+
+ case VALUE_OPT_SECOND:
+ if (HAVE_OPT( SECOND ))
+ usage_too_many (&DESC(SECOND));
+ SET_OPT_SECOND(optarg);
+ break;
+
+ case VALUE_OPT_NO_VAL:
+ if (HAVE_OPT( NO_VAL ))
+ usage_too_many (&DESC(NO_VAL));
+ SET_OPT_NO_VAL;
+ break;
+
+ case VALUE_OPT_MAX_VAL:
+ if (DESC(MAX_VAL).optOccCt++ >= DESC(MAX_VAL).optMaxCt)
+ usage_too_many (&DESC(MAX_VAL));
+ SET_OPT_MAX_VAL;
+ break;
+
+ case VALUE_OPT_MIN2_VAL:
+ if (DESC(MIN2_VAL).optOccCt++ >= DESC(MIN2_VAL).optMaxCt)
+ usage_too_many (&DESC(MIN2_VAL));
+ SET_OPT_MIN2_VAL;
+ break;
+
+ case VALUE_OPT_MIN_VAL:
+ if (DESC(MIN_VAL).optOccCt++ >= DESC(MIN_VAL).optMaxCt)
+ usage_too_many (&DESC(MIN_VAL));
+ SET_OPT_MIN_VAL;
+ break;
+
+ case VALUE_OPT_HELP:
+ USAGE(EXIT_SUCCESS);
+ /* NOTREACHED */
+
+ case VALUE_OPT_VERSION:
+ optionPrintVersion (&test_getoptOptions, &DESC(VERSION));
+ /* NOTREACHED */
+
+ default:
+ USAGE(EXIT_FAILURE);
+ }
+ } leave_processing:;
+
+ if (HAVE_OPT( NO_VAL )) {
+ if (! HAVE_OPT( MAX_VAL ))
+ usage_must (DESC(NO_VAL).pz_Name, DESC(MAX_VAL).pz_Name);
+ }
+
+ if (HAVE_OPT( MIN2_VAL )) {
+ if (HAVE_OPT( MAX_VAL ))
+ usage_cannot (DESC(MIN2_VAL).pz_Name, DESC(MAX_VAL).pz_Name);
+ if (DESC(MIN2_VAL).optOccCt < DESC(MIN2_VAL).optMinCt)
+ usage_too_few (&DESC(MIN2_VAL));
+ }
+ else
+ usage_too_few (&DESC(MIN2_VAL));
+
+ if (DESC(MIN_VAL).optOccCt < DESC(MIN_VAL).optMinCt)
+ usage_too_few (&DESC(MIN_VAL));
+
+ return 0;
+}
+_EndOfSample_
+
+# # # # # # # # # # BASE-2 OUTPUT FILE # # # # # # # # #
+
+echo creating ${testname}2-base.c
+
+cat > ${testname}2-base.c <<\_EndOfSample_
+#include "getopt-test_getopt.h"
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <getopt.h>
+#include "getopt-bn.h"
+
+#ifndef DIRCH
+# if defined(_WIN32) && !defined(__CYGWIN__)
+# define DIRCH '\\'
+# else
+# define DIRCH '/'
+# endif
+#endif
+
+/*
+ * getopt_long option descriptor
+ */
+static struct option a_long_opts[] = {
+ { "option", 1, NULL, VALUE_OPT_OPTION },
+ { "second", 1, NULL, VALUE_OPT_SECOND },
+ { "no_val", 0, NULL, VALUE_OPT_NO_VAL },
+ { "max_val", 0, NULL, VALUE_OPT_MAX_VAL },
+ { "min2_val", 0, NULL, VALUE_OPT_MIN2_VAL },
+ { "min_val", 0, NULL, VALUE_OPT_MIN_VAL },
+ { "help", 0, NULL, VALUE_OPT_HELP },
+ { "version", 0, NULL, VALUE_OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/*
+ * Option flag character list
+ */
+static char z_opts[] = "o:s:h";
+
+/*
+ * AutoOpts library replacement routines:
+ */
+void
+optionUsage (tOptions* pOptions, int status)
+{
+ if (status != 0)
+ fprintf (stderr, _("Try `%s --help' for more information.\n"),
+ test_getoptOptions.pzProgName);
+ else
+ {
+ fputs (_("test_getopt - Test AutoOpts for getopt - Ver. 1.2.3\n\
+USAGE: test_getopt { -<flag> [<val>] | --<name>[{=| }<val>] }...\n\n\
+ -o, --option=str The option option descrip\n\
+ -s, --second=str The second option descrip\n\
+ --no-val option with no flag\n\
+ --max-val option with max ct\n\
+ --min2-val option with min ct\n\
+ --min-val option with min ct\n\
+ --version Output version information and exit\n\
+ -h, --help Display extended usage information and exit\n\n\
+Options are specified by doubled hyphens and their name or by a single\n\
+hyphen and the flag character.\n\
+\n"), stdout);
+ }
+
+ exit (status);
+}
+
+void
+optionPrintVersion(
+ tOptions* pOptions,
+ tOptDesc* pOptDesc )
+{
+ char const * pz_by =
+ _("test_getopt 1.2.3\n\
+Written by Bruce Korb.\n\n\
+copyright (c) 2003-2012 Odyssey Computing Concepts, Inc.\n\
+This is free software; see the source for copying conditions. There is NO\n\
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
+
+ fputs (pz_by, stdout);
+ exit (EXIT_SUCCESS);
+}
+
+/*
+ * If an option appears more often than is allowed, ...
+ */
+static void
+usage_too_many (tOptDesc* pOptDesc)
+{
+ char const * pz =
+ _("test_getopt error: the '%s' option appears more than %d times\n");
+ fprintf (stderr, pz, pOptDesc->pz_Name, pOptDesc->optMaxCt);
+ USAGE(EXIT_FAILURE);
+}
+
+/*
+ * There is at least one option that must appear.
+ */
+static void
+usage_too_few (tOptDesc* pOptDesc)
+{
+ char const * pz =
+ _("test_getopt error: the '%s' option must appear %d times\n");
+ fprintf (stderr, pz, pOptDesc->pz_Name, pOptDesc->optMinCt);
+ USAGE(EXIT_FAILURE);
+}
+
+/*
+ * There is at least one pair of options that may not appear together
+ * on the command line.
+ */
+static void
+usage_cannot (char const* pz_what, char const* pz_cant)
+{
+ char const * pz =
+ _("test_getopt error: the `%s' option conflicts with the `%s' option.\n");
+ fprintf (stderr, pz, pz_what, pz_cant);
+ USAGE(EXIT_FAILURE);
+}
+
+/*
+ * There is at least one pair of options that are required to appear
+ * together on the command line.
+ */
+static void
+usage_must (char const* pz_what, char const* pz_must)
+{
+ char const * pz =
+ _("test_getopt error: the `%s' option requires the `%s' option.\n");
+ fprintf (stderr, pz, pz_what, pz_must);
+ USAGE(EXIT_FAILURE);
+}
+
+/*
+ * Process the options for the "test_getopt" program.
+ * This function was generated to use the getopt_long(3GNU) function.
+ * There are 8 options for this program,
+ * including "help (usage)" and "version".
+ */
+int
+process_test_getopt_opts (int argc, char** argv)
+{
+ {
+ char * pz_prog = strrchr (argv[0], DIRCH);
+ /*
+ * This violates the const-ness of the pzProgName field.
+ * The const-ness is to prevent accidents. This is not accidental.
+ */
+ char ** pp = (char **)(void *)&(test_getoptOptions.pzProgName);
+
+ if (pz_prog != NULL)
+ pz_prog++;
+ else
+ pz_prog = argv[0];
+ *pp = pz_prog;
+ }
+
+ for (;;) {
+ switch (getopt_long (argc, argv, z_opts, a_long_opts, NULL)) {
+ case -1: goto leave_processing;
+ case 0: break;
+
+ case VALUE_OPT_OPTION:
+ if (HAVE_OPT( OPTION ))
+ usage_too_many (&DESC(OPTION));
+ SET_OPT_OPTION(optarg);
+ break;
+
+ case VALUE_OPT_SECOND:
+ if (HAVE_OPT( SECOND ))
+ usage_too_many (&DESC(SECOND));
+ SET_OPT_SECOND(optarg);
+ break;
+
+ case VALUE_OPT_NO_VAL:
+ if (HAVE_OPT( NO_VAL ))
+ usage_too_many (&DESC(NO_VAL));
+ SET_OPT_NO_VAL;
+ break;
+
+ case VALUE_OPT_MAX_VAL:
+ if (DESC(MAX_VAL).optOccCt++ >= DESC(MAX_VAL).optMaxCt)
+ usage_too_many (&DESC(MAX_VAL));
+ SET_OPT_MAX_VAL;
+ break;
+
+ case VALUE_OPT_MIN2_VAL:
+ if (DESC(MIN2_VAL).optOccCt++ >= DESC(MIN2_VAL).optMaxCt)
+ usage_too_many (&DESC(MIN2_VAL));
+ SET_OPT_MIN2_VAL;
+ break;
+
+ case VALUE_OPT_MIN_VAL:
+ if (DESC(MIN_VAL).optOccCt++ >= DESC(MIN_VAL).optMaxCt)
+ usage_too_many (&DESC(MIN_VAL));
+ SET_OPT_MIN_VAL;
+ break;
+
+ case VALUE_OPT_HELP:
+ USAGE(EXIT_SUCCESS);
+ /* NOTREACHED */
+
+ case VALUE_OPT_VERSION:
+ optionPrintVersion (&test_getoptOptions, &DESC(VERSION));
+ /* NOTREACHED */
+
+ default:
+ USAGE(EXIT_FAILURE);
+ }
+ } leave_processing:;
+
+ if (HAVE_OPT( NO_VAL )) {
+ if (! HAVE_OPT( MAX_VAL ))
+ usage_must (DESC(NO_VAL).pz_Name, DESC(MAX_VAL).pz_Name);
+ }
+
+ if (HAVE_OPT( MIN2_VAL )) {
+ if (HAVE_OPT( MAX_VAL ))
+ usage_cannot (DESC(MIN2_VAL).pz_Name, DESC(MAX_VAL).pz_Name);
+ if (DESC(MIN2_VAL).optOccCt < DESC(MIN2_VAL).optMinCt)
+ usage_too_few (&DESC(MIN2_VAL));
+ }
+ else
+ usage_too_few (&DESC(MIN2_VAL));
+
+ if (DESC(MIN_VAL).optOccCt < DESC(MIN_VAL).optMinCt)
+ usage_too_few (&DESC(MIN_VAL));
+
+ return 0;
+}
+_EndOfSample_
+}
+
+# # # # # # # # # # RESULTS TESTING # # # # # # # # #
+
+go_init
+go_samples
+compile_getopt 1
+
+${GREP} 'getopt_long' /usr/include/getopt.h >/dev/null && {
+ CFLAGS="${CFLAGS} -D_GNU_SOURCE=1"
+ ${SED} '/REMOVE/d;$a\
+long-opts;\
+version-value;
+' ${testname}.def > ${testname}2.def
+ mv -f ${testname}2.def ${testname}.def
+
+ compile_getopt 2
+}
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# end of getopt.test
diff --git a/autoopts/test/handler.test b/autoopts/test/handler.test
new file mode 100755
index 0000000..ac7d4a4
--- /dev/null
+++ b/autoopts/test/handler.test
@@ -0,0 +1,254 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# handler.test --- test option handling
+# make sure that when it is not specified
+# then option processing consumes all args.
+#
+# Time-stamp: "2012-08-11 08:14:34 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating ${testname}.def in `pwd`"
+cat > ${testname}.def <<_EOF_
+AutoGen Definitions options;
+prog-name = ${testname};
+prog-title = "Testing ${testname}";
+
+flag = {
+ name = first;
+ descrip = "first description";
+ extract_code;
+};
+
+flag = {
+ name = second;
+ descrip = "second description";
+ arg-type = keyword;
+ keyword = alpha, beta, gamma, omega;
+};
+
+flag = {
+ name = third;
+ descrip = "third description";
+ flag_code = " SomeCodeOrOther();";
+};
+
+flag = {
+ name = fourth;
+ descrip = "fourth description";
+ arg-type = keyword;
+ keyword = alpha, beta, gamma, omega;
+ arg-default = gamma;
+ arg-optional;
+};
+
+flag = {
+ name = fifth;
+ descrip = "fifth description";
+ flag_proc = first;
+};
+
+flag = {
+ name = sixth;
+ descrip = "sixth description";
+ arg-type = set-member;
+ keyword = alpha, beta, gamma, omega;
+ arg-default = gamma, beta;
+};
+_EOF_
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+${SED} '/START =/a\
+SampleCode();\
+XXX-REMOVE-XXX' ${testname}.c > ${testname}.tmp
+chmod 644 ${testname}.c
+${SED} -e '/^XXX-REMOVE-XXX$/d;s/XXX-REMOVE-XXX//' \
+ ${testname}.tmp > ${testname}.c
+
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+# We are testing to ensure the procedures are created correctly.
+# The template line numbers and time stamps and all that cruft
+# vary too much, so sed them away.
+#
+${SED} -e '1,/Create the static procedure(s) declared above/d' \
+ -e '/extracted from.*near line/d' \
+ -e '/^#line/d' \
+ -e 's@handler_opt_strs+[0-9]*@handler_opt_strs+NNN@g' \
+ -e 's@+NNN, *@+NNN, @g' \
+ -e '/^#ifndef *PKGDATADIR/,$d' \
+ ${testname}.c > ${testname}.test
+
+# # # # # # # # # # SAMPLE OUTPUT FILE # # # # # # # # #
+
+echo creating ${testname}.sample
+cat > ${testname}.sample <<\_EOF_
+ */
+/**
+ * The callout function that invokes the optionUsage function.
+ *
+ * @param pOptions the AutoOpts option description structure
+ * @param pOptDesc the descriptor for the "help" (usage) option.
+ * @noreturn
+ */
+static void
+doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
+{
+ optionUsage(&handlerOptions, HANDLER_EXIT_SUCCESS);
+ /* NOTREACHED */
+ (void)pOptDesc;
+ (void)pOptions;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the first option.
+ *
+ * @param pOptions the handler options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptFirst(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+/* START =-= First Opt Code =-= DO NOT CHANGE THIS COMMENT */
+SampleCode();
+/* END =-= First Opt Code =-= DO NOT CHANGE THIS COMMENT */
+ (void)pOptDesc;
+ (void)pOptions;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the second option.
+ *
+ * @param pOptions the handler options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptSecond(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+
+ static char const zDef[2] = { 0x7F, 0 };
+ static char const * const azNames[5] = { zDef,
+ handler_opt_strs+NNN, handler_opt_strs+NNN, handler_opt_strs+NNN,
+ handler_opt_strs+NNN };
+
+ if (pOptions <= OPTPROC_EMIT_LIMIT) {
+ (void) optionEnumerationVal(pOptions, pOptDesc, azNames, 5);
+ return; /* protect AutoOpts client code from internal callbacks */
+ }
+
+ pOptDesc->optArg.argEnum =
+ optionEnumerationVal(pOptions, pOptDesc, azNames, 5);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the third option.
+ *
+ * @param pOptions the handler options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptThird(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ /* extracted from handler.def, line 21 */
+ SomeCodeOrOther();
+ (void)pOptDesc;
+ (void)pOptions;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the fourth option.
+ *
+ * @param pOptions the handler options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptFourth(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+
+ static char const * const azNames[4] = {
+ handler_opt_strs+NNN, handler_opt_strs+NNN, handler_opt_strs+NNN,
+ handler_opt_strs+NNN };
+
+ if (pOptions <= OPTPROC_EMIT_LIMIT) {
+ (void) optionEnumerationVal(pOptions, pOptDesc, azNames, 4);
+ return; /* protect AutoOpts client code from internal callbacks */
+ }
+
+ if (pOptDesc->optArg.argString == NULL)
+ pOptDesc->optArg.argEnum = FOURTH_GAMMA;
+ else
+ pOptDesc->optArg.argEnum =
+ optionEnumerationVal(pOptions, pOptDesc, azNames, 4);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the sixth option.
+ *
+ * @param pOptions the handler options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptSixth(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+
+ static char const * const azNames[4] = {
+ "alpha", "beta", "gamma", "omega"
+ };
+ /*
+ * This function handles special invalid values for "pOptions"
+ */
+ optionSetMembers(pOptions, pOptDesc, azNames, 4);
+}
+
+/**
+ * The directory containing the data associated with handler.
+ */
+_EOF_
+
+cmp -s ${testname}.test ${testname}.sample || {
+ failure "`diff -c ${testname}.test ${testname}.sample`" ; }
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of handler.test
diff --git a/autoopts/test/immediate.test b/autoopts/test/immediate.test
new file mode 100755
index 0000000..c7edbce
--- /dev/null
+++ b/autoopts/test/immediate.test
@@ -0,0 +1,121 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# immediate.test --- test immediate option handling
+#
+# Time-stamp: "2012-01-29 13:33:03 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating ${testname}.def in `pwd`"
+
+cat > ${testname}.def << _EOF_
+AutoGen definitions options;
+
+prog-name = "test_${testname}";
+prog-title = "Test AutoOpts for ${testname}";
+include = "#include <stdio.h>\nint invocation_ct = 0;";
+config-header = 'config.h';
+version = '1.0';
+copyright = {
+ date = "1992-2012";
+ owner = "Bruce Korb";
+ eaddr = "autogen-users@lists.sourceforge.net";
+ type = gpl;
+};
+
+flag = {
+ name = "second";
+ descrip = "The second option descrip";
+ immediate = also;
+ immed-disable = also;
+ disable = not;
+ arg-type = string;
+ flag-code = " invocation_ct++;";
+};
+
+main = {
+ main-type = main;
+ main-text = ' printf( "invocation_ct = %d\\n", invocation_ct );';
+};
+
+_EOF_
+
+INC=`echo ${INC} | ${SED} 's/-lguile//;s/-lqthreads//'`
+CFLAGS="-g`echo ' '${CFLAGS}' ' | \
+ ${SED} 's, -O2 , ,;s/ -g[^ ]* / /'`"
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+sedcmd="/All arguments are named options./q"
+compile "help"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+echo creating ${testname}.hlp
+clean_help > ${testname}.hlp << '_EOF_'
+test_immediate - Test AutoOpts for immediate - Ver. 1.0
+USAGE: immediate [ <option-name>[{=| }<val>] ]...
+ Arg Option-Name Description
+ Str second The second option descrip
+ - disabled as --not-second
+ opt version Output version information and exit
+ no help Display extended usage information and exit
+ no more-help Extended usage information passed thru pager
+
+All arguments are named options.
+_EOF_
+
+cmp -s ${testname}.help ${testname}.hlp || { set +x ; \
+ failure "`diff -c ${testname}.hlp ${testname}.help`" ; }
+
+f=`./${testname} second=hand`
+test "$f" = "invocation_ct = 2" || \
+ failure "enabled option not processed twice"
+
+f=`./${testname} not-second`
+test "$f" = "invocation_ct = 2" || \
+ failure "DIS-abled option not processed twice"
+
+f=`./${testname} help version=c | ${FGREP} 'USAGE:'`
+test -z "${f}" && failure "no USAGE: in help text"
+
+f=`./${testname} version=c help | ${FGREP} -i 'copyright (c)'`
+test -z "${f}" && failure "no 'copyright (c)' in version text"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of immediate.test
diff --git a/autoopts/test/keyword.test b/autoopts/test/keyword.test
new file mode 100755
index 0000000..03b8720
--- /dev/null
+++ b/autoopts/test/keyword.test
@@ -0,0 +1,449 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# keyword.test --- keyword option processing
+#
+# Time-stamp: "2012-02-28 19:42:00 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating ${testname}.def in `pwd`"
+testname="${testname}" test_main="" \
+argument="${argument}" long_opts="yes" \
+${SHELLX} ${stdopts} option:'opt init' || failure "Could not run stdopts.def"
+cat >> ${testname}.def <<- _EndOfDef_
+ help_value = X;
+ homerc = '.';
+ rcfile = ${testname}.cfg;
+
+ flag = {
+ name = trace;
+ arg-type = keyword;
+ arg-default = nothing;
+ arg-name = level;
+ descrip = "tracing level of detail";
+ keyword = nothing, templates, block-macros, expressions,
+ explanations;
+ };
+
+ flag = {
+ name = sets;
+ arg-type = set-members;
+ arg-default = second, fourth;
+ arg-name = member-list;
+ descrip = "set membership testing";
+ keyword = first, second, third, fourth, fifth,
+ sixth, seventh, eighth, ninth, tenth,
+ eleventh, twelfth, thirteenth, fourteenth, fifteenth,
+ sixteenth, seventeenth, eighteenth;
+ };
+ main = { main-type = shell-process; };
+ _EndOfDef_
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+compile "-X"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+echo creating ${testname}.res-help
+clean_help > ${testname}.res-help <<\_EOF_
+test_keyword - Test AutoOpts for keyword
+USAGE: keyword [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ KWd trace tracing level of detail
+ Mbr sets set membership testing
+ - is a set membership option
+ -X no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+The following option preset mechanisms are supported:
+ - reading file ./keyword.cfg
+
+The valid "trace" option keywords are:
+ nothing templates block-macros expressions explanations
+ or an integer from 0 through 4
+The valid "sets" option keywords are:
+ first second third fourth fifth sixth
+ seventh eighth ninth tenth eleventh twelfth
+ thirteenth fourteenth fifteenth sixteenth seventeenth eighteenth
+ or an integer mask with any of the lower 18 bits set
+or you may use a numeric representation. Preceding these with a '!' will
+clear the bits, specifying 'none' will clear all bits, and 'all' will set them
+all. Multiple entries may be passed as an option argument list.
+_EOF_
+
+dir=`pwd -P` || dir=`pwd`
+${SED} "s#${dir}/##" ${testname}.help > ${testname}.bas-help
+cmp -s ${testname}.*-help || \
+ failure "help output: `diff ${testname}.*-help`"
+
+./${testname} --trace=exp > /dev/null 2>&1 && \
+ failure "${testname} accepted ambiguous keyword"
+
+./${testname} --trace=999 > /dev/null 2>&1 && \
+ failure "${testname} accepted too much tracing"
+
+./${testname} --trace=~0 > /dev/null 2>&1 || \
+ failure "${testname} would not accept max tracing"
+
+./${testname} --trace=expr --set=thirteen,ninth,third > ${testname}.t1-s || \
+ failure "${testname} did not handle its options"
+
+./${testname} --trace=expr --set=thirteen,ninth,third --save=${testname}.cfg || \
+ failure "${testname} could not save its options"
+
+${EGREP} -v '^#' ${testname}.cfg > ${testname}res.cfg || \
+ failure "${testname} could not create ${testname}.cfg"
+
+cat > ${testname}base.cfg <<- \_EndIni_
+ trace expressions
+ sets none + second + third + fourth + ninth + thirteenth
+ _EndIni_
+
+cmp -s ${testname}base.cfg ${testname}res.cfg || \
+ failure "`diff ${testname}base.cfg ${testname}res.cfg`"
+
+cat > ${testname}.t1-b <<- \_EndTst_
+ OPTION_CT=2
+ export OPTION_CT
+ TEST_KEYWORD_TRACE='expressions'
+ export TEST_KEYWORD_TRACE
+ TEST_KEYWORD_SETS=4366 # 0x110E
+ export TEST_KEYWORD_SETS
+ typeset -x -i SETS_FIRST=1 # 0x1
+ typeset -x -i SETS_SECOND=2 # 0x2
+ typeset -x -i SETS_THIRD=4 # 0x4
+ typeset -x -i SETS_FOURTH=8 # 0x8
+ typeset -x -i SETS_FIFTH=16 # 0x10
+ typeset -x -i SETS_SIXTH=32 # 0x20
+ typeset -x -i SETS_SEVENTH=64 # 0x40
+ typeset -x -i SETS_EIGHTH=128 # 0x80
+ typeset -x -i SETS_NINTH=256 # 0x100
+ typeset -x -i SETS_TENTH=512 # 0x200
+ typeset -x -i SETS_ELEVENTH=1024 # 0x400
+ typeset -x -i SETS_TWELFTH=2048 # 0x800
+ typeset -x -i SETS_THIRTEENTH=4096 # 0x1000
+ typeset -x -i SETS_FOURTEENTH=8192 # 0x2000
+ typeset -x -i SETS_FIFTEENTH=16384 # 0x4000
+ typeset -x -i SETS_SIXTEENTH=32768 # 0x8000
+ typeset -x -i SETS_SEVENTEENTH=65536 # 0x10000
+ typeset -x -i SETS_EIGHTEENTH=131072 # 0x20000
+ _EndTst_
+
+cmp -s ${testname}.t1-* || \
+ failure "`diff ${testname}.t1-*`"
+
+${AG_L} -T agman-cmd.tpl ${testname}.def
+test -f test_${testname}.1 || \
+ failure "'test_${testname}.1' was not produced"
+mv test_${testname}.1 ${testname}.1
+
+cat > ${testname}-base.1 <<\_EOMan_
+test_keyword \- Test AutoOpts for keyword
+.SH SYNOPSIS
+.B test_keyword
+.\" Mixture of short (flag) options and long options
+.RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \-\-\fIopt\-name\fP " [[=| ]\fIvalue\fP]]..."
+.PP
+All arguments must be options.
+.SH "DESCRIPTION"
+There is no description for this command.
+.SH "OPTIONS"
+.TP
+.BR \-o " \fIstring\fP, " \-\-option "=" \fIstring\fP
+The option option descrip.
+The default \fIstring\fP for this option is:
+.ti +4
+ opt init
+.sp
+This option has not been fully documented.
+.TP
+.BR \-\-trace "=\fIlevel\fP"
+tracing level of detail.
+This option takes a keyword as its argument. The argument sets an enumeration value that can
+be tested by comparing them against the option value macro.
+The available keywords are:
+.in +4
+.nf
+.na
+nothing templates block-macros
+expressions explanations
+.fi
+or their numeric equivalent.
+.in -4
+.sp
+The default \fIlevel\fP for this option is:
+.ti +4
+ nothing
+.sp
+This option has not been fully documented.
+.TP
+.BR \-\-sets "=\fImember\-list\fP"
+set membership testing.
+This option takes a keyword as its argument list. Each entry turns on or off
+membership bits. The bits are set by name or numeric value and cleared
+by preceding the name or number with an exclamation character ('!').
+They can all be cleared with the magic name \fInone\fR and they can all be set
+with
+.IR all .
+A single option will process a list of these values.
+The available keywords are:
+.in +4
+.nf
+.na
+first second third fourth
+fifth sixth seventh eighth
+ninth tenth eleventh twelfth
+thirteenth fourteenth fifteenth sixteenth
+seventeenth eighteenth
+.fi
+or their numeric equivalent.
+.in -4
+.sp
+The default \fImember\-list\fP for this option is:
+.ti +4
+ second + fourth
+.sp
+This option has not been fully documented.
+.TP
+.BR \-X , " \-\-help"
+Display usage information and exit.
+.TP
+.BR \-! , " \-\-more-help"
+Pass the extended usage information through a pager.
+.TP
+.BR \-> " [\fIrcfile\fP]," " \-\-save-opts" "[=\fIrcfile\fP]"
+Save the option state to \fIrcfile\fP. The default is the \fIlast\fP
+configuration file listed in the \fBOPTION PRESETS\fP section, below.
+.TP
+.BR \-< " \fIrcfile\fP," " \-\-load-opts" "=\fIrcfile\fP," " \-\-no-load-opts"
+Load options from \fIrcfile\fP.
+The \fIno-load-opts\fP form will disable the loading
+of earlier RC/INI files. \fI\-\-no-load-opts\fP is handled early,
+out of order.
+.SH "OPTION PRESETS"
+Any option that is not marked as \fInot presettable\fP may be preset
+by loading values from configuration ("RC" or ".INI") file(s).
+The file "\fI./keyword.cfg\fP" will be used, if present.
+.SH "FILES"
+See \fBOPTION PRESETS\fP for configuration files.
+.SH "EXIT STATUS"
+One of the following exit values will be returned:
+.TP
+.BR 0 " (EXIT_SUCCESS)"
+Successful program execution.
+.TP
+.BR 1 " (EXIT_FAILURE)"
+The operation failed or the command syntax was not valid.
+.TP
+.BR 66 " (EX_NOINPUT)"
+A specified configuration file could not be loaded.
+.TP
+.BR 70 " (EX_SOFTWARE)"
+libopts had an internal operational error. Please report
+it to autogen-users@lists.sourceforge.net. Thank you.
+.SH "NOTES"
+This manual page was \fIAutoGen\fP-erated from the \fBtest_keyword\fP
+option definitions.
+_EOMan_
+
+${SED} '1,/^\.SH NAME/d' ${testname}.1 > ${testname}-res.1
+cmp -s ${testname}-base.1 ${testname}-res.1 || \
+ failure "`diff ${testname}-base.1 ${testname}-res.1`"
+
+# # # # # # # # # # CHECK OUT MDOC # # # # # # # # # # #
+
+${AG_L} -T agmdoc-cmd.tpl ${testname}.def
+test -f test_${testname}.1 || \
+ failure "'test_${testname}.1' was not produced"
+mv test_${testname}.1 ${testname}.mdoc
+
+cat > ${testname}-base.mdoc <<\_EOMan_
+.Dt TEST_KEYWORD 1 User Commands
+.Sh NAME
+.Nm test_keyword
+.Nd Test AutoOpts for keyword
+.Sh SYNOPSIS
+.Nm
+.\" Mixture of short (flag) options and long options
+.Op Fl flags
+.Op Fl flag Ar value
+.Op Fl \-option-name Ar value
+.Pp
+All arguments must be options.
+.Pp
+.Sh "DESCRIPTION"
+There is no description for this command.
+.Sh "OPTIONS"
+.Bl -tag
+.It \-o " \fIstring\fP, " \-\-option "=" \fIstring\fP
+The option option descrip.
+The default \fIstring\fP for this option is:
+.ti +4
+ opt init
+.sp
+This option has not been fully documented.
+.It \-\-trace "=\fIlevel\fP"
+tracing level of detail.
+This option takes a keyword as its argument. The argument sets an enumeration value that can
+be tested by comparing them against the option value macro.
+The available keywords are:
+.in +4
+.nf
+.na
+nothing templates block-macros
+expressions explanations
+.fi
+or their numeric equivalent.
+.in -4
+.sp
+The default \fIlevel\fP for this option is:
+.ti +4
+ nothing
+.sp
+This option has not been fully documented.
+.It \-\-sets "=\fImember\-list\fP"
+set membership testing.
+This option takes a keyword as its argument list. Each entry turns on or off
+membership bits. The bits are set by name or numeric value and cleared
+by preceding the name or number with an exclamation character ('!').
+They can all be cleared with the magic name \fInone\fR and they can all be set
+with
+.IR all .
+A single option will process a list of these values.
+The available keywords are:
+.in +4
+.nf
+.na
+first second third fourth
+fifth sixth seventh eighth
+ninth tenth eleventh twelfth
+thirteenth fourteenth fifteenth sixteenth
+seventeenth eighteenth
+.fi
+or their numeric equivalent.
+.in -4
+.sp
+The default \fImember\-list\fP for this option is:
+.ti +4
+ second + fourth
+.sp
+This option has not been fully documented.
+.It \-X , " \-\-help"
+Display usage information and exit.
+.It \-! , " \-\-more-help"
+Pass the extended usage information through a pager.
+.It \-> " [\fIrcfile\fP]," " \-\-save-opts" "[=\fIrcfile\fP]"
+Save the option state to \fIrcfile\fP. The default is the \fIlast\fP
+configuration file listed in the \fBOPTION PRESETS\fP section, below.
+.It \-< " \fIrcfile\fP," " \-\-load-opts" "=\fIrcfile\fP," " \-\-no-load-opts"
+Load options from \fIrcfile\fP.
+The \fIno-load-opts\fP form will disable the loading
+of earlier RC/INI files. \fI\-\-no-load-opts\fP is handled early,
+out of order.
+.El
+.Sh "OPTION PRESETS"
+Any option that is not marked as \fInot presettable\fP may be preset
+by loading values from configuration ("RC" or ".INI") file(s).
+The file "\fI./keyword.cfg\fP" will be used, if present.
+.Sh "FILES"
+See \fBOPTION PRESETS\fP for configuration files.
+.Sh "EXIT STATUS"
+One of the following exit values will be returned:
+.Bl -tag
+.It 0 " (EXIT_SUCCESS)"
+Successful program execution.
+.It 1 " (EXIT_FAILURE)"
+The operation failed or the command syntax was not valid.
+.It 66 " (EX_NOINPUT)"
+A specified configuration file could not be loaded.
+.It 70 " (EX_SOFTWARE)"
+libopts had an internal operational error. Please report
+it to autogen-users@lists.sourceforge.net. Thank you.
+.El
+.Sh "NOTES"
+This manual page was \fIAutoGen\fP-erated from the \fBtest_keyword\fP
+option definitions.
+_EOMan_
+
+${SED} '/DO NOT EDIT/,/and the template file/d;/^\.Os /d;/^\.Dd /d' \
+ ${testname}.mdoc > ${testname}-res.mdoc
+cmp -s ${testname}-base.mdoc ${testname}-res.mdoc || \
+ failure "`diff ${testname}-base.mdoc ${testname}-res.mdoc`"
+
+# # # # # # # # # # CHECK OUT VAL2STR # # # # # # # # # # #
+
+exec 3> ${testname}_2.def
+${SED} '/^prog-name/s/";/_2";/;/^main *=/,$d' ${testname}.def >&3
+cat >&3 <<- \_EOF_
+ include = '#include <stdio.h>';
+ main = {
+ main-type = main;
+ main-text =
+ ' printf( "%s\n", OPT_TRACE_VAL2STR( OPT_VALUE_TRACE ));';
+ };
+ _EOF_
+exec 3>&-
+
+echo ${AG_L} ${testname}_2.def
+${AG_L} ${testname}_2.def || \
+ failure AutoGen could not process
+
+Csrc=${testname}_2
+Dnam=${Csrc}
+compile "-X" || failure "cannot compile ${testname}_2"
+
+val=`./${testname}_2 --trace=expr 2>&1` || \
+ failure "cannot run ${testname}_2"
+
+case "${val}" in
+expressions) : ;;
+* ) failure "${testname}_2 returned '${val}', not 'expressions':
+ ${testname}_2 --trace=expr" ;;
+esac
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of keyword.test
diff --git a/autoopts/test/library.test b/autoopts/test/library.test
new file mode 100755
index 0000000..f463e3e
--- /dev/null
+++ b/autoopts/test/library.test
@@ -0,0 +1,170 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# library.test --- test library options
+#
+# Time-stamp: "2013-03-10 07:14:58 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+DEND=\<\<'- _DESC_END_'
+
+cat > ${testname}-libopts.def <<- _EODefs_
+ flag = { name = zzyzx-opts;
+ documentation;
+ lib-name = zzyzx;
+ descrip = ${DEND}
+ This option introduces the options for the
+ zzyzx library
+ _DESC_END_;
+ };
+ flag = {
+ name = library;
+ value = c;
+ ifdef = LIBOPTS;
+ descrip = "library test";
+ doc = mumble;
+ };
+ _EODefs_
+
+cat > ${testname}-lib.def <<- _EODefs_
+
+ AutoGen definitions options;
+
+ prog-name = ${testname};
+ prog-title = lib-${testname};
+ config-header = 'config.h';
+
+ library;
+ #include ${testname}-libopts.def
+ _EODefs_
+
+cat > ${testname}-prog.def <<- _EOF_
+
+ AutoGen definitions options;
+
+ prog-name = test-lib-prog;
+ prog-title = 'Test ${testname} Program';
+ config-header = 'config.h';
+
+ flag = {
+ name = program;
+ value = p;
+ descrip = "${testname} program test";
+ doc = stumble;
+ };
+
+ #include ${testname}-libopts.def
+ _EOF_
+
+echo ${AG_L} ${testname}-lib.def
+${AG_L} ${testname}-lib.def || \
+ failure AutoGen could not process ${testname}-lib.def
+
+echo ${AG_L} ${testname}-prog.def
+${AG_L} ${testname}-prog.def || \
+ failure AutoGen could not process ${testname}-prog.def
+
+for f in lib prog
+do
+ ${SED} -e '1,/include <autoopts\/options.h>/d' \
+ -e '/endif .* AUTOOPTS_.*_H_GUARD/,$d' \
+ -e 's/near line [0-9]*/near line XXX/' \
+ ${testname}-${f}.h > ${testname}-${f}.h-res || \
+ failure could not sed ${testname}-${f}.h
+done
+
+# # # # # # # # # # TEST PROGRAM # # # # # # # # # #
+
+cat > ${testname}-lib.c <<- _EOCode_
+ #include <stdlib.h>
+ #define LIBOPTS
+ #include "${testname}-lib.h"
+ void check_library_opt( void );
+ void check_library_opt( void ) {
+ if (HAVE_OPT(LIBRARY)) return;
+ exit( EXIT_FAILURE ); }
+ _EOCode_
+test $? -eq 0 || failure cannot create ${testname}-lib.c
+
+${CC} ${CFLAGS} ${INC} -o ${testname}-lib.o -c ${testname}-lib.c
+test $? -eq 0 || failure cannot compile ${testname}-lib.c
+
+cat > ${testname}-main.c <<- _EOCode_
+ #include <stdio.h>
+ #include <stdlib.h>
+ #define LIBOPTS
+ #include "${testname}-prog.c"
+ extern void check_library_opt( void );
+ int main( int argc, char** argv ) {
+ (void)optionProcess( &test_lib_progOptions, argc, argv );
+ check_library_opt();
+ return EXIT_SUCCESS; }
+ _EOCode_
+
+${CC} ${CFLAGS} ${INC} -o ${testname} ${testname}-main.c ${testname}-lib.o ${LIB}
+test $? -eq 0 || failure cannot compile ${testname}-main.c
+
+./${testname} -c || failure library option not detected
+
+# # # # # # # # # # HELP OUTPUT # # # # # # # # # #
+
+./${testname} -? | clean_help > ${testname}.help-sample
+
+clean_help > ${testname}.help-base <<- _EOHelp_
+test-lib-prog - Test library Program
+USAGE: library [ -<flag> ]...
+ Flg Arg Option-Name Description
+ -p no program library program test
+
+This option introduces the options for the zzyzx library:
+
+ Flg Arg Option-Name Description
+ -c no library library test
+
+version, usage and configuration options:
+
+ Flg Arg Option-Name Description
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+ _EOHelp_
+
+cmp ${testname}.help-* || \
+ failure "help output mismatch:
+`diff ${testname}.help-*`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of library.test
diff --git a/autoopts/test/main.test b/autoopts/test/main.test
new file mode 100755
index 0000000..0c4b124
--- /dev/null
+++ b/autoopts/test/main.test
@@ -0,0 +1,127 @@
+#! /bin/sh
+# -*- Mode: Shell-Script -*-
+# ----------------------------------------------------------------------
+# main.test --- test main program attribute
+# make sure that when it is not specified
+# then option processing consumes all args.
+#
+# Time-stamp: "2011-08-07 17:33:19 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating ${testname}.def in `pwd`"
+testname="${testname}" \
+argument="${argument}" long_opts="${long_opts}" \
+${SHELLX} ${stdopts} option:'opt init' second=020 || \
+ failure "Could not run stdopts.def"
+
+exec 4> ${testname}.def2
+${SED} '/test_main=/d' ${testname}.def >&4
+unset test_main
+cat >&4 <<- _EOF_
+ explain = 'This is some explanatory text.';
+ argument = '[ <argument> ... ]';
+ main = {
+ handler-proc = fumble;
+ fumble-code = 'printf( "%s\n", pz_entry );';
+ main-type = for-each;
+ };
+ _EOF_
+exec 4>&-
+mv -f ${testname}.def2 ${testname}.def
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+compile "-?"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+basehlp=${testname}.hlp
+echo creating ${basehlp}
+clean_help > ${basehlp} <<'_EOF_'
+test_main - Test AutoOpts for main
+USAGE: main [ -<flag> [<val>] ]... [ <argument> ... ]
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s Num second The second option descrip
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+
+This is some explanatory text.
+If no arguments are provided, input arguments are read from stdin,
+one per line; blank and '#'-prefixed lines are comments.
+'stdin' may not be a terminal (tty).
+_EOF_
+
+cmp -s ${testname}.h*lp || \
+ failure "`diff ${basehlp} ${testname}.help`"
+
+# # # # # # # # # # TEST OPERATION # # # # # # # # # #
+
+./${testname} > ${testname}.out < ${testname}.hlp
+
+clean_help > ${testname}.base <<\_EOF_
+test_main - Test AutoOpts for main
+USAGE: main [ -<flag> [<val>] ]... [ <argument> ... ]
+Flg Arg Option-Name Description
+-o Str option The option option descrip
+-s Num second The second option descrip
+-? no help Display extended usage information and exit
+-! no more-help Extended usage information passed thru pager
+This is some explanatory text.
+If no arguments are provided, input arguments are read from stdin,
+one per line; blank and '#'-prefixed lines are comments.
+'stdin' may not be a terminal (tty).
+_EOF_
+
+cmp -s ${testname}.base ${testname}.out || \
+ failure "`diff ${testname}.base ${testname}.out`"
+
+./${testname} -s 5 the quick 'brown fox' > ${testname}.out2
+
+cat > ${testname}.base2 <<\_EOF_
+the
+quick
+brown fox
+_EOF_
+
+cmp -s ${testname}.base2 ${testname}.out2 || \
+ failure "`diff ${testname}.base2 ${testname}.out2`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of main.test
diff --git a/autoopts/test/nested.test b/autoopts/test/nested.test
new file mode 100755
index 0000000..34c9a55
--- /dev/null
+++ b/autoopts/test/nested.test
@@ -0,0 +1,266 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# nested.test --- test nested option values
+#
+# Time-stamp: "2012-03-31 13:10:48 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+exec 5> ${testname}.def
+cat >&5 <<- _EOF_
+
+ AutoGen definitions options;
+
+ config-header = 'config.h';
+ prog-name = "test_${testname}";
+ prog-title = "Test AutoOpts for ${testname}";
+ homerc = ${testname}.d/${testname}.cfg;
+
+ flag = {
+ name = struct;
+ value = s;
+ max = NOLIMIT;
+ descrip = 'structured argument val';
+ arg-type = nested;
+ };
+ main = {
+ main-type = main;
+ _EOF_
+
+test -d ${testname}.d || mkdir -p ${testname}.d
+
+echo ' main-text = <''<- _EOCode_' >&5
+cat >&5 <<- _EOF_
+ {
+ int ix = 0;
+ const tOptionValue* pOV =
+ optionFindValue(&DESC(STRUCT), NULL, NULL);
+ do {
+ printf("\nstruct opt #%d:\n", ++ix);
+ res |= print_entry( pOV );
+ pOV = optionFindNextValue(&DESC(STRUCT), pOV, NULL, NULL);
+ } while (pOV != NULL);
+ }
+ _EOF_
+
+echo "_EOCode_; };" >&5
+
+echo 'include = <''<- _EOSubr_' >&5
+cat >&5 <<- _EOF_
+ #include <stdio.h>
+
+ int print_nested( const tOptionValue* pGV );
+ int print_entry( const tOptionValue* pGV );
+ int print_entry( const tOptionValue* pGV ) {
+ if (pGV == NULL) {
+ fprintf( stderr, "ENTRY NOT FOUND\n" );
+ return 1;
+ }
+ printf( "%-8s -- ", pGV->pzName );
+ switch (pGV->valType) {
+ case OPARG_TYPE_NONE:
+ fputs( "no value\n", stdout ); break;
+
+ case OPARG_TYPE_STRING:
+ printf( "string: %s\n", pGV->v.strVal ); break;
+
+ case OPARG_TYPE_ENUMERATION:
+ printf( "enum: %d\n", pGV->v.enumVal ); break;
+
+ case OPARG_TYPE_BOOLEAN:
+ printf( "bool: %s\n",
+ pGV->v.boolVal ? "TRUE" : "false" ); break;
+
+ case OPARG_TYPE_MEMBERSHIP:
+ printf("members: 0x%08lX\n", (unsigned long)pGV->v.setVal); break;
+
+ case OPARG_TYPE_NUMERIC:
+ printf( "integer: %ld\n", pGV->v.longVal ); break;
+
+ case OPARG_TYPE_HIERARCHY:
+ printf( "nested: 0x%08lX\n", (unsigned long)pGV->v.nestVal );
+ return print_nested( pGV );
+ break;
+
+ default:
+ printf( "bad type: %d\n", pGV->valType );
+ return 1;
+ }
+ return 0;
+ }
+
+ int print_nested( const tOptionValue* pGV ) {
+ int res = 0;
+ const tOptionValue* pOV = optionGetValue( pGV, NULL );
+ while (pOV != NULL) {
+ res |= print_entry( pOV );
+ pOV = optionNextValue( pGV, pOV );
+ }
+ return res;
+ }
+ _EOF_
+echo "_EOSubr_;" >&5
+
+exec 5>&-
+
+# # # # # # # # # # CREATE PROGRAM # # # # # # # # #
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+compile "-?"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+basehelp=${testname}-base.help
+echo creating ${basehelp}
+clean_help > ${basehelp} <<_EOF_
+test_${testname} - Test AutoOpts for ${testname}
+USAGE: ${testname} [ -<flag> [<val>] ]...
+ Flg Arg Option-Name Description
+ -s Cpx struct structured argument val
+ - may appear multiple times
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+
+The following option preset mechanisms are supported:
+ - reading file ${testname}.cfg
+_EOF_
+
+${SED} "/ - reading file/s/ file .*/ file ${testname}.cfg/" \
+ ${testname}.help > X$$
+mv -f X$$ ${testname}.help
+
+cmp -s ${basehelp} ${testname}.help || \
+ failure "`diff ${basehelp} ${testname}.help`"
+
+# # # # # # # # # # SINGLE ARG TEST # # # # # # # # #
+
+cat > ${testname}-res1.base <<- _EOF_
+
+ struct opt #1:
+ struct -- nested: 0xXXXXXXXX
+ able -- no value
+ bar -- integer: 1234
+ foo -- no value
+ stumble -- no value
+ _EOF_
+
+./${testname} -s 'stumble, foo, <bar type=integer>1234</bar> able' | \
+${SED} '/ nested:/s/ 0x.*/ 0xXXXXXXXX/' > ${testname}-res1.out || \
+ failure "FAILED: \
+./${testname} -s 'stumble, foo, <bar type=integer>1234</bar> baz'"
+
+cmp -s ${testname}-res1.* || \
+ failure "`diff ${testname}-res1.*`"
+
+# # # # # # # # # # DOUBLE ARG TEST # # # # # # # # #
+
+arg1="stumble, <foo>foo${ht}lish</foo>, <bar type=integer>1234</bar>, able"
+arg2='foo, <bar type=integer>4321</bar> <gr type=nested>one, two=2, three</gr>'
+(./${testname} -s "${arg1}" -s "${arg2}" \
+ | ${SED} '/ nested:/s/ 0x.*/ 0xXXXXXXXX/' ) > ${testname}-res2.out || \
+ failure "FAILED: ./${testname} ${arg1} ${arg2}"
+
+cat > ${testname}-res2.base <<- _EOF_
+
+ struct opt #1:
+ struct -- nested: 0xXXXXXXXX
+ able -- no value
+ bar -- integer: 1234
+ foo -- string: foo lish
+ stumble -- no value
+
+ struct opt #2:
+ struct -- nested: 0xXXXXXXXX
+ bar -- integer: 4321
+ foo -- no value
+ gr -- nested: 0xXXXXXXXX
+ one -- no value
+ three -- no value
+ two -- string: 2
+ _EOF_
+
+cmp -s ${testname}-res2.* || \
+ failure "`diff ${testname}-res2.*`"
+
+./${testname} -s "${arg1}" -s "${arg2}" '->'
+${SED} -e '3s/.*/# ***DATE***/' ${testname}.d/${testname}.cfg > ${testname}.XX
+mv -f ${testname}.XX ${testname}.d/${testname}.cfg
+cat > ${testname}-res3.base <<- _EOF_
+ # test_nested - Test AutoOpts for nested
+ # preset/initialization file
+ # ***DATE***
+ #
+ <struct type=nested>
+ <able/>
+ <bar type=integer>0x4D2</bar>
+ <foo>foo&#x09;lish</foo>
+ <stumble/>
+ </struct>
+ <struct type=nested>
+ <bar type=integer>0x10E1</bar>
+ <foo/>
+ <gr type=nested>
+ <one/>
+ <three/>
+ <two>2</two>
+ </gr>
+ </struct>
+ _EOF_
+files=${testname}-res3.base\ ${testname}.d/${testname}.cfg
+cmp -s ${files} || \
+ failure "saved config${nl}`diff ${files}`"
+
+# Copy the config file and verify that the contents are the same.
+#
+./${testname} "->${testname}.d/${testname}.cfg2"
+${SED} -e '3s/.*/# ***DATE***/' ${testname}.d/${testname}.cfg2 > ${testname}.XX
+mv -f ${testname}.XX ${testname}.d/${testname}.cfg2
+files=${testname}.d/${testname}.cfg\ ${testname}.d/${testname}.cfg2
+cmp -s ${files} || \
+ failure "re-saved config${nl}`diff ${files}`"
+
+# # # # # # # # # # TEST OPERATION # # # # # # # # # #
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of nested.test
diff --git a/autoopts/test/nls.test b/autoopts/test/nls.test
new file mode 100755
index 0000000..1455515
--- /dev/null
+++ b/autoopts/test/nls.test
@@ -0,0 +1,156 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# nls.test --- test NLS, sort-of
+#
+# Time-stamp: "2011-08-07 17:36:29 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+AUTOGEN_TEMPL_DIRS=`cd ${srcdir}/..;pwd`
+export AUTOGEN_TEMPL_DIRS
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating ${testname}.def in `pwd`"
+testname="${testname}" test_main="YES" \
+argument="${argument}" long_opts="YES" \
+${SHELLX} ${stdopts} option:'opt init' second=020 || \
+ failure "Could not run stdopts.def"
+
+echo 'export = "extern char* gettext( char const* );";' >> ${testname}.def
+CC="${CC} ${CFLAGS} -DENABLE_NLS=1 ${INC}"
+CFLAGS=''
+INC=''
+
+compile_with_nls() {
+
+ echo ${AG_L} ${testname}.def
+ ${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+ chmod u+w ${testname}.[ch]
+ cat >> ${testname}.c <<'_EOF_'
+#include <ctype.h>
+char*
+gettext( char const* pzS )
+{
+ static char z[ 4096 ];
+ char* pzD = z + sizeof(z) - 1;
+ int ct = 0;
+ int found_nl = 0;
+ if (pzS == NULL)
+ return NULL;
+ if (strchr(pzS, '%') != NULL)
+ return (void *)pzS;
+ *--pzD = '\0';
+ while (*pzS == ' ') pzS++;
+ for (;;) {
+ char ch = *(pzS++);
+ if (ch == '\0')
+ break;
+ *(--pzD) = ch;
+ ct++;
+ if (ch != '\n')
+ continue;
+ found_nl = 1;
+ while (*pzS == ' ') pzS++;
+ }
+ if (found_nl)
+ strcpy(z + sizeof(z) - 2, "\n");
+ while (*pzD == '\n')
+ pzD++;
+ return pzD;
+}
+_EOF_
+
+ sedcmd='/ot sgub .* tropeR$/d;/ yb degakcaP/d'
+ compile "--pleh"
+ mv ${testname}.help ${testname}-${1}.help
+ cmp -s ${testname}-${1}.help ${testname}-${1}.hlp || { set +x ; \
+ failure "`diff -c ${testname}-${1}.hlp ${testname}-${1}.help`" ; }
+}
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+echo creating ${testname}.hlp
+clean_help > ${testname}-1.hlp <<'_EOF_'
+test_nls - Test AutoOpts for nls
+USAGE: nls [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
+noitpircseD emaN-noitpO grA glF
+ -o rtS noitpo pircsed noitpo noitpo ehT
+ -s muN dnoces pircsed noitpo dnoces ehT
+ -? on pleh tixe dna noitamrofni egasu dednetxe yalpsiD
+ -! on pleh-erom regap urht dessap noitamrofni egasu dednetxE
+
+.retcarahc galf eht dna nehpyh
+elgnis a yb ro eman rieht dna snehpyh delbuod yb deificeps era snoitpO
+_EOF_
+
+compile_with_nls 1
+
+mv ${testname}.def ${testname}-1.def
+
+exec 3> ${testname}.def
+cat ${testname}-1.def >&3
+echo 'full-usage = <''<''- _EOF_' >&3
+clean_help >&3 <<'_EOF_'
+test_nls - Test AutoOpts for nls
+USAGE: nls [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str option The option descrip
+ -s Num second The second descrip
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+_EOF_
+echo '_EOF_;' >&3
+exec 3>&-
+
+clean_help > ${testname}-2.hlp <<'_EOF_'
+.retcarahc galf eht dna nehpyh
+elgnis a yb ro eman rieht dna snehpyh delbuod yb deificeps era snoitpO
+
+regap urht dessap noitamrofni egasu dednetxE pleh-erom on !-
+tixe dna noitamrofni egasu dednetxe yalpsiD pleh on ?-
+pircsed dnoces ehT dnoces muN s-
+pircsed noitpo ehT noitpo rtS o-
+noitpircseD emaN-noitpO grA glF
+...] ]>lav<} |={[>eman<-- | ]>lav<[ >galf<- [ sln :EGASU
+sln rof stpOotuA tseT - sln_tset
+_EOF_
+
+compile_with_nls 2
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of nls.test
diff --git a/autoopts/test/rc.test b/autoopts/test/rc.test
new file mode 100755
index 0000000..18e005d
--- /dev/null
+++ b/autoopts/test/rc.test
@@ -0,0 +1,240 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+
+# rc.test --- test loading and saving of rc files
+#
+# Time-stamp: "2012-05-13 13:21:58 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+
+. ./defs
+
+AUTOOPTS_TRACE=every
+AUTOOPTS_TRACE_OUT=">>`pwd`/${testname}-ag-trace.txt"
+export AUTOOPTS_TRACE AUTOOPTS_TRACE_OUT
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+: "creating ${testname}.def in `pwd`"
+
+TESTNAME=RC
+export TESTNAME
+
+test_main="yes" \
+argument="mumble" long_opts="yes" \
+${SHELLX} ${stdopts} option second:init third: || \
+ failure "Could not run stdopts.def"
+
+cat >> ${testname}.def <<_EOF_
+homerc = "\$\$/${testname}.rc";
+rcfile = ${testname}.file;
+environrc;
+_EOF_
+
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process A
+
+# # # # # # # # # # VALIDATE HELP # # # # # # # # #
+
+clean_help > ${testname}-base1.help <<_EOF_
+test_rc - Test AutoOpts for rc
+USAGE: rc [ -<flag> [<val>] | --<name>[{=| }<val>] ]... mumble
+ Flg Arg Option-Name Description
+ -o no option The option option descrip
+ -s Str second The second option descrip
+ -t Str third The third option descrip
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+The following option preset mechanisms are supported:
+ - reading file ..../${testname}.rc/rc.file
+ - examining environment variables named TEST_RC_*
+_EOF_
+
+mkdir ${testname}.rc ${testname}.run
+compile "--help"
+${SED} 's@\( - reading file \).*\(/'${testname}.rc/rc.file'\)@\1....\2@' \
+ ${testname}.help > ${testname}-res1.help
+cmp ${testname}-*1.help || \
+ failure "`diff ${testname}-*.help`"
+
+# # # # # # # # # # DO THE REAL TEST # # # # # # # # #
+
+# Install an initialization for the "second" option.
+# That goes into the ${testname}.rc directory.
+# We change into the ${testname}.run directory and run the program.
+# It should pick up the value saved into the ${testname}.rc dir.
+#
+./${testname} --second=third '->'${testname}.rc/${testname}.file
+
+cd ${testname}.run
+../${testname} -t xxx MUMBLE > ${testname}.cmds
+
+# This is what the output should be:
+#
+cat > ${testname}.test <<'_EOF_'
+OPTION_CT=2
+export OPTION_CT
+TEST_RC_SECOND='third'
+export TEST_RC_SECOND
+TEST_RC_THIRD='xxx'
+export TEST_RC_THIRD
+_EOF_
+
+
+cmp ${testname}.cmds ${testname}.test || {
+ df="`diff -c ${testname}.test ${testname}.cmds`"
+ cd ..
+ failure "${df}"
+}
+
+# # # # #
+
+TEST_RC=--no-load ../${testname} -t xxx MUMBLE > ${testname}-2.cmds
+
+# This is what the output should be:
+#
+cat > ${testname}-2.test <<'_EOF_'
+OPTION_CT=2
+export OPTION_CT
+TEST_RC_THIRD='xxx'
+export TEST_RC_THIRD
+_EOF_
+
+cmp ${testname}-2.cmds ${testname}-2.test || {
+ df="`diff -c ${testname}-2.test ${testname}-2.cmds`"
+ cd ..
+ failure "${df}"
+}
+
+# # # # # # # # # # SECOND TEST OUTPUT FILE # # # # # # # # #
+
+cat >> ../${testname}.rc/${testname}.file <<_EOF_
+[TEST_MUMBLE]
+second fourth
+<!-- This is a comment
+ and it should have no effect -->
+[TEST_${TESTNAME}]
+second = fifth
+
+# this is another comment
+#
+[TEST_STUMBLE]
+second : sixth
+_EOF_
+
+../${testname} -t yyy MUMBLE > ${testname}.cmds
+
+# This is what the output should be:
+#
+cat > ${testname}.test <<'_EOF_'
+OPTION_CT=2
+export OPTION_CT
+TEST_RC_SECOND='fifth'
+export TEST_RC_SECOND
+TEST_RC_THIRD='yyy'
+export TEST_RC_THIRD
+_EOF_
+
+cmp ${testname}.cmds ${testname}.test || {
+ df="`diff -c ${testname}.test ${testname}.cmds`"
+ cd ..
+ failure "${df}"
+}
+
+mv ../${testname}.rc/${testname}.file ../${testname}.rc/${testname}.save
+( ${SED} '/^[TEST_MUMBLE]/,$d' ../${testname}.rc/${testname}.save
+ cat <<- _EOF_
+ <?program test-mumble>
+ second fourth
+ <!-- This is a comment
+ and it should have no effect -->
+ <?program test-${testname}>
+ <second cooked>
+ fifth
+ </second>
+ # this is another comment
+ #
+ <?program test-stumble>
+ second : sixth
+ _EOF_
+) > ../${testname}.rc/${testname}.file
+
+../${testname} -t yyy MUMBLE > ${testname}.cmds
+
+cmp ${testname}.cmds ${testname}.test || {
+ df="USING <?program>: `diff -c ${testname}.test ${testname}.cmds`"
+ cd ..
+ failure "${df}"
+}
+
+# # # # # # # # # # THIRD TEST OUTPUT FILE # # # # # # # # #
+
+cd ${testsubdir}
+
+echo 'disable-save;' >> ${testname}.def
+
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process B
+
+compile "--help"
+${SED} 's@\( - reading file \).*\(/'${testname}.rc/rc.file'\)@\1....\2@' \
+ ${testname}.help > ${testname}-res2.help
+egrep -v ' save-opts +Save ' ${testname}-base1.help > ${testname}-base2.help
+
+cmp ${testname}-*2.help || \
+ failure "`diff ${testname}-*2.help`"
+
+echo 'disable-load;' >> ${testname}.def
+
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process B
+
+compile "--help"
+${SED} 's@\( - reading file \).*\(/'${testname}.rc/rc.file'\)@\1....\2@' \
+ ${testname}.help > ${testname}-res3.help
+
+${SED} -e '/ load-opts *Load /,/multiple times$/d' \
+ -e '/ save-opts *Save /d' \
+ ${testname}-base1.help > ${testname}-base3.help
+
+cmp ${testname}-*3.help || \
+ failure "`diff ${testname}-*3.help`"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of rc.test
diff --git a/autoopts/test/shell.test b/autoopts/test/shell.test
new file mode 100755
index 0000000..1a47b2f
--- /dev/null
+++ b/autoopts/test/shell.test
@@ -0,0 +1,457 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# shell.test --- test shell program attribute
+# make sure that when it is not specified
+# then option processing consumes all args.
+#
+# Time-stamp: "2012-08-11 08:51:08 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating ${testname}.def in `pwd`"
+
+ testname="${testname}" \
+test_main="${test_main}" \
+ argument="reg-arg [ ... ]" \
+long_opts=true \
+${SHELLX} ${stdopts} option: second || failure "Could not run stdopts.def"
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+compile "-?"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+echo creating ${testname}.hlp
+clean_help > ${testname}.hlp <<'_EOF_'
+test_shell - Test AutoOpts for shell
+USAGE: shell [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
+ reg-arg [ ... ]
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s no second The second option descrip
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+_EOF_
+
+cmp -s ${testname}.h*lp || \
+ failure "`diff ${testname}.hlp ${testname}.help`"
+
+./${testname} -X 2> /dev/null && \
+ failure ${testname} should not accept bogus options
+
+./${testname} -o 2> /dev/null && \
+ failure ${testname} should not accept missing options argument
+
+./${testname} 2> /dev/null && \
+ failure ${testname} must have an argument
+
+# # # # # # # # # # SHELL OUTPUT FILE # # # # # # # # #
+
+echo creating ${testname}.out
+cat > ${testname}.out <<_EOF_
+OPTION_CT=3
+export OPTION_CT
+TEST_SHELL_OPTION='opt-arg'
+export TEST_SHELL_OPTION
+TEST_SHELL_SECOND=1 # 0x1
+export TEST_SHELL_SECOND
+_EOF_
+
+./${testname} -o opt-arg -s a1 a2 > ${testname}.test || \
+ failure ${testname} did not handle its options
+
+cmp -s ${testname}.test ${testname}.out || \
+ failure "`diff ${testname}.out ${testname}.test`"
+
+${SED} '/test-main/s/yes/optionParseShell/' ${testname}.def > XX
+mv -f XX ${testname}.def
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+sedcmd='/Note that.*is only useful/,/will be regenerated/d'
+compile "-?"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+echo creating second ${testname}.hlp
+clean_help > ${testname}.hlp <<'_EOF_'
+genshellopt - Generate Shell Option Processing Script - Ver. 1
+USAGE: shell [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str script Output Script File
+ -s Str shell Shell name (follows "#!" magic)
+ - disabled as --no-shell
+ - enabled by default
+ -v opt version Output version information and exit
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+Note that ``shell'' is only useful if the output file does not already
+exist. If it does, then the shell name and optional first argument will
+be extracted from the script file.
+
+If the script file already exists and contains Automated Option Processing
+text, the second line of the file through the ending tag will be replaced
+by the newly generated text. The first ``#!'' line will be regenerated.
+
+= = = = = = = =
+
+This incarnation of genshell will produce
+a shell script to parse the options for test_shell:
+
+test_shell - Test AutoOpts for shell
+USAGE: test_shell [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
+ reg-arg [ ... ]
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s no second The second option descrip
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+_EOF_
+
+files=${testname}.hlp\ ${testname}.help
+cmp -s ${files} || \
+ failure "script generator help output mismatch: `diff -c ${files}`"
+
+# # # # # # # # # # SCRIPT OUTPUT FILE # # # # # # # # #
+
+echo creating ${testname}.sht
+exec 3> ${testname}.sht
+echo "#! ${SHELL}" >&3
+cat >&3 <<'_EOF_'
+#
+TEST_SHELL_LONGUSAGE_TEXT='test_shell - Test AutoOpts for shell
+USAGE: test_shell [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
+ reg-arg [ ... ]
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s no second The second option descrip
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.'
+
+TEST_SHELL_USAGE_TEXT='test_shell - Test AutoOpts for shell
+USAGE: test_shell [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
+ reg-arg [ ... ]
+ Flg Arg Option-Name Description
+ -o Str option The option option descrip
+ -s no second The second option descrip
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.'
+
+
+TEST_SHELL_OPTION=${TEST_SHELL_OPTION}
+TEST_SHELL_OPTION_set=false
+export TEST_SHELL_OPTION
+
+TEST_SHELL_SECOND=${TEST_SHELL_SECOND}
+TEST_SHELL_SECOND_set=false
+export TEST_SHELL_SECOND
+
+OPT_PROCESS=true
+OPT_ARG=$1
+while ${OPT_PROCESS} && [ $# -gt 0 ]
+do
+ OPT_ELEMENT=''
+ OPT_ARG_VAL=''
+
+ case "${OPT_ARG}" in
+ -- )
+ OPT_PROCESS=false
+ shift
+ ;;
+ --* )
+ OPT_CODE=`echo "X${OPT_ARG}"|sed 's/^X-*//'`
+ shift
+ OPT_ARG=$1
+ case "${OPT_CODE}" in *=* )
+ OPT_ARG_VAL=`echo "${OPT_CODE}"|sed 's/^[^=]*=//'`
+ OPT_CODE=`echo "${OPT_CODE}"|sed 's/=.*$//'` ;; esac
+ case "${OPT_CODE}" in
+ 'op' | \
+ 'opt' | \
+ 'opti' | \
+ 'optio' | \
+ 'option' )
+ if [ -n "${TEST_SHELL_OPTION}" ] && ${TEST_SHELL_OPTION_set} ; then
+ echo Error: duplicate OPTION option >&2
+ echo "$TEST_SHELL_USAGE_TEXT"
+ exit 1 ; fi
+ TEST_SHELL_OPTION_set=true
+ OPT_NAME='OPTION'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'se' | \
+ 'sec' | \
+ 'seco' | \
+ 'secon' | \
+ 'second' )
+ if [ -n "${TEST_SHELL_SECOND}" ] && ${TEST_SHELL_SECOND_set} ; then
+ echo Error: duplicate SECOND option >&2
+ echo "$TEST_SHELL_USAGE_TEXT"
+ exit 1 ; fi
+ TEST_SHELL_SECOND_set=true
+ OPT_NAME='SECOND'
+ eval TEST_SHELL_SECOND${OPT_ELEMENT}=true
+ export TEST_SHELL_SECOND${OPT_ELEMENT}
+ OPT_ARG_NEEDED=NO
+ ;;
+
+ 'he' | \
+ 'hel' | \
+ 'help' )
+ echo "$TEST_SHELL_LONGUSAGE_TEXT"
+ exit 0
+ ;;
+
+ 'mo' | \
+ 'mor' | \
+ 'more' | \
+ 'more-' | \
+ 'more-h' | \
+ 'more-he' | \
+ 'more-hel' | \
+ 'more-help' )
+ echo "$TEST_SHELL_LONGUSAGE_TEXT" | ${PAGER-more}
+ exit 0
+ ;;
+
+ * )
+ echo Unknown option: "${OPT_CODE}" >&2
+ echo "$TEST_SHELL_USAGE_TEXT"
+ exit 1
+ ;;
+ esac
+
+ case "${OPT_ARG_NEEDED}" in
+ NO )
+ OPT_ARG_VAL=''
+ ;;
+ YES )
+ if [ -z "${OPT_ARG_VAL}" ]
+ then
+ if [ $# -eq 0 ]
+ then
+ echo No argument provided for ${OPT_NAME} option >&2
+ echo "$TEST_SHELL_USAGE_TEXT"
+ exit 1
+ fi
+ OPT_ARG_VAL=${OPT_ARG}
+ shift
+ OPT_ARG=$1
+ fi
+ ;;
+ OK )
+ if [ -z "${OPT_ARG_VAL}" ] && [ $# -gt 0 ]
+ then
+ case "${OPT_ARG}" in -* ) ;; * )
+ OPT_ARG_VAL=${OPT_ARG}
+ shift
+ OPT_ARG=$1 ;; esac
+ fi
+ ;;
+ esac
+ ;;
+
+ -* )
+ OPT_CODE=`echo "X${OPT_ARG}" | sed 's/X-\(.\).*/\1/'`
+ OPT_ARG=` echo "X${OPT_ARG}" | sed 's/X-.//'`
+ case "${OPT_CODE}" in
+ 'o' )
+ if [ -n "${TEST_SHELL_OPTION}" ] && ${TEST_SHELL_OPTION_set} ; then
+ echo Error: duplicate OPTION option >&2
+ echo "$TEST_SHELL_USAGE_TEXT"
+ exit 1 ; fi
+ TEST_SHELL_OPTION_set=true
+ OPT_NAME='OPTION'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 's' )
+ if [ -n "${TEST_SHELL_SECOND}" ] && ${TEST_SHELL_SECOND_set} ; then
+ echo Error: duplicate SECOND option >&2
+ echo "$TEST_SHELL_USAGE_TEXT"
+ exit 1 ; fi
+ TEST_SHELL_SECOND_set=true
+ OPT_NAME='SECOND'
+ eval TEST_SHELL_SECOND${OPT_ELEMENT}=true
+ export TEST_SHELL_SECOND${OPT_ELEMENT}
+ OPT_ARG_NEEDED=NO
+ ;;
+
+ '?' )
+ echo "$TEST_SHELL_LONGUSAGE_TEXT"
+ exit 0
+ ;;
+
+ '!' )
+ echo "$TEST_SHELL_LONGUSAGE_TEXT" | ${PAGER-more}
+ exit 0
+ ;;
+
+ * )
+ echo Unknown flag: "${OPT_CODE}" >&2
+ echo "$TEST_SHELL_USAGE_TEXT"
+ exit 1
+ ;;
+ esac
+
+ case "${OPT_ARG_NEEDED}" in
+ NO )
+ if [ -n "${OPT_ARG}" ]
+ then
+ OPT_ARG=-${OPT_ARG}
+ else
+ shift
+ OPT_ARG=$1
+ fi
+ ;;
+ YES )
+ if [ -n "${OPT_ARG}" ]
+ then
+ OPT_ARG_VAL=${OPT_ARG}
+ else
+ if [ $# -eq 0 ]
+ then
+ echo No argument provided for ${OPT_NAME} option >&2
+ echo "$TEST_SHELL_USAGE_TEXT"
+ exit 1
+ fi
+ shift
+ OPT_ARG_VAL=$1
+ fi
+ shift
+ OPT_ARG=$1
+ ;;
+ OK )
+ if [ -n "${OPT_ARG}" ]
+ then
+ OPT_ARG_VAL=${OPT_ARG}
+ shift
+ OPT_ARG=$1
+ else
+ shift
+ if [ $# -gt 0 ]
+ then
+ case "$1" in -* ) ;; * )
+ OPT_ARG_VAL=$1
+ shift ;; esac
+ OPT_ARG=$1
+ fi
+ fi
+ ;;
+ esac
+ ;;
+
+ * )
+ OPT_PROCESS=false
+ ;;
+ esac
+ if [ -n "${OPT_ARG_VAL}" ]
+ then
+ eval TEST_SHELL_${OPT_NAME}${OPT_ELEMENT}="'${OPT_ARG_VAL}'"
+ export TEST_SHELL_${OPT_NAME}${OPT_ELEMENT}
+ fi
+done
+unset OPT_PROCESS || :
+unset OPT_ELEMENT || :
+unset OPT_ARG || :
+unset OPT_ARG_NEEDED || :
+unset OPT_NAME || :
+unset OPT_CODE || :
+unset OPT_ARG_VAL || :
+
+# # # # # # # # # #
+#
+# END OF AUTOMATED OPTION PROCESSING
+#
+# # # # # # # # # # -- do not modify this marker --
+
+env | grep '^TEST_SHELL_'
+_EOF_
+exec 3>&-
+
+# # # # # # # # # # SCRIPT OUTPUT TESTING # # # # # # # # #
+
+rm -f ${testname}.sh
+./${testname} -o ${testname}.sh
+
+sedcmd='2,/From the.*option def/d'
+${FGREP} 'Packaged by ' ${testname}.sh >/dev/null && {
+ sedcmd=${sedcmd}${nl}'/^Packaged by /d
+ /^Report .* bugs to /d
+ /and the flag character\.$/s/$/'"'/"
+}
+
+${SED} "$sedcmd" ${testname}.sh > ${testname}.shx
+cmp -s ${testname}.sh[tx] || \
+ failure "`diff ${testname}.sh[tx]`"
+
+# # # # # # # # # # SCRIPT PROCESSING TEST # # # # # # # # #
+
+./${testname}.sh --opt opt-arg -s a1 a2 | sort > ${testname}.test || \
+ failure ${testname} did not handle its options
+
+sort > ${testname}.out <<_EOF_
+TEST_SHELL_OPTION=opt-arg
+TEST_SHELL_SECOND=true
+_EOF_
+
+cmp -s ${testname}.out ${testname}.test || \
+ failure "`diff ${testname}.out ${testname}.test`"
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of shell.test
diff --git a/autoopts/test/stdopts.def b/autoopts/test/stdopts.def
new file mode 100644
index 0000000..e89745c
--- /dev/null
+++ b/autoopts/test/stdopts.def
@@ -0,0 +1,109 @@
+#! /bin/sh
+
+## Time-stamp: "2012-05-13 12:44:49 bkorb"
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+
+# This is the standard set of options for testing option processing
+# It is expected to be dot
+
+exec 5> $testname.def
+cat >&5 <<- _EOF_
+
+ AutoGen definitions options;
+
+ config-header = 'config.h';
+ prog-name = "test_${testname}";
+ prog-title = "Test AutoOpts for ${testname}";
+ _EOF_
+
+echo test_main $test_main
+echo argument $argument
+echo long_opts $long_opts
+
+{
+ test -n "${test_main}" && echo "test-main = '${test_main}';"
+ test -n "${argument}" && echo "argument = '${argument}';"
+ test -n "${long_opts}" && echo "long-opts;"
+} >&5
+
+for flag
+do
+ fname=`echo "${flag}" | ${SED} 's/[^a-zA-Z0-9_-].*//'`
+ flag=`echo "${flag}" | ${SED} "s/^${fname}//"`
+
+ case "${flag}" in
+ :* )
+ aval=`echo $flag | ${SED} 's/^://'`
+ arg=" arg-type = string;"
+ test -n "${aval}" && arg="${arg} arg_default = '${aval}';"
+ ;;
+
+ =* )
+ aval=`echo $flag | ${SED} 's/=//'`
+ arg=" arg-type = number;"
+ test -n "${aval}" && arg="${arg} arg_default = '${aval}';"
+ ;;
+
+ @* )
+ arg=`echo $flag | ${SED} 's/@//'`
+ case "${arg}" in
+ *=* ) default=`echo $flag | ${SED} 's/.*=//'`
+ arg=`echo $arg | ${SED} 's/=.*//'`
+ arg=" arg-type = '${arg}'; arg-default='${default}';"
+ ;;
+
+ * )
+ arg=" arg-type = '${arg}';"
+ ;;
+ esac
+ ;;
+
+ * )
+ unset arg
+ ;;
+ esac
+
+ cat <<-_EOF_
+ flag = {
+ name = "${fname}";
+ descrip = "The ${fname} option descrip";
+ _EOF_
+
+ ${use_flags} && {
+ fname=`echo ${fname} | ${SED} 's/\(.\).*/\1/'`
+ echo " value = '${fname}';"
+ }
+ test -n "${arg}" && echo "${arg}"
+ echo "};"
+ echo
+done >&5
+
+exec 5>&-
+ls -l ${testname}.def
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of stdopts.def
diff --git a/autoopts/test/stdopts.test b/autoopts/test/stdopts.test
new file mode 100755
index 0000000..21ba56c
--- /dev/null
+++ b/autoopts/test/stdopts.test
@@ -0,0 +1,161 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# stdopts.test --- test standard options
+#
+# Time-stamp: "2013-03-10 07:14:45 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating ${testname}.def in `pwd`"
+cat > ${testname}.def <<- _EOF_
+
+ AutoGen Definitions options;
+
+ prog-name = test_${testname};
+ prog-title = "${testname} test";
+ config-header = 'config.h';
+ test-main;
+ long-opts;
+
+ #define VERBOSE_ENUM
+ #define VERBOSE_FLAG
+
+ #include stdoptions
+ _EOF_
+
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+compile "-?"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+echo creating ${testname}.hlp
+clean_help > ${testname}.hbase <<- _EOF_
+ test_stdopts - stdopts test
+ USAGE: stdopts [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
+
+ The following options are commonly used and are provided and supported
+ by AutoOpts:
+
+ Flg Arg Option-Name Description
+ -V KWd verbose run program with progress info
+
+ version, usage and configuration options:
+
+ Flg Arg Option-Name Description
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+ Options are specified by doubled hyphens and their name or by a single
+ hyphen and the flag character.
+
+ The valid "verbose" option keywords are:
+ silent quiet brief informative verbose
+ or an integer from 0 through 4
+ _EOF_
+
+# When building with DEBUG set, we get an unanticipated option:
+#
+${GREP} -v 'run program with debugging info' ${testname}.help > ${testname}.hres
+
+cmp -s ${testname}.h[br]* || \
+ failure "MISCOMPARE: `diff ${testname}.h[br]*`"
+
+./${testname} --verbose=exp > /dev/null 2>&1 && \
+ failure ${testname} accepted ambiguous keyword
+
+./${testname} --verbose=inf > ${testname}.out || \
+ failure ${testname} did not handle its options
+
+cat > ${testname}.oex <<_EOF_
+OPTION_CT=1
+export OPTION_CT
+TEST_STDOPTS_VERBOSE='informative'
+export TEST_STDOPTS_VERBOSE
+_EOF_
+
+cmp -s ${testname}.o* || \
+ failure "`diff ${testname}.o??`"
+
+# # # # # # # # # # USAGE OPTION # # # # # # # # # # #
+
+( ${SED} "s/${testname}/${testname}-2/g" ${testname}.def
+ echo 'usage-opt;'
+) > ${testname}-2.def
+
+testname=${testname}-2
+
+${AG_L} ${testname}.def || {
+ testname=${testname%-2}
+ failure AutoGen could not process
+}
+
+compile "--usage"
+
+clean_help > ${testname}.hbase <<- _EOF_
+ test_stdopts-2 - stdopts-2 test
+ USAGE: stdopts-2 [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
+ Flg Arg Option-Name Description
+ -V KWd verbose run program with progress info
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -u no usage Abbreviated usage to stdout
+
+ Options are specified by doubled hyphens and their name or by a single
+ hyphen and the flag character.
+ _EOF_
+
+# When building with DEBUG set, we get an unanticipated option:
+#
+${GREP} -v 'run program with debugging info' ${testname}.help > ${testname}.hres
+
+cmp -s ${testname}.h[br]* || {
+ testname=${testname%-2}
+ failure "MISCOMPARE: `diff ${testname}-2.h[br]*`"
+}
+
+use=`
+ set +x
+ exec 2>&1
+ exec 1>/dev/null
+ ./${testname} --usage`
+test $? -eq 0 || failure usage failure
+test "X${use}" = X || failure misdirected usage
+
+testname=${testname%-2}
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of stdopts.test
diff --git a/autoopts/test/time.test b/autoopts/test/time.test
new file mode 100755
index 0000000..855ae88
--- /dev/null
+++ b/autoopts/test/time.test
@@ -0,0 +1,101 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# time.test --- test time duration argument
+#
+# Time-stamp: "2011-08-07 17:34:14 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating ${testname}.def in `pwd`"
+unset test_main
+export testname argument long_opts
+
+${SHELLX} ${stdopts} ${testname}@time='1d 2 h 15:10'
+here='<<'
+cat >> ${testname}.def <<- _EOF_
+ main = {
+ main-type = main;
+ main-text = ${here}- CodeEnd
+ printf("arg %s represents %d seconds", argv[-1],
+ OPT_VALUE_TIME);
+ return 0;
+ CodeEnd;
+ };
+ _EOF_
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+compile "-?"
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+basehlp=${testname}.hlp
+echo creating ${basehlp}
+clean_help > ${basehlp} <<'_EOF_'
+test_time - Test AutoOpts for time
+USAGE: time [ -<flag> [<val>] ]...
+ Flg Arg Option-Name Description
+ -t Tim time The time option descrip
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+_EOF_
+
+cmp -s ${testname}.h*lp || \
+ failure "`diff ${basehlp} ${testname}.help`"
+
+time_val=213791
+
+ck() {
+ tim=`./${testname} -t "$*" | \
+ ${SED} -n 's/.* represents \([0-9]*\) seconds/\1/p'`
+ test -z "${tim}" && failure ${testname} could not parse "$*"
+ test ${tim} -eq ${time_val} || \
+ failure ${testname} misevaluated "$*"
+}
+
+ck 2 d 11h 23:11
+ck 2 d 11h 23m 11s
+
+tim=`./${testname} -t '2 d 10h 83:11'` && \
+ failure ${testname} handled bad options
+
+# # # # # # # # # # T E S T E N D # # # # # # # # # #
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of argument.test
diff --git a/autoopts/test/usage.test b/autoopts/test/usage.test
new file mode 100755
index 0000000..33a21a5
--- /dev/null
+++ b/autoopts/test/usage.test
@@ -0,0 +1,656 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# usage.test --- test all the ways usage text can be printed.
+#
+## Time-stamp: "2011-08-07 17:20:27 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+${VERBOSE} && kill_delay=10 || kill_delay=5
+. ./defs
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+# ============= usage_LGFRA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LGFRA.hlp'
+test_usage_LGFRA - Checkout usage_LGFRA Options
+USAGE: usage_LGFRA { -<flag> [<val>] | --<name>[{=| }<val>] }... \
+ cmd-arg ...
+X
+X -L, --check-dirs=str Checkout directory list
+X --show-defs[=arg] Show the definition tree
+X -?, --help Display extended usage information and exit
+X -!, --more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LGFRp.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LGFRp.hlp'
+test_usage_LGFRp - Checkout usage_LGFRp Options
+USAGE: usage_LGFRp { -<flag> | --<name> }... cmd-arg ...
+X
+X -L, --check-dirs Checkout directory list
+X --show-defs Show the definition tree
+X -?, --help Display extended usage information and exit
+X -!, --more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LGFoA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LGFoA.hlp'
+test_usage_LGFoA - Checkout usage_LGFoA Options
+USAGE: usage_LGFoA [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
+ cmd-arg ...
+X
+X -L, --check-dirs=str Checkout directory list
+X --show-defs[=arg] Show the definition tree
+X -?, --help Display extended usage information and exit
+X -!, --more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LGFop.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LGFop.hlp'
+test_usage_LGFop - Checkout usage_LGFop Options
+USAGE: usage_LGFop [ -<flag> | --<name> ]... cmd-arg ...
+X
+X -L, --check-dirs Checkout directory list
+X --show-defs Show the definition tree
+X -?, --help Display extended usage information and exit
+X -!, --more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LGsRA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LGsRA.hlp'
+test_usage_LGsRA - Checkout usage_LGsRA Options
+USAGE: usage_LGsRA { --<name>[{=| }<val>] }... cmd-arg ...
+X
+X --check-dirs=str Checkout directory list
+X --show-defs[=arg] Show the definition tree
+X --help Display extended usage information and exit
+X --more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LGsRp.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LGsRp.hlp'
+test_usage_LGsRp - Checkout usage_LGsRp Options
+USAGE: usage_LGsRp { --<name> }... cmd-arg ...
+X
+X --check-dirs Checkout directory list
+X --show-defs Show the definition tree
+X --help Display extended usage information and exit
+X --more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LGsoA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LGsoA.hlp'
+test_usage_LGsoA - Checkout usage_LGsoA Options
+USAGE: usage_LGsoA [ --<name>[{=| }<val>] ]... cmd-arg ...
+X
+X --check-dirs=str Checkout directory list
+X --show-defs[=arg] Show the definition tree
+X --help Display extended usage information and exit
+X --more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LGsop.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LGsop.hlp'
+test_usage_LGsop - Checkout usage_LGsop Options
+USAGE: usage_LGsop [ --<name> ]... cmd-arg ...
+X
+X --check-dirs Checkout directory list
+X --show-defs Show the definition tree
+X --help Display extended usage information and exit
+X --more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LaFRA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LaFRA.hlp'
+test_usage_LaFRA - Checkout usage_LaFRA Options
+USAGE: usage_LaFRA { -<flag> [<val>] | --<name>[{=| }<val>] }... \
+ cmd-arg ...
+X Flg Arg Option-Name Req? Description
+X -L Str check-dirs YES Checkout directory list
+X opt show-defs opt Show the definition tree
+X -? no help opt Display extended usage information and exit
+X -! no more-help opt Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LaFRp.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LaFRp.hlp'
+test_usage_LaFRp - Checkout usage_LaFRp Options
+USAGE: usage_LaFRp { -<flag> | --<name> }... cmd-arg ...
+X Flg Arg Option-Name Req? Description
+X -L no check-dirs YES Checkout directory list
+X no show-defs opt Show the definition tree
+X -? no help opt Display extended usage information and exit
+X -! no more-help opt Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LaFoA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LaFoA.hlp'
+test_usage_LaFoA - Checkout usage_LaFoA Options
+USAGE: usage_LaFoA [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
+ cmd-arg ...
+X Flg Arg Option-Name Description
+X -L Str check-dirs Checkout directory list
+X opt show-defs Show the definition tree
+X -? no help Display extended usage information and exit
+X -! no more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LaFop.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LaFop.hlp'
+test_usage_LaFop - Checkout usage_LaFop Options
+USAGE: usage_LaFop [ -<flag> | --<name> ]... cmd-arg ...
+X Flg Arg Option-Name Description
+X -L no check-dirs Checkout directory list
+X no show-defs Show the definition tree
+X -? no help Display extended usage information and exit
+X -! no more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LasRA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LasRA.hlp'
+test_usage_LasRA - Checkout usage_LasRA Options
+USAGE: usage_LasRA { --<name>[{=| }<val>] }... cmd-arg ...
+X Arg Option-Name Req? Description
+X Str check-dirs YES Checkout directory list
+X opt show-defs opt Show the definition tree
+X no help opt Display extended usage information and exit
+X no more-help opt Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LasRp.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LasRp.hlp'
+test_usage_LasRp - Checkout usage_LasRp Options
+USAGE: usage_LasRp { --<name> }... cmd-arg ...
+X Arg Option-Name Req? Description
+X no check-dirs YES Checkout directory list
+X no show-defs opt Show the definition tree
+X no help opt Display extended usage information and exit
+X no more-help opt Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_LasoA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_LasoA.hlp'
+test_usage_LasoA - Checkout usage_LasoA Options
+USAGE: usage_LasoA [ --<name>[{=| }<val>] ]... cmd-arg ...
+X Arg Option-Name Description
+X Str check-dirs Checkout directory list
+X opt show-defs Show the definition tree
+X no help Display extended usage information and exit
+X no more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_Lasop.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_Lasop.hlp'
+test_usage_Lasop - Checkout usage_Lasop Options
+USAGE: usage_Lasop [ --<name> ]... cmd-arg ...
+X Arg Option-Name Description
+X no check-dirs Checkout directory list
+X no show-defs Show the definition tree
+X no help Display extended usage information and exit
+X no more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_sGFRA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_sGFRA.hlp'
+test_usage_sGFRA - Checkout usage_sGFRA Options
+USAGE: usage_sGFRA { -<flag> [<val>] }... cmd-arg ...
+X
+X -L str Checkout directory list
+X -s [arg] Show the definition tree
+X -? Display extended usage information and exit
+X -! Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_sGFRp.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_sGFRp.hlp'
+test_usage_sGFRp - Checkout usage_sGFRp Options
+USAGE: usage_sGFRp { -<flag> }... cmd-arg ...
+X
+X -L Checkout directory list
+X -s Show the definition tree
+X -? Display extended usage information and exit
+X -! Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_sGFoA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_sGFoA.hlp'
+test_usage_sGFoA - Checkout usage_sGFoA Options
+USAGE: usage_sGFoA [ -<flag> [<val>] ]... cmd-arg ...
+X
+X -L str Checkout directory list
+X -s [arg] Show the definition tree
+X -? Display extended usage information and exit
+X -! Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_sGFop.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_sGFop.hlp'
+test_usage_sGFop - Checkout usage_sGFop Options
+USAGE: usage_sGFop [ -<flag> ]... cmd-arg ...
+X
+X -L Checkout directory list
+X -s Show the definition tree
+X -? Display extended usage information and exit
+X -! Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_sGsRA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_sGsRA.hlp'
+test_usage_sGsRA - Checkout usage_sGsRA Options
+USAGE: usage_sGsRA { <option-name>[{=| }<val>] }...
+X
+X check-dirs=str Checkout directory list
+X show-defs[=arg] Show the definition tree
+X help Display extended usage information and exit
+X more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_sGsRp.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_sGsRp.hlp'
+test_usage_sGsRp - Checkout usage_sGsRp Options
+USAGE: usage_sGsRp { <option-name> }...
+X
+X check-dirs Checkout directory list
+X show-defs Show the definition tree
+X help Display extended usage information and exit
+X more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_sGsoA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_sGsoA.hlp'
+test_usage_sGsoA - Checkout usage_sGsoA Options
+USAGE: usage_sGsoA [ <option-name>[{=| }<val>] ]...
+X
+X check-dirs=str Checkout directory list
+X show-defs[=arg] Show the definition tree
+X help Display extended usage information and exit
+X more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_sGsop.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_sGsop.hlp'
+test_usage_sGsop - Checkout usage_sGsop Options
+USAGE: usage_sGsop [ <option-name> ]...
+X
+X check-dirs Checkout directory list
+X show-defs Show the definition tree
+X help Display extended usage information and exit
+X more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_saFRA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_saFRA.hlp'
+test_usage_saFRA - Checkout usage_saFRA Options
+USAGE: usage_saFRA { -<flag> [<val>] }... cmd-arg ...
+X Flg Arg Option-Name Req? Description
+X -L Str check-dirs YES Checkout directory list
+X -s opt show-defs opt Show the definition tree
+X -? no help opt Display extended usage information and exit
+X -! no more-help opt Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_saFRp.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_saFRp.hlp'
+test_usage_saFRp - Checkout usage_saFRp Options
+USAGE: usage_saFRp { -<flag> }... cmd-arg ...
+X Flg Arg Option-Name Req? Description
+X -L no check-dirs YES Checkout directory list
+X -s no show-defs opt Show the definition tree
+X -? no help opt Display extended usage information and exit
+X -! no more-help opt Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_saFoA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_saFoA.hlp'
+test_usage_saFoA - Checkout usage_saFoA Options
+USAGE: usage_saFoA [ -<flag> [<val>] ]... cmd-arg ...
+X Flg Arg Option-Name Description
+X -L Str check-dirs Checkout directory list
+X -s opt show-defs Show the definition tree
+X -? no help Display extended usage information and exit
+X -! no more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_saFop.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_saFop.hlp'
+test_usage_saFop - Checkout usage_saFop Options
+USAGE: usage_saFop [ -<flag> ]... cmd-arg ...
+X Flg Arg Option-Name Description
+X -L no check-dirs Checkout directory list
+X -s no show-defs Show the definition tree
+X -? no help Display extended usage information and exit
+X -! no more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_sasRA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_sasRA.hlp'
+test_usage_sasRA - Checkout usage_sasRA Options
+USAGE: usage_sasRA { <option-name>[{=| }<val>] }...
+X Arg Option-Name Req? Description
+X Str check-dirs YES Checkout directory list
+X opt show-defs opt Show the definition tree
+X no help opt Display extended usage information and exit
+X no more-help opt Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_sasRp.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_sasRp.hlp'
+test_usage_sasRp - Checkout usage_sasRp Options
+USAGE: usage_sasRp { <option-name> }...
+X Arg Option-Name Req? Description
+X no check-dirs YES Checkout directory list
+X no show-defs opt Show the definition tree
+X no help opt Display extended usage information and exit
+X no more-help opt Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_sasoA.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_sasoA.hlp'
+test_usage_sasoA - Checkout usage_sasoA Options
+USAGE: usage_sasoA [ <option-name>[{=| }<val>] ]...
+X Arg Option-Name Description
+X Str check-dirs Checkout directory list
+X opt show-defs Show the definition tree
+X no help Display extended usage information and exit
+X no more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# ============= usage_sasop.hlp ==============
+${SED} 's/^X//;/^[ ]*$/d' << 'SHAR_EOF' > 'usage_sasop.hlp'
+test_usage_sasop - Checkout usage_sasop Options
+USAGE: usage_sasop [ <option-name> ]...
+X Arg Option-Name Description
+X no check-dirs Checkout directory list
+X no show-defs Show the definition tree
+X no help Display extended usage information and exit
+X no more-help Extended usage information passed thru pager
+SHAR_EOF
+
+# # # # # # # # # # DEFINITIONS FILES # # # # # # # # #
+
+emit_defs()
+{
+ exec 4> $1.def
+ cat >&4 <<- _EOF_
+ AutoGen Definitions options;
+ prog-name = test_$1;
+ prog-title = "Checkout $1 Options";
+ config-header = 'config.h';
+ test-main;
+ _EOF_
+
+ cmd_arg="argument = 'cmd-arg ...';"
+ if ${long_opts}
+ then
+ echo "long-opts;" >&4
+ if ${flag_opts}
+ then detail="Long and short (flag) options are accepted."
+ else detail="Only long options are accepted." ; fi
+ else
+ if ${flag_opts}
+ then detail="Only short (flag) options are accepted."
+ else detail="All command line arguments must be named options."
+ cmd_arg=''
+ fi
+ fi
+
+ if ${gnu_usage}
+ then
+ echo "gnu-usage;" >&4
+ detail="${detail}${nl}Usage should be in GNU style."
+ else
+ detail="${detail}${nl}Usage is in AutoOpts traditional style."
+ fi
+
+ cat >&4 <<- _EOF_
+ ${cmd_arg}
+ flag = {
+ name = check_dirs;
+ descrip = "Checkout directory list";
+ _EOF_
+
+ if ${flag_opts}
+ then
+ echo " value = L;" >&4
+ fi
+
+ if ${req_opts}
+ then
+ echo " min = '1';" >&4
+ detail="${detail}${nl}The check-dirs option is required."
+ else
+ detail="${detail}${nl}There are no required options."
+ fi
+
+ if ${arg_opts}
+ then
+ echo " arg-type = string;" >&4
+ echo " arg-name = dir;" >&4
+ detail="${detail}${nl}Some options require arguments."
+ else
+ detail="${detail}${nl}No options require arguments."
+ fi
+
+ cat >&4 <<- _EOF_
+ };
+
+ flag = {
+ name = show_defs;
+ descrip = "Show the definition tree";
+ _EOF_
+
+ if ${flag_opts}
+ then
+ ${long_opts} || echo " value = s;" >&4
+ fi
+
+ if ${arg_opts}
+ then
+ echo " arg-type = number;" >&4
+ echo " arg-name = depth;" >&4
+ echo " arg-optional;" >&4
+ fi
+
+ echo "};" >&4
+ echo "detail = '${detail}';" >&4
+
+ exec 4>&-
+}
+
+run_usage_test() {
+ ${arg_opts} && name="${rname}A" || name="${rname}p"
+ testname=${tname}_${name}
+ emit_defs ${testname}
+ test_list="${test_list} ${testname}"
+ echo firstline >> ${defnames_raw}
+ ${AG_L} ${testname}.def >> ${defnames_raw} || {
+ cat ${defnames_raw}
+ failure "AutoGen could not process $testname"
+ }
+
+ ${SED} \
+ -e '1,/definition names looked up/d' \
+ -e '/end of looked up def/,$d' ${defnames_raw} \
+ ${defnames_raw} >> ${defnames_file}
+ compile ${helpstr}
+ ${SED} -e '/Extended usage information passed thru pager/q' \
+ ${testname}.help > XXX
+ mv XXX ${testname}.help
+ cmp -s ${testname}.help ${testname}.hlp || \
+ failure "FAILED ${testname} hlp -> help
+`diff ${testname}.hlp ${testname}.help`"
+}
+
+test_list=""
+tname=${testname}
+defnames_raw=${TMPDIR}/defnames.raw
+defnames_file=${TMPDIR}/defnames.uniq
+AG_L=${AG_L}\ --used-defines
+
+case "$-" in
+*x* ) setx='set -x' ;;
+* ) setx='' ;;
+esac
+
+stime=$(date +%s)
+
+for long_opts in true false
+do
+ ${long_opts} && lname=L || lname=s
+
+ for gnu_usage in true false
+ do
+ ${gnu_usage} && uname="${lname}G" || uname="${lname}a"
+
+ for flag_opts in true false
+ do
+ ${flag_opts} && fname="${uname}F" || fname="${uname}s"
+
+ if ${long_opts}
+ then helpstr=--help
+
+ elif ${flag_opts}
+ then helpstr='-?'
+
+ else helpstr=help
+ fi
+
+ for req_opts in true false
+ do
+ ${req_opts} && rname="${fname}R" || rname="${fname}o"
+
+ for arg_opts in true false
+ do
+ run_usage_test
+ done
+ done
+ done
+ done
+done
+
+test -z "${DEBUG_USAGE}" && cleanup && exit 0
+
+sort -u -o ${defnames_file} ${defnames_file}
+cat > ${defnames_raw} <<- _EOF_
+ aliases
+ allow_errors
+ arg_default
+ arg_optional
+ arg_range
+ arg_type
+ argument
+ call_proc
+ code
+ config_header
+ copyright
+ default
+ deprecated
+ descrip
+ detail
+ disable
+ documentation
+ eaddr
+ enable
+ enabled
+ environrc
+ equivalence
+ exit_name
+ explain
+ export
+ extract_code
+ field
+ file_fail_code
+ flag
+ flag_code
+ flag_proc
+ flags_cant
+ flags_must
+ full_usage
+ gnu_usage
+ guard_option_names
+ help_value
+ homerc
+ ifdef
+ ifndef
+ immed_disable
+ immediate
+ include
+ lib_name
+ library
+ long_opts
+ main
+ main_text
+ main_type
+ max
+ min
+ more_help_value
+ must_set
+ name
+ no_command
+ no_libopts
+ no_misuse_usage
+ no_preset
+ no_xlate
+ nomem_fail_code
+ omitted_usage
+ package
+ prefix
+ prefix_enum
+ preserve_case
+ prog_name
+ prog_title
+ reorder_args
+ resettable
+ scaled
+ settable
+ short_usage
+ stack_arg
+ std_value
+ test_main
+ translators
+ unstack_arg
+ usage
+ usage_message
+ usage_opt
+ usage_type
+ val_name
+ val_upname
+ value
+ version
+ _EOF_
+
+cmp ${defnames_raw} ${defnames_file} || \
+ failure "${defnames_raw} and ${defnames_file} do not compare${nl}`
+ diff ${defnames_raw} ${defnames_file}`"
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of usage.test
diff --git a/autoopts/test/vendor.test b/autoopts/test/vendor.test
new file mode 100755
index 0000000..a9d0ac8
--- /dev/null
+++ b/autoopts/test/vendor.test
@@ -0,0 +1,174 @@
+#! /bin/sh
+# -*- Mode: shell-script -*-
+# ----------------------------------------------------------------------
+# vendor.test --- test the vendor-opt option
+#
+# Time-stamp: "2012-03-31 13:11:19 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+#
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+{
+ sedcmd='
+s/long-opts;/vendor-opt;/
+/#include "autogen.h"/d
+/^prog-name/s/=.*/= '${testname}';/
+s/AutoGen/'${testname}'/g
+/^include /s/= '${testname}'5 Temp/= AutoGen5 Temp/
+/^config-header/s/=.*/= '${testname}'-config.h;/
+/call-proc *=/d
+/#ifndef XML/,/^#endif/ {
+ /^#else/,/^#endif/d
+ /^#/d
+}
+/flag-code =.*_EOCode_/,/_EOCode_;/d
+/flag-code *=/d
+'
+
+ ${SED} "$sedcmd" ${top_srcdir}/agen5/opts.def
+ cat <<- _EOF_
+ config-header = ${testname}-config.h;
+ help-value = h;
+ save-opts-value = S;
+ load-opts-value = P;
+ gnu-usage;
+ main = { main-type = shell-process; };
+ include = '#undef DEBUG_ENABLED';
+ _EOF_
+} > ${testname}.def
+
+{
+ sed '/^#endif.*_CONFIG_H/d' ${top_builddir}/config.h
+ sed '1,/#define *COMPAT_H_GUARD/d
+ /^#endif .* COMPAT_H_GUARD/{
+ s/COMPAT_H_GUARD/AUTOGEN_CONFIG_H/
+ q
+ }' ${top_srcdir}/compat/compat.h
+} > ./${testname}-config.h
+
+echo ${AG_L} ${testname}.def
+${AG_L} ${testname}.def || \
+ failure AutoGen could not process
+
+sedcmd=''
+HOME=${TMPDIR} compile "-h"
+${SED} 1d ${testname}.help > ${testname}.$$
+mv -f ${testname}.$$ ${testname}.help
+
+clean_help > ${testname}.hlp <<_EOF_
+USAGE: ${testname} [ -<flag> [<val>] ]... [ <def-file> ]
+The following options select definitions, templates and scheme functions
+to use:
+ -L str Template search directory list
+ - may appear multiple times
+ -T str Override template file
+ - may not be preset
+ -l str Library template file
+ - may appear multiple times
+ -S str Scheme code file to load
+ -F str Load scheme function library
+ -m Do not use in-mem streams
+The following options modify how output is handled:
+ -b str Base name for output file(s)
+ - may not be preset
+The following options are often useful while debugging new templates:
+ -t num Time limit for server shell
+ - It must be in the range:
+ 0 to 3600
+ --- show-defs This option has been disabled
+ -C Leave a core dump on a failure exit
+These options can be used to control what gets processed in the
+definitions files and template files:
+ -s str Omit the file with this suffix
+ - prohibits these options:
+ select-suffix
+ - may not be preset
+ - may appear multiple times
+ -o str specify this output suffix
+ - may not be preset
+ - may appear multiple times
+ -D str name to add to definition list
+ - may appear multiple times
+ -U str definition list removal pattern
+ - an alternate for define
+This option is used to automate dependency tracking:
+ -M [arg] emit make dependency file
+ - may not be preset
+ - may appear multiple times
+version, usage and configuration options:
+ -R str Reset an option's state
+ -v [arg] Output version information and exit
+ -h Display extended usage information and exit
+ -! Extended usage information passed thru pager
+ -u Abbreviated usage to stdout
+ -S [arg] Save the option state to a config file
+ -P str Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+The next option supports vendor supported extra options:
+ -W str vendor supported additional options
+ These additional options are:
+ definitions=str Definitions input file
+ - disabled as --no-definitions
+ - enabled by default
+ - may not be preset
+ shell=str name or path name of shell to use
+ equate=str characters considered equivalent
+ source-time set mod times to latest source
+ - disabled as --no-source-time
+ writable Allow output files to be writable
+ - disabled as --not-writable
+ loop-limit=num Limit on increment loops
+ - is scalable with a suffix: k/K/m/M/g/G/t/T
+ - It must lie in one of the ranges:
+ -1 exactly, or
+ 1 to 16777216
+ trace=KWd tracing level of detail
+ trace-out=str tracing output file or filter
+ used-defines Show the definitions used
+ - may not be preset
+${testname} creates text files from templates using external definitions.
+
+The following option preset mechanisms are supported:
+ - reading file \$HOME/.${testname}rc
+ - reading file ./.${testname}rc
+ - examining environment variables named `
+ echo ${testname} | tr 'a-z' 'A-Z'`_*
+
+The valid "trace" option keywords are:
+ nothing debug-message server-shell templates block-macros
+ expressions everything
+ or an integer from 0 through 6
+
+${testname} is a tool designed for generating program files that contain
+repetitive text with varied substitutions.
+_EOF_
+
+cmp -s ${testname}.h*lp || \
+ failure "`diff ${testname}.hlp ${testname}.help`"
+
+cleanup
diff --git a/autoopts/test/vers.test b/autoopts/test/vers.test
new file mode 100755
index 0000000..55fb435
--- /dev/null
+++ b/autoopts/test/vers.test
@@ -0,0 +1,107 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# vers.test --- test vers program attribute
+# make sure that when it is not specified
+# then option processing consumes all args.
+#
+# Time-stamp: "2011-08-07 17:35:55 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+##
+# ----------------------------------------------------------------------
+
+. ./defs
+
+# # # # # # # # # # DEFINITIONS FILE # # # # # # # # #
+
+echo "creating $testname.def in `pwd`"
+testname="$testname" test_main="${test_main}" \
+argument="${argument}" long_opts="${long_opts}" \
+${SHELLX} ${stdopts} option second || failure "Could not construct stdopts"
+echo 'help-value = h;' >> $testname.def
+echo 'version-value = V;' >> $testname.def
+
+echo ${AG_L} $testname.def
+${AG_L} $testname.def || \
+ failure AutoGen could not process
+
+compile "-h"
+
+
+# # # # # # # # # # HELP OUTPUT FILE # # # # # # # # #
+
+echo creating $testname.hlp
+clean_help > $testname.hlp <<'_EOF_'
+test_vers - Test AutoOpts for vers
+USAGE: vers [ -<flag> ]...
+ Flg Arg Option-Name Description
+ -o no option The option option descrip
+ -s no second The second option descrip
+ -h no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+_EOF_
+
+cmp -s $testname.h*lp || \
+ failure help output mismatch
+
+./$testname -v 2> /dev/null && \
+ failure $testname should not accept version option
+
+ver="`echo '$Revision: 4.8 $'|${SED} 's/.*: *\([0-9.a-z]*\).*/\1/'`"
+echo "version = '$ver';" >> $testname.def
+
+echo ${AG_L} $testname.def
+${AG_L} $testname.def || \
+ failure AutoGen could not process
+
+compile "-h"
+
+./$testname -V 2> /dev/null || \
+ failure "$testname '*SHOULD*' accept version option"
+
+echo recreating $testname.hlp
+clean_help > $testname.hlp <<_EOF_
+test_vers - Test AutoOpts for vers - Ver. ${ver}
+USAGE: vers [ -<flag> ]...
+ Flg Arg Option-Name Description
+ -o no option The option option descrip
+ -s no second The second option descrip
+ -V opt version Output version information and exit
+ -h no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+_EOF_
+
+cmp -s $testname.h*lp || \
+ failure versioned help output mismatch
+
+cleanup
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## End:
+
+# end of vers.test
diff --git a/autoopts/text_mmap.c b/autoopts/text_mmap.c
new file mode 100644
index 0000000..4a7aa1a
--- /dev/null
+++ b/autoopts/text_mmap.c
@@ -0,0 +1,370 @@
+/**
+ * @file text_mmap.c
+ *
+ * Map a text file, ensuring the text always has an ending NUL byte.
+ *
+ * Time-stamp: "2012-01-29 09:40:21 bkorb"
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+#if defined(HAVE_MMAP)
+# ifndef MAP_ANONYMOUS
+# ifdef MAP_ANON
+# define MAP_ANONYMOUS MAP_ANON
+# endif
+# endif
+
+# if ! defined(MAP_ANONYMOUS) && ! defined(HAVE_DEV_ZERO)
+ /*
+ * We must have either /dev/zero or anonymous mapping for
+ * this to work.
+ */
+# undef HAVE_MMAP
+
+# else
+# ifdef _SC_PAGESIZE
+# define GETPAGESIZE() sysconf(_SC_PAGESIZE)
+# else
+# define GETPAGESIZE() getpagesize()
+# endif
+# endif
+#endif
+
+/*
+ * Some weird systems require that a specifically invalid FD number
+ * get passed in as an argument value. Which value is that? Well,
+ * as everybody knows, if open(2) fails, it returns -1, so that must
+ * be the value. :)
+ */
+#define AO_INVALID_FD -1
+
+#define FILE_WRITABLE(_prt,_flg) \
+ ( (_prt & PROT_WRITE) \
+ && ((_flg & (MAP_SHARED|MAP_PRIVATE)) == MAP_SHARED))
+#define MAP_FAILED_PTR ((void*)MAP_FAILED)
+
+/**
+ * Load the contents of a text file. There are two separate implementations,
+ * depending up on whether mmap(3) is available.
+ *
+ * If not available, malloc the file length plus one byte. Read it in
+ * and NUL terminate.
+ *
+ * If available, first check to see if the text file size is a multiple of a
+ * page size. If it is, map the file size plus an extra page from either
+ * anonymous memory or from /dev/zero. Then map the file text on top of the
+ * first pages of the anonymous/zero pages. Otherwise, just map the file
+ * because there will be NUL bytes provided at the end.
+ *
+ * @param mapinfo a structure holding everything we need to know
+ * about the mapping.
+ *
+ * @param pzFile name of the file, for error reporting.
+ */
+static void
+load_text_file(tmap_info_t * mapinfo, char const * pzFile)
+{
+#if ! defined(HAVE_MMAP)
+ mapinfo->txt_data = AGALOC(mapinfo->txt_size+1, "file text");
+ if (mapinfo->txt_data == NULL) {
+ mapinfo->txt_errno = ENOMEM;
+ return;
+ }
+
+ {
+ size_t sz = mapinfo->txt_size;
+ char* pz = mapinfo->txt_data;
+
+ while (sz > 0) {
+ ssize_t rdct = read(mapinfo->txt_fd, pz, sz);
+ if (rdct <= 0) {
+ mapinfo->txt_errno = errno;
+ fprintf(stderr, zFSErrReadFile,
+ errno, strerror(errno), pzFile);
+ free(mapinfo->txt_data);
+ return;
+ }
+
+ pz += rdct;
+ sz -= rdct;
+ }
+
+ *pz = NUL;
+ }
+
+ mapinfo->txt_errno = 0;
+
+#else /* HAVE mmap */
+ size_t const pgsz = GETPAGESIZE();
+ void * map_addr = NULL;
+
+ (void)pzFile;
+
+ mapinfo->txt_full_size = (mapinfo->txt_size + pgsz) & ~(pgsz - 1);
+ if (mapinfo->txt_full_size == (mapinfo->txt_size + pgsz)) {
+ /*
+ * The text is a multiple of a page boundary. We must map an
+ * extra page so the text ends with a NUL.
+ */
+#if defined(MAP_ANONYMOUS)
+ map_addr = mmap(NULL, mapinfo->txt_full_size, PROT_READ|PROT_WRITE,
+ MAP_ANONYMOUS|MAP_PRIVATE, AO_INVALID_FD, 0);
+#else
+ mapinfo->txt_zero_fd = open("/dev/zero", O_RDONLY);
+
+ if (mapinfo->txt_zero_fd == AO_INVALID_FD) {
+ mapinfo->txt_errno = errno;
+ return;
+ }
+ map_addr = mmap(NULL, mapinfo->txt_full_size, PROT_READ|PROT_WRITE,
+ MAP_PRIVATE, mapinfo->txt_zero_fd, 0);
+#endif
+ if (map_addr == MAP_FAILED_PTR) {
+ mapinfo->txt_errno = errno;
+ return;
+ }
+ mapinfo->txt_flags |= MAP_FIXED;
+ }
+
+ mapinfo->txt_data =
+ mmap(map_addr, mapinfo->txt_size, mapinfo->txt_prot,
+ mapinfo->txt_flags, mapinfo->txt_fd, 0);
+
+ if (mapinfo->txt_data == MAP_FAILED_PTR)
+ mapinfo->txt_errno = errno;
+#endif /* HAVE_MMAP */
+}
+
+/**
+ * Make sure all the parameters are correct: we have a file name that
+ * is a text file that we can read.
+ *
+ * @param fname the text file to map
+ * @param prot the memory protections requested (read/write/etc.)
+ * @param flags mmap flags
+ * @param mapinfo a structure holding everything we need to know
+ * about the mapping.
+ */
+static void
+validate_mmap(char const * fname, int prot, int flags, tmap_info_t * mapinfo)
+{
+ memset(mapinfo, 0, sizeof(*mapinfo));
+#if defined(HAVE_MMAP) && ! defined(MAP_ANONYMOUS)
+ mapinfo->txt_zero_fd = AO_INVALID_FD;
+#endif
+ mapinfo->txt_fd = AO_INVALID_FD;
+ mapinfo->txt_prot = prot;
+ mapinfo->txt_flags = flags;
+
+ /*
+ * Make sure we can stat the regular file. Save the file size.
+ */
+ {
+ struct stat sb;
+ if (stat(fname, &sb) != 0) {
+ mapinfo->txt_errno = errno;
+ return;
+ }
+
+ if (! S_ISREG(sb.st_mode)) {
+ mapinfo->txt_errno = errno = EINVAL;
+ return;
+ }
+
+ mapinfo->txt_size = sb.st_size;
+ }
+
+ /*
+ * Map mmap flags and protections into open flags and do the open.
+ */
+ {
+ /*
+ * See if we will be updating the file. If we can alter the memory
+ * and if we share the data and we are *not* copy-on-writing the data,
+ * then our updates will show in the file, so we must open with
+ * write access.
+ */
+ int o_flag = FILE_WRITABLE(prot, flags) ? O_RDWR : O_RDONLY;
+
+ /*
+ * If you're not sharing the file and you are writing to it,
+ * then don't let anyone else have access to the file.
+ */
+ if (((flags & MAP_SHARED) == 0) && (prot & PROT_WRITE))
+ o_flag |= O_EXCL;
+
+ mapinfo->txt_fd = open(fname, o_flag);
+ }
+
+ if (mapinfo->txt_fd == AO_INVALID_FD)
+ mapinfo->txt_errno = errno;
+}
+
+/**
+ * Close any files opened by the mapping.
+ *
+ * @param mi a structure holding everything we need to know about the map.
+ */
+static void
+close_mmap_files(tmap_info_t * mi)
+{
+ if (mi->txt_fd == AO_INVALID_FD)
+ return;
+
+ close(mi->txt_fd);
+ mi->txt_fd = AO_INVALID_FD;
+
+#if ! defined(MAP_ANONYMOUS)
+ if (mi->txt_zero_fd == AO_INVALID_FD)
+ return;
+
+ close(mi->txt_zero_fd);
+ mi->txt_zero_fd = AO_INVALID_FD;
+#endif
+}
+
+/*=export_func text_mmap
+ * private:
+ *
+ * what: map a text file with terminating NUL
+ *
+ * arg: char const*, pzFile, name of the file to map
+ * arg: int, prot, mmap protections (see mmap(2))
+ * arg: int, flags, mmap flags (see mmap(2))
+ * arg: tmap_info_t*, mapinfo, returned info about the mapping
+ *
+ * ret-type: void*
+ * ret-desc: The mmaped data address
+ *
+ * doc:
+ *
+ * This routine will mmap a file into memory ensuring that there is at least
+ * one @file{NUL} character following the file data. It will return the
+ * address where the file contents have been mapped into memory. If there is a
+ * problem, then it will return @code{MAP_FAILED} and set @code{errno}
+ * appropriately.
+ *
+ * The named file does not exist, @code{stat(2)} will set @code{errno} as it
+ * will. If the file is not a regular file, @code{errno} will be
+ * @code{EINVAL}. At that point, @code{open(2)} is attempted with the access
+ * bits set appropriately for the requested @code{mmap(2)} protections and flag
+ * bits. On failure, @code{errno} will be set according to the documentation
+ * for @code{open(2)}. If @code{mmap(2)} fails, @code{errno} will be set as
+ * that routine sets it. If @code{text_mmap} works to this point, a valid
+ * address will be returned, but there may still be ``issues''.
+ *
+ * If the file size is not an even multiple of the system page size, then
+ * @code{text_map} will return at this point and @code{errno} will be zero.
+ * Otherwise, an anonymous map is attempted. If not available, then an attempt
+ * is made to @code{mmap(2)} @file{/dev/zero}. If any of these fail, the
+ * address of the file's data is returned, bug @code{no} @file{NUL} characters
+ * are mapped after the end of the data.
+ *
+ * see: mmap(2), open(2), stat(2)
+ *
+ * err: Any error code issued by mmap(2), open(2), stat(2) is possible.
+ * Additionally, if the specified file is not a regular file, then
+ * errno will be set to @code{EINVAL}.
+ *
+ * example:
+ * #include <mylib.h>
+ * tmap_info_t mi;
+ * int no_nul;
+ * void* data = text_mmap("file", PROT_WRITE, MAP_PRIVATE, &mi);
+ * if (data == MAP_FAILED) return;
+ * no_nul = (mi.txt_size == mi.txt_full_size);
+ * << use the data >>
+ * text_munmap(&mi);
+=*/
+void *
+text_mmap(char const * pzFile, int prot, int flags, tmap_info_t * mi)
+{
+ validate_mmap(pzFile, prot, flags, mi);
+ if (mi->txt_errno != 0)
+ return MAP_FAILED_PTR;
+
+ load_text_file(mi, pzFile);
+
+ if (mi->txt_errno == 0)
+ return mi->txt_data;
+
+ close_mmap_files(mi);
+
+ errno = mi->txt_errno;
+ mi->txt_data = MAP_FAILED_PTR;
+ return mi->txt_data;
+}
+
+
+/*=export_func text_munmap
+ * private:
+ *
+ * what: unmap the data mapped in by text_mmap
+ *
+ * arg: tmap_info_t*, mapinfo, info about the mapping
+ *
+ * ret-type: int
+ * ret-desc: -1 or 0. @code{errno} will have the error code.
+ *
+ * doc:
+ *
+ * This routine will unmap the data mapped in with @code{text_mmap} and close
+ * the associated file descriptors opened by that function.
+ *
+ * see: munmap(2), close(2)
+ *
+ * err: Any error code issued by munmap(2) or close(2) is possible.
+=*/
+int
+text_munmap(tmap_info_t * mi)
+{
+ errno = 0;
+
+#ifdef HAVE_MMAP
+ (void)munmap(mi->txt_data, mi->txt_full_size);
+
+#else /* don't HAVE_MMAP */
+ /*
+ * IF the memory is writable *AND* it is not private (copy-on-write)
+ * *AND* the memory is "sharable" (seen by other processes)
+ * THEN rewrite the data. Emulate mmap visibility.
+ */
+ if ( FILE_WRITABLE(mi->txt_prot, mi->txt_flags)
+ && (lseek(mi->txt_fd, 0, SEEK_SET) >= 0) ) {
+ write(mi->txt_fd, mi->txt_data, mi->txt_size);
+ }
+
+ free(mi->txt_data);
+#endif /* HAVE_MMAP */
+
+ mi->txt_errno = errno;
+ close_mmap_files(mi);
+
+ return mi->txt_errno;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/text_mmap.c */
diff --git a/autoopts/time.c b/autoopts/time.c
new file mode 100644
index 0000000..e8e4f05
--- /dev/null
+++ b/autoopts/time.c
@@ -0,0 +1,143 @@
+
+/**
+ * \file time.c
+ *
+ * Time-stamp: "2012-08-11 08:34:17 bkorb"
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/*=export_func optionTimeVal
+ * private:
+ *
+ * what: process an option with a time duration.
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ *
+ * doc:
+ * Decipher a time duration value.
+=*/
+void
+optionTimeVal(tOptions * pOpts, tOptDesc * pOD)
+{
+ time_t val;
+
+ if (pOpts <= OPTPROC_EMIT_LIMIT)
+ return;
+
+ if ((pOD->fOptState & OPTST_RESET) != 0)
+ return;
+
+ val = parse_duration(pOD->optArg.argString);
+ if (val == BAD_TIME) {
+ fprintf(stderr, zNotDuration, pOpts->pzProgName, pOD->optArg.argString);
+ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0)
+ (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE);
+ }
+
+ if (pOD->fOptState & OPTST_ALLOC_ARG) {
+ AGFREE(pOD->optArg.argString);
+ pOD->fOptState &= ~OPTST_ALLOC_ARG;
+ }
+
+ pOD->optArg.argInt = (unsigned long)val;
+}
+
+/*=export_func optionTimeDate
+ * private:
+ *
+ * what: process an option with a time and date.
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
+ *
+ * doc:
+ * Decipher a time and date value.
+=*/
+void
+optionTimeDate(tOptions * pOpts, tOptDesc * pOD)
+{
+#if defined(HAVE_GETDATE_R) && defined(HAVE_PUTENV)
+ if (pOpts <= OPTPROC_EMIT_LIMIT)
+ return;
+
+ if ((! HAS_pzPkgDataDir(pOpts)) || (pOpts->pzPkgDataDir == NULL))
+ goto default_action;
+
+ /*
+ * Export the DATEMSK environment variable. getdate_r() uses it to
+ * find the file with the strptime formats. If we cannot find the file
+ * we need ($PKGDATADIR/datemsk), then fall back to just a time duration.
+ */
+ {
+ static char * envptr = NULL;
+
+ if (envptr == NULL) {
+ static char const fmt[] = "DATEMSK=%s/datemsk";
+ envptr = AGALOC(sizeof(fmt) + strlen(pOpts->pzPkgDataDir), fmt);
+ sprintf(envptr, fmt, pOpts->pzPkgDataDir);
+
+ putenv(envptr);
+ }
+
+ if (access(envptr+8, R_OK) != 0)
+ goto default_action;
+ }
+
+ /*
+ * Convert the date to a time since the epoch and stash it in a long int.
+ */
+ {
+ struct tm stm;
+ time_t tm;
+
+ if (getdate_r(pOD->optArg.argString, &stm) != 0) {
+ fprintf(stderr, zNotDate, pOpts->pzProgName,
+ pOD->optArg.argString);
+ if ((pOpts->fOptSet & OPTPROC_ERRSTOP) != 0)
+ (*(pOpts->pUsageProc))(pOpts, EXIT_FAILURE);
+ return;
+ }
+
+ tm = mktime(&stm);
+
+ if (pOD->fOptState & OPTST_ALLOC_ARG) {
+ AGFREE(pOD->optArg.argString);
+ pOD->fOptState &= ~OPTST_ALLOC_ARG;
+ }
+
+ pOD->optArg.argInt = tm;
+ }
+ return;
+
+default_action:
+
+#endif
+ optionTimeVal(pOpts, pOD);
+ if (pOD->optArg.argInt != BAD_TIME)
+ pOD->optArg.argInt += (unsigned long)time(NULL);
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/time.c */
diff --git a/autoopts/tokenize.c b/autoopts/tokenize.c
new file mode 100644
index 0000000..9563713
--- /dev/null
+++ b/autoopts/tokenize.c
@@ -0,0 +1,333 @@
+/*
+ * This file defines the string_tokenize interface
+ * Time-stamp: "2012-03-04 13:23:50 bkorb"
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+#include <errno.h>
+#include <stdlib.h>
+
+#define cc_t const unsigned char
+#define ch_t unsigned char
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+copy_cooked(ch_t** ppDest, char const ** ppSrc);
+
+static void
+copy_raw(ch_t** ppDest, char const ** ppSrc);
+
+static token_list_t *
+alloc_token_list(char const * str);
+/* = = = END-STATIC-FORWARD = = = */
+
+static void
+copy_cooked(ch_t** ppDest, char const ** ppSrc)
+{
+ ch_t* pDest = (ch_t*)*ppDest;
+ const ch_t* pSrc = (const ch_t*)(*ppSrc + 1);
+
+ for (;;) {
+ ch_t ch = *(pSrc++);
+ switch (ch) {
+ case NUL: *ppSrc = NULL; return;
+ case '"': goto done;
+ case '\\':
+ pSrc += ao_string_cook_escape_char((char*)pSrc, (char*)&ch, 0x7F);
+ if (ch == 0x7F)
+ break;
+ /* FALLTHROUGH */
+
+ default:
+ *(pDest++) = ch;
+ }
+ }
+
+ done:
+ *ppDest = (ch_t*)pDest; /* next spot for storing character */
+ *ppSrc = (char const *)pSrc; /* char following closing quote */
+}
+
+
+static void
+copy_raw(ch_t** ppDest, char const ** ppSrc)
+{
+ ch_t* pDest = *ppDest;
+ cc_t* pSrc = (cc_t*) (*ppSrc + 1);
+
+ for (;;) {
+ ch_t ch = *(pSrc++);
+ switch (ch) {
+ case NUL: *ppSrc = NULL; return;
+ case '\'': goto done;
+ case '\\':
+ /*
+ * *Four* escapes are handled: newline removal, escape char
+ * quoting and apostrophe quoting
+ */
+ switch (*pSrc) {
+ case NUL: *ppSrc = NULL; return;
+ case '\r':
+ if (*(++pSrc) == NL)
+ ++pSrc;
+ continue;
+
+ case NL:
+ ++pSrc;
+ continue;
+
+ case '\'':
+ ch = '\'';
+ /* FALLTHROUGH */
+
+ case '\\':
+ ++pSrc;
+ break;
+ }
+ /* FALLTHROUGH */
+
+ default:
+ *(pDest++) = ch;
+ }
+ }
+
+ done:
+ *ppDest = pDest; /* next spot for storing character */
+ *ppSrc = (char const *) pSrc; /* char following closing quote */
+}
+
+static token_list_t *
+alloc_token_list(char const * str)
+{
+ token_list_t * res;
+
+ int max_token_ct = 2; /* allow for trailing NULL pointer & NUL on string */
+
+ if (str == NULL) goto enoent_res;
+
+ /*
+ * Trim leading white space. Use "ENOENT" and a NULL return to indicate
+ * an empty string was passed.
+ */
+ str = SPN_WHITESPACE_CHARS(str);
+ if (*str == NUL) goto enoent_res;
+
+ /*
+ * Take an approximate count of tokens. If no quoted strings are used,
+ * it will be accurate. If quoted strings are used, it will be a little
+ * high and we'll squander the space for a few extra pointers.
+ */
+ {
+ char const * pz = str;
+
+ do {
+ max_token_ct++;
+ pz = BRK_WHITESPACE_CHARS(pz+1);
+ pz = SPN_WHITESPACE_CHARS(pz);
+ } while (*pz != NUL);
+
+ res = malloc(sizeof(*res) + (pz - str)
+ + (max_token_ct * sizeof(ch_t*)));
+ }
+
+ if (res == NULL)
+ errno = ENOMEM;
+ else res->tkn_list[0] = (ch_t*)(res->tkn_list + (max_token_ct - 1));
+
+ return res;
+
+ enoent_res:
+
+ errno = ENOENT;
+ return NULL;
+}
+
+/*=export_func ao_string_tokenize
+ *
+ * what: tokenize an input string
+ *
+ * arg: + char const* + string + string to be tokenized +
+ *
+ * ret_type: token_list_t*
+ * ret_desc: pointer to a structure that lists each token
+ *
+ * doc:
+ *
+ * This function will convert one input string into a list of strings.
+ * The list of strings is derived by separating the input based on
+ * white space separation. However, if the input contains either single
+ * or double quote characters, then the text after that character up to
+ * a matching quote will become the string in the list.
+ *
+ * The returned pointer should be deallocated with @code{free(3C)} when
+ * are done using the data. The data are placed in a single block of
+ * allocated memory. Do not deallocate individual token/strings.
+ *
+ * The structure pointed to will contain at least these two fields:
+ * @table @samp
+ * @item tkn_ct
+ * The number of tokens found in the input string.
+ * @item tok_list
+ * An array of @code{tkn_ct + 1} pointers to substring tokens, with
+ * the last pointer set to NULL.
+ * @end table
+ *
+ * There are two types of quoted strings: single quoted (@code{'}) and
+ * double quoted (@code{"}). Singly quoted strings are fairly raw in that
+ * escape characters (@code{\\}) are simply another character, except when
+ * preceding the following characters:
+ * @example
+ * @code{\\} double backslashes reduce to one
+ * @code{'} incorporates the single quote into the string
+ * @code{\n} suppresses both the backslash and newline character
+ * @end example
+ *
+ * Double quote strings are formed according to the rules of string
+ * constants in ANSI-C programs.
+ *
+ * example:
+ * @example
+ * #include <stdlib.h>
+ * int ix;
+ * token_list_t* ptl = ao_string_tokenize(some_string)
+ * for (ix = 0; ix < ptl->tkn_ct; ix++)
+ * do_something_with_tkn(ptl->tkn_list[ix]);
+ * free(ptl);
+ * @end example
+ * Note that everything is freed with the one call to @code{free(3C)}.
+ *
+ * err:
+ * NULL is returned and @code{errno} will be set to indicate the problem:
+ * @itemize @bullet
+ * @item
+ * @code{EINVAL} - There was an unterminated quoted string.
+ * @item
+ * @code{ENOENT} - The input string was empty.
+ * @item
+ * @code{ENOMEM} - There is not enough memory.
+ * @end itemize
+=*/
+token_list_t*
+ao_string_tokenize(char const* str)
+{
+ token_list_t* res = alloc_token_list(str);
+ ch_t* pzDest;
+
+ /*
+ * Now copy each token into the output buffer.
+ */
+ if (res == NULL)
+ return res;
+
+ pzDest = (ch_t*)(res->tkn_list[0]);
+ res->tkn_ct = 0;
+
+ do {
+ res->tkn_list[ res->tkn_ct++ ] = pzDest;
+ for (;;) {
+ int ch = (ch_t)*str;
+ if (IS_WHITESPACE_CHAR(ch)) {
+ found_white_space:
+ str = SPN_WHITESPACE_CHARS(str+1);
+ break;
+ }
+
+ switch (ch) {
+ case '"':
+ copy_cooked(&pzDest, &str);
+ if (str == NULL) {
+ free(res);
+ errno = EINVAL;
+ return NULL;
+ }
+ if (IS_WHITESPACE_CHAR(*str))
+ goto found_white_space;
+ break;
+
+ case '\'':
+ copy_raw(&pzDest, &str);
+ if (str == NULL) {
+ free(res);
+ errno = EINVAL;
+ return NULL;
+ }
+ if (IS_WHITESPACE_CHAR(*str))
+ goto found_white_space;
+ break;
+
+ case NUL:
+ goto copy_done;
+
+ default:
+ str++;
+ *(pzDest++) = (unsigned char)ch;
+ }
+ } copy_done:;
+
+ /*
+ * NUL terminate the last token and see if we have any more tokens.
+ */
+ *(pzDest++) = NUL;
+ } while (*str != NUL);
+
+ res->tkn_list[ res->tkn_ct ] = NULL;
+
+ return res;
+}
+
+#ifdef TEST
+#include <stdio.h>
+#include <string.h>
+
+int
+main(int argc, char** argv)
+{
+ if (argc == 1) {
+ printf("USAGE: %s arg [ ... ]\n", *argv);
+ return 1;
+ }
+ while (--argc > 0) {
+ char* arg = *(++argv);
+ token_list_t* p = ao_string_tokenize(arg);
+ if (p == NULL) {
+ printf("Parsing string ``%s'' failed:\n\terrno %d (%s)\n",
+ arg, errno, strerror(errno));
+ } else {
+ int ix = 0;
+ printf("Parsed string ``%s''\ninto %d tokens:\n", arg, p->tkn_ct);
+ do {
+ printf(" %3d: ``%s''\n", ix+1, p->tkn_list[ix]);
+ } while (++ix < p->tkn_ct);
+ free(p);
+ }
+ }
+ return 0;
+}
+#endif
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/tokenize.c */
diff --git a/autoopts/tpl/aginfo.tpl b/autoopts/tpl/aginfo.tpl
new file mode 100644
index 0000000..01e4e2f
--- /dev/null
+++ b/autoopts/tpl/aginfo.tpl
@@ -0,0 +1,10 @@
+[= AutoGen5 template
+
+texi
+
+=]
+[= `echo please note that this is obsolete >&2` =][=
+
+INCLUDE "agtexi-cmd.tpl"
+
+\=]
diff --git a/autoopts/tpl/aginfo3.tpl b/autoopts/tpl/aginfo3.tpl
new file mode 100644
index 0000000..6c79e22
--- /dev/null
+++ b/autoopts/tpl/aginfo3.tpl
@@ -0,0 +1,128 @@
+{+ AutoGen5 template -*- nroff -*-
+
+texi
+
+## ---------------------------------------------------------------------
+## aginfo3.tpl -- Template for function texi doc
+##
+## Time-stamp: "2011-02-01 06:38:27 bkorb"
+## Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
++}{+
+
+(out-push-new (sprintf "%s.menu" (base-name)))
+(define lib-name (get "library"))
+(if (< (string-length lib-name) 1)
+ (set! lib-name (base-name)) )
+(define node-name (sprintf "lib%s procedures" lib-name))
+(define sec-name (sprintf "lib%s External Procedures" lib-name))
+
+(define doc-level (getenv "LEVEL"))
+(if (not (string? doc-level))
+ (set! doc-level "section"))
+(sprintf "* %-28s %s\n" (string-append node-name "::") sec-name) +}{+
+(out-pop)
++}@node {+ (. node-name) +}
+@{+ (. doc-level) +} {+ (. sec-name) +}
+
+{+
+
+IF (not (exist? "lib-description"))
+
++}These are the publicly exported procedures from the lib@i{{+(. lib-name)+}}
+library. Any other functions mentioned in the @i{header} file are
+for the private use of the library.{+
+
+ELSE +}{+ lib-description +}{+
+ENDIF +}
+
+@menu{+
+
+FOR export-func +}{+
+ IF (not (exist? "private")) +}
+* lib{+(sprintf "%-24s" (string-append
+ lib-name "-" (get "name") "::"))
+ +} {+name +}{+
+
+ ENDIF private +}{+
+
+ENDFOR export-func +}
+@end menu
+
+This {+(. doc-level)+} was automatically generated by AutoGen
+using extracted information and the {+(tpl-file)+} template.{+
+
+FOR export-func +}{+
+ IF (not (exist? "private"))
+
++}
+
+@node lib{+library+}-{+name+}
+@{+CASE (. doc-level)+}{+
+ = chapter +}{+
+ = section +}sub{+
+ = subsection +}subsub{+
+ ESAC +}section {+name+}
+@findex {+name+}
+
+{+what+}
+
+@noindent
+Usage:
+@example
+{+ % ret-type "%s res = "
++}{+name+}({+
+ IF (exist? "arg") +} {+
+ FOR arg ", " +}{+arg-name+}{+
+ ENDFOR +} {+
+ ENDIF +});
+@end example{+
+ IF (or (exist? "arg") (exist? "ret-type")) +}
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------{+
+ FOR arg "\n" +}
+@item @tab {+arg-name+} @tab @code{{+arg-type+}}
+@tab {+arg-desc+}{+
+ ENDFOR+}{+
+ IF (exist? "ret-type") +}
+@item @tab returns @tab {+ret-type+}
+@tab {+ ret-desc +}{+
+
+ ENDIF +}
+@end multitable{+
+
+ ENDIF
++}
+
+{+doc+}
+{+ % err "\n%s\n" +}{+
+
+ ENDIF private +}{+
+
+ENDFOR export-func
+
+
++}
diff --git a/autoopts/tpl/agman-cmd.tpl b/autoopts/tpl/agman-cmd.tpl
new file mode 100644
index 0000000..1ba4908
--- /dev/null
+++ b/autoopts/tpl/agman-cmd.tpl
@@ -0,0 +1,123 @@
+[+: -*- Mode: nroff -*-
+
+ AutoGen5 template man
+
+## agman-cmd.tpl -- Template for command line man pages
+##
+## Time-stamp: "2011-11-18 07:48:17 bkorb"
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+# Produce a man page for section 1, 5 or 8 commands.
+# Which is selected via: -DMAN_SECTION=n
+# passed to the autogen invocation. "n" may have a suffix, if desired.
+#
+:+][+:
+
+(define head-line (lambda()
+ (sprintf ".TH %s %s \"%s\" \"%s\" \"%s\"\n.\\\"\n"
+ (get "prog-name") man-sect
+ (shell "date '+%d %b %Y'") package-text section-name) ))
+
+(define man-page #t)
+
+:+][+:
+
+INCLUDE "cmd-doc.tlib"
+
+:+]
+.\"
+.SH NAME
+[+: prog-name :+] \- [+: prog-title :+]
+[+:
+
+(out-push-new) :+][+:
+
+INVOKE build-doc :+][+:
+
+ (shell (string-append
+ "fn='" (find-file "mdoc2man") "'\n"
+ "test -f ${fn} || die mdoc2man not found from $PWD\n"
+ "${fn} <<\\_EndOfMdoc_ || die ${fn} failed in $PWD\n"
+ (out-pop #t)
+ "\n_EndOfMdoc_" ))
+
+:+][+:
+
+(out-move (string-append (get "prog-name") "."
+ man-sect)) :+][+: #
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" S Y N O P S I S
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE mk-synopsis :+][+:
+ (out-push-new file-name) \:+]
+.SH SYNOPSIS
+.B [+: prog-name :+][+:
+
+ IF (. use-flags) :+][+:
+ IF (exist? "long-opts") :+]
+.\" Mixture of short (flag) options and long options
+.RB [ \-\fIflag\fP " [\fIvalue\fP]]... [" \-\-\fIopt\-name\fP[+:#
+:+] " [[=| ]\fIvalue\fP]]..."[+:
+
+ ELSE no long options: :+]
+.\" Short (flag) options only
+.RB [ \-\fIflag\fP " [\fIvalue\fP]]..."[+:
+ ENDIF
+ :+][+:
+ ELIF (exist? "long-opts")
+ :+]
+.\" Long options only
+.RB [ \-\-\fIopt\-name\fP [ = "| ] \fIvalue\fP]]..."[+:
+
+ ELIF (not (exist? "argument")) :+]
+.RI [ opt\-name "[\fB=\fP" value ]]...
+.PP
+All arguments are named options.[+:
+ ENDIF :+][+:
+
+ IF (exist? "argument")
+ :+] [+: argument :+][+:
+
+ IF (exist? "reorder-args") :+]
+.PP
+Operands and options may be intermixed. They will be reordered.
+[+: ENDIF :+][+:
+
+ ELIF (or (exist? "long-opts") use-flags)
+
+:+]
+.PP
+All arguments must be options.[+:
+
+ ENDIF :+][+:
+
+(if (exist? "explain")
+ (string-append "\n.PP\n"
+ (join "\n.PP\n" (stack "explain"))) ) :+][+:
+
+(out-pop) :+][+:
+
+ENDDEF mk-synopsis
+
+agman-cmd.tpl ends here :+]
diff --git a/autoopts/tpl/agman.tlib b/autoopts/tpl/agman.tlib
new file mode 100644
index 0000000..1a0a322
--- /dev/null
+++ b/autoopts/tpl/agman.tlib
@@ -0,0 +1,81 @@
+[+: AutoGen5 template -*- shell-script -*-
+
+null
+
+:+][+:
+
+## agman-lib.tpl -- Template for command line man pages
+##
+## Time-stamp: "2010-07-10 14:28:52 bkorb"
+## Author: Jim Van Zandt <jrv@vanzandt.mv.com>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+## This "library" converts texi-isms into man-isms. It gets included
+## by the man page template at the point where texi-isms might start appearing
+## and then "emit-man-text" is invoked when all the text has been assembled.
+##
+## Display the command line prototype,
+## based only on the argument processing type.
+##
+## And run the entire output through "sed" to convert texi-isms
+
+:+][+:
+
+(out-push-new)
+
+\:+]
+sed \
+ -e 's;@code{\([^}]*\)};\\fB\1\\fP;g' \
+ -e 's;@var{\([^}]*\)};\\fB\1\\fP;g' \
+ -e 's;@samp{\([^}]*\)};\\fB\1\\fP;g' \
+ -e 's;@i{\([^}]*\)};\\fI\1\\fP;g' \
+ -e 's;@file{\([^}]*\)};\\fI\1\\fP;g' \
+ -e 's;@emph{\([^}]*\)};\\fI\1\\fP;g' \
+ -e 's;@strong{\([^}]*\)};\\fB\1\\fP;g' \
+ -e 's/@\([{}]\)/\1/g' \
+ -e 's,^\$\*$,.br,' \
+ -e '/@ *example/,/@ *end *example/s/^/ /' \
+ -e 's/^ *@ *example/.nf/' \
+ -e 's/^ *@ *end *example/.fi/' \
+ -e '/^ *@ *noindent/d' \
+ -e '/^ *@ *enumerate/d' \
+ -e 's/^ *@ *end *enumerate/.br/' \
+ -e '/^ *@ *table/d' \
+ -e 's/^ *@ *end *table/.br/' \
+ -e 's/^@item \(.*\)/.sp\
+.IR "\1"/' \
+ -e 's/^@item/.sp 1/' \
+ -e 's/\*\([a-zA-Z0-9:~=_ -]*\)\*/\\fB\1\\fP/g' \
+ -e 's/``\([a-zA-Z0-9:~+=_ -]*\)'"''"'/\\(lq\1\\(rq/g' \
+ -e "s/^'/\\'/" \
+ -e 's/^@\*/.br/' \
+ -e 's/ -/ \\-/g;s/^\.in \\-/.in -/' <<'_End_Of_Man_'
+[+:
+
+DEFINE emit-man-text :+]
+_End_Of_Man_[+:
+
+(shell (out-pop #t) ) :+][+:
+
+ENDDEF emit-man-text :+][+: #
+
+agman-lib.tpl ends here :+]
diff --git a/autoopts/tpl/agman1.tpl b/autoopts/tpl/agman1.tpl
new file mode 100644
index 0000000..95e2a9c
--- /dev/null
+++ b/autoopts/tpl/agman1.tpl
@@ -0,0 +1,10 @@
+[+: -*- Mode: nroff -*-
+
+AutoGen5 template man=%s.1
+
+:+]
+[+: `echo please note that this is obsolete >&2` :+][+:
+
+INCLUDE "agman-cmd.tpl"
+
+\:+]
diff --git a/autoopts/tpl/agman3.tpl b/autoopts/tpl/agman3.tpl
new file mode 100644
index 0000000..6837c00
--- /dev/null
+++ b/autoopts/tpl/agman3.tpl
@@ -0,0 +1,142 @@
+{+ AutoGen5 template -*- nroff -*-
+
+null
+
+## agman3.tpl -- Template for command line man pages
+##
+## Time-stamp: "2011-02-24 10:39:17 bkorb"
+## Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
++}{+
+
+(define see-also "")
+(if (exist? "see-also")
+ (set! see-also (string-append (get "see-also") " ")) )
+
++}{+
+
+FOR export-func +}{+
+ (if (not (exist? "private"))
+ (set! see-also (string-append see-also
+ (get "name") "(3) " )) )
+ +}{+
+
+ENDFOR export-func +}{+
+
+
+FOR export-func +}{+
+ IF (not (exist? "private")) +}{+
+
+ (out-push-new (string-append
+ (get "name") ".3" ))
+
++}.TH {+name+} 3 {+ `date +%Y-%m-%d` +} "" "Programmer's Manual"
+{+
+
+;; The following "dne" argument is a string of 5 characters:
+;; '.' '\\' '"' and two spaces. It _is_ hard to read. "
+;;
+(dne ".\\\" ")
+
++}
+.SH NAME
+{+name+} - {+what+}
+.sp 1
+.SH SYNOPSIS
+{+IF (exist? "header") +}
+#include <\fI{+header+}\fP>
+.br{+
+ ENDIF+}
+cc [...] -o outfile infile.c -l\fB{+library+}\fP [...]
+.sp 1
+{+ ?% ret-type "%s" void
++} \fB{+name+}\fP({+
+ IF (not (exist? "arg")) +}void{+
+ ELSE +}{+
+ FOR arg ", " +}{+arg-type+} \fI{+arg-name+}\fP{+
+ ENDFOR arg +}{+
+ ENDIF +});
+.sp 1
+.SH DESCRIPTION
+{+
+ INCLUDE "agman.tlib"
++}{+
+(get "doc") +}{+
+ IF (exist? "arg") +}{+
+ FOR arg +}
+.TP
+.IR {+ arg-name +}
+{+ arg-desc +}{+
+
+ ENDFOR arg +}{+
+ ENDIF arg exists +}{+
+
+ IF (exist? "ret-type") +}
+.sp 1
+.SH RETURN VALUE
+{+ret-desc+}{+
+
+ ENDIF +}{+
+
+ IF (exist? "err") +}
+.sp 1
+.SH ERRORS
+{+ err +}{+
+
+ ENDIF +}{+
+
+ IF (exist? "example") +}
+.sp 1
+.SH EXAMPLES
+.nf
+.in +5
+{+ example +}
+.in -5
+.fi{+
+
+ ENDIF +}{+
+
+emit-man-text
+
++}
+.SH SEE ALSO
+The \fIinfo\fP documentation for the -l\fI{+library+}\fP library.
+.br
+{+
+(define tmp-txt (get "see"))
+(if (> (string-length see-also) 0)
+ (set! tmp-txt (string-append see-also ", " tmp-txt)) )
+
+(shellf "echo '%s' | \
+sed 's@%s(3) @@;s/3) $/3)/;s/(3) /(3), /g;s/, *,/,/g;s/^, *//'"
+ tmp-txt (get "name")) +}
+{+
+
+ (out-pop) +}{+
+
+ ENDIF private +}{+
+
+ENDFOR export-func
+
+
++}
diff --git a/autoopts/tpl/agmdoc-cmd.tpl b/autoopts/tpl/agmdoc-cmd.tpl
new file mode 100644
index 0000000..be8af95
--- /dev/null
+++ b/autoopts/tpl/agmdoc-cmd.tpl
@@ -0,0 +1,115 @@
+[+: -*- Mode: nroff -*-
+
+ AutoGen5 template mdoc
+
+## agman-cmd.tpl -- Template for command line mdoc pages
+##
+## Time-stamp: "2011-11-18 07:48:29 bkorb"
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+# Produce a man page for section 1, 5 or 8 commands.
+# Which is selected via: -DMAN_SECTION=n
+# passed to the autogen invocation. "n" may have a suffix, if desired.
+#
+:+][+:
+
+(define head-line (lambda() (string-append
+ ".Dd " (shell "date '+%B %e %Y' | sed 's/ */ /g'")
+ "\n.Dt " UP-PROG-NAME " " man-sect " " section-name
+ "\n.Os " (shell "uname -sr") "\n") ))
+
+(define man-page #f)
+
+:+][+:
+
+INCLUDE "cmd-doc.tlib"
+
+:+]
+.Sh NAME
+.Nm [+: prog-name :+]
+.Nd [+: prog-title :+]
+[+: INVOKE build-doc :+][+:
+
+(out-move (string-append (get "prog-name") "."
+ man-sect)) :+][+:#
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" S Y N O P S I S
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE mk-synopsis :+][+:
+ (out-push-new file-name) \:+]
+.Sh SYNOPSIS
+.Nm[+:
+
+ IF (. use-flags) :+][+:
+ IF (exist? "long-opts") :+]
+.\" Mixture of short (flag) options and long options
+.Op Fl flags
+.Op Fl flag Ar value
+.Op Fl \-option-name Ar value
+[+: ELSE no long options: :+]
+.Op Fl flags
+.Op Fl flag Ar value
+[+: ENDIF
+ :+][+:
+ ELIF (exist? "long-opts")
+ :+]
+.Op Fl \-option-name
+.Op Fl \-option-name Ar value
+[+:
+
+ ELIF (not (exist? "argument")) :+]
+.Op Ar option\-name Ar value
+.Pp
+All arguments are named options.
+[+:
+ ENDIF :+][+:
+
+ IF (exist? "argument") :+][+:
+ argument :+][+:
+
+ IF (exist? "reorder-args") :+]
+.Pp
+Operands and options may be intermixed. They will be reordered.
+[+: ENDIF :+][+:
+
+ ELIF (or (exist? "long-opts") use-flags)
+
+:+]
+.Pp
+All arguments must be options.
+[+:
+
+ ENDIF :+]
+.Pp
+[+:
+
+FOR explain "\n.Pp\n" :+][+:
+ explain :+][+:
+ENDFOR :+][+:
+
+(out-pop) :+][+:
+
+ENDDEF mk-synopsis
+
+agmdoc-cmd.tpl ends here :+]
diff --git a/autoopts/tpl/agpl.lic b/autoopts/tpl/agpl.lic
new file mode 100644
index 0000000..99661e4
--- /dev/null
+++ b/autoopts/tpl/agpl.lic
@@ -0,0 +1,19 @@
+<PFX>Copyright (C) <years> <owner>, all rights reserved.
+<PFX>This is free software. It is licensed for use, modification and
+<PFX>redistribution under the terms of the
+<PFX>GNU Affero GPL, version 3 or later <http://gnu.org/licenses/gpl.html>
+
+<PFX><program> is free software: you can redistribute it and/or modify it
+<PFX>under the terms of the GNU General Public License as published by the
+<PFX>Free Software Foundation, either version 3 of the License, or
+<PFX>(at your option) any later version.
+<PFX>
+<PFX><program> is distributed in the hope that it will be useful, but
+<PFX>WITHOUT ANY WARRANTY; without even the implied warranty of
+<PFX>MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+<PFX>See the GNU Affero General Public License for more details.
+<PFX>
+<PFX>You should have received a copy of the GNU Affero General Public License
+<PFX>along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+GNU Affero GPL, version 3 or later
diff --git a/autoopts/tpl/agtexi-cmd.tpl b/autoopts/tpl/agtexi-cmd.tpl
new file mode 100644
index 0000000..75330a0
--- /dev/null
+++ b/autoopts/tpl/agtexi-cmd.tpl
@@ -0,0 +1,894 @@
+[= AutoGen5 template -*- Mode: texinfo -*-
+
+texi
+
+# Documentation template
+#
+# Time-stamp: "2012-08-11 08:33:08 bkorb"
+# Author: Bruce Korb <bkorb@gnu.org>
+#
+# This file is part of AutoOpts, a companion to AutoGen.
+# AutoOpts is free software.
+# AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+#
+# AutoOpts is available under any one of two licenses. The license
+# in use must be one of these two and the choice is under the control
+# of the user of the license.
+#
+# The GNU Lesser General Public License, version 3 or later
+# See the files "COPYING.lgplv3" and "COPYING.gplv3"
+#
+# The Modified Berkeley Software Distribution License
+# See the file "COPYING.mbsd"
+#
+# These files have the following md5sums:
+#
+# 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+# 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+# 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+=][=
+
+INVOKE initialization =][=
+
+(out-push-new (string-substitute (out-name) ".texi" ".menu"))
+
+(ag-fprintf 0 "* %-32s Invoking %s\n"
+ (string-append program-name " Invocation::")
+ program-name )
+
+(out-pop)
+(if (exist? "explain")
+ (emit (string-append "\n" (get "explain") "\n")) )
+(set! tmp-str (get "option-doc-format" "texi"))
+(divert-convert tmp-str)
+
+=][=
+
+IF (match-value? == "doc-section.ds-type" "DESCRIPTION") =][=
+
+ FOR doc-section =][=
+ IF (== (get "ds-type") "DESCRIPTION") =][=
+ (define cvt-fn (get "ds-format" "texi"))
+ (if (not (== cvt-fn "texi"))
+ (divert-convert cvt-fn) ) =][=
+ (emit (string-append "\n" (get "ds-text") "\n"))
+ (convert-divert) =][=
+ BREAK =][=
+
+ ENDIF =][=
+ ENDFOR =][=
+
+ELSE =][=
+
+(join "\n\n"
+ (if (exist? "prog-info-descrip")
+ (stack "prog-info-descrip")
+ (if (exist? "prog-man-descrip")
+ (stack "prog-man-descrip")
+ (if (exist? "prog-descrip")
+ (stack "prog-descrip")
+ (stack "detail")
+) ) ) ) =][=
+
+ENDIF =][=
+
+(convert-divert) =]
+
+This [=(string-downcase doc-level)=] was generated by @strong{AutoGen},
+using the @code{agtexi-cmd} template and the option descriptions for the [=(.
+coded-prog-name)=] program.[= (name-copyright) =]
+
+@menu
+[=
+ (out-push-new) (out-suspend "menu")
+ (out-push-new) =][=
+
+INVOKE emit-usage-opt =][=
+
+;; FOR all options, ...
+;;
+(define opt-name "")
+(define extra-ct 0)
+(define extra-text "")
+(define optname-from "A-Z_^")
+(define optname-to "a-z--")
+(define invalid-doc "* INVALID *")
+(if (exist? "preserve-case") (begin
+ (set! optname-from "_^")
+ (set! optname-to "--") ))
+(if (and have-doc-options (not (exist? "flag[].documentation"))) (begin
+ (ag-fprintf "menu" menu-entry-fmt
+ "base-options:: " "Base options")
+ (print-node opt-name "Base options")
+) )
+
+=][=#
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+FOR flag =][=
+
+ (set! opt-name (string-tr! (get "name") optname-from optname-to))
+ (if (exist? "documentation")
+ (begin
+ (set! label-str (string-append opt-name " options"))
+ (ag-fprintf "menu" menu-entry-fmt
+ (string-append opt-name ":: ") label-str)
+ (print-node opt-name label-str)
+ (ag-fprintf 0 "\n%s." (get "descrip"))
+ (set! tmp-str (get "documentation"))
+ (if (> (string-length tmp-str) 1)
+ (ag-fprintf 0 "\n%s" tmp-str))
+ )
+ (begin
+ (set! tmp-str (get "doc" invalid-doc))
+ (if (< 0 (string-length tmp-str)) (begin
+ (set! label-str (string-append opt-name " option"
+ (if (exist? "value")
+ (string-append " (-" (get "value") ")")
+ "" ) ))
+ (if have-doc-options
+ (ag-fprintf 0 opt-node-fmt opt-name label-str)
+ (begin
+ (ag-fprintf "menu" menu-entry-fmt
+ (string-append opt-name ":: ") label-str)
+ (print-node opt-name label-str)
+ )
+ )
+ (ag-fprintf 0 "\n@cindex %s-%s" down-prog-name opt-name)
+ ) )
+ )
+ ) =][=
+
+ IF (and (not (exist? "documentation"))
+ (< 0 (string-length tmp-str)) )
+ =][=
+ IF (exist? "aliases") =][=
+ INVOKE emit-aliases =][=
+ ELSE =][=
+ INVOKE emit-opt-text =][=
+ ENDIF =][=
+ ENDIF =][=
+
+ENDFOR flag =][=
+
+IF
+ (define home-rc-files (exist? "homerc"))
+ (define environ-init (exist? "environrc"))
+ (or home-rc-files environ-init)
+ =][=
+
+ INVOKE emit-presets =][=
+
+ENDIF =][=
+
+INVOKE emit-exit-status =][=
+INVOKE emit-doc-sections =][=
+
+(out-suspend "opt-desc")
+(out-resume "menu")
+(emit (out-pop #t))
+(emit "@end menu\n")
+(out-resume "opt-desc")
+(out-pop #t) =][=#
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-doc-sections =][=
+
+FOR doc-section =][=
+
+ IF (define opt-name (string-capitalize! (get "ds-type")))
+ (or (== opt-name "Exit Status")
+ (== opt-name "Description")
+ (exist? "omit-texi")) =][=
+ CONTINUE =][=
+ ENDIF =][=
+
+ (ag-fprintf "menu" menu-entry-fmt (string-append opt-name "::") opt-name)
+ (set! label-str (string-append
+ down-prog-name " " (string-capitalize opt-name)))
+ (print-node opt-name label-str)
+ (define cvt-fn (get "ds-format" "texi"))
+ (if (not (== cvt-fn "texi"))
+ (divert-convert cvt-fn) ) =][=
+ (emit (string-append "\n" (get "ds-text") "\n"))
+ (convert-divert) =][=
+
+ENDFOR doc-section =][=
+
+ENDDEF emit-doc-sections
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-exit-status =][=
+ (ag-fprintf "menu" menu-entry-fmt "exit status::" "exit status")
+ (print-node "exit status" (string-append program-name " exit status")) =]
+
+One of the following exit values will be returned:
+@table @samp
+@item 0 (EXIT_[=
+ (set! tmp-str (get "exit-name[0]" "SUCCESS"))
+ (string-upcase (string->c-name! tmp-str))
+ =])
+[=
+ (define need-ex-noinput (exist? "homerc"))
+ (define need-ex-software #t)
+ (get "exit-desc[0]" "Successful program execution.")=]
+@item 1 (EXIT_[=
+
+ (set! tmp-str (get "exit-name[1]" "FAILURE"))
+ (string-upcase (string->c-name! tmp-str))=])
+[= (get "exit-desc[1]"
+ "The operation failed or the command syntax was not valid.") =][=
+
+FOR exit-desc (for-from 2) =][=
+ (if (= (for-index) 66)
+ (set! need-ex-noinput #f)
+ (if (= (for-index) 70)
+ (set! need-ex-software #f) ))
+ (set! tmp-str (get (sprintf "exit-name[%d]" (for-index)) "* unnamed *"))
+ (sprintf "\n@item %d (EXIT_%s)\n%s" (for-index)
+ (string-upcase (string->c-name! tmp-str))
+ (get (sprintf "exit-desc[%d]" (for-index))))
+ =][=
+ENDFOR exit-desc =][=
+
+(if need-ex-noinput
+ (emit "\n@item 66 (EX_NOINPUT)
+A specified configuration file could not be loaded."))
+
+(if need-ex-noinput
+ (emit "\n@item 70 (EX_SOFTWARE)
+libopts had an internal operational error. Please report
+it to autogen-users@@lists.sourceforge.net. Thank you."))
+=]
+@end table[=
+
+ENDDEF emit-exit-status
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-aliases =]
+
+This is an alias for the [= aliases =] option,
+[= (sprintf "@pxref{%1$s %2$s, the %2$s option documentation}.\n"
+ down-prog-name (get "aliases")) =][=
+
+ENDDEF emit-aliases
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-opt-text =]
+
+This is the ``[=(string-downcase! (get "descrip"))=]'' option.[=
+ IF (exist? "arg-type") =]
+This option takes an [= (if (exist? "arg-optional") "optional " "")
+ =]argument [= arg-type =][=
+(if (exist? "arg-name") (string-append " @file{"
+ (string-substitute (get "arg-name") "@" "@@") "}"))
+ =].[=
+ ENDIF =][=
+
+ (set! extra-ct 0)
+ (out-push-new) =][=
+
+ IF (exist? "min") =]@item
+is required to appear on the command line.
+[= (set! extra-ct (+ extra-ct 1)) =][=
+ ENDIF=][=
+
+ IF (exist? "max") =]@item
+may appear [=
+ IF % max (== "%s" "NOLIMIT")
+ =]an unlimited number of times[=
+ ELSE
+ =]up to [=max=] times[=
+ ENDIF=].
+[= (set! extra-ct (+ extra-ct 1)) =][=
+ ENDIF=][=
+
+ IF (exist? "enabled") =]@item
+is enabled by default.
+[= (set! extra-ct (+ extra-ct 1)) =][=
+ ENDIF=][=
+
+ IF (exist? "ifdef") =]@item
+must be compiled in by defining @code{[=(get "ifdef")
+ =]} during the compilation.
+[= (set! extra-ct (+ extra-ct 1)) =][=
+ ENDIF =][=
+
+ IF (exist? "ifndef") =]@item
+must be compiled in by @strong{un}-defining @code{[=(get "ifndef")
+ =]} during the compilation.
+[= (set! extra-ct (+ extra-ct 1)) =][=
+ ENDIF=][=
+
+ IF (exist? "no_preset") =]@item
+may not be preset with environment variables or configuration (rc/ini) files.
+[= (set! extra-ct (+ extra-ct 1)) =][=
+ ENDIF=][=
+
+ IF (exist? "equivalence") =]@item
+is a member of the [=equivalence=] class of options.
+[= (set! extra-ct (+ extra-ct 1)) =][=
+ ENDIF=][=
+
+ IF (exist? "flags_must") =]@item
+must appear in combination with the following options:
+[= FOR flags_must ", " =][=flags_must=][=
+ ENDFOR=].
+[= (set! extra-ct (+ extra-ct 1)) =][=
+ ENDIF=][=
+
+ IF (exist? "flags_cant") =]@item
+must not appear in combination with any of the following options:
+[= FOR flags_cant ", " =][=flags_cant=][=
+ ENDFOR=].
+[= (set! extra-ct (+ extra-ct 1)) =][=
+ ENDIF=][=
+
+ IF (~* (get "arg-type") "key|set") =]@item
+This option takes a keyword as its argument[=
+
+ CASE arg-type =][=
+ =* key =][= (set! extra-ct (+ extra-ct 1)) =].
+The argument sets an enumeration value that can be tested by comparing[=
+
+ =* set =][= (set! extra-ct (+ extra-ct 1)) =] list.
+Each entry turns on or off membership bits. These bits can be tested
+with bit tests against[=
+ ESAC arg-type =] the option value macro ([=
+(string-upcase (string-append
+(if (exist? "prefix") (string-append (get "prefix") "_") "")
+"OPT_VALUE_" (get "name") )) =]).
+The available keywords are:
+@example
+[= (shell (string-append
+ "${CLexe:-columns} -I4 --spread=1 -W50 <<\\" heredoc-marker
+ (join "\n" (stack "keyword") "\n")
+ heredoc-marker
+ ) ) =]
+@end example
+[=
+
+ IF (=* (get "arg-type") "key") =]
+or their numeric equivalent.[=
+ ENDIF =][=
+
+ ENDIF key/set arg =][=
+
+ IF (> extra-ct 0) =][=
+ (set! extra-text (out-pop #t)) =]
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+[=(. extra-text)
+=]@end itemize
+[= ELSE =][=
+ (out-pop) =][=
+ ENDIF =][=
+
+?% doc "\n%s" "\nThis option has no @samp{doc} documentation." =][=
+ IF (exist? "deprecated") =]
+
+@strong{NOTE: THIS OPTION IS DEPRECATED}[=
+
+ ENDIF =][=
+
+ENDDEF emit-opt-text
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE set-home-rc-vars =][=
+ CASE homerc =][=
+ ==* '$@' =][=
+ (set! explain-pkgdatadir #t)
+ (set! cfg-file-name (string-substitute (get "homerc")
+ "$@" "$(pkgdatadir)")) =][=
+
+ == '.' =][=
+ (set! cfg-file-name "$PWD")
+ (set! env-var-list (string-append env-var-list "PWD, "))
+ =][=
+
+ ==* './' =][=
+ (set! explain-pkgdatadir #t)
+ (set! env-var-list (string-append env-var-list "PWD, "))
+ (set! cfg-file-name (string-append "$PWD" (substring (get "homerc") 1)))
+ =][=
+
+ ~~* '\$[A-Za-z]' =][=
+ (set! cfg-file-name (get "homerc"))
+ (set! env-var-list (string-append env-var-list
+ (shellf "echo '%s' | sed 's/^.//;s#/.*##'" cfg-file-name)
+ ", " ))
+ =][=
+
+ == "" =][= (set! cfg-file-name "") =][=
+
+ * =][=
+ (set! cfg-file-name (get "homerc")) =][=
+ ESAC =][=
+
+ENDDEF set-home-rc-vars
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-multiple-rc \=]
+[=
+ (define explain-pkgdatadir #f)
+ (define env-var-list "")
+ rc-count =] places for configuration files:
+@itemize @bullet[=
+FOR homerc =][=
+ INVOKE set-home-rc-vars =][=
+ (if (> (string-length cfg-file-name) 0)
+ (sprintf "\n@item\n%s" cfg-file-name ))
+ =][=
+
+ENDFOR homerc =]
+@end itemize[=
+ (if explain-pkgdatadir (ag-fprintf 0
+"\nThe value for @code{$(pkgdatadir)} is recorded at package configure time
+and replaced by @file{libopts} when @file{%s} runs." program-name))
+
+(if (> (string-length env-var-list) 1)
+ (shell (string-append
+"list='@code{'`echo '" env-var-list "' | \
+ sed -e 's#, $##' \
+ -e 's#, #}, @code{#g' \
+ -e 's#, \\([^ ][^ ]*\\)$#, and \\1#'`\\}
+echo
+echo 'The environment variables' ${list}
+echo 'are expanded and replaced when @file{" program-name "} runs.'"
+)) ) =]
+For any of these that are plain files, they are simply processed.
+For any that are directories, then a file named @file{[=
+ (if (exist? "rcfile") (get "rcfile")
+ (string-append "." program-name "rc"))=]} is searched for
+within that directory and processed.
+[=
+
+ENDDEF emit-multiple-rc
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-one-rc-dir =][=
+ (define env-var-list "")
+ (define explain-pkgdatadir #f) =][=
+ INVOKE set-home-rc-vars
+
+=]@file{[=(. cfg-file-name) =]} for configuration (option) data.[=
+ IF (. explain-pkgdatadir) =]
+The value for @code{$(pkgdatadir)} is recorded at package configure time
+and replaced by @file{libopts} when @file{[=prog-name=]} runs.
+[=ENDIF=][=
+(if (> (string-length env-var-list) 1)
+ (sprintf
+"\nThe environment variable @code{%s} is expanded and replaced when
+the program runs" env-var-list)) =]
+If this is a plain file, it is simply processed.
+If it is a directory, then a file named @file{[=
+(if (exist? "rcfile") (get "rcfile")
+ (string-append "." program-name "rc"))
+=]} is searched for within that directory.[=
+
+ENDDEF emit-one-rc-dir
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-rc-file-info =]
+
+@noindent
+@code{libopts} will search in [=
+
+ IF (define rc-count (count "homerc"))
+ (define cfg-file-name "")
+ (> rc-count 1) =][=
+
+ INVOKE emit-multiple-rc =][=
+
+ ELSE =][=
+ INVOKE emit-one-rc-dir =][=
+ ENDIF (> rc-count 1)
+
+=]
+
+Configuration files may be in a wide variety of formats.
+The basic format is an option name followed by a value (argument) on the
+same line. Values may be separated from the option name with a colon,
+equal sign or simply white space. Values may be continued across multiple
+lines by escaping the newline with a backslash.
+
+Multiple programs may also share the same initialization file.
+Common options are collected at the top, followed by program specific
+segments. The segments are separated by lines like:
+@example
+[[=(. UP-PROG-NAME)=]]
+@end example
+@noindent
+or by
+@example
+<?program [= prog-name =]>
+@end example
+@noindent
+Do not mix these styles within one configuration file.
+
+Compound values and carefully constructed string values may also be
+specified using XML syntax:
+@example
+<option-name>
+ <sub-opt>...&lt;...&gt;...</sub-opt>
+</option-name>
+@end example
+@noindent
+yielding an @code{option-name.sub-opt} string value of
+@example
+"...<...>..."
+@end example
+@code{AutoOpts} does not track suboptions. You simply note that it is a
+hierarchicly valued option. @code{AutoOpts} does provide a means for searching
+the associated name/value pair list (see: optionFindValue).[=
+
+ENDDEF emit-rc-file-info
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-presets =]
+
+[=
+ (ag-fprintf "menu" menu-entry-fmt "config::"
+ (string-append "presetting/configuring " down-prog-name) )
+
+ (print-node "config"
+ (string-append "presetting/configuring " program-name) ) =]
+
+Any option that is not marked as @i{not presettable} may be preset by
+loading values from [=
+
+IF
+
+ (if home-rc-files (emit
+ "configuration (\"rc\" or \"ini\") files"))
+
+ environ-init
+
+ =][=
+ (if home-rc-files (emit ", and values from "))
+ =]environment variables named @code{[=(. UP-PROG-NAME)=]} and @code{[=
+(. UP-PROG-NAME)=]_<OPTION_NAME>}. @code{<OPTION_NAME>} must be one of
+the options listed above in upper case and segmented with underscores.
+The @code{[=(. UP-PROG-NAME)=]} variable will be tokenized and parsed like
+the command line. The remaining variables are tested for existence and their
+values are treated like option arguments[=
+ ENDIF have environment inits =].
+[=
+
+ IF (. home-rc-files) =][=
+ INVOKE emit-rc-file-info =][=
+ ENDIF home-rc-files =]
+
+The command line options relating to configuration and/or usage help are:
+[=
+
+IF (exist? "version") =]
+@[= (. head-level) =] version[= (flag-string "version-value" "v") =]
+
+Print the program version to standard out, optionally with licensing
+information, then exit 0. The optional argument specifies how much licensing
+detail to provide. The default is to print [=
+(if (exist? "gnu-usage") "the license name with the version" "just the version")
+=]. The licensing infomation may be selected with an option argument. Only the
+first letter of the argument is examined:
+
+@table @samp
+@item version
+Only print the version.[=
+(if (not (exist? "gnu-usage")) " This is the default.")=]
+@item copyright
+Name the copyright usage licensing terms.[=
+(if (exist? "gnu-usage") " This is the default.")=]
+@item verbose
+Print the full copyright usage licensing terms.
+@end table
+[=
+ENDIF version =][=
+
+IF (exist? "usage-opt") =]
+@[= (. head-level) =] usage[= (flag-string "usage-value" "u") =]
+
+Print abbreviated usage to standard out, then exit 0.
+[=
+ENDIF usage-opt =][=
+
+IF (exist? "vendor-opt") =]
+@[= (. head-level) =] vendor-option (-W)
+
+Options that do not have flag values specified must be specified with
+@code{-W} and the long option name. That long name is the argument to
+this option. Any options so named that require an argument must have
+that argument attached to the option name either with quoting or an
+equal sign.
+[=
+ENDIF vendor-opt =][=
+
+IF (exist? "resettable") =]
+@[= (. head-level) =] reset-option[= (flag-string "reset-value" "R") =]
+
+Resets the specified option to the compiled-in initial state.
+This will undo anything that may have been set by configuration files.
+The option argument may be either the option flag character or its long name.
+[=
+ENDIF resettable =][=
+
+IF (exist? "home-rc") =][=
+ IF (exist? "disable-save") =]
+@[= (. head-level) =] save-opts[= (flag-string "save-opts-value" ">") =]
+
+Saves the final, configured option state to the specified file (the optional
+option argument). If no file is specified, then it will be saved to the
+highest priority (last named) @file{rc-file} in the search list.
+[=
+ ENDIF disable-save =][=
+
+ IF (exist? "disable-load") =]
+@[= (. head-level) =] load-opts[= (flag-string "load-opts-value" "<") =]
+
+Loads the named configuration file.
+[=
+ ENDIF disable-load =][=
+ENDIF home-rc =][=
+
+ENDDEF emit-presets
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE header \=]
+\input texinfo
+@c -*-texinfo-*-
+@c %**start of header
+@setfilename [= (string-append down-prog-name ".info") =]
+@settitle [= (sprintf (if (exist? "package") "%2$s - %1$s" "%s")
+ (get "package") (get "prog-title")) =]
+@c %**end of header
+@setchapternewpage off
+@titlepage
+@sp 10
+@comment The title is printed in a large font.
+@center @titlefont{Sample Title}
+
+@c The following two commands start the copyright page.
+@page
+@vskip 0pt plus 1filll
+[= (name-copyright) =][=
+IF (exist? "copyright.type") =]
+[= (license-full (get "copyright.type") program-name ""
+ (get "copyright.owner" (get "copyright.author" ""))
+ (get "copyright.date") ) =][=
+ENDIF =]
+@end titlepage
+@node Top, [= prog-name =] usage, , (dir)
+@top [= prog-title =]
+[=
+
+ENDDEF header
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-usage-opt =][=
+
+ (define label-str (string-append
+ program-name " help/usage (@option{" help-opt "})"))
+ (ag-fprintf "menu" menu-entry-fmt "usage::" label-str)
+ (sprintf node-fmt "usage" label-str) =]
+@cindex [=(. down-prog-name)=] help
+
+This is the automatically generated usage text for [= prog-name =].
+
+The text printed is the same whether selected with the @code{help} option
+(@option{[= (. help-opt) =]}) or the @code{more-help} option (@option{[=
+(. more-help-opt) =]}). @code{more-help} will print
+the usage text by passing it through a pager program.
+@code{more-help} is disabled on platforms without a working
+@code{fork(2)} function. The @code{PAGER} environment variable is
+used to select the program, defaulting to @file{more}. Both will exit
+with a status code of 0.
+
+@exampleindent 0
+@example
+[= (out-push-new) =]
+prog_name=[= (. program-name) =]
+PROG=./${prog_name}
+test -f ${PROG} || {
+ PROG=`echo $PROG | tr '[A-Z]' '[a-z]'`
+ test -f ${PROG} || PROG=`echo $PROG | tr x_ x-`
+}
+if [ ! -f ${PROG} ]
+then
+ if [= (string-append program-name " " help-opt) =] > /dev/null 2>&1
+ then PROG=`command -v ${prog_name}`
+ else PROG="echo ${prog_name} is unavailable - no "
+ fi
+fi
+${PROG} [=(. help-opt)=] 2>&1 | \
+ sed -e "s/USAGE: lt-${prog_name} /USAGE: ${prog_name} /" \
+ -e 's/@/@@/g;s/{/@{/g;s/}/@}/g' \
+ -e 's/ / /g'
+[= (shell (out-pop #t)) =]
+@end example
+@exampleindent 4
+[=
+
+ENDDEF emit-usage-opt
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE initialization =][=
+
+ ;;# START-BUILDTREE-ISMS
+ ;;
+ (shell "CLexe=${AGexe%/agen5/*}/columns/columns
+ test -x \"${CLexe}\" || {
+ CLexe=${AGexe%/autogen}/columns
+ test -x \"${CLexe}\" || die 'columns program is not findable'
+ }")
+
+=][= # END-BUILDTREE-ISMS
+
+ (shell "CLexe=${AGexe%/autogen}/columns")
+
+# END-INSTALL-ONLY-CODE =][=
+
+ ;; divert-convert divert text for conversion to .texi format
+ ;; convert-divert convert the diversion done with divert-convert
+ ;;
+ (define divert-convert (lambda (diversion-type) (begin
+ (set! was-diverted
+ (not (or (== diversion-type "texi") (== diversion-type ""))))
+ (if was-diverted (begin
+ (set! cvt-script
+ (find-file (string-append diversion-type "2texi")))
+ (if (not (defined? 'cvt-script))
+ (error (sprintf "unknown source format type: %s" diversion-type)) )
+ (out-push-new) )) )))
+
+ (define heredoc-marker "_Unlikely_Here_Doc_Marker_\n")
+ (define convert-divert (lambda ()
+ (if was-diverted (shell (string-append
+ cvt-script "<<\\" heredoc-marker (out-pop #t) "\n" heredoc-marker
+ )) )))
+
+ (define was-diverted #f)
+ (define diversion-type "")
+ (define cvt-script "")
+ (define tmp-str "")
+
+ (define name-copyright (lambda ()
+ (if (exist? "copyright")
+ (string-append "\nThis software is released under "
+ (license-name (get "copyright.type" "an unknown copyright"))
+ "." ) ) ))
+
+ (make-tmp-dir)
+ (define program-name (get "prog-name"))
+ (define down-prog-name (string-downcase program-name))
+ (define UP-PROG-NAME (string-upcase program-name))
+ (shellf "export AG_DEF_PROG_NAME=%s" program-name)
+ (define doc-level (getenv "LEVEL"))
+ (if (not (string? doc-level))
+ (set! doc-level "section"))
+ (define file-name (string-append down-prog-name ".texi"))
+ (define coded-prog-name (string-append "@code{" down-prog-name "}"))
+
+ (define replace-prog-name (lambda (nm)
+ (string-substitute (get nm) down-prog-name coded-prog-name ) ))
+
+ (define have-doc-options (exist? "flag.documentation"))
+ (define print-menu #t)
+ (define do-doc-nodes #f)
+ (define menu-entry-fmt (string-append
+ "* " down-prog-name " %-24s %s\n"))
+ (define emit-menu-entry (lambda (is-doc) (not is-doc)))
+ (if have-doc-options
+ (set! emit-menu-entry (lambda (is-doc) is-doc)) )
+ (define chk-flag-val (exist? "flag.value"))
+ (define flag-string (lambda (v-nm v-df) (if (not chk-flag-val) ""
+ (string-append " (-"
+ (if (exist? v-nm) (get v-nm) v-df)
+ ")") )))
+
+ (define help-opt "")
+ (if (exist? "long-opts")
+ (set! help-opt "--help")
+ (if (not (exist? "flag.value"))
+ (set! help-opt "help")
+ (if (not (exist? "help-value"))
+ (set! help-opt "-?")
+ (begin
+ (set! tmp-str (get "help-value"))
+ (if (> (string-length tmp-str) 0)
+ (set! help-opt (string-append "-" tmp-str))
+ (set! help-opt "--help")
+ ) )
+ )))
+
+ (define more-help-opt "")
+ (if (exist? "long-opts")
+ (set! more-help-opt "--more-help")
+ (if (not (exist? "flag.value"))
+ (set! more-help-opt "more-help")
+ (if (not (exist? "more-help-value"))
+ (set! more-help-opt "-!")
+ (begin
+ (set! tmp-str (get "more-help-value"))
+ (if (> (string-length tmp-str) 0)
+ (set! help-opt (string-append "-" tmp-str))
+ (set! help-opt "--more-help")
+ ) )
+ )))
+
+ =][=
+
+ CASE (. doc-level) =][=
+ == document =][= INVOKE header =][=
+ (define sub-level "chapter")
+ (define head-level "heading") =][=
+ == chapter =][=
+ (define sub-level "section")
+ (define head-level "subheading") =][=
+ == section =][=
+ (define sub-level "subsection")
+ (define head-level "subsubheading") =][=
+ == subsection =][=
+ (define sub-level "subsubsection")
+ (define head-level "subsubheading") =][=
+
+ * =][=(error (sprintf "invalid doc level: %s\n" doc-level)) =][=
+
+ ESAC doc level =][=
+
+ (define node-fmt (string-append
+ "\n@node " down-prog-name " %s\n@" sub-level " %s"))
+ (define print-node (lambda (a b) (ag-fprintf 0 node-fmt a b) ))
+
+ (define opt-node-fmt (if have-doc-options
+ (string-append "\n@" head-level
+ " %2$s.\n@anchor{" down-prog-name " %1$s}")
+ node-fmt
+ ))
+
+ (define exit-sts-fmt "\n\n@node %1$s %2$s\n@%3$s %1$s %2$s\n")
+ =][=
+
+ IF (not (== doc-level "document")) =][=
+ (set! file-name (string-append "invoke-" file-name))
+ \=]
+@node [= prog-name =] Invocation
+@[=(. doc-level) =] Invoking [= prog-name =]
+@pindex [= prog-name =]
+@cindex [= prog-title =][=
+
+FOR concept =]
+@cindex [= concept =][=
+ENDFOR =][=
+
+ ENDIF document component
+
+=]
+@ignore
+[=
+
+(out-move file-name)
+(dne "# " "# ")
+
+=]
+@end ignore
+[=
+
+ENDDEF initialization
+
+@c agtexi-cmd.tpl ends here =]
diff --git a/autoopts/tpl/bits.tpl b/autoopts/tpl/bits.tpl
new file mode 100644
index 0000000..6de0458
--- /dev/null
+++ b/autoopts/tpl/bits.tpl
@@ -0,0 +1,721 @@
+[= AutoGen5 Template -*- Mode: C -*-
+
+h
+c
+
+#!/bin/sh
+
+## Time-stamp: "2011-12-30 08:28:20 bkorb"
+## Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+ (define base-name "")
+ (define BASE-NAME "")
+ (define element-type "")
+ (define init-done #f)
+ (define is-64-bit #f)
+ (define is-array #f)
+ (define name-width 0)
+ (define desc-width 0)
+ (define bit-list "")
+ (define bit-name "")
+ (define tmp-name "")
+
+ (define id-name (lambda (sfx)
+ (string-append
+ prefix "_" (string-upcase! (string->c-name! (get "b-name"))) sfx
+ ) ))
+
+ (define mask-name (lambda (sfx)
+ (string-append
+ prefix "_" (string-upcase! (string->c-name! (get "m-name"))) sfx
+ ) ))
+
+=][=
+
+INVOKE preamble
+
+=][=
+
+CASE (suffix) =][=
+
+# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+== h
+
+=]
+[=
+ (shell "sedcmd='s/$/_val} +/;s/^/${/'")
+ (make-header-guard "bit_mask") =]
+#include [= (if (exist? "stdint-hdr")
+ (string-append "\"" (get "stdint-hdr") "\"")
+ "<stdint.h>" ) =]
+
+typedef [=
+
+ (define type-name (string-append base-name "_bits_t"))
+ (define tmp
+ (if (< (high-lim "bit") 32) (begin
+ (set! element-type "uint32_t")
+ "uint32_t %s_bits_t")
+ (if (< (high-lim "bit") 64) (begin
+ (set! element-type "uint64_t")
+ (set! is-64-bit #t)
+ "uint64_t %s_bits_t" )
+ (begin
+ (set! element-type "uint32_t")
+ (set! is-array #t)
+ (sprintf "uint32_t %%s_bits_t[%s]"
+ (shellf "mask_ct=`calc '( %d + 32 ) / 32'` ; echo $mask_ct"
+ (high-lim "bit")) ) )) ))
+
+ (sprintf tmp base-name)
+
+=];
+typedef enum {[=
+
+FOR bit =][=
+
+ (set! bit-name (string->c-name! (get "b-name")))
+ (shellf
+ "%1$s_val=`calc '2 ^ %2$d'`\nmask_val=`calc \"${mask_val} + ${%1$s_val}\"`"
+ bit-name (for-index))
+
+ (set! tmp (string-length bit-name))
+ (if (> tmp name-width)
+ (set! name-width tmp))
+ (set! tmp (string-length (get "b-what")))
+ (if (> tmp desc-width)
+ (set! desc-width tmp)) =][=
+
+ENDFOR bit =][=
+
+ (define define-width (+ name-width 6 (string-length prefix)))
+ (define enum-fmt (sprintf "\n %%-%ds =%%4d%%s /* %%-%ds */"
+ define-width desc-width))
+
+=][=
+
+FOR bit =][=
+
+ (sprintf enum-fmt (id-name "_ID") (for-index)
+ (if (last-for?) " " ",") (get "b-what")) =][=
+ENDFOR bit
+
+= = = = = = = = = = = = = = = = =][=
+
+IF (ag-fprintf 0 "\n} %s_enum_t;\n" base-name)
+ (define def-fmt (sprintf "\n#define %%-%ds " define-width))
+
+ (< (high-lim "bit") 32) =][=
+
+ INVOKE emit-word-macro one = 'U' mask-fmt = "%08XU" =][=
+
+ELIF (< (high-lim "bit") 64) =][=
+
+ INVOKE emit-word-macro one = 'ULL' mask-fmt = "%016XULL" =][=
+
+ELSE more than 64 bits =][=
+
+ INVOKE emit-multi-macros =][=
+
+ENDIF how many bits =][=
+
+IF (if (exist? "extra-defs")
+ (emit (string-append "\n\n" (get "extra-defs") "\n")))
+
+ (not (exist? "no-code")) =]
+/*
+ * Return a string containing the names of the bits set.
+ */
+extern char *
+[= (. base-name) =]_names([= (. type-name) =] bits);
+
+#define INV_[= (. BASE-NAME) =] -1
+#define DUP_[= (. BASE-NAME) =] -2
+
+/*
+ * Set the bits in "bits" as specified by the input string "str".
+ * If any names are untranslatable (not in the name list or are
+ * ambiguous in that they match the initial portion of more than
+ * one entry), it will return -1 or -2, respectively.
+ * Otherwise, it returns the number of bits set in "bits".
+ */
+extern int
+[= (. base-name) =]_bits(
+ [= (. type-name) =] * const bits,
+ char const * str);
+[= ENDIF =]
+#endif /* [= (. header-guard) =] */[=
+
+# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+== c
+
+
+=]
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+[=
+
+ (if (exist? "no-code") (out-delete))
+ (ag-fprintf 0 "#include \"%s\"\n" header-file)
+ (string-table-new "nm")
+ (string-table-add "nm" "* INVALID *")
+ (define ix 0)
+ (define offset-list "")
+ (define sorted-off "") =][=
+
+FOR bit (for-from 0) (for-by 1) =][=
+
+ (if (exist? "b-name")
+ (begin
+ (set! tmp (string-downcase! (string->c-name! (get "b-name"))))
+ (set! ix (string-table-add "nm" tmp))
+ (set! offset-list (string-append offset-list (sprintf "%d\n" ix)))
+ (set! sorted-off (string-append sorted-off
+ (sprintf "%-40s { %3d, %3d }\n" tmp ix (for-index))))
+ )
+
+ (set! offset-list (string-append offset-list "0\n" ))
+ ) =][=
+
+ENDFOR bit =][=
+
+ (emit-string-table "nm")
+ (sprintf "\nchar *\n%1$s_names(%1$s_bits_t bits)\n{" base-name)
+=]
+ static int const nm_ixa[ [= (+ 1 (high-lim "bit")) =] ] = {
+[=
+
+ (define string-table-size (lambda (st-name)
+ (hash-ref (hash-ref stt-table st-name) "current-index") ))
+
+ (emit (shellf "columns -I8 -S, --spread=1 <<_EOF_\n%s_EOF_" offset-list))
+=] };
+
+ static char buf[ [= (+ (string-table-size "nm") (count "bit")) =] ];
+ char * buf_p = buf;
+ int ix = 0;
+[=
+
+IF (< (high-lim "bit") 64)
+
+=]
+ while (bits != 0) {
+ if ((bits & 1) != 0) {
+ char const * p = nm + nm_ixa[ix];
+
+ if (buf_p > buf) {
+ *(buf_p++) = ',';
+ *(buf_p++) = ' ';
+ }
+
+ if (p == nm) {
+ Oops:
+ strncpy(buf_p, nm, sizeof (buf) - (buf_p - buf));
+ break;
+ }
+
+ while ((*(buf_p++) = *(p++)) != '\0') ;
+ buf_p--;
+ }
+ bits >>= 1;
+ if (++ix > [= (high-lim "bit") =]) {
+ if (bits != 0)
+ goto Oops;
+ break;
+ }
+ }[=
+
+ELSE more than 64:
+
+=]
+ int bix = 0;
+ int bit_lim = 32;
+ do {
+ uint32_t bit_word = bits[bix];
+ int ix = bix * 32;
+
+ while (bit_word != 0) {
+ if ((bit_word & 1) != 0) {
+ char const * p = nm + nm_ixa[ix];
+
+ if (buf_p > buf) {
+ *(buf_p++) = ',';
+ *(buf_p++) = ' ';
+ }
+
+ if (p == nm) {
+ Oops:
+ strncpy(buf_p, nm, sizeof (buf) - (buf_p - buf));
+ break;
+ }
+
+ while ((*(buf_p++) = *(p++)) != '\0') ;
+ buf_p--;
+ }
+ bit_word >>= 1;
+ if (++ix > [= (high-lim "bit") =]) {
+ if (bit_word != 0)
+ goto Oops;
+ return buf;
+ }
+ }
+ } while (++bix < [= `echo $mask_ct` =]);[=
+
+ENDIF
+
+=]
+
+ return buf;
+}
+
+static int
+str_to_id(char const * str, char const ** p_str)
+{
+ static char nm_buf[ [= (+ 1 name-width) =] ];
+ int res = -1;
+ int part = 1;
+ size_t len = 0;
+
+ /*
+ * Extract the lower cased name with '-' replaced with '_'
+ */
+ {
+ char * p = nm_buf;
+
+ for (;;) {
+ char ch = *(str++);
+ switch (ch) {
+ case '-':
+ ch = '_';
+ /* FALLTHROUGH */
+
+ case '_':
+ break;
+
+ default:
+ if (isupper(ch))
+ ch = _tolower(ch);
+ else if (! isalnum(ch)) {
+ str--;
+ goto have_name;
+ }
+ }
+
+ if (++len > [= (. name-width) =])
+ return -1;
+
+ *(p++) = ch;
+ } have_name :;
+
+ *p = '\0';
+ len = p - nm_buf;
+ if (len == 0)
+ return INV_[= (. BASE-NAME) =];
+ }
+
+ /*
+ * Search the alphabetized table
+ */
+ do {
+ static struct {
+ unsigned short const nm_off, val;
+ } nm_ixa[ [= (count "bit") =] ] = {
+[=
+ (shellf (string-append
+ "(sort | sed 's/.*{/{/' | columns -I8 -S, --spread=1)<<_EOF_\n"
+ sorted-off "_EOF_"
+ ))
+=] };
+
+ int av;
+ int lo = 0;
+ int hi = [= (- (count "bit") 1) =];
+
+ /*
+ * Binary search for first match
+ */
+ do {
+ char const * p;
+ int df;
+
+ av = (lo + hi) / 2;
+ p = nm + nm_ixa[av].nm_off;
+ df = strncmp(p, nm_buf, len);
+
+ if (df == 0) {
+ res = nm_ixa[av].val;
+ if (p[len] == '\0')
+ part = 0;
+
+ break;
+ }
+
+ if (df > 0)
+ hi = av - 1;
+ else lo = av + 1;
+
+ } while (lo <= hi);
+
+ if (res < 0)
+ return INV_[= (. BASE-NAME) =];
+
+ if (part == 0)
+ break;
+
+ /*
+ * Partial match. Look for an earlier match. One may be a full match.
+ */
+ lo = av;
+ while (lo > 0) {
+ char const * p = nm + nm_ixa[--lo].nm_off;
+ int df = strncmp(p, nm_buf, len);
+ if (df != 0)
+ break;
+ if (p[len] == '\0') {
+ part = 0;
+ res = nm_ixa[lo].val;
+ break;
+ }
+ part++;
+ }
+
+ if (part > 1) {
+ *p_str = nm_buf;
+ return DUP_[= (. BASE-NAME) =];
+ }
+
+ if ((part == 0) || (av == [= (- (count "bit") 1) =]))
+ break;
+
+ /*
+ * Look for a successor match. No full match possible.
+ */
+ {
+ char const * p = nm + nm_ixa[av+1].nm_off;
+ int df = strncmp(p, nm_buf, len);
+ if (df == 0) {
+ *p_str = nm_buf;
+ return DUP_[= (. BASE-NAME) =];
+ }
+ }
+ } while (0);
+
+ while (isspace(*str)) str++;
+ *p_str = str;
+ return res;
+}
+
+int
+[=
+
+# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+(. base-name) =]_bits(
+ [= (. type-name) =] * const bits[= (if is-array "_p")=],
+ char const * str)
+{[=
+ IF (. is-array) =]
+ [= (. element-type) =] * const bits = (void*)bits_p;[=
+ ENDIF =]
+ int ct = 0;
+ int res = 0;
+
+ memset(bits, '\0', sizeof([= (. type-name) =]));
+
+ another_bit:
+
+ while (isspace(*str) || (*str == ',')) str++;
+
+ for (;;) {
+ if (isdigit(*str)) {
+ [=(. element-type) =] num =
+ ([=(. element-type) =])strtoull(str, &str, 0);
+ *bits |= num;
+ ct += (num != 0);
+
+ } else if (isalpha(*str)) {
+ res = str_to_id(str, &str);
+ if (res < 0) {
+ if (res == DUP_[= (. BASE-NAME) =])
+ fprintf(stderr, "duplicate matches for '%s'\n", str);
+ goto fail_exit;
+ }
+ ct++;
+[=
+
+ IF (. is-array) =]
+ bits[res/32] |= 1 << (res & 0x1F);[=
+ ELIF (. is-64-bit) =]
+ *bits |= 1ULL << res;[=
+ ELSE =]
+ *bits |= 1 << res;[=
+ ENDIF
+
+=]
+ } else switch (*str) {
+ case ',':
+ goto another_bit;
+
+ case '\0':
+ return ct;
+
+ default:
+ res = INV_[= (. BASE-NAME) =];
+ goto fail_exit;
+ }
+ }
+
+ fail_exit:
+ memset(bits, '\0', sizeof(*bits));
+ return res;
+}
+
+#ifdef TEST_BITS
+
+static char const bit_names[] =
+[=
+(kr-string (string-append "The known " base-name " bit names are:\n"
+ (shellf (string-append
+ "(sort | columns -I2 --spread=1\n) <<_EOF_\n"
+ (string-downcase! (join "\n" (stack "bit.b-name")))
+ "\n_EOF_"))
+ "\n" ))
+ =];
+
+int
+main(int argc, char** argv)
+{
+ static char const fmt_z[] = "'%s' yields: %s\n";
+ [= (. type-name) =] bts;
+ if (argc != 2) {
+ fputs(bit_names, stderr);
+ return 1;
+ }
+ {
+ int ct = [= (. base-name) =]_bits(&bts, argv[1]);
+ if (ct <= 0) {
+ char const * pz;
+ switch (ct) {
+ case 0: pz = "no results"; break;
+ case INV_[= (. BASE-NAME) =]: pz = "invalid name"; break;
+ case DUP_[= (. BASE-NAME) =]: pz = "multiple match"; break;
+ }
+ fprintf(stderr, fmt_z, argv[1], pz);
+ fputs(bit_names, stderr);
+ return 1;
+ }
+ }
+ {
+ char * pz = [= (. base-name) =]_names(bts);
+ printf(fmt_z, argv[1], pz);
+ }
+ return 0;
+}
+#endif
+[=
+
+ESAC =]
+/* end of [= (out-name) =] */
+[=#
+
+= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE preamble =][=
+
+ (if (not init-done) (begin
+
+ (if (not (exist? "mask-name"))
+ (error "no defined bit mask name"))
+
+ (shell "calc() { bc <<_EOF_
+$*
+_EOF_
+}
+ mask_val=0")
+ (set! init-done #t)
+ (set! base-name (string-downcase! (string->c-name! (get "mask-name"))))
+ (set! BASE-NAME (string-upcase base-name))
+ (set! prefix (string-upcase (string->c-name!
+ (if (exist? "prefix") (get "prefix") base-name) )))
+ ) )
+
+ (dne " * " "/* ") =]
+ */
+[=
+
+ENDDEF preamble
+
+= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-bit-list =][=
+
+ (if (exist? "b-name")
+ (set! bit-list (string-append (join "\n" (stack "b-name")) "\n"))
+ (set! bit-list "")
+ ) =][=
+
+ FOR m-inc =][=
+ (set! tmp (string->c-name! (get "m-inc")))
+ (set! bit-list (string-append bit-list
+ (shellf "echo \"${%s}\"" tmp) "\n"))
+ =][=
+ ENDFOR m-inc=][=
+
+ (set! bit-list (string->c-name! bit-list))
+ (shellf "%s='%s'" (string->c-name! (get "m-name")) bit-list)
+
+ (emit (shell (string-append
+
+ "(sort -u | columns -I8 --spread=1 -S' |' --format=" prefix "_%s_BIT "
+ "--line=' \\'\n) <<\\_EOF_\n"
+ (string-upcase bit-list)
+ "_EOF_"
+
+ )))
+
+ (shell (string-append
+ "sum=`(sort -u | \
+ sed -e \"${sedcmd}\"\n) <<\\_EOF_\n"
+ bit-list
+ "_EOF_\n`\n"
+ "sum=`eval calc ${sum} 0`\n"
+ "printf "
+ (if (>= (high-lim "bit") 32)
+ "' \\\\\\n /* 0x%016XULL */\\n'"
+ (if (>= (high-lim "bit") 16)
+ "' \\\\\\n /* 0x%08XU */\\n'"
+ "' \\\\\\n /* 0x%04XU */\\n'" ))
+ " ${sum}"
+ ))
+=][=
+
+ENDDEF emit-bit-list
+
+= = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-word-macro =][=
+
+ (set! tmp-name (string-upcase! (string-append prefix "_"
+ (if (exist? "zero-name") (get "zero-name") "NO_BITS") )))
+ (sprintf def-fmt tmp-name) =]0[= one =][=
+
+ FOR bit =][=
+
+ (sprintf def-fmt (id-name "_BIT")) =](1[=one=] << [= (id-name "_ID") =])[=
+
+ ENDFOR =][=
+
+ (ag-fprintf 0 def-fmt (string-append BASE-NAME "_MASK"))
+ (shellf "printf 0x%s ${mask_val}" (get "mask-fmt"))
+
+ =][=
+
+ FOR mask
+
+ =]
+[= (sprintf def-fmt (mask-name "_MASK")) =]( \
+[= INVOKE emit-bit-list =] )[=
+
+ ENDFOR mask =][=
+
+ FOR un-mask
+
+ =]
+[= (sprintf def-fmt (mask-name "_MASK")) =]([=
+ (string-append BASE-NAME "_MASK") =] & ~( \
+[= INVOKE emit-bit-list =]))[=
+
+ ENDFOR un-mask=][=
+
+ (if (exist? "defined") (string-append "\n\n" (get "defined")))
+
+=][= IF (not (exist? "omit-test-n-set")) =]
+
+#define SET_[= (. BASE-NAME) =](_m, _b) \
+ do { (_m) |= 1[= one =] << _b; } while (0)
+#define CLEAR_[= (. BASE-NAME) =](_m, _b) \
+ do { (_m) &= ~(1[= one =] << _b); } while (0)
+#define TEST_[= (. BASE-NAME) =](_m, _b) (((_m) & (1[= one =] << _b)) != 0)
+#define AND_[= (. BASE-NAME) =](_d, _s1, _s2) \
+ do { (_d) = (_s1) & (_s2); } while (0)
+#define OR_[= (. BASE-NAME) =](_d, _s1, _s2) \
+ do { (_d) = (_s1) | (_s2); } while (0)
+#define XOR_[= (. BASE-NAME) =](_d, _s1, _s2) \
+ do { (_d) = (_s1) ^ (_s2); } while (0)
+#define NOT_[= (. BASE-NAME) =](_d, _s) \
+ do { (_d) = ~(_s); } while (0)
+[= ENDIF omit-test-n-set =][=
+ENDDEF emit-word-macro
+
+= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-loop-macro
+
+=][=
+
+ (sprintf "#define %5s_%s" (get "mac-name") BASE-NAME) =][=
+
+ CASE op-code =][=
+ == "~" =](_d, _s)[= (set! tmp one-arg-op)=][=
+ * =](_d, _s1, _s2)[= (set! tmp two-arg-op)=][=
+ ESAC op-code =] \
+ [= (. iterate) =] \
+ [= (sprintf tmp (get "op-code")) =][=
+
+ENDDEF emit-loop-macro
+
+= = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-multi-macros
+
+=][=
+
+defined
+
+=][= IF (not (exist? "omit-test-n-set")) =]
+
+#define SET_[=
+(define iterate (sprintf "do { int _ix_ = 0; for (;_ix_ < %s; _ix_++) {"
+ (shell "echo $mask_ct") ))
+(define two-arg-op "(_d)[_ix_] = (_s1)[_ix_] %s (_s2)[_ix_]; } } while (0)")
+(define one-arg-op "(_d)[_ix_] = %s(_s)[_ix_]; } } while (0)")
+
+ BASE-NAME =](_m, _b) \
+ do { (_m)[(_b)/32] |= 1U << ((_b) % 32); } while (0)
+#define CLEAR_[= (. BASE-NAME) =](_m, _b) \
+ do { (_m)[(_b)/32] &= ~(1U << ((_b) % 32)); } while (0)
+#define TEST_[= (. BASE-NAME) =](_m, _b) \
+ (((_m)[(_b)/32] & (1U << ((_b) % 32))) != 0)
+[= INVOKE emit-loop-macro op-code = "&" mac-name = AND =]
+[= INVOKE emit-loop-macro op-code = "|" mac-name = OR =]
+[= INVOKE emit-loop-macro op-code = "^" mac-name = XOR =]
+[= INVOKE emit-loop-macro op-code = "~" mac-name = NOT =]
+[= ENDIF omit-test-n-set =][=
+
+ENDDEF emit-multi-macros =][=
+
+# End of bits.tpl \=]
diff --git a/autoopts/tpl/cmd-doc.tlib b/autoopts/tpl/cmd-doc.tlib
new file mode 100644
index 0000000..b59cef9
--- /dev/null
+++ b/autoopts/tpl/cmd-doc.tlib
@@ -0,0 +1,1001 @@
+[+: -*- Mode: nroff -*-
+
+ AutoGen5 template man
+
+# cmd-doc.tlib -- Template for command line man/mdoc pages
+#
+# Time-stamp: "2012-05-12 20:52:33 bkorb"
+#
+# This file is part of AutoOpts, a companion to AutoGen.
+# AutoOpts is free software.
+# Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+#
+# AutoOpts is available under any one of two licenses. The license
+# in use must be one of these two and the choice is under the control
+# of the user of the license.
+#
+# The GNU Lesser General Public License, version 3 or later
+# See the files "COPYING.lgplv3" and "COPYING.gplv3"
+#
+# The Modified Berkeley Software Distribution License
+# See the file "COPYING.mbsd"
+#
+# These files have the following md5sums:
+#
+# 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+# 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+# 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+# Produce a man page for section 1, 5, 6 or 8 commands. Which is
+# selected via: -DMAN_SECTION=n. "n" may have a suffix, if desired.
+# These sections have default section names that may be overridden
+# with -DSECTIN_NAME=XX, also passed to the autogen invocation.
+#
+:+][+:
+
+ ;;# START-BUILDTREE-ISMS
+ ;;
+ (shell "CLexe=${AGexe%/agen5/*}/columns/columns
+ test -x \"${CLexe}\" || {
+ CLexe=${AGexe%/autogen}/columns
+ test -x \"${CLexe}\" || die 'columns program is not findable'
+ }")
+
+:+][+: # END-BUILDTREE-ISMS
+
+ (shell "CLexe=${AGexe%/autogen}/columns")
+
+# END-INSTALL-ONLY-CODE :+][+:
+
+(define down-prog-name (string-downcase! (get "prog-name")))
+(define UP-PROG-NAME (get-up-name "prog-name"))
+
+(define tmp-val (getenv "MAN_SECTION"))
+(define man-sect (if (exist? "cmd-section") (get "cmd-section") "1"))
+(define file-name "")
+(define sect-name "")
+(define macro-name "")
+(define tmp-str "")
+(define fname-line "")
+(define use-flags (exist? "flag.value"))
+(define named-mode (not (or use-flags (exist? "long-opts") )))
+
+(if (defined? 'tmp-val)
+ (if (string? tmp-val)
+ (set! man-sect tmp-val)))
+
+(define section-name
+ (if (=* man-sect "1") "User Commands"
+ (if (=* man-sect "5") "File Formats"
+ (if (=* man-sect "6") "Games"
+ (if (=* man-sect "8") "System Management"
+ (error
+ "the agman-cmd template only produces section 1, 5, 6 and 8 man pages")
+)))))
+(set! tmp-val (getenv "SECTION_NAME"))
+(if (defined? 'tmp-val) (if (string? tmp-val)
+ (set! section-name tmp-val) ))
+
+(define package-text "")
+(define package+version (and (exist? "package") (exist? "version")))
+
+(if (or (exist? "package") (exist? "version")) (begin
+ (set! package-text (string-append
+ (get "package")
+ (if package+version " (" "")
+ (get "version")
+ (if package+version ")" "") ))
+) )
+
+(define name-to-fname (lambda (nm)
+ (string-tr (string-downcase nm) " " "-") ))
+
+(define sect-line-fname (lambda () (begin
+ (out-push-new file-name)
+ (emit (string-append ".Sh \"" sect-name "\"\n"))
+ (string-append "mk-" macro-name) )))
+
+(make-tmp-dir)
+
+(define home-rc-files (exist? "homerc"))
+(define home-rc-text
+ "\nSee \\fBOPTION PRESETS\\fP for configuration files.")
+
+(define environ-init (exist? "environrc"))
+(define environ-text
+ "\nSee \\fBOPTION PRESETS\\fP for configuration environment variables.")
+
+(set! tmp-str (find-file (if man-page "texi2man" "texi2mdoc")))
+(if (not (defined? 'tmp-str))
+ (error (string-append "cannot locate "
+ (if man-page "texi2man" "texi2mdoc"))))
+(shell (string-append "cvt_prog='" tmp-str
+ "'\ntest -x \"$cvt_prog\" || die 'no conversion program'" ))
+
+(define get-cvt (lambda (nm alt-txt)
+ (shell (string-append
+ "{\n${cvt_prog} || die ${cvt_prog} failed in $PWD\n"
+ "} <<\\_EndOfTexiSection_\n"
+ (get nm alt-txt)
+ "\n_EndOfTexiSection_"
+ ))
+))
+
+(emit (head-line))
+(dne ".\\\" ") :+][+:
+
+INCLUDE "tpl-config.tlib" :+][+:#
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" B U I L D D O C
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE build-doc :+][+:
+
+INVOKE doc-sections :+][+:
+INVOKE ao-sections :+][+:
+
+(out-push-new (string-append tmp-dir "/.assemble")) \:+]
+
+cat_n_rm() {
+ test -f ${tmp_dir}/$1 || return 0
+ [+:(. egrep-prog):+] -v '^[ ]*$' ${tmp_dir}/$1
+ rm -f ${tmp_dir}/$1
+}
+
+#.\" Insert these sections first, in the prescribed order
+#
+for f in synopsis description options option-presets
+do cat_n_rm $f ; done
+test -f ${tmp_dir}/name && rm -f ${tmp_dir}/name
+
+#.\" These sections go last, in the prescribed order
+#
+for f in implementation-notes environment files examples exit-status errors \
+ compatibility see-also conforming-to history authors copyright bugs notes
+do cat_n_rm $f ; done > ${tmp_dir}/.fini
+
+#.\" Insert the contents of all remaining files in alphabetic order,
+#.\" except remove any blank lines.
+#
+set XX ${tmp_dir}/* ; shift
+test -f "$1" && cat $* | [+:(. egrep-prog):+] -v '^[ ]*$'
+
+#.\" Now insert the sections we squirreled away for the end.
+#
+cat ${tmp_dir}/.fini
+[+: (out-pop)
+ (shell ". ${tmp_dir}/.assemble") :+][+:
+
+ENDDEF build-doc
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" D O C S E C T I O N S
+.\"
+.\" Emit the files for each section that was provided.
+.\"
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE doc-sections :+][+:
+
+FOR doc-section :+][+:
+
+ CASE
+ (define sec-type (string-upcase (get "ds-type")))
+ (define sec-name (name-to-fname sec-type))
+ (out-push-new (string-append tmp-dir "/" sec-name))
+ (define cvt-fn (find-file (string-append
+ (get "ds-format" "man") "2mdoc")))
+ (if (not (defined? 'cvt-fn))
+ (error (sprintf "Cannot locate converter for %s"
+ (get "ds-format" "man"))))
+ sec-type :+][+:
+ == "" :+][+: (error "unnamed doc-section") :+][+:
+ *==* " " :+].Sh "[+: (. sec-type) :+]"[+:
+ * :+].Sh [+: (. sec-type) :+][+:
+ ESAC :+]
+[+:
+ (shell (string-append
+ "fn='" cvt-fn "'\n"
+ "test -f ${fn} || die ${fn} not found from $PWD\n"
+ "${fn} <<\\_EndOfDocSection_ || die ${fn} failed in $PWD\n"
+ (get "ds-text")
+ "\n_EndOfDocSection_"
+ )) :+][+:
+
+ CASE (. sec-type) :+][+:
+ == FILES :+][+:
+ (if home-rc-files (emit home-rc-text))
+ (set! home-rc-files #f) :+][+:
+
+ == ENVIRONMENT :+][+:
+ (if environ-init (emit environ-text))
+ (set! environ-init #f) :+][+:
+ ESAC :+][+:
+
+ (out-pop)
+ :+][+:
+
+ENDFOR doc-section :+][+:
+
+ENDDEF doc-sections
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" A O S E C T I O N S
+.\"
+.\" Emit the files for the sections that these templates augment,
+.\" replace or conditionally replace
+.\"
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE ao-sections :+][+:
+
+INVOKE cond-section sec = "OPTIONS" mode = "replace" :+][+:
+INVOKE cond-section sec = "SYNOPSIS" mode = "alt" :+][+:
+INVOKE cond-section sec = "DESCRIPTION" mode = "append" :+][+:
+INVOKE cond-section sec = "EXIT STATUS" mode = "insert" :+][+:
+INVOKE cond-section sec = "AUTHORS" mode = "alt" :+][+:
+INVOKE cond-section sec = "BUGS" mode = "append" :+][+:
+INVOKE cond-section sec = "NOTES" mode = "append" :+][+:
+
+IF (exist? "copyright") :+][+:
+ INVOKE cond-section sec = "COPYRIGHT" mode = "alt" :+][+:
+ENDIF :+][+:
+
+IF (or home-rc-files environ-init) :+][+:
+ INVOKE cond-section sec = "OPTION PRESETS" mode = "replace" :+][+:
+
+ IF (. home-rc-files) :+][+:
+ INVOKE cond-section sec = "FILES" mode = "append" :+][+:
+ ENDIF :+][+:
+
+ IF (. environ-init) :+][+:
+ INVOKE cond-section sec = "ENVIRONMENT" mode = "append" :+][+:
+ ENDIF :+][+:
+
+ENDIF :+][+:
+
+ENDDEF ao-sections
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" C O N D I T I O N A L S E C T I O N
+.\"
+.\" Figure out what to do for AutoOpts required sections, depending on "mode"
+.\" In all cases, if the file does not exist, invoke the "mk" macro to create
+.\" a new file. If it does exist, then:
+.\"
+.\" alt Alternate -- emit no text
+.\" replace throw away any pre-existing file.
+.\" append invoke the "append" macro to emit additional text
+.\" insert save the current contents, replacing the .Sh line with .Pp.
+.\" invoke the "mk" macro then emit the saved text
+.\"
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE cond-section :+][+:
+
+ IF
+ (set! sect-name (string-upcase! (string-substitute
+ (get "sec") "-" " " )))
+ (set! macro-name (string-downcase! (string-substitute
+ sect-name " " "-" )))
+ (set! file-name (string-append tmp-dir "/" macro-name))
+
+ (not (access? file-name R_OK)) :+][+:
+
+ INVOKE (sect-line-fname) :+][+:
+ (out-pop) :+][+:
+
+ ELSE file exists :+][+:
+
+ CASE (get "mode") :+][+:
+
+ == replace :+][+:
+ INVOKE (sect-line-fname) :+][+:
+ (out-pop) :+][+:
+
+ == append :+][+:
+ (out-push-add file-name) :+][+:
+ INVOKE (string-append "append-" macro-name) :+][+:
+ (out-pop) :+][+:
+
+ == insert :+][+:
+ (set! fname-line (shellf "sed '1s/.Sh .*/.Pp/' %s" file-name)) :+][+:
+ INVOKE (sect-line-fname) :+][+:
+ (emit fname-line)
+ (out-pop) :+][+:
+
+ # * -- otherwise, do nothing :+][+:
+
+ ESAC :+][+:
+
+ ENDIF file existence/non-existence :+][+:
+ENDDEF cond-section
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" M K - D E S C R I P T I O N
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE mk-description :+][+:
+
+ (if (exist? "prog-man-descrip")
+ (stack-join "\n.Pp\n" "prog-man-descrip")
+ (if (exist? "detail")
+ (stack-join "\n.Pp\n" "detail")
+ "There is no description for this command."
+ ) ) :+]
+[+:
+ INVOKE append-description :+][+:
+
+ENDDEF mk-description
+
+.\" = = = = = APPEND TO IT: :+][+:
+
+DEFINE append-description :+][+:
+
+IF (= (get "main.main-type") "for-each"):+][+:
+
+ CASE main.handler-type :+][+:
+ ~* ^(name|file)|.*text \:+]
+.Pp
+This program will perform its function for every file named on the command
+line or every file named in a list read from stdin. The arguments or input
+names must be pre\-existing files. The input list may contain comments,
+which[+:
+
+ !E \:+]
+.Pp
+This program will perform its function for every command line argument
+or every non\-comment line in a list read from stdin.
+The input list comments[+:
+
+ * :+][+:
+ (error "the 'for-each' main has in invalid handler-type.") :+][+:
+ ESAC \:+]
+ are blank lines or lines beginning with a '[+:
+ ?% comment-char "%s" "#" :+]' character.
+[+:
+
+ENDIF - "main" exists :+][+:
+ENDDEF append-description
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" M K - O P T I O N S
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE mk-options
+
+:+][+:
+
+(define opt-arg "")
+(define dis-name "")
+(define opt-name "")
+(define optname-from "A-Z_^")
+(define optname-to "a-z--")
+(define cvt-cmd "")
+(define formatted-doc (exist? "option-doc-format"))
+
+(if formatted-doc (begin
+ (out-push-new)
+ (set! cvt-cmd (string-append (get "option-doc-format") "2mdoc"))
+) )
+
+(if (exist? "preserve-case")
+ (begin
+ (set! optname-from "_^")
+ (set! optname-to "--")
+) )
+
+(define fix-optname (lambda (o_nm) (begin
+ (set! o_nm (string-tr o_nm optname-from optname-to))
+ (set! o_nm (string-substitute o_nm "-" "\\-" ))
+ o_nm )))
+
+(if (exist? "option-info")
+ (string-append ".Pp\n" (get "option-info") "\n") )
+\:+]
+.Bl -tag[+:
+
+FOR flag :+][+:
+ IF (not (exist? "documentation")) :+][+:
+ IF (exist? "aliases") :+][+:
+ INVOKE emit-alias-opt :+][+:
+ ELSE :+][+:
+ INVOKE emit-flag-text :+][+:
+ ENDIF :+][+:
+
+ ELSE :+]
+.Ss "[+: (get-cvt "descrip" "") :+]"[+:
+
+ IF (set! tmp-str (get-cvt "documentation" ""))
+ (> (string-length tmp-str) 3) :+]
+[+: (. tmp-str) :+]
+[+: ENDIF :+][+:
+
+ ENDIF :+][+:
+ENDFOR flag
+
+.\" = = = = = = = = = = = = = = = = =
+.\" help option
+.\" = = = = = = = = = = = = = = = = =
+
+:+]
+.It [+:
+
+ IF (. use-flags) :+]\-[+: (get "help-value" "?") :+][+:
+ (if (exist? "long-opts") " , \" \\-\\-help\"") :+][+:
+ ELSE :+][+:
+ (if (exist? "long-opts") "\\-\\-") :+]help[+:
+ ENDIF :+]
+Display usage information and exit.[+:#
+
+.\" = = = = = = = = = = = = = = = = =
+.\" more-help option
+.\" = = = = = = = = = = = = = = = = = :+][+:
+
+ IF (not (exist? "no-libopts")) :+]
+.It [+:
+
+ IF (. use-flags) :+]\-[+: ?% more-help-value "%s" "!" :+][+:
+ IF (exist? "long-opts") :+] , " \-\-more-help"[+: ENDIF :+][+:
+ ELSE :+][+:
+ IF (exist? "long-opts") :+]\-\-[+: ENDIF :+]more-help[+:
+ ENDIF :+]
+Pass the extended usage information through a pager.[+:
+
+ENDIF no no-libopts
+
+.\" = = = = = = = = = = = = = = = = =
+.\" save and load configuration
+.\" = = = = = = = = = = = = = = = = = :+][+:
+
+IF (exist? "homerc") :+]
+.It [+:
+
+ IF (. use-flags) :+]\-[+: ?% save-opts-value "%s" ">"
+ :+] " [\fIrcfile\fP][+:
+ IF (exist? "long-opts") :+]," " \-\-save-opts" "[=\fIrcfile\fP][+:
+ ENDIF :+]"[+:
+ ELSE :+][+:
+ IF (exist? "long-opts") :+]\-\-[+:
+ ENDIF :+]save-opts "[=\fIrcfile\fP]"[+:
+ ENDIF :+]
+Save the option state to \fIrcfile\fP. The default is the \fIlast\fP
+configuration file listed in the \fBOPTION PRESETS\fP section, below.
+.It [+:
+
+ IF (. use-flags) :+]\-[+: ?% load-opts-value "%s" "<"
+ :+] " \fIrcfile\fP[+:
+ IF (exist? "long-opts")
+ :+]," " \-\-load-opts" "=\fIrcfile\fP," " \-\-no-load-opts[+:
+ ENDIF :+]"[+:
+ ELSE :+][+:
+ IF (exist? "long-opts") :+]\-\-[+:
+ ENDIF :+]load-opts "=\fIrcfile\fP," " \-\-no-load-opts"[+:
+ ENDIF :+]
+Load options from \fIrcfile\fP.
+The \fIno-load-opts\fP form will disable the loading
+of earlier RC/INI files. \fI\-\-no-load-opts\fP is handled early,
+out of order.[+:
+ENDIF (exist? "homerc")
+
+.\" = = = = = = = = = = = = = = = = =
+.\" version
+.\" = = = = = = = = = = = = = = = = = :+][+:
+
+IF (exist? "version") :+]
+.It [+:
+
+ IF (. use-flags) :+]\-[+: ?% version-value "%s" "v"
+ :+] " [{\fIv|c|n\fP}][+:
+ IF (exist? "long-opts") :+]," " \-\-version" "[=\fI{v|c|n}\fP][+:
+ ENDIF :+]"[+:
+ ELSE :+][+:
+ IF (exist? "long-opts") :+]\-\-[+:
+ ENDIF :+]version "[=\fI{v|c|n}\fP]"[+:
+ ENDIF :+]
+Output version of program and exit. The default mode is `v', a simple
+version. The `c' mode will print copyright information and `n' will
+print the full copyright notice.[+:
+ENDIF :+]
+.El
+[+:
+
+(if formatted-doc
+ (shell (string-append
+ "fn='" (find-file cvt-cmd)
+ "'\ntest -f ${fn} || die '" cvt-cmd " not found'\n"
+ "${fn} <<\\_EndOfMdoc_ || die ${fn} failed in $PWD\n"
+ (out-pop #t)
+ "\n_EndOfMdoc_" )) ) :+][+:
+
+ENDDEF mk-options
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" M K - O P T I O N - P R E S E T S
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE mk-option-presets \:+]
+Any option that is not marked as \fInot presettable\fP may be preset
+by loading values from [+:
+ IF (. home-rc-files)
+ :+]configuration ("RC" or ".INI") file(s)[+:
+ IF (. environ-init) :+] and values from
+[+:
+ ENDIF :+][+:
+ ENDIF :+][+:
+ IF (. environ-init) :+]environment variables named:
+.nf
+ \fB[+: (. UP-PROG-NAME) :+]_<option-name>\fP or \fB[+: (. UP-PROG-NAME) :+]\fP
+.fi
+.ad[+:
+ IF (. home-rc-files) :+]
+The environmental presets take precedence (are processed later than)
+the configuration files.[+:
+ ENDIF :+][+:
+ ELSE :+].[+:
+ ENDIF :+][+:
+
+ CASE
+ (define rc-file
+ (get "rcfile" (string-append "." (get "prog-name") "rc")) )
+ (count "homerc") :+][+:
+
+ == "0" :+][+:
+ == "1" :+][+:
+
+ CASE homerc :+][+:
+ ~~ '\.|\$HOME' :+]
+The file "\fI[+: (string-append (get "homerc") "/" rc-file)
+:+]\fP" will be used, if present.[+:
+ * :+]
+The \fIhomerc\fP file is "\fI[+:homerc:+]\fP", unless that is a directory.
+In that case, the file "\fI[+: (. rc-file) :+]\fP"
+is searched for within that directory.[+:
+ ESAC :+][+:
+
+ * :+]
+The \fIhomerc\fP files are [+:
+ FOR homerc ", " :+][+:
+ IF (last-for?) :+]and [+:
+ ENDIF :+]"\fI[+: homerc :+]\fP"[+: ENDFOR :+].
+If any of these are directories, then the file \fI[+: (. rc-file) :+]\fP
+is searched for within those directories.[+:
+ ESAC :+][+:
+
+ENDDEF mk-option-presets
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" M K - E X I T - S T A T U S
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE mk-exit-status \:+]
+One of the following exit values will be returned:
+.Bl -tag
+[+:
+(ag-fprintf 0 ".It 0 \" (EXIT_%s)\"\n%s\n"
+ (string->c-name! (string-upcase (get "exit-name[0]" "SUCCESS")))
+ (get-cvt "exit-desc[0]" "Successful program execution.") )
+
+(define need-ex-noinput (exist? "homerc"))
+(define need-ex-software #t)
+
+(ag-fprintf 0 ".It 1 \" (EXIT_%s)\"\n%s\n"
+ (string->c-name! (string-upcase (get "exit-name[1]" "FAILURE")))
+ (get-cvt "exit-desc[1]"
+ "The operation failed or the command syntax was not valid.")) :+][+:
+
+FOR exit-desc (for-from 2) :+][+:
+ (if (= (for-index) 66)
+ (set! need-ex-noinput #f)
+ (if (= (for-index) 70)
+ (set! need-ex-software #f) ))
+
+ (set! tmp-str (get (sprintf "exit-name[%d]" (for-index)) "* unnamed *"))
+ (sprintf ".It %d \" (EXIT_%s)\"\n%s\n"
+ (for-index)
+ (string-upcase (string->c-name! tmp-str))
+ (get-cvt "exit-desc" "")) :+][+:
+ENDFOR exit-desc :+][+:
+(if need-ex-noinput
+ (emit ".It 66 \" (EX_NOINPUT)\"
+A specified configuration file could not be loaded.\n"))
+
+(if need-ex-noinput
+ (emit ".It 70 \" (EX_SOFTWARE)\"
+libopts had an internal operational error. Please report
+it to autogen-users@lists.sourceforge.net. Thank you.\n"))
+
+(if (> (string-length fname-line) 1)
+ (emit fname-line)) :+]
+.El
+[+:
+
+ENDDEF exit-status
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" M K - A U T H O R S
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE mk-authors :+][+:
+
+ (define remove-authors #t)
+
+ (set! tmp-val
+ (if (exist? "copyright.author")
+ (stack-join ",\n" "copyright.author")
+ (stack-join ",\n" "copyright.owner") ))
+
+ (if (> (string-length tmp-val) 1)
+ (string-append tmp-val "\n")
+ (delete-file file-name))
+
+ :+][+:
+
+ENDDEF mk-authors
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" M K - B U G S
+.\"
+.\" This section is guaranteed to be the last section in the man page
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE mk-bugs :+][+:
+
+ (set! tmp-val (get "copyright.eaddr" (get "eaddr")))
+ (if (> (string-length tmp-val) 1)
+ (string-append "Please send bug reports to: " tmp-val "\n")
+ (delete-file file-name) )
+ :+][+:
+
+ENDDEF mk-bugs :+][+:
+
+DEFINE append-bugs :+][+:
+
+ (set! tmp-val (get "copyright.eaddr" (get "eaddr")))
+ (if (> (string-length tmp-val) 1)
+ (string-append "Please send bug reports to: " tmp-val "\n") )
+ :+][+:
+
+ENDDEF append-bugs
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" M K - C O P Y R I G H T (+ licensing)
+.\"
+.\" This section is guaranteed to be the last section in the man page
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE mk-copyright \:+]
+Copyright (C) [+: copyright.date :+] [+:
+ (get "copyright.owner" (get "copyright.author" (get "copyright.eaddr")))
+ :+] all rights reserved.
+[+: CASE (get "copyright.type") :+][+:
+ = note :+][+: (get "copyright.text") :+][+:
+ == '' :+]This program has an unspecified license.[+:
+
+ * :+][+:
+ (string-append "This program is released under the terms of "
+ (license-name (get "copyright.type")) ".") :+][+:
+
+ ESAC :+]
+[+:
+ENDDEF mk-copyright
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" M K - N O T E S
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE mk-notes \:+]
+This manual page was \fIAutoGen\fP-erated from the \fB[+: prog-name :+]\fP
+option definitions.
+[+:
+
+ENDDEF mk-notes
+
+.\" = = = = = APPEND TO IT: :+][+:
+
+DEFINE append-notes \:+]
+.Pp
+This manual page was \fIAutoGen\fP-erated from the \fB[+: prog-name :+]\fP
+option definitions.[+:
+
+ENDDEF append-notes
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" M K - E N V I R O N M E N T
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE mk-environment :+][+:
+ INVOKE append-environment :+][+:
+ENDDEF mk-environment
+
+.\" = = = = = APPEND TO IT: :+][+:
+
+DEFINE append-environment :+][+:
+ (. environ-text) :+][+:
+ENDDEF append-environment
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" M K - F I L E S
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE mk-files :+][+:
+ INVOKE append-files :+][+:
+ENDDEF mk-files
+
+.\" = = = = = APPEND TO IT: :+][+:
+
+DEFINE append-files :+][+:
+ (. home-rc-text) :+][+:
+ENDDEF append-files
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" E M I T A L I A S O P T
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE emit-alias-opt :+]
+.It [+:
+ IF (exist? "value") :+][+:
+ IF (exist? "long-opts") \:+]
+ \-[+:value:+] ", " -\-[+: name :+][+:
+ ELSE \:+]
+ \-[+:value:+][+:
+ ENDIF (exist? "long-opts") :+][+:
+
+ ELSE value does not exist -- named option only :+][+:
+
+ IF (not (exist? "long-opts")) \:+]
+ [+: name :+][+:
+ ELSE \:+]
+ \-\-[+: (. opt-name) :+][+:
+ ENDIF :+][+:
+ ENDIF :+]
+This is an alias for the [+: aliases :+] option.[+:
+ENDDEF emit-alias-opt
+
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+.\" E M I T F L A G T E X T
+.\" = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = :+][+:
+
+DEFINE emit-flag-text :+][+:
+
+ (if (exist? "enable")
+ (set! opt-name (string-append (get "enable") "-" (get "name")))
+ (set! opt-name (get "name")) )
+ (if (exist? "disable")
+ (set! dis-name (string-append (get "disable") "-" (get "name")))
+ (set! dis-name "") )
+
+ (set! opt-name (fix-optname opt-name))
+ (if (> (string-length dis-name) 0)
+ (set! dis-name (fix-optname dis-name)) )
+
+ (if (not (exist? "arg-type"))
+ (set! opt-arg "")
+ (set! opt-arg (string-append "\\fI"
+ (fix-optname (if (exist? "arg-name")
+ (get "arg-name")
+ (string-downcase! (get "arg-type")) ))
+ "\\fP" ))
+ )
+
+:+]
+.It [+:
+ IF (exist? "value") :+][+:
+ IF (exist? "long-opts") :+][+:
+
+ # * * * * * * * * * * * * * * * * * * * *
+ *
+ * The option has a flag value (character) AND
+ * the program uses long options
+ *
+ \:+]
+ \-[+:value:+][+:
+ IF (not (exist? "arg-type")) :+] ", " -\-[+:
+ ELSE :+] " [+:(. opt-arg):+], " \-\-[+:
+ ENDIF :+][+: (. opt-name) :+][+:
+ IF (exist? "arg-type") :+][+:
+ ? arg-optional " [ =" ' "=" '
+ :+][+: (. opt-arg) :+][+:
+ arg-optional " ]" :+][+:
+ ENDIF :+][+:
+ IF (exist? "disable") :+], " \fB\-\-[+:(. dis-name):+]\fP"[+:
+ ENDIF :+][+:
+
+ ELSE :+][+:
+
+ # * * * * * * * * * * * * * * * * * * * *
+ *
+ * The option has a flag value (character) BUT
+ * the program does _NOT_ use long options
+ *
+ \:+]
+ \-[+:value:+][+:
+ IF (exist? "arg-type") :+][+:
+ arg-optional "[" :+] "[+:(. opt-arg):+][+:
+ arg-optional '"]"' :+][+:
+ ENDIF " :+][+:
+ ENDIF (exist? "long-opts") :+][+:
+
+
+ ELSE value does not exist -- named option only :+][+:
+
+ IF (not (exist? "long-opts")) :+][+:
+
+ # * * * * * * * * * * * * * * * * * * * *
+ *
+ * The option does not have a flag value (character).
+ * The program does _NOT_ use long options either.
+ * Special magic: All arguments are named options.
+ *
+ \:+]
+ [+: (. opt-name) :+][+:
+ IF (exist? "arg-type") :+] [+:
+ ? arg-optional " [ =" ' "=" '
+ :+][+:(. opt-arg) :+][+:
+ arg-optional "]" :+][+:
+ ENDIF:+][+:
+ IF (exist? "disable") :+], " \fB[+:(. dis-name):+]\fP"[+:
+ ENDIF :+][+:
+
+
+ ELSE :+][+:
+ # * * * * * * * * * * * * * * * * * * * *
+ *
+ * The option does not have a flag value (character).
+ * The program, instead, only accepts long options.
+ *
+ \:+]
+ \-\-[+: (. opt-name) :+][+:
+
+ IF (exist? "arg-type") :+] "[+: #" :+][+:
+ arg-optional "[" :+]=[+:(. opt-arg):+][+:
+ arg-optional "]" :+]"[+: #" :+][+:
+ ENDIF :+][+:
+
+ IF (exist? "disable")
+ :+], " \fB\-\-[+:(. dis-name):+]\fP"[+:
+ ENDIF :+][+:
+ ENDIF :+][+:
+ ENDIF :+]
+[+: (get-cvt "descrip" "") :+].[+:
+
+ IF (exist? "min") :+]
+This option is required to appear.[+:
+ ENDIF :+][+:
+
+ IF (exist? "max") :+]
+This option may appear [+:
+ IF % max (= "%s" "NOLIMIT")
+ :+]an unlimited number of times[+:ELSE
+ :+]up to [+: max :+] times[+:
+ ENDIF:+].[+:
+ ENDIF:+][+:
+
+ IF (exist? "disable") :+]
+The \fI[+:(. dis-name):+]\fP form will [+:
+ IF (exist? "stack-arg")
+ :+]clear the list of option arguments[+:
+ ELSE :+]disable the option[+:
+ ENDIF :+].[+:
+ ENDIF:+][+:
+
+ IF (exist? "enabled") :+]
+This option is enabled by default.[+:
+ ENDIF :+][+:
+
+ IF (exist? "no-preset") :+]
+This option may not be preset with environment variables
+or in initialization (rc) files.[+:
+ ENDIF :+][+:
+
+ IF (and (exist? "default") named-mode) :+]
+This option is the default option.[+:
+ ENDIF :+][+:
+
+ IF (exist? "equivalence") :+]
+This option is a member of the [+:equivalence:+] class of options.[+:
+ ENDIF :+][+:
+
+ IF (exist? "flags-must") :+]
+This option must appear in combination with the following options:
+[+: FOR flags-must ", " :+][+:flags-must:+][+:ENDFOR:+].[+:
+ ENDIF :+][+:
+
+ IF (exist? "flags-cant") :+]
+This option must not appear in combination with any of the following options:
+[+: FOR flags-cant ", " :+][+:flags-cant:+][+:ENDFOR:+].[+:
+ ENDIF :+][+:
+
+
+ IF (~* (get "arg-type") "key|set") :+]
+This option takes a keyword as its argument[+:
+
+ IF (=* (get "arg-type") "set")
+
+:+] list. Each entry turns on or off
+membership bits. The bits are set by name or numeric value and cleared
+by preceding the name or number with an exclamation character ('!').
+They can all be cleared with the magic name \fInone\fR and they can all be set
+with
+.IR all .
+A single option will process a list of these values.[+:
+
+ ELSE
+
+:+]. The argument sets an enumeration value that can
+be tested by comparing them against the option value macro.[+:
+
+ ENDIF
+
+:+]
+The available keywords are:
+.in +4
+.nf
+.na
+[+: (shellf "${CLexe} --indent='' --spread=1 -W50 <<_EOF_\n%s\n_EOF_"
+ (join "\n" (stack "keyword")) ) :+]
+.fi
+or their numeric equivalent.
+.in -4[+: (if (exist? "arg-default") "\n.sp" ) :+][+:
+
+ ELIF (=* (get "arg-type") "num") :+]
+This option takes an integer number as its argument.[+:
+
+ IF (exist? "arg-range") :+]
+The value of [+:(. opt-arg):+] is constrained to being:
+.in +4
+.nf
+.na[+:FOR arg_range ", or" :+]
+[+: (shellf "
+range='%s'
+
+case \"X${range}\" in
+X'->'?* )
+ echo \"less than or equal to\" `
+ echo $range | sed 's/->//' ` ;;
+
+X?*'->' )
+ echo \"greater than or equal to\" `
+ echo $range | sed 's/->.*//' ` ;;
+
+X?*'->'?* )
+ echo \"in the range \" `
+ echo $range | sed 's/->/ through /' ` ;;
+
+X?* )
+ echo exactly $range ;;
+
+X* ) echo $range is indeterminate
+esac"
+
+(get "arg-range") )
+:+][+:
+ ENDFOR arg-range :+]
+.fi
+.in -4[+:
+
+ ENDIF arg-range exists :+][+:
+
+ ENDIF arg-type key/set/num :+][+:
+
+ IF (exist? "arg-default") :+]
+The default [+: (. opt-arg) :+] for this option is:
+.ti +4
+ [+: (join " + " (stack "arg-default" )) :+][+:
+ ENDIF :+]
+.sp
+[+:
+ (if (exist? "doc")
+ (get-cvt "doc" "")
+ "This option has not been fully documented." ) :+][+:
+ IF (exist? "deprecated") :+]
+.sp
+.B
+NOTE: THIS OPTION IS DEPRECATED
+.R[+:
+ ENDIF :+][+:
+
+ENDDEF emit-flag-text
+
+.\" cmd-doc.tlib ends here \:+]
diff --git a/autoopts/tpl/def2pot.tpl b/autoopts/tpl/def2pot.tpl
new file mode 100644
index 0000000..d2c5cc4
--- /dev/null
+++ b/autoopts/tpl/def2pot.tpl
@@ -0,0 +1,131 @@
+[= AutoGen5 template pot =][=
+#
+# this template can be used to generate .pot file for the
+# option definition files for these templates:
+# aginfo.tpl, agman-cmd.tpl, agmdoc-cmd.tpl
+#
+
+====================== FUNCTIONS BEGIN =======================][=
+DEFINE genmsg =][=
+
+ IF (set! msg-id (get "msgid"))
+ (set! msg-text (get-text msg-id))
+ (< 0 (string-length msg-text)) =]
+#: [=(def-file-line msg-id "%s:%d") =]
+msgid [= (c-string msg-text) =]
+msgstr ""
+[=ENDIF =][=
+ENDDEF =][=
+
+DEFINE genmsg2 =][=
+ IF (set! msg-text (get "msgid"))
+ (string-length msg-text) =]
+#: [=(def-file-line msg-text "%s:%d") =]
+msgid [= (c-string msg-text) =]
+msgstr ""
+[=ENDIF =][=
+ENDDEF =][=
+
+(define get-text (lambda (nm) (shell (string-append
+
+ "{ sed 's/@[a-z]*{\\([^}]*\\)}/\\1/g' | "
+ "${CLexe} --fill -I0 -W72\n"
+ "} <<\\_EODesc_\n"
+ (get nm)
+ "\n_EODesc_"
+))))
+(define msg-text "")
+(define msg-id "")
+
+ ;;# START-BUILDTREE-ISMS
+ ;;
+ (shell "CLexe=${AGexe%/agen5/*}/columns/columns
+ test -x \"${CLexe}\" || {
+ CLexe=${AGexe%/autogen}/columns
+ test -x \"${CLexe}\" || die 'columns program is not findable'
+ }")
+
+=][= # END-BUILDTREE-ISMS
+
+ (shell "CLexe=${AGexe%/autogen}/columns")
+
+# END-INSTALL-ONLY-CODE =][= #
+
+;; ==================== FUNCTIONS END ===========================
+
+;; pot file header and comment info \=]
+# localization template (.pot) for [= (def-file) =] of [= prog-name =],
+# this file is used to generate localized manual for [= prog-name =].
+# Copyright (C) [= (shell "date +%Y") =][=
+
+ IF (exist? "copyright") =]
+# This file is distributed under the terms of the
+# [= (license-name (get "copyright.type")) \=]
+
+# The program owners may be reached via:
+# [=(shellf
+ "author='%s' email='%s' date=`date +%%Y`
+ printf '%%s <%%s>, %%s.' \"$author\" \"$email\" \"${date}\""
+ (get "copyright.owner" "FIRST AUTHOR")
+ (get "copyright.eaddr" "EMAIL@ADDRESS")
+)=][= ENDIF =]
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: [= prog-name =] [= version =]\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: [= (shell "date +\"%F %R%z\"") =]\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+[=
+genmsg msgid=prog-title =][=
+
+FOR flag =][=
+ genmsg msgid=descrip =][=
+ genmsg msgid=doc =][=
+ENDFOR =][=
+
+FOR explain =][=
+ genmsg msgid=explain =][=
+ENDFOR =][=
+
+FOR doc-section =][=
+ genmsg msgid=ds-text =][=
+ENDFOR =][=
+
+FOR prog-man-descrip =][=
+ genmsg msgid=prog-man-descrip =][=
+ENDFOR =][=
+
+FOR prog-info-descrip =][=
+ genmsg msgid=prog-info-descrip =][=
+ENDFOR =][=
+
+FOR detail =][=
+ genmsg msgid=detail =][=
+ENDFOR =][=
+
+FOR exit-desc =][=
+ genmsg msgid=exit-desc =][=
+ENDFOR =][=
+
+CASE (get "copyright.type") =][=
+ = note =][=
+ == '' =][=
+ * =][=
+ genmsg2 msgid=(string-append
+ "This program is released under the terms of "
+ (license-name (get "copyright.type")) ".")
+ =][=
+ESAC =][=
+
+genmsg msgid=option-info =][=
+genmsg msgid=argument =][=
+genmsg msgid=man-doc =][=
+genmsg msgid=copyright.text =]
diff --git a/autoopts/tpl/getopt.tpl b/autoopts/tpl/getopt.tpl
new file mode 100644
index 0000000..374c8b6
--- /dev/null
+++ b/autoopts/tpl/getopt.tpl
@@ -0,0 +1,517 @@
+[+ AutoGen5 Template -*- Mode: C -*-
+
+ h=%s-temp.h
+ c=%s-temp.c +][+
+
+`stamp=\`sed 's,.*stamp: *",,;s,".*,,' <<\_EOF_
+ Time-stamp: "2012-04-29 08:54:45 bkorb"
+_EOF_
+\` ` +][+
+
+;; This file is part of AutoOpts, a companion to AutoGen.
+;; AutoOpts is free software.
+;; AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+;;
+;; AutoOpts is available under any one of two licenses. The license
+;; in use must be one of these two and the choice is under the control
+;; of the user of the license.
+;;
+;; The GNU Lesser General Public License, version 3 or later
+;; See the files "COPYING.lgplv3" and "COPYING.gplv3"
+;;
+;; The Modified Berkeley Software Distribution License
+;; See the file "COPYING.mbsd"
+;;
+;; These files have the following md5sums:
+;;
+;; 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+;; 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+;; 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+ (if (not (exist? "settable"))
+ (error "'settable' must be specified globally for getopt_long\n"))
+ (if (not (exist? "no-libopts"))
+ (error "'no-libopts' must be specified globally to use getopt\n"))
+ (define prog-name (string->c-name! (get "prog-name")))
+ (define PROG-NAME (string-upcase prog-name))
+ (out-move (string-append "getopt-" prog-name "." (suffix)))
+ (dne " * " "/* " ) +]
+ *[+
+
+ IF (exist? "copyright") +]
+ *
+[+
+ CASE copyright.type +][+
+ == "" +] * licensing type not specified.[+
+ = note +][+ (prefix " * " (get "copyright.text")) +][+
+ * +][+
+ (license-description (get "copyright.type") prog-name " * "
+ (get "copyright.owner")) +][+
+ ESAC +][+
+ ENDIF +]
+ *
+ * Last template edit: [+ `echo $stamp` +]
+ */[+
+CASE (suffix) +][+
+== h +][+
+ (define header-file (out-name))
+ (out-push-new) \+]
+{
+ test -x "${AGexe}" || die "AGexe not properly set: ${AGexe}"
+[+ # START-BUILDTREE-ISMS:
+
+# The following code is sedded away in install-hook.sh.
+# The goal is to ensure we use build tree templates in testing mode, and
+# remove them when installing this file.
+
+\+]
+ aobdir=`echo ${AGexe} | sed 's@/[^/]*$@@'`
+
+ if ! test -x ${aobdir}/autoopts-config
+ then
+ # Check for autoopts-config in build directory layout
+ #
+ aobdir=`echo ${aobdir} | sed 's@/[^/]*$@@'`/autoopts
+ test -x ${aobdir}/autoopts-config || {
+ aobdir=`echo ${aobdir} | sed 's@/[^/]*/autoopts$@@'`/autoopts
+ test -x ${aobdir}/autoopts-config || \
+ die 'cannot locate autoopts-config'
+ }
+ fi
+
+ agopts=`dirname [+ (tpl-file #t) +]`
+ agopts="-L${aobdir}/tpl -L$agopts "
+ tarfile=`set -- ${aobdir}/libopts*.tar.*
+ test -f $1 || {
+ cd ${aobdir}
+ ${MAKE:-make} libsrc
+ cd -
+ set -- ${aobdir}/libopts*.tar.*
+ test -f $1 || die 'libopts tarball not built'
+ } >&2
+ echo $1`[+
+
+# END-BUILDTREE-ISMS the following code is for installed version:
+ agopts=
+ aocfg=`echo ${AGexe} | sed 's@/[^/]*$@@'`/autoopts-config
+ tarfile=`${aocfg} libsrc`
+
+# END-INSTALL-ONLY-CODE +]
+ if test -n "${AG_Tracing}"
+ then
+ AG_Dep_File=`dirname "${AG_Tracing}"`/ao-[+ (base-name) +].dep
+ agopts="${agopts}-MF${AG_Dep_File} -MT${AG_Dep_File%.dep}.targ"
+ fi
+
+ ${AGexe} -b[+ (base-name) +] ${agopts} -Toptions.tpl [+ (def-file) +]
+ def_hdr=[+ (base-name) +].h
+ sed 's@<autoopts/options.h>@"[+ (. header-file)
+ +]"@' $def_hdr > XXX-$$
+ mv -f XXX-$$ $def_hdr
+ hdrfile=`gunzip -c $tarfile | tar tf - | fgrep /autoopts/options.h`
+ gunzip -c $tarfile | tar xf - $hdrfile
+ exec 3< $hdrfile
+ untardir=`echo $hdrfile | sed 's@/.*@@'`
+} >&2
+
+while :
+do
+ IFS= read -r -u3 line || die "no header guard in $hdrfile"
+ case "$line" in
+ *AUTOOPTS_OPTIONS_H_GUARD ) break ;;
+ esac
+done
+echo
+
+echo "$line"
+IFS= read -r -u3 line || die "short $hdrfile"
+case "$line" in
+'#define AUTOOPTS_OPTIONS_H_GUARD'* ) : ;;
+*) die "invalid header guard in $hdrfile" ;;
+esac
+echo "$line"
+echo '#include "[+
+(if (exist? "config-header")
+ (get "config-header")
+ (error "getopt template requires a \"config-header\" attribute")
+) +]"'
+
+while :
+do
+ IFS= read -r -u3 line || die "no CPLUSPLUS_CLOSER in $hdrfile"
+ case "$line" in
+ *'Versions where in various fields first appear'* ) break ;;
+ esac
+ echo "$line"
+done
+
+cat <<- _EOF_
+ * option loop function
+ */
+ #ifdef __cplusplus
+ #define CPLUSPLUS_OPENER extern "C" {
+ CPLUSPLUS_OPENER
+ #define CPLUSPLUS_CLOSER }
+ #else
+ #define CPLUSPLUS_CLOSER
+ #endif
+
+ extern int process_[+(. prog-name)+]_opts(int argc, char** argv);
+ extern void optionPrintVersion(tOptions* pOptions, tOptDesc* pOptDesc);
+
+ CPLUSPLUS_CLOSER
+ _EOF_
+
+sed '1,/^CPLUSPLUS_CLOSER/d' <&3
+exec 3<&-
+rm -rf $untardir
+[+ (shell (out-pop #t)) +]
+[+ == c +]
+#include "[+ (. header-file) +]"
+
+#include <sys/types.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <[+ (if (exist? "long-opts") "getopt" "unistd") +].h>
+#include "[+ (base-name) +].h"
+
+#ifndef DIRCH
+# if defined(_WIN32) && !defined(__CYGWIN__)
+# define DIRCH '\\'
+# else
+# define DIRCH '/'
+# endif
+#endif[+
+
+IF (exist? "long-opts") +]
+
+/*
+ * getopt_long option descriptor
+ */
+static struct option a_long_opts[] = {[+
+
+ FOR flag +][+
+ (sprintf
+
+ "\n { %-20s %d, NULL, VALUE_OPT_%s },"
+ (string-append (c-string (get "name")) ",")
+ (if (exist? "arg-type") 1 0)
+ (string-upcase (string->c-name! (get "name")))
+ ) +][+
+
+ ENDFOR flag
+
++]
+ { "help", 0, NULL, VALUE_OPT_HELP },[+
+IF (exist? "version") +]
+ { "version", 0, NULL, VALUE_OPT_VERSION },[+
+ENDIF +]
+ { NULL, 0, NULL, 0 }
+};
+[+ ENDIF +]
+/*
+ * Option flag character list
+ */
+static char z_opts[] = "[+ # close quote for emacs " +][+
+ FOR flag +][+
+ CASE value +][+
+ ~ [!-~] +][+ value +][+
+
+ CASE arg-type +][+
+ =* str +]:[+
+ == "" +][+
+ * +][+ (error (sprintf
+ "error in %s opt: The only allowed arg type is 'string'\n"
+ (get "name") )) +][+
+ ESAC +][+
+
+ ESAC +][+
+
+ ENDFOR flag +][+
+
+ IF (not (exist? "help-value")) +]?[+
+ ELSE +][+
+ CASE help-value +][+
+ == "" +][+
+ == '"' +]\"[+
+ * +][+ help-value +][+
+ ESAC +][+
+ ENDIF +][+
+
+ IF (exist? "version") +][+
+ IF (not (exist? "version-value")) +]v[+
+ ELSE +][+
+ CASE version-value +][+
+ == "" +][+
+ == '"' +]\"[+
+ * +][+ version-value +][+
+ ESAC +][+
+ ENDIF +][+
+ ENDIF +][+
+
+ (define help-opt
+ (if (exist? "long-opts") "--help"
+ (if (not (exist? "flag.value")) "help"
+ (if (exist? "help-value") (string-append "-" (get "help-value"))
+ "-?" ))) )
+ ;; open quote for emacs " +]";
+
+/*
+ * AutoOpts library replacement routines:
+ */
+void
+optionUsage (tOptions* pOptions, int status)
+{
+ if (status != 0)
+ fprintf (stderr, _("Try `%s [+(. help-opt)+]' for more information.\n"),
+ [+ (. prog-name) +]Options.pzProgName);
+ else
+ {
+ fputs (_([+
+ INVOKE emit-usage-string usage-type = short +]), stdout);
+ }
+
+ exit (status);
+}
+
+void
+optionPrintVersion(
+ tOptions* pOptions,
+ tOptDesc* pOptDesc )
+{
+ char const * pz_by =
+ _("[+ # " +][+
+
+ (sprintf "%s%s %s" prog-name
+ (if (exist? "prog-group")
+ (sprintf " (%s)" (get "prog-group"))
+ "" )
+ (get "version") ) +]\n\
+Written by [+(join ", " (stack "copyright.author"))+].\n\n\
+copyright (c) [+ copyright.date +] [+ copyright.owner +]\n[+
+
+CASE copyright.type +][+
+*= gpl +]\
+This is free software; see the source for copying conditions. There is NO\n\
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.[+
+
+ESAC +][+ # " +]\n");
+
+ fputs (pz_by, stdout);
+ exit (EXIT_SUCCESS);
+}
+
+/*
+ * If an option appears more often than is allowed, ...
+ */
+static void
+usage_too_many (tOptDesc* pOptDesc)
+{
+ char const * pz =
+ _("[+(. prog-name)
+ +] error: the '%s' option appears more than %d times\n");
+ fprintf (stderr, pz, pOptDesc->pz_Name, pOptDesc->optMaxCt);
+ USAGE(EXIT_FAILURE);
+}
+[+
+ IF (exist? "flag.min")
++]
+/*
+ * There is at least one option that must appear.
+ */
+static void
+usage_too_few (tOptDesc* pOptDesc)
+{
+ char const * pz =
+ _("[+(. prog-name)
+ +] error: the '%s' option must appear %d times\n");
+ fprintf (stderr, pz, pOptDesc->pz_Name, pOptDesc->optMinCt);
+ USAGE(EXIT_FAILURE);
+}
+[+
+ ENDIF
++][+
+ IF (exist? "flag.flags-cant")
++]
+/*
+ * There is at least one pair of options that may not appear together
+ * on the command line.
+ */
+static void
+usage_cannot (char const* pz_what, char const* pz_cant)
+{
+ char const * pz =
+ _("[+(. prog-name)
+ +] error: the `%s' option conflicts with the `%s' option.\n");
+ fprintf (stderr, pz, pz_what, pz_cant);
+ USAGE(EXIT_FAILURE);
+}
+[+
+ ENDIF
++][+
+ IF (exist? "flag.flags-must")
++]
+/*
+ * There is at least one pair of options that are required to appear
+ * together on the command line.
+ */
+static void
+usage_must (char const* pz_what, char const* pz_must)
+{
+ char const * pz =
+ _("[+(. prog-name)
+ +] error: the `%s' option requires the `%s' option.\n");
+ fprintf (stderr, pz, pz_what, pz_must);
+ USAGE(EXIT_FAILURE);
+}
+[+
+ ENDIF
++]
+/*
+ * Process the options for the "[+(. prog-name)+]" program.
+ * This function was generated to use the getopt[+
+ (if (exist? "long-opts") "_long(3GNU)" "(3posix)") +] function.
+ * There are [+ (+ (count "flag") (if (exist? "version") 2 1))
+ +] options for this program,
+ * including "help (usage)"[+
+ IF (exist? "version") +] and "version"[+ ENDIF +].
+ */
+int
+process_[+(. prog-name)+]_opts (int argc, char** argv)
+{
+ {
+ char * pz_prog = strrchr (argv[0], DIRCH);
+ /*
+ * This violates the const-ness of the pzProgName field.
+ * The const-ness is to prevent accidents. This is not accidental.
+ */
+ char ** pp = (char **)(void *)&([+ (. prog-name) +]Options.pzProgName);
+
+ if (pz_prog != NULL)
+ pz_prog++;
+ else
+ pz_prog = argv[0];
+ *pp = pz_prog;
+ }
+
+ for (;;) {
+ switch ([+
+
+IF (exist? "long-opts")
+ +]getopt_long (argc, argv, z_opts, a_long_opts, NULL)[+
+ELSE +]getopt (argc, argv, z_opts)[+
+ENDIF +]) {
+ case -1: goto leave_processing;
+ case 0: break;[+
+ FOR flag +][+
+ (define OPT-NAME (string-upcase! (string->c-name! (get "name"))))
++]
+
+ case VALUE_OPT_[+ (. OPT-NAME) +]:[+
+
+ IF (not (exist? "max")) +]
+ if (HAVE_OPT( [+(. OPT-NAME)+] ))
+ usage_too_many (&DESC([+(. OPT-NAME) +]));[+
+
+ ELIF (not (= (get "max") "nolimit")) +]
+ if (DESC([+(. OPT-NAME)+]).optOccCt++ >= DESC([+(. OPT-NAME)+]).optMaxCt)
+ usage_too_many (&DESC([+(. OPT-NAME) +]));[+
+ ENDIF
++]
+ SET_OPT_[+(. OPT-NAME)+][+ (if (exist? "arg-type") "(optarg)") +];
+ break;[+
+
+ ENDFOR +]
+
+ case VALUE_OPT_HELP:
+ USAGE(EXIT_SUCCESS);
+ /* NOTREACHED */
+[+ IF (exist? "version") +]
+ case VALUE_OPT_VERSION:
+ optionPrintVersion (&[+ (. prog-name) +]Options, &DESC(VERSION));
+ /* NOTREACHED */
+[+ ENDIF +]
+ default:
+ USAGE(EXIT_FAILURE);
+ }
+ } leave_processing:;
+[+
+FOR flag +][+
+ IF
+ (set! OPT-NAME (string-upcase! (string->c-name! (get "name"))))
+ (define check-have-opt (or (exist? "flags-cant") (exist? "flags-must")))
+ check-have-opt
++]
+ if (HAVE_OPT( [+ (. OPT-NAME) +] )) {[+
+
+ FOR flags-cant +]
+ if (HAVE_OPT( [+ (string-upcase! (string->c-name! (get "flags-cant"))) +] ))
+ usage_cannot (DESC([+ (. OPT-NAME) +]).pz_Name, DESC([+
+ (string-upcase! (string->c-name! (get "flags-cant"))) +]).pz_Name);[+
+ ENDFOR cant +][+
+
+ FOR flags-must +]
+ if (! HAVE_OPT( [+(string-upcase! (string->c-name! (get "flags-must")))+] ))
+ usage_must (DESC([+ (. OPT-NAME) +]).pz_Name, DESC([+
+ (string-upcase! (string->c-name! (get "flags-must"))) +]).pz_Name);[+
+ ENDFOR must +][+
+
+ IF (exist? "min") +][+
+ IF (> (string->number (get "min" "0")) 1) +]
+ if (DESC([+(. OPT-NAME)+]).optOccCt < DESC([+(. OPT-NAME)+]).optMinCt)
+ usage_too_few (&DESC([+(. OPT-NAME) +]));[+
+
+ ENDIF +][+
+ ENDIF +]
+ }
+[+
+
+ ENDIF
+
++][+
+
+ IF (exist? "min") +][+
+ IF (. check-have-opt)
++] else[+
+
+ ELSE
++]
+ if ([+ #
+ We have a minimum count, but we have not checked for option existence
+ yet because there are no option interdependencies. We must therefore
+ now check to see if the option has appeared the required number of
+ times. In the absence of a max count, our limit must be one and we
+ only check for presence. If a max count exists, then we will also
+ have kept the occurrence count. Check that against the limit. +][+
+
+ IF (not (exist? "max"))
+ +]! HAVE_OPT( [+ (. OPT-NAME) +] )[+
+ ELSE max ct exists
+ +]DESC([+(. OPT-NAME)+]).optOccCt < DESC([+(. OPT-NAME)+]).optMinCt[+
+ ENDIF +])[+
+
+ ENDIF +]
+ usage_too_few (&DESC([+(. OPT-NAME) +]));
+[+
+ ENDIF +][+
+ENDFOR +]
+ return 0;
+}
+[+ ESAC +][+
+
+DEFINE emit-usage-string +][+
+
+ (out-push-new) +][+
+ INCLUDE "usage.tlib" +][+
+ (kr-string (string-append (shell (string-append
+ "sed -e '/version information/s/ -v \\[arg\\]/ -v /' \
+ -e '/: illegal option --/d' \
+ -e 's/ --version\\[=arg\\]/ --version /' <<_EOF_\n"
+ (out-pop #t) "\n_EOF_"
+ )) "\n" )) +][+
+
+ENDDEF
+
+# end of getopt.tpl \+]
diff --git a/autoopts/tpl/gpl.lic b/autoopts/tpl/gpl.lic
new file mode 100644
index 0000000..47cdf95
--- /dev/null
+++ b/autoopts/tpl/gpl.lic
@@ -0,0 +1,20 @@
+<PFX>Copyright (C) <years> <owner>, all rights reserved.
+<PFX>This is free software. It is licensed for use, modification and
+<PFX>redistribution under the terms of the
+<PFX>GNU General Public License, version 3 or later
+<PFX> <http://gnu.org/licenses/gpl.html>
+
+<PFX><program> is free software: you can redistribute it and/or modify it
+<PFX>under the terms of the GNU General Public License as published by the
+<PFX>Free Software Foundation, either version 3 of the License, or
+<PFX>(at your option) any later version.
+<PFX>
+<PFX><program> is distributed in the hope that it will be useful, but
+<PFX>WITHOUT ANY WARRANTY; without even the implied warranty of
+<PFX>MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+<PFX>See the GNU General Public License for more details.
+<PFX>
+<PFX>You should have received a copy of the GNU General Public License along
+<PFX>with this program. If not, see <http://www.gnu.org/licenses/>.
+
+the GNU General Public License, version 3 or later
diff --git a/autoopts/tpl/gplv2.lic b/autoopts/tpl/gplv2.lic
new file mode 100644
index 0000000..31965d3
--- /dev/null
+++ b/autoopts/tpl/gplv2.lic
@@ -0,0 +1,19 @@
+<PFX>Copyright (C) <years> <owner>, all rights reserved.
+<PFX>This is free software. It is licensed for use, modification and
+<PFX>redistribution under the terms of the
+<PFX>GNU General Public License, version 2 <http://gnu.org/licenses/gpl.html>
+
+<PFX><program> is free software: you can redistribute it and/or modify it
+<PFX>under the terms of version 2 of the GNU General Public License,
+<PFX>as published by the Free Software Foundation.
+<PFX>
+<PFX><program> is distributed in the hope that it will be useful, but
+<PFX>WITHOUT ANY WARRANTY; without even the implied warranty of
+<PFX>MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+<PFX>See the GNU General Public License for more details.
+<PFX>
+<PFX>You should have received a copy of the GNU General Public License,
+<PFX>version 2, along with this program.
+<PFX>If not, see <http://www.gnu.org/licenses/>.
+
+the GNU General Public License, version 2
diff --git a/autoopts/tpl/lgpl.lic b/autoopts/tpl/lgpl.lic
new file mode 100644
index 0000000..86c7cf6
--- /dev/null
+++ b/autoopts/tpl/lgpl.lic
@@ -0,0 +1,20 @@
+<PFX>Copyright (C) <years> <owner>, all rights reserved.
+<PFX>This is free software. It is licensed for use, modification and
+<PFX>redistribution under the terms of the
+<PFX>GNU Lesser General Public License, version 3 or later
+<PFX> <http://gnu.org/licenses/lgpl.html>
+
+<PFX><program> is free software: you can redistribute it and/or modify it
+<PFX>under the terms of the GNU Lesser General Public License as published
+<PFX>by the Free Software Foundation, either version 3 of the License, or
+<PFX>(at your option) any later version.
+<PFX>
+<PFX><program> is distributed in the hope that it will be useful, but
+<PFX>WITHOUT ANY WARRANTY; without even the implied warranty of
+<PFX>MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+<PFX>See the GNU Lesser General Public License for more details.
+<PFX>
+<PFX>You should have received a copy of the GNU Lesser General Public License
+<PFX>along with this program. If not, see <http://www.gnu.org/licenses/>.";
+
+the GNU Lesser General Public License, version 3 or later
diff --git a/autoopts/tpl/man2mdoc.pl b/autoopts/tpl/man2mdoc.pl
new file mode 100755
index 0000000..64d3570
--- /dev/null
+++ b/autoopts/tpl/man2mdoc.pl
@@ -0,0 +1,279 @@
+#!/usr/bin/perl
+
+use strict;
+
+my ($taglist , $optlistold, $paraold, $parafirstval,$List,
+ $indentation,$isindentated);
+
+my ($line);
+
+$isindentated = 0; #this variable is used check the indentation
+$indentation = 0; #this variable is used to set the indentation if given
+$List = 0;
+$parafirstval = 0;
+$paraold = 0;
+$taglist = 0; ### 1 = taglist, 0 = other list types except taglist
+$optlistold = 0; ## 1 = previous list entry was there, 0 = not
+
+while ($line = <STDIN>)
+{
+ if ($line !~ /^\./ ) {
+ if ($line =~ /[\\fB|\\fI]/) {
+ MakeMacro($line);
+ print "\n";
+ next;
+ }
+
+ print $line;
+ next;
+ }
+
+ $line =~ s/^\.//;
+
+ next
+ if ($line =~ /\\"/);
+
+ $line = ParseMacro($line);
+
+ print($line)
+ if (defined $line);
+}
+
+sub ParseMacro
+{
+ my ($line) = @_;
+
+ my (@words,$retval);
+ $retval = '';
+ @words = split(/\s+/,$line);
+
+ while($_ = shift (@words)) {
+ if (/^sp$/ || /^ne$/ || /^na$/|| /^rt$/|| /^mk$/|| /^ad$/) {
+ last;
+ }
+
+ if (/^RS$/) {
+ $List = 1;
+ # this is to check whether that indentation value is given,
+ # if it is not given tha means we have to use default indentation,
+ # if it is given we need to check for that value
+ #
+ $isindentated = scalar(@words);
+
+ if ($isindentated) {
+ if ($_ = shift (@words))
+ {
+ $indentation = 1;
+ last;
+ }
+ $indentation = 0;
+ last;
+ }
+ $indentation = 1;
+ last;
+ }
+
+ if (/^IP$/ && $List) {
+ if (!$optlistold) {
+ $optlistold = 1;
+ $taglist = 1;
+
+ if ($indentation) {
+ $retval .= ".Bl -tag -offset indent -compact\n";
+ } else {
+ $retval .= ".Bl -tab -offset 0n -compact\n";
+ }
+ print $retval;
+ $words[0] =~ s/\\fB/ Nm /;
+ $words[0] =~ s/\\fI/ Ar /;
+ $words[0] =~ s/\\fR/ /g;
+
+ print ".It ".$words[0]."\n";
+ last;
+
+ }
+
+ if ($optlistold) {
+ $words[0] =~ s/\\fB/ Nm /;
+ $words[0] =~ s/\\fI/ Ar /;
+ $words[0] =~ s/\\fR/ /g;
+ print ".It ".$words[0]."\n";
+ last;
+ }
+ }
+
+ if (/^TP$/ && $List) {
+ if (!$optlistold)
+ {
+ $optlistold = 1;
+ $taglist = 1;
+
+ if ($indentation) {
+ $retval .= ".Bl -tag -offset indent -compact\n";
+ } else {
+ $retval .= ".Bl -tab -offset 0n -compact\n";
+ }
+ print $retval;
+ $retval = <DATA>;
+
+ $retval =~ s/\\fB/ Nm /;
+ $retval =~ s/\\fI/ Ar /;
+ $retval =~ s/\\fR/ /g;
+
+ print ".It ".$retval."\n";
+ last;
+ }
+
+ if ($optlistold) {
+ $retval = <DATA>;
+ $retval =~ s/\\fB/ Nm /;
+ $retval =~ s/\\fI/ Ar /;
+ $retval =~ s/\\fR/ /g;
+ print ".It ".$retval."\n";
+ last;
+ }
+ }
+
+ if (/^RE$/) {
+ $indentation = 0;
+ $optlistold = 0;
+ $isindentated = 0;
+
+ $optlistold = 0;
+
+ }
+
+ if (/^IP$/ && !$List)
+ {
+ if (!$optlistold && $words[0] =~ /^\\\(bu$/) {
+ $optlistold = 1;
+ $retval .= ".Bl -bullet"."\n";
+ print $retval;
+ print ".It \n";
+ last;
+ }
+
+
+ if (!$optlistold && $words[0] =~ /^-$/) {
+ $optlistold = 1;
+ $retval .= ".Bl -dash \n";
+ print $retval;
+ print ".It \n";
+ last;
+ }
+
+
+ if (!$optlistold && $words[0] =~ /^[1-9]\.$/) {
+ $optlistold = 1;
+ $retval .= ".Bl -enum \n";
+ print $retval;
+ print ".It \n";
+ last;
+
+ }
+
+ if (!$optlistold && $words[0] !~ /[0-9|-|(br]/) {
+ $optlistold = 1;
+ $taglist = 1;
+ $retval .= ".Bl -tag \n";
+ print $retval;
+ print ".It ".$words[0]."\n";
+ last;
+ }
+
+ if (!$optlistold) {
+ $optlistold = 1;
+ $retval .= ".Bl -item \n";
+ print $retval;
+ print ".It \n";
+ last;
+
+ }
+
+ if ($optlistold) {
+ print ".It \n";
+ last
+ }
+ }
+
+ if ($optlistold && ! /^IP$/ ) {
+ $optlistold = 0;
+ print ".El \n";
+ }
+
+ if (/^TP$/) {
+ $parafirstval = 1;
+
+ if (!$paraold) {
+ $retval .= ".Bl -tag \n";
+ print $retval;
+ print ".It ";
+ $paraold = 1;
+ last;
+ }
+
+ if ($paraold) {
+ print ".It ";
+ $paraold = 1;
+ last;
+ }
+ }
+
+ #text bolding (mdoc : .Nm ntpq) (man : .B ntpq )
+ if (/^RS$/) {
+ $List = 1;
+ }
+
+ if (/^B$/) {
+ $retval .= ".Nm ".join(' ',@words)."\n";
+ print $retval;
+ }
+
+ #text bolding ()
+ if (/\\fB/) {
+ $retval = $_;
+ $retval =~ s/[\\fB|\\fP]//g;
+ print ".Nm ".$retval."\n";
+ }
+
+ if (/\\fI/) {
+ $retval = $_;
+ $retval =~ s/[\\fI|\\fP]//g;
+ print ".Em ".$retval."\n";
+ }
+
+ if (/^I$/) {
+ $retval .= ".Em ".join(' ',@words)."\n";
+ print $retval;
+ }
+
+ if (/^PP$/) {
+ print "\n";
+ }
+
+ if (/^LP$/) {
+ print "\n";
+ }
+ }
+}
+
+sub MakeMacro
+{
+ my (@words);
+ @words = split(/\s+/,$line);
+ while($_ = shift (@words))
+ {
+ if (/\\fB/ or /\\fI/) {
+ print "\n";
+ $_ =~ s/\\fB/\.Nm /;
+ $_ =~ s/\\fI/\.Ar /;
+ $_ =~ s/\\fR//g;
+
+ print $_;
+ print"\n";
+ next;
+ }
+
+ print $_." ";
+ }
+}
diff --git a/autoopts/tpl/man2texi.sh b/autoopts/tpl/man2texi.sh
new file mode 100755
index 0000000..6578a51
--- /dev/null
+++ b/autoopts/tpl/man2texi.sh
@@ -0,0 +1,29 @@
+#! /bin/sh
+
+## man2texi.sh -- script to convert man page isms to texi-isms
+##
+## Time-stamp: "2012-02-12 09:25:29 bkorb"
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+sed \
+ -e 's;\\fB\([^\\]*\)\\fP;@var{\1};' \
+ -e 's;\\fI\([^\\]*\)\\fP;@i{\1};'
diff --git a/autoopts/tpl/mbsd.lic b/autoopts/tpl/mbsd.lic
new file mode 100644
index 0000000..2537463
--- /dev/null
+++ b/autoopts/tpl/mbsd.lic
@@ -0,0 +1,31 @@
+<PFX>Copyright (C) <years> <owner>, all rights reserved.
+<PFX>This is free software. It is licensed for use, modification and
+<PFX>redistribution under the terms of the
+<PFX>Modified (3 clause) Berkeley Software Distribution License
+<PFX> <http://www.xfree86.org/3.3.6/COPYRIGHT2.html>
+
+<PFX>Redistribution and use in source and binary forms, with or without
+<PFX>modification, are permitted provided that the following conditions
+<PFX>are met:
+<PFX>1. Redistributions of source code must retain the above copyright
+<PFX> notice, this list of conditions and the following disclaimer.
+<PFX>2. Redistributions in binary form must reproduce the above copyright
+<PFX> notice, this list of conditions and the following disclaimer in the
+<PFX> documentation and/or other materials provided with the distribution.
+<PFX>3. Neither the name ``<owner>'' nor the name of any other
+<PFX> contributor may be used to endorse or promote products derived
+<PFX> from this software without specific prior written permission.
+<PFX>
+<PFX><program> IS PROVIDED BY <owner> ``AS IS'' AND ANY EXPRESS
+<PFX>OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+<PFX>WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+<PFX>ARE DISCLAIMED. IN NO EVENT SHALL <owner> OR ANY OTHER CONTRIBUTORS
+<PFX>BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+<PFX>CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+<PFX>SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+<PFX>BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+<PFX>WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+<PFX>OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+<PFX>ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+the Modified Berkeley Software Distribution License
diff --git a/autoopts/tpl/mdoc2man.sh b/autoopts/tpl/mdoc2man.sh
new file mode 100755
index 0000000..815f716
--- /dev/null
+++ b/autoopts/tpl/mdoc2man.sh
@@ -0,0 +1,298 @@
+#! /bin/sh
+
+## mdoc2man.sh -- script to convert mdoc-isms to man-isms
+##
+## Time-stamp: "2012-04-15 07:38:27 bkorb"
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+## This "library" converts mdoc-isms into man-isms. It gets included
+## by the man page template at the point where mdoc-isms might start appearing
+## and then "emit-man-text" is invoked when all the text has been assembled.
+##
+## Display the command line prototype,
+## based only on the argument processing type.
+##
+## And run the entire output through "sed" to convert mdoc-isms
+
+# /bin/sh on Solaris is too horrible for words
+#
+case "$0" in
+/bin/sh ) test -x /usr/xpg4/bin/sh && exec /usr/xpg4/bin/sh ${1+"$@"} ;;
+esac
+
+parent_pid=$$
+prog=`basename $0 .sh`
+NmName=
+
+die() {
+ echo "$prog error: $*" >&2
+ ps -p ${AG_pid:-999999999} >/dev/null 2>&1 && \
+ kill -TERM ${AG_pid}
+ kill -TERM $parent_pid
+ sleep 1
+ kill -9 $parent_pid
+ sleep 1
+ exit 1
+}
+
+had_no_arg() {
+ die "'$1' command had no argument: <$line>"
+}
+
+# One function for each mdoc structure.
+#
+do_nest_enum() {
+ do_enum
+}
+
+do_enum() {
+ echo '.in +4'
+ local ix=1
+
+ while IFS='' read -r line
+ do
+ case "${line}" in
+ .It* ) printf '.ti -4\n%d\n\t' $ix
+ ix=`expr $ix + 1`
+ ;;
+
+ .Bl' '*enum* ) do_nest_enum ;;
+ .Bl' '*tag* ) do_nest_tag ;;
+ .Bl' '*bullet* ) do_nest_bullet ;;
+ .Bd' '* ) do_nest_block ;;
+ .Op' '* ) do_nest_optional ;;
+ .Fl' '* ) do_nest_flag ;;
+ .Ar' '* ) do_nest_arg ;;
+
+ .El* ) echo '.in -4'
+ return 0 ;;
+
+ * ) echo "$line" ;;
+ esac
+ done
+ die "EOF reached processing '.Bl -enum'"
+}
+
+do_nest_tag() {
+ echo '.in +4'
+ while IFS='' read -r line
+ do
+ case "${line}" in
+ .It* ) printf '.ti -4\n.IR '
+ echo ${line#.It} ;;
+
+ .Bl' '*enum* ) do_nest_enum ;;
+ .Bl' '*tag* ) do_nest_tag ;;
+ .Bl' '*bullet* ) do_nest_bullet ;;
+ .Bd' '* ) do_nest_block ;;
+ .Op' '* ) do_nest_optional ;;
+ .Fl' '* ) do_nest_flag ;;
+ .Ar' '* ) do_nest_arg ;;
+
+ .El* ) echo '.in -4'
+ return 0 ;;
+
+ * ) echo "$line" ;;
+ esac
+ done
+ die "EOF reached processing '.Bl -tag'"
+}
+
+do_tag() {
+ while IFS='' read -r line
+ do
+ case "${line}" in
+ .It* ) printf '.TP\n.BR '
+ echo ${line#.It} ;;
+
+ .Bl' '*enum* ) do_nest_enum ;;
+ .Bl' '*tag* ) do_nest_tag ;;
+ .Bl' '*bullet* ) do_nest_bullet ;;
+ .Bd' '* ) do_nest_block ;;
+ .Op' '* ) do_nest_optional ;;
+ .Fl' '* ) do_nest_flag ;;
+ .Ar' '* ) do_nest_arg ;;
+ .El* ) return 0 ;;
+ * ) echo "$line" ;;
+ esac
+ done
+ die "EOF reached processing '.Bl -tag'"
+}
+
+do_nest_bullet() {
+ do_bullet
+}
+
+do_bullet() {
+ echo '.in +4'
+ while IFS='' read -r line
+ do
+ case "${line}" in
+ .It* ) printf '.ti -4\n\\fB*\\fP\n'
+ echo ${line#.It}
+ ;;
+
+ .Bl' '*enum* ) do_nest_enum ;;
+ .Bl' '*tag* ) do_nest_tag ;;
+ .Bl' '*bullet* ) do_nest_bullet ;;
+ .Bd' '* ) do_nest_block ;;
+ .Op' '* ) do_nest_optional ;;
+ .Fl' '* ) do_nest_flag ;;
+ .Ar' '* ) do_nest_arg ;;
+
+ .El* ) echo '.in -4'
+ return 0 ;;
+
+ * ) echo "$line" ;;
+ esac
+ done
+ die "EOF reached processing '.Bl -bullet'"
+}
+
+do_nest_block() {
+ do_block
+}
+
+do_block() {
+ printf '.br\n.in +4\n.nf\n'
+ while IFS='' read -r line
+ do
+ case "${line}" in
+ .B* ) die ".Bx command nested within .Bd" ;;
+
+ .Ed* ) echo .in -4
+ echo .fi
+ return 0 ;;
+
+ * ) echo "$line" ;;
+ esac
+ done
+ die "EOF reached processing '.Bd'"
+}
+
+do_nest_optional() {
+ do_optional
+}
+
+do_optional() {
+ set -- $line
+ shift
+ local text='['
+ while test $# -gt 0
+ do
+ m1="$1"
+ case "X$1" in
+ 'X...' | 'X\*' )
+ text=${text}' "\fI'${1}'\fR"'
+ shift
+ ;;
+ XAr | XCm )
+ text=${text}' "\fI'${2}'\fR"'
+ shift 2 || had_no_arg "$m1"
+ ;;
+ XFl )
+ text=${text}' \fB-'${2}'\fR'
+ shift 2 || had_no_arg "$m1"
+ ;;
+ * ) text="${text} \"$2\""
+ m1="$1"
+ shift 2 || had_no_arg "$m1"
+ ;;
+ esac
+ done
+ echo "${text} ]"
+}
+
+do_nest_flag() {
+ do_flag
+}
+
+do_flag() {
+ echo ${line#.Fl}
+}
+
+do_nest_arg() {
+ do_arg
+}
+
+do_arg() {
+ line=`echo ${line#.Ar}`
+ echo "\\fI${line}\\fR"
+}
+
+do_NmName() {
+ # do we want to downcase the line first? Yes...
+ set -- `echo ${line#.Nm} | \
+ sed -e 's/-/\\-/g' \
+ -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
+ NmNameSfx=
+
+ if test $# -gt 0
+ then case "$1" in
+ [A-Za-z]* )
+ NmName=$1
+ shift
+ ;;
+ esac
+
+ test $# -gt 0 && NmNameSfx=" $*"
+ fi
+ echo ".B $NmName$NmNameSfx"
+}
+
+do_line() {
+ case "${line}" in
+ .Bl' '*enum* ) do_enum ;;
+ .Bl' '*tag* ) do_tag ;;
+ .Bl' '*bullet* ) do_bullet ;;
+ .Bd' '* ) do_block ;;
+ .Op' '* ) do_optional ;;
+ .Fl' '* ) do_flag ;;
+ .Ar' '* ) do_arg ;;
+ .Nm' '* ) do_NmName ;;
+ .Nm ) do_NmName ;;
+ * ) echo "$line" ;;
+ esac
+ return 0
+}
+
+
+
+easy_fixes='
+s/^\.Sh/.SH/
+s/^\.Ss/.SS/
+s/^\.Em/.I/
+s/^\.Pp/.PP/
+s/^.in *\\-/.in -/
+'
+
+readonly easy_fixes
+set -f
+
+{
+ while IFS='' read -r line
+ do
+ do_line
+ done
+} | sed "${easy_fixes}"
+
+exit 0
diff --git a/autoopts/tpl/mdoc2texi.pl b/autoopts/tpl/mdoc2texi.pl
new file mode 100755
index 0000000..859690e
--- /dev/null
+++ b/autoopts/tpl/mdoc2texi.pl
@@ -0,0 +1,345 @@
+#! /usr/bin/perl
+
+use strict;
+
+my ($optlist,$oldoptlist);
+my ($literal);
+my ($line);
+my ($count,$tableitemcount);
+my ($progName);
+my (@words, $retval,$columnline);
+
+$optlist = 0; ### 1 = bullet, 2 = enum, 3 = tag, 4 = item
+$oldoptlist = 0;
+
+while ($line = <STDIN>)
+{
+ if ($line !~ /^\./)
+ {
+ print $line;
+ print ".br\n"
+ if ($literal);
+ next;
+ }
+
+ next
+ if ($line =~ /^\.\\"/);
+
+ $line = ParseMacro($line);
+ print($line)
+ if (defined $line);
+}
+
+sub Handle_Bl
+{
+ if ($words[0] eq '-bullet')
+ {
+ if (!$optlist)
+ {
+ $optlist = 1; #bullet
+ $retval .= "\@itemize \@bullet\n" ;
+ print "$retval";
+ return 1;
+ }
+ else
+ {
+ $retval .= "\@itemize \@minus\n";
+ print $retval;
+ $oldoptlist = 1;
+ return 1;
+ }
+ }
+ if ($words[0] eq '-enum')
+ {
+ if (!$optlist)
+ {
+ $optlist = 2; #enum
+ $retval .= "\@enumerate\n" ;
+ print "$retval";
+ return 1;
+ }
+ else
+ {
+ $retval .= "\@enumerate\n";
+ print $retval;
+ $oldoptlist = 2;
+ return 1;
+ }
+ }
+ if ($words[0] eq '-tag')
+ {
+ $optlist = 3; #tag
+ $retval .= "\@table \@samp\n";
+ print "$retval";
+ return 1;
+ }
+ if ($words[0] eq '-column')
+ {
+ $optlist = 4; #column
+ $retval = "\@multitable \@columnfractions ";#\.20 \.20 \.20\n";
+ #print $retval;
+ $columnline = "\@headitem ";
+ #print $retval;
+ foreach(@words)
+ {
+ if (!/^"./ && !/-column/ && !/indent/ && !/-offset/)
+ {
+ $_ =~ s/\"//g;
+
+ $retval .= "\.20 ";
+ if (!$count)
+ {
+ $columnline .= $_;
+ }
+ else
+ {
+ $columnline .= " \@tab ".$_;
+ }
+ $count++;
+ }
+ }
+ print $retval."\n";
+ print $columnline;
+ return 1;
+ }
+
+ return 0;
+}
+
+sub Handle_It
+{
+ if ($optlist == 3)
+ {
+ $retval .= "\@item ".$words[0]."\n";
+ print $retval;
+ return 1;
+ }
+ elsif ($optlist == 4 )
+ {
+ if (!$tableitemcount)
+ {
+ $tableitemcount = 1;
+ return 1;
+ }
+ else
+ {
+ foreach(@words)
+ {
+ if (/^Li$/)
+ {
+ print "\n\@item ";
+ return 0;
+ }
+ elsif (/^Ta$/)
+ {
+ print "\n\@tab ";
+ return 0;
+ }
+ else
+ {
+ print $_;
+ return 0;
+ }
+ }
+ return 1;
+ }
+ }
+ else
+ {
+ print "\@item\n";
+ }
+ return 0;
+}
+
+sub Handle_El
+{
+ if ($oldoptlist)
+ {
+ if ($oldoptlist == 1)
+ {
+ $oldoptlist = 0;
+ $retval .= "\@end itemize\n";
+ print $retval;
+ }
+ elsif ($oldoptlist == 2)
+ {
+ $oldoptlist = 0;
+ $retval .= "\@end enumerate\n";
+ print $retval;
+ }
+ }
+ else
+ {
+ if ($optlist == 1)
+ {
+ $oldoptlist = 0;
+ $retval .= "\@end itemize\n";
+ print $retval;
+ }
+ elsif ($optlist == 2)
+ {
+ $oldoptlist = 0;
+ $retval .= "\@end enumerate\n";
+ print $retval;
+ }
+ elsif ($optlist = 4)
+ {
+ $count = 0;
+ $columnline = '';
+ $oldoptlist = 0;
+ $optlist = 0;
+ $tableitemcount = 0;
+ $retval .= "\n\@end multitable\n";
+ print $retval;
+ }
+ $optlist = 0;
+ }
+}
+
+sub Handle_Fl
+{
+ # .Cm is .Fl but no '-'.
+ # Usage: .Fl <argument> ...
+ #
+ # .Fl -
+ # .Fl cfv -cfv
+ # .Fl cfv . -cfv.
+ # .Cm cfv . cfv.
+ # .Fl s v t -s -v -t
+ # .Fl - , --,
+ # .Fl xyz ) , -xyz),
+ # .Fl | - |
+ #
+ my ($dash, $didOne);
+ $dash = "-"; # or empty if .Cm
+ $didOne = 0;
+
+ do {
+ if ($words[0] eq '' || $words[0] =~ /^[-\w]+$/)
+ {
+ print " " if $didOne;
+ print '@code{', $dash, $words[0], '}';
+ }
+ elsif ($words[0] eq '|')
+ {
+ print " " if $didOne;
+ print '@code{', $dash, '}', " $words[0]";
+ }
+ else
+ {
+ print "$words[0]";
+ }
+ shift @words;
+ $didOne = 1;
+ } while scalar(@words);
+ print " ";
+}
+
+sub Handle_Nm
+{
+ # Usage: .Nm [<argument>] ...
+ #
+ # .Nm groff_mdoc groff_mdoc
+ # .Nm \-mdoc -mdoc
+ # .Nm foo ) ) , foo)),
+ # .Nm : groff_mdoc:
+ #
+ if (!defined $progName)
+ {
+ if (defined $ENV{AG_DEF_PROG_NAME})
+ {
+ $progName = $ENV{AG_DEF_PROG_NAME};
+ }
+ else
+ {
+ $progName = "XXX Program Name";
+ }
+ }
+
+ if ($words[0] =~ /^[\\\w]/)
+ {
+ $progName = shift @words;
+ }
+ print '@code{', $progName, '}';
+
+ # Anything after this should be punctuation
+
+ while ($_ = shift @words)
+ {
+ print;
+ }
+ print "\n";
+}
+
+sub Handle_Xr
+{
+ # Usage: .Xr <man page name> [<section>] ...
+ # .Xr mdoc mdoc
+ # .Xr mdoc , mdoc,
+ # .Xr mdoc 7 mdoc(7)
+ # .Xr xinit 1x ; xinit(1x);
+ #
+ # Emitting things like @uref{/man.cgi/1/ls,,ls} would be OK,
+ # but we'd have to allow for changing /man.cgi/ (at least).
+ # I'm OK with:
+ # @code{mdoc}
+ # @code{mdoc},
+ # @code{mdoc(7)}
+ # @code{xinit(1x);
+ #
+ my ($xr_cmd, $xr_sec, $xr_punc);
+ if (@words == 1)
+ {
+ $xr_cmd = $words[0];
+ }
+ elsif (@words == 2)
+ {
+ $xr_cmd = shift @words;
+ if ($words[0] =~ /[[:punct:]]/)
+ {
+ $xr_punc = shift @words;
+ }
+ else
+ {
+ $xr_sec = shift @words;
+ }
+ }
+ elsif (@words == 3)
+ {
+ $xr_cmd = shift @words;
+ $xr_sec = shift @words;
+ $xr_punc = shift @words;
+ }
+ else
+ {
+ }
+
+ # HMS: do we really want 'defined' in the following tests?
+ print '@code{',"$xr_cmd" if (defined $xr_cmd);
+ print "($xr_sec)" if (defined $xr_sec);
+ print "}" if (defined $xr_cmd);
+ print "$xr_punc" if (defined $xr_punc);
+ print "\n";
+}
+
+sub ParseMacro #line
+{
+ my ($line) = @_;
+
+ @words = split(/\s+/, $line);
+ $retval = '';
+
+ # print('@words = ', scalar(@words), ': ', join(' ', @words), "\n");
+
+ while ($_ = shift @words)
+ {
+ if (/^\.Bl$/) { last if (Handle_Bl()); }
+ elsif ($optlist && /^\.It$/) { last if (Handle_It()); }
+ elsif (/^\.El$/) { Handle_El(); }
+ elsif (/^\.Fl$/) { Handle_Fl(); }
+ elsif (/^\.Nm/) { Handle_Nm(); }
+ elsif (/^\.Pp$/) { print "\n"; }
+ elsif (/^\.Xr/) { Handle_Xr(); }
+ else { print $_,"\n"; }
+ }
+}
diff --git a/autoopts/tpl/optcode.tlib b/autoopts/tpl/optcode.tlib
new file mode 100644
index 0000000..9f519ae
--- /dev/null
+++ b/autoopts/tpl/optcode.tlib
@@ -0,0 +1,819 @@
+[= autogen5 template
+
+# Time-stamp: "2012-08-11 08:31:28 bkorb"
+#
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+=][=
+
+;;;
+;;; Compute the usage line. It is complex because we are trying to
+;;; encode as much information as we can and still be comprehensible.
+;;;
+;;; The rules are: If any options have a "value" attribute, then
+;;; there are flags allowed, so include "-<flag>" on the usage line.
+;;; If the program has the "long-opts" attribute set, then we must
+;;; have "<option-name>" or "--<name>" on the line, depending on
+;;; whether or not there are flag options. If any options take
+;;; arguments, then append "[<val>]" to the flag description and
+;;; "[{=| }<val>]" to the option-name/name descriptions. We will not
+;;; worry about being correct if every option has a required argument.
+;;; Finally, if there are no minimum occurrence counts (i.e. all
+;;; options are optional), then we put square brackets around the
+;;; syntax.
+;;;
+;;; Compute the option arguments
+;;;
+(define tmp-val "")
+(if (exist? "flag.arg-type")
+ (set! tmp-val "[{=| }<val>]"))
+
+(define usage-line (string-append "USAGE: %s "
+
+ ;; If at least one option has a minimum occurrence count
+ ;; we use curly brackets around the option syntax.
+ ;;
+ (if (not (exist? "flag.min")) "[ " "{ ")
+
+ (if (exist? "flag.value")
+ (string-append "-<flag>"
+ (if (exist? "flag.arg-type") " [<val>]" "")
+ (if (exist? "long-opts") " | " "") )
+ (if (not (exist? "long-opts"))
+ (string-append "<option-name>" tmp-val) "" ) )
+
+ (if (exist? "long-opts")
+ (string-append "--<name>" tmp-val) "" )
+
+ (if (not (exist? "flag.min")) " ]..." " }...")
+) )
+
+(if (exist? "argument")
+ (set! usage-line (string-append usage-line
+
+ ;; the USAGE line plus the program name plus the argument goes
+ ;; past 80 columns, then break the line, else separate with space
+ ;;
+ (if (< 80 (+ (string-length usage-line)
+ (len "argument")
+ (string-length prog-name) ))
+ " \\\n\t\t"
+ " "
+ )
+
+ (get "argument")
+ ))
+)
+
+(define usage-text (string-append prog-name
+ (if (exist? "package")
+ (string-append " (" (get "package") ")")
+ "" )
+ " - " (get "prog-title")
+ (if (exist? "version")
+ (string-append " - Ver. " (get "version"))
+ "" )
+ "\n" usage-line "\n"
+))
+
+=][= # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+INCLUDE "optmain.tlib"
+
+=][=
+
+IF (or (= "shell-process" (get "main.main-type"))
+ (= "shell-parser" (get "main.main-type"))
+ (exist? "main.code")) =]
+#define [= (set! make-test-main #t) main-guard =] 1[=
+ENDIF
+=]
+#ifndef __doxygen__
+#define OPTION_CODE_COMPILE 1
+#include "[= (define lib-externs "") header-file=]"[=
+
+IF (== (get "main.main-type" "") "for-each")
+
+=]
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>[=
+
+ELSE
+
+=]
+#include <sys/types.h>
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>[=
+
+ (if (exist? "flag.arg-range")
+ (emit "\n#include <errno.h>"))
+
+ (if (and (exist? "resettable") (exist? "flag.open-file"))
+ (emit "
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>" )) =][=
+
+ENDIF
+
+=]
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern FILE * option_usage_fp;
+
+/* TRANSLATORS: choose the translation for option names wisely because you
+ cannot ever change your mind. */[=
+
+IF (not (exist? "copyright"))
+
+=]
+#define zCopyright NULL
+#define zLicenseDescrip NULL[=
+ELSE =][=
+ (define cright-owner (get "copyright.owner" (get "copyright.author")))
+ =][=
+ CASE (get "copyright.type") =][=
+ = note =][=
+ (set! tmp-text (get "copyright.text"))
+ (define ext-text tmp-text) =][=
+
+ ~~* . =][=
+ (define ext-text
+ (license-description (get "copyright.type")
+ prog-name "" cright-owner ) )
+
+ (set! tmp-text
+ (license-info (get "copyright.type")
+ prog-name "" cright-owner (get "copyright.date") ) )
+ =][=
+
+ * =][=
+ (set! tmp-text (sprintf
+ "Copyright (C) %s %s, all rights reserved"
+ (get "copyright.date") cright-owner ))
+ (define ext-text tmp-text) =][=
+
+ ESAC =][=
+
+(set! tmp-text (string-append version-text "\n" tmp-text))
+(string-append "\n#define zCopyright ("
+ (string-table-add-ref opt-strs tmp-text)
+ ")\n#define zLicenseDescrip ("
+
+ (if (= tmp-text ext-text)
+ "zCopyright"
+ (begin
+ (set! ext-text (string-append (shell (string-append
+ "${CLexe} --fill -I0 -W75 <<_EOF_\n" ext-text "\n_EOF_" )) "\n" ))
+
+ (string-table-add-ref opt-strs ext-text)
+ ) )
+ ")\n" ) =][=
+
+ENDIF "copyright" =][=
+
+ (define usage-proc (get "usage"))
+ (if (< 1 (string-length usage-proc))
+ (emit (string-append "\nextern tUsageProc " usage-proc ";"))
+ (set! usage-proc "optionUsage")
+ )
+
+=]
+[= INVOKE join-or-expand join-type = "include" =]
+#ifndef NULL
+# define NULL 0
+#endif
+
+/*
+ * [= prog-name =] option static const strings
+ */[=
+ (out-resume "home-list") \=][=
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+FOR flag "\n" =][=
+ (define flag-index (for-index)) =][=
+ INVOKE emit-opt-strs =][=
+
+ (if (exist? "lib-name") (begin
+ (set! lib-opt-ptr (string->c-name! (string-append
+ (get "lib-name") "_" (get "name") "_optDesc_p")))
+ (set! lib-externs (string-append lib-externs
+ (sprintf "tOptDesc * const %-16s = optDesc + %d;\n"
+ lib-opt-ptr (for-index) ) ))
+ ) ) =][=
+
+ENDFOR flag =][=
+
+INVOKE help-strs =][=
+INVOKE decl-callbacks =][=
+
+IF (exist? "version") =][=
+
+ IF (exist? "version-proc") =]
+#define VER_PROC [= (get "version-proc") =][=
+ ELIF (. make-test-main) =]
+#ifdef [=(. main-guard) =]
+# define VER_PROC optionVersionStderr
+#else
+# define VER_PROC optionPrintVersion
+#endif /* [=(. main-guard)=] */[=
+ ELSE =]
+#define VER_PROC optionPrintVersion[=
+ ENDIF make-test-main =][=
+
+ENDIF there is a version
+
+=]
+[= INVOKE emit-option-desc-table =]
+[= (. lib-externs) =]
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Define the [= (. prog-name) =] Option Environment
+ */
+#define zPROGNAME ([= (string-table-add-ref opt-strs pname-up) =])
+#define zUsageTitle ([=
+ (define homerc-ct 0)
+ (define homerc-txt "")
+ (string-table-add-ref opt-strs usage-text) =])
+[=
+FOR homerc =][=
+ (set! tmp-text (get "homerc"))
+ (if (> (string-length tmp-text)) (begin
+ (set! homerc-ct (+ 1 homerc-ct))
+ (set! homerc-txt (string-append homerc-txt
+ "\n " (string-table-add-ref opt-strs tmp-text) "," ))
+ ) ) =][=
+ENDFOR homerc =][=
+IF (> homerc-ct 0) \=]
+#define zRcName ([=
+ (set! tmp-text (if (exist? "rcfile") (get "rcfile")
+ (string-append "." pname-down "rc") ))
+ (string-table-add-ref opt-strs tmp-text) =])
+static char const * const apzHomeList[=
+ (sprintf "[%u] = {%s\n NULL };" (+ 1 homerc-ct) homerc-txt) =][=
+
+ELSE \=]
+#define zRcName NULL
+#define apzHomeList NULL[=
+ENDIF =]
+#define zBugsAddr ([=
+(out-push-new) \=]
+s/@[a-z]*{\([^{@}]*\)}/``\1''/g
+s=@<prog-name>@=[= prog-name =]=g
+/^@\(end *\)*example/d
+s/^@item *$/\
+/[=
+
+(define patch-text-sed
+ (sprintf "sed %s <<\\_EODetail_ | ${CLexe} --fill -I0 -W75\n"
+ (raw-shell-str (out-pop #t)) ) )
+
+(define patch-text (lambda (t-name)
+ (set! tmp-text (string-append "\n"
+
+ (shell (string-append
+ patch-text-sed
+ (get t-name)
+ "\n_EODetail_" ))
+ "\n" )) ))
+
+(if (exist? "copyright.eaddr")
+ (string-table-add-ref opt-strs (get "copyright.eaddr"))
+ (if (exist? "eaddr")
+ (string-table-add-ref opt-strs (get "eaddr"))
+ "NULL"
+) ) =])
+#define zExplain ([=
+
+(if (or (exist? "explain") (== (get "main.main-type") "for-each"))
+ (begin
+ (if (exist? "explain")
+ (patch-text "explain")
+ (set! tmp-text "") )
+
+ (if (== (get "main.main-type") "for-each")
+ (set! tmp-text (string-append tmp-text
+"\nIf no arguments are provided, input arguments are read from stdin,
+one per line; blank and '#'-prefixed lines are comments.
+'stdin' may not be a terminal (tty).\n" )) )
+
+ (string-table-add-ref opt-strs tmp-text)
+ )
+ "NULL"
+) =])
+#define zDetail ([=
+
+(if (exist? "detail")
+ (begin
+ (patch-text "detail")
+ (string-table-add-ref opt-strs tmp-text)
+ )
+ "NULL"
+) =])
+#define zFullVersion ([=
+
+(if (exist? "version")
+ (string-table-add-ref opt-strs version-text)
+ "NULL") =])[=
+(tpl-file-line extract-fmt)
+=][=
+
+ IF (. omit-nls-code) =]
+#define OPTPROC_BASE OPTPROC_NONE
+#define translate_option_strings NULL
+[= ELSE =]
+#if defined(ENABLE_NLS)
+# define OPTPROC_BASE OPTPROC_TRANSLATE[=
+CASE no-xlate =][=
+!E =][=
+= opt-cfg =] | OPTPROC_NXLAT_OPT_CFG[=
+= opt =] | OPTPROC_NXLAT_OPT[=
+* =][= (error "invalid value for 'no-xlate'") =][=
+ESAC no-xlate =]
+ static tOptionXlateProc translate_option_strings;
+#else
+# define OPTPROC_BASE OPTPROC_NONE
+# define translate_option_strings NULL
+#endif /* ENABLE_NLS */
+[= ENDIF no-nls =][=
+ IF (exist? "resettable") =]
+static optArgBucket_t const original_[=(. pname-down)=]_defaults[ [=
+(. UP-prefix) =]OPTION_CT ] = {
+[= (shell (string-append
+ "sed '$s@},@} @' <<\\_EOF_" default-text "\n_EOF_\n")) =]
+};
+static void * const original_[=(. pname-down)=]_cookies[ [=
+(. UP-prefix) =]OPTION_CT ] = {
+[=
+ (shell (string-append "${CLexe} -I4 -S, <<\\_EOF_\n" default-cookie "_EOF_"))
+=]
+};
+[= ENDIF resettable=]
+[= INVOKE usage-text usage-type = full \=]
+[= INVOKE usage-text usage-type = short =]
+#endif /* not defined __doxygen__ */
+[= INVOKE emit-option-callbacks =]
+/**
+ * The directory containing the data associated with [= prog-name =].
+ */
+#ifndef PKGDATADIR
+# define PKGDATADIR ""
+#endif
+
+/**
+ * Information about the person or institution that packaged [= prog-name =]
+ * for the current distribution.
+ */
+#ifndef WITH_PACKAGER
+# define [=(. pname)=]_packager_info NULL
+#else
+static char const [=(. pname)=]_packager_info[] =
+ "Packaged by " WITH_PACKAGER
+
+# ifdef WITH_PACKAGER_VERSION
+ " ("WITH_PACKAGER_VERSION")"
+# endif
+
+# ifdef WITH_PACKAGER_BUG_REPORTS
+ "\nReport [=(. pname)=] bugs to " WITH_PACKAGER_BUG_REPORTS
+# endif
+ "\n";
+#endif
+#ifndef __doxygen__
+[=
+ (out-suspend "home-list") =][=
+ (emit-string-table opt-strs) =][=
+ (out-resume "home-list") =][=
+ (out-pop #t)
+=]
+#endif /* __doxygen__ */
+/**
+ * The option definitions for [= prog-name =]. The one structure that
+ * binds them all.
+ */
+tOptions [=(. pname)=]Options = {
+ OPTIONS_STRUCT_VERSION,
+ 0, NULL, /* original argc + argv */
+ ( OPTPROC_BASE[= IF (not (exist? "allow-errors")) =]
+ + OPTPROC_ERRSTOP[= ENDIF=][=IF (exist? "flag.value") =]
+ + OPTPROC_SHORTOPT[= ENDIF=][=IF (exist? "long-opts") =]
+ + OPTPROC_LONGOPT[= ENDIF=][=IF (not (exist? "flag.min")) =]
+ + OPTPROC_NO_REQ_OPT[= ENDIF=][=IF (exist? "flag.disable") =]
+ + OPTPROC_NEGATIONS[= ENDIF=][=IF (>= number-opt-index 0) =]
+ + OPTPROC_NUM_OPT[= ENDIF=][=IF (exist? "environrc") =]
+ + OPTPROC_ENVIRON[= ENDIF=][=IF (not (exist? "argument")) =]
+ + OPTPROC_NO_ARGS[= ELIF (not (==* (get "argument") "[" )) =]
+ + OPTPROC_ARGS_REQ[= ENDIF=][=IF (exist? "reorder-args") =]
+ + OPTPROC_REORDER[= ENDIF=][=IF (exist? "gnu-usage") =]
+ + OPTPROC_GNUUSAGE[= ENDIF=][=IF (exist? "no-misuse-usage") =]
+ + OPTPROC_MISUSE[= ENDIF=][=IF (exist? "vendor-opt") =]
+ + OPTPROC_VENDOR_OPT[= ENDIF=] ),
+ 0, NULL, /* current option index, current option */
+ NULL, NULL, zPROGNAME,
+ zRcName, zCopyright, zLicenseDescrip,
+ zFullVersion, apzHomeList, zUsageTitle,
+ zExplain, zDetail, optDesc,
+ zBugsAddr, /* address to send bugs to */
+ NULL, NULL, /* extensions/saved state */
+ [= (. usage-proc) =], /* usage procedure */
+ translate_option_strings, /* translation procedure */
+ /*
+ * Indexes to special options
+ */
+ { [= (if (exist? "no-libopts") "NO_EQUIVALENT"
+ (string-append INDEX-pfx "MORE_HELP"))
+ =], /* more-help option index */
+ [=IF (and (exist? "homerc") (not (exist? "disable-save")))
+ =][= (. INDEX-pfx) =]SAVE_OPTS[=
+ ELSE =]NO_EQUIVALENT[=
+ ENDIF=], /* save option index */
+ [= (if (>= number-opt-index 0) number-opt-index "NO_EQUIVALENT")
+ =], /* '-#' option index */
+ [= (if (>= default-opt-index 0) default-opt-index "NO_EQUIVALENT")
+ =] /* index of default opt */
+ },
+ [= (. option-ct) =] /* full option count */, [=
+ (count "flag")=] /* user option count */,
+ [= (. pname) =]_full_usage, [= (. pname) =]_short_usage,
+[= IF (exist? "resettable") \=]
+ original_[=(. pname-down)=]_defaults, original_[=(. pname-down)=]_cookies,
+[= ELSE \=]
+ NULL, NULL,
+[= ENDIF \=]
+ PKGDATADIR, [=(. pname)=]_packager_info
+};
+[=
+
+FOR lib-name
+
+=]
+tOptDesc* [= (string->c-name! (get "lib-name")) =]_optDesc_p = NULL;[=
+
+ENDFOR =][=
+
+INVOKE emit-nls-code
+
+=]
+#ifdef __cplusplus
+}
+#endif[= #
+
+// = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-nls-code
+
+=][= IF (. omit-nls-code) =][= RETURN =][= ENDIF
+
+=]
+#if ENABLE_NLS
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <autoopts/usage-txt.h>
+
+static char* AO_gettext(char const* pz);
+static void coerce_it(void** s);
+
+/**
+ * AutoGen specific wrapper function for gettext.
+ * It relies on the macro _() to convert from English to the target
+ * language, then strdup-duplicates the result string.
+ *
+ * @param[in] pz the input text used as a lookup key.
+ * @returns the translated text (if there is one),
+ * or the original text (if not).
+ */
+static char *
+AO_gettext(char const* pz)
+{
+ char* pzRes;
+ if (pz == NULL)
+ return NULL;
+ pzRes = _(pz);
+ if (pzRes == pz)
+ return pzRes;
+ pzRes = strdup(pzRes);
+ if (pzRes == NULL) {
+ fputs(_("No memory for duping translated strings\n"), stderr);
+ exit([=(. nomem-exit-code)=]);
+ }
+ return pzRes;
+}
+
+static void coerce_it(void** s) { *s = AO_gettext(*s);
+}
+
+/**
+ * Translate all the translatable strings in the [=(. pname)=]Options
+ * structure defined above. This is done only once.
+ */
+static void
+translate_option_strings(void)
+{
+ tOptions * const pOpt = &[=(. pname)=]Options;
+
+ /*
+ * Guard against re-translation. It won't work. The strings will have
+ * been changed by the first pass through this code. One shot only.
+ */
+ if (option_usage_text.field_ct != 0) {
+ /*
+ * Do the translations. The first pointer follows the field count
+ * field. The field count field is the size of a pointer.
+ */
+ tOptDesc * pOD = pOpt->pOptDesc;
+ char ** ppz = (char**)(void*)&(option_usage_text);
+ int ix = option_usage_text.field_ct;
+
+ do {
+ ppz++;
+ *ppz = AO_gettext(*ppz);
+ } while (--ix > 0);
+[=
+ FOR field IN pzCopyright pzCopyNotice pzFullVersion pzUsageTitle pzExplain
+ pzDetail pzPackager =]
+ coerce_it((void*)&(pOpt->[= field =]));[=
+ ENDFOR =][=
+
+ IF (exist? "full-usage") =]
+ coerce_it((void*)&(pOpt->pzFullUsage));[=
+ ENDIF =][=
+
+ IF (exist? "short-usage") =]
+ coerce_it((void*)&(pOpt->pzShortUsage));[=
+ ENDIF =]
+ option_usage_text.field_ct = 0;
+
+ for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
+ coerce_it((void*)&(pOD->pzText));
+ }
+
+ if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
+ tOptDesc * pOD = pOpt->pOptDesc;
+ int ix;
+
+ for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {[=
+
+ FOR field IN pz_Name pz_DisableName pz_DisablePfx =][=
+
+ (sprintf "\n coerce_it((void*)&(pOD->%1$s));"
+ (get "field")) =][=
+
+ ENDFOR =]
+ }
+ /* prevent re-translation */
+ [= (. pname)
+ =]Options.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
+ }
+}
+
+#endif /* ENABLE_NLS */
+[=
+
+ENDDEF emit-nls-code
+
+=][=
+
+DEFINE emit-option-desc-table
+
+=]
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Define the [= prog-name =] Option Descriptions.
+ * This is an array of [=(. UP-prefix)=]OPTION_CT entries, one for each
+ * option that the [= prog-name =] program responds to.
+ */
+static tOptDesc optDesc[[=
+(define default-text "")
+(define default-cookie "")
+UP-prefix
+=]OPTION_CT] = {[=
+
+FOR flag "\n" =][=
+ (define flag-index (for-index)) =][=
+
+ INVOKE emit-opt-desc =][=
+
+ENDFOR flag
+
+=][=
+
+IF (exist? "resettable")
+
+=]
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* resettable */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]RESET_OPTION, [= (. VALUE-pfx) =]RESET_OPTION,
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]RESET_OPTION,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ RESET_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionResetOpt,
+ /* desc, NAME, name */ RESET_DESC, NULL, RESET_name,
+ /* disablement strs */ NULL, NULL },[=
+
+ENDIF
+
+=][=
+
+IF (exist? "version") =]
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* version */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]VERSION, [= (. VALUE-pfx) =]VERSION,
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]VERSION,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ VER_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ VER_PROC,
+ /* desc, NAME, name */ VER_DESC, NULL, VER_name,
+ /* disablement strs */ NULL, NULL },
+
+[=
+
+ENDIF =]
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* help */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]HELP, [= (. VALUE-pfx) =]HELP,
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]HELP,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doUsageOpt,
+ /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
+ /* disablement strs */ NULL, NULL }[=
+
+IF (not (exist? "no-libopts")) =],
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* more-help */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]MORE_HELP, [= (. VALUE-pfx) =]MORE_HELP,
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]MORE_HELP,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ MORE_HELP_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionPagedUsage,
+ /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
+ /* disablement strs */ NULL, NULL }[=
+
+ENDIF not have no-libopts =][=
+
+IF (exist? "usage-opt") =],
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* usage-opt */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]USAGE, [= (. VALUE-pfx) =]USAGE,
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]USAGE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doUsageOpt,
+ /* desc, NAME, name */ USAGE_DESC, NULL, USAGE_name,
+ /* disablement strs */ NULL, NULL }[=
+
+ENDIF have usage-opt =][=
+
+IF (exist? "homerc") =][=
+ IF (not (exist? "disable-save")) =],
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* save-opts */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]SAVE_OPTS, [=
+ (if (not (exist? "disable-save"))
+ (string-append VALUE-pfx "SAVE_OPTS")
+ "0") =],
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]SAVE_OPTS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
+ | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ SAVE_OPTS_DESC, NULL, SAVE_OPTS_name,
+ /* disablement strs */ NULL, NULL }[=
+
+ ENDIF disable-save does not exist =],
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* load-opts */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]LOAD_OPTS, [=
+ (if (not (exist? "disable-load"))
+ (string-append VALUE-pfx "LOAD_OPTS")
+ "0") =],
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]LOAD_OPTS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
+ | OPTST_DISABLE_IMM[=
+ (if (exist? "disable-load") "| OPTST_NO_COMMAND") =], 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionLoadOpt,
+ /* desc, NAME, name */ [=
+ (if (exist? "disable-load") "NULL, NULL, NULL"
+ "LOAD_OPTS_DESC, LOAD_OPTS_NAME, LOAD_OPTS_name")=],
+ /* disablement strs */ [=
+ (if (exist? "disable-load") "NULL, NULL"
+ "NO_LOAD_OPTS_name, LOAD_OPTS_pfx")=] }[=
+
+ENDIF have homerc =][=
+
+IF (exist? "vendor-opt") =],
+
+ { /* entry idx, value */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* vendor-opt */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ INDEX-pfx =]VENDOR_OPT, [= (. VALUE-pfx) =]VENDOR_OPT,
+ /* equiv idx value */ NO_EQUIVALENT, [= (. VALUE-pfx) =]VENDOR_OPT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
+ | OPTST_IMM | OPTST_TWICE, 0, /* both directions */
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionVendorOption,
+ /* desc, NAME, name */ VEND_DESC, NULL, VEND_name,
+ /* disablement strs */ NULL, NULL }[=
+
+ENDIF have vendor-opt =]
+};
+[=
+
+ENDDEF emit-option-desc-table
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * opthead.tpl ends here */ \=]
diff --git a/autoopts/tpl/opthead.tlib b/autoopts/tpl/opthead.tlib
new file mode 100644
index 0000000..86e87bf
--- /dev/null
+++ b/autoopts/tpl/opthead.tlib
@@ -0,0 +1,601 @@
+[= autogen5 template -*- Mode: C -*-
+
+# Time-stamp: "2012-08-11 08:56:26 bkorb"
+#
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+=]
+/*
+ * This file contains the programmatic interface to the Automated
+ * Options generated for the [=prog-name=] program.
+ * These macros are documented in the AutoGen info file in the
+ * "AutoOpts" chapter. Please refer to that doc for usage help.
+ */
+[= (make-header-guard "autoopts") =][=
+% config-header "\n#include \"%s\"" =]
+#include <autoopts/options.h>[=
+(if (or (exist? "usage-message") (exist? "die-code"))
+ "\n#include <stdarg.h>") =]
+[= IF
+
+ (define option-ct 0)
+ (define index-sep-str "")
+
+ (set! max-name-len (+ max-name-len 2))
+ (define index-fmt (sprintf "%%s\n %s%%-%ds=%%3d" INDEX-pfx max-name-len))
+
+ (define add-opt-index (lambda (opt-nm) (begin
+ (ag-fprintf 0 index-fmt index-sep-str opt-nm option-ct)
+ (set! option-ct (+ option-ct 1))
+ (set! index-sep-str ",")
+ ) ) )
+
+ (not (exist? "library")) =]
+/*
+ * Ensure that the library used for compiling this generated header is at
+ * least as new as the version current when the header template was released
+ * (not counting patch version increments). Also ensure that the oldest
+ * tolerable version is at least as old as what was current when the header
+ * template was released.
+ */
+#define AO_TEMPLATE_VERSION [=(. ao-template-ver)=]
+#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
+ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
+# error option template version mismatches autoopts/options.h header
+ Choke Me.
+#endif
+[= ENDIF not a library =]
+/*
+ * Enumeration of each option:
+ */
+typedef enum {[=
+FOR flag =][=
+ (if (exist? "documentation")
+ (set! option-ct (+ option-ct 1))
+ (add-opt-index (get-up-name "name"))
+ )
+ =][=
+ENDFOR flag =][=
+
+IF (exist? "library") =],
+ LIBRARY_OPTION_COUNT[=
+
+ELSE not exists library =][=
+
+ (if (exist? "resettable") (add-opt-index "RESET_OPTION"))
+ (if (exist? "version") (add-opt-index "VERSION"))
+ (add-opt-index "HELP")
+ (if (not (exist? "no-libopts")) (add-opt-index "MORE_HELP"))
+ (if (exist? "usage-opt") (add-opt-index "USAGE"))
+ (if (exist? "vendor-opt") (add-opt-index "VENDOR_OPT"))
+
+ (if (exist? "homerc") (begin
+ (if (not (exist? "disable-save")) (add-opt-index "SAVE_OPTS"))
+ (add-opt-index "LOAD_OPTS")
+ ) ) =][=
+ENDIF not exist library =]
+} te[=(. Cap-prefix)=]OptIndex;
+
+#define [=(. UP-prefix)=]OPTION_CT [= (. option-ct) =][=
+IF (exist? "version") =]
+#define [=(. pname-up)=]_VERSION [=(c-string (get "version"))=]
+#define [=(. pname-up)=]_FULL_VERSION [=(c-string version-text) =][=
+ENDIF (exist? version) =]
+
+/*
+ * Interface defines for all options. Replace "n" with the UPPER_CASED
+ * option name (as in the te[=(. Cap-prefix)=]OptIndex enumeration above).
+ * e.g. HAVE_[=(. UP-prefix)=]OPT([= (get-up-name "flag[].name") =])
+ */[=
+
+IF (exist? "library")
+
+=]
+extern tOptDesc * const [= (. lib-opt-ptr) =];[=
+
+ENDIF is a library =][=
+
+CASE guard-option-names =][=
+!E =][=
+ (set! tmp-val (string-append "[" INDEX-pfx "## n]"))
+ =][=
+
+= full-enum =][=
+ (set! tmp-val "[n]") =][=
+
+=* no-warn =][=
+ (set! tmp-val (string-append "[" INDEX-pfx "## n]"))
+ =][=
+
+* =][=
+ (set! tmp-val (string-append "[" INDEX-pfx "## n]"))
+ =][=
+
+ESAC =][=
+
+(if (exist? "library")
+ (set! tmp-val (string-append "(" lib-opt-ptr tmp-val ")"))
+ (set! tmp-val (string-append "(" pname "Options.pOptDesc" tmp-val ")")) )
+
+(ag-fprintf 0 "\n#define %8sDESC(n) " UP-prefix) tmp-val
+
+=][=
+
+IF (> 1 (string-length UP-prefix))
+
+=]
+#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
+#define OPT_ARG(n) (DESC(n).optArg.argString)
+#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
+#define COUNT_OPT(n) (DESC(n).optOccCt)
+#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
+#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
+#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
+#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
+#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
+#define CLEAR_OPT(n) STMTS( \
+ DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
+ if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
+ DESC(n).fOptState |= OPTST_DISABLED; \
+ DESC(n).optCookie = NULL )[=
+
+ELSE we have a prefix:
+
+=][= (sprintf "
+#define HAVE_%1$sOPT(n) (! UNUSED_OPT(& %1$sDESC(n)))
+#define %1$sOPT_ARG(n) (%1$sDESC(n).optArg.argString)
+#define STATE_%1$sOPT(n) (%1$sDESC(n).fOptState & OPTST_SET_MASK)
+#define COUNT_%1$sOPT(n) (%1$sDESC(n).optOccCt)
+#define ISSEL_%1$sOPT(n) (SELECTED_OPT(&%1$sDESC(n)))
+#define ISUNUSED_%1$sOPT(n) (UNUSED_OPT(& %1$sDESC(n)))
+#define ENABLED_%1$sOPT(n) (! DISABLED_OPT(& %1$sDESC(n)))
+#define STACKCT_%1$sOPT(n) (((tArgList*)(%1$sDESC(n).optCookie))->useCt)
+#define STACKLST_%1$sOPT(n) (((tArgList*)(%1$sDESC(n).optCookie))->apzArgs)
+#define CLEAR_%1$sOPT(n) STMTS( \\
+ %1$sDESC(n).fOptState &= OPTST_PERSISTENT_MASK; \\
+ if ((%1$sDESC(n).fOptState & OPTST_INITENABLED) == 0) \\
+ %1$sDESC(n).fOptState |= OPTST_DISABLED; \\
+ %1$sDESC(n).optCookie = NULL )"
+
+ UP-prefix ) =][=
+
+ENDIF prefix/not =]
+
+/* * * * * *
+ *
+ * Enumeration of [= prog-name =] exit codes
+ */
+typedef enum {[=
+ #/*
+ ;; Assume no definitions for exit-name[0] and [1]. If not true,
+ ;; then change the strings associated with the ones defined to the
+ ;; specified name. If the assumption is correct, we'll need to
+ ;; emit the a default value into the enumeration..
+ =][= ;; */
+ (set! tmp-val "")
+ (define need-ex-noinput (exist? "homerc"))
+ (define need-ex-software #t)
+
+ (define succ-exit-code (string-append pname-up "_EXIT_SUCCESS"))
+ (if (exist? "exit-name[0]")
+ (set! succ-exit-code (string-append
+ pname-up "_EXIT_" (get-up-name "exit-name[0]") ))
+
+ (set! tmp-val (string-append
+ "\n " pname-up "_EXIT_SUCCESS = 0" ))
+ )
+
+ (define fail-exit-code (string-append pname-up "_EXIT_FAILURE"))
+ (if (exist? "exit-name[1]")
+ (set! fail-exit-code (string-append
+ pname-up "_EXIT_" (get-up-name "exit-name[1]") ))
+
+ (set! tmp-val (string-append tmp-val
+ (if (> (string-length tmp-val) 1) "," "")
+ "\n " pname-up "_EXIT_FAILURE = 1" ))
+ )
+
+ (define nomem-exit-code
+ (if (exist? "nomem-fail-code")
+ (string-append pname-up "_EXIT_" (get-up-name "nomem-fail-code"))
+ fail-exit-code))
+
+ (define file-fail-exit-code
+ (if (exist? "file-fail-code")
+ (string-append pname-up "_EXIT_" (get-up-name "file-fail-code"))
+ fail-exit-code))
+
+ (if (and (exist? "exit-name") (> (string-length tmp-val) 1))
+ (set! tmp-val (string-append tmp-val ",")) )
+
+ tmp-val =][=
+
+ FOR exit-name "," =]
+ [=
+ (if (= (for-index) 66)
+ (set! need-ex-noinput #f)
+ (if (= (for-index) 70)
+ (set! need-ex-software #f) ))
+
+ pname-up =]_EXIT_[= (get-up-name "exit-name")
+ =] = [= (for-index) =][=
+ ENDFOR =][=
+ (if need-ex-noinput
+ (ag-fprintf 0 ",\n %s_EXIT_NO_CONFIG_INPUT = 66" pname-up))
+ (if need-ex-software
+ (ag-fprintf 0 ",\n %s_EXIT_LIBOPTS_FAILURE = 70" pname-up))
+=]
+} [= (. pname-down) =]_exit_code_t;[=
+
+CASE guard-option-names =][=
+!E =][=
+= full-enum =][=
+
+
+=* no-warn =]
+/*
+ * Make sure there are no #define name conflicts with the option names
+ */[=
+ FOR flag =]
+#undef [= (get-up-name "name") =][=
+ ENDFOR flag =][=
+
+* =][=
+
+ (define undef-list "\n#else /* NO_OPTION_NAME_WARNINGS */")
+ (define conf-warn-fmt (string-append
+ "\n# ifdef %1$s"
+ "\n# warning undefining %1$s due to option name conflict"
+ "\n# undef %1$s"
+ "\n# endif" ))
+
+=]
+/*
+ * Make sure there are no #define name conflicts with the option names
+ */
+#ifndef NO_OPTION_NAME_WARNINGS[=
+ FOR flag =][=
+
+ (set! opt-name (get-up-name "name"))
+ (set! undef-list (string-append undef-list "\n# undef " opt-name))
+ (sprintf conf-warn-fmt opt-name)
+ =][=
+
+ ENDFOR flag =][=
+
+ (. undef-list)=]
+#endif /* NO_OPTION_NAME_WARNINGS */
+[=
+
+ESAC on guard-option-names
+
+=]
+/* * * * * *
+ *
+ * Interface defines for specific options.
+ */[=
+
+FOR flag =][=
+ (define flag-index (for-index)) =][=
+
+ INVOKE save-name-morphs =][=
+
+ IF (set! opt-name (string-append OPT-pfx UP-name))
+ (set! descriptor (string-append UP-prefix "DESC(" UP-name ")" ))
+
+ (exist? "documentation")
+
+ =][=
+ IF (hash-ref have-cb-procs flg-name)
+=]
+#define SET_[= (string-append OPT-pfx UP-name) =] STMTS( \
+ (*([=(. descriptor)=].pOptProc))(&[=(. pname)=]Options, \
+ [=(. pname)=]Options.pOptDesc + [=(for-index)=])[=
+
+ ENDIF =][=
+ ELSE =][=
+ INVOKE option-defines =][=
+ ENDIF =][=
+ENDFOR flag
+
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+Autoopts maintained option values.
+
+If *any* option flag value is specified,
+then we provide flag characters for our options.
+Otherwise, we will use the INDEX_* values for the option value.
+
+There are no documentation strings because these defines
+are used identically to the user-generated VALUE defines.
+
+=][=
+
+DEFINE set-std-value =]
+#define [= (sprintf "%-23s " (string-append VALUE-pfx (get "val-UPNAME"))) =][=
+ CASE (define tmp-val (get "val-name"))
+ (get tmp-val) =][=
+ == "" =][=
+
+ (if (exist? tmp-val)
+ (if (not (exist? "long-opts"))
+ (error (sprintf "'%s' may not be empty" tmp-val))
+ (string-append INDEX-pfx (get "val-UPNAME")) )
+ (sprintf "'%s'" (get "std-value"))
+ ) =][=
+
+ == "'" =]'\''[=
+ ~~ . =]'[=(get tmp-val)=]'[=
+ * =][=(error "value (flag) codes must be single characters") =][=
+ ESAC =][=
+ENDDEF set-std-value =][=
+
+IF (exist? "flag.value") =][=
+
+ INVOKE set-std-value
+ val-name = "help-value"
+ val-UPNAME = "HELP"
+ std-value = "?" =][=
+
+ IF (not (exist? "no-libopts")) =][=
+ INVOKE set-std-value
+ val-name = "more-help-value"
+ val-UPNAME = "MORE_HELP"
+ std-value = "!" =][=
+ ENDIF don't have no-libopts ' =][=
+
+ IF (exist? "resettable") =][=
+ INVOKE set-std-value
+ val-name = "reset-value"
+ val-UPNAME = "RESET_OPTION"
+ std-value = "R" =][=
+ ENDIF have "reset" =][=
+
+ IF (exist? "version") =][=
+ INVOKE set-std-value
+ val-name = "version-value"
+ val-UPNAME = "VERSION"
+ std-value = "v" =][=
+ ENDIF have "version" =][=
+
+ IF (exist? "usage-opt") =][=
+ INVOKE set-std-value
+ val-name = "usage-value"
+ val-UPNAME = "USAGE"
+ std-value = "u" =][=
+ ENDIF have "usage-opt" =][=
+
+ IF (exist? "vendor-opt") =][=
+ INVOKE set-std-value
+ val-name = "vendor-value"
+ val-UPNAME = "VENDOR_OPT"
+ std-value = "W" =][=
+ ENDIF have "vendor-opt" =][=
+
+ IF (exist? "homerc") =][=
+
+ IF (not (exist? "disable-save")) =][=
+ INVOKE set-std-value
+ val-name = "save-opts-value"
+ val-UPNAME = "SAVE_OPTS"
+ std-value = ">" =][=
+ ELSE =]
+#define [= (sprintf "%-23s 0" (string-append VALUE-pfx "SAVE_OPTS"))
+ =][=
+ ENDIF =][=
+ IF (not (exist? "disable-load")) =][=
+ INVOKE set-std-value
+ val-name = "load-opts-value"
+ val-UPNAME = "LOAD_OPTS"
+ std-value = "<" =][=
+ ELSE =]
+#define [= (sprintf "%-23s 0" (string-append VALUE-pfx "LOAD_OPTS"))
+ =][=
+ ENDIF =][=
+ ENDIF have "homerc" =][=
+
+ELSE NO "flag.value" =]
+[=
+(set! index-fmt (string-append
+ "\n#define " VALUE-pfx "%1$-16s " INDEX-pfx "%1$s"))
+(define std-vals (lambda (std-nm)
+ (ag-fprintf 0 index-fmt std-nm) ))
+
+(if (exist? "resettable") (std-vals "RESET_OPTION"))
+(if (exist? "version") (std-vals "VERSION"))
+(std-vals "HELP")
+(if (not (exist? "no-libopts")) (std-vals "MORE_HELP"))
+(if (exist? "usage-opt") (std-vals "USAGE"))
+(if (exist? "homerc") (begin
+ (if (not (exist? "disable-save"))
+ (std-vals "SAVE_OPTS"))
+ (if (not (exist? "disable-load"))
+ (std-vals "LOAD_OPTS"))
+) ) =][=
+
+ENDIF have flag.value/not =][=
+
+IF (and (exist? "homerc") (not (exist? "disable-save")))
+
+=]
+#define SET_[=(. OPT-pfx)=]SAVE_OPTS(a) STMTS( \
+ [=(. UP-prefix)=]DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
+ [=(. UP-prefix)=]DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
+ [=(. UP-prefix)=]DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )[=
+ENDIF
+=][=
+
+IF (not (exist? "library"))
+
+=]
+/*
+ * Interface defines not associated with particular options
+ */
+#define ERRSKIP_[=
+
+ IF (> 1 (string-length UP-prefix))
+
+=][= (sprintf "OPTERR STMTS(%1$sOptions.fOptSet &= ~OPTPROC_ERRSTOP)
+#define ERRSTOP_OPTERR STMTS(%1$sOptions.fOptSet |= OPTPROC_ERRSTOP)
+#define RESTART_OPT(n) STMTS( \\
+ %1$sOptions.curOptIdx = (n); \\
+ %1$sOptions.pzCurOpt = NULL)
+#define START_OPT RESTART_OPT(1)
+#define USAGE(c) (*%1$sOptions.pUsageProc)(&%1$sOptions, c)"
+ pname ) =][=
+
+ ELSE we have a prefix
+
+=][= (sprintf "%1$sOPTERR STMTS(%2$sOptions.fOptSet &= ~OPTPROC_ERRSTOP)
+#define ERRSTOP_%1$sOPTERR STMTS(%2$sOptions.fOptSet |= OPTPROC_ERRSTOP)
+#define RESTART_%1$sOPT(n) STMTS( \\
+ %2$sOptions.curOptIdx = (n); \\
+ %2$sOptions.pzCurOpt = NULL )
+#define START_%1$sOPT RESTART_%1$sOPT(1)
+#define %1$sUSAGE(c) (*%2$sOptions.pUsageProc)(&%2$sOptions, c)"
+
+ UP-prefix pname ) =][=
+
+ ENDIF have/don't have prefix ' =][=
+
+ENDIF is not a library
+
+* * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+=][=
+(tpl-file-line extract-fmt)
+=][=
+
+IF (not (exist? "library"))
+
+=]
+#ifdef __cplusplus
+extern "C" {
+#endif
+[=INVOKE join-or-expand join-type = "export" =][=
+
+ IF (exist? "usage-message") =]
+extern void [=(. lc-prefix)=]vusage_message(char const * fmt, va_list ap);
+extern void [=(. lc-prefix)=]usage_message(char const * fmt, ...);
+[=ENDIF have usage-message =]
+
+/* * * * * *
+ *
+ * Declare the [=prog-name=] option descriptor.
+ */
+extern tOptions [=(. pname)=]Options;[=
+
+ (if (> (string-length added-hdr) 0)
+ (begin
+ (emit "\n")
+ (shellf "sort -u <<_EOF_\n%s_EOF_" added-hdr)
+ ) ) =][=
+
+ IF (not omit-nls-code) =]
+
+#if defined(ENABLE_NLS)
+# ifndef _
+# include <stdio.h>
+# ifndef HAVE_GETTEXT
+ extern char * gettext(char const *);
+# else
+# include <libintl.h>
+# endif
+
+static inline char* aoGetsText(char const* pz) {
+ if (pz == NULL) return NULL;
+ return (char*)gettext(pz);
+}
+# define _(s) aoGetsText(s)
+# endif /* _() */
+
+# define OPT_NO_XLAT_CFG_NAMES STMTS([=(. pname)=]Options.fOptSet |= \
+ OPTPROC_NXLAT_OPT_CFG;)
+# define OPT_NO_XLAT_OPT_NAMES STMTS([=(. pname)=]Options.fOptSet |= \
+ OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
+
+# define OPT_XLAT_CFG_NAMES STMTS([=(. pname)=]Options.fOptSet &= \
+ ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
+# define OPT_XLAT_OPT_NAMES STMTS([=(. pname)=]Options.fOptSet &= \
+ ~OPTPROC_NXLAT_OPT;)
+
+#else /* ENABLE_NLS */[=
+ ENDIF no-nls-support =]
+# define OPT_NO_XLAT_CFG_NAMES
+# define OPT_NO_XLAT_OPT_NAMES
+
+# define OPT_XLAT_CFG_NAMES
+# define OPT_XLAT_OPT_NAMES
+
+# ifndef _
+# define _(_s) _s
+# endif[=
+
+(if (not omit-nls-code) (emit "\n#endif /* ENABLE_NLS */")) =][=
+
+IF (exist? "die-code") =]
+
+extern void [=(. lc-prefix)=]vdie( int exit_code, char const * fmt, va_list);
+extern void [=(. lc-prefix)=]die( int exit_code, char const * fmt, ...);
+extern void [=(. lc-prefix)
+=]fserr(int exit_code, char const * op, char const * fname);[=
+
+ENDIF die-code exists =]
+
+#ifdef __cplusplus
+}
+#endif[=
+
+ENDIF this is not a lib
+
+=]
+#endif /* [=(. header-guard)=] */[=
+DEFINE join-or-expand =][=
+ IF (define join-type (get "join-type"))
+ (exist? join-type) \=]
+/*
+ * global [=(string-append join-type (if (==* join-type "inc") "d" "ed"))
+ =] definitions
+ */
+[=
+ IF
+ (set! tmp-text (join "\n\n" (stack join-type)))
+ (~* (get join-type) "^[^a-z0-9_]{2,}[ \t]+autogen5[ \t]+template")
+ =][=
+ INCLUDE (begin
+ (set! tmp-val (string-append tmp-dir "/" join-type "-text"))
+ (out-push-new tmp-val)
+ (emit tmp-text)
+ (out-pop)
+ tmp-val
+ ) =][=
+ ELSE text is not template =][=
+ (. tmp-text) =][=
+ ENDIF text is template =]
+[=ENDIF join-type =][=
+ENDDEF join-or-expand
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * opthead.tpl ends here */=]
diff --git a/autoopts/tpl/options.tpl b/autoopts/tpl/options.tpl
new file mode 100644
index 0000000..41d6291
--- /dev/null
+++ b/autoopts/tpl/options.tpl
@@ -0,0 +1,57 @@
+[= Autogen5 Template -*- Mode: scheme -*-
+
+h
+c
+
+# Time-stamp: "2011-01-28 10:30:50 bkorb"
+
+# This file contains the templates used to generate the
+# option descriptions for client programs, and it declares
+# the macros used in the templates.
+
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+=][= (dne " * " "/* ") =][=
+
+CASE (suffix) =][=
+
+== h =][=
+
+ INCLUDE "optlib.tlib" =][=
+ INVOKE init-and-validate =][=
+ INVOKE option-copyright =][=
+ INCLUDE "opthead.tlib" =][=
+
+== c =][=
+
+ (if (exist? "library")
+ (out-delete)) =][=
+
+ INVOKE option-copyright =][=
+ INCLUDE "optcode.tlib" =][=
+
+ (if (exist? "flag.extract-code")
+ (shellf "test -f %1$s.c && rm -f %1$s.c.save" (base-name))) =][=
+
+ESAC =]
+/* [= (out-name) =] ends here */[=
+
+# options.tpl ends here =]
diff --git a/autoopts/tpl/optlib.tlib b/autoopts/tpl/optlib.tlib
new file mode 100644
index 0000000..9d72c15
--- /dev/null
+++ b/autoopts/tpl/optlib.tlib
@@ -0,0 +1,1260 @@
+[= AutoGen5 Template Library -*- Mode: scheme -*-
+
+# Time-stamp: "2012-08-11 08:14:10 bkorb"
+#
+# This file is part of AutoOpts, a companion to AutoGen.
+# AutoOpts is free software.
+# AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+#
+# AutoOpts is available under any one of two licenses. The license
+# in use must be one of these two and the choice is under the control
+# of the user of the license.
+#
+# The GNU Lesser General Public License, version 3 or later
+# See the files "COPYING.lgplv3" and "COPYING.gplv3"
+#
+# The Modified Berkeley Software Distribution License
+# See the file "COPYING.mbsd"
+#
+# These files have the following md5sums:
+#
+# 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+# 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+# 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+=][=
+
+INCLUDE "tpl-config.tlib" =][=
+
+DEFINE init-and-validate =][=
+
+(if (not (exist? "flag.name"))
+ (error "No options have been defined" ))
+
+(if (> (count "flag") 100)
+ (error (sprintf "%d options are too many - limit of 100"
+ (count "flag")) ))
+
+(if (not (and (exist? "prog-name") (exist? "prog-title")))
+ (error "prog-name and prog-title are required"))
+(define prog-name (get "prog-name"))
+(if (> (string-length prog-name) 16)
+ (error (sprintf "prog-name limited to 16 characters: %s"
+ prog-name)) )
+
+ ;;# START-BUILDTREE-ISMS
+ ;;
+ (shell "CLexe=${AGexe%/agen5/*}/columns/columns
+ test -x \"${CLexe}\" || {
+ CLexe=${AGexe%/autogen}/columns
+ test -x \"${CLexe}\" || die 'columns program is not findable'
+ }")
+
+=][= # END-BUILDTREE-ISMS
+
+ (shell "CLexe=${AGexe%/autogen}/columns")
+
+# END-INSTALL-ONLY-CODE =][=
+
+(make-tmp-dir)
+(define get-opt-value (lambda (val)
+ (if (<= val 32) val (+ val 96)) ))
+
+(define have-proc #f)
+(define proc-name "")
+(define test-name "")
+(define tmp-text "")
+(define is-extern #t)
+(define is-lib-cb #f)
+(define have-cb-procs (make-hash-table 31))
+(define is-ext-cb-proc (make-hash-table 31))
+(define is-lib-cb-proc (make-hash-table 31))
+(define cb-proc-name (make-hash-table 31))
+(define test-proc-name (make-hash-table 31))
+(define disable-name (make-hash-table 31))
+(define disable-prefix (make-hash-table 31))
+(define ifdef-ed (make-hash-table 31))
+(define tmp-ct 0)
+(define extract-fmt "\n/* extracted from %s near line %d */\n")
+(define make-callback-procs #f)
+(define omit-nls-code (~ (get "no-xlate") "(any|no)thing"))
+
+(define need-stacking (lambda()
+ (if (not (exist? "max"))
+ #f
+ (> (string->number (get "max")) 1)
+) ) )
+
+(define get-text (lambda (nm) (shell (string-append
+ "{ sed 's/@[a-z]*{\\([^}]*\\)}/\\1/g' | "
+ "${CLexe} --fill -I0 -W72\n}<<\\_EODesc_\n"
+ (get nm) "\n_EODesc_" ))))
+
+(define do-ifdefs (or (exist? "flag.ifdef") (exist? "flag.ifndef")))
+
+;; IF long options are disallowed
+;; AND at least one flag character (value) is supplied
+;; THEN every option must have a 'value' attribute
+;;
+(define flag-options-only
+ (and (not (exist? "long-opts")) (exist? "flag.value")))
+
+(if (exist? "vendor-opt") (begin
+ ;; except the 'vendor-opt' attribute allows long options that do
+ ;; not have flag values, but it conflicts with 'long-opts' and requires
+ ;; at least one 'flag.value'
+ ;;
+ (if (or (exist? "long-opts") (not (exist? "flag.value")))
+ (error "'vendor-opt' conflicts with 'long-opts' and requires flag values")
+ (set! flag-options-only #f))
+ (if (exist? "library")
+ (error "'vendor-opt' conflicts with 'library'"))
+) )
+
+(if (and (exist? "reorder-args") (not (exist? "argument")) )
+ (error
+ "Reordering arguments requires operands (the 'argument' attribute)"))
+
+(if (and flag-options-only (exist? "flag.disable"))
+ (error "options can be disabled only with a long option name"))
+
+(if (exist? "flag.extract-code")
+ (shellf "f=%s.c ; test -s $f && mv -f $f $f.save"
+ (base-name)))
+
+(if (and (exist? "usage") (exist? "gnu-usage"))
+ (error "'usage' and 'gnu-usage' conflict." ))
+
+(if (> (count "flag.default") 1)
+ (error "Too many default options"))
+
+(if (exist? "library") (begin
+ (if (not (exist? "flag[0].documentation")) (error
+ "The first option of a library must be a documentation option"))
+ (if (not (exist? "flag[0].lib-name"))
+ (error "The first option of a library must specify 'lib-name'"))
+ (if (< 1 (count "flag.lib-name"))
+ (error "a library must only have one 'flag.lib-name'"))
+) )
+
+;; Establish a number of variations on the spelling of the
+;; program name. Use these Scheme defined values throughout.
+;;
+(define pname (get-c-name "prog-name"))
+(define pname-cap (string-capitalize pname))
+(define pname-up (string-upcase pname))
+(define pname-down (string-downcase pname))
+(define main-guard (string-append "TEST_" pname-up "_OPTS" ))
+(define number-opt-index -1)
+(define default-opt-index -1)
+(define make-test-main (if (exist? "test-main") #t
+ (string? (getenv "TEST_MAIN")) ))
+
+(define descriptor "")
+(define opt-name "")
+(define tmp-val "")
+(define added-hdr "")
+
+(define flg-name "")
+(define UP-name "")
+(define cap-name "")
+(define low-name "")
+(define enum-pfx "")
+
+(define set-flag-names (lambda () (begin
+ (set! flg-name (get "name"))
+ (set! UP-name (get-up-name "name"))
+ (set! cap-name (string-capitalize UP-name ))
+ (set! low-name (string-downcase UP-name ))
+ (set! enum-pfx (if (exist? ".prefix-enum")
+ (string-append (get-up-name "prefix-enum") "_")
+ (string-append UP-prefix UP-name "_") ))
+) ) )
+
+(define UP-prefix "")
+(define lc-prefix "")
+(define Cap-prefix "")
+(define OPT-pfx "OPT_")
+(define INDEX-pfx "INDEX_OPT_")
+(define VALUE-pfx "VALUE_OPT_")
+
+(if (exist? "prefix")
+ (begin
+ (set! UP-prefix (string-append (get-up-name "prefix") "_"))
+ (set! lc-prefix (string-downcase UP-prefix))
+ (set! Cap-prefix (string-capitalize UP-prefix))
+ (set! OPT-pfx (string-append UP-prefix "OPT_"))
+ (set! INDEX-pfx (string-append "INDEX_" OPT-pfx))
+ (set! VALUE-pfx (string-append "VALUE_" OPT-pfx))
+ ) )
+
+(define cap-c-name (lambda (ag-name)
+ (string-capitalize! (get-c-name ag-name)) ))
+
+(define index-name (lambda (i-name)
+ (string-append INDEX-pfx (get-up-name i-name)) ))
+
+(define optname-from "A-Z_^")
+(define optname-to "a-z--")
+(if (exist? "preserve-case")
+ (begin
+ (set! optname-from "_^")
+ (set! optname-to "--")
+) )
+
+(define version-text (string-append prog-name
+ (if (exist? "package")
+ (string-append " (" (get "package") ")")
+ "" )
+ (if (exist? "version")
+ (string-append " " (get "version"))
+ "" ) ))
+
+(if (exist? "flag.value")
+ (shellf "
+
+ list=`echo '%s' | sort`
+ ulst=`echo \"${list}\" | sort -u`
+ test `echo \"${ulst}\" | wc -l` -ne %d && {
+ echo \"${list}\" > ${tmp_dir}/sort
+ echo \"${ulst}\" > ${tmp_dir}/uniq
+ df=`diff ${tmp_dir}/sort ${tmp_dir}/uniq | sed -n 's/< *//p'`
+ die 'duplicate option value characters:' ${df}
+ }"
+
+ (join "\n" (stack "flag.value"))
+ (count "flag.value") ) )
+
+(define temp-idx 0)
+(define no-flag-ct 0)
+(define lib-opt-ptr "")
+(define max-name-len 10) =][=
+
+
+FOR flag =][=
+
+ (set! tmp-ct (len "name"))
+ (if (> tmp-ct 32)
+ (error (sprintf "Option %d name exceeds 32 characters: %s"
+ (for-index) (get "name")) ))
+ (if (> tmp-ct max-name-len)
+ (set! max-name-len tmp-ct))
+
+ (if (exist? "value")
+ (if (< 1 (count "value"))
+ (error (sprintf "Option %s has too many `value's" (get "name"))))
+ (set! no-flag-ct (+ 1 no-flag-ct))
+ )
+
+ (if (and flag-options-only
+ (not (exist? "documentation"))
+ (not (exist? "value")))
+ (error (sprintf "Option %s needs a `value' attribute" (get "name"))))
+
+ (set! tmp-val
+ (+ (if (exist? "call-proc") 1 0)
+ (if (exist? "extract-code") 1 0)
+ (if (exist? "flag-proc") 1 0)
+ (if (exist? "unstack-arg") 1 0)
+ (if (exist? "stack-arg") 1 0) ))
+
+ ;; IF there is one of the above callback proc types AND there is an
+ ;; option argument of type non-string, THEN oops. Conflict.
+ ;;
+ (if (and (> tmp-val 0) (exist? "arg-type")
+ (not (=* (get "arg-type") "str")) )
+ (error (sprintf
+ "Option %s has a %s argument and a callback procedure"
+ (get "name") (get "arg-type") )
+ ) )
+
+ ;; Count up the ways a callback procedure was specified. Must be 0 or 1
+ ;;
+ (if (< 1 (+ (if (exist? "arg-range") 1 0)
+ (if (~* (get "arg-type") "key|set") 1 0) tmp-val))
+ (error (sprintf "Option %s has multiple callback specifications"
+ (get "name")) ))
+
+ (if (< 1 (+ (count "ifdef") (count "ifndef") ))
+ (error (sprintf "Option %s has multiple 'ifdef-es'" (get "name") )) )
+
+ (if (and (exist? "stack-arg") (not (exist? "arg-type")))
+ (error (sprintf "Option %s has stacked args, but no arg-type"
+ (get "name"))))
+
+ (if (and (exist? "min") (exist? "must-set"))
+ (error (sprintf "Option %s has both 'min' and 'must-set' attributes"
+ (get "name"))))
+
+ (if (and (exist? "omitted-usage")
+ (not (exist? "ifdef"))
+ (not (exist? "ifndef")) )
+ (error (string-append "Option " (get "name") " has 'omitted-usage' "
+ "but neither 'ifdef' nor 'ifndef'" )) )
+
+ (if (and (exist? "equivalence")
+ (exist? "aliases"))
+ (error (string-append "Option " (get "name") " has both "
+ "'equivalence' and 'aliases'" )) )
+
+ (if (exist? "lib-name")
+ (set! lib-opt-ptr (string->c-name! (string-append
+ (get "lib-name") "_" (get "name") "_optDesc_p"))) )
+=][=
+
+ENDFOR flag
+
+=][=
+(if (and (exist? "vendor-opt") (= no-flag-ct 0))
+ (error "'vendor-opt' requires that there be options without flag values"))
+
+(define opt-strs (string-append pname "_opt_strs"))
+(string-table-new opt-strs)
+(out-push-new) (out-suspend "home-list")
+=][=
+
+ENDDEF init-and-validate
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE save-name-morphs
+
+ Save the various flag name morphs into hash tables
+
+ Every option descriptor has a pointer to a handler procedure. That
+ pointer may be NULL. We generate a procedure for keyword,
+ set-membership and range checked options. "optionStackArg" is called
+ if "stack-arg" is specified. The specified procedure is called if
+ "call-proc" is specified. Finally, we insert the specified code for
+ options with "flag-code" or "extract-code" attributes.
+
+ This all changes, however, if "make-test-main" is set. It is set if
+ either "test-main" is specified as a program/global attribute, or if
+ the TEST_MAIN environment variable is defined. This should be set
+ if either the program is intended to digest options for an incorporating
+ shell script, or else if the user wants a quick program to show off the
+ usage text and command line parsing. For that environment, all callbacks
+ are disabled except "optionStackArg" for stacked arguments and the
+ keyword set membership options.
+
+ =][=
+
+ IF
+
+ (set-flag-names)
+ (hash-create-handle! ifdef-ed flg-name
+ (and do-ifdefs (or (exist? "ifdef") (exist? "ifndef"))) )
+ (set! proc-name (string-append "doOpt" cap-name))
+ (set! is-lib-cb #f)
+
+ (exist? "call-proc")
+
+ =][= # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+ (set! have-proc #t)
+ (set! is-extern #t)
+ (set! proc-name (get "call-proc"))
+ (set! test-name (if need-stacking "optionStackArg" "NULL"))
+ =][=
+
+ ELIF (or (exist? "extract-code")
+ (exist? "flag-code")
+ (exist? "aliases")
+ (exist? "arg-range"))
+ =][=
+
+ (set! have-proc #t)
+ (set! is-extern #f)
+ (set! test-name (if (or (exist? "arg-range") (exist? "aliases"))
+ proc-name
+ (if need-stacking "optionStackArg" "NULL") ))
+ =][=
+
+ ELIF (exist? "flag-proc") =][=
+
+ (set! have-proc #t)
+ (set! proc-name (string-append "doOpt" (cap-c-name "flag-proc")))
+ (set! test-name (if need-stacking "optionStackArg" "NULL"))
+ (set! is-extern #f)
+ =][=
+
+ ELIF (exist? "stack-arg") =][=
+
+ (if (not (exist? "max"))
+ (error (string-append flg-name
+ " has a stacked arg, but can only appear once")) )
+
+ (set! have-proc #t)
+ (set! proc-name "optionStackArg")
+ (set! is-lib-cb #t)
+ (set! test-name (if need-stacking proc-name "NULL"))
+ (set! is-extern #t)
+ =][=
+
+ ELIF (exist? "unstack-arg") =][=
+
+ (set! have-proc #t)
+ (set! proc-name "optionUnstackArg")
+ (set! is-lib-cb #t)
+ (set! test-name (if need-stacking proc-name "NULL"))
+ (set! is-extern #t)
+ =][=
+
+ ELSE =][=
+
+ CASE arg-type =][=
+ =* bool =][=
+ (set! proc-name "optionBooleanVal")
+ (set! is-lib-cb #t)
+ (set! test-name proc-name)
+ (set! is-extern #t)
+ (set! have-proc #t) =][=
+
+ =* num =][=
+ (set! proc-name "optionNumericVal")
+ (set! is-lib-cb #t)
+ (set! test-name proc-name)
+ (set! is-extern #t)
+ (set! have-proc #t) =][=
+
+ = time-date =][=
+ (set! proc-name "optionTimeDate")
+ (set! is-lib-cb #t)
+ (set! test-name proc-name)
+ (set! is-extern #t)
+ (set! have-proc #t) =][=
+
+ =* time =][=
+ (set! proc-name "optionTimeVal")
+ (set! is-lib-cb #t)
+ (set! test-name proc-name)
+ (set! is-extern #t)
+ (set! have-proc #t) =][=
+
+ ~* key|set|fil =][=
+ (set! test-name proc-name)
+ (set! is-extern #f)
+ (set! have-proc #t) =][=
+
+ ~* hier|nest =][=
+ (set! proc-name "optionNestedVal")
+ (set! is-lib-cb #t)
+ (set! test-name proc-name)
+ (set! is-extern #t)
+ (set! have-proc #t) =][=
+
+ * =][=
+ (set! have-proc #f) =][=
+ ESAC =][=
+
+ ENDIF =][=
+
+ ;; If these are different, then a #define name is inserted into the
+ ;; option descriptor table. Never a need to mess with it if we are
+ ;; not building a "test main" procedure.
+ ;;
+ (if (not make-test-main)
+ (set! test-name proc-name))
+
+ (if have-proc
+ (begin
+ (hash-create-handle! have-cb-procs flg-name #t)
+ (hash-create-handle! cb-proc-name flg-name proc-name)
+ (hash-create-handle! test-proc-name flg-name test-name)
+ (hash-create-handle! is-ext-cb-proc flg-name is-extern)
+ (hash-create-handle! is-lib-cb-proc flg-name is-lib-cb)
+ (set! make-callback-procs #t)
+ )
+ (begin
+ (hash-create-handle! have-cb-procs flg-name #f)
+ (hash-create-handle! cb-proc-name flg-name "NULL")
+ (hash-create-handle! test-proc-name flg-name "NULL")
+ )
+ )
+
+ (if (exist? "default")
+ (set! default-opt-index (. flag-index)) )
+
+=][=
+
+ENDDEF save-name-morphs
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+Emit the "#define SET_OPT_NAME ..." and "#define DISABLE_OPT_NAME ..." =][=
+
+DEFINE set-defines
+
+=]
+#define SET_[=(. opt-name)=][= (if (exist? "arg-type") "(a)")
+ =] STMTS( \
+ [=set-desc=].optActualIndex = [=(. flag-index)=]; \
+ [=set-desc=].optActualValue = VALUE_[=(. opt-name)=]; \
+ [=set-desc=].fOptState &= OPTST_PERSISTENT_MASK; \
+ [=set-desc=].fOptState |= [=opt-state=][=
+ CASE arg-type =][=
+ ~* str|fil =]; \
+ [=set-desc=].optArg.argString = (a)[=
+ =* num =]; \
+ [=set-desc=].optArg.argInt = (a)[=
+ =* time =]; \
+ [=set-desc=].optArg.argInt = (a)[=
+ =* bool =]; \
+ [=set-desc=].optArg.argBool = (a)[=
+ =* key =]; \
+ [=set-desc=].optArg.argEnum = (a)[=
+ =* set =]; \
+ [=set-desc=].optArg.argIntptr = (a)[=
+ ~* hier|nest =]; \
+ [=set-desc=].optArg.argString = (a)[=
+
+ ESAC arg-type =][=
+
+ IF (hash-ref have-cb-procs flg-name) =]; \
+ (*([=(. descriptor)=].pOptProc))(&[=(. pname)=]Options, \
+ [=(. pname)=]Options.pOptDesc + [=set-index=]);[=
+ ENDIF "callout procedure exists" =] )[=
+
+ IF (exist? "disable") =][=
+ IF (~* (get "arg-type") "hier|nest") =]
+#define DISABLE_[=(. opt-name)=](a) STMTS( \
+ [=set-desc=].fOptState &= OPTST_PERSISTENT_MASK; \
+ [=set-desc=].fOptState |= OPTST_SET | OPTST_DISABLED; \
+ [=set-desc=].optArg.argString = (a); \
+ optionNestedVal(&[=(. pname)=]Options, \
+ [=(. pname)=]Options.pOptDesc + [=set-index=]);)[=
+
+ ELSE =]
+#define DISABLE_[=(. opt-name)=] STMTS( \
+ [=set-desc=].fOptState &= OPTST_PERSISTENT_MASK; \
+ [=set-desc=].fOptState |= OPTST_SET | OPTST_DISABLED; \
+ [=set-desc=].optArg.argString = NULL[=
+ IF (hash-ref have-cb-procs flg-name) =]; \
+ (*([=(. descriptor)=].pOptProc))(&[=(. pname)=]Options, \
+ [=(. pname)=]Options.pOptDesc + [=set-index=]);[=
+ ENDIF "callout procedure exists" =] )[=
+ ENDIF =][=
+ ENDIF disable exists =][=
+
+ENDDEF set-defines
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+Emit the copyright comment =][=
+
+DEFINE option-copyright =]
+ *
+ * Generated from AutoOpts [=(. ao-version)=] templates.
+ *
+ * AutoOpts is a copyrighted work. This [=
+ (if (= "h" (suffix)) "header" "source") =] file is not encumbered
+ * by AutoOpts licensing, but is provided under the licensing terms chosen
+ * by the [= prog-name =] author or copyright holder. AutoOpts is
+ * licensed under the terms of the LGPL. The redistributable library
+ * (``libopts'') is licensed under the terms of either the LGPL or, at the
+ * users discretion, the BSD license. See the AutoOpts and/or libopts sources
+ * for details.[=
+
+IF (exist? "copyright") =]
+ *
+ * The [= prog-name =] program is copyrighted and licensed
+ * under the following terms:
+ *
+[=
+ CASE copyright.type =][=
+ == "" =][=
+ (sprintf " * %s copyright (c) %s %s - all rights reserved\n * %s"
+ prog-name (get "copyright.date") (get "copyright.owner")
+ "licensing type not specified" ) =][=
+
+ = note =][= (prefix " * " (get "copyright.text")) =][=
+
+ * =][= (license-full (get "copyright.type") prog-name " * "
+ (get "copyright.owner") (get "copyright.date")) =][=
+ ESAC =][=
+ENDIF "copyright exists" =]
+ */
+[=
+
+ENDDEF option-copyright
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+Emit usage text =][=
+
+DEFINE usage-text =]
+#define [=
+ (set! tmp-val (string-append (get "usage-type") "-usage"))
+ (define usage-text-name
+ (string->c-name! (string-append pname "_" tmp-val)) )
+ usage-text-name
+
+ =] ([=
+
+ CASE (set! tmp-val (get tmp-val "<<<NOT-FOUND>>>"))
+ tmp-val =][=
+
+ == "<<<NOT-FOUND>>>" =]NULL[=
+
+ == "" =][=
+
+ (out-push-new) =][=
+ INCLUDE "usage.tlib" =][=
+ (string-table-add-ref opt-strs (out-pop #t)) =][=
+
+ ~ "[a-z][a-z0-9_]*" =][= (. tmp-val) =][=
+
+ * anything else must be plain text =][=
+ (string-table-add-ref opt-strs tmp-val) =][=
+ ESAC flavor of usage text. =])
+[=
+
+ENDDEF usage-text
+
+;; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE emit-keyword-enum =]
+typedef enum {[=
+ (if (not (exist? "arg-default"))
+ (string-append " " enum-pfx "UNDEFINED = 0,")) =]
+[=(shellf
+"for f in %s ; do echo %s${f} ; done | \
+ ${CLexe} -I4 --spread=3 --sep=,
+test $? -eq 0 || die ${CLexe} failed"
+ (string-upcase! (string->c-name! (join " " (stack "keyword"))))
+ enum-pfx )=]
+} te_[=(string-append Cap-prefix cap-name)=];
+#define [= (sprintf "%-24s" (string-append OPT-pfx UP-name "_VAL2STR(_v)"))
+ =] optionKeywordName(&[=(. value-desc)=], (_v))
+#define [=(. OPT-pfx)=]VALUE_[=(sprintf "%-14s" UP-name)
+ =] ([=(. value-desc)=].optArg.argEnum)[=
+
+ENDDEF emit-keyword-enum
+
+;; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE emit-member-mask =][=
+
+ (define setmember-fmt (string-append "\n#define %-24s 0x%0"
+ (shellf "expr '(' %d + 4 ')' / 4" (count "keyword")) "XUL"
+ (if (> (count "keyword") 32) "L" "") ))
+ (define full-prefix (string-append UP-prefix UP-name) ) =][=
+
+ FOR keyword =][=
+
+ (sprintf setmember-fmt
+ (string->c-name! (string-append
+ full-prefix "_" (string-upcase! (get "keyword")) ))
+ (ash 1 (for-index)) ) =][=
+
+ ENDFOR keyword =][=
+
+ (ag-fprintf 0 setmember-fmt (string->c-name! (string-append
+ full-prefix "_MEMBERSHIP_MASK"))
+ (- (ash 1 (count "keyword")) 1) ) =]
+#define [=(sprintf "%sVALUE_%-14s ((uintptr_t)%s.optCookie)"
+ OPT-pfx UP-name value-desc)
+ =][=
+
+ENDDEF emit-member-mask
+
+;; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE emit-value-defines =][=
+
+ CASE arg-type =][=
+
+ =* num =]
+#define [=(. OPT-pfx)=]VALUE_[=(sprintf "%-14s" UP-name)
+ =] ([=(. value-desc)=].optArg.argInt)[=
+
+ =* time =]
+#define [=(. OPT-pfx)=]VALUE_[=(sprintf "%-14s" UP-name)
+ =] ([=(. value-desc)=].optArg.argInt)[=
+
+ =* key =][=
+ INVOKE emit-keyword-enum =][=
+
+ =* set =][=
+ INVOKE emit-member-mask =][=
+
+ =* bool =]
+#define [=(. OPT-pfx)=]VALUE_[=(sprintf "%-14s" UP-name)
+ =] ([=(. value-desc)=].optArg.argBool)[=
+
+ =* fil =][=
+ CASE open-file =][=
+ == "" =][=
+ =* desc =]
+#define [=(. OPT-pfx)=]VALUE_[=(sprintf "%-14s" UP-name)
+ =] ([=(. value-desc)=].optArg.argFd)[=
+ * =]
+#define [=(. OPT-pfx)=]VALUE_[=(sprintf "%-14s" UP-name)
+ =] ([=(. value-desc)=].optArg.argFp)[=
+ ESAC =][=
+
+ ESAC =][=
+
+ENDDEF emit-value-defines
+
+;; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE set-option-define =][=
+
+ IF (exist? "unstack-arg") =][=
+
+ set-defines
+ set-desc = (string-append UP-prefix "DESC("
+ (get-up-name "unstack-arg") ")" )
+ set-index = (index-name "unstack-arg")
+ opt-state = "OPTST_SET | OPTST_EQUIVALENCE" =][=
+
+ ELIF (and (exist? "equivalence")
+ (not (== (get-up-name "equivalence") UP-name))) =][=
+
+ set-defines
+ set-desc = (string-append UP-prefix "DESC("
+ (get-up-name "equivalence") ")" )
+ set-index = (index-name "equivalence")
+ opt-state = "OPTST_SET | OPTST_EQUIVALENCE" =][=
+
+ ELSE "is equivalenced" =][=
+
+ set-defines
+ set-desc = (string-append UP-prefix "DESC(" UP-name ")" )
+ set-index = (. flag-index)
+ opt-state = OPTST_SET =][=
+
+ ENDIF is/not equivalenced =][=
+
+ENDDEF set-option-define
+
+;; # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+;;
+;; #define's for a single option
+;;
+;; First, emit defines that are always required. Then start collecting
+;; defines in a diverted output. If there is any output, there will
+;; be well more than 2 bytes of it. If so, actually emit it, but first
+;; see if it needs to be enclused in a #ifdef/#endif pair.
+;; =][=
+DEFINE option-defines =]
+#define VALUE_[=
+ (define value-desc (string-append UP-prefix "DESC("
+ (if (exist? "equivalence")
+ (get-up-name "equivalence")
+ UP-name) ")" ))
+ (sprintf "%-18s" opt-name)=] [=
+
+ CASE value =][=
+ !E =][= (get-opt-value flag-index) =][=
+ == "'" =]'\''[=
+ == "\\" =]'\\'[=
+ ~~ "[ -~]" =]'[=value=]'[=
+
+ =* num =][=
+ (if (>= number-opt-index 0)
+ (error "only one number option is allowed") )
+ (set! number-opt-index flag-index)
+ (get-opt-value flag-index) =][=
+
+ * =][=(error (sprintf
+ "Error: value for opt %s is `%s'\nmust be single char or 'NUMBER'"
+ (get "name") (get "value")))=][=
+
+ ESAC =][=
+ (out-push-new) =][=
+ INVOKE emit-value-defines =][=
+
+ IF (== (get-up-name "equivalence") UP-name) =]
+#define WHICH_[=(sprintf "%-18s" opt-name)
+ =] ([=(. descriptor)=].optActualValue)
+#define WHICH_[=(. UP-prefix)=]IDX_[=(sprintf "%-14s" UP-name)
+ =] ([=(. descriptor)=].optActualIndex)[=
+ ENDIF =][=
+
+ IF (exist? "settable") =][=
+ INVOKE set-option-define =][=
+ ENDIF settable =][=
+
+ IF (define tmp-val (out-pop #t))
+ (if (defined? 'tmp-val)
+ (> (string-length tmp-val) 2)
+ #f ) =][=
+
+ IF (hash-ref ifdef-ed flg-name) =]
+#if[=ifndef "n"=]def [= ifdef =][= ifndef \=]
+[= (. tmp-val) =]
+#endif /* [= ifdef =][= ifndef =] */[=
+
+ ELSE =]
+[= (. tmp-val) =][=
+ ENDIF =][=
+ ENDIF =][=
+
+ENDDEF Option_Defines
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE emit-alias-option
+
+=]
+#define [= (. UP-name) =]_DESC ([=
+ (string-table-add-ref opt-strs
+ (string-append "This is an alias for '" (get "aliases") "'")) =])
+#define [= (. UP-name) =]_NAME NULL
+#define [= (. UP-name) =]_name ([=
+ (string-table-add-ref opt-strs (get "name")) =])
+#define [=(. UP-name)=]_FLAGS ([=
+ (get-up-name "aliases") =]_FLAGS | OPTST_ALIAS)[=
+
+ENDDEF emit-alias-option
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+Define the arrays of values associated with an option (strings, etc.) =][=
+
+DEFINE emit-nondoc-option =][=
+ (if (exist? "translators")
+ (string-append "\n" (shellf
+"${CLexe} -I16 --fill --first='/* TRANSLATORS:' <<\\_EOF_
+%s
+_EOF_" (get "translators") ) " */" ) ) =]
+#define [= (. UP-name) =]_DESC ([=
+ (string-table-add-ref opt-strs (get-text "descrip")) =])
+#define [= (. UP-name) =]_NAME ([=
+ (string-table-add-ref opt-strs UP-name) =])[=
+
+ # IF this option can be disabled,
+ # THEN we must create the string for the disabled version
+ # =][=
+ IF (> (len "disable") 0) =]
+#define NOT_[= (. UP-name) =]_name ([=
+ (hash-create-handle! disable-name flg-name (string-append
+ "NOT_" UP-name "_name" ))
+ (hash-create-handle! disable-prefix flg-name (string-append
+ "NOT_" UP-name "_PFX" ))
+ (string-table-add-ref opt-strs
+ (string-tr! (string-append (get "disable") "-" flg-name)
+ optname-from optname-to)) =])
+#define NOT_[= (. UP-name) =]_PFX ([=
+ (string-table-add-ref opt-strs (string-downcase! (get "disable"))) =])
+#define [= (. UP-name) =]_name ([=
+ (if (> (len "enable") 0)
+ (string-table-add-ref opt-strs
+ (string-tr! (string-append (get "enable") "-" flg-name)
+ optname-from optname-to) )
+ (sprintf "NOT_%s_name + %d"
+ UP-name (+ (string-length (get "disable")) 1 ))
+ ) =])[=
+
+ ELSE No disablement of this option: =][=
+
+ (hash-create-handle! disable-name flg-name "NULL")
+ (hash-create-handle! disable-prefix flg-name "NULL") ""
+ =]
+#define [= (. UP-name) =]_name ([=
+ (string-table-add-ref opt-strs
+ (string-tr! (string-append
+ (if (exist? "enable") (string-append (get "enable") "-") "")
+ (get "name"))
+ optname-from optname-to)) =])[=
+
+ ENDIF (> (len "disable") 0) =][=
+
+ # Check for special attributes: a default value
+ # and conflicting or required options
+ =][=
+ IF (define def-arg-name (sprintf "%-28s "
+ (string-append UP-name "_DFT_ARG" )))
+ (exist? "arg-default") =]
+#define [= (. UP-name) =]_DFT_ARG ([=
+ CASE arg-type =][=
+ =* num =](char const*)[= arg-default =][=
+
+ =* time =](char const*)[=
+ (time-string->number (get "arg-default")) =][=
+
+ =* bool =][=
+ CASE arg-default =][=
+ ~ n.*|f.*|0 =](char const*)false[=
+ * =](char const*)true[=
+ ESAC =][=
+
+ =* key =](char const*)[=
+ (emit (if (=* (get "arg-default") enum-pfx) "" enum-pfx))
+ (get-up-name "arg-default") =][=
+
+ =* set =]NULL)
+#define [=(sprintf "%-28s " (string-append cap-name "CookieBits"))=](void*)([=
+ IF (not (exist? "arg-default")) =]0[=
+ ELSE =][=
+ FOR arg-default | =][=
+ (string->c-name! (string-append UP-prefix UP-name "_"
+ (get-up-name "arg-default") )) =][=
+ ENDFOR arg-default =][=
+ ENDIF =][=
+
+ =* str =][=
+ (string-table-add-ref opt-strs (get "arg-default")) =][=
+
+ =* file =][=
+ (string-table-add-ref opt-strs (get "arg-default")) =][=
+
+ * =][=
+ (error (string-append cap-name
+ " has arg-default, but no valid arg-type")) =][=
+ ESAC =])[=
+ ENDIF =][=
+
+
+ IF (exist? "flags-must") =]
+static int const a[=(. cap-name)=]MustList[] = {[=
+ FOR flags-must =]
+ [= (index-name "flags-must") =],[=
+ ENDFOR flags_must =] NO_EQUIVALENT };[=
+ ENDIF =][=
+
+
+ IF (exist? "flags-cant") =]
+static int const a[=(. cap-name)=]CantList[] = {[=
+ FOR flags-cant =]
+ [= (index-name "flags-cant") =],[=
+ ENDFOR flags-cant =] NO_EQUIVALENT };[=
+ ENDIF =]
+#define [= (. UP-name) =]_FLAGS ([=
+ ? enabled "OPTST_INITENABLED"
+ "OPTST_DISABLED" =][=
+ stack-arg " | OPTST_STACKED" =][=
+ must-set " | OPTST_MUST_SET" =][=
+ no-preset " | OPTST_NO_INIT" =][=
+ no-command " | OPTST_NO_COMMAND" =][=
+ deprecated " | OPTST_DEPRECATED" =][=
+
+ CASE immediate =][=
+ = also =] | OPTST_IMM | OPTST_TWICE[=
+ +E =] | OPTST_IMM[=
+ ESAC immediate =][=
+
+ CASE immed-disable =][=
+ = also =] | OPTST_DISABLE_IMM | OPTST_DISABLE_TWICE[=
+ +E =] | OPTST_DISABLE_IMM[=
+ ESAC immed-disable =][=
+
+ IF (exist? "arg-type") =][=
+ CASE arg-type =][=
+
+ =* num =] \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)[=
+ IF (exist? "scaled") =] \
+ | OPTST_SCALED_NUM[= ENDIF =][=
+
+ =* time =] \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_TIME)[=
+
+ =* bool =] \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_BOOLEAN)[=
+
+ =* key =] \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_ENUMERATION)[=
+
+ =* set =] \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_MEMBERSHIP)[=
+
+ ~* hier|nest =] \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_HIERARCHY)[=
+
+ =* str =] \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)[=
+
+ =* fil =] \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE)[=
+
+ * =][=
+ (error (string-append "unknown arg type '"
+ (get "arg-type") "' for " flg-name)) =][=
+ ESAC arg-type =][=
+ (if (exist? "arg-optional") " | OPTST_ARG_OPTIONAL") =][=
+ ENDIF arg-type exists =])[=
+
+ENDDEF emit-nondoc-option
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+Define the arrays of values associated with an option (strings, etc.) =][=
+
+DEFINE emit-opt-strs
+
+=]
+/*
+ * [= (set-flag-names) flg-name =] option description[=
+ IF (or (exist? "flags_must") (exist? "flags_cant")) =] with
+ * "Must also have options" and "Incompatible options"[=
+ ENDIF =]:
+ */[=
+ IF (hash-ref ifdef-ed flg-name) =]
+#if[=ifndef "n"=]def [= (define if-def-name (get "ifdef" (get "ifndef")))
+ if-def-name =][=
+ ENDIF ifdef-ed =][=
+
+ IF (exist? "documentation") =]
+#define [= (. UP-name) =]_DESC ([=
+ (string-table-add-ref opt-strs
+ (string-append (get-text "descrip") ":")) =])
+#define [= (. UP-name) =]_FLAGS (OPTST_DOCUMENT | OPTST_NO_INIT)[=
+ ELIF (exist? "aliases") =][=
+ INVOKE emit-alias-option =][=
+ ELSE =][=
+ INVOKE emit-nondoc-option =][=
+ ENDIF (exist? "documentation") =][=
+
+ IF (hash-ref ifdef-ed flg-name) =]
+
+#else /* disable [= (. flg-name)=] */
+#define [= (. UP-name) =]_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)[=
+
+ IF (exist? "arg-default") =]
+#define [= (. UP-name) =]_DFT_ARG NULL[=
+ ENDIF =][=
+
+ IF (exist? "flags-must") =]
+#define a[=(. cap-name)=]MustList NULL[=
+ ENDIF =][=
+
+ IF (exist? "flags-cant") =]
+#define a[=(. cap-name)=]CantList NULL[=
+ ENDIF =]
+#define [= (. UP-name) =]_NAME NULL[=
+
+ IF (exist? "omitted-usage") =]
+#define [= (. UP-name) =]_DESC ([=
+ (set! tmp-text (get "omitted-usage"))
+ (if (> (string-length tmp-text) 1)
+ (string-table-add-ref opt-strs tmp-text)
+ "NULL") =])
+#define [= (. UP-name) =]_name ([=
+ (string-table-add-ref opt-strs (get "name")) =])[=
+
+ ELSE =]
+#define [= (. UP-name) =]_DESC NULL
+#define [= (. UP-name) =]_name NULL[=
+ ENDIF =][=
+
+ IF (> (len "disable") 0) =]
+#define NOT_[= (. UP-name) =]_name NULL
+#define NOT_[= (. UP-name) =]_PFX NULL[=
+ ENDIF =]
+#endif /* [= (. if-def-name) =] */[=
+ ENDIF ifdef-ed =][=
+
+ENDDEF opt-strs
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+Define the arrays of values associated with help/version/etc. =][=
+
+DEFINE help-strs
+
+=]
+
+/*
+ * Help[= (string-append
+ (if (exist? "no-libopts") "" "/More_Help")
+ (if (exist? "version") "/Version" "")) =] option descriptions:
+ */
+#define HELP_DESC ([=
+ (string-table-add-ref opt-strs
+ "Display extended usage information and exit")=])
+#define HELP_name ([=
+ (string-table-add-ref opt-strs "help")=])[=
+
+ IF (not (exist? "no-libopts"))
+
+=]
+#ifdef HAVE_WORKING_FORK
+#define MORE_HELP_DESC ([=
+ (string-table-add-ref opt-strs
+ "Extended usage information passed thru pager")=])
+#define MORE_HELP_name ([=
+ (string-table-add-ref opt-strs "more-help")=])
+#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
+#else
+#define MORE_HELP_DESC NULL
+#define MORE_HELP_name NULL
+#define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
+#endif[=
+
+ ENDIF (not (exist? "no-libopts")) =][=
+
+ IF (exist? "version")
+
+=]
+#ifdef NO_OPTIONAL_OPT_ARGS
+# define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
+#else
+# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
+ OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
+#endif
+#define VER_DESC ([=
+ (string-table-add-ref opt-strs "Output version information and exit")=])
+#define VER_name ([=
+ (string-table-add-ref opt-strs "version")=])[=
+
+ ENDIF (exist? "version") =][=
+
+ IF (exist? "resettable")
+
+=]
+#define RESET_DESC ([=
+ (string-table-add-ref opt-strs "Reset an option's state")=])
+#define RESET_name ([=
+ (string-table-add-ref opt-strs "reset-option")=])
+#define RESET_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_NO_INIT)[=
+
+ ENDIF (exist? "resettable") =][=
+
+ IF (exist? "usage-opt")
+
+=]
+#define USAGE_DESC ([=
+ (string-table-add-ref opt-strs "Abbreviated usage to stdout")=])
+#define USAGE_name ([=
+ (string-table-add-ref opt-strs "usage")=])[=
+
+ ENDIF (exist? "usage-opt") =][=
+
+ IF (exist? "vendor-opt")
+
+=]
+#define VEND_DESC ([=
+ (string-table-add-ref opt-strs "vendor supported additional options")=])
+#define VEND_name ([=
+ (string-table-add-ref opt-strs "vendor-option")=])[=
+
+ ENDIF (exist? "vendor-opt") =][=
+
+ IF (exist? "homerc") =][=
+
+ IF (not (exist? "disable-save")) =]
+#define SAVE_OPTS_DESC ([=
+ (string-table-add-ref opt-strs "Save the option state to a config file")=])
+#define SAVE_OPTS_name ([=
+ (string-table-add-ref opt-strs "save-opts")=])[=
+
+ ENDIF no disable-save =][=
+
+ IF (not (exist? "disable-load")) =]
+#define LOAD_OPTS_DESC ([=
+ (string-table-add-ref opt-strs "Load options from a config file")=])
+#define LOAD_OPTS_NAME ([=
+ (string-table-add-ref opt-strs "LOAD_OPTS")=])
+#define NO_LOAD_OPTS_name ([=
+ (string-table-add-ref opt-strs "no-load-opts")=])
+#define LOAD_OPTS_pfx ([=
+ (string-table-add-ref opt-strs "no")=])
+#define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3)[=
+
+ ENDIF no disable-load =][=
+
+ ENDIF (exist? "homerc") =][=
+
+ENDDEF help-strs
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+Define the values for an option descriptor =][=
+
+DEFINE emit-opt-desc =][=
+ IF
+ (set-flag-names)
+
+ (exist? "documentation")
+
+=]
+ { /* entry idx, value */ 0, 0,
+ /* equiv idx, value */ 0, 0,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 0, 0,
+ /* opt state flags */ [=(. UP-name)=]_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ [=
+ IF (exist? "call-proc") =][=call-proc=][=
+ ELIF (or (exist? "extract-code")
+ (exist? "flag-code")) =]doOpt[=(. cap-name)=][=
+ ELSE =]NULL[=
+ ENDIF =],
+ /* desc, NAME, name */ [=
+ (set! default-text (string-append default-text
+ "\n { NULL }, /* doc opt */" ))
+ (set! default-cookie (string-append default-cookie "NULL\n" ))
+ UP-name =]_DESC, NULL, NULL,
+ /* disablement strs */ NULL, NULL },[=
+
+ ELSE
+
+=]
+ { /* entry idx, value */ [=(. flag-index)=], [=
+ (string-append VALUE-pfx UP-name)=],
+ /* equiv idx, value */ [=
+ IF (== (get-up-name "equivalence") UP-name)
+ =]NO_EQUIVALENT, 0[=
+ ELIF (or (exist? "equivalence") (exist? "unstack-arg"))
+ =]NOLIMIT, NOLIMIT[=
+ ELSE
+ =][=(. flag-index)=], [=(string-append VALUE-pfx UP-name)=][=
+ ENDIF=],
+ /* equivalenced to */ [=
+ (if (exist? "unstack-arg")
+ (index-name "unstack-arg")
+ (if (and (exist? "equivalence")
+ (not (== (get-up-name "equivalence") UP-name)) )
+ (index-name "equivalence")
+ "NO_EQUIVALENT"
+ ) ) =],
+ /* min, max, act ct */ [=
+ (if (exist? "min") (get "min")
+ (if (exist? "must-set") "1" "0" )) =], [=
+ (if (=* (get "arg-type") "set") "NOLIMIT"
+ (if (exist? "max") (get "max") "1") ) =], 0,
+ /* opt state flags */ [=(. UP-name)=]_FLAGS, 0,
+ /* last opt argumnt */ [=
+ (set! tmp-val (if (exist? "arg-default")
+ (string-append "{ " UP-name "_DFT_ARG },")
+ (string-append "{ NULL }, /* --" flg-name " */" ) ))
+ (set! default-text (string-append default-text "\n " tmp-val))
+ tmp-val =]
+ /* arg list/cookie */ [=
+ (set! tmp-val (if (and (=* (get "arg-type") "set") (exist? "arg-default"))
+ (string-append cap-name "CookieBits") "NULL"))
+ (set! default-cookie (string-append default-cookie tmp-val "\n" ))
+ tmp-val =],
+ /* must/cannot opts */ [=
+ (if (exist? "flags-must")
+ (string-append "a" cap-name "MustList, ")
+ "NULL, " ) =][=
+ (if (exist? "flags-cant")
+ (string-append "a" cap-name "CantList")
+ "NULL" ) =],
+ /* option proc */ [=
+
+ ;; If there is a difference between what gets invoked under test and
+ ;; what gets invoked "normally", then there must be a #define name
+ ;; for the procedure. There will only be such a difference if
+ ;; make-test-main is #t
+ ;;
+ (if (= (hash-ref cb-proc-name flg-name)
+ (hash-ref test-proc-name flg-name))
+
+ (hash-ref test-proc-name flg-name)
+ (string-append UP-name "_OPT_PROC") ) =],
+ /* desc, NAME, name */ [=
+ (sprintf "%1$s_DESC, %1$s_NAME, %1$s_name," UP-name) =]
+ /* disablement strs */ [=(hash-ref disable-name flg-name)=], [=
+ (hash-ref disable-prefix flg-name)=] },[=
+ ENDIF =][=
+
+ENDDEF opt-desc
+
+optlib.tlib ends here \=]
diff --git a/autoopts/tpl/optmain.tlib b/autoopts/tpl/optmain.tlib
new file mode 100644
index 0000000..13b01de
--- /dev/null
+++ b/autoopts/tpl/optmain.tlib
@@ -0,0 +1,1255 @@
+[= AutoGen5 Template -*- Mode: text -*-
+
+# Time-stamp: "2012-08-11 08:13:56 bkorb"
+
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+=][=
+
+(out-push-new) =]
+ck_flag_code() {
+ addon_txt=''
+ txt1=`[=(. grep-prog)=] -w pOptDesc ${tmp_dir}/flag-code`
+ test -z "$txt1" && addon_txt=' (void)pOptDesc;\n'
+ txt2=`[=(. grep-prog)=] -w pOptions ${tmp_dir}/flag-code`
+ test -z "$txt2" && addon_txt=${addon_txt}' (void)pOptions;\n'
+ cat ${tmp_dir}/flag-code
+ test -z "$addon_txt" || printf "\n$addon_txt"
+ rm -f ${tmp_dir}/flag-code
+}[=
+(shell (out-pop #t)) =][=
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+ BUILD TEST MAIN
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE build-test-main
+
+=][= (tpl-file-line extract-fmt) \=]
+
+#if defined([=(. main-guard)=]) /* TEST MAIN PROCEDURE: */[=
+
+ IF (= (get "test-main") "optionParseShell")
+
+=]
+
+extern tOptions genshelloptOptions;
+extern void optionParseShell(tOptions*);
+extern tOptions* optionParseShellOptions;[=
+
+ ELIF (not (exist? "main-text")) =][=
+
+ (define option-emitter-proc (get "test-main"))
+ (if (<= (string-length option-emitter-proc) 3)
+ (set! option-emitter-proc "optionPutShell"))
+=]
+
+extern void [= (. option-emitter-proc) =](tOptions*);[=
+
+ ENDIF
+
+=]
+
+/**
+ * Generated main procedure. This will emit text that a Bourne shell can
+ * process to handle its command line arguments.
+ *
+ * @param argc argument count
+ * @param argv argument vector
+ * @returns program exit code
+ */
+int
+main(int argc, char ** argv)
+{
+ int res = [=(. succ-exit-code)=];[=
+
+ IF (= (get "test-main") "optionParseShell") =]
+ /*
+ * Stash a pointer to the options we are generating.
+ * `genshellUsage()' will use it.
+ */
+ optionParseShellOptions = &[=(. pname)=]Options;
+ (void)optionProcess(&genshelloptOptions, argc, argv);
+ optionParseShell(&[=(. pname)=]Options);[=
+
+ ELIF (exist? "main-text") =][=
+ IF (not (exist? "option-code")) =]
+ {
+ int ct = optionProcess(&[=(. pname)=]Options, argc, argv);
+ argc -= ct;
+ argv += ct;
+ }[=
+ ELSE =][=
+ (def-file-line "option-code" extract-fmt) =][=
+ option-code =][=
+ ENDIF =][=
+
+ (def-file-line "main-text" extract-fmt) =][=
+ main-text =][=
+
+ ELSE test-main is not optionParseShell and main-text not exist
+
+=]
+ (void)optionProcess(&[=(. pname)=]Options, argc, argv);
+ [= (. option-emitter-proc) =](&[=(. pname)=]Options);
+ res = ferror(stdout);
+ if (res != 0)
+ fputs("output error writing to stdout\n", stderr);[=
+ ENDIF=]
+ return res;
+}
+#endif /* defined [= (. main-guard) =] */[=
+
+ENDDEF build-test-main
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+ BUILD FOR-EACH MAIN
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE for-each-main =][=
+
+ (if (not (==* (get "argument") "[" ))
+ (error "command line arguments must be optional for a 'for-each' main"))
+
+ (if (not (exist? "handler-proc"))
+ (error "'for-each' mains require a handler proc") )
+
+ (define handler-arg-type "")
+ (tpl-file-line extract-fmt)
+
+=]
+/**
+ * strip (destructively) the leading and trailing white space.
+ * Trailing white space is trimmed with a NUL byte.
+ * The returned address is that of the first character after the
+ * leading white space. Characters are not moved.
+ *
+ * @param pz_s source text pointer
+ * @returns pointer to the same text buffer, but after finding the
+ * first non-white space character.
+ */
+static char *
+trim_input_line(char * pz_s)
+{
+ char* pz_e = pz_s + strlen(pz_s);
+ while ((pz_e > pz_s) && isspace((unsigned int)pz_e[-1])) pz_e--;
+ *pz_e = '\0';
+ while ((unsigned int)isspace(*pz_s)) pz_s++;
+
+ switch (*pz_s) {
+ case '\0':
+ case '[= ?% comment-char "%s" "#" =]':
+ return NULL;
+ default:
+ return pz_s;
+ }
+}[=
+
+CASE handler-type =][=
+=* name =][= (set! handler-arg-type "char const* pz_fname")
+ (define handler-proc "validate_fname") =][=
+=* file =][=
+ (set! handler-arg-type "char const* pz_fname, FILE* entry_fp")
+ (define handler-proc "validate_fname") =][=
+*=* text =][=
+ (set! handler-arg-type
+ "char const* pz_fname, char* pz_file_text, size_t text_size")
+ (define handler-proc "validate_fname") =][=
+!E =][= (set! handler-arg-type "char const* pz_entry")
+ (define handler-proc (get "handler-proc")) =][=
+* =][= (error) =][=
+ESAC =][=
+
+IF (set! tmp-text (string-append (get "handler-proc") "-code"))
+ (exist? tmp-text) =]
+
+static int
+[= handler-proc =]([=(. handler-arg-type)=])
+{
+ int res = 0;[=
+ (string-append
+ (def-file-line tmp-text extract-fmt)
+ (get tmp-text) ) =]
+ return res;
+}[=
+
+ELSE
+
+=]
+
+extern int [= handler-proc =]([=(. handler-arg-type)=]);[=
+
+ENDIF
+
+=][= (tpl-file-line extract-fmt) =][=
+
+IF (exist? "handler-type") =]
+/**
+ * validate file name and dispach callout procedure.
+ * This procedure is generated by AutoOpts.
+ * It will make sure that the input file name refers to a file[=
+
+ CASE handler-type =][=
+=* name =]
+ * that exists.[=
+=* file =]
+ * that exists and has been opened for [=
+ CASE
+ (define open-mode (shellf "echo '%s' | sed 's/.*-//'"
+ (get "handler-type")))
+ open-mode =][=
+ *~~* '[rwa]\+' =]reading and writing[=
+ *~~* [wa] =]writing[=
+ *~~* r =]reading[=
+ ESAC =].[=
+
+*=* text =]
+ * that has been read into memory as text.[=
+ ESAC =]
+ *
+ * @param pz_fname the name of the file to process
+ * @returns program exit code flag
+ */
+static [=
+
+(define emit-failing-printf (not (= (get "file-fail-code") "success")))
+
+ pname-down =]_exit_code_t
+validate_fname(char const* pz_fname)
+{
+ static char const * pz_fs_err = NULL;[=
+
+ IF (*=* (get "handler-type") "text") =]
+ char* file_text;
+ size_t text_size;
+ int res;[=
+ ENDIF =]
+
+ if (pz_fs_err == NULL)
+ pz_fs_err = _("fs error %d (%s) %s-ing %s\n");
+
+ {
+ struct stat sb;
+ if (stat(pz_fname, &sb) < 0) {[=
+ IF (. emit-failing-printf) =]
+ fprintf(stderr, pz_fs_err, errno, strerror(errno), "stat",
+ pz_fname);[=
+ ENDIF =]
+ return [= (. file-fail-exit-code) =];
+ }[=
+
+ IF (*=* (get "handler-type") "text") =]
+
+ if (! S_ISREG(sb.st_mode)) {[=
+ IF (. emit-failing-printf) =]
+ fprintf(stderr, pz_fs_err, EINVAL, strerror(EINVAL),
+ "not regular file:", pz_fname);[=
+ ENDIF =]
+ return [= (. file-fail-exit-code) =];
+ }[=
+
+ IF (=* (get "handler-type") "some-text") =]
+
+ if (sb.st_size == 0) {[=
+ IF (. emit-failing-printf) =]
+ fprintf(stderr, pz_fs_err, EINVAL, strerror(EINVAL),
+ "empty file:", pz_fname);[=
+ ENDIF =]
+ return [= (. file-fail-exit-code) =];
+ }[=
+
+ ENDIF =]
+
+ text_size = sb.st_size;[=
+
+ ENDIF =]
+ }[=
+
+CASE handler-type =][=
+=* name =][= (tpl-file-line extract-fmt) =]
+
+ return [= handler-proc =](pz_fname);[=
+
+=* file =][= (tpl-file-line extract-fmt) =]
+ {
+ int res;
+ FILE* fp = fopen(pz_fname, "[=
+ (shellf "echo '%s' | sed 's/.*-//'"
+ (get "handler-type")) =]");
+ if (fp == NULL) {
+ fprintf(stderr, pz_fs_err, errno, strerror(errno), "fopen",
+ pz_fname);
+ return [= (. file-fail-exit-code) =];
+ }
+ res = [= handler-proc =](pz_fname, fp);
+ fclose(fp);
+ return res;
+ }[=
+
+*=* text =][= (tpl-file-line extract-fmt) =]
+ file_text = malloc(text_size + 1);
+ if (file_text == NULL) {
+ fprintf(stderr, _("cannot allocate %u bytes for %s file text\n"),
+ (unsigned int)text_size+1, pz_fname);
+ exit([=(. nomem-exit-code)=]);
+ }
+
+ {
+ char* pz = file_text;
+ size_t sz = text_size;
+ int fd = open(pz_fname, O_RDONLY);
+ int try_ct = 0;
+
+ if (fd < 0) {
+ fprintf(stderr, pz_fs_err, errno, strerror(errno), "open",
+ pz_fname);
+ free(file_text);
+ return [= (. file-fail-exit-code) =];
+ }
+
+ while (sz > 0) {
+ ssize_t rd_ct = read(fd, pz, sz);
+ /*
+ * a read count of zero is theoretically okay, but we've already
+ * checked the file size, so we shoud be reading more.
+ * For us, a count of zero is an error.
+ */
+ if (rd_ct <= 0) {
+ /*
+ * Try retriable errors up to 10 times. Then bomb out.
+ */
+ if ( ((errno == EAGAIN) || (errno == EINTR))
+ && (++try_ct < 10) )
+ continue;
+
+ fprintf(stderr, pz_fs_err, errno, strerror(errno), "read",
+ pz_fname);
+ exit([=(. file-fail-exit-code)=]);
+ }
+ pz += rd_ct;
+ sz -= rd_ct;
+ }
+ close(fd);
+ }
+
+ /*
+ * Just in case it is a text file, we have an extra byte to NUL
+ * terminate the thing.
+ */
+ file_text[ text_size ] = '\0';
+ res = [= handler-proc =](pz_fname, file_text, text_size);
+ free(file_text);
+ return res;[=
+ESAC =]
+}[=
+
+ENDIF handler-type exists =][=
+
+(tpl-file-line extract-fmt)
+
+=]
+/**
+ * Generated main procedure. This will call the [= (. handler-proc) =] procedure
+ * for every operand on the command line. If there are no operands, then stdin
+ * is read for a list of file names to process. stdin must not be a terminal.
+ * It must be a pipe or a file.
+ *
+ * @param argc argument count
+ * @param argv argument vector
+ * @returns program exit code
+ */
+int
+main(int argc, char** argv)
+{
+ int res = 0;
+ {
+ int ct = optionProcess(&[=(. pname)=]Options, argc, argv);
+ argc -= ct;
+ argv += ct;
+ }[=
+ (if (exist? "main-init") (string-append
+ "\n " (def-file-line "main-init" extract-fmt) "\n" (get "main-init")))
+
+ =][= (tpl-file-line extract-fmt) =]
+ /*
+ * Input list from command line
+ */
+ if (argc > 0) {
+ do {
+ res |= [= (. handler-proc) =](*(argv++));
+ } while (--argc > 0);
+ }
+
+ /*
+ * Input list from tty input
+ */
+ else if (isatty(STDIN_FILENO)) {
+ fputs(_("[=(. prog-name)=] ERROR: input list is a tty\n"), stderr);
+ [= (. UP-prefix) =]USAGE([=(. file-fail-exit-code)=]);
+ /* NOTREACHED */
+ }
+
+ /*
+ * Input list from a pipe or file or some such
+ */
+ else {
+ int in_ct = 0;
+ size_t pg_size = getpagesize();
+ char* buf = malloc(pg_size);
+ if (buf == NULL) {
+ fputs(_("[=(. prog-name)
+ =] ERROR: no memory for input list\n"), stderr);
+ return [=(. nomem-exit-code)=];
+ }
+
+ for (;;) {
+ char* pz = fgets(buf, (ssize_t)pg_size, stdin);
+ if (pz == NULL)
+ break;
+
+ pz = trim_input_line(pz);
+ if (pz != NULL) {
+ res |= [= (. handler-proc) =](pz);
+ in_ct++;
+ }
+ }
+
+ if (in_ct == 0)
+ fputs(_("[=(. prog-name)
+ =] Warning: no input lines were read\n"), stderr);
+ free(buf);
+ }[=
+ (if (exist? "main-fini") (string-append
+ "\n " (def-file-line "main-fini" extract-fmt) "\n" (get "main-fini")))
+ \=]
+
+ return res;
+}[=
+
+ENDDEF for-each-main
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+ BUILD MAIN
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE build-main =][= FOR main[] =][=
+
+ CASE main-type =][=
+ == shell-process =][=
+ INVOKE build-test-main test-main = "optionPutShell" =][=
+
+ == shell-parser =][=
+ INVOKE build-test-main test-main = "optionParseShell" =][=
+
+ == main =][=
+ INVOKE build-test-main =][=
+
+ == include =]
+[= INCLUDE tpl =][=
+
+ == invoke =][=
+ INVOKE (get "func") =][=
+
+ == for-each =][=
+ INVOKE for-each-main =][=
+
+ * =][=
+ (error (sprintf "unknown/invalid main-type: '%s'" (get "main-type"))) =][=
+
+ ESAC =][= ENDFOR first-main =][=
+
+ENDDEF build-main
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+ DECLARE OPTION CALLBACK PROCEDURES
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE decl-callbacks
+
+ This is the test for whether or not to emit callback handling code:
+
+=]
+/*
+ * Declare option callback procedures
+ */[=
+ (define undef-proc-names "")
+ (define decl-type "")
+ (define extern-proc-list (string-append
+ (if (exist? "version-proc")
+ (get "version-proc")
+ "optionPrintVersion") "\n"
+ "optionBooleanVal\n"
+ "optionNestedVal\n"
+ "optionNumericVal\n"
+ "optionResetOpt\n"
+ "optionStackArg\n"
+ "optionTimeDate\n"
+ "optionTimeVal\n"
+ "optionUnstackArg\n"
+ "optionVendorOption\n"
+
+ ) )
+
+ (define extern-test-list "")
+
+ (define emit-decl-list (lambda(txt-var is-extern)
+ (if (> (string-length txt-var) 1) (begin
+
+ (emit (if is-extern "\nextern tOptProc\n" "\nstatic tOptProc\n"))
+ (set! txt-var (shellf "
+ (%s -v '^%s$' | sed '/^$/d' | sort -u | \
+ sed 's@$@,@;$s@,$@;@' ) <<_EOProcs_\n%s_EOProcs_"
+ egrep-prog
+ (if is-extern "NULL" "(NULL|optionStackArg|optionUnstackArg)")
+ txt-var ))
+
+ (emit (shellf (if (< (string-length txt-var) 72)
+ "f='%s' ; echo \" \" $f"
+ "${CLexe} --spread=1 -I4 <<_EOProcs_\n%s\n_EOProcs_" )
+ txt-var ))
+ ))
+ ))
+
+ (define static-proc-list "doUsageOpt\n")
+ (define static-test-list static-proc-list)
+ (define ifdef-fmt (string-append
+ "\n#if%1$sdef %2$s"
+ "\n %3$s tOptProc %4$s;"
+ "\n#else /* not %2$s */"
+ "\n# define %4$s NULL"
+ "\n#endif /* def/not %2$s */"))
+
+ (define make-proc-decl #t)
+
+ (define set-ifdef (lambda(n-or-def ifdef-cb ifdef-name) (begin
+ (set! decl-type (if (hash-ref is-ext-cb-proc flg-name) "extern" "static"))
+ (set! make-proc-decl #f)
+ (ag-fprintf 0 ifdef-fmt n-or-def ifdef-name decl-type ifdef-cb )
+ )))
+
+ (define set-cb-decl (lambda() (begin
+
+ (set! make-proc-decl #t)
+ (set! tmp-val (hash-ref cb-proc-name flg-name))
+
+ (if (exist? "ifdef")
+ (set-ifdef "" tmp-val (get "ifdef"))
+
+ (if (exist? "ifndef")
+ (set-ifdef "n" tmp-val (get "ifndef"))
+
+ (if (hash-ref is-ext-cb-proc flg-name)
+ (set! extern-proc-list (string-append
+ extern-proc-list tmp-val "\n" ))
+
+ (set! static-proc-list (string-append
+ static-proc-list tmp-val "\n" ))
+ ) ) )
+
+ (if make-test-main (begin
+ (set! tmp-val (hash-ref test-proc-name flg-name))
+ (if (hash-ref is-ext-cb-proc flg-name)
+ (set! extern-test-list (string-append extern-test-list
+ tmp-val "\n" ))
+
+ (if make-proc-decl
+ (set! static-test-list
+ (string-append static-test-list tmp-val "\n") ) ) )
+ ) )
+
+ )))
+ =][=
+
+ FOR flag =][=
+
+ ;; Fill in four strings with names of callout procedures:
+ ;; extern-test-list - external callouts done IFF test main is built
+ ;; static-test-list - static callouts done IFF test main is built
+ ;; extern-proc-list - external callouts for normal compilation
+ ;; static-proc-list - static callouts for normal compilation
+ ;;
+ ;; Anything under the control of "if[n]def" has the declaration or
+ ;; #define to NULL emitted immediately.
+ ;;
+ (set! flg-name (get "name"))
+
+ (if (and (hash-ref have-cb-procs flg-name)
+ (not (hash-ref is-lib-cb-proc flg-name)) )
+ (set-cb-decl)
+ ) =][=
+
+ ENDFOR flag =][=
+
+ IF (. make-test-main) =][=
+ (set! extern-proc-list (string-append extern-proc-list
+ "optionVersionStderr\n")) =][=
+ INVOKE emit-testing-defines =][=
+ ENDIF make-test-main =][=
+
+ (if (not (exist? "no-libopts"))
+ (set! extern-proc-list (string-append extern-proc-list
+ "optionPagedUsage\n")) )
+
+ (emit-decl-list extern-proc-list #t)
+ (emit-decl-list static-proc-list #f)
+ (set! static-proc-list "") =][=
+
+ FOR flag =][=
+
+ (set! flg-name (get "name"))
+ (if (not (= (hash-ref cb-proc-name flg-name)
+ (hash-ref test-proc-name flg-name)))
+ (set! static-proc-list (string-append static-proc-list
+ "#define " (get-up-name "name") "_OPT_PROC "
+ (hash-ref cb-proc-name flg-name) "\n")) )
+ =][=
+ ENDFOR flag =][=
+
+ IF (> (string-length static-proc-list) 0) =]
+
+/*
+ * #define map the "normal" callout procs
+ */
+[= (. static-proc-list) =][=
+
+ ENDIF have some #define mappings
+
+=][=
+
+ (if make-test-main
+ (ag-fprintf 0 "\n#endif /* defined(%s) */" main-guard) )
+
+ undef-proc-names =][=
+
+ENDDEF decl-callbacks =][=
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE emit-testing-defines
+
+=]
+#if defined([=(tpl-file-line extract-fmt) main-guard =])
+/*
+ * Under test, omit argument processing, or call optionStackArg,
+ * if multiple copies are allowed.
+ */[=
+
+ (emit-decl-list extern-test-list #t)
+ (emit-decl-list static-test-list #f)
+ (set! static-test-list "") =][=
+
+ FOR flag =][=
+
+ (set! flg-name (get "name"))
+ (if (not (= (hash-ref cb-proc-name flg-name)
+ (hash-ref test-proc-name flg-name)))
+ (set! static-test-list (string-append static-test-list
+ "#define " (get-up-name "name") "_OPT_PROC "
+ (hash-ref test-proc-name flg-name) "\n")) )
+ =][=
+ ENDFOR flag =][=
+
+ IF (> (string-length static-test-list) 0) =]
+
+/*
+ * #define map the "normal" callout procs to the test ones...
+ */
+[= (. static-test-list) =][=
+
+ ENDIF have some #define mappings
+
+=]
+
+#else /* NOT defined [=(. main-guard)=] */
+/*
+ * When not under test, there are different procs to use
+ */[=
+
+ENDDEF emit-testing-defines
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+ DEFINE OPTION CALLBACKS
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE callback-proc-header =]
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the [=name=] option[=
+
+ IF (exist? "ifdef")
+
+=], when [= ifdef =] is #define-d[=
+ (define ifdef-text (string-append "\n#ifdef " (get "ifdef")))
+ (set! endif-test-main (string-append
+ (sprintf "\n#endif /* defined %s */" (get "ifdef"))
+ endif-test-main
+ )) =][=
+
+ ELIF (exist? "ifndef")
+
+=], when [= ifndef =] is *not* #define-d[=
+ (define ifdef-text (string-append "\n#ifndef " (get "ifndef")))
+ (set! endif-test-main (string-append
+ (sprintf "\n#endif /* ! defined %s */" (get "ifndef"))
+ endif-test-main
+ )) =][=
+
+ ELSE unconditional code:
+
+=][= (define ifdef-text "") =][=
+
+ ENDIF ifdef / ifndef
+
+=].
+ *
+ * @param pOptions the [=(. prog-name)=] options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */[= (. ifdef-text) =]
+static void
+doOpt[= (set! endif-test-main (string-append "\n}" endif-test-main))
+ cap-name =](tOptions* pOptions, tOptDesc* pOptDesc)
+{
+[=
+
+ENDDEF callback-proc-header
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE reset-clause =][=
+
+ (if (exist? "flag-code[0]")
+ (emit (string-append "\n" (get "flag-code[0]"))))
+
+ (if (exist? "resettable") (emit (string-append
+ "\n if ((pOptDesc->fOptState & OPTST_RESET) != 0)"
+ "\n return;" )) )
+
+ =][=
+
+ENDDEF reset-clause
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE range-option-code
+
+=][=
+
+(define option-arg-type (get "arg-type"))
+(define range-count (count "arg-range"))
+
+\=]
+ static struct {long rmin, rmax;} const rng[[=
+ (. range-count) =]] = {
+[=(out-push-new) =][=
+ FOR arg-range ",\n" =]{ [=
+
+ CASE arg-range =][=
+ *== "->" =][=
+ (string-substitute (get "arg-range") "->" "") =], LONG_MAX[=
+
+ ==* "->" =]LONG_MIN, [=
+ (string-substitute (get "arg-range") "->" "") =][=
+
+ *==* "->" =][=
+ (string-substitute (get "arg-range") "->" ", ") =][=
+
+ ~~ -{0,1}[0-9]+ =][=arg-range=], LONG_MIN[=
+
+ * =][= (error (string-append "Invalid range spec: ``"
+ (get "arg-range") "''" )) =][=
+
+ ESAC arg-range =] }[=
+ ENDFOR =][=
+
+ (shellf "${CLexe} -I8 --spread=2 <<_EOF_\n%s\n_EOF_"
+ (out-pop #t)) =] };
+ int ix;
+
+ if (pOptions <= OPTPROC_EMIT_LIMIT)
+ goto emit_ranges;[=
+
+ INVOKE reset-clause =][=
+
+ CASE (define leave-ok-code "") (define ok-return-code "")
+ (if (exist? "flag-code[1]")
+ (begin
+ (set! leave-ok-code "goto return_okay")
+ (set! ok-return-code (string-append
+ "\n return;\n\nreturn_okay:\n"
+ (get "flag-code[1]") ))
+ )
+ (begin
+ (set! leave-ok-code "return")
+ (set! ok-return-code "")
+ ) )
+
+ option-arg-type =][=
+
+ =* num =]
+ optionNumericVal(pOptions, pOptDesc);[=
+
+ = time-date =][=
+ (error (string-append "time/date option " low-name
+ " may not be range limited.")) )
+ =][=
+
+ =* time =]
+ optionTimeVal(pOptions, pOptDesc);
+ if (pOptDesc->optArg.argInt == (long)BAD_TIME)
+ return;[=
+
+ * =][=
+ (error (string-append option-arg-type " option " low-name
+ " may not be range limited.")) )
+ =][=
+
+ ESAC =]
+
+ for (ix = 0; ix < [=(. range-count)=]; ix++) {
+ if (pOptDesc->optArg.argInt < rng[ix].rmin)
+ continue; /* ranges need not be ordered. */
+ if (pOptDesc->optArg.argInt == rng[ix].rmin)
+ [= (. leave-ok-code) =];
+ if (rng[ix].rmax == LONG_MIN)
+ continue;
+ if (pOptDesc->optArg.argInt <= rng[ix].rmax)
+ [= (. leave-ok-code) =];
+ }
+
+ option_usage_fp = stderr;
+
+emit_ranges:
+ optionShowRange(pOptions, pOptDesc, (void *)rng, [= (. range-count) =]);[=
+
+(. ok-return-code) =][=
+
+ENDDEF range-option-code
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE alias-option-code \=]
+ int res = optionAlias(pOptions, pOptDesc, [=
+ (string-append INDEX-pfx (get-up-name "aliases")) =]);
+ if ((res != 0) && ((pOptions->fOptSet & OPTPROC_ERRSTOP) != 0))
+ [= (. UP-prefix) =]USAGE([=(. fail-exit-code)=]);
+[=
+
+ENDDEF alias-option-code
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE keyword-code =][=
+ (emit (tpl-file-line extract-fmt))
+
+ (set! tmp-ct (count "keyword"))
+ (if (not (exist? "arg-default"))
+ (begin
+ (set! tmp-ct (+ 1 tmp-ct))
+ (emit " static char const zDef[2] = { 0x7F, 0 };\n")
+ ) ) \=]
+ static char const * const azNames[[= (. tmp-ct) =]] = {[=
+ (emit (if (not (exist? "arg-default")) " zDef,\n" "\n"))
+ (out-push-new) =][=
+ FOR keyword =][=
+ (string-table-add-ref opt-strs (get "keyword")) =]
+[= ENDFOR =][=
+ (shell (string-append
+ "${CLexe} -S, -I8 --spread=1 <<-\\_EOF_\n" (out-pop #t) "_EOF_\nset +x" ))
+=] };
+
+ if (pOptions <= OPTPROC_EMIT_LIMIT) {
+ (void) optionEnumerationVal(pOptions, pOptDesc, azNames, [=
+ (. tmp-ct)=]);
+ return; /* protect AutoOpts client code from internal callbacks */
+ }[=
+
+ INVOKE reset-clause =][=
+
+ IF (exist? "arg-optional")
+
+=]
+
+ if (pOptDesc->optArg.argString == NULL)
+ pOptDesc->optArg.argEnum = [=
+ (string-append UP-name "_" (if (> (len "arg-optional") 0)
+ (get-up-name "arg-optional") (if (exist? "arg-default")
+ (get-up-name "arg-default")
+ "UNDEFINED" ))) =];
+ else
+ pOptDesc->optArg.argEnum =
+ optionEnumerationVal(pOptions, pOptDesc, azNames, [=(. tmp-ct)=]);[=
+
+ ELSE
+
+=]
+
+ pOptDesc->optArg.argEnum =
+ optionEnumerationVal(pOptions, pOptDesc, azNames, [=(. tmp-ct)=]);[=
+
+ ENDIF =][=
+
+ (if (exist? "flag-code[1]")
+ (emit (string-append "\n" (get "flag-code[1]"))))
+
+ =][=
+
+ENDDEF keyword-code
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE set-membership-code
+
+=][=
+
+(if (not (exist? "keyword"))
+ (error "set membership requires keywords"))
+(set! tmp-ct (count "keyword"))
+(emit (tpl-file-line extract-fmt))
+(ag-fprintf 0 " static char const * const azNames[%d] = {\n" tmp-ct)
+
+(shell (string-append
+
+ "${CLexe} -I8 --spread=2 --sep=',' -f'\"%s\"' <<_EOF_\n"
+ (join "\n" (stack "keyword"))
+ "\n_EOF_\n" )) =]
+ };[=
+
+ INVOKE reset-clause =]
+ /*
+ * This function handles special invalid values for "pOptions"
+ */
+ optionSetMembers(pOptions, pOptDesc, azNames, [= (. tmp-ct) =]);[=
+
+ (if (exist? "flag-code[1]")
+ (emit (string-append "\n" (get "flag-code[1]"))))
+
+ =][=
+
+ENDDEF set-membership-code
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE file-name-code
+
+\=]
+ static teOptFileType const type =
+ [= (set! tmp-val (get "open-file")) =][=
+ CASE file-exists =][=
+ == "" =]FTYPE_MODE_MAY_EXIST[=
+ =* "no" =]FTYPE_MODE_MUST_NOT_EXIST[=
+ * =]FTYPE_MODE_MUST_EXIST[=
+ ESAC =] + [= CASE open-file =][=
+
+ == "" =]FTYPE_MODE_NO_OPEN[=
+ =* "desc" =]FTYPE_MODE_OPEN_FD[=
+ * =]FTYPE_MODE_FOPEN_FP[=
+
+ ESAC =];
+ static tuFileMode mode;
+[= IF (or (=* tmp-val "desc") (== tmp-val "")) \=]
+[= IF (not (exist? "file-mode")) \=]
+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+#endif
+[= (define file-mode "O_CLOEXEC") =][=
+ ELSE =][=
+ (define file-mode (get "file-mode")) \=]
+[= ENDIF \=]
+ mode.file_flags = [= (. file-mode) =];
+[= ELSE \=]
+#ifndef FOPEN_BINARY_FLAG
+# define FOPEN_BINARY_FLAG
+#endif
+ mode.file_mode = [= (c-string (get "file-mode")) =] FOPEN_BINARY_FLAG;
+[= ENDIF =][=
+
+ INVOKE reset-clause =]
+ /*
+ * This function handles special invalid values for "pOptions"
+ */
+ optionFileCheck(pOptions, pOptDesc, type, mode);[=
+
+ (if (exist? "flag-code[1]")
+ (emit (string-append "\n" (get "flag-code[1]"))))
+
+ =][=
+
+ENDDEF file-name-code
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE requested-code =][=
+
+IF (not (or (exist? "extract-code") (exist? "flag-code")))
+ =][= RETURN =][=
+ENDIF =][=
+
+(if make-test-main
+ (begin
+ (set! endif-test-main
+ (sprintf "\n#endif /* defined(%s) */" main-guard))
+ (sprintf "\n\n#if ! defined(%s)" main-guard)
+) ) =][=
+
+INVOKE callback-proc-header =][=
+
+IF (out-push-new (string-append tmp-dir "/flag-code"))
+ (exist? "flag-code") =][=
+ (def-file-line "flag-code" " /* extracted from %s, line %d */\n")
+ =][=
+ (join "\n" (stack "flag-code")) =][=
+
+ELSE =][=
+
+ (extract (string-append (base-name) ".c.save") (string-append
+ "/* %s =-= " cap-name " Opt Code =-= %s */"))
+ =][=
+ENDIF =][=
+(out-pop)
+(shell "ck_flag_code") =][=
+
+ENDDEF requested-code
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE define-option-callbacks =][=
+
+ FOR flag =][=
+ (define flag-index (for-index))
+ (set-flag-names)
+ (define endif-test-main "") =][=
+
+# # # # # # # # # # # # # # # # # # =][=
+
+ IF (exist? "arg-range") =][=
+
+ INVOKE callback-proc-header =][=
+ INVOKE range-option-code =][=
+
+# # # # # # # # # # # # # # # # # # =][=
+
+ ELIF (exist? "aliases") =][=
+
+ INVOKE callback-proc-header =][=
+ INVOKE alias-option-code =][=
+
+# # # # # # # # # # # # # # # # # # =][=
+
+ ELSE =][= CASE arg-type =][=
+
+ =* key =][=
+ INVOKE callback-proc-header =][=
+ INVOKE keyword-code =][=
+
+# # # # # # # # # # # # # # # # # # =][=
+
+ =* set =][=
+
+ INVOKE callback-proc-header =][=
+ INVOKE set-membership-code =][=
+
+# # # # # # # # # # # # # # # # # # =][=
+
+ =* fil =][=
+ INVOKE callback-proc-header =][=
+ INVOKE file-name-code =][=
+
+# # # # # # # # # # # # # # # # # # =][=
+
+ * =][=
+ INVOKE requested-code =][=
+
+ ESAC =][=
+ ENDIF =][=
+
+ (. endif-test-main) =][=
+
+ ENDFOR flag =][=
+
+ENDDEF define-option-callbacks
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE emit-option-callbacks =]
+/*
+ * Create the static procedure(s) declared above.
+ */
+/**
+ * The callout function that invokes the [= (. usage-proc)
+ =] function.
+ *
+ * @param pOptions the AutoOpts option description structure
+ * @param pOptDesc the descriptor for the "help" (usage) option.
+ * @noreturn
+ */
+static void
+doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
+{[=
+ IF (exist? "resettable") =]
+ if ((pOptDesc->fOptState & OPTST_RESET) != 0)
+ return;
+[=ENDIF=][=
+ IF (exist? "usage-opt") =]
+ int ex_code = (pOptDesc->optIndex == [= (. INDEX-pfx) =]HELP)
+ ? [=(. succ-exit-code)=] : AO_EXIT_REQ_USAGE;
+ [= (string-append usage-proc "(&" pname "Options, ex_code);") =]
+ /* NOTREACHED */[=
+
+ ELSE =]
+ [= (string-append usage-proc "(&" pname "Options, " succ-exit-code ");") =]
+ /* NOTREACHED */
+ (void)pOptDesc;[=
+ ENDIF =]
+ (void)pOptions;
+}[=
+
+INVOKE define-option-callbacks =][=
+
+IF (exist? "main") =][=
+ INVOKE build-main =][=
+
+ELIF (. make-test-main) =][=
+ INVOKE build-test-main =][=
+
+ENDIF
+
+=][=
+(tpl-file-line extract-fmt)
+=][=
+
+IF (exist? "usage-message") =]
+/**
+ * Print a usage message with a format and va_list argument.
+ * The [= (. usage-proc) =] function is then invoked to print
+ * the error usage text (somewhat abbreviated) and then exit.
+ *
+ * @param[in] fmt the message format string
+ * @param[in] ap the var-arg list.
+ * @noreturn
+ */
+void
+[=(. lc-prefix)=]vusage_message(char const * fmt, va_list ap)
+{
+ char const * er_leader = _("[= prog-name =] usage error:\n");
+ fputs(er_leader, stderr);
+ vfprintf(stderr, fmt, ap);
+ [= (string-append usage-proc "(&" pname "Options, " fail-exit-code ");") =]
+ /* NOTREACHED */
+}
+
+/**
+ * Print a usage message with a format and a variable argument list.
+ * [=(. lc-prefix)=]vusage_message() is called to do the work.
+ *
+ * @param[in] fmt the message format string
+ * @param[in] ... the argument list for the message
+ * @noreturn
+ */
+void
+[=(. lc-prefix)=]usage_message(char const * fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ [=(. lc-prefix)=]vusage_message(fmt, ap);
+ /* NOTREACHED */
+ va_end(ap);
+}
+[=
+
+ENDIF have usage-message =][=
+
+IF (exist? "die-code")
+
+=]
+/**
+ * Print a fatal error message and die
+ *
+ * @param[in] exit_code the value to call exit(3) with
+ * @param[in] fmt the death rattle message
+ * @param[in] ap the argument list for the message
+ * @noreturn
+ */
+void
+[=(. lc-prefix)=]vdie(int exit_code, char const * fmt, va_list ap)
+{
+ char const * die_leader = _("[= prog-name =] fatal error:\n");[=
+ (set! tmp-text (get "die-code"))
+ (if (> (string-length tmp-text) 1)
+ (string-append "\n\n" tmp-text "\n"))
+ =]
+ fputs(die_leader, stderr);
+ vfprintf(stderr, fmt, ap);
+ fflush(stderr);
+ exit(exit_code);
+ /* NOTREACHED */
+}
+
+/**
+ * Print a fatal error message and die
+ *
+ * @param[in] exit_code the value to call exit(3) with
+ * @param[in] fmt the death rattle message
+ * @param[in] ... the list of arguments for the message
+ * @noreturn
+ */
+void
+[=(. lc-prefix)=]die(int exit_code, char const * fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vdie(exit_code, fmt, ap);
+ /* NOTREACHED */
+ va_end(ap);
+}
+
+/**
+ * Print a file system error fatal error message and die
+ *
+ * @param[in] exit_code the value to call exit(3) with.
+ * @param[in] op the operation that failed.
+ * @param[in] fname the file name the operation was on.
+ * @noreturn
+ */
+void
+[=(. lc-prefix)=]fserr(int exit_code, char const * op, char const * fname)
+{
+ char const * fserr_fmt = _("fserr %d (%s) performing '%s' on %s\n");
+ die(exit_code, fserr_fmt, errno, strerror(errno), op, fname);
+ /* NOTREACHED */
+}
+[=
+
+ENDIF die-code =][=
+
+ENDDEF emit-option-callbacks
+
+=]
diff --git a/autoopts/tpl/rc-sample.tpl b/autoopts/tpl/rc-sample.tpl
new file mode 100644
index 0000000..f01d506
--- /dev/null
+++ b/autoopts/tpl/rc-sample.tpl
@@ -0,0 +1,126 @@
+[= AutoGen5 Template rc
+
+# Time-stamp: "2011-11-21 04:52:41 bkorb"
+
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+=]
+# [= (define prog-name (get "prog-name")) prog-name =] sample configuration file
+#[=
+
+IF (if (not (exist? "homerc"))
+ (error "RC file samples only work for rc-optioned programs") )
+
+ (out-move (string-append "sample-"
+ (if (exist? "rcfile") (get "rcfile")
+ (string-append (get "prog-name") "rc") )
+ ) )
+
+ (set-writable)
+
+ (exist? "copyright")
+\=]
+# This source file is copyrighted and licensed under the following terms:
+#
+[=
+ CASE copyright.type =][=
+ == "" =][=
+ (sprintf "# %s copyright (c) %s %s - all rights reserved\n# %s"
+ prog-name (get "copyright.date") (get "copyright.owner")
+ "licensing type not specified" ) =][=
+
+ = note =][= (prefix "# " (get "copyright.text")) =][=
+
+ * =][= (license-full (get "copyright.type") prog-name "# "
+ (get "copyright.owner") (get "copyright.date")) =][=
+ ESAC =][=
+
+ENDIF "copyright exists" =][=
+
+FOR flag =][=
+
+ IF (not (or (exist? "documentation") (exist? "no-preset"))) =]
+
+# [= name =] -- [= descrip =]
+#
+[= INVOKE emit-description =]
+# Example:
+#
+#[= name =][=
+ IF (exist? "arg-type")
+ =] [= (if (exist? "arg-default") (get "arg-default")
+ (if (exist? "arg-name") (get "arg-name")
+ (get "arg-type") )) =][=
+ ENDIF (exist? "arg-type") =][=
+
+ ENDIF (not (exist? "documentation")) =][=
+
+ENDFOR flag
+
+= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =][=
+
+DEFINE emit-description =][=
+(out-push-new) =][=
+
+ IF (~* (get "arg-type") "key|set")
+=]This configuration value takes a keyword as its argument[=
+
+ IF (=* (get "arg-type") "set")
+
+=] list. Each entry turns on or off membership bits. The bits are set by [=#
+=]name or numeric value and cleared by preceding the name or number with an [=#
+=]exclamation character ('!'). [=
+
+ ELSE
+
+=]. [=
+
+ ENDIF
+
+=]The available keywords are: [=
+ (join ", " (stack "keyword")) =]. [=
+
+ ELIF (=* (get "arg-type") "num")
+ =]This configuration value takes an integer number as its argument. [=
+ IF (exist? "scaled") =]That number may be scaled with a single letter [=#
+=]suffix: k/K/m/M/g/G/t/T These will multiply the value by powers of [=#
+=]1000 (lower case) or 1024 (upper case). [=
+ ENDIF =][=
+
+ ENDIF =][=
+
+ (define fill-txt (out-pop #t))
+ (if (defined? 'fill-txt)
+ (string-append
+
+ (shell (string-append "while read line
+ do echo ${line} | fold -s -w76 | sed 's/^/# /'
+ echo '#'
+ done <<'__EndOfText__'\n" fill-txt "\n__EndOfText__" ))
+
+ "\n#\n"
+ ) ) =][=
+
+ (if (exist? "doc") (prefix "# " (get "doc"))) =][=
+
+ENDDEF emit-description
+
+=]
diff --git a/autoopts/tpl/stdoptions.def b/autoopts/tpl/stdoptions.def
new file mode 100644
index 0000000..f04fd5b
--- /dev/null
+++ b/autoopts/tpl/stdoptions.def
@@ -0,0 +1,345 @@
+
+/* -*- Mode: Text -*-
+ *
+ * Time-stamp: "2013-03-10 07:50:01 bkorb"
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+ */
+
+#ifndef NO_STD_OPT_DOC
+# ifndef HAVE_STD_OPT_DOC
+# define HAVE_STD_OPT_DOC 1
+flag = {
+ name = autoopts_std_options;
+ documentation;
+ descrip = <<- _EOF_
+ The following options are commonly used and are
+ provided and supported by AutoOpts
+ _EOF_;
+};
+# endif
+#endif
+
+#ifdef ALL_STD_OPTS
+#define BRIEF
+#define DEBUG
+#define DIRECTORY
+#define DRY_RUN
+#define INPUT
+#define INTERACTIVE
+#define OUTPUT
+#define QUIET
+#define SILENT
+#define VERBOSE
+#define WARN
+#endif
+
+#ifdef ALL_FLAG_OPTS
+#define BRIEF_FLAG
+#define DEBUG_FLAG
+#define DIRECTORY_FLAG
+#define DRY_RUN_FLAG
+#define INPUT_FLAG
+#define INTERACTIVE_FLAG
+#define OUTPUT_FLAG
+#define QUIET_FLAG
+#define SILENT_FLAG
+#define VERBOSE_FLAG
+#define WARN_FLAG
+#endif
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Levels of user entertainment
+ *
+ * DEBUG output
+ */
+#ifdef DEBUG_FLAG
+#define DEBUG
+#endif
+
+#ifdef DEBUG
+flag = {
+ name = DEBUG;
+#ifdef DEBUG_FLAG
+ value = D;
+#endif
+#ifdef DEBUG_LEVEL
+ arg-type = number;
+#endif
+ descrip = 'run program with debugging info';
+ doc =
+ "Specifying this option will cause the program to display debugging\n"
+ "information. The information should be helpful to a developer in\n"
+ "debugging this program.";
+};
+#endif
+
+/* * * * * * * *
+ *
+ * VERBOSE output
+ */
+#ifdef VERBOSE_FLAG
+#define VERBOSE 1
+#endif
+
+#ifdef VERBOSE
+flag = {
+ name = verbose;
+#ifdef VERBOSE_FLAG
+ value = V;
+#endif
+#ifdef VERBOSE_LEVEL
+ arg-type = number;
+#endif
+#ifdef VERBOSE_ENUM
+ arg-type = keyword;
+ keyword = silent, quiet, brief, informative, verbose;
+ arg-default = brief;
+#endif
+ descrip = 'run program with progress info';
+ doc =
+ "Specifying this option will cause the program to display lots of\n"
+ "progress information. You will be able to see that the program\n"
+ "is working and it may help you debug your use of the tool.";
+};
+#endif
+
+/* * * * * * * *
+ *
+ * WARNING output
+ */
+#ifdef WARN_LEVEL
+#define WARN
+#endif
+#ifdef WARN_FLAG
+#define WARN
+#endif
+
+#ifdef WARN
+flag = {
+ name = warn;
+#ifdef WARN_FLAG
+ value = w;
+#endif
+#ifdef WARN_LEVEL
+ arg-type = number;
+ descrip = 'specify a warning-level threshhold';
+ disable = no;
+ doc =
+ "Specifying this option will allow you to specify the warning level\n"
+ "for the messages you want to see. `--no-warn' will disable\n"
+ "warnings entirely.";
+#else
+ descrip = 'disable warning output';
+ doc =
+ "Specifying this option will cause the program to disable\n"
+ "warning messages.";
+#endif
+};
+#endif
+
+/* * * * * * * *
+ *
+ * BRIEF output
+ */
+#ifdef BRIEF_FLAG
+#define BRIEF
+#endif
+
+#ifdef BRIEF
+flag = {
+ name = brief;
+#ifdef BRIEF_FLAG
+ value = b;
+#endif
+ descrip = 'run with minimal info output';
+ doc =
+ "Specifying this option will cause the program to disable most progress\n"
+ "information.";
+};
+#endif
+
+/* * * * * * * *
+ *
+ * QUIET/SILENT output
+ */
+#ifdef QUIET_FLAG
+#define QUIET
+#endif
+#ifdef SILENT_FLAG
+#define SILENT
+#endif
+
+#ifdef QUIET_SILENT
+#define QUIET
+#define SILENT
+#else
+
+#ifdef QUIET
+#ifdef SILENT
+#define QUIET_SILENT
+#endif
+#endif
+#endif
+
+#ifdef QUIET
+flag = {
+ name = quiet;
+#ifdef QUIET_FLAG
+ value = q;
+#endif
+#ifdef QUIET_SILENT
+ equivalence = quiet;
+#endif
+#ifdef QUIET_LEVEL
+ arg-type = number;
+#endif
+ descrip = 'run without unnecessary output';
+ doc =
+ "Specifying this option will cause the program to disable progress\n"
+ "information.";
+};
+#endif
+
+#ifdef SILENT
+flag = {
+ name = silent;
+#ifdef SILENT_FLAG
+ value = s;
+#endif
+#ifdef QUIET_SILENT
+ equivalence = quiet;
+#endif
+#ifdef SILENT_LEVEL
+ arg-type = number;
+#endif
+ descrip = 'run without unnecessary output';
+ doc =
+ "Specifying this option will cause the program to disable progress\n"
+ "information.";
+};
+#endif
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Operational mode
+ *
+ * DRY_RUN
+ */
+#ifdef DRY_RUN_FLAG
+#define DRY_RUN
+#endif
+
+#ifdef DRY_RUN
+flag = {
+ name = DRY_RUN;
+#ifdef DRY_RUN_FLAG
+ value = R;
+#endif
+ descrip = 'program will make no changes';
+ doc =
+ "Specifying this option will cause the program to run without\n"
+ "altering any of the normal output files. Instead, it will\n"
+ "display what it would otherwise have done.";
+};
+#endif
+
+/* * * * * * * *
+ *
+ * INTERACTIVE OPERATION
+ */
+#ifdef INTERACTIVE_FLAG
+#define INTERACTIVE
+#endif
+
+#ifdef INTERACTIVE
+flag = {
+ name = interactive;
+ arg-type = string;
+#ifdef INTERACTIVE_FLAG
+ value = I; /* flag style option character */
+#endif
+ descrip = "prompt for confirmation";
+ doc =
+ "Specifying this option will cause the program to query you for\n"
+ "confirmation before doing anything destructive.";
+};
+#endif
+
+/* * * * * * * *
+ *
+ * INPUT/OUTPUT files
+ */
+#ifdef INPUT_FLAG
+#define INPUT
+#endif
+
+#ifdef INPUT
+flag = {
+ name = input;
+ arg-type = string;
+#ifdef INPUT_FLAG
+ value = i; /* flag style option character */
+#endif
+ descrip = "redirect input from file";
+ doc =
+ "This option specifies the file to use for program input.";
+};
+#endif
+
+#ifdef OUTPUT_FLAG
+#define OUTPUT
+#endif
+
+#ifdef OUTPUT
+flag = {
+ name = output;
+ arg-type = string;
+#ifdef OUTPUT_FLAG
+ value = o; /* flag style option character */
+#endif
+ descrip = "redirect output to file";
+ doc =
+ "This option specifies the file to use for program output.";
+};
+#endif
+
+/* * * * * * * *
+ *
+ * INPUT/OUTPUT directory
+ */
+#ifdef DIRECTORY_FLAG
+#define DIRECTORY
+#endif
+
+#ifdef DIRECTORY
+flag = {
+ name = directory;
+ arg-type = string;
+#ifdef DIRECTORY_FLAG
+ value = d; /* flag style option character */
+#endif
+ descrip = "use specified dir for I/O";
+ doc =
+ "This option specifies the directory to use for program input and output.";
+};
+#endif
diff --git a/autoopts/tpl/strings.tpl b/autoopts/tpl/strings.tpl
new file mode 100644
index 0000000..725726e
--- /dev/null
+++ b/autoopts/tpl/strings.tpl
@@ -0,0 +1,174 @@
+[= AutoGen5 Template c -*- Mode: scheme -*-
+
+## Time-stamp: "2012-08-11 08:20:07 bkorb"
+## Author: Bruce Korb <bkorb@gnu.org>
+
+## Copyright (C) 2011-2012 Bruce Korb, all rights reserved.
+## This is free software. It is licensed for use, modification and
+## redistribution under the terms of the
+## Modified (3 clause) Berkeley Software Distribution License
+## <http://www.xfree86.org/3.3.6/COPYRIGHT2.html>
+##
+## Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions
+## are met:
+## 1. Redistributions of source code must retain the above copyright
+## notice, this list of conditions and the following disclaimer.
+## 2. Redistributions in binary form must reproduce the above copyright
+## notice, this list of conditions and the following disclaimer in the
+## documentation and/or other materials provided with the distribution.
+## 3. Neither the name ``Bruce Korb'' nor the name of any other
+## contributor may be used to endorse or promote products derived
+## from this software without specific prior written permission.
+##
+## strings IS PROVIDED BY Bruce Korb ``AS IS'' AND ANY EXPRESS
+## OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+## WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+## ARE DISCLAIMED. IN NO EVENT SHALL Bruce Korb OR ANY OTHER CONTRIBUTORS
+## BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+## BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+## OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+## ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=]
+[= INCLUDE "tpl-config.tlib" =][=
+
+(define copy-years (shellf
+ "year=`sed -n '/Time-stamp[:]/ {
+ s/[^\"]*\"//
+ s/-.*//
+ p
+ q
+ }' %s`
+ test X$year = X2011 || year=2011-$year
+ echo $year" (tpl-file #t))) \=]
+[= INVOKE leader guard = false \=]
+[= (out-push-new (string-append (base-name) ".h")) \=]
+[= INVOKE leader guard = true =]
+[= (out-suspend "header") ;; resume defines
+ (define string-name (string->c-name! (string-append
+ (base-name) "-strtable")))
+ (string-table-new string-name)
+ (define max-name-len 0)
+ (define tmp-str "")
+ (define tmp-len 0) \=]
+#include "[= (. header-file) =]"
+[=
+
+(define str-nm "")
+(define str-val "")
+(define str-ct 0)
+(define name-ln 0)
+(define find-ln "")
+(define def-fmt "#define %%-%us (%%s)\n#define %%-%us %%d\n")
+(out-push-new) ;; temp file for #defines
+=][=
+FOR string =][=
+ (set! find-ln (string-length (get "nm" "")))
+ (if (> find-ln name-ln)
+ (set! name-ln find-ln)) =][=
+ENDFOR string =][=
+
+(if (exist? "file-name-string") (begin
+ (set! str-nm (string-upcase (string-append string-name "_file")))
+ (set! find-ln (string-length str-nm))
+ (if (> find-ln name-ln)
+ (set! name-ln find-ln))
+ (set! def-fmt (sprintf def-fmt (+ 1 name-ln) (+ 5 name-ln)))
+ (set! str-ct 1)
+ (set! str-val (string-append (base-name) ".c"))
+ (set! tmp-str (string-table-add-ref string-name str-val))
+ (ag-fprintf 0 def-fmt str-nm tmp-str
+ (string-append str-nm "_LEN") (string-length str-val))
+ )
+
+ (set! def-fmt (sprintf def-fmt (+ 1 name-ln) (+ 5 name-ln)))
+)
+
+(set! find-ln "") =][=
+
+FOR string =][=
+ (set! str-nm (get "nm"))
+ (set! str-ct (+ str-ct 1))
+ (set! str-val (get "str" str-nm))
+ (set! tmp-str (string-table-add-ref string-name str-val))
+ (if (exist? "define-line-no")
+ (set! find-ln (string-append find-ln str-nm " " tmp-str "\n")) )
+ (sprintf def-fmt str-nm tmp-str
+ (string-append str-nm "_LEN") (string-length str-val)) =][=
+ENDFOR string =][=
+
+(out-suspend "defines")
+(out-resume "header") ;; real header file
+(ag-fprintf 0
+ "/*\n * %d strings in %s string table\n */\n" str-ct string-name)
+(out-resume "defines")
+(emit (shell (string-append "sort <<\\_EOF_\n"
+ (out-pop #t) "_EOF_"))) ;; #defines now in real header file
+(emit "\n")
+(out-push-new)
+(emit-string-table string-name)
+(define str-table (out-pop #t))
+(emit (shell (string-append
+ "sed -n '/static char const/ {
+ s/static char/extern char/
+ s/ *=.*/;/
+ p
+ q
+ }' <<\\_EOF_\n"
+ str-table
+ "\n_EOF_"
+)))
+(out-suspend "header") ;; resuming text output
+(shell (string-append
+ "sed 's/^static char const/char const/' <<\\_EOF_\n"
+ str-table
+ "\n_EOF_"
+)) =][=
+
+IF (out-resume "header") ;; real header file
+ (> (string-length find-ln) 0)=]
+
+[= (out-push-new) =]
+while read nm ln
+do
+ test -z "$nm" && break
+ ln='/\* *'${ln#*+}' \*/'
+ ln=`[=(. egrep-prog)=] -n "$ln" [= (base-name) =].c`
+ nm=`echo $nm | tr '[a-z]' '[A-Z]'`_LINENO
+ printf '#define %-31s %s\n' ${nm} ${ln%%:*}
+done <<\_EOF_
+[= (. find-ln) =]_EOF_[=
+
+(shell (out-pop #t)) =][=
+ENDIF find-ln not empty =][=
+(if (exist? "header-trailer")
+ (emit (join "\n\n" "header-trailer")) ) \=]
+
+
+#endif /* [= (. header-guard) =] */
+[= (out-pop) =][=
+
+DEFINE leader \=][=
+ (emit (dne " * " "/* "))
+ (emit "\n *\n")
+ (emit (license-full "mbsd" "strings" " * " "Bruce Korb" copy-years))
+ (emit "\n */\n")
+ (if (= (get "guard") "true")
+ (emit (string-append
+ (make-header-guard "strings")
+ (if (exist? "header-leader") (string-append "\n\n"
+ (join "\n\n" "header-leader") ) "" ) ))
+ (if (exist? "code-leader")
+ (emit (string-append "\n\n" (join "\n\n" "code-leader"))) )
+ )
+=][=
+
+ENDDEF leader =][=
+(if (exist? "code-trailer")
+ (emit (join "\n\n" "code-trailer")) ) =]
+
+/* end of [= (out-name) =] */
diff --git a/autoopts/tpl/texi2man.sh b/autoopts/tpl/texi2man.sh
new file mode 100755
index 0000000..0c20cb5
--- /dev/null
+++ b/autoopts/tpl/texi2man.sh
@@ -0,0 +1,76 @@
+#! /bin/sh
+
+## texi2man.sh -- script to convert texi-isms to man page isms
+##
+## Time-stamp: "2012-05-05 08:13:04 bkorb"
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+## This "library" converts texi-isms into man-isms. It gets included
+## by the man page template at the point where texi-isms might start appearing
+## and then "emit-man-text" is invoked when all the text has been assembled.
+##
+## Display the command line prototype,
+## based only on the argument processing type.
+##
+## And run the entire output through "sed" to convert texi-isms
+
+nl='
+'
+sedcmd=
+bracket='{\([^}]*\)}'
+replB='%BACKSLASH%fB\1%BACKSLASH%fP'
+replI='%BACKSLASH%fI\1%BACKSLASH%fP'
+
+for f in code command var env dvn samp option strong
+do
+ sedcmd="${sedcmd}s;@${f}${bracket};${replB};g${nl}"
+done
+
+for f in i file emph kbd key abbr acronym email
+do
+ sedcmd="${sedcmd}s;@${f}${bracket};${replI};g${nl}"
+done
+
+sed \
+ -e "${sedcmd}" \
+ -e 's;@pxref{\([^}]*\)};see: \1;g' \
+ -e 's;@xref{\([^}]*\)};see: \1;g' \
+ -e 's/@\([{}]\)/\1/g' \
+ -e 's,^\$\*$,.br,' \
+ -e '/@ *example/,/@ *end *example/s/^/ /' \
+ -e 's/^ *@ *example/.nf/' \
+ -e 's/^ *@ *end *example/.fi/' \
+ -e '/^ *@ *noindent/d' \
+ -e '/^ *@ *enumerate/d' \
+ -e 's/^ *@ *end *enumerate/.br/' \
+ -e '/^ *@ *table/d' \
+ -e 's/^ *@ *end *table/.br/' \
+ -e 's/^@item \(.*\)/.sp\
+.IR "\1"/' \
+ -e 's/^@item/.sp 1/' \
+ -e 's/\*\([a-zA-Z0-9:~=_ -]*\)\*/%BACKSLASH%fB\1%BACKSLASH%fP/g' \
+ -e 's/``\([a-zA-Z0-9:~+=_ -]*\)'"''"'/\\(lq\1\\(rq/g' \
+ -e "s/^'/\\'/" \
+ -e 's/^@\*/.br/' \
+ -e 's/ -/ \\-/g' \
+ -e 's@^\.in \\-@.in -@' \
+ -e 's#%BACKSLASH%#\\#g'
diff --git a/autoopts/tpl/texi2mdoc.sh b/autoopts/tpl/texi2mdoc.sh
new file mode 100755
index 0000000..6c1325e
--- /dev/null
+++ b/autoopts/tpl/texi2mdoc.sh
@@ -0,0 +1,196 @@
+#! /bin/sh
+
+## texi2mdoc.sh -- script to convert texi-isms to mdoc-isms
+##
+## Time-stamp: "2012-05-13 15:45:06 bkorb"
+##
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+## This "library" converts texi-isms into man-isms. It gets included
+## by the man page template at the point where texi-isms might start appearing
+## and then "emit-man-text" is invoked when all the text has been assembled.
+##
+## Display the command line prototype,
+## based only on the argument processing type.
+##
+## And run the entire output through "sed" to convert texi-isms
+
+# /bin/sh on Solaris is too horrible for words
+#
+case "$0" in
+/bin/sh ) test -x /usr/xpg4/bin/sh && exec /usr/xpg4/bin/sh ${1+"$@"} ;;
+esac
+
+parent_pid=$$
+prog=`basename $0 .sh`
+
+die() {
+ echo "$prog error: $*" >&2
+ kill -TERM $parent_pid
+ sleep 1
+ kill -9 $parent_pid
+ sleep 1
+ exit 1
+}
+
+do_example() {
+ echo '.Bd -literal -offset indent'
+ res=0
+
+ while :
+ do
+ IFS='' read -r line || die "incomplete example"
+ case "$line" in
+ '@end '*example ) break ;;
+ esac
+
+ do_line
+ done
+ echo '.Ed'
+ return $res
+}
+
+do_noindent() {
+ return 0
+}
+
+do_enumerate() {
+ echo '.Bl -enum -compact'
+
+ while :
+ do
+ IFS='' read -r line || die "incomplete enumerate"
+ case "$line" in
+ '@end '*enumerate ) break ;;
+ esac
+
+ do_line
+ done
+ echo '.El'
+
+ return $res
+}
+
+do_end() {
+ die "Improper ending: $line"
+}
+
+do_table() {
+ echo '.Bl -tag -width 8n'
+
+ while :
+ do
+ IFS='' read -r line || die "incomplete table"
+ case "$line" in
+ '@end '*table ) break ;;
+ esac
+
+ do_line
+ done
+ echo '.El'
+
+ return $res
+}
+
+do_itemize() {
+ echo '.Bl -bullet -compact'
+
+ while :
+ do
+ IFS='' read -r line || die "incomplete itemize"
+ case "$line" in
+ '@end '*itemize ) break ;;
+ esac
+
+ do_line
+ done
+ echo '.El'
+
+ return $res
+}
+
+do_item() {
+ echo "$line" | sed 's/@item/.It/'
+}
+
+do_line() {
+ case "${line}" in
+ '@subheading'* ) echo "$line" | sed 's/@subheading/.SS /' ;;
+ '@*' ) echo .br ;;
+ '' ) echo .sp ;;
+ '@'[{}]* ) echo "${line}" | sed 's/@\([{}]\)/\1/g' ;;
+ '@'* )
+ typ=`echo "$line" | egrep '@[a-z]*\{'`
+ test ${#typ} -gt 0 && echo "$line" && return 0
+ typ=`echo "$line" | sed 's/@ *//;s/[^a-z].*//'`
+ eval do_${typ} || die "do_${typ} failed"
+ ;;
+
+ * )
+ echo "$line"
+ ;;
+ esac
+ return 0
+}
+
+
+nl='
+'
+sedcmd=
+bracket='{\([^}]*\)}'
+replB='%BACKSLASH%fB\1%BACKSLASH%fP'
+replI='%BACKSLASH%fI\1%BACKSLASH%fP'
+
+for f in code command var env dvn samp option strong
+do
+ sedcmd="${sedcmd}s;@${f}${bracket};${replB};g${nl}"
+done
+
+for f in i file emph kbd key abbr acronym email
+do
+ sedcmd="${sedcmd}s;@${f}${bracket};${replI};g${nl}"
+done
+
+fixfont="${sedcmd}"'
+ s;@pxref{\([^}]*\)};see: \1;g
+ s;@xref{\([^}]*\)};see: \1;g
+ s/@\([{@}]\)/\1/g
+ s,^[@$]\*$,.br,
+ s/\*\([a-zA-Z0-9:~=_ -]*\)\*/\\fB\1\\fP/g
+ s/``\([a-zA-Z0-9:~+=_ -]*\)'\'\''/\\(lq\1\\(rq/g
+ s/\([^\\]\)-/\1\\-/g
+ s/\([^\\]\)-/\1\\-/g
+ /^\.Bl /s/ \\-/ -/g
+ /^\.Bd /s/ \\-/ -/g
+ /^\.in /s/ \\-/ -/g
+ s#%BACKSLASH%#\\#g'"
+ s/^'/\\\\'/
+ /^\$/d"
+readonly fixfont
+
+{
+ while IFS='' read -r line
+ do
+ do_line
+ done
+} | sed "${fixfont}"
+
+exit 0
diff --git a/autoopts/tpl/tpl-config-tlib.in b/autoopts/tpl/tpl-config-tlib.in
new file mode 100644
index 0000000..80006dc
--- /dev/null
+++ b/autoopts/tpl/tpl-config-tlib.in
@@ -0,0 +1,84 @@
+[= Autogen5 Template configuration -*- Mode: scheme -*- =]
+[=
+
+# Time-stamp: "2012-05-12 19:42:14 bkorb"
+
+# This file contains configure stuff used by various templates.
+
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+=][=
+
+(define ao-version "@AO_CURRENT@:@AO_REVISION@:@AO_AGE@")
+(define ao-template-ver "@AO_TEMPLATE_VERSION@")
+
+(define inst-prefix
+ (shell "prefix=\"@prefix@\"
+ echo \"${prefix}\""))
+
+(define exec-prefix
+ (shell "exec_prefix=\"@exec_prefix@\"
+ echo \"${exec_prefix}\""))
+
+(define inst-bin-dir
+ (shell "bindir=\"@bindir@\"
+ echo \"${bindir}\""))
+
+(define libs
+ (shell "LIBS=\"@LIBS@\"
+ echo \"${LIBS}\""))
+
+(define inc-dir
+ (shell "includedir=\"@includedir@\"
+ echo \"${includedir}\""))
+
+(define lib-dir
+ (shell "libdir=\"@libdir@\"
+ echo \"${libdir}\""))
+
+(define package
+ (shell "PACKAGE_TARNAME=\"@PACKAGE_TARNAME@\"
+ echo \"${PACKAGE_TARNAME}\""))
+
+(define data-root-dir
+ (shell "datarootdir=\"@datarootdir@\"
+ echo \"${datarootdir}\""))
+
+(define data-dir
+ (shell "datadir=\"@datadir@\"
+ echo \"${datadir}\""))
+
+(define grep-prog
+ (shell "GREP=\"@GREP@\"
+ echo \"${GREP}\""))
+
+(define egrep-prog
+ (shell "EGREP=\"@EGREP@\"
+ echo \"${EGREP}\""))
+
+(define fgrep-prog
+ (shell "FGREP=\"@FGREP@\"
+ echo \"${FGREP}\""))
+
+(define top-build-dir (shell "\\cd .. >/dev/null ; pwd"))
+(define pkgdatadir (shell "echo \"${datadir}/${package}\""))
+(setenv "SHELL" "@POSIX_SHELL@")
+;;; \=]
diff --git a/autoopts/tpl/usage-txt.tpl b/autoopts/tpl/usage-txt.tpl
new file mode 100644
index 0000000..fad1a0d
--- /dev/null
+++ b/autoopts/tpl/usage-txt.tpl
@@ -0,0 +1,199 @@
+[= AutoGen5 Template
+
+ h pot
+
+(define time-stamp "2012-02-18 10:10:47")
+
+## This file is part of AutoOpts, a companion to AutoGen.
+## AutoOpts is free software.
+## AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoOpts is available under any one of two licenses. The license
+## in use must be one of these two and the choice is under the control
+## of the user of the license.
+##
+## The GNU Lesser General Public License, version 3 or later
+## See the files "COPYING.lgplv3" and "COPYING.gplv3"
+##
+## The Modified Berkeley Software Distribution License
+## See the file "COPYING.mbsd"
+##
+## These files have the following md5sums:
+##
+## 43b91e8ca915626ed3818ffb1b71248b COPYING.gplv3
+## 06a1a2e4760c90ea5e1dad8dfaac4d39 COPYING.lgplv3
+## 66a5cedaf62c4b2637025f049f9b826f COPYING.mbsd
+
+=][= CASE (suffix) =][=
+
+== h =][=
+
+(define ref-list "")
+(define cch-ct 0)
+(dne " * " "/* ") =]
+ *
+ * This file handles all the bookkeeping required for tracking all the little
+ * tiny strings used by the AutoOpts library. There are [= (count "utxt") =]
+ * of them. This is not versioned because it is entirely internal to the
+ * library and accessed by client code only in a very well-controlled way:
+ * they may substitute translated strings using a procedure that steps through
+ * all the string pointers.
+ *
+[= (license-full "lgpl" "AutoOpts" " * " "Bruce Korb" (shell "date +1992-%Y"))
+ =]
+ */
+[=
+(make-header-guard "autoopts")
+=]
+
+#undef cch_t
+#define cch_t char const
+
+/*
+ * One structure to hold all the pointers to all the stringlets.
+ */
+typedef struct {
+ int field_ct;[=
+FOR utxt =][=
+ (if (exist? "ut-type")
+ (emit (sprintf "\n %-9s utpz_%s;"
+ (string-append (get "ut-type") "*")
+ (get "ut-name") ))
+ (set! cch-ct (+ cch-ct 1)) ) =][=
+
+ENDFOR utxt =]
+ cch_t* apz_str[ [= (. cch-ct) =] ];
+} usage_text_t;
+
+/*
+ * Declare the global structure with all the pointers to translated
+ * strings. This is then used by the usage generation procedure.
+ */
+extern usage_text_t option_usage_text;
+
+#if defined(AUTOOPTS_INTERNAL) /* DEFINE ALL THE STRINGS = = = = = */
+/*
+ * Provide a mapping from a short name to fields in this structure.
+ */[=
+
+(string-table-new "usage_txt")
+(define str-ix 0)
+(define const-list "")
+(define typed-list "")
+(set! cch-ct 0) =][=
+
+FOR utxt =]
+#define z[= (sprintf "%-20s" (get "ut-name"))
+ =] (option_usage_text.[=
+
+ IF (exist? "ut-type") =]utpz_[= ut-name =][=
+ (set! typed-list (string-append typed-list "\n" (get "ut-name"))) =][=
+ ELSE
+ =][=
+ (ag-fprintf 0 "apz_str[%3d]" cch-ct)
+ (set! cch-ct (+ 1 cch-ct))
+ =][=
+ ENDIF =])[=
+ENDFOR =]
+
+ /*
+ * First, set up the strings. Some of these are writable. These are all in
+ * English. This gets compiled into libopts and is distributed here so that
+ * xgettext (or equivalents) can extract these strings for translation.
+ */
+[=
+FOR utxt =][=
+ (if (exist? "ut-type")
+ (sprintf "\n static %-7s eng_z%s[] = %s;"
+ (get "ut-type") (get "ut-name") (kr-string (get "ut-text"))
+ )
+
+ (begin
+ (set! str-ix (string-table-add "usage_txt" (get "ut-text")))
+ (set! const-list (string-append const-list
+ (sprintf "usage_txt +%4d\n" str-ix) ))
+ ) )
+ =][=
+ENDFOR utxt =][=
+
+(emit-string-table "usage_txt")
+
+=]
+
+ /*
+ * Now, define (and initialize) the structure that contains
+ * the pointers to all these strings.
+ * Aren't you glad you don't maintain this by hand?
+ */
+ usage_text_t option_usage_text = {
+ [= (count "utxt") =],
+[= (shell (string-append
+ "CLexe=${AGexe%/agen5/*}/columns/columns
+ test -x \"${CLexe}\" || {
+ CLexe=${AGexe%/autogen}/columns
+ test -x \"${CLexe}\" || die 'columns program is not findable'
+ }
+ ${CLexe} -W84 -I4 --spread=1 -f'eng_z%s,' <<_EOF_" typed-list
+ "\n_EOF_
+ echo ' {'
+ ${CLexe} -W84 -I6 --spread=1 -S, <<_EOF_\n" const-list
+ "_EOF_" )) =]
+ }
+ };
+
+#endif /* DO_TRANSLATIONS */
+#endif /* [= (. header-guard) =] */
+[=
+
+
+== pot
+
+
+\=]
+# Automated Option parsing usage text.
+# copyright (c) [=`date +1999-%Y`=] by Bruce Korb - all rights reserved
+# This file is distributed under the same license as the AutoOpts package.
+# Bruce Korb <bkorb@gnu.org> [=`date +%Y`=]
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: autogen [=`echo ${AG_VERSION}`=]\n"
+"Report-Msgid-Bugs-To: autogen-users@lists.sourceforge.net\n"
+"POT-Creation-Date: [=`date '+%Y-%m-%d %H:%M%z'`=]\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+[=
+
+FOR utxt
+ =][=
+ (set! ref-list (shellf
+ "list=`grep -n -w z%s *.c [agpo]*.h tpl/opt*.t* | \\
+ sed -n 's/\\([^:]*:[^:]*\\):.*/\\1/p'`
+ echo ${list}" (get "ut-name")))
+
+ (if (< (string-length ref-list) 2)
+ (error (sprintf "No references to z%s string" (get "ut-name"))) )
+
+ (sprintf "\n#: %s\nmsgid %s\n" ref-list (c-string (get "ut-text")))
+
+ =][=
+ENDFOR utxt
+
+=]
+[=
+
+ESAC
+
+# Local Variables:
+# Mode: text
+# time-stamp-format: "\"%:y-%02m-%02d %02H:%02M:%02S\""
+# time-stamp-pattern: "(define time-stamp "
+# time-stamp-end: ")"
+# End:
+
+\=]
diff --git a/autoopts/tpl/usage.tlib b/autoopts/tpl/usage.tlib
new file mode 100644
index 0000000..91bb239
--- /dev/null
+++ b/autoopts/tpl/usage.tlib
@@ -0,0 +1,207 @@
+[= AutoGen5 Template -*- Mode: shell-script -*-
+
+ help-text
+
+# This file is part of AutoGen.
+# AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+#
+# AutoGen is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# AutoGen is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+=][= INCLUDE "tpl-config.tlib" =][=
+
+ ;; This template is designed to emit help text from the current set
+ ;; of option definitions.
+ ;;
+ (make-tmp-dir)
+ (out-push-new (shellf "echo ${tmp_dir}/%s.def" (get "prog-name")))
+ (define emit-def (lambda (vname)
+ (if (exist? vname)
+ (sprintf "\n%s = %s;" vname (kr-string (get vname))) ) ))
+=]
+AutoGen Definitions options.tpl;
+no-libopts;
+[=
+
+FOR var IN prog-name prog-title argument
+ environrc export homerc include
+ long-opts rcfile version detail
+ explain package preserve-case prog-desc
+ opts-ptr gnu-usage reorder-args usage-opt
+
+ version-value help-value more-help-value
+ save-opts-value usage-value load-opts-value
+ =][=
+ (emit-def (get "var")) =][=
+ENDFOR var IN .... =][=
+
+IF (exist? "config-header") =]
+config-header = '[= prog-name =]-config.h';[=
+ENDIF =][=
+
+FOR copyright =]
+copyright = {[=
+
+ FOR var IN date owner type text author eaddr
+ =][=
+ (emit-def (get "var")) =][=
+ ENDFOR var IN .... =]
+};[=
+ENDFOR copyright =]
+
+main = { main-type = shell-process; };
+[=
+
+FOR flag
+
+=]
+flag = {[=
+
+ FOR var IN name descrip value max min must-set enable disable enabled
+ ifdef ifndef no-preset settable equivalence documentation
+ immediate immed-disable also
+ arg-type arg-optional arg-default default arg-range
+ stack-arg unstack-arg
+ =][=
+ (emit-def (get "var")) =][=
+ ENDFOR var IN .... =][=
+
+ IF (exist? "keyword") =]
+ keyword = '[= (join "', '" (stack "keyword")) =]';[=
+ ENDIF keyword exists =][=
+
+ IF (exist? "flags-must") =]
+ flags-must = '[= (join "', '" (stack "flags-must")) =]';[=
+ ENDIF flags-must exists =][=
+
+ IF (exist? "flags-cant") =]
+ flags-cant = '[= (join "', '" (stack "flags-cant")) =]';[=
+ ENDIF flags-cant exists =]
+};[=
+
+ENDFOR flag =][=
+
+(out-pop)
+(out-push-new) \=]
+# redirect stdout. We see this IFF there is a problem
+#
+redirect_log=${tmp_dir}/redirected.log
+exec 8>&1 9>&2 1> ${redirect_log} 2>&1
+redirect_die() {
+ exec 2>&9 1>&9 9>&- 8>&-
+ cat ${redirect_log}
+ die "$@"
+}
+
+inc_list="-I${PWD} -I[=(. inc-dir)=]"
+cfg_ldflags="[=(. libs)=]"
+cfg_cflags=${CFLAGS}
+exe=${tmp_dir}/[= prog-name =]
+[= # START-BUILDTREE-ISMS:
+
+# The following code is sedded away in install-hook.sh.
+# The goal is to remove build tree-isms when installing this file.
+
+\=]
+test -z "${top_builddir}" && ldflags='' || \
+ ldflags=`exec 2>/dev/null
+ find ${top_builddir}/autoopts -name "libopts*.${OBJEXT}" | head -1`
+
+test -f "${ldflags}" || {
+ ldflags='[=(. lib-dir)=]/libopts.a'
+ test -f "${ldflags}" || redirect_die "Cannot locate libopts.a"
+}
+ldflags="$ldflags ${cfg_ldflags}"
+test -d "${top_builddir}" && \
+ inc_list="-I${top_builddir} -I${top_builddir}/autoopts ${inc_list}"
+test -d "${top_srcdir}" && \
+ inc_list="-I${top_srcdir}/autoopts ${inc_list}"
+
+[= # END-BUILDTREE-ISMS the following code is for installed version:
+
+test -x "${AGexe}" || redirect_die "AGexe is invalid: ${AGexe}"
+aocfg=`dirname ${AGexe}`/autoopts-config
+test -x "$aocfg" || redirect_die "missing $ag"
+ldflags="${cfg_ldflags} `${aocfg} ldflags`"
+cfg_cflags="${cfg_cflags} `${aocfg} cflags`"
+
+# END-INSTALL-ONLY-CODE \=]
+[= IF (exist? "config-header") \=]
+inc_list="-I${tmp_dir} ${inc_list}"
+while :
+do
+ h='[= config-header =]'
+ test -f "$h" && break
+ hdr=$h
+ h=`basename "${hdr}"`
+ test -f "$h" && break
+ g=$h
+ d=`pwd`
+
+ while :
+ do
+ d=`dirname $d`
+ test "X$d" = X/ && \
+ redirect_die "cannot locate [= config-header =]"
+ h="$d/$g"
+ test -f "$h" && break
+ h="$d/$hdr"
+ test -f "$h" && break
+ done
+ break
+done
+cp "${h}" ${exe}-config.h
+[= ENDIF \=]
+flags="-DTEST_[= (string-upcase! (string->c-name! (get "prog-name")))
+ =]_OPTS=1 ${inc_list} ${cfg_cflags}"
+cd ${tmp_dir}
+${AGexe} -Toptions.tpl [= prog-name =].def || \
+ redirect_die "Cannot gen [= prog-name =]"
+cd -
+${CC:-cc} ${flags} -g -o TMPexe$$ ${exe}.c ${ldflags} || \
+ redirect_die cannot compile ${exe}.c
+mv -f TMPexe$$ ${exe}
+exec 1>&8 2>&9 9>&- 8>&-
+
+${exe} [=
+
+ (if (== (get "usage-type") "short")
+ (if (exist? "usage-opt")
+ (if (exist? "long-opts")
+ "--usage"
+ (string-append "-" (get "usage-value" "u"))
+ )
+ "--give-me-short-usage 2>&1 | sed -e '/: illegal option /d'"
+ )
+ (if (exist? "long-opts")
+ "--help"
+ (string-append "-" (get "help-value" "?"))
+ ) ) =] || \
+ die "cannot obtain ${exe} help in ${tmp_dir}"[=
+
+(shell (out-pop #t))
+
+=]
+[=
+
+## Local Variables:
+## Mode: shell-script
+## indent-tabs-mode: nil
+## sh-basic-offset: 4
+## sh-indent-after-do: 4
+## sh-indentation: 4
+## sh-indent-for-case-label: 0
+## sh-indent-for-case-alt: 4
+## End:
+
+# end of usage.tlib \=]
diff --git a/autoopts/usage.c b/autoopts/usage.c
new file mode 100644
index 0000000..ebdc46a
--- /dev/null
+++ b/autoopts/usage.c
@@ -0,0 +1,1053 @@
+
+/*
+ * \file usage.c
+ *
+ * Time-stamp: "2012-03-31 19:19:26 bkorb"
+ *
+ * This module implements the default usage procedure for
+ * Automated Options. It may be overridden, of course.
+ *
+ * Sort options:
+ --start=END-[S]TATIC-FORWARD --patt='^/\*($|[^:])' \
+ --out=xx.c key='^[a-zA-Z0-9_]+\(' --trail='^/\*:' \
+ --spac=2 --input=usage.c
+ */
+
+/*
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+#define OPTPROC_L_N_S (OPTPROC_LONGOPT | OPTPROC_SHORTOPT)
+
+/* = = = START-STATIC-FORWARD = = = */
+static inline bool
+do_gnu_usage(tOptions * pOpts);
+
+static inline bool
+skip_misuse_usage(tOptions * pOpts);
+
+static void
+print_usage_details(tOptions * opts, int exit_code);
+
+static void
+prt_conflicts(tOptions * pOptions, tOptDesc * pOD);
+
+static void
+prt_one_vendor(tOptions * pOptions, tOptDesc * pOD,
+ arg_types_t * pAT, char const * usefmt);
+
+static void
+prt_vendor_opts(tOptions * pOpts, char const * pOptTitle);
+
+static void
+prt_extd_usage(tOptions * pOpts, tOptDesc * pOD,
+ char const * pOptTitle);
+
+static void
+prt_ini_list(char const * const * papz, bool * pInitIntro,
+ char const * pzRc, char const * pzPN);
+
+static void
+prt_preamble(tOptions * pOptions, tOptDesc * pOD, arg_types_t * pAT);
+
+static void
+prt_one_usage(tOptions * pOptions, tOptDesc * pOD, arg_types_t * pAT);
+
+static void
+prt_opt_usage(tOptions * pOpts, int ex_code, char const * pOptTitle);
+
+static void
+prt_prog_detail(tOptions* pOptions);
+
+static int
+setGnuOptFmts(tOptions* pOpts, tCC** ppT);
+
+static int
+setStdOptFmts(tOptions* pOpts, tCC** ppT);
+/* = = = END-STATIC-FORWARD = = = */
+
+/*
+ * NB: no entry may be a prefix of another entry
+ */
+#define AOFLAG_TABLE \
+ _aof_(gnu, OPTPROC_GNUUSAGE ) \
+ _aof_(autoopts, ~OPTPROC_GNUUSAGE) \
+ _aof_(no_misuse_usage, OPTPROC_MISUSE ) \
+ _aof_(misuse_usage, ~OPTPROC_MISUSE )
+
+LOCAL void
+set_usage_flags(tOptions * opts, char const * flg_txt)
+{
+ typedef struct {
+ size_t fnm_len;
+ uint32_t fnm_mask;
+ char const * fnm_name;
+ } ao_flag_names_t;
+
+# define _aof_(_n, _f) AOUF_ ## _n ## _ID,
+ typedef enum { AOFLAG_TABLE AOUF_COUNT } ao_flag_id_t;
+# undef _aof_
+
+# define _aof_(_n, _f) AOUF_ ## _n = (1 << AOUF_ ## _n ## _ID),
+ typedef enum { AOFLAG_TABLE } ao_flags_t;
+# undef _aof_
+
+# define _aof_(_n, _f) { sizeof(#_n)-1, _f, #_n },
+ static ao_flag_names_t const fn_table[AOUF_COUNT] = {
+ AOFLAG_TABLE
+ };
+# undef _aof_
+
+ unsigned int flg = (ao_flags_t)0;
+
+ if (flg_txt == NULL) {
+ flg_txt = getenv("AUTOOPTS_USAGE");
+ if (flg_txt == NULL) return;
+ }
+
+ flg_txt = SPN_WHITESPACE_CHARS(flg_txt);
+ if (*flg_txt == NUL)
+ return;
+
+ for (;;) {
+ int ix = 0;
+ ao_flag_names_t const * fnt = fn_table;
+
+ for (;;) {
+ if (strneqvcmp(flg_txt, fnt->fnm_name, fnt->fnm_len) == 0)
+ break;
+ if (++ix >= AOUF_COUNT)
+ return;
+ fnt++;
+ }
+
+ /*
+ * Make sure we have a full match. Look for whitespace,
+ * a comma, or a NUL byte.
+ */
+ if (! IS_END_LIST_ENTRY_CHAR(flg_txt[fnt->fnm_len]))
+ return;
+
+ flg |= 1 << ix;
+ flg_txt = SPN_WHITESPACE_CHARS(flg_txt + fnt->fnm_len);
+
+ if (*flg_txt == NUL)
+ break;
+
+ if (*flg_txt == ',') {
+ /*
+ * skip the comma and following white space
+ */
+ flg_txt = SPN_WHITESPACE_CHARS(flg_txt + 1);
+ if (*flg_txt == NUL)
+ break;
+ }
+ }
+
+ {
+ ao_flag_names_t const * fnm = fn_table;
+
+ while (flg != 0) {
+ if ((flg & 1) != 0) {
+ if ((fnm->fnm_mask & OPTPROC_LONGOPT) != 0)
+ opts->fOptSet &= fnm->fnm_mask;
+ else opts->fOptSet |= fnm->fnm_mask;
+ }
+ flg >>= 1;
+ fnm++;
+ }
+ }
+}
+
+/*
+ * Figure out if we should try to format usage text sort-of like
+ * the way many GNU programs do.
+ */
+static inline bool
+do_gnu_usage(tOptions * pOpts)
+{
+ return (pOpts->fOptSet & OPTPROC_GNUUSAGE) ? true : false;
+}
+
+/*
+ * Figure out if we should try to format usage text sort-of like
+ * the way many GNU programs do.
+ */
+static inline bool
+skip_misuse_usage(tOptions * pOpts)
+{
+ return (pOpts->fOptSet & OPTPROC_MISUSE) ? true : false;
+}
+
+
+/*=export_func optionOnlyUsage
+ *
+ * what: Print usage text for just the options
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + int + ex_code + exit code for calling exit(3) +
+ *
+ * doc:
+ * This routine will print only the usage for each option.
+ * This function may be used when the emitted usage must incorporate
+ * information not available to AutoOpts.
+=*/
+void
+optionOnlyUsage(tOptions * pOpts, int ex_code)
+{
+ char const * pOptTitle = NULL;
+
+ set_usage_flags(pOpts, NULL);
+ if ((ex_code != EXIT_SUCCESS) &&
+ skip_misuse_usage(pOpts))
+ return;
+
+ /*
+ * Determine which header and which option formatting strings to use
+ */
+ if (do_gnu_usage(pOpts))
+ (void)setGnuOptFmts(pOpts, &pOptTitle);
+ else
+ (void)setStdOptFmts(pOpts, &pOptTitle);
+
+ prt_opt_usage(pOpts, ex_code, pOptTitle);
+
+ fflush(option_usage_fp);
+ if (ferror(option_usage_fp) != 0) {
+ fputs(zOutputFail, stderr);
+ exit(EXIT_FAILURE);
+ }
+}
+
+static void
+print_usage_details(tOptions * opts, int exit_code)
+{
+ {
+ char const * pOptTitle = NULL;
+
+ /*
+ * Determine which header and which option formatting strings to use
+ */
+ if (do_gnu_usage(opts)) {
+ int flen = setGnuOptFmts(opts, &pOptTitle);
+ sprintf(line_fmt_buf, zFmtFmt, flen);
+ fputc(NL, option_usage_fp);
+ }
+ else {
+ int flen = setStdOptFmts(opts, &pOptTitle);
+ sprintf(line_fmt_buf, zFmtFmt, flen);
+
+ /*
+ * When we exit with EXIT_SUCCESS and the first option is a doc
+ * option, we do *NOT* want to emit the column headers.
+ * Otherwise, we do.
+ */
+ if ( (exit_code != EXIT_SUCCESS)
+ || ((opts->pOptDesc->fOptState & OPTST_DOCUMENT) == 0) )
+
+ fputs(pOptTitle, option_usage_fp);
+ }
+
+ prt_opt_usage(opts, exit_code, pOptTitle);
+ }
+
+ /*
+ * Describe the mechanics of denoting the options
+ */
+ switch (opts->fOptSet & OPTPROC_L_N_S) {
+ case OPTPROC_L_N_S: fputs(zFlagOkay, option_usage_fp); break;
+ case OPTPROC_SHORTOPT: break;
+ case OPTPROC_LONGOPT: fputs(zNoFlags, option_usage_fp); break;
+ case 0: fputs(zOptsOnly, option_usage_fp); break;
+ }
+
+ if ((opts->fOptSet & OPTPROC_NUM_OPT) != 0)
+ fputs(zNumberOpt, option_usage_fp);
+
+ if ((opts->fOptSet & OPTPROC_REORDER) != 0)
+ fputs(zReorder, option_usage_fp);
+
+ if (opts->pzExplain != NULL)
+ fputs(opts->pzExplain, option_usage_fp);
+
+ /*
+ * IF the user is asking for help (thus exiting with SUCCESS),
+ * THEN see what additional information we can provide.
+ */
+ if (exit_code == EXIT_SUCCESS)
+ prt_prog_detail(opts);
+
+ /*
+ * Give bug notification preference to the packager information
+ */
+ if (HAS_pzPkgDataDir(opts) && (opts->pzPackager != NULL))
+ fputs(opts->pzPackager, option_usage_fp);
+
+ else if (opts->pzBugAddr != NULL)
+ fprintf(option_usage_fp, zPlsSendBugs, opts->pzBugAddr);
+
+ fflush(option_usage_fp);
+
+ if (ferror(option_usage_fp) != 0) {
+ fputs(zOutputFail, stderr);
+ exit(EXIT_FAILURE);
+ }
+}
+
+
+/*=export_func optionUsage
+ * private:
+ *
+ * what: Print usage text
+ * arg: + tOptions* + pOptions + program options descriptor +
+ * arg: + int + exitCode + exit code for calling exit(3) +
+ *
+ * doc:
+ * This routine will print usage in both GNU-standard and AutoOpts-expanded
+ * formats. The descriptor specifies the default, but AUTOOPTS_USAGE will
+ * over-ride this, providing the value of it is set to either "gnu" or
+ * "autoopts". This routine will @strong{not} return.
+ *
+ * If "exitCode" is "AO_EXIT_REQ_USAGE" (normally 64), then output will to
+ * to stdout and the actual exit code will be "EXIT_SUCCESS".
+=*/
+void
+optionUsage(tOptions * pOptions, int usage_exit_code)
+{
+ int exit_code = (usage_exit_code == AO_EXIT_REQ_USAGE)
+ ? EXIT_SUCCESS : usage_exit_code;
+
+ displayEnum = false;
+
+ /*
+ * Paged usage will preset option_usage_fp to an output file.
+ * If it hasn't already been set, then set it to standard output
+ * on successful exit (help was requested), otherwise error out.
+ *
+ * Test the version before obtaining pzFullUsage or pzShortUsage.
+ * These fields do not exist before revision 30.
+ */
+ {
+ char const * pz;
+
+ if (exit_code == EXIT_SUCCESS) {
+ pz = (pOptions->structVersion >= 30 * 4096)
+ ? pOptions->pzFullUsage : NULL;
+
+ if (option_usage_fp == NULL)
+ option_usage_fp = stdout;
+ } else {
+ pz = (pOptions->structVersion >= 30 * 4096)
+ ? pOptions->pzShortUsage : NULL;
+
+ if (option_usage_fp == NULL)
+ option_usage_fp = stderr;
+ }
+
+ if (pz != NULL) {
+ fputs(pz, option_usage_fp);
+ exit(exit_code);
+ }
+ }
+
+ fprintf(option_usage_fp, pOptions->pzUsageTitle, pOptions->pzProgName);
+ set_usage_flags(pOptions, NULL);
+
+ if ((exit_code == EXIT_SUCCESS) ||
+ (! skip_misuse_usage(pOptions)))
+
+ print_usage_details(pOptions, usage_exit_code);
+
+ exit(exit_code);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * PER OPTION TYPE USAGE INFORMATION
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * print option conflicts.
+ *
+ * @param pOptions the program option descriptor
+ * @param pOD the option descriptor
+ * @param pAT names of the option argument types
+ */
+static void
+prt_conflicts(tOptions * pOptions, tOptDesc * pOD)
+{
+
+ fputs(zTabHyp, option_usage_fp);
+
+ /*
+ * REQUIRED:
+ */
+ if (pOD->pOptMust != NULL) {
+ const int* pOptNo = pOD->pOptMust;
+
+ fputs(zReqThese, option_usage_fp);
+ for (;;) {
+ fprintf(option_usage_fp, zTabout,
+ pOptions->pOptDesc[*pOptNo].pz_Name);
+ if (*++pOptNo == NO_EQUIVALENT)
+ break;
+ }
+
+ if (pOD->pOptCant != NULL)
+ fputs(zTabHypAnd, option_usage_fp);
+ }
+
+ /*
+ * CONFLICTS:
+ */
+ if (pOD->pOptCant != NULL) {
+ const int* pOptNo = pOD->pOptCant;
+
+ fputs(zProhib, option_usage_fp);
+ for (;;) {
+ fprintf(option_usage_fp, zTabout,
+ pOptions->pOptDesc[*pOptNo].pz_Name);
+ if (*++pOptNo == NO_EQUIVALENT)
+ break;
+ }
+ }
+}
+
+/**
+ * Print the usage information for a single vendor option.
+ *
+ * @param pOpts the program option descriptor
+ * @param pOD the option descriptor
+ * @param pAT names of the option argument types
+ */
+static void
+prt_one_vendor(tOptions * pOptions, tOptDesc * pOD,
+ arg_types_t * pAT, char const * usefmt)
+{
+ prt_preamble(pOptions, pOD, pAT);
+
+ {
+ char z[ 80 ];
+ char const * pzArgType;
+
+ /*
+ * Determine the argument type string first on its usage, then,
+ * when the option argument is required, base the type string on the
+ * argument type.
+ */
+ if (pOD->fOptState & OPTST_ARG_OPTIONAL) {
+ pzArgType = pAT->pzOpt;
+
+ } else switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
+ case OPARG_TYPE_NONE: pzArgType = pAT->pzNo; break;
+ case OPARG_TYPE_ENUMERATION: pzArgType = pAT->pzKey; break;
+ case OPARG_TYPE_FILE: pzArgType = pAT->pzFile; break;
+ case OPARG_TYPE_MEMBERSHIP: pzArgType = pAT->pzKeyL; break;
+ case OPARG_TYPE_BOOLEAN: pzArgType = pAT->pzBool; break;
+ case OPARG_TYPE_NUMERIC: pzArgType = pAT->pzNum; break;
+ case OPARG_TYPE_HIERARCHY: pzArgType = pAT->pzNest; break;
+ case OPARG_TYPE_STRING: pzArgType = pAT->pzStr; break;
+ case OPARG_TYPE_TIME: pzArgType = pAT->pzTime; break;
+ default: goto bogus_desc;
+ }
+
+ pzArgType = SPN_WHITESPACE_CHARS(pzArgType);
+ if (*pzArgType == NUL)
+ snprintf(z, sizeof(z), "%s", pOD->pz_Name);
+ else
+ snprintf(z, sizeof(z), "%s=%s", pOD->pz_Name, pzArgType);
+ fprintf(option_usage_fp, usefmt, z, pOD->pzText);
+
+ switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
+ case OPARG_TYPE_ENUMERATION:
+ case OPARG_TYPE_MEMBERSHIP:
+ displayEnum = (pOD->pOptProc != NULL) ? true : displayEnum;
+ }
+ }
+
+ return;
+
+bogus_desc:
+ fprintf(stderr, zInvalOptDesc, pOD->pz_Name);
+ exit(EX_SOFTWARE);
+}
+
+/**
+ * Print the long options processed with "-W". These options will be the
+ * ones that do *not* have flag characters.
+ *
+ * @param pOptions the program option descriptor
+ * @param pOD the option descriptor
+ */
+static void
+prt_vendor_opts(tOptions * pOpts, char const * pOptTitle)
+{
+ static unsigned int const not_vended_mask =
+ OPTST_NO_USAGE_MASK | OPTST_DOCUMENT;
+
+ static char const vfmtfmt[] = "%%-%us %%s\n";
+ char vfmt[sizeof(vfmtfmt)];
+
+ /*
+ * Only handle client specified options. The "vendor option" follows
+ * "presetOptCt", so we won't loop/recurse indefinitely.
+ */
+ int ct = pOpts->presetOptCt;
+ tOptDesc * pOD = pOpts->pOptDesc;
+ size_t nmlen = 0;
+
+ fprintf(option_usage_fp, zTabout, zVendOptsAre);
+
+ do {
+ size_t l;
+ if ( ((pOD->fOptState & not_vended_mask) != 0)
+ || IS_GRAPHIC_CHAR(pOD->optValue))
+ continue;
+
+ l = strlen(pOD->pz_Name);
+ if (l > nmlen) nmlen = l;
+ } while (pOD++, (--ct > 0));
+
+ sprintf(vfmt, vfmtfmt, (unsigned int)nmlen + 4);
+ ct = pOpts->presetOptCt;
+ pOD = pOpts->pOptDesc;
+
+ do {
+ if ( ((pOD->fOptState & not_vended_mask) != 0)
+ || IS_GRAPHIC_CHAR(pOD->optValue))
+ continue;
+
+ prt_one_vendor(pOpts, pOD, &argTypes, vfmt);
+ prt_extd_usage(pOpts, pOD, pOptTitle);
+
+ } while (pOD++, (--ct > 0));
+}
+
+/**
+ * Print extended usage. Usage/help was requested.
+ *
+ * @param pOptions the program option descriptor
+ * @param pOD the option descriptor
+ * @param pAT names of the option argument types
+ */
+static void
+prt_extd_usage(tOptions * pOpts, tOptDesc * pOD,
+ char const * pOptTitle)
+{
+ if ( ((pOpts->fOptSet & OPTPROC_VENDOR_OPT) != 0)
+ && (pOD->optActualValue == VENDOR_OPTION_VALUE)) {
+ prt_vendor_opts(pOpts, pOptTitle);
+ return;
+ }
+
+ /*
+ * IF there are option conflicts or dependencies,
+ * THEN print them here.
+ */
+ if ( (pOD->pOptMust != NULL)
+ || (pOD->pOptCant != NULL) )
+ prt_conflicts(pOpts, pOD);
+
+ /*
+ * IF there is a disablement string
+ * THEN print the disablement info
+ */
+ if (pOD->pz_DisableName != NULL )
+ fprintf(option_usage_fp, zDis, pOD->pz_DisableName);
+
+ /*
+ * Check for argument types that have callbacks with magical properties
+ */
+ switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
+ case OPARG_TYPE_NUMERIC:
+ /*
+ * IF the numeric option has a special callback,
+ * THEN call it, requesting the range or other special info
+ */
+ if ( (pOD->pOptProc != NULL)
+ && (pOD->pOptProc != optionNumericVal) ) {
+ (*(pOD->pOptProc))(OPTPROC_EMIT_USAGE, pOD);
+ }
+ break;
+
+ case OPARG_TYPE_FILE:
+ (*(pOD->pOptProc))(OPTPROC_EMIT_USAGE, pOD);
+ break;
+ }
+
+ /*
+ * IF the option defaults to being enabled,
+ * THEN print that out
+ */
+ if (pOD->fOptState & OPTST_INITENABLED)
+ fputs(zEnab, option_usage_fp);
+
+ /*
+ * IF the option is in an equivalence class
+ * AND not the designated lead
+ * THEN print equivalence and leave it at that.
+ */
+ if ( (pOD->optEquivIndex != NO_EQUIVALENT)
+ && (pOD->optEquivIndex != pOD->optActualIndex ) ) {
+ fprintf(option_usage_fp, zAlt,
+ pOpts->pOptDesc[ pOD->optEquivIndex ].pz_Name);
+ return;
+ }
+
+ /*
+ * IF this particular option can NOT be preset
+ * AND some form of presetting IS allowed,
+ * AND it is not an auto-managed option (e.g. --help, et al.)
+ * THEN advise that this option may not be preset.
+ */
+ if ( ((pOD->fOptState & OPTST_NO_INIT) != 0)
+ && ( (pOpts->papzHomeList != NULL)
+ || (pOpts->pzPROGNAME != NULL)
+ )
+ && (pOD->optIndex < pOpts->presetOptCt)
+ )
+
+ fputs(zNoPreset, option_usage_fp);
+
+ /*
+ * Print the appearance requirements.
+ */
+ if (OPTST_GET_ARGTYPE(pOD->fOptState) == OPARG_TYPE_MEMBERSHIP)
+ fputs(zMembers, option_usage_fp);
+
+ else switch (pOD->optMinCt) {
+ case 1:
+ case 0:
+ switch (pOD->optMaxCt) {
+ case 0: fputs(zPreset, option_usage_fp); break;
+ case NOLIMIT: fputs(zNoLim, option_usage_fp); break;
+ case 1: break;
+ /*
+ * IF the max is more than one but limited, print "UP TO" message
+ */
+ default: fprintf(option_usage_fp, zUpTo, pOD->optMaxCt); break;
+ }
+ break;
+
+ default:
+ /*
+ * More than one is required. Print the range.
+ */
+ fprintf(option_usage_fp, zMust, pOD->optMinCt, pOD->optMaxCt);
+ }
+
+ if ( NAMED_OPTS(pOpts)
+ && (pOpts->specOptIdx.default_opt == pOD->optIndex))
+ fputs(zDefaultOpt, option_usage_fp);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Figure out where all the initialization files might live.
+ * This requires translating some environment variables and
+ * testing to see if a name is a directory or a file. It's
+ * squishy, but important to tell users how to find these files.
+ */
+static void
+prt_ini_list(char const * const * papz, bool * pInitIntro,
+ char const * pzRc, char const * pzPN)
+{
+ char zPath[AG_PATH_MAX+1];
+
+ if (papz == NULL)
+ return;
+
+ fputs(zPresetIntro, option_usage_fp);
+ *pInitIntro = false;
+
+ for (;;) {
+ char const * pzPath = *(papz++);
+ char const * pzReal = zPath;
+
+ if (pzPath == NULL)
+ break;
+
+ /*
+ * Ignore any invalid paths
+ */
+ if (! optionMakePath(zPath, (int)sizeof(zPath), pzPath, pzPN))
+ pzReal = pzPath;
+
+ /*
+ * Expand paths that are relative to the executable or installation
+ * directories. Leave alone paths that use environment variables.
+ */
+ else if ((*pzPath == '$')
+ && ((pzPath[1] == '$') || (pzPath[1] == '@')))
+ pzPath = pzReal;
+
+ /*
+ * Print the name of the "homerc" file. If the "rcfile" name is
+ * not empty, we may or may not print that, too...
+ */
+ fprintf(option_usage_fp, zPathFmt, pzPath);
+ if (*pzRc != NUL) {
+ struct stat sb;
+
+ /*
+ * IF the "homerc" file is a directory,
+ * then append the "rcfile" name.
+ */
+ if ((stat(pzReal, &sb) == 0) && S_ISDIR(sb.st_mode)) {
+ fputc(DIRCH, option_usage_fp);
+ fputs(pzRc, option_usage_fp);
+ }
+ }
+
+ fputc(NL, option_usage_fp);
+ }
+}
+
+
+static void
+prt_preamble(tOptions * pOptions, tOptDesc * pOD, arg_types_t * pAT)
+{
+ /*
+ * Flag prefix: IF no flags at all, then omit it. If not printable
+ * (not allowed for this option), then blank, else print it.
+ * Follow it with a comma if we are doing GNU usage and long
+ * opts are to be printed too.
+ */
+ if ((pOptions->fOptSet & OPTPROC_SHORTOPT) == 0)
+ fputs(pAT->pzSpc, option_usage_fp);
+
+ else if (! IS_GRAPHIC_CHAR(pOD->optValue)) {
+ if ( (pOptions->fOptSet & (OPTPROC_GNUUSAGE|OPTPROC_LONGOPT))
+ == (OPTPROC_GNUUSAGE|OPTPROC_LONGOPT))
+ fputc(' ', option_usage_fp);
+ fputs(pAT->pzNoF, option_usage_fp);
+
+ } else {
+ fprintf(option_usage_fp, " -%c", pOD->optValue);
+ if ( (pOptions->fOptSet & (OPTPROC_GNUUSAGE|OPTPROC_LONGOPT))
+ == (OPTPROC_GNUUSAGE|OPTPROC_LONGOPT))
+ fputs(", ", option_usage_fp);
+ }
+}
+
+/**
+ * Print the usage information for a single option.
+ *
+ * @param pOpts the program option descriptor
+ * @param pOD the option descriptor
+ * @param pAT names of the option argument types
+ */
+static void
+prt_one_usage(tOptions * pOptions, tOptDesc * pOD, arg_types_t * pAT)
+{
+ prt_preamble(pOptions, pOD, pAT);
+
+ {
+ char z[ 80 ];
+ char const * pzArgType;
+
+ /*
+ * Determine the argument type string first on its usage, then,
+ * when the option argument is required, base the type string on the
+ * argument type.
+ */
+ if (pOD->fOptState & OPTST_ARG_OPTIONAL) {
+ pzArgType = pAT->pzOpt;
+
+ } else switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
+ case OPARG_TYPE_NONE: pzArgType = pAT->pzNo; break;
+ case OPARG_TYPE_ENUMERATION: pzArgType = pAT->pzKey; break;
+ case OPARG_TYPE_FILE: pzArgType = pAT->pzFile; break;
+ case OPARG_TYPE_MEMBERSHIP: pzArgType = pAT->pzKeyL; break;
+ case OPARG_TYPE_BOOLEAN: pzArgType = pAT->pzBool; break;
+ case OPARG_TYPE_NUMERIC: pzArgType = pAT->pzNum; break;
+ case OPARG_TYPE_HIERARCHY: pzArgType = pAT->pzNest; break;
+ case OPARG_TYPE_STRING: pzArgType = pAT->pzStr; break;
+ case OPARG_TYPE_TIME: pzArgType = pAT->pzTime; break;
+ default: goto bogus_desc;
+ }
+
+ snprintf(z, sizeof(z), pAT->pzOptFmt, pzArgType, pOD->pz_Name,
+ (pOD->optMinCt != 0) ? pAT->pzReq : pAT->pzOpt);
+
+ fprintf(option_usage_fp, line_fmt_buf, z, pOD->pzText);
+
+ switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
+ case OPARG_TYPE_ENUMERATION:
+ case OPARG_TYPE_MEMBERSHIP:
+ displayEnum = (pOD->pOptProc != NULL) ? true : displayEnum;
+ }
+ }
+
+ return;
+
+bogus_desc:
+ fprintf(stderr, zInvalOptDesc, pOD->pz_Name);
+ exit(EX_SOFTWARE);
+}
+
+/*
+ * Print out the usage information for just the options.
+ */
+static void
+prt_opt_usage(tOptions * pOpts, int ex_code, char const * pOptTitle)
+{
+ int ct = pOpts->optCt;
+ int optNo = 0;
+ tOptDesc * pOD = pOpts->pOptDesc;
+ int docCt = 0;
+
+ do {
+ /*
+ * no usage --> disallowed on command line (OPTST_NO_COMMAND), or
+ * deprecated -- strongly discouraged (OPTST_DEPRECATED), or
+ * compiled out of current object code (OPTST_OMITTED)
+ */
+ if ((pOD->fOptState & OPTST_NO_USAGE_MASK) != 0) {
+
+ /*
+ * IF this is a compiled-out option
+ * *AND* usage was requested with "omitted-usage"
+ * *AND* this is NOT abbreviated usage
+ * THEN display this option.
+ */
+ if ( (pOD->fOptState == (OPTST_OMITTED | OPTST_NO_INIT))
+ && (pOD->pz_Name != NULL)
+ && (ex_code == EXIT_SUCCESS)) {
+
+ char const * why_pz =
+ (pOD->pzText == NULL) ? zDisabledWhy : pOD->pzText;
+ prt_preamble(pOpts, pOD, &argTypes);
+ fprintf(option_usage_fp, zDisabledOpt, pOD->pz_Name, why_pz);
+ }
+
+ continue;
+ }
+
+ if ((pOD->fOptState & OPTST_DOCUMENT) != 0) {
+ if (ex_code == EXIT_SUCCESS) {
+ fprintf(option_usage_fp, argTypes.pzBrk, pOD->pzText,
+ pOptTitle);
+ docCt++;
+ }
+
+ continue;
+ }
+
+ /* Skip name only options when we have a vendor option */
+ if ( ((pOpts->fOptSet & OPTPROC_VENDOR_OPT) != 0)
+ && (! IS_GRAPHIC_CHAR(pOD->optValue)))
+ continue;
+
+ /*
+ * IF this is the first auto-opt maintained option
+ * *AND* we are doing a full help
+ * *AND* there are documentation options
+ * *AND* the last one was not a doc option,
+ * THEN document that the remaining options are not user opts
+ */
+ if ((docCt > 0) && (ex_code == EXIT_SUCCESS)) {
+ if (pOpts->presetOptCt == optNo) {
+ if ((pOD[-1].fOptState & OPTST_DOCUMENT) == 0)
+ fprintf(option_usage_fp, argTypes.pzBrk, zAuto, pOptTitle);
+
+ } else if ((ct == 1) &&
+ (pOpts->fOptSet & OPTPROC_VENDOR_OPT))
+ fprintf(option_usage_fp, argTypes.pzBrk, zVendIntro, pOptTitle);
+ }
+
+ prt_one_usage(pOpts, pOD, &argTypes);
+
+ /*
+ * IF we were invoked because of the --help option,
+ * THEN print all the extra info
+ */
+ if (ex_code == EXIT_SUCCESS)
+ prt_extd_usage(pOpts, pOD, pOptTitle);
+
+ } while (pOD++, optNo++, (--ct > 0));
+
+ fputc(NL, option_usage_fp);
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * PROGRAM DETAILS
+ */
+static void
+prt_prog_detail(tOptions* pOptions)
+{
+ bool initIntro = true;
+
+ /*
+ * Display all the places we look for config files
+ */
+ prt_ini_list(pOptions->papzHomeList, &initIntro,
+ pOptions->pzRcName, pOptions->pzProgPath);
+
+ /*
+ * Let the user know about environment variable settings
+ */
+ if ((pOptions->fOptSet & OPTPROC_ENVIRON) != 0) {
+ if (initIntro)
+ fputs(zPresetIntro, option_usage_fp);
+
+ fprintf(option_usage_fp, zExamineFmt, pOptions->pzPROGNAME);
+ }
+
+ /*
+ * IF we found an enumeration,
+ * THEN hunt for it again. Call the handler proc with a NULL
+ * option struct pointer. That tells it to display the keywords.
+ */
+ if (displayEnum) {
+ int ct = pOptions->optCt;
+ int optNo = 0;
+ tOptDesc* pOD = pOptions->pOptDesc;
+
+ fputc(NL, option_usage_fp);
+ fflush(option_usage_fp);
+ do {
+ switch (OPTST_GET_ARGTYPE(pOD->fOptState)) {
+ case OPARG_TYPE_ENUMERATION:
+ case OPARG_TYPE_MEMBERSHIP:
+ (*(pOD->pOptProc))(OPTPROC_EMIT_USAGE, pOD);
+ }
+ } while (pOD++, optNo++, (--ct > 0));
+ }
+
+ /*
+ * If there is a detail string, now is the time for that.
+ */
+ if (pOptions->pzDetail != NULL)
+ fputs(pOptions->pzDetail, option_usage_fp);
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * OPTION LINE FORMATTING SETUP
+ *
+ * The "OptFmt" formats receive three arguments:
+ * 1. the type of the option's argument
+ * 2. the long name of the option
+ * 3. "YES" or "no ", depending on whether or not the option must appear
+ * on the command line.
+ * These formats are used immediately after the option flag (if used) has
+ * been printed.
+ *
+ * Set up the formatting for GNU-style output
+ */
+static int
+setGnuOptFmts(tOptions* pOpts, tCC** ppT)
+{
+ static char const zOneSpace[] = " ";
+ int flen = 22;
+ *ppT = zNoRq_ShrtTtl;
+
+ argTypes.pzStr = zGnuStrArg;
+ argTypes.pzReq = zOneSpace;
+ argTypes.pzNum = zGnuNumArg;
+ argTypes.pzKey = zGnuKeyArg;
+ argTypes.pzKeyL = zGnuKeyLArg;
+ argTypes.pzTime = zGnuTimeArg;
+ argTypes.pzFile = zGnuFileArg;
+ argTypes.pzBool = zGnuBoolArg;
+ argTypes.pzNest = zGnuNestArg;
+ argTypes.pzOpt = zGnuOptArg;
+ argTypes.pzNo = zOneSpace;
+ argTypes.pzBrk = zGnuBreak;
+ argTypes.pzNoF = zSixSpaces;
+ argTypes.pzSpc = zThreeSpaces;
+
+ switch (pOpts->fOptSet & OPTPROC_L_N_S) {
+ case OPTPROC_L_N_S: argTypes.pzOptFmt = zGnuOptFmt; break;
+ case OPTPROC_LONGOPT: argTypes.pzOptFmt = zGnuOptFmt; break;
+ case 0: argTypes.pzOptFmt = zGnuOptFmt + 2; break;
+ case OPTPROC_SHORTOPT:
+ argTypes.pzOptFmt = zShrtGnuOptFmt;
+ zGnuStrArg[0] = zGnuNumArg[0] = zGnuKeyArg[0] = zGnuBoolArg[0] = ' ';
+ argTypes.pzOpt = " [arg]";
+ flen = 8;
+ break;
+ }
+
+ return flen;
+}
+
+
+/*
+ * Standard (AutoOpts normal) option line formatting
+ */
+static int
+setStdOptFmts(tOptions* pOpts, tCC** ppT)
+{
+ int flen = 0;
+
+ argTypes.pzStr = zStdStrArg;
+ argTypes.pzReq = zStdReqArg;
+ argTypes.pzNum = zStdNumArg;
+ argTypes.pzKey = zStdKeyArg;
+ argTypes.pzKeyL = zStdKeyLArg;
+ argTypes.pzTime = zStdTimeArg;
+ argTypes.pzFile = zStdFileArg;
+ argTypes.pzBool = zStdBoolArg;
+ argTypes.pzNest = zStdNestArg;
+ argTypes.pzOpt = zStdOptArg;
+ argTypes.pzNo = zStdNoArg;
+ argTypes.pzBrk = zStdBreak;
+ argTypes.pzNoF = zFiveSpaces;
+ argTypes.pzSpc = zTwoSpaces;
+
+ switch (pOpts->fOptSet & (OPTPROC_NO_REQ_OPT | OPTPROC_SHORTOPT)) {
+ case (OPTPROC_NO_REQ_OPT | OPTPROC_SHORTOPT):
+ *ppT = zNoRq_ShrtTtl;
+ argTypes.pzOptFmt = zNrmOptFmt;
+ flen = 19;
+ break;
+
+ case OPTPROC_NO_REQ_OPT:
+ *ppT = zNoRq_NoShrtTtl;
+ argTypes.pzOptFmt = zNrmOptFmt;
+ flen = 19;
+ break;
+
+ case OPTPROC_SHORTOPT:
+ *ppT = zReq_ShrtTtl;
+ argTypes.pzOptFmt = zReqOptFmt;
+ flen = 24;
+ break;
+
+ case 0:
+ *ppT = zReq_NoShrtTtl;
+ argTypes.pzOptFmt = zReqOptFmt;
+ flen = 24;
+ }
+
+ return flen;
+}
+
+
+/*:
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/usage.c */
diff --git a/autoopts/value-type.c b/autoopts/value-type.c
new file mode 100644
index 0000000..ff98c0a
--- /dev/null
+++ b/autoopts/value-type.c
@@ -0,0 +1,123 @@
+/* ANSI-C code produced by gperf version 3.0.4 */
+
+
+#if 0 /* gperf build options: */
+// %struct-type
+// %language=ANSI-C
+// %includes
+// %global-table
+// %omit-struct-type
+// %readonly-tables
+// %compare-strncmp
+//
+// %define slot-name vtp_name
+// %define hash-function-name value_type_hash
+// %define lookup-function-name find_value_type_name
+// %define word-array-name value_type_table
+// %define initializer-suffix ,VTP_COUNT_KWD
+#endif /* gperf build options: */
+
+#include "value-type.h"
+
+typedef struct {
+ char const * vtp_name;
+ value_type_enum_t vtp_id;
+} value_type_map_t;
+#include <string.h>
+
+/* maximum key range = 20, duplicates = 0 */
+
+#ifdef __GNUC__
+#else
+#ifdef __cplusplus
+#endif
+#endif
+inline static unsigned int
+value_type_hash (register const char *str, register unsigned int len)
+{
+ static const unsigned char asso_values[] =
+ {
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 10, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 5, 23, 23, 5, 0, 0, 23, 15, 23,
+ 23, 10, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 23
+ };
+ return len + asso_values[(unsigned char)str[2]];
+}
+
+static const value_type_map_t value_type_table[] =
+ {
+ {"",VTP_COUNT_KWD}, {"",VTP_COUNT_KWD},
+ {"",VTP_COUNT_KWD},
+ {"set", VTP_KWD_SET},
+ {"",VTP_COUNT_KWD}, {"",VTP_COUNT_KWD},
+ {"nested", VTP_KWD_NESTED},
+ {"integer", VTP_KWD_INTEGER},
+ {"",VTP_COUNT_KWD},
+ {"bool", VTP_KWD_BOOL},
+ {"",VTP_COUNT_KWD},
+ {"string", VTP_KWD_STRING},
+ {"boolean", VTP_KWD_BOOLEAN},
+ {"",VTP_COUNT_KWD},
+ {"set-membership", VTP_KWD_SET_MEMBERSHIP},
+ {"",VTP_COUNT_KWD}, {"",VTP_COUNT_KWD},
+ {"keyword", VTP_KWD_KEYWORD},
+ {"",VTP_COUNT_KWD},
+ {"hierarchy", VTP_KWD_HIERARCHY},
+ {"",VTP_COUNT_KWD}, {"",VTP_COUNT_KWD},
+ {"invalid", VTP_KWD_INVALID}
+ };
+
+#ifdef __GNUC__
+#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
+__attribute__ ((__gnu_inline__))
+#endif
+#endif
+static inline const value_type_map_t *
+find_value_type_name (register const char *str, register unsigned int len)
+{
+ if (len <= 14 && len >= 3)
+ {
+ register int key = value_type_hash (str, len);
+
+ if (key <= 22 && key >= 0)
+ {
+ register const char *s = value_type_table[key].vtp_name;
+
+ if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
+ return &value_type_table[key];
+ }
+ }
+ return 0;
+}
+
+
+value_type_enum_t
+find_value_type_id(char const * str, unsigned int len)
+{
+ const value_type_map_t * p =
+ find_value_type_name(str, len);
+ return (p == 0) ? VTP_KWD_INVALID : p->vtp_id;
+}
diff --git a/autoopts/value-type.h b/autoopts/value-type.h
new file mode 100644
index 0000000..70ff91a
--- /dev/null
+++ b/autoopts/value-type.h
@@ -0,0 +1,25 @@
+/*
+ * Generated header for gperf generated source Sat Aug 11 09:41:14 PDT 2012
+ * This file enumerates the list of names and declares the
+ * procedure for mapping string names to the enum value.
+ */
+#ifndef AUTOOPTS_VALUE_TYPE_H_GUARD
+#define AUTOOPTS_VALUE_TYPE_H_GUARD 1
+
+typedef enum {
+ VTP_KWD_INVALID,
+ VTP_KWD_STRING,
+ VTP_KWD_INTEGER,
+ VTP_KWD_BOOLEAN,
+ VTP_KWD_BOOL,
+ VTP_KWD_KEYWORD,
+ VTP_KWD_SET,
+ VTP_KWD_SET_MEMBERSHIP,
+ VTP_KWD_NESTED,
+ VTP_KWD_HIERARCHY,
+ VTP_COUNT_KWD
+} value_type_enum_t;
+
+extern value_type_enum_t
+find_value_type_id(char const * str, unsigned int len);
+#endif /* AUTOOPTS_VALUE_TYPE_H_GUARD */
diff --git a/autoopts/version.c b/autoopts/version.c
new file mode 100644
index 0000000..e91d4ec
--- /dev/null
+++ b/autoopts/version.c
@@ -0,0 +1,214 @@
+
+/*
+ * Time-stamp: "2012-08-11 08:41:53 bkorb"
+ *
+ * This module implements the default usage procedure for
+ * Automated Options. It may be overridden, of course.
+ */
+
+/*
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+/*=export_func optionVersion
+ *
+ * what: return the compiled AutoOpts version number
+ * ret_type: char const*
+ * ret_desc: the version string in constant memory
+ * doc:
+ * Returns the full version string compiled into the library.
+ * The returned string cannot be modified.
+=*/
+char const*
+optionVersion(void)
+{
+ static char const zVersion[] =
+ STR(AO_CURRENT.AO_REVISION);
+
+ return zVersion;
+}
+
+/**
+ * Select among various ways to emit version information.
+ *
+ * @param opts the option descriptor
+ * @param fp the output stream
+ */
+static void
+emit_simple_ver(tOptions * opts, FILE * fp)
+{
+ /*
+ * Use the supplied string
+ */
+ if (opts->pzFullVersion != NULL)
+ fputs(opts->pzFullVersion, fp);
+
+ /*
+ * Extract the interesting part of the copyright string
+ */
+ else if (opts->pzCopyright != NULL) {
+ char const * pe = strchr(opts->pzCopyright, NL);
+ if (pe == NULL)
+ pe = opts->pzCopyright + strlen(opts->pzCopyright);
+ fwrite(opts->pzCopyright, 1, pe - opts->pzCopyright, fp);
+ }
+
+ /*
+ * Extract the interesting part of the usage title string
+ */
+ else {
+ char const * pe = strchr(opts->pzUsageTitle, NL);
+ if (pe == NULL)
+ pe = opts->pzUsageTitle + strlen(opts->pzUsageTitle);
+ fwrite(opts->pzUsageTitle, 1, pe - opts->pzUsageTitle, fp);
+ }
+ fputc(NL, fp);
+}
+
+static void
+emit_copy_ver(tOptions * opts, FILE * fp)
+{
+ if (opts->pzCopyright != NULL)
+ fputs(opts->pzCopyright, fp);
+
+ else if (opts->pzFullVersion != NULL)
+ fputs(opts->pzFullVersion, fp);
+
+ else {
+ char const * pe = strchr(opts->pzUsageTitle, NL);
+ if (pe == NULL)
+ pe = opts->pzUsageTitle + strlen(opts->pzUsageTitle);
+ fwrite(opts->pzUsageTitle, 1, pe - opts->pzCopyright, fp);
+ }
+
+ fputc(NL, fp);
+
+ if (HAS_pzPkgDataDir(opts) && (opts->pzPackager != NULL))
+ fputs(opts->pzPackager, fp);
+
+ else if (opts->pzBugAddr != NULL)
+ fprintf(fp, zPlsSendBugs, opts->pzBugAddr);
+}
+
+static void
+emit_copy_note(tOptions * opts, FILE * fp)
+{
+ if (opts->pzCopyright != NULL) {
+ fputs(opts->pzCopyright, fp);
+ fputc(NL, fp);
+ }
+
+ if (opts->pzCopyNotice != NULL) {
+ fputs(opts->pzCopyNotice, fp);
+ fputc(NL, fp);
+ }
+
+ fprintf(fp, zAO_Ver, optionVersion());
+
+ if (HAS_pzPkgDataDir(opts) && (opts->pzPackager != NULL))
+ fputs(opts->pzPackager, fp);
+
+ else if (opts->pzBugAddr != NULL)
+ fprintf(fp, zPlsSendBugs, opts->pzBugAddr);
+}
+
+static void
+print_ver(tOptions * opts, tOptDesc * od, FILE * fp)
+{
+ char ch;
+
+ if (opts <= OPTPROC_EMIT_LIMIT)
+ return;
+
+ /*
+ * IF we have an argument for this option, use it
+ * Otherwise, default to version only or copyright note,
+ * depending on whether the layout is GNU standard form or not.
+ */
+ if ( (od->fOptState & OPTST_ARG_OPTIONAL)
+ && (od->optArg.argString != NULL)
+ && (od->optArg.argString[0] != NUL))
+
+ ch = od->optArg.argString[0];
+
+ else {
+ set_usage_flags(opts, NULL);
+ ch = (opts->fOptSet & OPTPROC_GNUUSAGE) ? 'c' : 'v';
+ }
+
+ switch (ch) {
+ case NUL: /* arg provided, but empty */
+ case 'v': case 'V': emit_simple_ver(opts, fp); break;
+ case 'c': case 'C': emit_copy_ver( opts, fp); break;
+ case 'n': case 'N': emit_copy_note( opts, fp); break;
+
+ default:
+ fprintf(stderr, zBadVerArg, ch);
+ exit(EXIT_FAILURE);
+ }
+
+ fflush(fp);
+ if (ferror(fp) != 0) {
+ fputs(zOutputFail, stderr);
+ exit(EXIT_FAILURE);
+ }
+ exit(EXIT_SUCCESS);
+}
+
+/*=export_func optionPrintVersion
+ * private:
+ *
+ * what: Print the program version
+ * arg: + tOptions* + opts + program options descriptor +
+ * arg: + tOptDesc* + od + the descriptor for this arg +
+ *
+ * doc:
+ * This routine will print the version to stdout.
+=*/
+void
+optionPrintVersion(tOptions * opts, tOptDesc * od)
+{
+ print_ver(opts, od, stdout);
+}
+
+/*=export_func optionVersionStderr
+ * private:
+ *
+ * what: Print the program version to stderr
+ * arg: + tOptions* + opts + program options descriptor +
+ * arg: + tOptDesc* + od + the descriptor for this arg +
+ *
+ * doc:
+ * This routine will print the version to stderr.
+=*/
+void
+optionVersionStderr(tOptions * opts, tOptDesc * od)
+{
+ print_ver(opts, od, stderr);
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of autoopts/version.c */
diff --git a/autoopts/xat-attribute.c b/autoopts/xat-attribute.c
new file mode 100644
index 0000000..db47531
--- /dev/null
+++ b/autoopts/xat-attribute.c
@@ -0,0 +1,114 @@
+/* ANSI-C code produced by gperf version 3.0.4 */
+
+
+#if 0 /* gperf build options: */
+// %struct-type
+// %language=ANSI-C
+// %includes
+// %global-table
+// %omit-struct-type
+// %readonly-tables
+// %compare-strncmp
+//
+// %define slot-name xat_name
+// %define hash-function-name xat_attribute_hash
+// %define lookup-function-name find_xat_attribute_name
+// %define word-array-name xat_attribute_table
+// %define initializer-suffix ,XAT_COUNT_KWD
+#endif /* gperf build options: */
+
+#include "xat-attribute.h"
+
+typedef struct {
+ char const * xat_name;
+ xat_attribute_enum_t xat_id;
+} xat_attribute_map_t;
+#include <string.h>
+
+/* maximum key range = 9, duplicates = 0 */
+
+#ifdef __GNUC__
+#else
+#ifdef __cplusplus
+#endif
+#endif
+inline static unsigned int
+xat_attribute_hash (register const char *str, register unsigned int len)
+{
+ static const unsigned char asso_values[] =
+ {
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 0,
+ 13, 13, 13, 13, 13, 5, 13, 5, 13, 0,
+ 13, 13, 13, 13, 13, 13, 0, 0, 13, 0,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13
+ };
+ return len + asso_values[(unsigned char)str[0]];
+}
+
+static const xat_attribute_map_t xat_attribute_table[] =
+ {
+ {"",XAT_COUNT_KWD}, {"",XAT_COUNT_KWD},
+ {"",XAT_COUNT_KWD}, {"",XAT_COUNT_KWD},
+ {"type", XAT_KWD_TYPE},
+ {"words", XAT_KWD_WORDS},
+ {"cooked", XAT_KWD_COOKED},
+ {"members", XAT_KWD_MEMBERS},
+ {"uncooked", XAT_KWD_UNCOOKED},
+ {"keep", XAT_KWD_KEEP},
+ {"",XAT_COUNT_KWD}, {"",XAT_COUNT_KWD},
+ {"invalid", XAT_KWD_INVALID}
+ };
+
+#ifdef __GNUC__
+#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
+__attribute__ ((__gnu_inline__))
+#endif
+#endif
+static inline const xat_attribute_map_t *
+find_xat_attribute_name (register const char *str, register unsigned int len)
+{
+ if (len <= 8 && len >= 4)
+ {
+ register int key = xat_attribute_hash (str, len);
+
+ if (key <= 12 && key >= 0)
+ {
+ register const char *s = xat_attribute_table[key].xat_name;
+
+ if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
+ return &xat_attribute_table[key];
+ }
+ }
+ return 0;
+}
+
+
+xat_attribute_enum_t
+find_xat_attribute_id(char const * str, unsigned int len)
+{
+ const xat_attribute_map_t * p =
+ find_xat_attribute_name(str, len);
+ return (p == 0) ? XAT_KWD_INVALID : p->xat_id;
+}
diff --git a/autoopts/xat-attribute.h b/autoopts/xat-attribute.h
new file mode 100644
index 0000000..ac9b595
--- /dev/null
+++ b/autoopts/xat-attribute.h
@@ -0,0 +1,22 @@
+/*
+ * Generated header for gperf generated source Sat Aug 11 09:41:14 PDT 2012
+ * This file enumerates the list of names and declares the
+ * procedure for mapping string names to the enum value.
+ */
+#ifndef AUTOOPTS_XAT_ATTRIBUTE_H_GUARD
+#define AUTOOPTS_XAT_ATTRIBUTE_H_GUARD 1
+
+typedef enum {
+ XAT_KWD_INVALID,
+ XAT_KWD_TYPE,
+ XAT_KWD_WORDS,
+ XAT_KWD_MEMBERS,
+ XAT_KWD_COOKED,
+ XAT_KWD_UNCOOKED,
+ XAT_KWD_KEEP,
+ XAT_COUNT_KWD
+} xat_attribute_enum_t;
+
+extern xat_attribute_enum_t
+find_xat_attribute_id(char const * str, unsigned int len);
+#endif /* AUTOOPTS_XAT_ATTRIBUTE_H_GUARD */
diff --git a/columns/Makefile.am b/columns/Makefile.am
new file mode 100644
index 0000000..e18853e
--- /dev/null
+++ b/columns/Makefile.am
@@ -0,0 +1,70 @@
+## -*- Mode: Makefile -*-
+##
+## Makefile.am -- process this file with automake to produce Makefile.in
+##
+## Time-stamp: "2011-03-06 14:06:37 bkorb"
+## Copyright (c) 1992-2012 by Bruce Korb
+##
+## This file is part of AutoGen.
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+bin_PROGRAMS = columns
+csrc = opts.h columns.c opts.c
+nodist_columns_SOURCES = cols.c
+
+LO_LIB = $(top_builddir)/autoopts/libopts.la
+columns_LDADD = $(LO_LIB) $(LIBGUILE_LIBS)
+
+BUILT_SOURCES = columns.menu columns.texi columns.1
+EXTRA_DIST = opts.def $(csrc)
+
+RUNAG = $(AGexe) -L$(top_srcdir)/autoopts/tpl \
+ -L$(top_builddir)/autoopts/tpl -MF$@
+man_MANS = columns.1
+
+INCLUDES = @INCLIST@
+
+CONFIG_CLEAN_FILES = $(BUILT_SOURCES) stamp-*
+MAINTAINERCLEANFILES = $(CONFIG_CLEAN_FILES)
+DISTCLEANFILES = cols.c
+
+gen : $(BUILT_SOURCES)
+
+all : gen
+
+## opts.h cannot be built until columns is built, so no rules for it.
+
+columns.menu columns.texi : stamp-agtexi
+columns.1 : stamp-agman
+
+cols.c : Makefile
+ exec > $@ ; \
+ echo '#undef PKGDATADIR' ; \
+ echo '#define PKGDATADIR "$(pkgdatadir)"' ; \
+ echo ; echo '#define DEFINING 1' ; \
+ echo '#include "autoopts/project.h"' ; \
+ for f in $(csrc) ; do echo "#include \"$$f\"" ; done
+
+stamp-agtexi : opts.def columns$(EXEEXT)
+ top_builddir=$(top_builddir) \
+ $(RUNAG) -Tagtexi-cmd.tpl -DLEVEL=section $(srcdir)/opts.def
+
+stamp-agman : opts.def columns$(EXEEXT)
+ top_builddir=$(top_builddir) \
+ $(RUNAG) -Tagman-cmd.tpl $(srcdir)/opts.def
+
+.NOTPARALLEL:
+
+# Makefile.am ends here
diff --git a/columns/Makefile.in b/columns/Makefile.in
new file mode 100644
index 0000000..0ff7c31
--- /dev/null
+++ b/columns/Makefile.in
@@ -0,0 +1,739 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+bin_PROGRAMS = columns$(EXEEXT)
+subdir = columns
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+PROGRAMS = $(bin_PROGRAMS)
+nodist_columns_OBJECTS = cols.$(OBJEXT)
+columns_OBJECTS = $(nodist_columns_OBJECTS)
+am__DEPENDENCIES_1 =
+columns_DEPENDENCIES = $(LO_LIB) $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(nodist_columns_SOURCES)
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = @AGexe@
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = @CLexe@
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+csrc = opts.h columns.c opts.c
+nodist_columns_SOURCES = cols.c
+LO_LIB = $(top_builddir)/autoopts/libopts.la
+columns_LDADD = $(LO_LIB) $(LIBGUILE_LIBS)
+BUILT_SOURCES = columns.menu columns.texi columns.1
+EXTRA_DIST = opts.def $(csrc)
+RUNAG = $(AGexe) -L$(top_srcdir)/autoopts/tpl \
+ -L$(top_builddir)/autoopts/tpl -MF$@
+
+man_MANS = columns.1
+INCLUDES = @INCLIST@
+CONFIG_CLEAN_FILES = $(BUILT_SOURCES) stamp-*
+MAINTAINERCLEANFILES = $(CONFIG_CLEAN_FILES)
+DISTCLEANFILES = cols.c
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu columns/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu columns/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+columns$(EXEEXT): $(columns_OBJECTS) $(columns_DEPENDENCIES) $(EXTRA_columns_DEPENDENCIES)
+ @rm -f columns$(EXEEXT)
+ $(LINK) $(columns_OBJECTS) $(columns_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cols.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-man1: $(man_MANS)
+ @$(NORMAL_INSTALL)
+ @list1=''; \
+ list2='$(man_MANS)'; \
+ test -n "$(man1dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.1[a-z]*$$/p'; \
+ fi; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man1dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.1[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @list='$(MANS)'; if test -n "$$list"; then \
+ list=`for p in $$list; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+ if test -n "$$list" && \
+ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+ echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \
+ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
+ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+ echo " typically 'make maintainer-clean' will remove them" >&2; \
+ exit 1; \
+ else :; fi; \
+ else :; fi
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man: install-man1
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-man
+
+uninstall-man: uninstall-man1
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool cscopelist ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-binPROGRAMS install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-man1 install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-man uninstall-man1
+
+
+gen : $(BUILT_SOURCES)
+
+all : gen
+
+columns.menu columns.texi : stamp-agtexi
+columns.1 : stamp-agman
+
+cols.c : Makefile
+ exec > $@ ; \
+ echo '#undef PKGDATADIR' ; \
+ echo '#define PKGDATADIR "$(pkgdatadir)"' ; \
+ echo ; echo '#define DEFINING 1' ; \
+ echo '#include "autoopts/project.h"' ; \
+ for f in $(csrc) ; do echo "#include \"$$f\"" ; done
+
+stamp-agtexi : opts.def columns$(EXEEXT)
+ top_builddir=$(top_builddir) \
+ $(RUNAG) -Tagtexi-cmd.tpl -DLEVEL=section $(srcdir)/opts.def
+
+stamp-agman : opts.def columns$(EXEEXT)
+ top_builddir=$(top_builddir) \
+ $(RUNAG) -Tagman-cmd.tpl $(srcdir)/opts.def
+
+.NOTPARALLEL:
+
+# Makefile.am ends here
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/columns/columns.c b/columns/columns.c
new file mode 100644
index 0000000..7819c00
--- /dev/null
+++ b/columns/columns.c
@@ -0,0 +1,769 @@
+
+/*
+ * \file columns.c
+ *
+ * Time-stamp: "2012-03-31 13:37:39 bkorb"
+ *
+ * Columns Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ * Columns is free software.
+ * This file is part of AutoGen.
+ *
+ * AutoGen copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef NUL
+# define NUL '\0'
+#endif
+
+struct print_list {
+ char** papz;
+ int index;
+};
+
+typedef struct print_list tPrintList, *tpPrintList;
+
+int maxEntryWidth = 0;
+int fillColumnCt = 0;
+
+#define LINE_LIMIT 4096
+char zLine[ LINE_LIMIT ];
+char zFmtLine[ LINE_LIMIT ];
+
+char** papzLines = (char**)NULL;
+char const * pzLinePfx = "";
+char const * pzFirstPfx = NULL;
+size_t allocCt = 0;
+size_t usedCt = 0;
+size_t columnCt = 0;
+size_t columnSz = 0;
+size_t indentSize = 0;
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+fserr_die(char const * fmt, ...);
+
+static inline void *
+malloc_or_die(size_t sz);
+
+static char const *
+construct_first_pfx(char const * f_indent);
+
+static uint32_t
+pad_indentation(char const * pzIndentArg, char const ** pfx);
+
+static void
+readLines(void);
+
+static void
+writeColumns(void);
+
+static void
+trim_last_separation(void);
+
+static void
+writeRows(void);
+
+static int
+emitWord(char const * word, size_t len, int col);
+
+static void
+writeFill(void);
+
+static int
+compProc(const void * p1, const void * p2);
+/* = = = END-STATIC-FORWARD = = = */
+
+int
+main(int argc, char ** argv)
+{
+ (void)optionProcess( &columnsOptions, argc, argv );
+
+ if (HAVE_OPT( INDENT )) {
+ indentSize = pad_indentation( OPT_ARG(INDENT), &pzLinePfx);
+ OPT_VALUE_WIDTH -= indentSize;
+
+ pzFirstPfx = HAVE_OPT(FIRST_INDENT)
+ ? construct_first_pfx( OPT_ARG(FIRST_INDENT))
+ : pzLinePfx;
+ }
+
+ if (HAVE_OPT( LINE_SEPARATION ))
+ OPT_VALUE_WIDTH -= strlen( OPT_ARG( LINE_SEPARATION ));
+
+ if (HAVE_OPT( COL_WIDTH ))
+ columnSz = OPT_VALUE_COL_WIDTH;
+
+ if (HAVE_OPT( COLUMNS ))
+ columnCt = OPT_VALUE_COLUMNS;
+
+ if (OPT_VALUE_WIDTH <= 16)
+ OPT_VALUE_WIDTH = 16;
+
+ readLines();
+
+ if (HAVE_OPT( SORT ))
+ qsort( (void*)papzLines, usedCt, sizeof( char* ), &compProc );
+
+ if (HAVE_OPT( BY_COLUMNS ))
+ writeColumns();
+ else if (HAVE_OPT(FILL))
+ writeFill();
+ else writeRows();
+
+ return EXIT_SUCCESS;
+}
+
+
+static void
+fserr_die(char const * fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ fprintf(stderr, "%s fserr %d (%s): ", columnsOptions.pzProgName,
+ errno, strerror(errno));
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(EXIT_FAILURE);
+}
+
+static inline void *
+malloc_or_die(size_t sz)
+{
+ void * res = malloc(sz);
+ if (res == NULL) {
+ errno = ENOMEM;
+ fserr_die("could not allocate %d bytes", sz);
+ }
+ return res;
+}
+
+static char const *
+construct_first_pfx(char const * f_indent)
+{
+ static char const pad_fmt[] = "%%-%ds";
+ // 24 > log10(0xFFFFFFFFFFFFFFFFULL)
+ char pfx_buf[24 + sizeof(pad_fmt)];
+ size_t firstSize = pad_indentation(f_indent, &pzFirstPfx);
+ size_t len;
+ char * res;
+
+ /*
+ * If this first line exceeds the indentation size, then we
+ * need to append a newline and any indentation.
+ */
+ if (firstSize > indentSize) {
+ size_t sep_len = HAVE_OPT(LINE_SEPARATION)
+ ? strlen( OPT_ARG(LINE_SEPARATION)) : 0;
+ len = firstSize + sep_len + indentSize + 3;
+ sprintf(pfx_buf, pad_fmt, (int)firstSize);
+ } else {
+ len = indentSize + 3;
+ sprintf(pfx_buf, pad_fmt, (int)indentSize);
+ }
+
+ res = malloc_or_die(len);
+ snprintf(res, len, pfx_buf, pzFirstPfx);
+ pzFirstPfx = res;
+
+ if (firstSize > indentSize) {
+ char * p = res + firstSize;
+
+ if (HAVE_OPT( LINE_SEPARATION )) {
+ len = strlen(OPT_ARG(LINE_SEPARATION));
+ memcpy(p, OPT_ARG(LINE_SEPARATION), len);
+ p += len;
+ }
+
+ sprintf(p, "\n%s", pzLinePfx);
+ }
+
+ return res;
+}
+
+static uint32_t
+pad_indentation(char const * pzIndentArg, char const ** pfx)
+{
+ char * pz;
+ unsigned int cct;
+
+ errno = 0;
+ cct = (unsigned int)strtoul(pzIndentArg, &pz, 0);
+
+ /*
+ * IF the indent argument is a number
+ */
+ if ((*pz == NUL) && (errno == 0) && (cct < OPT_VALUE_WIDTH)) {
+ char * p;
+
+ /*
+ * Allocate a string to hold the line prefix
+ */
+ *pfx = p = malloc_or_die( (size_t)cct + 1 );
+
+ /*
+ * Set it to a NUL terminated string of spaces
+ */
+ if (cct > 0)
+ memset(p, ' ', (size_t)cct);
+ p[cct] = NUL;
+
+ } else {
+ /*
+ * Otherwise, set the line prefix to whatever the string is.
+ * It will not be the empty string because that is handled
+ * as an indent count of zero and is ignored.
+ */
+ char const * p = pzIndentArg;
+ *pfx = pzIndentArg;
+ cct = 0;
+
+ for (;;) {
+ /*
+ * Compute the length of the last line of the prefix.
+ */
+ switch (*p++) {
+ case NUL:
+ goto colsCounted;
+
+ case '\t':
+ cct += OPT_VALUE_TAB_WIDTH;
+ cct -= (cct % OPT_VALUE_TAB_WIDTH);
+ break;
+
+ case '\n':
+ case '\f':
+ case '\r':
+ cct = 0;
+ break;
+
+ default:
+ cct++;
+ break;
+
+ case '\a':
+ break;
+ }
+ } colsCounted:;
+ }
+
+ return cct;
+}
+
+
+static void
+readLines(void)
+{
+ int sepLen;
+
+ if (HAVE_OPT(SEPARATION))
+ sepLen = strlen(OPT_ARG(SEPARATION));
+ else sepLen = 0;
+
+
+ /*
+ * Read the input text, stripping trailing white space
+ */
+ for (;;) {
+ char* pzL;
+ char* pzText = fgets(zLine, (int)sizeof( zLine ), stdin);
+ size_t len;
+
+ if (pzText == NULL)
+ break;
+
+ /*
+ * Trim off trailing white space.
+ */
+ len = strlen( pzText );
+ pzText += len;
+ while (isspace(pzText[-1])) {
+ if (--pzText == zLine) {
+ if (HAVE_OPT(FILL))
+ break;
+ goto next_line;
+ }
+ len--;
+ }
+
+ *pzText = NUL;
+
+ /*
+ * IF the input lines are to be reformatted,
+ * THEN the length is the result of the sprintf
+ * Else, compute the length.
+ */
+ if (HAVE_OPT(FORMAT)) {
+ pzText = zFmtLine;
+ len = snprintf(zFmtLine, sizeof(zFmtLine), OPT_ARG(FORMAT), zLine);
+ } else {
+ pzText = zLine;
+ }
+
+ /*
+ * Allocate a string and space in the pointer array.
+ */
+ len += sepLen + 1;
+ pzL = (char*)malloc_or_die( len );
+ if (++usedCt > allocCt) {
+ allocCt += 128;
+ papzLines = (char**)realloc( (void*)papzLines,
+ sizeof( char* ) * allocCt );
+ }
+ papzLines[ usedCt-1 ] = pzL;
+
+ /*
+ * Copy the text and append the separation character
+ */
+ strcpy( pzL, pzText );
+
+ /*
+ * Initially, all strings have the separator,
+ * the entries may get reordered.
+ */
+ if (sepLen > 0)
+ strcat(pzL, OPT_ARG(SEPARATION));
+
+ if ((int)len > maxEntryWidth)
+ maxEntryWidth = len;
+ next_line:;
+ }
+
+ if (maxEntryWidth == 0) {
+ fputs( "columns warning: no input text was read\n", stderr );
+ exit( EXIT_SUCCESS );
+ }
+
+ /*
+ * Set the line width to the amount of space we have to play with.
+ */
+ if ((OPT_VALUE_WIDTH < maxEntryWidth) && (! HAVE_OPT(FILL)))
+ OPT_VALUE_WIDTH = maxEntryWidth;
+
+ /*
+ * If we do not have a column size set,
+ * then figure out what it must be.
+ */
+ if (columnSz == 0) {
+ /*
+ * IF the column count has not been set,
+ * THEN compute it.
+ */
+ if (columnCt == 0)
+ columnCt = OPT_VALUE_WIDTH / maxEntryWidth;
+
+ /*
+ * IF there are to be multiple columns, ...
+ */
+ if (columnCt > 1) {
+ int spreadwidth = OPT_VALUE_WIDTH - maxEntryWidth;
+ int sz = spreadwidth / (columnCt-1);
+
+ /*
+ * Either there is room for added space,
+ * or we must (possibly) reduce the number of columns
+ */
+ if (sz >= maxEntryWidth)
+ columnSz = sz;
+ else {
+ columnCt = (spreadwidth / maxEntryWidth) + 1;
+ if (columnCt > 1)
+ columnSz = spreadwidth / (columnCt - 1);
+ else columnSz = OPT_VALUE_WIDTH;
+ }
+ }
+ }
+
+ /*
+ * Otherwise, the column size has been set. Ensure it is sane.
+ */
+ else {
+ bool compute_val = (columnCt == 0);
+
+ /*
+ * Increase the column size to the width of the widest entry
+ */
+ if (maxEntryWidth > (int)columnSz)
+ columnSz = maxEntryWidth;
+
+ /*
+ * IF we have not been provided a column count
+ * *OR* we are set to overfill the output line,
+ * THEN compute the number of columns.
+ */
+ if (! compute_val) {
+ unsigned long width = maxEntryWidth + (columnSz * (columnCt-1));
+ compute_val = width > (unsigned)OPT_VALUE_WIDTH;
+ }
+ if (compute_val)
+ columnCt = ((OPT_VALUE_WIDTH - maxEntryWidth) / columnSz) + 1;
+ }
+
+ /*
+ * Ensure that any "spread" we added to the column size
+ * does not exceed the parameterized limit.
+ */
+ if ( HAVE_OPT( SPREAD )
+ && ((maxEntryWidth + OPT_VALUE_SPREAD - 1) < (int)columnSz))
+ columnSz = maxEntryWidth + OPT_VALUE_SPREAD - 1;
+}
+
+
+static void
+writeColumns(void)
+{
+ char zFmt[ 12 ];
+ int colCt, rowCt, col, row;
+ tpPrintList pPL;
+
+ colCt = columnCt;
+ snprintf(zFmt, sizeof(zFmt), "%%-%ds", (int)columnSz);
+
+ if (colCt == 1) {
+ writeRows();
+ return;
+ }
+
+ pPL = (tpPrintList)malloc_or_die( colCt * sizeof( tPrintList ));
+
+ /*
+ * This "loop" is normally executed half way through and exited.
+ * IF, however, we would produce an empty final column,
+ * we will reduce our column count and line width and then
+ * try the top-of-column pointer computation again.
+ *
+ * The problem solved here is that sometimes, when the
+ * number of entries in a row is greater than the number of rows,
+ * it is possible that all the entries that would have been
+ * in the last column are, instead, essentially put on the
+ * last row. That will leave the final column empty.
+ * We could regroup at that point and spread the columns some more,
+ * but, if done, is an exercise for later.
+ */
+ for (;;) {
+ int rem;
+ int fsz;
+
+ rowCt = (usedCt/colCt) + ((usedCt % colCt) ? 1 : 0);
+
+ /*
+ * FOR each column, compute the address of the pointer to
+ * the string at the top of the column, and the index of
+ * that entry.
+ */
+ for (col = 0; col < colCt ; col++) {
+ pPL[col].papz = papzLines + (col * rowCt);
+ pPL[col].index = col * rowCt;
+ }
+
+ /*
+ * IF the final column is not empty,
+ * THEN break out and start printing.
+ */
+ if (pPL[colCt-1].index < (int)usedCt)
+ break;
+
+ /*
+ * The last column is blank, so we reduce our column count,
+ * even if the user specified a count!!
+ */
+ colCt--;
+ rem = OPT_VALUE_WIDTH - (colCt * maxEntryWidth);
+
+ if ((rem == 0) || (colCt < 2) || (columnSz > 0))
+ fsz = maxEntryWidth;
+ else
+ fsz = maxEntryWidth + (rem / (colCt-1));
+ snprintf( zFmt, sizeof(zFmt), "%%-%ds", fsz );
+ }
+
+ /*
+ * Now, actually print each row...
+ */
+ for ( row = 0 ;; ) {
+ char* pzL;
+ char* pzE;
+
+ if (pzLinePfx != NULL)
+ fputs( pzLinePfx, stdout );
+
+ /*
+ * Increment the index of the current entry in the last column.
+ * IF it goes beyond the end of the entries in use,
+ * THEN reduce our column count.
+ */
+ if ((pPL[colCt-1].index)++ >= (int)usedCt)
+ colCt--;
+
+ /*
+ * Get the address of the string in the last column.
+ */
+ pzE = *(pPL[colCt-1].papz++);
+
+ col = 0;
+
+ /*
+ * FOR every column except the last,
+ * print the entry with the width format
+ *
+ * No need to worry about referring to a non-existent entry. Only
+ * the last column might have that problem, and we addressed it above
+ * where the column count got decremented.
+ */
+ while (++col < colCt) {
+ pzL = *(pPL[col-1].papz++);
+ fprintf( stdout, zFmt, pzL );
+ free( (void*)pzL );
+ }
+
+ /*
+ * See if we are on the last row. If so, then this is the last entry.
+ * Strip any separation characters, emit the entry and break out.
+ */
+ if (++row == rowCt) {
+ /*
+ * IF we have a separator,
+ * THEN remove it from the last entry.
+ */
+ if (HAVE_OPT( SEPARATION )) {
+ char* pz = pzE + strlen( pzE )
+ - strlen( OPT_ARG(SEPARATION));
+ *pz = NUL;
+ }
+
+ fputs(pzE, stdout);
+ if (HAVE_OPT(ENDING))
+ fputs(OPT_ARG(ENDING), stdout);
+
+ putc( '\n', stdout );
+ break;
+ }
+
+ /*
+ * Print the last entry on the line, without the width format.
+ * If we have line separation (which does not apply to the last
+ * line), then emit those characters, too.
+ */
+ fputs( pzE, stdout );
+ if (HAVE_OPT( LINE_SEPARATION ))
+ fputs( OPT_ARG( LINE_SEPARATION ), stdout );
+
+ putc( '\n', stdout );
+ free( (void*)pzE );
+ }
+
+ free(pPL);
+}
+
+static void
+trim_last_separation(void)
+{
+ char* pz = papzLines[ usedCt-1 ];
+ pz += strlen(pz) - strlen( OPT_ARG(SEPARATION));
+ *pz = NUL;
+}
+
+static void
+writeRows(void)
+{
+ char zFmt[32];
+ int colCt;
+
+ colCt = columnCt;
+ snprintf(zFmt, sizeof(zFmt), "%%-%ds", (int)columnSz);
+
+ if (HAVE_OPT( SEPARATION ))
+ trim_last_separation();
+
+ if (pzFirstPfx != NULL) {
+ fputs( pzFirstPfx, stdout );
+ pzFirstPfx = pzLinePfx;
+ }
+
+ {
+ char** ppzLL = papzLines;
+ size_t left = usedCt;
+ int lnNo = 0;
+
+ /*
+ * FOR every entry we are to emit, ...
+ */
+ for (;;) {
+ char* pzL = *ppzLL++;
+
+ /*
+ * IF this is the last entry,
+ * THEN emit it and a new line and break out
+ */
+ if (--left <= 0) {
+ fputs(pzL, stdout);
+ if (HAVE_OPT(ENDING))
+ fputs(OPT_ARG(ENDING), stdout);
+
+ putc('\n', stdout);
+ free((void*)pzL);
+ break;
+ }
+
+ /*
+ * IF the count of entries on this line is still less
+ * than the number of columns,
+ * THEN emit the padded entry
+ * ELSE ...
+ */
+ if (++lnNo < colCt)
+ fprintf( stdout, zFmt, pzL );
+
+ else {
+ lnNo = 0;
+ /*
+ * Last entry on the line. Emit the string without padding.
+ * IF we have a line separation string, emit that too.
+ */
+ fputs( pzL, stdout );
+ if (HAVE_OPT( LINE_SEPARATION ))
+ fputs( OPT_ARG( LINE_SEPARATION ), stdout );
+
+ putc( '\n', stdout );
+
+ /*
+ * Start the next line with any required indentation
+ */
+ if (pzFirstPfx != NULL) {
+ fputs( pzFirstPfx, stdout );
+ pzFirstPfx = pzLinePfx;
+ }
+ }
+
+ free( (void*)pzL );
+ }
+ }
+}
+
+static int
+emitWord(char const * word, size_t len, int col)
+{
+ static int ended_with_period = 0;
+
+ if (col > 0) {
+ if ((int)len >= (OPT_VALUE_WIDTH - col)) {
+ putc('\n', stdout);
+ if (pzLinePfx != NULL)
+ fputs(pzLinePfx, stdout);
+ col = 0;
+
+ } else {
+ if (ended_with_period) {
+ putc(' ', stdout);
+ col++;
+ }
+ putc(' ', stdout);
+ col++;
+ }
+ }
+
+ fwrite(word, len, 1, stdout);
+ col += len;
+ ended_with_period = (word[len - 1] == '.');
+
+ return col;
+}
+
+/*
+ * writeFill -- fill the output. Pack together as much as will fit
+ * on each line.
+ */
+static void
+writeFill(void)
+{
+ char** ppzLL = papzLines;
+ size_t left = usedCt;
+ int colNo = 0;
+
+ if (HAVE_OPT( SEPARATION ))
+ trim_last_separation();
+
+ if (pzFirstPfx != NULL)
+ fputs(pzFirstPfx, stdout);
+
+ /*
+ * FOR every entry we are to emit, ...
+ */
+ while (left-- > 0) {
+ char* pzL = *ppzLL;
+
+ while (isspace(*pzL)) pzL++;
+
+ /*
+ * Blank lines are magical and trigger a blank line in output.
+ */
+ if (*pzL == NUL) {
+ if (! HAVE_OPT(SORT)) {
+ if (colNo > 0) /* guard against multiple blank lines */
+ putc('\n', stdout);
+ putc('\n', stdout);
+ colNo = -2;
+ }
+
+ free(*(ppzLL++));
+ continue;
+ }
+
+ /*
+ * We are going to emit some output. Make sure we're indented.
+ */
+ if (colNo < 0) {
+ if (pzLinePfx != NULL)
+ fputs(pzLinePfx, stdout);
+ colNo = 0;
+ }
+
+ do {
+ size_t tknlen;
+
+ for (tknlen = 0; pzL[tknlen] != NUL; tknlen++)
+ if (isspace(pzL[tknlen]))
+ break;
+ colNo = emitWord(pzL, tknlen, colNo);
+ pzL += tknlen;
+ while (isspace(*pzL)) pzL++;
+ } while (*pzL != NUL);
+
+ free(*(ppzLL++));
+ }
+
+ if (HAVE_OPT(ENDING) && (left == 0))
+ fputs(OPT_ARG(ENDING), stdout);
+
+ putc('\n', stdout);
+}
+
+
+/*
+ * Line comparison procedure
+ */
+static int
+compProc(const void * p1, const void * p2)
+{
+ char const * pz1 = *(char* const*)p1;
+ char const * pz2 = *(char* const*)p2;
+ return strcmp(pz1, pz2);
+}
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of columns/columns.c */
diff --git a/columns/opts.c b/columns/opts.c
new file mode 100644
index 0000000..9c0187f
--- /dev/null
+++ b/columns/opts.c
@@ -0,0 +1,1055 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (opts.c)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:50 AM by AutoGen 5.16.2pre7
+ * From the definitions opts.def
+ * and the template file options
+ *
+ * Generated from AutoOpts 36:5:11 templates.
+ *
+ * AutoOpts is a copyrighted work. This source file is not encumbered
+ * by AutoOpts licensing, but is provided under the licensing terms chosen
+ * by the columns author or copyright holder. AutoOpts is
+ * licensed under the terms of the LGPL. The redistributable library
+ * (``libopts'') is licensed under the terms of either the LGPL or, at the
+ * users discretion, the BSD license. See the AutoOpts and/or libopts sources
+ * for details.
+ *
+ * The columns program is copyrighted and licensed
+ * under the following terms:
+ *
+ * Copyright (C) 1999-2012 Bruce Korb, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the
+ * GNU General Public License, version 3 or later
+ * <http://gnu.org/licenses/gpl.html>
+ *
+ * columns is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * columns is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __doxygen__
+#define OPTION_CODE_COMPILE 1
+#include "opts.h"
+#include <sys/types.h>
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern FILE * option_usage_fp;
+
+/* TRANSLATORS: choose the translation for option names wisely because you
+ cannot ever change your mind. */
+#define zCopyright (columns_opt_strs+0)
+#define zLicenseDescrip (columns_opt_strs+272)
+
+/*
+ * global included definitions
+ */
+
+#include <errno.h>
+
+#define OPEN_ERROR_FMT (columns_opt_strs+875)
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+/*
+ * columns option static const strings
+ */
+static char const columns_opt_strs[2143] =
+/* 0 */ "columns (GNU AutoGen) 1.2\n"
+ "Copyright (C) 1999-2012 Bruce Korb, all rights reserved.\n"
+ "This is free software. It is licensed for use, modification and\n"
+ "redistribution under the terms of the\n"
+ "GNU General Public License, version 3 or later\n"
+ " <http://gnu.org/licenses/gpl.html>\n\0"
+/* 272 */ "columns is free software: you can redistribute it and/or modify it under\n"
+ "the terms of the GNU General Public License as published by the Free\n"
+ "Software Foundation, either version 3 of the License, or (at your option)\n"
+ "any later version.\n\n"
+ "columns is distributed in the hope that it will be useful, but WITHOUT ANY\n"
+ "WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n"
+ "FOR A PARTICULAR PURPOSE. See the GNU General Public License for more\n"
+ "details.\n\n"
+ "You should have received a copy of the GNU General Public License along\n"
+ "with this program. If not, see <http://www.gnu.org/licenses/>.\n\0"
+/* 875 */ "Error %d (%s) opening %s\n\0"
+/* 901 */ "Specify the output dimensions:\0"
+/* 932 */ "Maximum Line Width\0"
+/* 951 */ "WIDTH\0"
+/* 957 */ "width\0"
+/* 963 */ "Desired number of columns\0"
+/* 989 */ "COLUMNS\0"
+/* 997 */ "columns\0"
+/* 1005 */ "Set width of each column\0"
+/* 1030 */ "COL_WIDTH\0"
+/* 1040 */ "col-width\0"
+/* 1050 */ "tab width\0"
+/* 1060 */ "TAB_WIDTH\0"
+/* 1070 */ "tab-width\0"
+/* 1080 */ "Specify how to lay out the text:\0"
+/* 1113 */ "maximum spread added to column width\0"
+/* 1150 */ "SPREAD\0"
+/* 1157 */ "spread\0"
+/* 1164 */ "Fill lines with input\0"
+/* 1186 */ "FILL\0"
+/* 1191 */ "fill\0"
+/* 1196 */ "Line prefix or indentation\0"
+/* 1223 */ "INDENT\0"
+/* 1230 */ "indent\0"
+/* 1237 */ "First line prefix\0"
+/* 1255 */ "FIRST_INDENT\0"
+/* 1268 */ "first-indent\0"
+/* 1281 */ "Formatting string for each input\0"
+/* 1314 */ "FORMAT\0"
+/* 1321 */ "format\0"
+/* 1328 */ "Separation string - follows all but last\0"
+/* 1369 */ "SEPARATION\0"
+/* 1380 */ "separation\0"
+/* 1391 */ "string at end of all lines but last\0"
+/* 1427 */ "LINE_SEPARATION\0"
+/* 1443 */ "line-separation\0"
+/* 1459 */ "string at end of last line\0"
+/* 1486 */ "ENDING\0"
+/* 1493 */ "ending\0"
+/* 1500 */ "Specify the ordering of the entries:\0"
+/* 1537 */ "Print entries in column order\0"
+/* 1567 */ "BY_COLUMNS\0"
+/* 1578 */ "by-columns\0"
+/* 1589 */ "Sort input text\0"
+/* 1605 */ "SORT\0"
+/* 1610 */ "sort\0"
+/* 1615 */ "Redirecting stdin to an alternate file:\0"
+/* 1655 */ "Input file (if not stdin)\0"
+/* 1681 */ "INPUT\0"
+/* 1687 */ "input\0"
+/* 1693 */ "Display extended usage information and exit\0"
+/* 1737 */ "help\0"
+/* 1742 */ "Extended usage information passed thru pager\0"
+/* 1787 */ "more-help\0"
+/* 1797 */ "Output version information and exit\0"
+/* 1833 */ "version\0"
+/* 1841 */ "Save the option state to a config file\0"
+/* 1880 */ "save-opts\0"
+/* 1890 */ "Load options from a config file\0"
+/* 1922 */ "LOAD_OPTS\0"
+/* 1932 */ "no-load-opts\0"
+/* 1945 */ "no\0"
+/* 1948 */ "columns (GNU AutoGen) - Columnize Input Text - Ver. 1.2\n"
+ "USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
+/* 2062 */ ".\0"
+/* 2064 */ "$HOME\0"
+/* 2070 */ ".columnsrc\0"
+/* 2081 */ "autogen-users@lists.sourceforge.net\0"
+/* 2117 */ "columns (GNU AutoGen) 1.2";
+
+/*
+ * dimensions option description:
+ */
+#define DIMENSIONS_DESC (columns_opt_strs+901)
+#define DIMENSIONS_FLAGS (OPTST_DOCUMENT | OPTST_NO_INIT)
+
+/*
+ * width option description:
+ */
+#define WIDTH_DESC (columns_opt_strs+932)
+#define WIDTH_NAME (columns_opt_strs+951)
+#define WIDTH_name (columns_opt_strs+957)
+#define WIDTH_DFT_ARG ((char const*)79)
+#define WIDTH_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
+
+/*
+ * columns option description:
+ */
+#define COLUMNS_DESC (columns_opt_strs+963)
+#define COLUMNS_NAME (columns_opt_strs+989)
+#define COLUMNS_name (columns_opt_strs+997)
+#define COLUMNS_DFT_ARG ((char const*)0)
+#define COLUMNS_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
+
+/*
+ * col_width option description:
+ */
+#define COL_WIDTH_DESC (columns_opt_strs+1005)
+#define COL_WIDTH_NAME (columns_opt_strs+1030)
+#define COL_WIDTH_name (columns_opt_strs+1040)
+#define COL_WIDTH_DFT_ARG ((char const*)0)
+#define COL_WIDTH_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
+
+/*
+ * tab_width option description:
+ */
+#define TAB_WIDTH_DESC (columns_opt_strs+1050)
+#define TAB_WIDTH_NAME (columns_opt_strs+1060)
+#define TAB_WIDTH_name (columns_opt_strs+1070)
+#define TAB_WIDTH_DFT_ARG ((char const*)8)
+#define TAB_WIDTH_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
+
+/*
+ * treatment option description:
+ */
+#define TREATMENT_DESC (columns_opt_strs+1080)
+#define TREATMENT_FLAGS (OPTST_DOCUMENT | OPTST_NO_INIT)
+
+/*
+ * spread option description:
+ */
+#define SPREAD_DESC (columns_opt_strs+1113)
+#define SPREAD_NAME (columns_opt_strs+1150)
+#define SPREAD_name (columns_opt_strs+1157)
+#define SPREAD_DFT_ARG ((char const*)0)
+#define SPREAD_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
+
+/*
+ * fill option description with
+ * "Must also have options" and "Incompatible options":
+ */
+#define FILL_DESC (columns_opt_strs+1164)
+#define FILL_NAME (columns_opt_strs+1186)
+#define FILL_name (columns_opt_strs+1191)
+static int const aFillCantList[] = {
+ INDEX_OPT_SPREAD,
+ INDEX_OPT_COL_WIDTH,
+ INDEX_OPT_BY_COLUMNS, NO_EQUIVALENT };
+#define FILL_FLAGS (OPTST_DISABLED)
+
+/*
+ * indent option description:
+ */
+#define INDENT_DESC (columns_opt_strs+1196)
+#define INDENT_NAME (columns_opt_strs+1223)
+#define INDENT_name (columns_opt_strs+1230)
+#define INDENT_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * first_indent option description with
+ * "Must also have options" and "Incompatible options":
+ */
+#define FIRST_INDENT_DESC (columns_opt_strs+1237)
+#define FIRST_INDENT_NAME (columns_opt_strs+1255)
+#define FIRST_INDENT_name (columns_opt_strs+1268)
+static int const aFirst_IndentMustList[] = {
+ INDEX_OPT_INDENT, NO_EQUIVALENT };
+#define FIRST_INDENT_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * format option description:
+ */
+#define FORMAT_DESC (columns_opt_strs+1281)
+#define FORMAT_NAME (columns_opt_strs+1314)
+#define FORMAT_name (columns_opt_strs+1321)
+#define FORMAT_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * separation option description:
+ */
+#define SEPARATION_DESC (columns_opt_strs+1328)
+#define SEPARATION_NAME (columns_opt_strs+1369)
+#define SEPARATION_name (columns_opt_strs+1380)
+#define SEPARATION_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * line_separation option description:
+ */
+#define LINE_SEPARATION_DESC (columns_opt_strs+1391)
+#define LINE_SEPARATION_NAME (columns_opt_strs+1427)
+#define LINE_SEPARATION_name (columns_opt_strs+1443)
+#define LINE_SEPARATION_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * ending option description:
+ */
+#define ENDING_DESC (columns_opt_strs+1459)
+#define ENDING_NAME (columns_opt_strs+1486)
+#define ENDING_name (columns_opt_strs+1493)
+#define ENDING_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * ordering option description:
+ */
+#define ORDERING_DESC (columns_opt_strs+1500)
+#define ORDERING_FLAGS (OPTST_DOCUMENT | OPTST_NO_INIT)
+
+/*
+ * by_columns option description:
+ */
+#define BY_COLUMNS_DESC (columns_opt_strs+1537)
+#define BY_COLUMNS_NAME (columns_opt_strs+1567)
+#define BY_COLUMNS_name (columns_opt_strs+1578)
+#define BY_COLUMNS_FLAGS (OPTST_DISABLED)
+
+/*
+ * sort option description:
+ */
+#define SORT_DESC (columns_opt_strs+1589)
+#define SORT_NAME (columns_opt_strs+1605)
+#define SORT_name (columns_opt_strs+1610)
+#define SORT_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | OPTST_ARG_OPTIONAL)
+
+/*
+ * input-text option description:
+ */
+#define INPUT_TEXT_DESC (columns_opt_strs+1615)
+#define INPUT_TEXT_FLAGS (OPTST_DOCUMENT | OPTST_NO_INIT)
+
+/*
+ * input option description:
+ */
+#define INPUT_DESC (columns_opt_strs+1655)
+#define INPUT_NAME (columns_opt_strs+1681)
+#define INPUT_name (columns_opt_strs+1687)
+#define INPUT_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * Help/More_Help/Version option descriptions:
+ */
+#define HELP_DESC (columns_opt_strs+1693)
+#define HELP_name (columns_opt_strs+1737)
+#ifdef HAVE_WORKING_FORK
+#define MORE_HELP_DESC (columns_opt_strs+1742)
+#define MORE_HELP_name (columns_opt_strs+1787)
+#define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
+#else
+#define MORE_HELP_DESC NULL
+#define MORE_HELP_name NULL
+#define MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
+#endif
+#ifdef NO_OPTIONAL_OPT_ARGS
+# define VER_FLAGS (OPTST_IMM | OPTST_NO_INIT)
+#else
+# define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
+ OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT)
+#endif
+#define VER_DESC (columns_opt_strs+1797)
+#define VER_name (columns_opt_strs+1833)
+#define SAVE_OPTS_DESC (columns_opt_strs+1841)
+#define SAVE_OPTS_name (columns_opt_strs+1880)
+#define LOAD_OPTS_DESC (columns_opt_strs+1890)
+#define LOAD_OPTS_NAME (columns_opt_strs+1922)
+#define NO_LOAD_OPTS_name (columns_opt_strs+1932)
+#define LOAD_OPTS_pfx (columns_opt_strs+1945)
+#define LOAD_OPTS_name (NO_LOAD_OPTS_name + 3)
+/*
+ * Declare option callback procedures
+ */
+extern tOptProc
+ optionBooleanVal, optionNestedVal, optionNumericVal,
+ optionPagedUsage, optionPrintVersion, optionResetOpt,
+ optionStackArg, optionTimeDate, optionTimeVal,
+ optionUnstackArg, optionVendorOption;
+static tOptProc
+ doOptCol_Width, doOptColumns, doOptInput, doOptSpread,
+ doOptWidth, doUsageOpt;
+#define VER_PROC optionPrintVersion
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Define the columns Option Descriptions.
+ * This is an array of OPTION_CT entries, one for each
+ * option that the columns program responds to.
+ */
+static tOptDesc optDesc[OPTION_CT] = {
+ { /* entry idx, value */ 0, 0,
+ /* equiv idx, value */ 0, 0,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 0, 0,
+ /* opt state flags */ DIMENSIONS_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ DIMENSIONS_DESC, NULL, NULL,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 1, VALUE_OPT_WIDTH,
+ /* equiv idx, value */ 1, VALUE_OPT_WIDTH,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ WIDTH_FLAGS, 0,
+ /* last opt argumnt */ { WIDTH_DFT_ARG },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptWidth,
+ /* desc, NAME, name */ WIDTH_DESC, WIDTH_NAME, WIDTH_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 2, VALUE_OPT_COLUMNS,
+ /* equiv idx, value */ 2, VALUE_OPT_COLUMNS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ COLUMNS_FLAGS, 0,
+ /* last opt argumnt */ { COLUMNS_DFT_ARG },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptColumns,
+ /* desc, NAME, name */ COLUMNS_DESC, COLUMNS_NAME, COLUMNS_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 3, VALUE_OPT_COL_WIDTH,
+ /* equiv idx, value */ 3, VALUE_OPT_COL_WIDTH,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ COL_WIDTH_FLAGS, 0,
+ /* last opt argumnt */ { COL_WIDTH_DFT_ARG },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptCol_Width,
+ /* desc, NAME, name */ COL_WIDTH_DESC, COL_WIDTH_NAME, COL_WIDTH_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 4, VALUE_OPT_TAB_WIDTH,
+ /* equiv idx, value */ 4, VALUE_OPT_TAB_WIDTH,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ TAB_WIDTH_FLAGS, 0,
+ /* last opt argumnt */ { TAB_WIDTH_DFT_ARG },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionNumericVal,
+ /* desc, NAME, name */ TAB_WIDTH_DESC, TAB_WIDTH_NAME, TAB_WIDTH_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 0, 0,
+ /* equiv idx, value */ 0, 0,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 0, 0,
+ /* opt state flags */ TREATMENT_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ TREATMENT_DESC, NULL, NULL,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 6, VALUE_OPT_SPREAD,
+ /* equiv idx, value */ 6, VALUE_OPT_SPREAD,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ SPREAD_FLAGS, 0,
+ /* last opt argumnt */ { SPREAD_DFT_ARG },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptSpread,
+ /* desc, NAME, name */ SPREAD_DESC, SPREAD_NAME, SPREAD_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 7, VALUE_OPT_FILL,
+ /* equiv idx, value */ 7, VALUE_OPT_FILL,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ FILL_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --fill */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, aFillCantList,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ FILL_DESC, FILL_NAME, FILL_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 8, VALUE_OPT_INDENT,
+ /* equiv idx, value */ 8, VALUE_OPT_INDENT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ INDENT_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --indent */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ INDENT_DESC, INDENT_NAME, INDENT_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 9, VALUE_OPT_FIRST_INDENT,
+ /* equiv idx, value */ 9, VALUE_OPT_FIRST_INDENT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ FIRST_INDENT_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --first_indent */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ aFirst_IndentMustList, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ FIRST_INDENT_DESC, FIRST_INDENT_NAME, FIRST_INDENT_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 10, VALUE_OPT_FORMAT,
+ /* equiv idx, value */ 10, VALUE_OPT_FORMAT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ FORMAT_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --format */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ FORMAT_DESC, FORMAT_NAME, FORMAT_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 11, VALUE_OPT_SEPARATION,
+ /* equiv idx, value */ 11, VALUE_OPT_SEPARATION,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ SEPARATION_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --separation */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ SEPARATION_DESC, SEPARATION_NAME, SEPARATION_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 12, VALUE_OPT_LINE_SEPARATION,
+ /* equiv idx, value */ 12, VALUE_OPT_LINE_SEPARATION,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ LINE_SEPARATION_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --line_separation */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ LINE_SEPARATION_DESC, LINE_SEPARATION_NAME, LINE_SEPARATION_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 13, VALUE_OPT_ENDING,
+ /* equiv idx, value */ 13, VALUE_OPT_ENDING,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ ENDING_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --ending */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ ENDING_DESC, ENDING_NAME, ENDING_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 0, 0,
+ /* equiv idx, value */ 0, 0,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 0, 0,
+ /* opt state flags */ ORDERING_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ ORDERING_DESC, NULL, NULL,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 15, VALUE_OPT_BY_COLUMNS,
+ /* equiv idx, value */ 15, VALUE_OPT_BY_COLUMNS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ BY_COLUMNS_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --by_columns */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ BY_COLUMNS_DESC, BY_COLUMNS_NAME, BY_COLUMNS_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 16, VALUE_OPT_SORT,
+ /* equiv idx, value */ 16, VALUE_OPT_SORT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ SORT_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --sort */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ SORT_DESC, SORT_NAME, SORT_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 0, 0,
+ /* equiv idx, value */ 0, 0,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 0, 0,
+ /* opt state flags */ INPUT_TEXT_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ INPUT_TEXT_DESC, NULL, NULL,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 18, VALUE_OPT_INPUT,
+ /* equiv idx, value */ 18, VALUE_OPT_INPUT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ INPUT_FLAGS, 0,
+ /* last opt argumnt */ { NULL }, /* --input */
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptInput,
+ /* desc, NAME, name */ INPUT_DESC, INPUT_NAME, INPUT_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_VERSION,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ VER_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ VER_PROC,
+ /* desc, NAME, name */ VER_DESC, NULL, VER_name,
+ /* disablement strs */ NULL, NULL },
+
+
+
+ { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_HELP,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doUsageOpt,
+ /* desc, NAME, name */ HELP_DESC, NULL, HELP_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_MORE_HELP,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ MORE_HELP_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionPagedUsage,
+ /* desc, NAME, name */ MORE_HELP_DESC, NULL, MORE_HELP_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ INDEX_OPT_SAVE_OPTS, VALUE_OPT_SAVE_OPTS,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_SAVE_OPTS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
+ | OPTST_ARG_OPTIONAL | OPTST_NO_INIT, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ SAVE_OPTS_DESC, NULL, SAVE_OPTS_name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ INDEX_OPT_LOAD_OPTS, VALUE_OPT_LOAD_OPTS,
+ /* equiv idx value */ NO_EQUIVALENT, VALUE_OPT_LOAD_OPTS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, NOLIMIT, 0,
+ /* opt state flags */ OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)
+ | OPTST_DISABLE_IMM, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionLoadOpt,
+ /* desc, NAME, name */ LOAD_OPTS_DESC, LOAD_OPTS_NAME, LOAD_OPTS_name,
+ /* disablement strs */ NO_LOAD_OPTS_name, LOAD_OPTS_pfx }
+};
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Define the columns Option Environment
+ */
+#define zPROGNAME (columns_opt_strs+989)
+#define zUsageTitle (columns_opt_strs+1948)
+#define zRcName (columns_opt_strs+2070)
+static char const * const apzHomeList[3] = {
+ columns_opt_strs+2062,
+ columns_opt_strs+2064,
+ NULL };
+#define zBugsAddr (columns_opt_strs+2081)
+#define zExplain (NULL)
+#define zDetail (NULL)
+#define zFullVersion (columns_opt_strs+2117)
+/* extracted from optcode.tlib near line 350 */
+
+#if defined(ENABLE_NLS)
+# define OPTPROC_BASE OPTPROC_TRANSLATE
+ static tOptionXlateProc translate_option_strings;
+#else
+# define OPTPROC_BASE OPTPROC_NONE
+# define translate_option_strings NULL
+#endif /* ENABLE_NLS */
+
+
+#define columns_full_usage (NULL)
+
+#define columns_short_usage (NULL)
+
+#endif /* not defined __doxygen__ */
+
+/*
+ * Create the static procedure(s) declared above.
+ */
+/**
+ * The callout function that invokes the optionUsage function.
+ *
+ * @param pOptions the AutoOpts option description structure
+ * @param pOptDesc the descriptor for the "help" (usage) option.
+ * @noreturn
+ */
+static void
+doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
+{
+ optionUsage(&columnsOptions, COLUMNS_EXIT_SUCCESS);
+ /* NOTREACHED */
+ (void)pOptDesc;
+ (void)pOptions;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the width option.
+ *
+ * @param pOptions the columns options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptWidth(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ static struct {long rmin, rmax;} const rng[1] = {
+ { 16, 4095 } };
+ int ix;
+
+ if (pOptions <= OPTPROC_EMIT_LIMIT)
+ goto emit_ranges;
+ optionNumericVal(pOptions, pOptDesc);
+
+ for (ix = 0; ix < 1; ix++) {
+ if (pOptDesc->optArg.argInt < rng[ix].rmin)
+ continue; /* ranges need not be ordered. */
+ if (pOptDesc->optArg.argInt == rng[ix].rmin)
+ return;
+ if (rng[ix].rmax == LONG_MIN)
+ continue;
+ if (pOptDesc->optArg.argInt <= rng[ix].rmax)
+ return;
+ }
+
+ option_usage_fp = stderr;
+
+emit_ranges:
+ optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the columns option.
+ *
+ * @param pOptions the columns options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptColumns(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ static struct {long rmin, rmax;} const rng[1] = {
+ { 1, 2048 } };
+ int ix;
+
+ if (pOptions <= OPTPROC_EMIT_LIMIT)
+ goto emit_ranges;
+ optionNumericVal(pOptions, pOptDesc);
+
+ for (ix = 0; ix < 1; ix++) {
+ if (pOptDesc->optArg.argInt < rng[ix].rmin)
+ continue; /* ranges need not be ordered. */
+ if (pOptDesc->optArg.argInt == rng[ix].rmin)
+ return;
+ if (rng[ix].rmax == LONG_MIN)
+ continue;
+ if (pOptDesc->optArg.argInt <= rng[ix].rmax)
+ return;
+ }
+
+ option_usage_fp = stderr;
+
+emit_ranges:
+ optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the col_width option.
+ *
+ * @param pOptions the columns options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptCol_Width(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ static struct {long rmin, rmax;} const rng[1] = {
+ { 1, 2048 } };
+ int ix;
+
+ if (pOptions <= OPTPROC_EMIT_LIMIT)
+ goto emit_ranges;
+ optionNumericVal(pOptions, pOptDesc);
+
+ for (ix = 0; ix < 1; ix++) {
+ if (pOptDesc->optArg.argInt < rng[ix].rmin)
+ continue; /* ranges need not be ordered. */
+ if (pOptDesc->optArg.argInt == rng[ix].rmin)
+ return;
+ if (rng[ix].rmax == LONG_MIN)
+ continue;
+ if (pOptDesc->optArg.argInt <= rng[ix].rmax)
+ return;
+ }
+
+ option_usage_fp = stderr;
+
+emit_ranges:
+ optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the spread option.
+ *
+ * @param pOptions the columns options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptSpread(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ static struct {long rmin, rmax;} const rng[1] = {
+ { 1, 1024 } };
+ int ix;
+
+ if (pOptions <= OPTPROC_EMIT_LIMIT)
+ goto emit_ranges;
+ optionNumericVal(pOptions, pOptDesc);
+
+ for (ix = 0; ix < 1; ix++) {
+ if (pOptDesc->optArg.argInt < rng[ix].rmin)
+ continue; /* ranges need not be ordered. */
+ if (pOptDesc->optArg.argInt == rng[ix].rmin)
+ return;
+ if (rng[ix].rmax == LONG_MIN)
+ continue;
+ if (pOptDesc->optArg.argInt <= rng[ix].rmax)
+ return;
+ }
+
+ option_usage_fp = stderr;
+
+emit_ranges:
+ optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/**
+ * Code to handle the input option.
+ *
+ * @param pOptions the columns options data structure
+ * @param pOptDesc the option descriptor for this option.
+ */
+static void
+doOptInput(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ /* extracted from opts.def, line 302 */
+ FILE* fp = freopen(
+ pOptDesc->optArg.argString, "r" FOPEN_BINARY_FLAG, stdin);
+
+ if (fp == (FILE*)NULL) {
+ fprintf(stderr, OPEN_ERROR_FMT, errno, strerror(errno),
+ pOptDesc->optArg.argString);
+ USAGE(EXIT_FAILURE);
+ }
+ (void)pOptions;
+}
+/* extracted from optmain.tlib near line 1146 */
+
+/**
+ * The directory containing the data associated with columns.
+ */
+#ifndef PKGDATADIR
+# define PKGDATADIR ""
+#endif
+
+/**
+ * Information about the person or institution that packaged columns
+ * for the current distribution.
+ */
+#ifndef WITH_PACKAGER
+# define columns_packager_info NULL
+#else
+static char const columns_packager_info[] =
+ "Packaged by " WITH_PACKAGER
+
+# ifdef WITH_PACKAGER_VERSION
+ " ("WITH_PACKAGER_VERSION")"
+# endif
+
+# ifdef WITH_PACKAGER_BUG_REPORTS
+ "\nReport columns bugs to " WITH_PACKAGER_BUG_REPORTS
+# endif
+ "\n";
+#endif
+#ifndef __doxygen__
+
+#endif /* __doxygen__ */
+/**
+ * The option definitions for columns. The one structure that
+ * binds them all.
+ */
+tOptions columnsOptions = {
+ OPTIONS_STRUCT_VERSION,
+ 0, NULL, /* original argc + argv */
+ ( OPTPROC_BASE
+ + OPTPROC_ERRSTOP
+ + OPTPROC_SHORTOPT
+ + OPTPROC_LONGOPT
+ + OPTPROC_NO_REQ_OPT
+ + OPTPROC_ENVIRON
+ + OPTPROC_NO_ARGS ),
+ 0, NULL, /* current option index, current option */
+ NULL, NULL, zPROGNAME,
+ zRcName, zCopyright, zLicenseDescrip,
+ zFullVersion, apzHomeList, zUsageTitle,
+ zExplain, zDetail, optDesc,
+ zBugsAddr, /* address to send bugs to */
+ NULL, NULL, /* extensions/saved state */
+ optionUsage, /* usage procedure */
+ translate_option_strings, /* translation procedure */
+ /*
+ * Indexes to special options
+ */
+ { INDEX_OPT_MORE_HELP, /* more-help option index */
+ INDEX_OPT_SAVE_OPTS, /* save option index */
+ NO_EQUIVALENT, /* '-#' option index */
+ NO_EQUIVALENT /* index of default opt */
+ },
+ 24 /* full option count */, 19 /* user option count */,
+ columns_full_usage, columns_short_usage,
+ NULL, NULL,
+ PKGDATADIR, columns_packager_info
+};
+
+#if ENABLE_NLS
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <autoopts/usage-txt.h>
+
+static char* AO_gettext(char const* pz);
+static void coerce_it(void** s);
+
+/**
+ * AutoGen specific wrapper function for gettext.
+ * It relies on the macro _() to convert from English to the target
+ * language, then strdup-duplicates the result string.
+ *
+ * @param[in] pz the input text used as a lookup key.
+ * @returns the translated text (if there is one),
+ * or the original text (if not).
+ */
+static char *
+AO_gettext(char const* pz)
+{
+ char* pzRes;
+ if (pz == NULL)
+ return NULL;
+ pzRes = _(pz);
+ if (pzRes == pz)
+ return pzRes;
+ pzRes = strdup(pzRes);
+ if (pzRes == NULL) {
+ fputs(_("No memory for duping translated strings\n"), stderr);
+ exit(COLUMNS_EXIT_FAILURE);
+ }
+ return pzRes;
+}
+
+static void coerce_it(void** s) { *s = AO_gettext(*s);
+}
+
+/**
+ * Translate all the translatable strings in the columnsOptions
+ * structure defined above. This is done only once.
+ */
+static void
+translate_option_strings(void)
+{
+ tOptions * const pOpt = &columnsOptions;
+
+ /*
+ * Guard against re-translation. It won't work. The strings will have
+ * been changed by the first pass through this code. One shot only.
+ */
+ if (option_usage_text.field_ct != 0) {
+ /*
+ * Do the translations. The first pointer follows the field count
+ * field. The field count field is the size of a pointer.
+ */
+ tOptDesc * pOD = pOpt->pOptDesc;
+ char ** ppz = (char**)(void*)&(option_usage_text);
+ int ix = option_usage_text.field_ct;
+
+ do {
+ ppz++;
+ *ppz = AO_gettext(*ppz);
+ } while (--ix > 0);
+
+ coerce_it((void*)&(pOpt->pzCopyright));
+ coerce_it((void*)&(pOpt->pzCopyNotice));
+ coerce_it((void*)&(pOpt->pzFullVersion));
+ coerce_it((void*)&(pOpt->pzUsageTitle));
+ coerce_it((void*)&(pOpt->pzExplain));
+ coerce_it((void*)&(pOpt->pzDetail));
+ coerce_it((void*)&(pOpt->pzPackager));
+ option_usage_text.field_ct = 0;
+
+ for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
+ coerce_it((void*)&(pOD->pzText));
+ }
+
+ if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
+ tOptDesc * pOD = pOpt->pOptDesc;
+ int ix;
+
+ for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
+ coerce_it((void*)&(pOD->pz_Name));
+ coerce_it((void*)&(pOD->pz_DisableName));
+ coerce_it((void*)&(pOD->pz_DisablePfx));
+ }
+ /* prevent re-translation */
+ columnsOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
+ }
+}
+
+#endif /* ENABLE_NLS */
+
+#ifdef __cplusplus
+}
+#endif
+/* opts.c ends here */
diff --git a/columns/opts.def b/columns/opts.def
new file mode 100644
index 0000000..a2c0af1
--- /dev/null
+++ b/columns/opts.def
@@ -0,0 +1,357 @@
+/* -*- Mode: conf -*- */
+
+autogen definitions options;
+
+/*
+ * Time-stamp: "2012-04-07 09:30:18 bkorb"
+ *
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+copyright = {
+ date = "1999-2012";
+ type = gpl;
+ owner = "Bruce Korb";
+ eaddr = 'autogen-users@lists.sourceforge.net';
+};
+
+prog-name = "columns";
+prog-title = "Columnize Input Text";
+package = 'GNU AutoGen';
+homerc = '.', '$HOME';
+environrc;
+long-opts;
+
+version = "1.2";
+
+export = <<- EOExport
+ #include "config.h"
+ #include <ctype.h>
+ #include <errno.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ EOExport;
+
+include = "[= AutoGen5 Template =]";
+include = "#include <errno.h>";
+
+flag = {
+ name = dimensions;
+ documentation;
+
+ descrip = 'Specify the output dimensions';
+};
+
+flag = {
+ name = width;
+ value = W;
+ arg-type = number;
+ arg-default = 79;
+ arg-name = num;
+ arg-range = '16->4095';
+ descrip = "Maximum Line Width";
+ doc = <<- _EODoc_
+ This option specifies the full width of the output line,
+ including any start-of-line indentation. The output will fill
+ each line as completely as possible, unless the column width has
+ been explicitly specified. If the maximum width is less than
+ the length of the widest input, you will get a single column
+ of output.
+ _EODoc_;
+};
+
+flag = {
+ name = columns;
+ value = c;
+ arg-type = number;
+ arg-default = 0;
+ arg-name = count;
+ arg-range = '1->2048';
+ descrip = "Desired number of columns";
+ doc = <<- _EODoc_
+ Use this option to specify exactly how many columns to produce.
+ If that many columns will not fit within @var{line_width}, then
+ the count will be reduced to the number that fit.
+ _EODoc_;
+};
+
+flag = {
+ name = col_width;
+ value = w;
+ arg-type = number;
+ arg-default = 0;
+ arg-name = num;
+ arg-range = '1->2048';
+ descrip = "Set width of each column";
+ doc = <<- _EODoc_
+ Use this option to specify exactly how many characters are to be
+ allocated for each column. If it is narrower than the widest entry,
+ it will be over-ridden with the required width.
+ _EODoc_;
+};
+
+flag = {
+ name = tab_width;
+ arg-type = number;
+ arg-default = 8;
+ arg-name = num;
+ descrip = "tab width";
+ doc = <<- _EODoc_
+ If an indentation string contains tabs, then this value is used to
+ compute the ending column of the prefix string.
+ _EODoc_;
+};
+
+#ifdef LATER
+flag = {
+ name = page_len;
+ arg-type = number;
+ arg-name = num;
+ descrip = "Page Length";
+ doc = <<- _EODoc_
+ This many lines will be printed before a form feed is emitted.
+ The 'by_columns' ordering will wrap columns within a page.
+ _EODoc_;
+};
+#endif
+
+flag = {
+ name = treatment;
+ documentation;
+ descrip = 'Specify how to lay out the text';
+};
+
+flag = {
+ name = spread;
+ arg-type = number;
+ arg-default = 0;
+ arg-name = num;
+ arg-range = '1->1024';
+ descrip = "maximum spread added to column width";
+ doc = <<- _EODoc_
+ Use this option to specify exactly how many characters may be
+ added to each column. It allows you to prevent columns from
+ becoming too far apart. Without this option, @file{columns}
+ will attempt to widen columns to fill the full width.
+ _EODoc_;
+};
+
+flag = {
+ name = fill;
+ descrip = "Fill lines with input";
+ flags-cant = spread, col_width, by_columns;
+ doc = <<- _EODoc_
+ Instead of columnizing the input text, fill the output lines
+ with the input lines. Blank lines on input will cause a
+ blank line in the output, unless the output is sorted.
+ With sorted output, blank lines are ignored.
+ _EODoc_;
+};
+
+flag = {
+ name = indent;
+ value = I;
+ arg-type = string;
+ arg-name = l-pfx;
+ descrip = "Line prefix or indentation";
+ doc = <<- _EODoc_
+ If a number, then this many spaces will be inserted at the start of
+ every line. Otherwise, it is a line prefix that will be inserted
+ at the start of every line.
+ _EODoc_;
+};
+
+flag = {
+ name = first_indent;
+ arg-type = string;
+ flags_must = indent;
+ arg-name = l-pfx;
+ descrip = "First line prefix";
+ doc = <<- _EODoc_
+ If a number, then this many spaces will be inserted at the start of
+ the first line. Otherwise, it is a line prefix that will be inserted
+ at the start of that line. If its length exceeds "indent", then it
+ will be emitted on a line by itself, suffixed by any line separation
+ string. For example:
+
+ @example
+ $ columns --first='#define TABLE' -c 2 -I4 --line=' \' <<_EOF_
+ one
+ two
+ three
+ four
+ _EOF_
+ #define TABLE \
+ one two \
+ three four
+ @end example
+ _EODoc_; // '
+};
+
+flag = {
+ name = format;
+ value = f;
+ arg-type = string;
+ arg-name = fmt-str;
+ descrip = "Formatting string for each input";
+ doc = <<- _EODoc_
+ If you need to reformat each input text, the argument to this
+ option is interpreted as an @code{sprintf(3)} format that is used
+ to produce each output entry.
+ _EODoc_;
+};
+
+flag = {
+ name = separation;
+ value = S;
+ arg-type = string;
+ arg-name = sep-str;
+ descrip = "Separation string - follows all but last";
+ doc = <<- _EODoc_
+ Use this option if, for example, you wish a comma to appear after
+ each entry except the last.
+ _EODoc_;
+};
+
+flag = {
+ name = line_separation;
+ arg-type = string;
+ arg-name = sep-str;
+ descrip = "string at end of all lines but last";
+ doc = <<- _EODoc_
+ Use this option if, for example, you wish a backslash to appear at
+ the end of every line, except the last.
+ _EODoc_;
+};
+
+flag = {
+ name = ending;
+ arg-type = string;
+ arg-name = end-str;
+ descrip = "string at end of last line";
+ doc = <<- _EODoc_
+ This option puts the specified string at the end of the output.
+ _EODoc_;
+};
+
+flag = {
+ name = ordering;
+ documentation;
+ descrip = 'Specify the ordering of the entries';
+};
+
+flag = {
+ name = by_columns;
+ descrip = "Print entries in column order";
+ doc = <<- _EODoc_
+ Normally, the entries are printed out in order by rows and then columns.
+ This option will cause the entries to be ordered within columns.
+ The final column, instead of the final row, may be shorter than the
+ others.
+ _EODoc_;
+};
+
+flag = {
+ name = sort;
+ value = s;
+ arg-type = string;
+ arg-optional;
+ arg-name = key-pat;
+ descrip = "Sort input text";
+ doc = <<- _EODoc_
+ Causes the input text to be sorted. If an argument is supplied,
+ it is presumed to be a pattern and the sort is based upon the
+ matched text. If the pattern starts with or consists of
+ an asterisk (@code{*}), then the sort is case insensitive.
+ _EODoc_;
+};
+
+flag = {
+ name = input-text;
+ documentation;
+ descrip = 'Redirecting stdin to an alternate file';
+};
+
+include =
+ '#define OPEN_ERROR_FMT ([=
+ (string-table-add-ref opt-strs
+ "Error %d (%s) opening %s\n")=])';
+
+flag = {
+ name = input;
+ value = i;
+ arg-type = string;
+ arg-name = file;
+ descrip = "Input file (if not stdin)";
+ flag-code = <<- _EODoc_
+ FILE* fp = freopen(
+ pOptDesc->optArg.argString, "r" FOPEN_BINARY_FLAG, stdin);
+
+ if (fp == (FILE*)NULL) {
+ fprintf(stderr, OPEN_ERROR_FMT, errno, strerror(errno),
+ pOptDesc->optArg.argString);
+ USAGE(EXIT_FAILURE);
+ }
+ _EODoc_;
+ doc = <<- _EODoc_
+ This program normally runs as a @code{filter}, reading from standard
+ input, columnizing and writing to standard out. This option redirects
+ input to a file.
+ _EODoc_;
+};
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Program Documentation
+ */
+option-doc-format = texi;
+
+/* prog_man_descrip = -- unchanged; */
+
+doc-section = {
+ ds-type = "SEE ALSO";
+ ds-format = texi;
+ ds-text = <<- _EndOfMan_
+ This program is documented more fully in the Columns section
+ of the Add-On chapter in the @code{AutoGen} Info system documentation.
+ _EndOfMan_;
+};
+
+prog_descrip = <<- _EndOfMan_
+ This program was designed for the purpose of generating compact,
+ columnized tables. It will read a list of text items from standard
+ in or a specified input file and produce a columnized listing of
+ all the non-blank lines. Leading white space on each line is
+ preserved, but trailing white space is stripped. Methods of
+ applying per-entry and per-line embellishments are provided.
+ See the formatting and separation arguments below.
+
+ This program is used by AutoGen to help clean up and organize
+ its output.
+
+ See @file{autogen/agen5/fsm.tpl} and the generated output
+ @file{pseudo-fsm.h}.
+
+ This function was not implemented as an expression function because
+ either it would have to be many expression functions, or a provision
+ would have to be added to provide options to expression functions.
+ Maybe not a bad idea, but it is not being implemented at the moment.
+
+ A side benefit is that you can use it outside of @code{autogen} to
+ columnize input, a la the @code{ls} command.
+ _EndOfMan_;
diff --git a/columns/opts.h b/columns/opts.h
new file mode 100644
index 0000000..caa5fde
--- /dev/null
+++ b/columns/opts.h
@@ -0,0 +1,239 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (opts.h)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:50 AM by AutoGen 5.16.2pre7
+ * From the definitions opts.def
+ * and the template file options
+ *
+ * Generated from AutoOpts 36:5:11 templates.
+ *
+ * AutoOpts is a copyrighted work. This header file is not encumbered
+ * by AutoOpts licensing, but is provided under the licensing terms chosen
+ * by the columns author or copyright holder. AutoOpts is
+ * licensed under the terms of the LGPL. The redistributable library
+ * (``libopts'') is licensed under the terms of either the LGPL or, at the
+ * users discretion, the BSD license. See the AutoOpts and/or libopts sources
+ * for details.
+ *
+ * The columns program is copyrighted and licensed
+ * under the following terms:
+ *
+ * Copyright (C) 1999-2012 Bruce Korb, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the
+ * GNU General Public License, version 3 or later
+ * <http://gnu.org/licenses/gpl.html>
+ *
+ * columns is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * columns is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+/*
+ * This file contains the programmatic interface to the Automated
+ * Options generated for the columns program.
+ * These macros are documented in the AutoGen info file in the
+ * "AutoOpts" chapter. Please refer to that doc for usage help.
+ */
+#ifndef AUTOOPTS_OPTS_H_GUARD
+#define AUTOOPTS_OPTS_H_GUARD 1
+#include <autoopts/options.h>
+
+/*
+ * Ensure that the library used for compiling this generated header is at
+ * least as new as the version current when the header template was released
+ * (not counting patch version increments). Also ensure that the oldest
+ * tolerable version is at least as old as what was current when the header
+ * template was released.
+ */
+#define AO_TEMPLATE_VERSION 147461
+#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
+ || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
+# error option template version mismatches autoopts/options.h header
+ Choke Me.
+#endif
+
+/*
+ * Enumeration of each option:
+ */
+typedef enum {
+ INDEX_OPT_WIDTH = 1,
+ INDEX_OPT_COLUMNS = 2,
+ INDEX_OPT_COL_WIDTH = 3,
+ INDEX_OPT_TAB_WIDTH = 4,
+ INDEX_OPT_SPREAD = 6,
+ INDEX_OPT_FILL = 7,
+ INDEX_OPT_INDENT = 8,
+ INDEX_OPT_FIRST_INDENT = 9,
+ INDEX_OPT_FORMAT = 10,
+ INDEX_OPT_SEPARATION = 11,
+ INDEX_OPT_LINE_SEPARATION = 12,
+ INDEX_OPT_ENDING = 13,
+ INDEX_OPT_BY_COLUMNS = 15,
+ INDEX_OPT_SORT = 16,
+ INDEX_OPT_INPUT = 18,
+ INDEX_OPT_VERSION = 19,
+ INDEX_OPT_HELP = 20,
+ INDEX_OPT_MORE_HELP = 21,
+ INDEX_OPT_SAVE_OPTS = 22,
+ INDEX_OPT_LOAD_OPTS = 23
+} teOptIndex;
+
+#define OPTION_CT 24
+#define COLUMNS_VERSION "1.2"
+#define COLUMNS_FULL_VERSION "columns (GNU AutoGen) 1.2"
+
+/*
+ * Interface defines for all options. Replace "n" with the UPPER_CASED
+ * option name (as in the teOptIndex enumeration above).
+ * e.g. HAVE_OPT(DIMENSIONS)
+ */
+#define DESC(n) (columnsOptions.pOptDesc[INDEX_OPT_## n])
+#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
+#define OPT_ARG(n) (DESC(n).optArg.argString)
+#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
+#define COUNT_OPT(n) (DESC(n).optOccCt)
+#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
+#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
+#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
+#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
+#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
+#define CLEAR_OPT(n) STMTS( \
+ DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
+ if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
+ DESC(n).fOptState |= OPTST_DISABLED; \
+ DESC(n).optCookie = NULL )
+
+/* * * * * *
+ *
+ * Enumeration of columns exit codes
+ */
+typedef enum {
+ COLUMNS_EXIT_SUCCESS = 0,
+ COLUMNS_EXIT_FAILURE = 1,
+ COLUMNS_EXIT_NO_CONFIG_INPUT = 66,
+ COLUMNS_EXIT_LIBOPTS_FAILURE = 70
+} columns_exit_code_t;
+/* * * * * *
+ *
+ * Interface defines for specific options.
+ */
+#define VALUE_OPT_WIDTH 'W'
+
+#define OPT_VALUE_WIDTH (DESC(WIDTH).optArg.argInt)
+#define VALUE_OPT_COLUMNS 'c'
+
+#define OPT_VALUE_COLUMNS (DESC(COLUMNS).optArg.argInt)
+#define VALUE_OPT_COL_WIDTH 'w'
+
+#define OPT_VALUE_COL_WIDTH (DESC(COL_WIDTH).optArg.argInt)
+#define VALUE_OPT_TAB_WIDTH 4
+
+#define OPT_VALUE_TAB_WIDTH (DESC(TAB_WIDTH).optArg.argInt)
+#define VALUE_OPT_SPREAD 6
+
+#define OPT_VALUE_SPREAD (DESC(SPREAD).optArg.argInt)
+#define VALUE_OPT_FILL 7
+#define VALUE_OPT_INDENT 'I'
+#define VALUE_OPT_FIRST_INDENT 9
+#define VALUE_OPT_FORMAT 'f'
+#define VALUE_OPT_SEPARATION 'S'
+#define VALUE_OPT_LINE_SEPARATION 12
+#define VALUE_OPT_ENDING 13
+#define VALUE_OPT_BY_COLUMNS 15
+#define VALUE_OPT_SORT 's'
+#define VALUE_OPT_INPUT 'i'
+#define VALUE_OPT_HELP '?'
+#define VALUE_OPT_MORE_HELP '!'
+#define VALUE_OPT_VERSION 'v'
+#define VALUE_OPT_SAVE_OPTS '>'
+#define VALUE_OPT_LOAD_OPTS '<'
+#define SET_OPT_SAVE_OPTS(a) STMTS( \
+ DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
+ DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
+ DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
+/*
+ * Interface defines not associated with particular options
+ */
+#define ERRSKIP_OPTERR STMTS(columnsOptions.fOptSet &= ~OPTPROC_ERRSTOP)
+#define ERRSTOP_OPTERR STMTS(columnsOptions.fOptSet |= OPTPROC_ERRSTOP)
+#define RESTART_OPT(n) STMTS( \
+ columnsOptions.curOptIdx = (n); \
+ columnsOptions.pzCurOpt = NULL)
+#define START_OPT RESTART_OPT(1)
+#define USAGE(c) (*columnsOptions.pUsageProc)(&columnsOptions, c)
+/* extracted from opthead.tlib near line 484 */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * global exported definitions
+ */
+#include "config.h"
+#include <ctype.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+/* * * * * *
+ *
+ * Declare the columns option descriptor.
+ */
+extern tOptions columnsOptions;
+
+#if defined(ENABLE_NLS)
+# ifndef _
+# include <stdio.h>
+# ifndef HAVE_GETTEXT
+ extern char * gettext(char const *);
+# else
+# include <libintl.h>
+# endif
+
+static inline char* aoGetsText(char const* pz) {
+ if (pz == NULL) return NULL;
+ return (char*)gettext(pz);
+}
+# define _(s) aoGetsText(s)
+# endif /* _() */
+
+# define OPT_NO_XLAT_CFG_NAMES STMTS(columnsOptions.fOptSet |= \
+ OPTPROC_NXLAT_OPT_CFG;)
+# define OPT_NO_XLAT_OPT_NAMES STMTS(columnsOptions.fOptSet |= \
+ OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
+
+# define OPT_XLAT_CFG_NAMES STMTS(columnsOptions.fOptSet &= \
+ ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
+# define OPT_XLAT_OPT_NAMES STMTS(columnsOptions.fOptSet &= \
+ ~OPTPROC_NXLAT_OPT;)
+
+#else /* ENABLE_NLS */
+# define OPT_NO_XLAT_CFG_NAMES
+# define OPT_NO_XLAT_OPT_NAMES
+
+# define OPT_XLAT_CFG_NAMES
+# define OPT_XLAT_OPT_NAMES
+
+# ifndef _
+# define _(_s) _s
+# endif
+#endif /* ENABLE_NLS */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* AUTOOPTS_OPTS_H_GUARD */
+/* opts.h ends here */
diff --git a/compat/Makefile.am b/compat/Makefile.am
new file mode 100644
index 0000000..81b9476
--- /dev/null
+++ b/compat/Makefile.am
@@ -0,0 +1,52 @@
+## -*- Mode: Makefile -*-
+##
+## Makefile.am -- process this file with automake to produce Makefile.in
+##
+## Time-stamp: "2012-04-07 09:31:30 bkorb"
+## Copyright (c) 1997-2012 by Bruce Korb
+## Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+COMPAT_CSRC = chmod.c pathfind.c snprintf.c strchr.c strdup.c strftime.c \
+ strsignal.c
+COMPAT_HDRS = compat.h strsignal.h windows-config.h unlocked-io.h
+COMPAT_GEN = bootstrap.dir strsignal.def strsignal.tpl
+EXTRA_DIST = $(COMPAT_CSRC) $(COMPAT_HDRS) $(COMPAT_GEN)
+
+MAINTAINERCLEANFILES = strsignal.h
+
+all:
+ :
+
+strsignal.h : strsignal.def strsignal.tpl
+ @if $(AGexe) --version >&- 2>&- ; then \
+ echo $(AGexe) -L $(srcdir) $(srcdir)/strsignal.def ; \
+ top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) \
+ $(AGexe) -L $(srcdir) $(srcdir)/strsignal.def ; \
+ elif $(AGnam) --version >&- 2>&- ; then \
+ echo $(AGnam) -L $(srcdir) $(srcdir)/strsignal.def ; \
+ top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) \
+ $(AGnam) -L $(srcdir) $(srcdir)/strsignal.def ; \
+ elif test -s $(srcdir)/$@; then \
+ echo "WARNING: $(AGnam) not available, current $(srcdir)/$@ used"; \
+ else \
+ echo "ERROR: $(srcdir)/$@ has been corrupted"; exit 1;\
+ fi
+
+.NOTPARALLEL:
+
+# compat/Makefile.am ends here
diff --git a/compat/Makefile.in b/compat/Makefile.in
new file mode 100644
index 0000000..5ea0a59
--- /dev/null
+++ b/compat/Makefile.in
@@ -0,0 +1,463 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = compat
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = @AGexe@
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = @CLexe@
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+COMPAT_CSRC = chmod.c pathfind.c snprintf.c strchr.c strdup.c strftime.c \
+ strsignal.c
+
+COMPAT_HDRS = compat.h strsignal.h windows-config.h unlocked-io.h
+COMPAT_GEN = bootstrap.dir strsignal.def strsignal.tpl
+EXTRA_DIST = $(COMPAT_CSRC) $(COMPAT_HDRS) $(COMPAT_GEN)
+MAINTAINERCLEANFILES = strsignal.h
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu compat/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu compat/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+all:
+ :
+
+strsignal.h : strsignal.def strsignal.tpl
+ @if $(AGexe) --version >&- 2>&- ; then \
+ echo $(AGexe) -L $(srcdir) $(srcdir)/strsignal.def ; \
+ top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) \
+ $(AGexe) -L $(srcdir) $(srcdir)/strsignal.def ; \
+ elif $(AGnam) --version >&- 2>&- ; then \
+ echo $(AGnam) -L $(srcdir) $(srcdir)/strsignal.def ; \
+ top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) \
+ $(AGnam) -L $(srcdir) $(srcdir)/strsignal.def ; \
+ elif test -s $(srcdir)/$@; then \
+ echo "WARNING: $(AGnam) not available, current $(srcdir)/$@ used"; \
+ else \
+ echo "ERROR: $(srcdir)/$@ has been corrupted"; exit 1;\
+ fi
+
+.NOTPARALLEL:
+
+# compat/Makefile.am ends here
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/compat/bootstrap.dir b/compat/bootstrap.dir
new file mode 100644
index 0000000..2c8027c
--- /dev/null
+++ b/compat/bootstrap.dir
@@ -0,0 +1,24 @@
+#! /bin/echo This_file_must_be_sourced,_not_executed
+##
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if [ -n "${AGexe}" ]
+then
+ top_srcdir=.. top_builddir=..
+ export top_srcdir top_builddir
+ echo "Rebuilding strsignal.h"
+ ${AGexe} strsignal.def
+fi
diff --git a/compat/chmod.c b/compat/chmod.c
new file mode 100644
index 0000000..01a1be0
--- /dev/null
+++ b/compat/chmod.c
@@ -0,0 +1,4 @@
+
+inline int chmod(char const * path, mode_t mode) {
+ return 0;
+}
diff --git a/compat/compat.h b/compat/compat.h
new file mode 100644
index 0000000..d3d1eab
--- /dev/null
+++ b/compat/compat.h
@@ -0,0 +1,403 @@
+/* -*- Mode: C -*- */
+
+/**
+ * \file compat.h --- fake the preprocessor into handlng portability
+ *
+ * Time-stamp: "2012-08-11 08:17:36 bkorb"
+ *
+ * compat.h is free software.
+ * This file is part of AutoGen.
+ *
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, Bruce Korb gives permission for additional
+ * uses of the text contained in the release of compat.h.
+ *
+ * The exception is that, if you link the compat.h library with other
+ * files to produce an executable, this does not by itself cause the
+ * resulting executable to be covered by the GNU General Public License.
+ * Your use of that executable is in no way restricted on account of
+ * linking the compat.h library code into it.
+ *
+ * This exception does not however invalidate any other reasons why
+ * the executable file might be covered by the GNU General Public License.
+ *
+ * This exception applies only to the code released by Bruce Korb under
+ * the name compat.h. If you copy code from other sources under the
+ * General Public License into a copy of compat.h, as the General Public
+ * License permits, the exception does not apply to the code that you add
+ * in this way. To avoid misleading anyone as to the status of such
+ * modified files, you must delete this exception notice from them.
+ *
+ * If you write modifications of your own for compat.h, it is your choice
+ * whether to permit this exception to apply to your modifications.
+ * If you do not wish that, delete this exception notice.
+ */
+#ifndef COMPAT_H_GUARD
+#define COMPAT_H_GUARD 1
+
+#if defined(HAVE_CONFIG_H)
+# include <config.h>
+
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+# include "windows-config.h"
+
+#else
+# error "compat.h" requires "config.h"
+ choke me.
+#endif
+
+
+#ifndef HAVE_STRSIGNAL
+# ifndef HAVE_RAW_DECL_STRSIGNAL
+ char * strsignal(int signo);
+# endif
+#endif
+
+#define _GNU_SOURCE 1 /* for strsignal in GNU's libc */
+#define __USE_GNU 1 /* exact same thing as above */
+#define __EXTENSIONS__ 1 /* and another way to call for it */
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * SYSTEM HEADERS:
+ */
+#include <sys/types.h>
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif
+#include <sys/param.h>
+#if HAVE_SYS_PROCSET_H
+# include <sys/procset.h>
+#endif
+#include <sys/stat.h>
+#ifdef HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+
+#if defined( HAVE_SOLARIS_SYSINFO )
+# include <sys/systeminfo.h>
+#elif defined( HAVE_UNAME_SYSCALL )
+# include <sys/utsname.h>
+#endif
+
+#ifdef DAEMON_ENABLED
+# if HAVE_SYS_STROPTS_H
+# include <sys/stropts.h>
+# endif
+
+# if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+# endif
+
+# if ! defined(HAVE_SYS_POLL_H) && ! defined(HAVE_SYS_SELECT_H)
+# error This system cannot support daemon processing
+ Choke Me.
+# endif
+
+# if HAVE_SYS_POLL_H
+# include <sys/poll.h>
+# endif
+
+# if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# endif
+
+# if HAVE_NETINET_IN_H
+# include <netinet/in.h>
+# endif
+
+# if HAVE_SYS_UN_H
+# include <sys/un.h>
+# endif
+#endif
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * USER HEADERS:
+ */
+#include <stdio.h>
+#include <assert.h>
+#include <ctype.h>
+
+/*
+ * Directory opening stuff:
+ */
+# if defined (_POSIX_SOURCE)
+/* Posix does not require that the d_ino field be present, and some
+ systems do not provide it. */
+# define REAL_DIR_ENTRY(dp) 1
+# else /* !_POSIX_SOURCE */
+# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
+# endif /* !_POSIX_SOURCE */
+
+# if defined (HAVE_DIRENT_H)
+# include <dirent.h>
+# define D_NAMLEN(dirent) strlen((dirent)->d_name)
+# else /* !HAVE_DIRENT_H */
+# define dirent direct
+# define D_NAMLEN(dirent) (dirent)->d_namlen
+# if defined (HAVE_SYS_NDIR_H)
+# include <sys/ndir.h>
+# endif /* HAVE_SYS_NDIR_H */
+# if defined (HAVE_SYS_DIR_H)
+# include <sys/dir.h>
+# endif /* HAVE_SYS_DIR_H */
+# if defined (HAVE_NDIR_H)
+# include <ndir.h>
+# endif /* HAVE_NDIR_H */
+# endif /* !HAVE_DIRENT_H */
+
+#include <errno.h>
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+#ifndef O_NONBLOCK
+# define O_NONBLOCK FNDELAY
+#endif
+
+#if defined(HAVE_LIBGEN) && defined(HAVE_LIBGEN_H)
+# include <libgen.h>
+#endif
+
+#if defined(HAVE_LIMITS_H) /* this is also in options.h */
+# include <limits.h>
+#elif defined(HAVE_SYS_LIMITS_H)
+# include <sys/limits.h>
+#endif /* HAVE_LIMITS/SYS_LIMITS_H */
+
+#include <memory.h>
+#include <setjmp.h>
+#include <signal.h>
+
+#if defined(HAVE_STDINT_H)
+# include <stdint.h>
+
+#elif defined(HAVE_INTTYPES_H)
+# include <inttypes.h>
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#ifdef HAVE_UTIME_H
+# include <utime.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_STDBOOL_H
+# include <stdbool.h>
+#else
+ typedef enum { false = 0, true = 1 } _Bool;
+# define bool _Bool
+
+ /* The other macros must be usable in preprocessor directives. */
+# define false 0
+# define true 1
+#endif
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * FIXUPS and CONVIENCE STUFF:
+ */
+#ifdef __cplusplus
+# define EXTERN extern "C"
+#else
+# define EXTERN extern
+#endif
+
+/* some systems #def errno! and others do not declare it!! */
+#ifndef errno
+ extern int errno;
+#endif
+
+/* Some machines forget this! */
+
+# ifndef EXIT_FAILURE
+# define EXIT_SUCCESS 0
+# define EXIT_FAILURE 1
+# endif
+
+#ifndef NUL
+# define NUL '\0'
+#endif
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+#if !defined (MAXPATHLEN) && defined (HAVE_SYS_PARAM_H)
+# include <sys/param.h>
+#endif /* !MAXPATHLEN && HAVE_SYS_PARAM_H */
+
+#if !defined (MAXPATHLEN) && defined (PATH_MAX)
+# define MAXPATHLEN PATH_MAX
+#endif /* !MAXPATHLEN && PATH_MAX */
+
+#if !defined (MAXPATHLEN) && defined(_MAX_PATH)
+# define PATH_MAX _MAX_PATH
+# define MAXPATHLEN _MAX_PATH
+#endif
+
+#if !defined (MAXPATHLEN)
+# define MAXPATHLEN ((size_t)4096)
+#endif /* MAXPATHLEN */
+
+#define AG_PATH_MAX ((size_t)MAXPATHLEN)
+
+#ifndef LONG_MAX
+# define LONG_MAX ~(1L << (8*sizeof(long) -1))
+# define INT_MAX ~(1 << (8*sizeof(int) -1))
+#endif
+
+#ifndef ULONG_MAX
+# define ULONG_MAX ~(OUL)
+# define UINT_MAX ~(OU)
+#endif
+
+#ifndef SHORT_MAX
+# define SHORT_MAX ~(1 << (8*sizeof(short) - 1))
+#else
+# define USHORT_MAX ~(OUS)
+#endif
+
+#ifndef HAVE_INT8_T
+ typedef signed char int8_t;
+# define HAVE_INT8_T 1
+#endif
+#ifndef HAVE_UINT8_T
+ typedef unsigned char uint8_t;
+# define HAVE_UINT8_T 1
+#endif
+#ifndef HAVE_INT16_T
+ typedef signed short int16_t;
+# define HAVE_INT16_T 1
+#endif
+#ifndef HAVE_UINT16_T
+ typedef unsigned short uint16_t;
+# define HAVE_UINT16_T 1
+#endif
+
+#ifndef HAVE_INT32_T
+# if SIZEOF_INT == 4
+ typedef signed int int32_t;
+# elif SIZEOF_LONG == 4
+ typedef signed long int32_t;
+# endif
+# define HAVE_INT32_T 1
+#endif
+
+#ifndef HAVE_UINT32_T
+# if SIZEOF_INT == 4
+ typedef unsigned int uint32_t;
+# elif SIZEOF_LONG == 4
+ typedef unsigned long uint32_t;
+# else
+# error Cannot create a uint32_t type.
+ Choke Me.
+# endif
+# define HAVE_UINT32_T 1
+#endif
+
+#ifndef HAVE_INTPTR_T
+# if SIZEOF_CHARP == SIZEOF_LONG
+ typedef signed long intptr_t;
+# else
+ typedef signed int intptr_t;
+# endif
+# define HAVE_INTPTR_T 1
+#endif
+
+#ifndef HAVE_UINTPTR_T
+# if SIZEOF_CHARP == SIZEOF_LONG
+ typedef unsigned long intptr_t;
+# else
+ typedef unsigned int intptr_t;
+# endif
+# define HAVE_INTPTR_T 1
+#endif
+
+#ifndef HAVE_UINT_T
+ typedef unsigned int uint_t;
+# define HAVE_UINT_T 1
+#endif
+
+#ifndef HAVE_SIZE_T
+ typedef unsigned int size_t;
+# define HAVE_SIZE_T 1
+#endif
+#ifndef HAVE_WINT_T
+ typedef unsigned int wint_t;
+# define HAVE_WINT_T 1
+#endif
+#ifndef HAVE_PID_T
+ typedef signed int pid_t;
+# define HAVE_PID_T 1
+#endif
+
+/* redefine these for BSD style string libraries */
+#ifndef HAVE_STRCHR
+# define strchr index
+# define strrchr rindex
+#endif
+
+#ifdef USE_FOPEN_BINARY
+# ifndef FOPEN_BINARY_FLAG
+# define FOPEN_BINARY_FLAG "b"
+# endif
+# ifndef FOPEN_TEXT_FLAG
+# define FOPEN_TEXT_FLAG "t"
+# endif
+#else
+# ifndef FOPEN_BINARY_FLAG
+# define FOPEN_BINARY_FLAG
+# endif
+# ifndef FOPEN_TEXT_FLAG
+# define FOPEN_TEXT_FLAG
+# endif
+#endif
+
+#ifndef STR
+# define _STR(s) #s
+# define STR(s) _STR(s)
+#endif
+
+/* ##### Pointer sized word ##### */
+
+/* FIXME: the MAX stuff in here is broken! */
+#if SIZEOF_CHARP > SIZEOF_INT
+ typedef long t_word;
+ #define WORD_MAX LONG_MAX
+ #define WORD_MIN LONG_MIN
+#else /* SIZEOF_CHARP <= SIZEOF_INT */
+ typedef int t_word;
+ #define WORD_MAX INT_MAX
+ #define WORD_MIN INT_MIN
+#endif
+
+#endif /* COMPAT_H_GUARD */
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of compat/compat.h */
diff --git a/compat/pathfind.c b/compat/pathfind.c
new file mode 100644
index 0000000..3f66812
--- /dev/null
+++ b/compat/pathfind.c
@@ -0,0 +1,335 @@
+/* -*- Mode: C -*- */
+
+/* pathfind.c --- find a FILE MODE along PATH */
+
+/*
+ * Author: Gary V Vaughan <gvaughan@oranda.demon.co.uk>
+ * Time-stamp: "2012-08-11 08:19:39 bkorb"
+ */
+
+/* Code: */
+
+#include "compat.h"
+#ifndef HAVE_PATHFIND
+#if defined(__windows__) && !defined(__CYGWIN__)
+char*
+pathfind( char const* path,
+ char const* fileName,
+ char const* mode )
+{
+ return NULL;
+}
+#else
+
+static char* make_absolute( char const *string, char const *dot_path );
+static char* canonicalize_pathname( char *path );
+static char* extract_colon_unit( char* dir, char const *string, int *p_index );
+
+
+/*=export_func pathfind
+ *
+ * what: fild a file in a list of directories
+ *
+ * ifndef: HAVE_PATHFIND
+ *
+ * arg: + char const* + path + colon separated list of search directories +
+ * arg: + char const* + file + the name of the file to look for +
+ * arg: + char const* + mode + the mode bits that must be set to match +
+ *
+ * ret_type: char*
+ * ret_desc: the path to the located file
+ *
+ * doc:
+ *
+ * pathfind looks for a a file with name "FILE" and "MODE" access
+ * along colon delimited "PATH", and returns the full pathname as a
+ * string, or NULL if not found. If "FILE" contains a slash, then
+ * it is treated as a relative or absolute path and "PATH" is ignored.
+ *
+ * @strong{NOTE}: this function is compiled into @file{libopts} only if
+ * it is not natively supplied.
+ *
+ * The "MODE" argument is a string of option letters chosen from the
+ * list below:
+ * @example
+ * Letter Meaning
+ * r readable
+ * w writable
+ * x executable
+ * f normal file (NOT IMPLEMENTED)
+ * b block special (NOT IMPLEMENTED)
+ * c character special (NOT IMPLEMENTED)
+ * d directory (NOT IMPLEMENTED)
+ * p FIFO (pipe) (NOT IMPLEMENTED)
+ * u set user ID bit (NOT IMPLEMENTED)
+ * g set group ID bit (NOT IMPLEMENTED)
+ * k sticky bit (NOT IMPLEMENTED)
+ * s size nonzero (NOT IMPLEMENTED)
+ * @end example
+ *
+ * example:
+ * To find the "ls" command using the "PATH" environment variable:
+ * @example
+ * #include <stdlib.h>
+ * char* pz_ls = pathfind( getenv("PATH"), "ls", "rx" );
+ * <<do whatever with pz_ls>>
+ * free( pz_ls );
+ * @end example
+ * The path is allocated with @code{malloc(3C)}, so you must @code{free(3C)}
+ * the result. Also, do not use unimplemented file modes. :-)
+ *
+ * err: returns NULL if the file is not found.
+=*/
+char*
+pathfind( char const* path,
+ char const* fileName,
+ char const* mode )
+{
+ int p_index = 0;
+ int mode_bits = 0;
+ char* pathName = NULL;
+ char zPath[ AG_PATH_MAX + 1 ];
+
+ if (strchr( mode, 'r' )) mode_bits |= R_OK;
+ if (strchr( mode, 'w' )) mode_bits |= W_OK;
+ if (strchr( mode, 'x' )) mode_bits |= X_OK;
+
+ /*
+ * FOR each non-null entry in the colon-separated path, DO ...
+ */
+ for (;;) {
+ DIR* dirP;
+ char* colon_unit = extract_colon_unit( zPath, path, &p_index );
+
+ /*
+ * IF no more entries, THEN quit
+ */
+ if (colon_unit == NULL)
+ break;
+
+ dirP = opendir( colon_unit );
+
+ /*
+ * IF the directory is inaccessable, THEN next directory
+ */
+ if (dirP == NULL)
+ continue;
+
+ /*
+ * FOR every entry in the given directory, ...
+ */
+ for (;;) {
+ struct dirent *entP = readdir( dirP );
+
+ if (entP == (struct dirent*)NULL)
+ break;
+
+ /*
+ * IF the file name matches the one we are looking for, ...
+ */
+ if (strcmp( entP->d_name, fileName ) == 0) {
+ char* pzFullName = make_absolute( fileName, colon_unit);
+
+ /*
+ * Make sure we can access it in the way we want
+ */
+ if (access( pzFullName, mode_bits ) >= 0) {
+ /*
+ * We can, so normalize the name and return it below
+ */
+ pathName = canonicalize_pathname( pzFullName );
+ }
+
+ free( (void*)pzFullName );
+ break;
+ }
+ }
+
+ closedir( dirP );
+
+ if (pathName != NULL)
+ break;
+ }
+
+ return pathName;
+}
+
+/*
+ * Turn STRING (a pathname) into an absolute pathname, assuming that
+ * DOT_PATH contains the symbolic location of `.'. This always returns
+ * a new string, even if STRING was an absolute pathname to begin with.
+ */
+static char*
+make_absolute( char const *string, char const *dot_path )
+{
+ char *result;
+ int result_len;
+
+ if (!dot_path || *string == '/') {
+ result = strdup( string );
+ } else {
+ if (dot_path && dot_path[0]) {
+ result = malloc( 2 + strlen( dot_path ) + strlen( string ) );
+ strcpy( result, dot_path );
+ result_len = strlen( result );
+ if (result[result_len - 1] != '/') {
+ result[result_len++] = '/';
+ result[result_len] = '\0';
+ }
+ } else {
+ result = malloc( 3 + strlen( string ) );
+ result[0] = '.'; result[1] = '/'; result[2] = '\0';
+ result_len = 2;
+ }
+
+ strcpy( result + result_len, string );
+ }
+
+ return result;
+}
+
+/*
+ * Canonicalize PATH, and return a new path. The new path differs from
+ * PATH in that:
+ *
+ * Multiple `/'s are collapsed to a single `/'.
+ * Leading `./'s are removed.
+ * Trailing `/.'s are removed.
+ * Trailing `/'s are removed.
+ * Non-leading `../'s and trailing `..'s are handled by removing
+ * portions of the path.
+ */
+static char*
+canonicalize_pathname( char *path )
+{
+ int i, start;
+ char stub_char, *result;
+
+ /* The result cannot be larger than the input PATH. */
+ result = strdup( path );
+
+ stub_char = (*path == '/') ? '/' : '.';
+
+ /* Walk along RESULT looking for things to compact. */
+ i = 0;
+ while (result[i]) {
+ while (result[i] != '\0' && result[i] != '/')
+ i++;
+
+ start = i++;
+
+ /* If we didn't find any slashes, then there is nothing left to
+ * do.
+ */
+ if (!result[start])
+ break;
+
+ /* Handle multiple `/'s in a row. */
+ while (result[i] == '/')
+ i++;
+
+#if !defined (apollo)
+ if ((start + 1) != i)
+#else
+ if ((start + 1) != i && (start != 0 || i != 2))
+#endif /* apollo */
+ {
+ strcpy( result + start + 1, result + i );
+ i = start + 1;
+ }
+
+ /* Handle backquoted `/'. */
+ if (start > 0 && result[start - 1] == '\\')
+ continue;
+
+ /* Check for trailing `/', and `.' by itself. */
+ if ((start && !result[i])
+ || (result[i] == '.' && !result[i+1])) {
+ result[--i] = '\0';
+ break;
+ }
+
+ /* Check for `../', `./' or trailing `.' by itself. */
+ if (result[i] == '.') {
+ /* Handle `./'. */
+ if (result[i + 1] == '/') {
+ strcpy( result + i, result + i + 1 );
+ i = (start < 0) ? 0 : start;
+ continue;
+ }
+
+ /* Handle `../' or trailing `..' by itself. */
+ if (result[i + 1] == '.' &&
+ (result[i + 2] == '/' || !result[i + 2])) {
+ while (--start > -1 && result[start] != '/')
+ ;
+ strcpy( result + start + 1, result + i + 2 );
+ i = (start < 0) ? 0 : start;
+ continue;
+ }
+ }
+ }
+
+ if (!*result) {
+ *result = stub_char;
+ result[1] = '\0';
+ }
+
+ return result;
+}
+
+/*
+ * Given a string containing units of information separated by colons,
+ * return the next one pointed to by (P_INDEX), or NULL if there are no
+ * more. Advance (P_INDEX) to the character after the colon.
+ */
+static char*
+extract_colon_unit( char* pzDir, char const *string, int *p_index )
+{
+ char* pzDest = pzDir;
+ int ix = *p_index;
+
+ if (string == NULL)
+ return NULL;
+
+ if ((unsigned)ix >= strlen( string ))
+ return NULL;
+
+ {
+ char const* pzSrc = string + ix;
+
+ while (*pzSrc == ':') pzSrc++;
+
+ for (;;) {
+ char ch = (*(pzDest++) = *(pzSrc++));
+ switch (ch) {
+ case ':':
+ pzDest[-1] = NUL;
+ /* FALLTHROUGH */
+ case NUL:
+ goto copy_done;
+ }
+
+ if ((unsigned long)(pzDest - pzDir) >= AG_PATH_MAX)
+ break;
+ } copy_done:;
+
+ ix = pzSrc - string;
+ }
+
+ if (*pzDir == NUL)
+ return NULL;
+
+ *p_index = ix;
+ return pzDir;
+}
+#endif /* __windows__ / __CYGWIN__ */
+#endif /* HAVE_PATHFIND */
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of compat/pathfind.c */
diff --git a/compat/snprintf.c b/compat/snprintf.c
new file mode 100644
index 0000000..fc91d63
--- /dev/null
+++ b/compat/snprintf.c
@@ -0,0 +1,60 @@
+
+#ifndef HAVE_VPRINTF
+#include "choke-me: no vprintf and no snprintf"
+#endif
+
+#if defined(HAVE_STDARG_H)
+# include <stdarg.h>
+# ifndef VA_START
+# define VA_START(a, f) va_start(a, f)
+# define VA_END(a) va_end(a)
+# endif /* VA_START */
+# define SNV_USING_STDARG_H
+
+#elif defined(HAVE_VARARGS_H)
+# include <varargs.h>
+# ifndef VA_START
+# define VA_START(a, f) va_start(a)
+# define VA_END(a) va_end(a)
+# endif /* VA_START */
+# undef SNV_USING_STDARG_H
+
+#else
+# include "must-have-stdarg-or-varargs"
+#endif
+
+static int
+snprintf(char *str, size_t n, char const *fmt, ...)
+{
+ va_list ap;
+ int rval;
+
+#ifdef VSPRINTF_CHARSTAR
+ char *rp;
+ VA_START(ap, fmt);
+ rp = vsprintf(str, fmt, ap);
+ VA_END(ap);
+ rval = strlen(rp);
+
+#else
+ VA_START(ap, fmt);
+ rval = vsprintf(str, fmt, ap);
+ VA_END(ap);
+#endif
+
+ if (rval > n) {
+ fprintf(stderr, "snprintf buffer overrun %d > %d\n", rval, (int)n);
+ abort();
+ }
+ return rval;
+}
+
+static int
+vsnprintf( char *str, size_t n, char const *fmt, va_list ap )
+{
+#ifdef VSPRINTF_CHARSTAR
+ return (strlen(vsprintf(str, fmt, ap)));
+#else
+ return (vsprintf(str, fmt, ap));
+#endif
+}
diff --git a/compat/strchr.c b/compat/strchr.c
new file mode 100644
index 0000000..413f999
--- /dev/null
+++ b/compat/strchr.c
@@ -0,0 +1,60 @@
+/*
+ SYNOPSIS
+ #include <string.h>
+
+ char *strchr(char const *s, int c);
+
+ char *strrchr(char const *s, int c);
+
+ DESCRIPTION
+ The strchr() function returns a pointer to the first occurrence of the
+ character c in the string s.
+
+ The strrchr() function returns a pointer to the last occurrence of the
+ character c in the string s.
+
+ Here "character" means "byte" - these functions do not work with wide
+ or multi-byte characters.
+
+ RETURN VALUE
+ The strchr() and strrchr() functions return a pointer to the matched
+ character or NULL if the character is not found.
+
+ CONFORMING TO
+ SVID 3, POSIX, BSD 4.3, ISO 9899
+*/
+
+char*
+strchr( char const *s, int c)
+{
+ do {
+ if ((unsigned)*s == (unsigned)c)
+ return s;
+
+ } while (*(++s) != NUL);
+
+ return NULL;
+}
+
+char*
+strrchr( char const *s, int c)
+{
+ char const *e = s + strlen(s);
+
+ for (;;) {
+ if (--e < s)
+ break;
+
+ if ((unsigned)*e == (unsigned)c)
+ return e;
+ }
+ return NULL;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of compat/strsignal.c */
diff --git a/compat/strdup.c b/compat/strdup.c
new file mode 100644
index 0000000..e2933a8
--- /dev/null
+++ b/compat/strdup.c
@@ -0,0 +1,19 @@
+/*
+ * Platforms without strdup ?!?!?!
+ */
+
+static char *
+strdup( char const *s )
+{
+ char *cp;
+
+ if (s == NULL)
+ return NULL;
+
+ cp = (char *) AGALOC((unsigned) (strlen(s)+1), "strdup");
+
+ if (cp != NULL)
+ (void) strcpy(cp, s);
+
+ return cp;
+}
diff --git a/compat/strftime.c b/compat/strftime.c
new file mode 100644
index 0000000..400ad52
--- /dev/null
+++ b/compat/strftime.c
@@ -0,0 +1,1049 @@
+/*
+ NOTE: The canonical source of this file is maintained with the GNU C
+ Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef _LIBC
+# define HAVE_LIMITS_H 1
+# define HAVE_MBLEN 1
+# define HAVE_MBRLEN 1
+# define HAVE_STRUCT_ERA_ENTRY 1
+# define HAVE_TM_GMTOFF 1
+# define HAVE_TM_ZONE 1
+# define HAVE_TZNAME 1
+# define HAVE_TZSET 1
+# define MULTIBYTE_IS_FORMAT_SAFE 1
+# define STDC_HEADERS 1
+# include <ansidecl.h>
+# include "../locale/localeinfo.h"
+#endif
+
+#include <ctype.h>
+#include <sys/types.h> /* Some systems define `time_t' here. */
+
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_TZNAME
+extern char *tzname[];
+#endif
+
+/* Do multibyte processing if multibytes are supported, unless
+ multibyte sequences are safe in formats. Multibyte sequences are
+ safe if they cannot contain byte sequences that look like format
+ conversion specifications. The GNU C Library uses UTF8 multibyte
+ encoding, which is safe for formats, but strftime.c can be used
+ with other C libraries that use unsafe encodings. */
+#define DO_MULTIBYTE (HAVE_MBLEN && ! MULTIBYTE_IS_FORMAT_SAFE)
+
+#if DO_MULTIBYTE
+# if HAVE_MBRLEN
+# include <wchar.h>
+# else
+ /* Simulate mbrlen with mblen as best we can. */
+# define mbstate_t int
+# define mbrlen(s, n, ps) mblen (s, n)
+# define mbsinit(ps) (*(ps) == 0)
+# endif
+ static const mbstate_t mbstate_zero;
+#endif
+
+#if HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
+#if STDC_HEADERS
+# include <stddef.h>
+# include <stdlib.h>
+# include <string.h>
+#else
+# define memcpy(d, s, n) bcopy ((s), (d), (n))
+#endif
+
+#ifndef __P
+# if defined (__GNUC__) || (defined (__STDC__) && __STDC__)
+# define __P(args) args
+# else
+# define __P(args) ()
+# endif /* GCC. */
+#endif /* Not __P. */
+
+#ifndef PTR
+# ifdef __STDC__
+# define PTR void *
+# else
+# define PTR char *
+# endif
+#endif
+
+#ifndef CHAR_BIT
+# define CHAR_BIT 8
+#endif
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+#define TYPE_SIGNED(t) ((t) -1 < 0)
+
+/* Bound on length of the string representing an integer value of type t.
+ Subtract one for the sign bit if t is signed;
+ 302 / 1000 is log10 (2) rounded up;
+ add one for integer division truncation;
+ add one more for a minus sign if t is signed. */
+#define INT_STRLEN_BOUND(t) \
+ ((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 100 + 1 + TYPE_SIGNED (t))
+
+#define TM_YEAR_BASE 1900
+
+#ifndef __isleap
+/* Nonzero if YEAR is a leap year (every 4 years,
+ except every 100th isn't, and every 400th is). */
+# define __isleap(year) \
+ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
+#endif
+
+
+#ifdef _LIBC
+# define gmtime_r __gmtime_r
+# define localtime_r __localtime_r
+extern int __tz_compute __P ((time_t timer, const struct tm *tm));
+# define tzname __tzname
+# define tzset __tzset
+#else
+# if ! HAVE_LOCALTIME_R
+# if ! HAVE_TM_GMTOFF
+/* Approximate gmtime_r as best we can in its absence. */
+# define gmtime_r my_gmtime_r
+static struct tm *gmtime_r __P ((const time_t *, struct tm *));
+static struct tm *
+gmtime_r (const time_t *t, struct tm *tp)
+{
+ struct tm *l = gmtime (t);
+ if (! l)
+ return 0;
+ *tp = *l;
+ return tp;
+}
+# endif /* ! HAVE_TM_GMTOFF */
+
+/* Approximate localtime_r as best we can in its absence. */
+# define localtime_r my_localtime_r
+static struct tm *localtime_r __P ((const time_t *, struct tm *));
+static struct tm *
+localtime_r (const time_t *t, struct tm *tp)
+{
+ struct tm *l = localtime (t);
+ if (! l)
+ return 0;
+ *tp = *l;
+ return tp;
+}
+# endif /* ! HAVE_LOCALTIME_R */
+#endif /* ! defined (_LIBC) */
+
+
+#if !defined (memset) && !HAVE_MEMSET && !_LIBC
+/* Some systems lack the `memset' function and we don't want to
+ introduce additional dependencies. */
+static char const spaces[16] = " ";
+
+# define memset_space(P, Len) \
+ do { \
+ int _len = (Len); \
+ \
+ do \
+ { \
+ int _this = _len > 16 ? 16 : _len; \
+ memcpy ((P), spaces, (size_t) _this); \
+ (P) += _this; \
+ _len -= _this; \
+ } \
+ while (_len > 0); \
+ } while (false)
+#else
+# define memset_space(P, Len) memset ((P), ' ', (size_t) (Len))
+#endif
+
+#define add(n, f) \
+ do \
+ { \
+ int _n = (n); \
+ int _delta = width - _n; \
+ int _incr = _n + (_delta > 0 ? _delta : 0); \
+ if (i + _incr >= maxsize) \
+ return 0; \
+ if (p) \
+ { \
+ if (_delta > 0) \
+ memset_space (p, _delta); \
+ f; \
+ p += _n; \
+ } \
+ i += _incr; \
+ } while (false)
+
+#define cpy(n, s) \
+ add ((n), \
+ if (to_lowcase) \
+ memcpy_lowcase (p, (s), (size_t) _n); \
+ else if (to_uppcase) \
+ memcpy_uppcase (p, (s), (size_t) _n); \
+ else \
+ memcpy ((PTR) p, (PTR) (s), (size_t) _n))
+
+
+
+#ifdef _LIBC
+# define TOUPPER(Ch) toupper (Ch)
+# define TOLOWER(Ch) tolower (Ch)
+#else
+# define TOUPPER(Ch) (islower (Ch) ? toupper (Ch) : (Ch))
+# define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
+#endif
+/* We don't use `isdigit' here since the locale dependent
+ interpretation is not what we want here. We only need to accept
+ the arabic digits in the ASCII range. One day there is perhaps a
+ more reliable way to accept other sets of digits. */
+#define ISDIGIT(Ch) ((unsigned int) (Ch) - '0' <= 9)
+
+static char *memcpy_lowcase __P ((char *dest, char const *src, size_t len));
+
+static char *
+memcpy_lowcase (char *dest, char const *src, size_t len)
+{
+ while (len-- > 0)
+ dest[len] = TOLOWER (src[len]);
+ return dest;
+}
+
+static char *memcpy_uppcase __P ((char *dest, char const *src, size_t len));
+
+static char *
+memcpy_uppcase (char *dest, char const *src, size_t len)
+{
+ while (len-- > 0)
+ dest[len] = TOUPPER (src[len]);
+ return dest;
+}
+
+#if ! HAVE_TM_GMTOFF
+/* Yield the difference between *A and *B,
+ measured in seconds, ignoring leap seconds. */
+static int tm_diff __P ((const struct tm *, const struct tm *));
+static int
+tm_diff (const struct tm *a, const struct tm *b)
+{
+ /* Compute intervening leap days correctly even if year is negative.
+ Take care to avoid int overflow in leap day calculations,
+ but it's OK to assume that A and B are close to each other. */
+ int a4 = (a->tm_year >> 2) + (TM_YEAR_BASE >> 2) - ! (a->tm_year & 3);
+ int b4 = (b->tm_year >> 2) + (TM_YEAR_BASE >> 2) - ! (b->tm_year & 3);
+ int a100 = a4 / 25 - (a4 % 25 < 0);
+ int b100 = b4 / 25 - (b4 % 25 < 0);
+ int a400 = a100 >> 2;
+ int b400 = b100 >> 2;
+ int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
+ int years = a->tm_year - b->tm_year;
+ int days = (365 * years + intervening_leap_days
+ + (a->tm_yday - b->tm_yday));
+ return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
+ + (a->tm_min - b->tm_min))
+ + (a->tm_sec - b->tm_sec));
+}
+#endif /* ! HAVE_TM_GMTOFF */
+
+
+
+/* The number of days from the first day of the first ISO week of this
+ year to the year day YDAY with week day WDAY. ISO weeks start on
+ Monday; the first ISO week has the year's first Thursday. YDAY may
+ be as small as YDAY_MINIMUM. */
+#define ISO_WEEK_START_WDAY 1 /* Monday */
+#define ISO_WEEK1_WDAY 4 /* Thursday */
+#define YDAY_MINIMUM (-366)
+static int iso_week_days __P ((int, int));
+#ifdef __GNUC__
+inline
+#endif
+static int
+iso_week_days (int yday, int wday)
+{
+ /* Add enough to the first operand of % to make it nonnegative. */
+ int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
+ return (yday
+ - (yday - wday + ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7
+ + ISO_WEEK1_WDAY - ISO_WEEK_START_WDAY);
+}
+
+
+#ifndef _NL_CURRENT
+static char const weekday_name[][10] =
+ {
+ "Sunday", "Monday", "Tuesday", "Wednesday",
+ "Thursday", "Friday", "Saturday"
+ };
+static char const month_name[][10] =
+ {
+ "January", "February", "March", "April", "May", "June",
+ "July", "August", "September", "October", "November", "December"
+ };
+#endif
+
+
+#if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
+ /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
+ Work around this bug by copying *tp before it might be munged. */
+ size_t _strftime_copytm __P ((char *, size_t, char const *,
+ const struct tm *));
+ size_t
+ strftime (s, maxsize, format, tp)
+ char *s;
+ size_t maxsize;
+ char const *format;
+ const struct tm *tp;
+ {
+ struct tm tmcopy;
+ tmcopy = *tp;
+ return _strftime_copytm (s, maxsize, format, &tmcopy);
+}
+# ifdef strftime
+# undef strftime
+# endif
+# define strftime _strftime_copytm
+#endif
+
+
+
+/* Write information from TP into S according to the format
+ string FORMAT, writing no more that MAXSIZE characters
+ (including the terminating '\0') and returning number of
+ characters written. If S is NULL, nothing will be written
+ anywhere, so to determine how many characters would be
+ written, use NULL for S and (size_t) UINT_MAX for MAXSIZE. */
+size_t
+strftime (char *s, size_t maxsize, char const *format, const struct tm *tp)
+{
+ int hour12 = tp->tm_hour;
+#ifdef _NL_CURRENT
+ char const *const a_wkday = _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday);
+ char const *const f_wkday = _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday);
+ char const *const a_month = _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon);
+ char const *const f_month = _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon);
+ char const *const ampm = _NL_CURRENT (LC_TIME,
+ hour12 > 11 ? PM_STR : AM_STR);
+ size_t aw_len = strlen (a_wkday);
+ size_t am_len = strlen (a_month);
+ size_t ap_len = strlen (ampm);
+#else
+ char const *const f_wkday = weekday_name[tp->tm_wday];
+ char const *const f_month = month_name[tp->tm_mon];
+ char const *const a_wkday = f_wkday;
+ char const *const a_month = f_month;
+ char const *const ampm = "AMPM" + 2 * (hour12 > 11);
+ size_t aw_len = 3;
+ size_t am_len = 3;
+ size_t ap_len = 2;
+#endif
+ size_t wkday_len = strlen (f_wkday);
+ size_t month_len = strlen (f_month);
+ char const *zone;
+ size_t zonelen;
+ size_t i = 0;
+ char *p = s;
+ char const *f;
+
+ zone = NULL;
+#if !defined _LIBC && HAVE_TM_ZONE
+ /* XXX We have some problems here. First, the string pointed to by
+ tm_zone is dynamically allocated while loading the zone data. But
+ when another zone is loaded since the information in TP were
+ computed this would be a stale pointer.
+ The second problem is the POSIX test suite which assumes setting
+ the environment variable TZ to a new value before calling strftime()
+ will influence the result (the %Z format) even if the information in
+ TP is computed with a totally different time zone. --drepper@gnu */
+ zone = (char const *) tp->tm_zone;
+#endif
+#if HAVE_TZNAME
+ /* POSIX.1 8.1.1 requires that whenever strftime() is called, the
+ time zone names contained in the external variable `tzname' shall
+ be set as if the tzset() function had been called. */
+# if HAVE_TZSET
+ tzset ();
+# endif
+
+ if (!(zone && *zone) && tp->tm_isdst >= 0)
+ zone = tzname[tp->tm_isdst];
+#endif
+ if (! zone)
+ zone = ""; /* POSIX.2 requires the empty string here. */
+
+ zonelen = strlen (zone);
+
+ if (hour12 > 12)
+ hour12 -= 12;
+ else
+ if (hour12 == 0) hour12 = 12;
+
+ for (f = format; *f != '\0'; ++f)
+ {
+ int pad; /* Padding for number ('-', '_', or 0). */
+ int modifier; /* Field modifier ('E', 'O', or 0). */
+ int digits; /* Max digits for numeric format. */
+ int number_value; /* Numeric value to be printed. */
+ int negative_number; /* 1 if the number is negative. */
+ char const *subfmt;
+ char *bufp;
+ char buf[1 + (sizeof (int) < sizeof (time_t)
+ ? INT_STRLEN_BOUND (time_t)
+ : INT_STRLEN_BOUND (int))];
+ int width = -1;
+ int to_lowcase = 0;
+ int to_uppcase = 0;
+
+#if DO_MULTIBYTE
+
+ switch (*f)
+ {
+ case '%':
+ break;
+
+#if __STDC__
+ case '\a':
+#else
+ case 7: /* '\a' is ASCII decimal value 7. */
+#endif
+ case '\b': case '\t': case '\n':
+ case '\v': case '\f': case '\r':
+ case ' ': case '!': case '"': case '#': case '&': case'\'':
+ case '(': case ')': case '*': case '+': case ',': case '-':
+ case '.': case '/': case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7': case '8': case '9':
+ case ':': case ';': case '<': case '=': case '>': case '?':
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+ case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+ case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+ case 'Y': case 'Z': case '[': case'\\': case ']': case '^':
+ case '_': case 'a': case 'b': case 'c': case 'd': case 'e':
+ case 'f': case 'g': case 'h': case 'i': case 'j': case 'k':
+ case 'l': case 'm': case 'n': case 'o': case 'p': case 'q':
+ case 'r': case 's': case 't': case 'u': case 'v': case 'w':
+ case 'x': case 'y': case 'z': case '{': case '|': case '}':
+ case '~':
+ /* The C Standard requires these 98 characters (plus '%') to
+ be in the basic execution character set. None of these
+ characters can start a multibyte sequence, so they need
+ not be analyzed further. */
+ add (1, *p = *f);
+ continue;
+
+ default:
+ /* Copy this multibyte sequence until we reach its end, find
+ an error, or come back to the initial shift state. */
+ {
+ mbstate_t mbstate = mbstate_zero;
+ size_t len = 0;
+
+ do
+ {
+ size_t bytes = mbrlen (f + len, (size_t) -1, &mbstate);
+
+ if (bytes == 0)
+ break;
+
+ if (bytes == (size_t) -2 || bytes == (size_t) -1)
+ {
+ len++;
+ break;
+ }
+
+ len += bytes;
+ }
+ while (! mbsinit (&mbstate));
+
+ cpy (len, f);
+ continue;
+ }
+ }
+
+#else /* ! DO_MULTIBYTE */
+
+ /* Either multibyte encodings are not supported, or they are
+ safe for formats, so any non-'%' byte can be copied through. */
+ if (*f != '%')
+ {
+ add (1, *p = *f);
+ continue;
+ }
+
+#endif /* ! DO_MULTIBYTE */
+
+ /* Check for flags that can modify a format. */
+ pad = 0;
+ while (1)
+ {
+ switch (*++f)
+ {
+ /* This influences the number formats. */
+ case '_':
+ case '-':
+ case '0':
+ pad = *f;
+ continue;
+
+ /* This changes textual output. */
+ case '^':
+ to_uppcase = 1;
+ continue;
+
+ default:
+ break;
+ }
+ break;
+ }
+
+ /* As a GNU extension we allow to specify the field width. */
+ if (ISDIGIT (*f))
+ {
+ width = 0;
+ do
+ {
+ width *= 10;
+ width += *f - '0';
+ ++f;
+ }
+ while (ISDIGIT (*f));
+ }
+
+ /* Check for modifiers. */
+ switch (*f)
+ {
+ case 'E':
+ case 'O':
+ modifier = *f++;
+ break;
+
+ default:
+ modifier = 0;
+ break;
+ }
+
+ /* Now do the specified format. */
+ switch (*f)
+ {
+#define DO_NUMBER(d, v) \
+ digits = d; number_value = v; goto do_number
+#define DO_NUMBER_SPACEPAD(d, v) \
+ digits = d; number_value = v; goto do_number_spacepad
+
+ case '%':
+ if (modifier != 0)
+ goto bad_format;
+ add (1, *p = *f);
+ break;
+
+ case 'a':
+ if (modifier != 0)
+ goto bad_format;
+ cpy (aw_len, a_wkday);
+ break;
+
+ case 'A':
+ if (modifier != 0)
+ goto bad_format;
+ cpy (wkday_len, f_wkday);
+ break;
+
+ case 'b':
+ case 'h': /* POSIX.2 extension. */
+ if (modifier != 0)
+ goto bad_format;
+ cpy (am_len, a_month);
+ break;
+
+ case 'B':
+ if (modifier != 0)
+ goto bad_format;
+ cpy (month_len, f_month);
+ break;
+
+ case 'c':
+ if (modifier == 'O')
+ goto bad_format;
+#ifdef _NL_CURRENT
+ if (! (modifier == 'E'
+ && *(subfmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT)) != '\0'))
+ subfmt = _NL_CURRENT (LC_TIME, D_T_FMT);
+#else
+ subfmt = "%a %b %e %H:%M:%S %Y";
+#endif
+
+ subformat:
+ {
+ char *old_start = p;
+ size_t len = strftime (NULL, maxsize - i, subfmt, tp);
+ if (len == 0 && *subfmt)
+ return 0;
+ add (len, strftime (p, maxsize - i, subfmt, tp));
+
+ if (to_uppcase)
+ while (old_start < p)
+ {
+ *old_start = TOUPPER (*old_start);
+ ++old_start;
+ }
+ }
+ break;
+
+ case 'C': /* POSIX.2 extension. */
+ if (modifier == 'O')
+ goto bad_format;
+#if HAVE_STRUCT_ERA_ENTRY
+ if (modifier == 'E')
+ {
+ struct era_entry *era = _nl_get_era_entry (tp);
+ if (era)
+ {
+ size_t len = strlen (era->name_fmt);
+ cpy (len, era->name_fmt);
+ break;
+ }
+ }
+#endif
+ {
+ int year = tp->tm_year + TM_YEAR_BASE;
+ DO_NUMBER (1, year / 100 - (year % 100 < 0));
+ }
+
+ case 'x':
+ if (modifier == 'O')
+ goto bad_format;
+#ifdef _NL_CURRENT
+ if (! (modifier == 'E'
+ && *(subfmt = _NL_CURRENT (LC_TIME, ERA_D_FMT)) != '\0'))
+ subfmt = _NL_CURRENT (LC_TIME, D_FMT);
+ goto subformat;
+#endif
+ /* Fall through. */
+ case 'D': /* POSIX.2 extension. */
+ if (modifier != 0)
+ goto bad_format;
+ subfmt = "%m/%d/%y";
+ goto subformat;
+
+ case 'd':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, tp->tm_mday);
+
+ case 'e': /* POSIX.2 extension. */
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER_SPACEPAD (2, tp->tm_mday);
+
+ /* All numeric formats set DIGITS and NUMBER_VALUE and then
+ jump to one of these two labels. */
+
+ do_number_spacepad:
+ /* Force `_' flag unless overwritten by `0' flag. */
+ if (pad != '0')
+ pad = '_';
+
+ do_number:
+ /* Format the number according to the MODIFIER flag. */
+
+#ifdef _NL_CURRENT
+ if (modifier == 'O' && 0 <= number_value)
+ {
+ /* Get the locale specific alternate representation of
+ the number NUMBER_VALUE. If none exist NULL is returned. */
+ char const *cp = _nl_get_alt_digit (number_value);
+
+ if (cp != NULL)
+ {
+ size_t digitlen = strlen (cp);
+ if (digitlen != 0)
+ {
+ cpy (digitlen, cp);
+ break;
+ }
+ }
+ }
+#endif
+ {
+ unsigned int u = number_value;
+
+ bufp = buf + sizeof (buf);
+ negative_number = number_value < 0;
+
+ if (negative_number)
+ u = -u;
+
+ do
+ *--bufp = u % 10 + '0';
+ while ((u /= 10) != 0);
+ }
+
+ do_number_sign_and_padding:
+ if (negative_number)
+ *--bufp = '-';
+
+ if (pad != '-')
+ {
+ int padding = digits - (buf + sizeof (buf) - bufp);
+
+ if (pad == '_')
+ {
+ while (0 < padding--)
+ *--bufp = ' ';
+ }
+ else
+ {
+ bufp += negative_number;
+ while (0 < padding--)
+ *--bufp = '0';
+ if (negative_number)
+ *--bufp = '-';
+ }
+ }
+
+ cpy (buf + sizeof (buf) - bufp, bufp);
+ break;
+
+
+ case 'H':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, tp->tm_hour);
+
+ case 'I':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, hour12);
+
+ case 'k': /* GNU extension. */
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER_SPACEPAD (2, tp->tm_hour);
+
+ case 'l': /* GNU extension. */
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER_SPACEPAD (2, hour12);
+
+ case 'j':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (3, 1 + tp->tm_yday);
+
+ case 'M':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, tp->tm_min);
+
+ case 'm':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, tp->tm_mon + 1);
+
+ case 'n': /* POSIX.2 extension. */
+ add (1, *p = '\n');
+ break;
+
+ case 'P':
+ to_lowcase = 1;
+ /* FALLTHROUGH */
+
+ case 'p':
+ cpy (ap_len, ampm);
+ break;
+
+ case 'R': /* GNU extension. */
+ subfmt = "%H:%M";
+ goto subformat;
+
+ case 'r': /* POSIX.2 extension. */
+#ifdef _NL_CURRENT
+ if (*(subfmt = _NL_CURRENT (LC_TIME, T_FMT_AMPM)) == '\0')
+#endif
+ subfmt = "%I:%M:%S %p";
+ goto subformat;
+
+ case 'S':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, tp->tm_sec);
+
+ case 's': /* GNU extension. */
+ {
+ struct tm ltm;
+ time_t t;
+
+ ltm = *tp;
+ t = mktime (&ltm);
+
+ /* Generate string value for T using time_t arithmetic;
+ this works even if sizeof (long) < sizeof (time_t). */
+
+ bufp = buf + sizeof (buf);
+ negative_number = t < 0;
+
+ do
+ {
+ int d = t % 10;
+ t /= 10;
+
+ if (negative_number)
+ {
+ d = -d;
+
+ /* Adjust if division truncates to minus infinity. */
+ if (0 < -1 % 10 && d < 0)
+ {
+ t++;
+ d += 10;
+ }
+ }
+
+ *--bufp = d + '0';
+ }
+ while (t != 0);
+
+ digits = 1;
+ goto do_number_sign_and_padding;
+ }
+
+ case 'X':
+ if (modifier == 'O')
+ goto bad_format;
+#ifdef _NL_CURRENT
+ if (! (modifier == 'E'
+ && *(subfmt = _NL_CURRENT (LC_TIME, ERA_T_FMT)) != '\0'))
+ subfmt = _NL_CURRENT (LC_TIME, T_FMT);
+ goto subformat;
+#endif
+ /* Fall through. */
+ case 'T': /* POSIX.2 extension. */
+ subfmt = "%H:%M:%S";
+ goto subformat;
+
+ case 't': /* POSIX.2 extension. */
+ add (1, *p = '\t');
+ break;
+
+ case 'u': /* POSIX.2 extension. */
+ DO_NUMBER (1, (tp->tm_wday - 1 + 7) % 7 + 1);
+
+ case 'U':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, (tp->tm_yday - tp->tm_wday + 7) / 7);
+
+ case 'V':
+ case 'g': /* GNU extension. */
+ case 'G': /* GNU extension. */
+ if (modifier == 'E')
+ goto bad_format;
+ {
+ int year = tp->tm_year + TM_YEAR_BASE;
+ int days = iso_week_days (tp->tm_yday, tp->tm_wday);
+
+ if (days < 0)
+ {
+ /* This ISO week belongs to the previous year. */
+ year--;
+ days = iso_week_days (tp->tm_yday + (365 + __isleap (year)),
+ tp->tm_wday);
+ }
+ else
+ {
+ int d = iso_week_days (tp->tm_yday - (365 + __isleap (year)),
+ tp->tm_wday);
+ if (0 <= d)
+ {
+ /* This ISO week belongs to the next year. */
+ year++;
+ days = d;
+ }
+ }
+
+ switch (*f)
+ {
+ case 'g':
+ DO_NUMBER (2, (year % 100 + 100) % 100);
+
+ case 'G':
+ DO_NUMBER (1, year);
+
+ default:
+ DO_NUMBER (2, days / 7 + 1);
+ }
+ }
+
+ case 'W':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (2, (tp->tm_yday - (tp->tm_wday - 1 + 7) % 7 + 7) / 7);
+
+ case 'w':
+ if (modifier == 'E')
+ goto bad_format;
+
+ DO_NUMBER (1, tp->tm_wday);
+
+ case 'Y':
+#if HAVE_STRUCT_ERA_ENTRY
+ if (modifier == 'E')
+ {
+ struct era_entry *era = _nl_get_era_entry (tp);
+ if (era)
+ {
+ subfmt = strchr (era->name_fmt, '\0') + 1;
+ goto subformat;
+ }
+ }
+#endif
+ if (modifier == 'O')
+ goto bad_format;
+ else
+ DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);
+
+ case 'y':
+#if HAVE_STRUCT_ERA_ENTRY
+ if (modifier == 'E')
+ {
+ struct era_entry *era = _nl_get_era_entry (tp);
+ if (era)
+ {
+ int delta = tp->tm_year - era->start_date[0];
+ DO_NUMBER (1, (era->offset
+ + (era->direction == '-' ? -delta : delta)));
+ }
+ }
+#endif
+ DO_NUMBER (2, (tp->tm_year % 100 + 100) % 100);
+
+ case 'Z':
+ cpy (zonelen, zone);
+ break;
+
+ case 'z': /* GNU extension. */
+ if (tp->tm_isdst < 0)
+ break;
+
+ {
+ int diff;
+#if HAVE_TM_GMTOFF
+ diff = tp->tm_gmtoff;
+#else
+ struct tm gtm;
+ struct tm ltm;
+ time_t lt;
+
+ ltm = *tp;
+ lt = mktime (&ltm);
+
+ if (lt == (time_t) -1)
+ {
+ /* mktime returns -1 for errors, but -1 is also a
+ valid time_t value. Check whether an error really
+ occurred. */
+ struct tm tm;
+ localtime_r (&lt, &tm);
+
+ if ((ltm.tm_sec ^ tm.tm_sec)
+ | (ltm.tm_min ^ tm.tm_min)
+ | (ltm.tm_hour ^ tm.tm_hour)
+ | (ltm.tm_mday ^ tm.tm_mday)
+ | (ltm.tm_mon ^ tm.tm_mon)
+ | (ltm.tm_year ^ tm.tm_year))
+ break;
+ }
+
+ if (! gmtime_r (&lt, &gtm))
+ break;
+
+ diff = tm_diff (&ltm, &gtm);
+#endif
+
+ if (diff < 0)
+ {
+ add (1, *p = '-');
+ diff = -diff;
+ }
+ else
+ add (1, *p = '+');
+
+ diff /= 60;
+ DO_NUMBER (4, (diff / 60) * 100 + diff % 60);
+ }
+
+ case '\0': /* GNU extension: % at end of format. */
+ --f;
+ /* Fall through. */
+ default:
+ /* Unknown format; output the format, including the '%',
+ since this is most likely the right thing to do if a
+ multibyte string has been misparsed. */
+ bad_format:
+ {
+ int flen;
+ for (flen = 1; f[1 - flen] != '%'; flen++)
+ continue;
+ cpy (flen, &f[1 - flen]);
+ }
+ break;
+ }
+ }
+
+ if (p)
+ *p = '\0';
+ return i;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of compat/strftime.c */
diff --git a/compat/strsignal.c b/compat/strsignal.c
new file mode 100644
index 0000000..cb92550
--- /dev/null
+++ b/compat/strsignal.c
@@ -0,0 +1,121 @@
+
+/**
+ * \file strsignal.c
+ *
+ * Time-stamp: "2010-07-16 15:12:27 bkorb"
+ *
+ * This file is part of AutoGen.
+ *
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, Bruce Korb gives permission for additional
+ * uses of the text contained in the release of strsignal.
+ *
+ * The exception is that, if you link the strsignal library with other
+ * files to produce an executable, this does not by itself cause the
+ * resulting executable to be covered by the GNU General Public License.
+ * Your use of that executable is in no way restricted on account of
+ * linking the strsignal library code into it.
+ *
+ * This exception does not however invalidate any other reasons why
+ * the executable file might be covered by the GNU General Public License.
+ *
+ * This exception applies only to the code released by Bruce Korb under
+ * the name strsignal. If you copy code from other sources under the
+ * General Public License into a copy of strsignal, as the General Public
+ * License permits, the exception does not apply to the code that you add
+ * in this way. To avoid misleading anyone as to the status of such
+ * modified files, you must delete this exception notice from them.
+ *
+ * If you write modifications of your own for strsignal, it is your choice
+ * whether to permit this exception to apply to your modifications.
+ * If you do not wish that, delete this exception notice.
+ */
+
+#include "compat.h"
+
+/* Routines imported from standard C runtime libraries. */
+
+#if ! defined(HAVE_STRSIGNAL)
+
+#ifdef __STDC__
+# include <stddef.h>
+#else /* !__STDC__ */
+# ifndef const
+# define const
+# endif
+#endif /* __STDC__ */
+
+#ifdef HAVE_SYS_SIGLIST
+# include <signal.h>
+#endif
+
+/*
+ * Import the generated tables
+ */
+#include "strsignal.h"
+#endif
+
+#ifndef HAVE_STRSIGNAL
+
+/*
+
+NAME
+
+ strsignal -- map a signal number to a signal message string
+
+SYNOPSIS
+
+ char *strsignal (int signo)
+
+DESCRIPTION
+
+ Maps an signal number to an signal message string, the contents of
+ which are implementation defined. On systems which have the external
+ variable sys_siglist, these strings will be the same as the ones used
+ by psignal().
+
+ If the supplied signal number is within the valid range of indices
+ for the sys_siglist, but no message is available for the particular
+ signal number, then returns the string "Signal NUM", where NUM is the
+ signal number.
+
+ If the supplied signal number is not a valid index into sys_siglist,
+ returns NULL.
+
+ The returned string is only guaranteed to be valid only until the
+ next call to strsignal.
+
+ Also, though not declared "const", it is.
+*/
+
+char *
+strsignal( int signo )
+{
+ if (SIGNAL_IN_RANGE( signo ))
+ return (char*)SIGNAL_INFO( signo );
+
+ return NULL;
+}
+#endif /* HAVE_STRSIGNAL */
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of compat/strsignal.c */
diff --git a/compat/strsignal.def b/compat/strsignal.def
new file mode 100644
index 0000000..f645d10
--- /dev/null
+++ b/compat/strsignal.def
@@ -0,0 +1,151 @@
+autogen definitions strsignal;
+
+/*
+ * Dynamic definitions for creating the strsignal.h header file
+ *
+ * This file is part of AutoGen.
+ *
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#shell
+
+RE_sigfind='[A-Z12]+[ ]+[1-9][0-9]*'
+RE_sigdef='^#[ ]*define[ ][ ]*_*SIG'
+RE_inc='^#[ ]*include[ ][ ]*<'
+
+threshold=5 # minimum number of signals to accept
+num=0 # number of signals defined in this file
+seen="" # include files already searched
+files="sys/signal.h" # initial files to search
+
+cd /usr/include
+while test -n "$files"
+do
+ for file in $files; do
+ # look for $threshold or more matches in one of the search files
+ test -f $file || continue
+ sigs=`egrep "$RE_sigdef$RE_sigfind" $file|sed "s,$RE_sigdef,,"`
+ test -z "$sigs" || num=`echo "$sigs" | wc -l`
+ test $num -lt $threshold || break
+ seen="$file $seen"
+ done
+ test $num -lt $threshold || break
+
+ # IF no file has $threshold or better SIG matches;
+ # generate a new search list from all files #included from the old list
+ newfiles=""
+ for file in $files; do
+ test -f $file || continue
+ new=`egrep "$RE_inc" $file|sed "s,$RE_inc,,"';s,>.*$,,'`
+ newfiles=" $new $newfiles"
+ done
+
+ # remove any files that have been searched previously
+ for file in $seen; do
+ newfiles=`echo "$newfiles"|sed "s, $file , ,g"`
+ done
+
+ # set the search list for the next iteration
+ files="$newfiles"
+ num=0
+done
+
+if test $num -lt $threshold
+then
+ echo "WARNING: cannot find signal definitions in $seen" >&2
+ echo "using POSIX + ANSI signal definitions" >&2
+ cat <<- _EOF_
+ signal[ 1 ] = { signame = SIGHUP;
+ sigtext = "Hangup (POSIX)."; };
+ signal[ 2 ] = { signame = SIGINT;
+ sigtext = "Interrupt (ANSI)."; };
+ signal[ 3 ] = { signame = SIGQUIT;
+ sigtext = "Quit (POSIX)."; };
+ signal[ 4 ] = { signame = SIGILL;
+ sigtext = "Illegal instruction (ANSI)."; };
+ signal[ 5 ] = { signame = SIGTRAP;
+ sigtext = "Trace trap (POSIX)."; };
+ signal[ 6 ] = { signame = SIGABRT;
+ sigtext = "Abort (ANSI)."; };
+ signal[ 8 ] = { signame = SIGFPE;
+ sigtext = "Floating-point exception (ANSI)."; };
+ signal[ 9 ] = { signame = SIGKILL;
+ sigtext = "Kill, unblockable (POSIX)."; };
+ signal[ 10 ] = { signame = SIGUSR1;
+ sigtext = "User-defined signal 1 (POSIX)."; };
+ signal[ 11 ] = { signame = SIGSEGV;
+ sigtext = "Segmentation violation (ANSI)."; };
+ signal[ 12 ] = { signame = SIGUSR2;
+ sigtext = "User-defined signal 2 (POSIX)."; };
+ signal[ 13 ] = { signame = SIGPIPE;
+ sigtext = "Broken pipe (POSIX)."; };
+ signal[ 14 ] = { signame = SIGALRM;
+ sigtext = "Alarm clock (POSIX)."; };
+ signal[ 15 ] = { signame = SIGTERM;
+ sigtext = "Termination (ANSI)."; };
+ signal[ 17 ] = { signame = SIGCHLD;
+ sigtext = "Child status has changed (POSIX)."; };
+ signal[ 18 ] = { signame = SIGCONT;
+ sigtext = "Continue (POSIX)."; };
+ signal[ 19 ] = { signame = SIGSTOP;
+ sigtext = "Stop, unblockable (POSIX)."; };
+ signal[ 20 ] = { signame = SIGTSTP;
+ sigtext = "Keyboard stop (POSIX)."; };
+ signal[ 21 ] = { signame = SIGTTIN;
+ sigtext = "Background read from tty (POSIX)."; };
+ signal[ 22 ] = { signame = SIGTTOU;
+ sigtext = "Background write to tty (POSIX)."; };
+_EOF_
+
+else
+ echo "$sigs" |
+ while read SIG NUM f
+ do
+ # IF the "signal number" is octal or hex or non-numeric,
+ # THEN we know it is a value we are not interested in
+ #
+ case ${NUM} in
+ *[A-Za-z_]* )
+ continue ;;
+ esac
+
+ # Sometimes, there are aliases. Accept only the first.
+ #
+ if eval test ! -z \"\$HAVE_${NUM}\"
+ then continue ; fi
+
+ # We also know we are not interested in super large numbers
+ # (e.g. SIGSTKSZ 8192)
+ #
+ if test ${NUM} -gt 127
+ then continue ; fi
+
+ eval HAVE_${NUM}=1
+ f=`echo "$f" | sed -e 's;/\*[ ]*;;' -e 's;[ ]*\*/;;'`
+ if test -z "$f"
+ then f="Undescribed: SIG${SIG} (${NUM})" ; fi
+
+ cat <<- _EOF_
+ signal[ ${NUM} ] = {
+ signame = ${SIG};
+ sigtext = "$f";
+ };
+
+ _EOF_
+ done
+fi
+#endshell
diff --git a/compat/strsignal.h b/compat/strsignal.h
new file mode 100644
index 0000000..0c30679
--- /dev/null
+++ b/compat/strsignal.h
@@ -0,0 +1,110 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (strsignal.h)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:41:52 AM by AutoGen 5.16.2pre7
+ * From the definitions strsignal.def
+ * and the template file strsignal
+ *
+ * Generated for a 3.1.10-1.16-desktop Linux platform
+ *
+ * strsignal copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef MAX_SIGNAL_NUMBER
+#define MAX_SIGNAL_NUMBER 32
+#define SIGNAL_IN_RANGE(s) (((unsigned)s) <= MAX_SIGNAL_NUMBER)
+#define SIGNAL_NAME(s) (zSigNames + sigNameOffset[s])
+#define SIGNAL_INFO(s) (zSigInfo + sigInfoOffset[s])
+
+static char const zSigNames[] =
+ "INVALID\0" "SIGHUP\0" "SIGINT\0" "SIGQUIT\0" "SIGILL\0"
+ "SIGTRAP\0" "SIGABRT\0" "SIGBUS\0" "SIGFPE\0" "SIGKILL\0"
+ "SIGUSR1\0" "SIGSEGV\0" "SIGUSR2\0" "SIGPIPE\0" "SIGALRM\0"
+ "SIGTERM\0" "SIGSTKFLT\0" "SIGCHLD\0" "SIGCONT\0" "SIGSTOP\0"
+ "SIGTSTP\0" "SIGTTIN\0" "SIGTTOU\0" "SIGURG\0" "SIGXCPU\0"
+ "SIGXFSZ\0" "SIGVTALRM\0" "SIGPROF\0" "SIGWINCH\0" "SIGIO\0"
+ "SIGPWR\0" "SIGSYS\0" "SIGRTMIN\0";
+
+static const unsigned int sigNameOffset[] = {
+ 0, 8, 15, 22, 30, 37, 45, 53, 60, 67, 75, 83, 91, 99, 107,
+ 115, 123, 133, 141, 149, 157, 165, 173, 181, 188, 196, 204, 214, 222, 231,
+ 237, 244, 251 };
+
+#ifndef HAVE_SYS_SIGLIST
+static char const zSigInfo[] =
+ /* 0 */ "Signal 0 invalid\0"
+ /* 1 */ "Hangup (POSIX).\0"
+ /* 2 */ "Interrupt (ANSI).\0"
+ /* 3 */ "Quit (POSIX).\0"
+ /* 4 */ "Illegal instruction (ANSI).\0"
+ /* 5 */ "Trace trap (POSIX).\0"
+ /* 6 */ "Abort (ANSI).\0"
+ /* 7 */ "BUS error (4.2 BSD).\0"
+ /* 8 */ "Floating-point exception (ANSI).\0"
+ /* 9 */ "Kill, unblockable (POSIX).\0"
+ /* 10 */ "User-defined signal 1 (POSIX).\0"
+ /* 11 */ "Segmentation violation (ANSI).\0"
+ /* 12 */ "User-defined signal 2 (POSIX).\0"
+ /* 13 */ "Broken pipe (POSIX).\0"
+ /* 14 */ "Alarm clock (POSIX).\0"
+ /* 15 */ "Termination (ANSI).\0"
+ /* 16 */ "Stack fault.\0"
+ /* 17 */ "Child status has changed (POSIX).\0"
+ /* 18 */ "Continue (POSIX).\0"
+ /* 19 */ "Stop, unblockable (POSIX).\0"
+ /* 20 */ "Keyboard stop (POSIX).\0"
+ /* 21 */ "Background read from tty (POSIX).\0"
+ /* 22 */ "Background write to tty (POSIX).\0"
+ /* 23 */ "Urgent condition on socket (4.2 BSD).\0"
+ /* 24 */ "CPU limit exceeded (4.2 BSD).\0"
+ /* 25 */ "File size limit exceeded (4.2 BSD).\0"
+ /* 26 */ "Virtual alarm clock (4.2 BSD).\0"
+ /* 27 */ "Profiling alarm clock (4.2 BSD).\0"
+ /* 28 */ "Window size change (4.3 BSD, Sun).\0"
+ /* 29 */ "I/O now possible (4.2 BSD).\0"
+ /* 30 */ "Power failure restart (System V).\0"
+ /* 31 */ "Bad system call.\0"
+ /* 32 */ "Undescribed: SIGRTMIN (32)\0";
+
+static const unsigned int sigInfoOffset[] = {
+ 0, 17, 33, 51, 65, 93, 113, 127, 148, 181, 208, 239, 270, 301, 322,
+ 343, 363, 376, 410, 428, 455, 478, 512, 545, 583, 613, 649, 680, 713, 748,
+ 776, 810, 827 };
+
+#endif /* MAX_SIGNAL_NUMBER */
+
+#ifndef HAVE_STRSIGNAL
+extern char * strsignal( int signo );
+#endif
+
+#ifdef DEBUG_STRSIGNAL
+#include <stdio.h>
+
+int
+main( int argc, char** argv )
+{
+ int sig = 0;
+ fputs( "Sig Sig-Name Description\n"
+ "=== ======== ===========\n", stdout );
+ do {
+ printf( "%3d %-10s %s\n", sig, SIGNAL_NAME(sig),
+ SIGNAL_INFO(sig) );
+ ++sig;
+ } while (SIGNAL_IN_RANGE(sig));
+ return 0;
+}
+#endif /* DEBUG */
+#endif /* MAX_SIGNAL_NUMBER */
diff --git a/compat/strsignal.tpl b/compat/strsignal.tpl
new file mode 100644
index 0000000..e017764
--- /dev/null
+++ b/compat/strsignal.tpl
@@ -0,0 +1,126 @@
+[= AutoGen5 template -*- Mode: html -*-
+
+h
+
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+(setenv "SHELL" "/bin/sh")
+
+=]
+[=(dne " * " "/* ")=]
+ *
+ * Generated for a [=`uname -r`=] [=`uname`=] platform
+ *
+ * strsignal copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+[=(gpl "AutoGen" " * ")=]
+ */
+#ifndef MAX_SIGNAL_NUMBER
+#define MAX_SIGNAL_NUMBER [= (high-lim "signal") =]
+#define SIGNAL_IN_RANGE(s) (((unsigned)s) <= MAX_SIGNAL_NUMBER)
+#define SIGNAL_NAME(s) (zSigNames + sigNameOffset[s])
+#define SIGNAL_INFO(s) (zSigInfo + sigInfoOffset[s])[=
+
+(define sig-names "\"INVALID\\0\"\n")
+(define name-refs "")
+(define name-ix (- (string-length sig-names) 4))
+(define tmp-text "")
+
+(define sig-info "")
+(define info-refs "")
+(define info-ix 0)
+
+(define add-string (lambda()
+ (if (exist? "signame")
+ (begin
+ (set! tmp-text (string-append "\"SIG" (get "signame") "\\0\"\n"))
+ (set! sig-names (string-append sig-names tmp-text))
+ (set! name-refs (string-append name-refs
+ (sprintf "%d\n" name-ix) ))
+ (set! name-ix (+ name-ix (string-length tmp-text) -4))
+
+ (set! tmp-text (sprintf "/* %3d */ \"%s\\0\"\n"
+ (for-index) (get "sigtext")))
+ )
+
+ (begin
+ (set! name-refs (string-append name-refs "0\n"))
+ (set! tmp-text (sprintf "/* %1$3d */ \"Signal %1$d invalid\\0\"\n"
+ (for-index)))
+ ) )
+
+ (set! sig-info (string-append sig-info tmp-text))
+ (set! info-refs (string-append info-refs
+ (sprintf "%d\n" info-ix) ))
+ (set! info-ix (+ info-ix (string-length tmp-text) -14))
+)) =][=
+
+FOR signal (for-from 0) (for-by 1) =][=
+
+ (add-string) =][=
+
+ENDFOR signal =]
+
+static char const zSigNames[] =
+[=(shell (string-append
+ "columns -I4 --spread=1 <<'_EOF_'\n"
+ sig-names
+ "_EOF_" )) =];
+
+static const unsigned int sigNameOffset[] = {
+[=(shell (string-append
+ "columns -I4 -S, --spread=1 <<'_EOF_'\n"
+ name-refs
+ "_EOF_" )) =] };
+
+#ifndef HAVE_SYS_SIGLIST
+static char const zSigInfo[] =
+[=(shell (string-append
+ "columns -I4 --spread=1 <<'_EOF_'\n"
+ sig-info
+ "_EOF_" )) =];
+
+static const unsigned int sigInfoOffset[] = {
+[=(shell (string-append
+ "columns -I4 -S, --spread=1 <<'_EOF_'\n"
+ info-refs
+ "_EOF_" )) =] };
+
+#endif /* MAX_SIGNAL_NUMBER */
+
+#ifndef HAVE_STRSIGNAL
+extern char * strsignal( int signo );
+#endif
+
+#ifdef DEBUG_STRSIGNAL
+#include <stdio.h>
+
+int
+main( int argc, char** argv )
+{
+ int sig = 0;
+ fputs( "Sig Sig-Name Description\n"
+ "=== ======== ===========\n", stdout );
+ do {
+ printf( "%3d %-10s %s\n", sig, SIGNAL_NAME(sig),
+ SIGNAL_INFO(sig) );
+ ++sig;
+ } while (SIGNAL_IN_RANGE(sig));
+ return 0;
+}
+#endif /* DEBUG */
+#endif /* MAX_SIGNAL_NUMBER */
diff --git a/compat/unlocked-io.h b/compat/unlocked-io.h
new file mode 100644
index 0000000..65bfbc4
--- /dev/null
+++ b/compat/unlocked-io.h
@@ -0,0 +1,136 @@
+/* Prefer faster, non-thread-safe stdio functions if available.
+
+ Copyright (C) 2001-2004, 2009-2012 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Jim Meyering. */
+
+#ifndef UNLOCKED_IO_H
+# define UNLOCKED_IO_H 1
+
+/* These are wrappers for functions/macros from the GNU C library, and
+ from other C libraries supporting POSIX's optional thread-safe functions.
+
+ The standard I/O functions are thread-safe. These *_unlocked ones are
+ more efficient but not thread-safe. That they're not thread-safe is
+ fine since all of the applications in this package are single threaded.
+
+ Also, some code that is shared with the GNU C library may invoke
+ the *_unlocked functions directly. On hosts that lack those
+ functions, invoke the non-thread-safe versions instead. */
+
+# include <stdio.h>
+
+# if HAVE_DECL_CLEARERR_UNLOCKED
+# undef clearerr
+# define clearerr(x) clearerr_unlocked (x)
+# else
+# define clearerr_unlocked(x) clearerr (x)
+# endif
+
+# if HAVE_DECL_FEOF_UNLOCKED
+# undef feof
+# define feof(x) feof_unlocked (x)
+# else
+# define feof_unlocked(x) feof (x)
+# endif
+
+# if HAVE_DECL_FERROR_UNLOCKED
+# undef ferror
+# define ferror(x) ferror_unlocked (x)
+# else
+# define ferror_unlocked(x) ferror (x)
+# endif
+
+# if HAVE_DECL_FFLUSH_UNLOCKED
+# undef fflush
+# define fflush(x) fflush_unlocked (x)
+# else
+# define fflush_unlocked(x) fflush (x)
+# endif
+
+# if HAVE_DECL_FGETS_UNLOCKED
+# undef fgets
+# define fgets(x,y,z) fgets_unlocked (x,y,z)
+# else
+# define fgets_unlocked(x,y,z) fgets (x,y,z)
+# endif
+
+# if HAVE_DECL_FPUTC_UNLOCKED
+# undef fputc
+# define fputc(x,y) fputc_unlocked (x,y)
+# else
+# define fputc_unlocked(x,y) fputc (x,y)
+# endif
+
+# if HAVE_DECL_FPUTS_UNLOCKED
+# undef fputs
+# define fputs(x,y) fputs_unlocked (x,y)
+# else
+# define fputs_unlocked(x,y) fputs (x,y)
+# endif
+
+# if HAVE_DECL_FREAD_UNLOCKED
+# undef fread
+# define fread(w,x,y,z) fread_unlocked (w,x,y,z)
+# else
+# define fread_unlocked(w,x,y,z) fread (w,x,y,z)
+# endif
+
+# if HAVE_DECL_FWRITE_UNLOCKED
+# undef fwrite
+# define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z)
+# else
+# define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
+# endif
+
+# if HAVE_DECL_GETC_UNLOCKED
+# undef getc
+# define getc(x) getc_unlocked (x)
+# else
+# define getc_unlocked(x) getc (x)
+# endif
+
+# if HAVE_DECL_GETCHAR_UNLOCKED
+# undef getchar
+# define getchar() getchar_unlocked ()
+# else
+# define getchar_unlocked() getchar ()
+# endif
+
+# if HAVE_DECL_PUTC_UNLOCKED
+# undef putc
+# define putc(x,y) putc_unlocked (x,y)
+# else
+# define putc_unlocked(x,y) putc (x,y)
+# endif
+
+# if HAVE_DECL_PUTCHAR_UNLOCKED
+# undef putchar
+# define putchar(x) putchar_unlocked (x)
+# else
+# define putchar_unlocked(x) putchar (x)
+# endif
+
+# undef flockfile
+# define flockfile(x) ((void) 0)
+
+# undef ftrylockfile
+# define ftrylockfile(x) 0
+
+# undef funlockfile
+# define funlockfile(x) ((void) 0)
+
+#endif /* UNLOCKED_IO_H */
diff --git a/compat/windows-config.h b/compat/windows-config.h
new file mode 100644
index 0000000..ddb4ce1
--- /dev/null
+++ b/compat/windows-config.h
@@ -0,0 +1,156 @@
+
+/**
+ * \file autoopts.c
+ *
+ * Time-stamp: "2012-06-15 12:31:28 bkorb"
+ *
+ * This file contains all of the routines that must be linked into
+ * an executable to use the generated option processing. The optional
+ * routines are in separately compiled modules so that they will not
+ * necessarily be linked in.
+ *
+ * This file is part of AutoOpts, a companion to AutoGen.
+ * AutoOpts is free software.
+ * AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoOpts is available under any one of two licenses. The license
+ * in use must be one of these two and the choice is under the control
+ * of the user of the license.
+ *
+ * The GNU Lesser General Public License, version 3 or later
+ * See the files "COPYING.lgplv3" and "COPYING.gplv3"
+ *
+ * The Modified Berkeley Software Distribution License
+ * See the file "COPYING.mbsd"
+ *
+ * These files have the following md5sums:
+ *
+ * 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
+ * 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
+ * 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
+ */
+
+#ifndef WINDOWS_CONFIG_HACKERY
+#define WINDOWS_CONFIG_HACKERY 1
+
+/*
+ * The definitions below have been stolen from NTP's config.h for Windows.
+ * However, they may be kept here in order to keep libopts independent from
+ * the NTP project.
+ */
+#ifndef __windows__
+# define __windows__ 4
+#endif
+
+/*
+ * Miscellaneous functions that Microsoft maps
+ * to other names
+ *
+ * #define inline __inline
+ * #define vsnprintf _vsnprintf
+ */
+#define snprintf _snprintf
+/*
+ * #define stricmp _stricmp
+ * #define strcasecmp _stricmp
+ * #define isascii __isascii
+ * #define finite _finite
+ * #define random rand
+ * #define srandom srand
+ */
+
+#define SIZEOF_INT 4
+#define SIZEOF_CHARP 4
+#define SIZEOF_LONG 4
+#define SIZEOF_SHORT 2
+
+typedef unsigned long uintptr_t;
+
+/*
+ * # define HAVE_NET_IF_H
+ * # define QSORT_USES_VOID_P
+ * # define HAVE_SETVBUF
+ * # define HAVE_VSPRINTF
+ * # define HAVE_SNPRINTF
+ * # define HAVE_VSNPRINTF
+ * # define HAVE_PROTOTYPES /* from ntpq.mak * /
+ * # define HAVE_MEMMOVE
+ * # define HAVE_TERMIOS_H
+ * # define HAVE_ERRNO_H
+ * # define HAVE_STDARG_H
+ * # define HAVE_NO_NICE
+ * # define HAVE_MKTIME
+ * # define TIME_WITH_SYS_TIME
+ * # define HAVE_IO_COMPLETION_PORT
+ * # define ISC_PLATFORM_NEEDNTOP
+ * # define ISC_PLATFORM_NEEDPTON
+ * # define NEED_S_CHAR_TYPEDEF
+ * # define USE_PROTOTYPES /* for ntp_types.h * /
+ *
+ * #define ULONG_CONST(a) a ## UL
+ */
+
+#define HAVE_LIMITS_H 1
+#define HAVE_STRDUP 1
+#define HAVE_STRCHR 1
+#define HAVE_FCNTL_H 1
+
+/*
+ * VS.NET's version of wspiapi.h has a bug in it
+ * where it assigns a value to a variable inside
+ * an if statement. It should be comparing them.
+ * We prevent inclusion since we are not using this
+ * code so we don't have to see the warning messages
+ */
+#ifndef _WSPIAPI_H_
+#define _WSPIAPI_H_
+#endif
+
+/* Prevent inclusion of winsock.h in windows.h */
+#ifndef _WINSOCKAPI_
+#define _WINSOCKAPI_
+#endif
+
+#ifndef __RPCASYNC_H__
+#define __RPCASYNC_H__
+#endif
+
+/* Include Windows headers */
+#include <windows.h>
+#include <winsock2.h>
+#include <limits.h>
+
+/*
+ * Compatibility declarations for Windows, assuming SYS_WINNT
+ * has been defined.
+ */
+#define strdup _strdup
+#define stat _stat /* struct stat from <sys/stat.h> */
+#define unlink _unlink
+#define fchmod( _x, _y );
+#define ssize_t SSIZE_T
+
+#include <io.h>
+#define open _open
+#define close _close
+#define read _read
+#define write _write
+#define lseek _lseek
+#define pipe _pipe
+#define dup2 _dup2
+
+#define O_RDWR _O_RDWR
+#define O_RDONLY _O_RDONLY
+#define O_EXCL _O_EXCL
+
+#ifndef S_ISREG
+# define S_IFREG _S_IFREG
+# define S_ISREG(mode) (((mode) & S_IFREG) == S_IFREG)
+#endif
+
+#ifndef S_ISDIR
+# define S_IFDIR _S_IFDIR
+# define S_ISDIR(mode) (((mode) & S_IFDIR) == S_IFDIR)
+#endif
+
+#endif /* WINDOWS_CONFIG_HACKERY */
diff --git a/config-h.in b/config-h.in
new file mode 100644
index 0000000..5d19693
--- /dev/null
+++ b/config-h.in
@@ -0,0 +1,565 @@
+/* config-h.in. Generated from configure.ac by autoheader. */
+
+#ifndef AUTOGEN_CONFIG_H
+
+#define AUTOGEN_CONFIG_H 1
+
+/* define to suitable timeout limit for shell command */
+#undef AG_DEFAULT_TIMEOUT
+
+/* Define this to the autoopts interface age number */
+#undef AO_AGE
+
+/* Define this to the autoopts current interface number */
+#undef AO_CURRENT
+
+/* Define this to the autoopts interface revision number */
+#undef AO_REVISION
+
+/* Define this to a working Bourne shell */
+#undef CONFIG_SHELL
+
+/* Define this if debugging is enabled */
+#undef DEBUG_ENABLED
+
+/* "Define if we can use it" */
+#undef ENABLE_FMEMOPEN
+
+/* fopen(3) accepts a 'b' in the mode flag */
+#undef FOPEN_BINARY_FLAG
+
+/* fopen(3) accepts a 't' in the mode flag */
+#undef FOPEN_TEXT_FLAG
+
+/* define to Guile version expression */
+#undef GUILE_VERSION
+
+/* Define to 1 if you have the <assert.h> header file. */
+#undef HAVE_ASSERT_H
+
+/* Define to 1 if you have the `canonicalize_file_name' function. */
+#undef HAVE_CANONICALIZE_FILE_NAME
+
+/* Define to 1 if you have the `chmod' function. */
+#undef HAVE_CHMOD
+
+/* Define to 1 if you have the `copysign' function. */
+#undef HAVE_COPYSIGN
+
+/* Define to 1 if you have the `copysignl' function. */
+#undef HAVE_COPYSIGNL
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#undef HAVE_CTYPE_H
+
+/* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if
+ you don't. */
+#undef HAVE_DECL_CLEARERR_UNLOCKED
+
+/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you
+ don't. */
+#undef HAVE_DECL_FEOF_UNLOCKED
+
+/* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if
+ you don't. */
+#undef HAVE_DECL_FERROR_UNLOCKED
+
+/* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if
+ you don't. */
+#undef HAVE_DECL_FFLUSH_UNLOCKED
+
+/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if
+ you don't. */
+#undef HAVE_DECL_FGETS_UNLOCKED
+
+/* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if
+ you don't. */
+#undef HAVE_DECL_FPUTC_UNLOCKED
+
+/* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if
+ you don't. */
+#undef HAVE_DECL_FPUTS_UNLOCKED
+
+/* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if
+ you don't. */
+#undef HAVE_DECL_FREAD_UNLOCKED
+
+/* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if
+ you don't. */
+#undef HAVE_DECL_FWRITE_UNLOCKED
+
+/* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if
+ you don't. */
+#undef HAVE_DECL_GETCHAR_UNLOCKED
+
+/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you
+ don't. */
+#undef HAVE_DECL_GETC_UNLOCKED
+
+/* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if
+ you don't. */
+#undef HAVE_DECL_PUTCHAR_UNLOCKED
+
+/* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you
+ don't. */
+#undef HAVE_DECL_PUTC_UNLOCKED
+
+/* Define to 1 if you have the declaration of `sigsetjmp', and to 0 if you
+ don't. */
+#undef HAVE_DECL_SIGSETJMP
+
+/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
+ don't. */
+#undef HAVE_DECL_SYS_SIGLIST
+
+/* Define this if /dev/zero is readable device */
+#undef HAVE_DEV_ZERO
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the `dlopen' function. */
+#undef HAVE_DLOPEN
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+
+/* Define to 1 if you have the `fchmod' function. */
+#undef HAVE_FCHMOD
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `fopencookie' function. */
+#undef HAVE_FOPENCOOKIE
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the `frexpl' function. */
+#undef HAVE_FREXPL
+
+/* Define to 1 if you have the `fstat' function. */
+#undef HAVE_FSTAT
+
+/* Define to 1 if you have the `funopen' function. */
+#undef HAVE_FUNOPEN
+
+/* Define to 1 if you have the `futimes' function. */
+#undef HAVE_FUTIMES
+
+/* Define to 1 if you have the `getdate_r' function. */
+#undef HAVE_GETDATE_R
+
+/* Define to 1 if the system has the type `int16_t'. */
+#undef HAVE_INT16_T
+
+/* Define to 1 if the system has the type `int32_t'. */
+#undef HAVE_INT32_T
+
+/* Define to 1 if the system has the type `int8_t'. */
+#undef HAVE_INT8_T
+
+/* Define to 1 if the system has the type `intptr_t'. */
+#undef HAVE_INTPTR_T
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `ldexpl' function. */
+#undef HAVE_LDEXPL
+
+/* Define to 1 if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
+
+/* Define to 1 if you have the `gen' library (-lgen). */
+#undef HAVE_LIBGEN
+
+/* Define to 1 if you have the <libgen.h> header file. */
+#undef HAVE_LIBGEN_H
+
+/* Define to 1 if you have the <libio.h> header file. */
+#undef HAVE_LIBIO_H
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if the system has the type `long double'. */
+#undef HAVE_LONG_DOUBLE
+
+/* Define to 1 if the type `long double' works and has more range or precision
+ than `double'. */
+#undef HAVE_LONG_DOUBLE_WIDER
+
+/* Define to 1 if the system has the type `long long'. */
+#undef HAVE_LONG_LONG
+
+/* Define to 1 if the system has the type `long long int'. */
+#undef HAVE_LONG_LONG_INT
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `mmap' function. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the `modfl' function. */
+#undef HAVE_MODFL
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
+/* Define this if pathfind(3) works */
+#undef HAVE_PATHFIND
+
+/* Define to 1 if the system has the type `pid_t'. */
+#undef HAVE_PID_T
+
+/* Define to 1 if you have the `putenv' function. */
+#undef HAVE_PUTENV
+
+/* Define this if we have a functional realpath(3C) */
+#undef HAVE_REALPATH
+
+/* Define to 1 if you have the <runetype.h> header file. */
+#undef HAVE_RUNETYPE_H
+
+/* Define to 1 if you have the <setjmp.h> header file. */
+#undef HAVE_SETJMP_H
+
+/* Define to 1 if the system has the type `size_t'. */
+#undef HAVE_SIZE_T
+
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* Define this if sysinfo(2) is Solaris */
+#undef HAVE_SOLARIS_SYSINFO
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#undef HAVE_STDARG_H
+
+/* Define to 1 if you have the <stdbool.h> header file. */
+#undef HAVE_STDBOOL_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define this if strcspn matches prototype and works */
+#undef HAVE_STRCSPN
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define this if strftime() works */
+#undef HAVE_STRFTIME
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strlcpy' function. */
+#undef HAVE_STRLCPY
+
+/* Define to 1 if you have the `strrchr' function. */
+#undef HAVE_STRRCHR
+
+/* Define to 1 if you have the `strsignal' function. */
+#undef HAVE_STRSIGNAL
+
+/* Define to 1 if you have the `strtoul' function. */
+#undef HAVE_STRTOUL
+
+/* Define to 1 if you have the <sysexits.h> header file. */
+#undef HAVE_SYSEXITS_H
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_DIR_H
+
+/* Define to 1 if you have the <sys/limits.h> header file. */
+#undef HAVE_SYS_LIMITS_H
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#undef HAVE_SYS_MMAN_H
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_SYS_NDIR_H
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/poll.h> header file. */
+#undef HAVE_SYS_POLL_H
+
+/* Define to 1 if you have the <sys/procset.h> header file. */
+#undef HAVE_SYS_PROCSET_H
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#undef HAVE_SYS_RESOURCE_H
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/stropts.h> header file. */
+#undef HAVE_SYS_STROPTS_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/un.h> header file. */
+#undef HAVE_SYS_UN_H
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if the system has the type `uint16_t'. */
+#undef HAVE_UINT16_T
+
+/* Define to 1 if the system has the type `uint32_t'. */
+#undef HAVE_UINT32_T
+
+/* Define to 1 if the system has the type `uint8_t'. */
+#undef HAVE_UINT8_T
+
+/* Define to 1 if the system has the type `uintmax_t'. */
+#undef HAVE_UINTMAX_T
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#undef HAVE_UINTPTR_T
+
+/* Define to 1 if the system has the type `uint_t'. */
+#undef HAVE_UINT_T
+
+/* Define this if uname(2) is POSIX */
+#undef HAVE_UNAME_SYSCALL
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if the system has the type `unsigned long long int'. */
+#undef HAVE_UNSIGNED_LONG_LONG_INT
+
+/* Define to 1 if you have the `utimes' function. */
+#undef HAVE_UTIMES
+
+/* Define to 1 if you have the <utime.h> header file. */
+#undef HAVE_UTIME_H
+
+/* Define to 1 if you have the <values.h> header file. */
+#undef HAVE_VALUES_H
+
+/* Define to 1 if you have the <varargs.h> header file. */
+#undef HAVE_VARARGS_H
+
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the <vfork.h> header file. */
+#undef HAVE_VFORK_H
+
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#undef HAVE_WCHAR_H
+
+/* Define to 1 if the system has the type `wchar_t'. */
+#undef HAVE_WCHAR_T
+
+/* Define to 1 if the system has the type `wint_t'. */
+#undef HAVE_WINT_T
+
+/* Define to 1 if `fork' works. */
+#undef HAVE_WORKING_FORK
+
+/* [setjmp links okay] */
+#undef HAVE_WORKING_SETJMP
+
+/* [sigsetjmp links okay] */
+#undef HAVE_WORKING_SIGSETJMP
+
+/* Define to 1 if `vfork' works. */
+#undef HAVE_WORKING_VFORK
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Define if typedefs for the funopen function pointers are required. */
+#undef NEED_COOKIE_FUNCTION_TYPEDEFS
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Define this if optional arguments are disallowed */
+#undef NO_OPTIONAL_OPT_ARGS
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* define to a working POSIX compliant shell */
+#undef POSIX_SHELL
+
+/* name of regex header file */
+#undef REGEX_HEADER
+
+/* Define if shell scripts are enabled */
+#undef SHELL_ENABLED
+
+/* The size of `char*', as computed by sizeof. */
+#undef SIZEOF_CHARP
+
+/* The size of `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* The size of `short', as computed by sizeof. */
+#undef SIZEOF_SHORT
+
+/* define to static or static inline */
+#undef SNV_INLINE
+
+/* Define this to the long+double type */
+#undef SNV_LONG_DOUBLE
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you want getc etc. to use unlocked I/O if available.
+ Unlocked I/O can improve performance in unithreaded apps, but it is not
+ safe for multithreaded apps. */
+#undef USE_UNLOCKED_IO
+
+/* Version number of package */
+#undef VERSION
+
+/* Define if using the dmalloc debugging malloc package */
+#undef WITH_DMALLOC
+
+/* Define this if a working libregex can be found */
+#undef WITH_LIBREGEX
+
+/* Define this if name of the packager of this software is supplied */
+#undef WITH_PACKAGER
+
+/* Define this if bug reporting URI/e-mail/etc. is supplied */
+#undef WITH_PACKAGER_BUG_REPORTS
+
+/* Define this if packager-specific version information is supplied */
+#undef WITH_PACKAGER_VERSION
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
+/* Define to 500 only on HP-UX. */
+#undef _XOPEN_SOURCE
+
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef gid_t
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef mode_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef uid_t
+
+/* Define as `fork' if `vfork' does not work. */
+#undef vfork
+
+#endif /* AUTOGEN_CONFIG_H */
diff --git a/config/ag_macros.m4 b/config/ag_macros.m4
new file mode 100644
index 0000000..b62d0f8
--- /dev/null
+++ b/config/ag_macros.m4
@@ -0,0 +1,634 @@
+dnl -*- buffer-read-only: t -*- vi: set ro:
+dnl
+dnl DO NOT EDIT THIS FILE (ag_macros.m4)
+dnl
+dnl It has been AutoGen-ed August 11, 2012 at 09:41:11 AM by AutoGen 5.16.2pre7
+dnl From the definitions misc.def
+dnl and the template file conftest.tpl
+dnl
+dnl do always after generated macros:
+dnl
+AC_DEFUN([INVOKE_AG_MACROS_LAST],[
+[if test X${INVOKE_AG_MACROS_LAST_done} != Xyes ; then]
+ AC_CHECK_HEADERS([libio.h ctype.h assert.h sys/resource.h])
+ INVOKE_LIBOPTS_MACROS
+ AC_CHECK_DECLS([sigsetjmp],,, [#include <setjmp.h>])
+ AC_DECL_SYS_SIGLIST
+ AC_CHECK_FUNCS([putenv getdate_r utimes futimes])
+ AC_CHECK_FUNCS([fopencookie funopen], [break])
+ case "${ac_cv_func_fopencookie}${ac_cv_func_funopen}" in
+ *yes* )
+ AC_DEFINE([ENABLE_FMEMOPEN], 1, "Define if we can use it")
+ ;;
+ esac
+ AC_C_INLINE
+ AC_TYPE_LONG_LONG_INT
+
+ # Note that BSD does not typedef these in its headers, but instead
+ # calls for them to be identical in signature to read(2), write(2),
+ # lseek(2), and close(2). Newlib however does include typedefs
+ # in its stdio.h for these, and they do not match the signatures
+ # of the BSD implementation. So this test relies on the fact
+ # that any typedef will succeed for BSD, while only one that
+ # matches the existing definitions in stdio.h will succeed for
+ # a newlib system.
+
+ if test "X${ac_cv_func_funopen}" = Xyes; then
+ AC_CACHE_CHECK([for cookie_function_t type],
+ [ag_cv_cookie_function_t],
+ [AC_TRY_COMPILE([#include <stdio.h>
+ typedef int cookie_read_function_t (void *, char *, int);
+ ], [], ag_cv_cookie_function_t="bsd",
+ AC_TRY_COMPILE([#include <stdio.h>
+ typedef ssize_t cookie_read_function_t (void *, char *, size_t);
+ ], [], ag_cv_cookie_function_t="newlib",
+ AC_MSG_ERROR([Unknown flavor of cookie_XXX_t types])))])
+ fi
+ if test "X${ag_cv_cookie_function_t}" = Xbsd; then
+ AC_DEFINE([NEED_COOKIE_FUNCTION_TYPEDEFS], [1],
+ [Define if typedefs for the funopen function pointers are required.])
+ fi
+
+ AC_CACHE_CHECK([for static inline], [snv_cv_static_inline], [
+ AC_TRY_COMPILE([static inline foo(bar) int bar; { return bar; }],
+ [return foo(0);],
+ [snv_cv_static_inline='static inline'],
+ [snv_cv_static_inline='static'])
+ ])
+ AC_DEFINE_UNQUOTED(SNV_INLINE, ${snv_cv_static_inline},
+ [define to static or static inline])
+ [if test "X${libopts_cv_with_libregex}" = Xno
+ then
+ echo "A POSIX compliant regcomp/regexec routine is required.
+ These are required for AutoGen to work correctly. If you have
+ such a library present on your system, you must specify it by
+ setting the LIBS environment variable, e.g., \"LIBS='-lregex'\".
+ If you do not have such a library on your system, then you should
+ download and install, for example, the one from:
+ ftp://ftp.gnu.org/gnu/rx/" >&2]
+ AC_MSG_ERROR([Cannot find working POSIX regex library])
+ [fi]
+ AC_PROG_GREP
+ AC_PROG_EGREP
+ AC_PROG_FGREP
+[ INVOKE_AG_MACROS_LAST_done=yes
+fi]])
+
+dnl
+dnl @synopsis INVOKE_AG_MACROS
+dnl
+dnl This macro will invoke the AutoConf macros specified in misc.def
+dnl that have not been disabled with "omit-invocation".
+dnl
+AC_DEFUN([AG_DISABLE_SHELL],[
+ AC_ARG_ENABLE([shell],
+ AS_HELP_STRING([--disable-shell], [shell scripts are desired]),
+ [ag_cv_enable_shell=${enable_shell}],
+ AC_CACHE_CHECK([whether shell scripts are desired], ag_cv_enable_shell,
+ ag_cv_enable_shell=yes)
+ ) # end of AC_ARG_ENABLE
+ if test "X${ag_cv_enable_shell}" != Xno
+ then
+ AC_FUNC_FORK
+ fi
+
+]) # end of AC_DEFUN of AG_DISABLE_SHELL
+
+
+AC_DEFUN([AG_TEST_DO_SHELL],[
+ AC_MSG_CHECKING([whether using shell scripts])
+ AC_CACHE_VAL([ag_cv_test_do_shell],[
+ ag_cv_test_do_shell=`exec 2> /dev/null
+test "x$ac_cv_func_fork_works" != xyes && \\
+ test "x$ac_cv_func_vfork_works" != xyes && exit 1
+test "x$ag_cv_enable_shell" = xyes || exit 1
+echo yes`
+ if test $? -ne 0 || test -z "$ag_cv_test_do_shell"
+ then ag_cv_test_do_shell=no
+ fi
+ ]) # end of CACHE_VAL of ag_cv_test_do_shell
+ AC_MSG_RESULT([${ag_cv_test_do_shell}])
+ if test "X${ag_cv_test_do_shell}" != Xno
+ then
+ AC_SUBST(OPTS_TESTDIR)
+AC_SUBST(AGEN5_TESTS)
+AC_DEFINE([SHELL_ENABLED], [1], [Define if shell scripts are enabled])
+OPTS_TESTDIR=test
+AGEN5_TESTS='$(SHELL_TESTS) $(NOSHELL_TESTS)'
+ else
+ OPTS_TESTDIR=
+AGEN5_TESTS='$(NOSHELL_TESTS)'
+ fi
+ AM_CONDITIONAL([DO_SHELL_CMDS],[test "X${ag_cv_test_do_shell}" != Xno])
+
+]) # end of AC_DEFUN of AG_TEST_DO_SHELL
+
+
+AC_DEFUN([AG_LINK_SETJMP],[
+ AC_MSG_CHECKING([whether setjmp() links okay])
+ AC_CACHE_VAL([ag_cv_link_setjmp],[
+ AC_TRY_LINK([@%:@include <setjmp.h>],
+ [jmp_buf bf;
+if (setjmp(bf))
+ return 0;
+return 0;],
+ [ag_cv_link_setjmp=yes],[ag_cv_link_setjmp=no]
+ ) # end of TRY_LINK
+ ]) # end of AC_CACHE_VAL for ag_cv_link_setjmp
+ AC_MSG_RESULT([${ag_cv_link_setjmp}])
+ if test "X${ag_cv_link_setjmp}" != Xno
+ then
+ AC_DEFINE(HAVE_WORKING_SETJMP, 1, @<:@setjmp links okay@:>@)
+ fi
+
+]) # end of AC_DEFUN of AG_LINK_SETJMP
+
+
+AC_DEFUN([AG_LINK_SIGSETJMP],[
+ AC_MSG_CHECKING([whether sigsetjmp() links okay])
+ AC_CACHE_VAL([ag_cv_link_sigsetjmp],[
+ AC_TRY_LINK([@%:@include <setjmp.h>],
+ [sigjmp_buf bf;
+if (sigsetjmp(bf,0))
+ return 0;
+return 0;],
+ [ag_cv_link_sigsetjmp=yes],[ag_cv_link_sigsetjmp=no]
+ ) # end of TRY_LINK
+ ]) # end of AC_CACHE_VAL for ag_cv_link_sigsetjmp
+ AC_MSG_RESULT([${ag_cv_link_sigsetjmp}])
+ if test "X${ag_cv_link_sigsetjmp}" != Xno
+ then
+ AC_DEFINE(HAVE_WORKING_SIGSETJMP, 1, @<:@sigsetjmp links okay@:>@)
+ fi
+
+]) # end of AC_DEFUN of AG_LINK_SIGSETJMP
+
+
+AC_DEFUN([AG_WITHLIB_GUILE],[
+ AC_ARG_WITH([libguile],
+ AS_HELP_STRING([--with-libguile], [libguile installation prefix]),
+ [ag_cv_with_libguile_root=${with_libguile}],
+ AC_CACHE_CHECK([whether with-libguile was specified], ag_cv_with_libguile_root,
+ ag_cv_with_libguile_root=no)
+ ) # end of AC_ARG_WITH libguile
+
+ if test "${with_libguile+set}" = set && \
+ test "X${withval}" = Xno
+ then ## disabled by request
+ ag_cv_with_libguile_root=no
+ ag_cv_with_libguile_cflags=no
+ ag_cv_with_libguile_libs=no
+ else
+
+ AC_ARG_WITH([libguile-cflags],
+ AS_HELP_STRING([--with-libguile-cflags], [libguile compile flags]),
+ [ag_cv_with_libguile_cflags=${with_libguile_cflags}],
+ AC_CACHE_CHECK([whether with-libguile-cflags was specified], ag_cv_with_libguile_cflags,
+ ag_cv_with_libguile_cflags=no)
+ ) # end of AC_ARG_WITH libguile-cflags
+
+ AC_ARG_WITH([libguile-libs],
+ AS_HELP_STRING([--with-libguile-libs], [libguile link command arguments]),
+ [ag_cv_with_libguile_libs=${with_libguile_libs}],
+ AC_CACHE_CHECK([whether with-libguile-libs was specified], ag_cv_with_libguile_libs,
+ ag_cv_with_libguile_libs=no)
+ ) # end of AC_ARG_WITH libguile-libs
+
+ case "X${ag_cv_with_libguile_cflags}" in
+ Xyes|Xno|X )
+ case "X${ag_cv_with_libguile_root}" in
+ Xyes|Xno|X ) ag_cv_with_libguile_cflags=no ;;
+ * ) ag_cv_with_libguile_cflags=-I${ag_cv_with_libguile_root}/include ;;
+ esac
+ esac
+ case "X${ag_cv_with_libguile_libs}" in
+ Xyes|Xno|X )
+ case "X${ag_cv_with_libguile_root}" in
+ Xyes|Xno|X ) ag_cv_with_libguile_libs=no ;;
+ * ) ag_cv_with_libguile_libs="-L${ag_cv_with_libguile_root}/lib -lguile";;
+ esac
+ esac
+ ag_save_CPPFLAGS="${CPPFLAGS}"
+ ag_save_LIBS="${LIBS}"
+ case "X${ag_cv_with_libguile_cflags}" in
+ Xyes|Xno|X )
+ f=`guile-config compile 2>/dev/null` || f=''
+ test -n "${f}" && ag_cv_with_libguile_cflags="${f}" && \
+ AC_MSG_NOTICE([guile-config used for CFLAGS: $f]) ;;
+ esac
+ case "X${ag_cv_with_libguile_libs}" in
+ Xyes|Xno|X )
+ f=`guile-config link 2>/dev/null` || f=''
+ test -n "${f}" && ag_cv_with_libguile_libs="${f}" && \
+ AC_MSG_NOTICE([guile-config used for LIBS: $f]) ;;
+ esac
+ fi ## disabled by request
+
+ case "X${ag_cv_with_libguile_cflags}" in
+ Xyes|Xno|X )
+ ag_cv_with_libguile_cflags="" ;;
+ * ) CPPFLAGS="${CPPFLAGS} ${ag_cv_with_libguile_cflags}" ;;
+ esac
+ case "X${ag_cv_with_libguile_libs}" in
+ Xyes|Xno|X )
+ LIBS="${LIBS} -lguile"
+ ag_cv_with_libguile_libs="-lguile" ;;
+ * )
+ LIBS="${LIBS} ${ag_cv_with_libguile_libs}" ;;
+ esac
+ LIBGUILE_CFLAGS=""
+ LIBGUILE_LIBS=""
+ AC_MSG_CHECKING([whether libguile can be linked with])
+ AC_CACHE_VAL([ag_cv_with_libguile],[
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([[@%:@include <libguile.h>
+@%:@if ((SCM_MAJOR_VERSION * 100) + SCM_MINOR_VERSION) > 200
+This has not been tested with Guile 2.1. Remove this line to proceed.
+@%:@endif
+int main () {
+ SCM fumble = SCM_UNDEFINED;
+ SCM bumble = SCM_UNDEFINED;
+ SCM stumble= SCM_UNDEFINED;
+ long lstumble;
+ stumble = scm_display( fumble, bumble );
+ lstumble = scm_ilength( fumble );
+ stumble = scm_c_eval_string( "stumble" );
+ scm_misc_error( "oops", "bad", bumble );
+ stumble = scm_num_eq_p( fumble, bumble );
+ scm_wrong_type_arg( "oops", 1, bumble );
+ return 0; }]])],
+ [ag_cv_with_libguile=yes],
+ [ag_cv_with_libguile=no]) # end of AC_LINK_IFELSE
+ ]) # end of AC_CACHE_VAL for ag_cv_with_libguile
+ AC_MSG_RESULT([${ag_cv_with_libguile}])
+ AC_SUBST([LIBGUILE_CFLAGS])
+ AC_SUBST([LIBGUILE_LIBS])
+ AC_SUBST([LIBGUILE_PATH])
+ if test "X${ag_cv_with_libguile}" != Xno
+ then[
+ LIBGUILE_CFLAGS="${ag_cv_with_libguile_cflags}"
+ LIBGUILE_LIBS="${ag_cv_with_libguile_libs}"
+ case "${LIBGUILE_LIBS}" in *-L* )
+ LIBGUILE_PATH=`echo ,${LIBGUILE_LIBS} | sed 's/.*[, ]-L[ ]*//;s/[ ].*//'`
+ ;; * ) LIBGUILE_PATH='' ;; esac]
+ CPPFLAGS="@S|@{ag_save_CPPFLAGS}"
+ LIBS="@S|@{ag_save_LIBS}"
+ else
+ CPPFLAGS="${ag_save_CPPFLAGS}"
+ LIBS="${ag_save_LIBS}"
+ LIBGUILE_CFLAGS=''
+ LIBGUILE_LIBS=''
+ LIBGUILE_PATH=''
+ AC_MSG_ERROR([Cannot find libguile. libguile is required. Perhaps you need to install guile-devel?])
+ fi
+ AC_SUBST([AG_GUILE])
+
+]) # end of AC_DEFUN of AG_WITHLIB_GUILE
+
+
+AC_DEFUN([AG_TEST_GUILE_VERSION],[
+ AC_MSG_CHECKING([whether the guile version])
+ AC_CACHE_VAL([ag_cv_test_guile_version],[
+ ag_cv_test_guile_version=`exec 2> /dev/null
+pkginfo=\`dpkg --list 2>/dev/null | egrep 'guile-[0-9.]-dev'\`
+if test -n "${pkginfo}"
+then echo ${pkginfo} | sed -e 's/.*guile-//' -e 's/-dev.*//'
+else
+ v=\`( guile-config --version 2>&1 ) | sed 's/.*Guile version *//'\`
+ test -z "${v}" && v=\`guile --version | sed 's/.*Guile *//;1q'\`
+ test -z "${v}" && exit 1
+ echo ${v}
+fi`
+ if test $? -ne 0 || test -z "$ag_cv_test_guile_version"
+ then ag_cv_test_guile_version=no
+ fi
+ ]) # end of CACHE_VAL of ag_cv_test_guile_version
+ AC_MSG_RESULT([${ag_cv_test_guile_version}])
+ if test "X${ag_cv_test_guile_version}" != Xno
+ then
+ set -- `IFS=' .' ; echo ${ag_cv_test_guile_version}`
+i=${3}
+test -z "${i}" && i=0
+GUILE_VERSION=`expr ${1} \* 100000 + ${2} \* 1000 + ${i}`
+AC_DEFINE_UNQUOTED([GUILE_VERSION], [${GUILE_VERSION}],
+ [define to Guile version expression])
+AC_SUBST(GUILE_VERSION)
+ else
+ AC_MSG_ERROR(@<:@Cannot determine Guile version number@:>@)
+ fi
+
+]) # end of AC_DEFUN of AG_TEST_GUILE_VERSION
+
+
+AC_DEFUN([AG_WITHLIB_XML2],[
+ AC_ARG_WITH([libxml2],
+ AS_HELP_STRING([--with-libxml2], [libxml2 installation prefix]),
+ [ag_cv_with_libxml2_root=${with_libxml2}],
+ AC_CACHE_CHECK([whether with-libxml2 was specified], ag_cv_with_libxml2_root,
+ ag_cv_with_libxml2_root=no)
+ ) # end of AC_ARG_WITH libxml2
+
+ if test "${with_libxml2+set}" = set && \
+ test "X${withval}" = Xno
+ then ## disabled by request
+ ag_cv_with_libxml2_root=no
+ ag_cv_with_libxml2_cflags=no
+ ag_cv_with_libxml2_libs=no
+ else
+
+ AC_ARG_WITH([libxml2-cflags],
+ AS_HELP_STRING([--with-libxml2-cflags], [libxml2 compile flags]),
+ [ag_cv_with_libxml2_cflags=${with_libxml2_cflags}],
+ AC_CACHE_CHECK([whether with-libxml2-cflags was specified], ag_cv_with_libxml2_cflags,
+ ag_cv_with_libxml2_cflags=no)
+ ) # end of AC_ARG_WITH libxml2-cflags
+
+ AC_ARG_WITH([libxml2-libs],
+ AS_HELP_STRING([--with-libxml2-libs], [libxml2 link command arguments]),
+ [ag_cv_with_libxml2_libs=${with_libxml2_libs}],
+ AC_CACHE_CHECK([whether with-libxml2-libs was specified], ag_cv_with_libxml2_libs,
+ ag_cv_with_libxml2_libs=no)
+ ) # end of AC_ARG_WITH libxml2-libs
+
+ case "X${ag_cv_with_libxml2_cflags}" in
+ Xyes|Xno|X )
+ case "X${ag_cv_with_libxml2_root}" in
+ Xyes|Xno|X ) ag_cv_with_libxml2_cflags=no ;;
+ * ) ag_cv_with_libxml2_cflags=-I${ag_cv_with_libxml2_root}/include ;;
+ esac
+ esac
+ case "X${ag_cv_with_libxml2_libs}" in
+ Xyes|Xno|X )
+ case "X${ag_cv_with_libxml2_root}" in
+ Xyes|Xno|X ) ag_cv_with_libxml2_libs=no ;;
+ * ) ag_cv_with_libxml2_libs="-L${ag_cv_with_libxml2_root}/lib -lxml2";;
+ esac
+ esac
+ ag_save_CPPFLAGS="${CPPFLAGS}"
+ ag_save_LIBS="${LIBS}"
+ case "X${ag_cv_with_libxml2_cflags}" in
+ Xyes|Xno|X )
+ f=`xml2-config --cflags 2>/dev/null` || f=''
+ test -n "${f}" && ag_cv_with_libxml2_cflags="${f}" && \
+ AC_MSG_NOTICE([xml2-config used for CFLAGS: $f]) ;;
+ esac
+ case "X${ag_cv_with_libxml2_libs}" in
+ Xyes|Xno|X )
+ f=`xml2-config --libs 2>/dev/null` || f=''
+ test -n "${f}" && ag_cv_with_libxml2_libs="${f}" && \
+ AC_MSG_NOTICE([xml2-config used for LIBS: $f]) ;;
+ esac
+ fi ## disabled by request
+
+ case "X${ag_cv_with_libxml2_cflags}" in
+ Xyes|Xno|X )
+ ag_cv_with_libxml2_cflags="" ;;
+ * ) CPPFLAGS="${CPPFLAGS} ${ag_cv_with_libxml2_cflags}" ;;
+ esac
+ case "X${ag_cv_with_libxml2_libs}" in
+ Xyes|Xno|X )
+ LIBS="${LIBS} -lxml2"
+ ag_cv_with_libxml2_libs="-lxml2" ;;
+ * )
+ LIBS="${LIBS} ${ag_cv_with_libxml2_libs}" ;;
+ esac
+ LIBXML2_CFLAGS=""
+ LIBXML2_LIBS=""
+ AC_MSG_CHECKING([whether libxml2 can be linked with])
+ AC_CACHE_VAL([ag_cv_with_libxml2],[
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([[@%:@include <libxml/parser.h>
+@%:@include <libxml/tree.h>
+
+int main () {
+xmlDocPtr p = xmlParseFile( "mumble.xml" ); }]])],
+ [ag_cv_with_libxml2=yes],
+ [ag_cv_with_libxml2=no]) # end of AC_LINK_IFELSE
+ ]) # end of AC_CACHE_VAL for ag_cv_with_libxml2
+ AC_MSG_RESULT([${ag_cv_with_libxml2}])
+ AC_SUBST([LIBXML2_CFLAGS])
+ AC_SUBST([LIBXML2_LIBS])
+ AC_SUBST([LIBXML2_PATH])
+ if test "X${ag_cv_with_libxml2}" != Xno
+ then[
+ LIBXML2_CFLAGS="${ag_cv_with_libxml2_cflags}"
+ LIBXML2_LIBS="${ag_cv_with_libxml2_libs}"
+ case "${LIBXML2_LIBS}" in *-L* )
+ LIBXML2_PATH=`echo ,${LIBXML2_LIBS} | sed 's/.*[, ]-L[ ]*//;s/[ ].*//'`
+ ;; * ) LIBXML2_PATH='' ;; esac]
+ CPPFLAGS="@S|@{ag_save_CPPFLAGS}"
+ LIBS="@S|@{ag_save_LIBS}"
+
+ else
+ CPPFLAGS="${ag_save_CPPFLAGS}"
+ LIBS="${ag_save_LIBS}"
+ LIBXML2_CFLAGS=''
+ LIBXML2_LIBS=''
+ LIBXML2_PATH=''
+ fi
+ AC_SUBST([AG_XML2])
+ AM_CONDITIONAL([HAVE_XML_LIB],[test "X${ag_cv_with_libxml2}" != Xno])
+
+]) # end of AC_DEFUN of AG_WITHLIB_XML2
+
+
+AC_DEFUN([AG_RUN_SOLARIS_SYSINFO],[
+ AC_MSG_CHECKING([whether sysinfo(2) is Solaris])
+ AC_CACHE_VAL([ag_cv_run_solaris_sysinfo],[
+ AC_RUN_IFELSE([@%:@include <sys/systeminfo.h>
+int main() { char z@<:@ 256 @:>@;
+long sz = sysinfo(SI_SYSNAME, z, sizeof(z));
+return (sz > 0) ? 0 : 1; }],
+ [ag_cv_run_solaris_sysinfo=yes],[ag_cv_run_solaris_sysinfo=no],[ag_cv_run_solaris_sysinfo=no]
+ ) # end of RUN_IFELSE
+ ]) # end of AC_CACHE_VAL for ag_cv_run_solaris_sysinfo
+ AC_MSG_RESULT([${ag_cv_run_solaris_sysinfo}])
+ if test "X${ag_cv_run_solaris_sysinfo}" != Xno
+ then
+ AC_DEFINE([HAVE_SOLARIS_SYSINFO],[1],
+ [Define this if sysinfo(2) is Solaris])
+ fi
+
+]) # end of AC_DEFUN of AG_RUN_SOLARIS_SYSINFO
+
+
+AC_DEFUN([AG_RUN_STRCSPN],[
+ AC_MSG_CHECKING([whether strcspn matches prototype and works])
+ AC_CACHE_VAL([ag_cv_run_strcspn],[
+ AC_RUN_IFELSE([@%:@include <string.h>
+int main (int argc, char** argv) {
+ char zRej@<:@@:>@ = reject;
+ char zAcc@<:@@:>@ = "a-ok-eject";
+ return strcspn( zAcc, zRej ) - 5;
+}],
+ [ag_cv_run_strcspn=yes],[ag_cv_run_strcspn=no],[ag_cv_run_strcspn=no]
+ ) # end of RUN_IFELSE
+ ]) # end of AC_CACHE_VAL for ag_cv_run_strcspn
+ AC_MSG_RESULT([${ag_cv_run_strcspn}])
+ if test "X${ag_cv_run_strcspn}" != Xno
+ then
+ AC_DEFINE([HAVE_STRCSPN],[1],
+ [Define this if strcspn matches prototype and works])
+ else
+ COMPATOBJ="@S|@COMPATOBJ strcspn.lo"
+ fi
+
+]) # end of AC_DEFUN of AG_RUN_STRCSPN
+
+
+AC_DEFUN([AG_RUN_UNAME_SYSCALL],[
+ AC_MSG_CHECKING([whether uname(2) is POSIX])
+ AC_CACHE_VAL([ag_cv_run_uname_syscall],[
+ AC_RUN_IFELSE([@%:@include <sys/utsname.h>
+int main() { struct utsname unm;
+return uname( &unm ); }],
+ [ag_cv_run_uname_syscall=yes],[ag_cv_run_uname_syscall=no],[ag_cv_run_uname_syscall=no]
+ ) # end of RUN_IFELSE
+ ]) # end of AC_CACHE_VAL for ag_cv_run_uname_syscall
+ AC_MSG_RESULT([${ag_cv_run_uname_syscall}])
+ if test "X${ag_cv_run_uname_syscall}" != Xno
+ then
+ AC_DEFINE([HAVE_UNAME_SYSCALL],[1],
+ [Define this if uname(2) is POSIX])
+ fi
+
+]) # end of AC_DEFUN of AG_RUN_UNAME_SYSCALL
+
+
+AC_DEFUN([AG_TEST_LDFLAGS],[
+ AC_MSG_CHECKING([whether runtime library dirs can be specified])
+ AC_CACHE_VAL([ag_cv_test_ldflags],[
+ ag_cv_test_ldflags=`exec 2> /dev/null
+echo 'int main() { return 0; }' > conftest.$ac_ext
+libs="${LIBS}"
+LIBS="${LIBS} -Wl,-R/tmp"
+if (eval $ac_link) > /dev/null 2>&1
+then echo '-Wl,-R${libdir}' ; rm -f conftest* ; exit 0 ; fi
+LIBS="${libs} -R/tmp"
+if (eval $ac_link) > /dev/null 2>&1
+then echo '-R' ; rm -f conftest* ; exit 0 ; fi
+rm -f conftest* ; exit 1`
+ if test $? -ne 0 || test -z "$ag_cv_test_ldflags"
+ then ag_cv_test_ldflags=no
+ fi
+ ]) # end of CACHE_VAL of ag_cv_test_ldflags
+ AC_MSG_RESULT([${ag_cv_test_ldflags}])
+ if test "X${ag_cv_test_ldflags}" != Xno
+ then
+ AG_LDFLAGS="@S|@{ag_cv_test_ldflags}"
+ else
+ AG_LDFLAGS=''
+ fi
+ AC_SUBST([AG_LDFLAGS])
+
+]) # end of AC_DEFUN of AG_TEST_LDFLAGS
+
+
+AC_DEFUN([AG_ENABLE_DEBUG],[
+ AC_ARG_ENABLE([debug],
+ AS_HELP_STRING([--enable-debug], [wanting autogen debugging]),
+ [ag_cv_enable_debug=${enable_debug}],
+ AC_CACHE_CHECK([whether wanting autogen debugging], ag_cv_enable_debug,
+ ag_cv_enable_debug=no)
+ ) # end of AC_ARG_ENABLE
+ if test "X${ag_cv_enable_debug}" != Xno
+ then
+ AC_DEFINE([DEBUG_ENABLED],[1],
+ [Define this if wanting autogen debugging])
+ AC_DEFINE([DEBUG_ENABLED], [1],
+ [Define this if debugging is enabled])
+ CFLAGS="-g `echo $CFLAGS|sed 's%-g *%%g;s%-O[0-9]* *%%g'`"
+ f=`which dmalloc 2>/dev/null`
+ [ -n "$f" ] && LIBS="${LIBS} -ldmalloc"
+ fi
+
+]) # end of AC_DEFUN of AG_ENABLE_DEBUG
+
+
+AC_DEFUN([AG_WITH_GROUP_PACKAGER],[
+ AC_ARG_WITH([packager],
+ AS_HELP_STRING([--with-packager], [name of the packager of this software is supplied]),
+ [ag_cv_with_group_packager=${with_packager}],
+ AC_CACHE_CHECK([whether name of the packager of this software is supplied], ag_cv_with_group_packager,
+ ag_cv_with_group_packager=no)
+ ) # end of AC_ARG_WITH
+ if test "X${ag_cv_with_group_packager}" != Xno
+ then
+ AC_DEFINE_UNQUOTED([WITH_PACKAGER],["${withval}"],
+ [Define this if name of the packager of this software is supplied])
+ fi
+ AC_ARG_WITH([packager-version],
+ AS_HELP_STRING([--with-packager-version], [packager-specific version information is supplied]),
+ [ag_cv_with_group_packager_version=${with_packager_version}],
+ AC_CACHE_CHECK([whether packager-specific version information is supplied], ag_cv_with_group_packager_version,
+ ag_cv_with_group_packager_version=no)
+ ) # end of AC_ARG_WITH
+ if test "X${ag_cv_with_group_packager_version}" != Xno
+ then
+ AC_DEFINE_UNQUOTED([WITH_PACKAGER_VERSION],["${withval}"],
+ [Define this if packager-specific version information is supplied])
+ fi
+ AC_ARG_WITH([packager-bug-reports],
+ AS_HELP_STRING([--with-packager-bug-reports], [bug reporting URI/e-mail/etc. is supplied]),
+ [ag_cv_with_group_packager_bug_reports=${with_packager_bug_reports}],
+ AC_CACHE_CHECK([whether bug reporting URI/e-mail/etc. is supplied], ag_cv_with_group_packager_bug_reports,
+ ag_cv_with_group_packager_bug_reports=no)
+ ) # end of AC_ARG_WITH
+ if test "X${ag_cv_with_group_packager_bug_reports}" != Xno
+ then
+ AC_DEFINE_UNQUOTED([WITH_PACKAGER_BUG_REPORTS],["${withval}"],
+ [Define this if bug reporting URI/e-mail/etc. is supplied])
+ fi
+ if test "X$with_packager" != "X" || \
+ test "X$with_packager_version$with_packager_bug_reports" = "X"
+ then :
+ else
+
+ AC_MSG_ERROR([--with-packager-{bug-reports,version} require --with-packager])
+ fi
+
+]) # end of AC_DEFUN of AG_WITH_GROUP_PACKAGER
+
+
+AC_DEFUN([INVOKE_AG_MACROS],[
+ # Check to see if shell scripts are desired.
+ AG_DISABLE_SHELL
+
+ # Check to see if using shell scripts.
+ AG_TEST_DO_SHELL
+
+ # Check to see if setjmp() links okay.
+ AG_LINK_SETJMP
+
+ # Check to see if sigsetjmp() links okay.
+ AG_LINK_SIGSETJMP
+
+ # Check to see if prefix for a working libguile installation.
+ AG_WITHLIB_GUILE
+
+ # Check to see if the guile version.
+ AG_TEST_GUILE_VERSION
+
+ # Check to see if a working libxml2 can be found.
+ AG_WITHLIB_XML2
+
+ # Check to see if sysinfo(2) is Solaris.
+ AG_RUN_SOLARIS_SYSINFO
+
+ # Check to see if strcspn matches prototype and works.
+ AG_RUN_STRCSPN
+
+ # Check to see if uname(2) is POSIX.
+ AG_RUN_UNAME_SYSCALL
+
+ # Check to see if runtime library dirs can be specified.
+ AG_TEST_LDFLAGS
+
+ # Check to see if wanting autogen debugging.
+ AG_ENABLE_DEBUG
+
+ # Check to see if name of the packager of this software is supplied.
+ AG_WITH_GROUP_PACKAGER
+
+ INVOKE_AG_MACROS_LAST
+]) # end AC_DEFUN of INVOKE_AG_MACROS
diff --git a/config/bootstrap b/config/bootstrap
new file mode 100644
index 0000000..2675a56
--- /dev/null
+++ b/config/bootstrap
@@ -0,0 +1,194 @@
+#! /bin/bash
+# -*- Mode: Shell-script -*-
+#
+# bootstrap --- maintainer's bootstrap script
+#
+# Time-stamp: "2012-04-14 08:11:20 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This script is designed to find any directories which contain a
+# configure.ac in script, and to run the autotools programs from each
+# of those directories to make sure they are in a state ready to
+# 'configure; make; make install'
+#
+# Often this process involves more than `libtoolize; automake; autoconf',
+# so supplementary actions can be placed in a bootstrap.local script
+# in the same directory as this script, and anywhere in the source tree
+# in bootstrap.dir files. The bootstrap.local script will be sourced
+# twice; first with BOOTSTRAP=pre before the main part is run, and then
+# again with BOOTSTRAP=post after the main part has finished. This makes
+# it possible to set up any links or temporary files required for this
+# script to work before it has executed, and then remove them when it
+# has finished. The bootstrap.dir files are also sourced, in a random
+# order, as they are found in the tree just before the BOOTSTRAP=post
+# phase. This allows a developer to put any peculiar bootstrap actions
+# required by individual directories where they can be seen (and not
+# forgotten!).
+#
+# In an ideal world, running this bootstrap script (including any extra
+# scripts it executes) should leave a freshly checked out CVS source tree
+# in the same state as a freshly unrolled tarball. In this way, one
+# no longer has to maintain generated files under source control, they
+# can be generated after checkout using this bootstrap procedure.
+
+PS4='>bsl-${FUNCNAME}> '
+top_srcdir=$(
+ cd $(dirname $0)/.. >/dev/null
+ pwd )
+top_builddir=${top_srcdir}
+
+. config/bootstrap.shlib
+PS4='>bs-${FUNCNAME}> '
+
+config_tools()
+{
+ top_srcdir=$(pwd)
+ top_builddir=${top_srcdir}
+ srcdir=${top_srcdir}
+ config_file=configure.ac
+ conf_dir=${top_srcdir}/config
+ test -f "${srcdir}/${config_file}" || die "${config_file} not in ${srcdir}"
+
+ # This missing function is used in many places
+ #
+ MISSING="${conf_dir}/missing"
+ export config_file srcdir top_srcdir top_builddir MISSING
+ chmod +x ${MISSING} || exit 1
+
+ # Check for AutoGen version 5.
+ #
+ AGexe=$(command -v autogen)
+ case "${AGexe}" in
+ ( /* )
+ v=$($AGexe --version || :)
+ case "$(echo $v | sed 's/.* //')" in
+ 5.* ) : ;;
+ * ) die "OUT OF DATE AutoGen: $v" ;;
+ esac
+ ;;
+
+ ( * )
+ die "AutoGen requires autogen to bootstrap"
+ ;;
+ esac
+
+ GDexe=$(command -v getdefs)
+ CLexe=$(command -v columns)
+ test -x "${GDexe}" -a -x "${CLexe}" || \
+ die "autogen support programs are missing"
+ export AGexe GDexe CLexe
+
+ # ------------------------------------------------------------------
+ # Make sure all of the maintainer tools required for bootstrap are
+ # available on the host machine.
+ # ------------------------------------------------------------------
+
+ tools="autoconf autoheader aclocal automake libtoolize"
+ for f in $tools
+ do
+ tool=$(command -v ${f}) > /dev/null || die "No $f found"
+ eval ${f}_reqver=$(
+ set -- $(${tool} --version | sed 1q)
+ eval echo \${$#})
+ eval $(echo $f | tr a-z A-Z)=${tool}
+ done
+
+ char_mapper=$(command -v char-mapper) 2>/dev/null
+ test -x "${char_mapper}" || {
+ char_mapper=$(
+ cd add-on/char-mapper >&2
+ make char-mapper >&2 || die "cannot make char-mapper"
+ echo ${PWD}/char-mapper)
+ }
+ export char_mapper
+
+ echo bootstrapping in ${PWD}
+ set +e
+}
+
+# Source any local scripts which add to the bootstrap procedure.
+# The bootstrap.local script should test the value of the BOOTSTRAP
+# environment variable to see whether it should run the sections
+# to be called before the main script, or afterwards.
+#
+pre_local()
+{
+ BOOTSTRAP=pre
+ export BOOTSTRAP
+
+ local PS4='>pbs-${FUNCNAME}> '
+ . ${conf_dir}/bootstrap.local ${1+"$@"} || \
+ die FAILED: ${conf_dir}/bootstrap.local
+
+ cd autoopts
+ PS4='>aobs-${FUNCNAME}> '
+ . ./bootstrap.dir aoconf
+}
+
+post_local()
+{
+ for f in $(find . -name bootstrap.dir)
+ do (
+ ${setx}
+ cd $(dirname $f)
+ srcdir=`pwd`
+ echo running POST-bootstrap.dir in ${srcdir}
+ PS4='>Abs-${FUNCNAME}> '
+ . ./bootstrap.dir recursive || :
+ )
+ done
+
+ local BOOTSTRAP=post
+ local PS4='>Abs-${FUNCNAME}> '
+ . ${conf_dir}/bootstrap.local ${1+"$@"}
+}
+
+run_autotools()
+{
+ # remove any stale config.cache
+ doit rm -f config.cache
+
+ test -n "$auxdir" || auxdir=${srcdir}
+ test -d $auxdir || auxdir=.
+
+ doit $LIBTOOLIZE --force
+ doit $ACLOCAL -I config
+ doit $AUTOHEADER
+ doit $AUTOMAKE --gnu --add-missing
+ doit $AUTOCONF
+}
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+#
+# M A I N
+#
+config_tools
+( pre_local )
+run_autotools
+post_local
+
+trap '' 0
+( exit 0 ) ; exit
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# indent-tabs-mode: nil
+# End:
+
+# bootstrap ends here
diff --git a/config/bootstrap.local b/config/bootstrap.local
new file mode 100644
index 0000000..2375ce7
--- /dev/null
+++ b/config/bootstrap.local
@@ -0,0 +1,223 @@
+#! /bin/echo This_file_must_be_sourced,_not_executed
+#
+# config/bootstrap.local --- maintainer's bootstrap script
+#
+# Author: Bruce Korb <bkorb@gnu.org>
+# Time-stamp: "2012-08-11 08:38:04 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+locate_exe()
+{
+ if [ -x "$1" ]
+ then
+ echo "$1"
+ return 0
+ fi
+
+ case "${1}" in
+ */* )
+ echo "Cannot find ${1}" >&2
+ return 1
+ ;;
+ "" )
+ echo "USAGE: locate_exe <exe-name>" >&2
+ exit 1
+ ;;
+ * )
+ name="${1}"
+ ;;
+ esac
+
+ SV="${IFS}"
+ IFS=" :"
+ set -- ${PATH}
+ for f
+ do
+ if [ -x ${f}/${name} ]
+ then
+ echo ${f}/${name}
+ return 0
+ fi
+ done
+ return 1
+}
+
+config_configurables()
+{
+ local tops=$(ls -d [a-rt-z]* snprintfv/Makefile.am Makefile.am)
+ local inf=$(find ${tops} -type f -name '*.in')
+ local in_list
+
+ {
+ for f in $inf
+ do
+ case "$f" in
+ *-tpl.in ) g=${f%-tpl.in}.tpl ;;
+ *-tlib.in ) g=${f%-tlib.in}.tlib ;;
+ *.in ) in_list=${in_list}${f%.in}$'\n' ; continue ;;
+ esac
+ printf 'AC_CONFIG_FILES([%s:%s])\n' $g $f
+ done
+ {
+ echo "$in_list"
+ find ${tops} -name 'Makefile.am' | sed 's/\.am$//'
+ } | columns --first='AC_CONFIG_FILES([' --end='])' -I4
+ } > configure.files
+
+ sedcmd="
+ s/^AC_INIT(.*/AC_INIT([${PACKAGE}],[${AG_VERSION}],[${EADDR}])/
+ /dnl Local Variables:/,\$d
+ /==ADD_CONFIG_FILES==/{
+ s/.*//
+ r configure.files
+ }"
+
+ sed "$sedcmd" ${config_file} > configure.tmp
+ mv -f configure.tmp ${config_file}
+ rm -f configure.files
+}
+
+config_versions()
+{
+ set -a
+ eval "$(egrep '^[A-Z][A-Z0-9_]+=' VERSION)"
+ set +a
+ unset LANG || LANG=''
+
+ grep '==ADD_CONFIG_FILES==' ${config_file} >/dev/null 2>&1
+ test $? -eq 0 && config_configurables
+
+ for f in $(egrep -l 'eaddr +=' */*opts.def)
+ do sed "/eaddr *=/s/= .*/= '${EADDR}';/" $f > X ; mv -f X $f
+ done
+
+ if grep '__CURRENT_VERSION__' NEWS > /dev/null
+ then
+ sed "1s/__CURRENT_VERSION__.*/${AG_VERSION} - $(date '+%B %Y')/" NEWS > X
+ mv -f X NEWS
+ fi
+
+ cd ${srcdir}/config
+ ${AGexe} -L. libopts.def || exit 1
+ ${AGexe} -L. misc.def || exit 1
+ cd ..
+ cp snprintfv/snprintfv.m4 config/.
+
+ marker='=== Component Todo:'
+ rm -f TODO
+ {
+ sed "/${marker}/,\$d" TODO-top
+ for f in */TODO
+ do
+ test -s $f || continue
+ echo ; echo ${marker} ${f} '==='
+ cat ${f}
+ done
+ } > TODO
+
+ cd ${srcdir}
+
+ glopts='--local-dir=tmp --source-base=autoopts --lib=do_not_make_me
+ --import
+ --makefile-name=gnulib.mk
+ --libtool
+ --no-changelog
+ --symlink
+ --m4-base=config
+ --lgpl=2'
+ glmods='parse-duration gendocs gettext-h'
+
+ GNULIBTOOL=${GNULIBDIR:-~gnu/proj/gnulib}/gnulib-tool
+ ${GNULIBTOOL} $glopts $glmods
+ sed -i 's/do_not_make_me_.*_SOURCES/EXTRA_DIST/;/do_not_make_me/d' \
+ autoopts/gnulib.mk
+}
+
+check_tools()
+{
+ local t e
+ for t in AG GD CL
+ do
+ eval e=\${${t}exe}
+ test -x "$e" || die "Not executable: \$${t}exe == '$e'"
+ $e --version || die "$e does not work"
+ done
+}
+
+tweak_Makefile_am()
+{
+ # IF the source dir is not known,
+ # THEN it is the directory above the directory of this file.
+ #
+ test -z "${srcdir}" && \
+ srcdir=$(\cd $(dirname $0) ; \cd .. ; pwd)
+ cd ${srcdir}
+
+ {
+ sed '/^EXTRA_DIST /{
+ s/.*/misc_extra = \\/
+ q
+ }' Makefile.am
+ find VERSION NOTES config/bootstrap* config/*.m4 \
+ autoopts/parse-duration.[ch] doc/gendocs* \
+ -type f | \
+ columns --spread=1 -I4 --line=' \'
+
+ sed -n '/^EXTRA_DIST /,$p' Makefile.am
+ } > XXX$$
+ mv -f XXX$$ Makefile.am
+
+ cd pkg
+ {
+ sed '/^LIBOPTS_FILES *=/{
+ s/=.*/= \\/
+ q
+ }' Makefile.am
+
+ find libopts -type f -name '[a-zA-Z]*' | \
+ columns --spread=1 -I4 --line=' \'
+ echo
+
+ sed '1,/LIBOPTS_FILES *=/d' Makefile.am
+ } > XXX$$
+ mv -f XXX$$ Makefile.am
+ cd ${srcdir}
+}
+
+case "${BOOTSTRAP}" in
+( pre )
+ dummy_texi=${srcdir}/doc/autogen.texi
+ echo '@setfilename autogen.info' > ${dummy_texi}
+ test -f ${srcdir}/configure && rm -f ${srcdir}/configure
+ check_tools >/dev/null
+ config_versions
+ tweak_Makefile_am
+ ;;
+
+( post )
+ test ${#dummy_texi} -gt 0 && rm -f ${dummy_texi}
+ ;;
+esac
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# indent-tabs-mode: nil
+# End:
+
+# config/bootstrap.local ends here
diff --git a/config/bootstrap.shlib b/config/bootstrap.shlib
new file mode 100644
index 0000000..b88e605
--- /dev/null
+++ b/config/bootstrap.shlib
@@ -0,0 +1,268 @@
+#! /bin/echo This_file_must_be_sourced,_not_executed
+# config/bootstrap.local --- maintainer's bootstrap script
+#
+# Author: Bruce Korb <bkorb@gnu.org>
+# Time-stamp: "2012-05-12 20:07:23 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file contains various utility functions for the "bootstrap" scripts
+# that are scattered about.
+
+mainpid=$$
+
+die() {
+ echo "bootstrap failure: $*" >&2
+ kill -9 ${mainpid}
+ exit 1
+}
+
+doit ()
+{
+ if test "x$1" != x:
+ then
+ echo "RUN: $*"
+ eval "$@" || exit 1
+ fi
+}
+
+case `set -o` in
+*posix*) set -o posix ;;
+*) exec bash $0 ${1+"$@"} ;;
+esac
+
+case "${SHELL}" in
+*[akz]sh) : ;;
+*)
+ while : ; do
+ SHELL=`which bash 2>/dev/null`
+ test -x "${SHELL}" && break
+
+ SHELL=`which ksh 2>/dev/null`
+ test -x "${SHELL}" && break
+
+ SHELL=/usr/xpg4/bin/sh
+ test -x "${SHELL}" && break
+
+ SHELL=`which sh 2>/dev/null`
+ test -x "${SHELL}" && break
+
+ die "unable to determine which shell to use"
+ done
+ ;;
+esac
+
+case "${VERBOSE}" in
+[tTyY1]* ) VERBOSE=true ;;
+[fFnN0]* ) VERBOSE=false ;;
+* )
+ case "$-" in
+ *x* ) VERBOSE=true ;;
+ * ) VERBOSE=false ;;
+ esac
+esac
+
+if ${VERBOSE}
+then setx=set\ -x dashx=-x ; set -x
+else setx=: dashx= ; set +x
+fi
+
+test -n "${BASH_VERSION}" || {
+ local() {
+ "$@"
+ }
+}
+
+test -z "${BASH_VERSION}" && local() { : ; }
+# Setup run_ag
+tpl_dir='-L'$(\cd ${top_srcdir}/autoopts/tpl && pwd)' -L'$(
+ \cd ${top_builddir}/autoopts/tpl && pwd)
+typeset -r tpl_dir
+
+if ${VERBOSE}
+then
+ # vgopts='--suppressions=/old-home/bkorb/ag/valgrind.conf --leak-check=yes'
+ # valgrind ${vgopts} --log-file=${vgfile} \
+
+ run_ag()
+ {
+ local tag=${1} ; shift
+ # local vgfile=/tmp/vglog/${tag}-%p.txt
+ local tfile='>>'ag-${tag}-$$.log
+ if test -n "$DEPFILE"
+ then tag="-MTstamp-${tag} -MF${DEPFILE} -MP"
+ else tag="-MFstamp-${tag} -MP"
+ fi
+ tag="${tag} --trace=every --trace-out=${tfile}"
+
+ MALLOC_CHECK_=2 \
+ ${AGexe} ${tpl_dir} ${tag} "$@" || die "FAILED: ${AGexe} $*"
+ }
+else
+ run_ag()
+ {
+ # local vgfile=/tmp/vglog/${1}-%p.txt
+ if test -n "$DEPFILE"
+ then tag="-MTstamp-${1} -MF${DEPFILE} -MP"
+ else tag="-MFstamp-${1} -MP"
+ fi
+ shift
+
+ echo ${AGexe} ${tpl_dir} ${tag} "$@"
+ ${AGexe} ${tpl_dir} ${tag} "$@" || die "FAILED: ${AGexe} $*"
+ }
+fi
+
+trap 'die "trapped exit signal"' 0
+
+test "X${CDPATH}" = X || {
+ ( unset CDPATH ) > /dev/null 2>&1 && unset CDPATH || CDPATH=''
+}
+
+nl=$'\n'
+ht=$'\t'
+GREP=$(command -v grep)
+EGREP=${GREP}\ -E
+FGREP=${GREP}\ -F
+
+export setx dashx VERBOSE nl ht
+
+# # # # # # # # # # # # # # # # # # #
+#
+# Make the option processing files:
+#
+make_opts()
+{
+ # Make the option processing files:
+ #
+ if [ -z "${AGexe}" ]
+ then
+ test "X${BOOTSTRAP}" = X \
+ && echo "Cannot locate ${AG}. Giving up"
+ if [ -f opts.h ] && [ -f opts.c ]
+ then exit 0 ; else exit 1 ; fi
+ fi
+ run_ag opts ${DEBUG_OPTS} *opts.def
+}
+
+# # # # # # # # # # # # # # # # # # #
+#
+# Make the proto.h header & make sure the static proc declarations
+# are all current at the top of each module.
+#
+make_proto()
+{
+ local target=stamp-proto temp_proto=proto-h$$ proto_h=proto.h
+ echo '#' stamped `date` > ${target}-$$
+
+ exec 5> $temp_proto
+
+ local files=`ls -1 *.c | grep -v 'fsm\.c$'`
+ local dirname=
+ local base_dir=`basename \`pwd\``
+ local marker=`echo ${base_dir} | tr a-z A-Z`_PROTO_H_GUARD
+ local ct=0
+
+ cat >&5 <<- _EOF_
+ /* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * Prototypes for ${base_dir}
+ * Generated `date`
+ */
+ #ifndef ${marker}
+ #define ${marker} 1
+
+ #ifndef LOCAL
+ # define LOCAL extern
+ # define REDEF_LOCAL 1
+ #else
+ # undef REDEF_LOCAL
+ #endif
+ _EOF_
+
+ for f in ${files}
+ do
+ test ! -f ${f} && echo "not a file: $f" >&2 && continue
+ ct=`echo \`egrep '(START|END)-STATIC-FORWARD' $f | wc -l\` `
+
+ case ${ct} in
+ ( 2 )
+ rm -f $f.[XY]
+
+ exec 4> $f.X
+ sed '/START-STATIC-FORWARD/q' $f >&4
+ sed -n '/END-STATIC-FORWARD/,$p' $f > $f.Y
+ sed -n '/^static /,/^{/p' $f.Y | \
+ sed 's/^{.*//;s/)$/);/;$d' >&4
+ cat $f.Y >&4
+ exec 4>&-
+
+ if cmp $f.X $f > /dev/null 2>&1
+ then :
+ else echo WARNING: ${f} has been updated >&2
+ mv -f $f.X $f ; fi
+
+ rm -f $f.[XY]
+ ;;
+
+ ( 0 ) : ;;
+ ( * )
+ echo "bad marker line count:" $ct in $f >&2
+ continue
+ esac
+
+ ct=`echo \`egrep '^LOCAL ' $f | wc -l\` `
+ test $ct -eq 0 && continue
+
+ echo $'/*\n * Extracted from '$f$'\n */' >&5
+ sed -n '/^LOCAL /,/^{/p' $f | \
+ sed 's/)$/);/;s/^{.*//' >&5
+ done
+
+ cat >&5 <<- _EOF_
+ #ifdef REDEF_LOCAL
+ # undef LOCAL
+ # define LOCAL
+ #endif
+ #endif /* ${marker} */
+ _EOF_
+ exec 5>&-
+
+ if cmp -s ${temp_proto} ${proto_h}
+ then
+ rm -f ${temp_proto}
+ if test -f
+ then
+ rm -f ${target}-$$
+ else
+ mv -f ${target}-$$ ${target}
+ touch ${proto_h}
+ fi
+ else
+ mv -f ${temp_proto} ${proto_h}
+ mv -f ${target}-$$ ${target}
+ fi
+}
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:4
+# sh-basic-offset:4
+# indent-tabs-mode: nil
+# End:
+
+# bootstrap.shlib ends here
diff --git a/config/compile b/config/compile
new file mode 100755
index 0000000..7b4a9a7
--- /dev/null
+++ b/config/compile
@@ -0,0 +1,342 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand '-c -o'.
+
+scriptversion=2012-03-05.13; # UTC
+
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+nl='
+'
+
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" "" $nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+ file=$1
+ case $file in
+ / | /[!/]*) # absolute file, and not a UNC file
+ if test -z "$file_conv"; then
+ # lazily determine how to convert abs files
+ case `uname -s` in
+ MINGW*)
+ file_conv=mingw
+ ;;
+ CYGWIN*)
+ file_conv=cygwin
+ ;;
+ *)
+ file_conv=wine
+ ;;
+ esac
+ fi
+ case $file_conv/,$2, in
+ *,$file_conv,*)
+ ;;
+ mingw/*)
+ file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+ ;;
+ cygwin/*)
+ file=`cygpath -m "$file" || echo "$file"`
+ ;;
+ wine/*)
+ file=`winepath -w "$file" || echo "$file"`
+ ;;
+ esac
+ ;;
+ esac
+}
+
+# func_cl_dashL linkdir
+# Make cl look for libraries in LINKDIR
+func_cl_dashL ()
+{
+ func_file_conv "$1"
+ if test -z "$lib_path"; then
+ lib_path=$file
+ else
+ lib_path="$lib_path;$file"
+ fi
+ linker_opts="$linker_opts -LIBPATH:$file"
+}
+
+# func_cl_dashl library
+# Do a library search-path lookup for cl
+func_cl_dashl ()
+{
+ lib=$1
+ found=no
+ save_IFS=$IFS
+ IFS=';'
+ for dir in $lib_path $LIB
+ do
+ IFS=$save_IFS
+ if $shared && test -f "$dir/$lib.dll.lib"; then
+ found=yes
+ lib=$dir/$lib.dll.lib
+ break
+ fi
+ if test -f "$dir/$lib.lib"; then
+ found=yes
+ lib=$dir/$lib.lib
+ break
+ fi
+ done
+ IFS=$save_IFS
+
+ if test "$found" != yes; then
+ lib=$lib.lib
+ fi
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+ # Assume a capable shell
+ lib_path=
+ shared=:
+ linker_opts=
+ for arg
+ do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ eat=1
+ case $2 in
+ *.o | *.[oO][bB][jJ])
+ func_file_conv "$2"
+ set x "$@" -Fo"$file"
+ shift
+ ;;
+ *)
+ func_file_conv "$2"
+ set x "$@" -Fe"$file"
+ shift
+ ;;
+ esac
+ ;;
+ -I)
+ eat=1
+ func_file_conv "$2" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -I*)
+ func_file_conv "${1#-I}" mingw
+ set x "$@" -I"$file"
+ shift
+ ;;
+ -l)
+ eat=1
+ func_cl_dashl "$2"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -l*)
+ func_cl_dashl "${1#-l}"
+ set x "$@" "$lib"
+ shift
+ ;;
+ -L)
+ eat=1
+ func_cl_dashL "$2"
+ ;;
+ -L*)
+ func_cl_dashL "${1#-L}"
+ ;;
+ -static)
+ shared=false
+ ;;
+ -Wl,*)
+ arg=${1#-Wl,}
+ save_ifs="$IFS"; IFS=','
+ for flag in $arg; do
+ IFS="$save_ifs"
+ linker_opts="$linker_opts $flag"
+ done
+ IFS="$save_ifs"
+ ;;
+ -Xlinker)
+ eat=1
+ linker_opts="$linker_opts $2"
+ ;;
+ -*)
+ set x "$@" "$1"
+ shift
+ ;;
+ *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+ func_file_conv "$1"
+ set x "$@" -Tp"$file"
+ shift
+ ;;
+ *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+ func_file_conv "$1" mingw
+ set x "$@" "$file"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+ done
+ if test -n "$linker_opts"; then
+ linker_opts="-link$linker_opts"
+ fi
+ exec "$@" $linker_opts
+ exit 1
+}
+
+eat=
+
+case $1 in
+ '')
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file 'INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "compile $scriptversion"
+ exit $?
+ ;;
+ cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+ func_cl_wrapper "$@" # Doesn't return...
+ ;;
+esac
+
+ofile=
+cfile=
+
+for arg
+do
+ if test -n "$eat"; then
+ eat=
+ else
+ case $1 in
+ -o)
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
+ # So we strip '-o arg' only if arg is an object.
+ eat=1
+ case $2 in
+ *.o | *.obj)
+ ofile=$2
+ ;;
+ *)
+ set x "$@" -o "$2"
+ shift
+ ;;
+ esac
+ ;;
+ *.c)
+ cfile=$1
+ set x "$@" "$1"
+ shift
+ ;;
+ *)
+ set x "$@" "$1"
+ shift
+ ;;
+ esac
+ fi
+ shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+ # If no '-o' option was seen then we might have been invoked from a
+ # pattern rule where we don't need one. That is ok -- this is a
+ # normal compilation that the losing compiler can handle. If no
+ # '.c' file was seen then we are probably linking. That is also
+ # ok.
+ exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
+# that we are using for the .o file. Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
+while true; do
+ if mkdir "$lockdir" >/dev/null 2>&1; then
+ break
+ fi
+ sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+ test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+ test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/config/config.guess b/config/config.guess
new file mode 100755
index 0000000..c0adba9
--- /dev/null
+++ b/config/config.guess
@@ -0,0 +1,1530 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+# 2011, 2012 Free Software Foundation, Inc.
+
+timestamp='2012-06-10'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner. Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a ChangeLog
+# entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ELF__
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+ exitcode=$?
+ trap '' 0
+ exit $exitcode ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ s390x:SunOS:*:*)
+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+ echo i386-pc-auroraux${UNAME_RELEASE}
+ exit ;;
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+ eval $set_cc_for_build
+ SUN_ARCH="i386"
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH="x86_64"
+ fi
+ fi
+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[4567])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep -q __LP64__
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ case ${UNAME_PROCESSOR} in
+ amd64)
+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ *:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:MSYS*:*)
+ echo ${UNAME_MACHINE}-pc-msys
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ *:Interix*:*)
+ case ${UNAME_MACHINE} in
+ x86)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ authenticamd | genuineintel | EM64T)
+ echo x86_64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ IA64)
+ echo ia64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ 8664:Windows_NT:*)
+ echo x86_64-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ aarch64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep -q ld.so.1
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
+ arm*:Linux:*:*)
+ eval $set_cc_for_build
+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_EABI__
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ else
+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_PCS_VFP
+ then
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+ else
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
+ fi
+ fi
+ exit ;;
+ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo ${UNAME_MACHINE}-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo ${UNAME_MACHINE}-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ hexagon:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ LIBC=gnu
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ mips:Linux:*:* | mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef ${UNAME_MACHINE}
+ #undef ${UNAME_MACHINE}el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=${UNAME_MACHINE}el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=${UNAME_MACHINE}
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ padre:Linux:*:*)
+ echo sparc-unknown-linux-gnu
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ tile*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ xtensa*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i586.
+ # Note: whatever this is, it MUST be the same as what config.sub
+ # prints for the "djgpp" host, or else GDB configury will decide that
+ # this is a cross-build.
+ echo i586-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
+ echo i586-pc-haiku
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-7:SUPER-UX:*:*)
+ echo sx7-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8:SUPER-UX:*:*)
+ echo sx8-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8R:SUPER-UX:*:*)
+ echo sx8r-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ i386)
+ eval $set_cc_for_build
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ UNAME_PROCESSOR="x86_64"
+ fi
+ fi ;;
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NEO-?:NONSTOP_KERNEL:*:*)
+ echo neo-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSE-*:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
+ i*86:AROS:*:*)
+ echo ${UNAME_MACHINE}-pc-aros
+ exit ;;
+ x86_64:VMkernel:*:*)
+ echo ${UNAME_MACHINE}-unknown-esx
+ exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config/config.sub b/config/config.sub
new file mode 100755
index 0000000..6205f84
--- /dev/null
+++ b/config/config.sub
@@ -0,0 +1,1782 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+# 2011, 2012 Free Software Foundation, Inc.
+
+timestamp='2012-04-18'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+ linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+ knetbsd*-gnu* | netbsd*-gnu* | \
+ kopensolaris*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ android-linux)
+ os=-linux-android
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray | -microblaze)
+ os=
+ basic_machine=$1
+ ;;
+ -bluegene*)
+ os=-cnk
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*178)
+ os=-lynxos178
+ ;;
+ -lynx*5)
+ os=-lynxos5
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | aarch64 | aarch64_be \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+ | be32 | be64 \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | epiphany \
+ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | hexagon \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | le32 | le64 \
+ | lm32 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | mcore | mep | metag \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64octeon | mips64octeonel \
+ | mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | moxie \
+ | mt \
+ | msp430 \
+ | nds32 | nds32le | nds32be \
+ | nios | nios2 \
+ | ns16k | ns32k \
+ | open8 \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle \
+ | pyramid \
+ | rl78 | rx \
+ | score \
+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ | spu \
+ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+ | ubicom32 \
+ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+ | we32k \
+ | x86 | xc16x | xstormy16 | xtensa \
+ | z8k | z80)
+ basic_machine=$basic_machine-unknown
+ ;;
+ c54x)
+ basic_machine=tic54x-unknown
+ ;;
+ c55x)
+ basic_machine=tic55x-unknown
+ ;;
+ c6x)
+ basic_machine=tic6x-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
+
+ strongarm | thumb | xscale)
+ basic_machine=arm-unknown
+ ;;
+ xgate)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ xscaleeb)
+ basic_machine=armeb-unknown
+ ;;
+
+ xscaleel)
+ basic_machine=armel-unknown
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | aarch64-* | aarch64_be-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* | avr32-* \
+ | be32-* | be64-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | hexagon-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | le32-* | le64-* \
+ | lm32-* \
+ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64octeon-* | mips64octeonel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
+ | nds32-* | nds32le-* | nds32be-* \
+ | nios-* | nios2-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | open8-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+ | pyramid-* \
+ | rl78-* | romp-* | rs6000-* | rx-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+ | tahoe-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tile*-* \
+ | tron-* \
+ | ubicom32-* \
+ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+ | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* \
+ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+ | z8k-* | z80-*)
+ ;;
+ # Recognize the basic CPU types without company name, with glob match.
+ xtensa*)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aros)
+ basic_machine=i386-pc
+ os=-aros
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ blackfin)
+ basic_machine=bfin-unknown
+ os=-linux
+ ;;
+ blackfin-*)
+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ bluegene*)
+ basic_machine=powerpc-ibm
+ os=-cnk
+ ;;
+ c54x-*)
+ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c55x-*)
+ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c6x-*)
+ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ cegcc)
+ basic_machine=arm-unknown
+ os=-cegcc
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16 | cr16-*)
+ basic_machine=cr16-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dicos)
+ basic_machine=i686-pc
+ os=-dicos
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ os=-linux
+ ;;
+ m68knommu-*)
+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ microblaze)
+ basic_machine=microblaze-xilinx
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ os=-mingw32ce
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
+ msys)
+ basic_machine=i386-pc
+ os=-msys
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ nacl)
+ basic_machine=le32-unknown
+ os=-nacl
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ neo-tandem)
+ basic_machine=neo-tandem
+ ;;
+ nse-tandem)
+ basic_machine=nse-tandem
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ parisc)
+ basic_machine=hppa-unknown
+ os=-linux
+ ;;
+ parisc-*)
+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc | ppcbe) basic_machine=powerpc-unknown
+ ;;
+ ppc-* | ppcbe-*)
+ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rdos)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh5el)
+ basic_machine=sh5le-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ strongarm-* | thumb-*)
+ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tile*)
+ basic_machine=$basic_machine-unknown
+ os=-linux-gnu
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ xscale-* | xscalee[bl]-*)
+ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ z80-*-coff)
+ basic_machine=z80-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -auroraux)
+ os=-auroraux
+ ;;
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+ | -sym* | -kopensolaris* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* | -cegcc* \
+ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-android* \
+ | -linux-newlib* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -dicos*)
+ os=-dicos
+ ;;
+ -nacl*)
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
+ spu-*)
+ os=-elf
+ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ hexagon-*)
+ os=-elf
+ ;;
+ tic54x-*)
+ os=-coff
+ ;;
+ tic55x-*)
+ os=-coff
+ ;;
+ tic6x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mep-*)
+ os=-elf
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -cnk*|-aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config/confmacs.tlib b/config/confmacs.tlib
new file mode 100644
index 0000000..820ec54
--- /dev/null
+++ b/config/confmacs.tlib
@@ -0,0 +1,674 @@
+[=
+
+AutoGen5 Template
+
+## Time-stamp: "2012-08-11 08:38:53 bkorb"
+##
+## This file is part of AutoGen.
+##
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+=][=
+
+(define restore-flags "")
+(define (protect-text t)
+ (string-substitute t
+ '("[" "]" "$" "#" )
+ '("@<:@" "@:>@" "@S|@" "@%:@" )) )
+
+(define test-name "")
+(define up-name "")
+(define down-name "")
+(define hyphen-name "")
+(define mac-name "")
+(define sub-name "")
+(define cv-name "")
+(define good-text "")
+(define bad-text "")
+
+(define set-ctx (lambda (my-name) (begin
+ (set! test-name (string->c-name! my-name))
+
+ (set! good-text "")
+ (set! bad-text "")
+
+ (set! up-name (string-upcase test-name))
+ (set! down-name (string-downcase test-name))
+ (set! hyphen-name (string-tr down-name "_" "-"))
+ (set! mac-name (string->c-name! (string-upcase! (string-append
+ group-pfx (get "type") "_" up-name))) )
+ (set! cv-name (string->c-name! (string-downcase! (string-append
+ group-pfx "cv_" (get "type") "_" down-name))) )
+ (set! sub-name (string-upcase! (string-append group-pfx up-name)))
+)))
+
+=][=
+
+# # # # # # # # # # EMIT MACRO # # # # # # # # =][=
+
+DEFINE emit-macro =][=
+
+ CASE type =][=
+ ~~ compile|run|link|test =][=
+ (define bad-define-name "NEED_%s")
+ (define good-define-name "HAVE_%s") =][=
+
+ ~~ enable|disable =][=
+ (define bad-define-name "%s_DISABLED")
+ (define good-define-name "%s_ENABLED") =][=
+
+ ~~ with|without|with-group =][=
+ (define bad-define-name "WITHOUT_%s")
+ (define good-define-name "WITH_%s") =][=
+
+ ~~ withlib|withconf =][=
+ (define lib-name (string-append "lib" down-name))
+ (define bad-define-name "WITHOUT_LIB%s")
+ (define good-define-name "WITH_LIB%s") =][=
+
+ * =][= (error (string-append "unknown macro type: " (get "type"))) =][=
+
+ ESAC =][=
+
+ IF (. separate-macros) =][=
+
+ INVOKE macro-header =][=
+
+ ENDIF separate-macros
+
+=]
+AC_DEFUN([[=
+ (define fcn-name (string-append "try-" (get "type")))
+ (define c-text (get "code")) =][=
+
+ IF (= (get "code-mode") "body") =][=
+ (set! c-text (string-append "int main(int argc,char** argv) {\n"
+ c-text "\nreturn 0; }" )) =][=
+ ENDIF =][=
+
+ (. mac-name) =]],[[=
+
+ IF (ag-function? fcn-name) =][=
+ INVOKE (. fcn-name) =][=
+ ELSE =][=
+
+ (error (string-append "invalid conftest function: " fcn-name)) =][=
+
+ ENDIF =]
+[=(prefix " " (join "\n" (stack "always")))
+=]
+]) # end of AC_DEFUN of [=(. mac-name)=]
+[=
+
+ENDDEF emit-macro
+
+# # # # # # # # # # # macro file header # # # # # # # # # # =][=
+
+DEFINE macro-header =][=
+
+(dne "dnl " "dnl ") =]
+dnl
+dnl @synopsis [=(. mac-name)=]
+dnl
+dnl @success-result[=
+ IF (<= (count "action") (count "action.no"))
+ =]: there is no output[=
+ ELSE =]
+dnl[=
+ FOR action =][=
+ IF (not (exist? "no")) =][=
+ CASE act-type =][=
+ == define =]
+dnl * [=(sprintf good-define-name up-name)
+ =] is #defined as [=?% act-text "%s" "1"=][=
+ == subst =]
+dnl * @[=(. sub-name)=]@ is replaced by [=act-text=][=
+ == script =]
+dnl * a short script is run[=
+ ESAC =][=
+ ENDIF exist? "no" =][=
+ ENDFOR =][=
+ ENDIF (<= (count "action") (count "action.no")) =]
+dnl
+dnl @failure-result[=
+ IF (= (count "action.no") 0)
+ =]: there is no output[=
+ ELSE =]
+dnl[=
+ FOR action =][=
+ IF (exist? "no") =][=
+ CASE act-type =][=
+ == define =]
+dnl * [=(sprintf bad-define-name up-name)
+ =] is #defined as [=?% act-text "%s" "1"=][=
+ == subst =]
+dnl * @[=(. sub-name)=]@ is replaced by [=act-text=][=
+ == script =]
+dnl * a short script is run[=
+ ESAC =][=
+ ENDIF =][=
+ ENDFOR =][=
+ ENDIF (= (count "action.no") 0) =][=
+
+ IF (define doc-text (get "doc"))
+ (> (string-length doc-text) 0) =]
+dnl
+dnl @description
+[=(prefix "dnl " doc-text) =][=
+ ENDIF =][=
+
+ IF (> (string-length author-name) 0) =]
+dnl
+dnl @version "[=
+
+ (strftime "%d-%B-%Y at %H:%M"
+ (localtime (current-time)) ) =]"
+dnl
+dnl @author [=(. author-name)=][=
+
+ ENDIF =]
+dnl[=
+
+ENDDEF macro-header
+
+# # # # # # # # # # # C-Feature # # # # # # # # # #
+
+Stash the result of a C/C++ feature test =][=
+
+DEFINE start-feat-test =][=
+ (if (exist? "preamble") (prefix " " (get "preamble"))) =]
+ AC_MSG_CHECKING([whether [=(protect-text (get "check"))=]])[=
+ENDDEF start-feat-test =][=
+
+DEFINE end-feat-test =][=
+
+ (. pop-language) =]
+ ]) # end of AC_CACHE_VAL for [=(. cv-name)=]
+ AC_MSG_RESULT([${[=(. cv-name)=]}])[=
+ emit-results =][=
+
+ENDDEF end-feat-test
+
+# # # # # # # # # # COLLECT ACTIONS # # # # # # # # # # =][=
+
+DEFINE collect-act =][=
+
+ CASE
+ (set! tmp-text (get "act-text"))
+ (set! TMP-text (string-upcase tmp-text))
+ (string-append
+ (if (exist? "no") "no-" "yes-")
+ (get "act-type"))
+ =][=
+
+ == yes-define =][=
+ (set! good-text (string-append good-text
+ "\n AC_DEFINE" (if (exist? "unquoted") "_UNQUOTED" "")
+ "([" (sprintf good-define-name up-name) "],["
+ (if (> (string-length tmp-text) 0) tmp-text "1")
+ "],\n [Define this if " (protect-text (get "check")) "])" ))
+ =][=
+
+ == yes-subst =][=
+ (set! good-subst 1)
+ (set! good-text (string-append good-text
+ "\n " sub-name "=" (protect-text (shell-str tmp-text)) ))
+ =][=
+
+ == yes-script =][=
+ (set! good-text (string-append good-text "\n "
+ (if (exist? "asis") tmp-text (protect-text tmp-text)) ))
+ =][=
+
+ == no-define =][=
+ (set! bad-text (string-append bad-text
+ "\n AC_DEFINE" (if (exist? "unquoted") "_UNQUOTED" "")
+ "([" (sprintf bad-define-name up-name) "],["
+ (if (> (string-length tmp-text) 0) tmp-text "1")
+ "],\n [Define this if '" (protect-text (get "check"))
+ "' is not true])" ))
+ =][=
+
+ == no-subst =][=
+ (set! bad-subst 1)
+ (set! bad-text (string-append bad-text
+ "\n " sub-name "=" (protect-text (shell-str tmp-text)) ))
+ =][=
+
+ == no-script =][=
+ (set! bad-text (string-append bad-text "\n "
+ (if (exist? "asis") tmp-text (protect-text tmp-text)) ))
+ =][=
+
+ ESAC =][=
+
+ENDDEF collect-act
+
+# # # # # # # # # # EMIT RESULTS # # # # # # # # # # =][=
+
+DEFINE emit-results =][=
+
+ (define good-subst 0 )
+ (define bad-subst 0 )
+ (define TMP-text "")
+ (define tmp-text "") =][=
+
+ IF (and (= (get "type") "withlib") (exist? "config")) =]
+ AC_SUBST([LIB[=(. up-name)=]_CFLAGS])
+ AC_SUBST([LIB[=(. up-name)=]_LIBS])
+ AC_SUBST([LIB[=(. up-name)=]_PATH])[=
+
+ (define good-subst 1)
+ (define bad-subst 1)
+ (set! good-text (string-append good-text (sprintf "[
+ LIB%1$s_CFLAGS=\"${%2$s_cflags}\"
+ LIB%1$s_LIBS=\"${%2$s_libs}\"
+ case \"${LIB%1$s_LIBS}\" in *-L* )
+ LIB%1$s_PATH=`echo ,${LIB%1$s_LIBS} | \
+ sed 's/.*[, ]-L[ \t]*//;s/[ \t].*//'`
+ ;; * ) LIB%1$s_PATH='' ;; esac]"
+ up-name cv-name )))
+
+ (set! bad-text (string-append bad-text (sprintf "
+ LIB%1$s_CFLAGS=''
+ LIB%1$s_LIBS=''
+ LIB%1$s_PATH=''" up-name ))) =][=
+
+ ENDIF type is withlib =][=
+
+ FOR action =][=
+ INVOKE collect-act =][=
+ ENDFOR action =][=
+
+ (if (> good-subst 0)
+ (if (< bad-subst 1)
+ (set! bad-text (string-append bad-text "\n "
+ sub-name "=''" )) )
+ (if (> bad-subst 0)
+ (set! good-text (string-append good-text "\n "
+ sub-name "=''" )) )
+ )
+
+=]
+ if test "X${[=(. cv-name)=]}" [=
+
+ IF (> (string-length good-text) 0)
+
+ =]!= Xno
+ then[=
+ (. good-text) =][=
+
+ IF (> (string-length bad-text) 0) =]
+ else[=
+ ENDIF =][=
+ ELSE =]= Xno
+ then[=
+ ENDIF =][=
+ (. bad-text) =]
+ fi[=
+
+ (if (> (+ good-subst bad-subst) 0)
+ (string-append "\n AC_SUBST([" sub-name "])" )) =][=
+
+ FOR conditional =]
+ AM_CONDITIONAL([[= conditional =]],[test "X${[=(. cv-name)=]}" != Xno])[=
+ ENDFOR =][=
+
+ FOR affirmed =]
+ AM_CONDITIONAL([[= conditional =]],[test "X${[=(. cv-name)=]}" = Xyes])[=
+ ENDFOR =][=
+
+ENDDEF emit-results
+
+# # # # # # # # # # ENABLEMENT # # # # # # # # # # =][=
+
+DEFINE emit-enablement
+
+ =]
+ AC_ARG_[=arg-name=]([[=(. hyphen-name)=]],
+ AS_HELP_STRING([--[=type=]-[=(. hyphen-name)=]], [[=check=]]),
+ [[=(. cv-name)=]=${[=(string-downcase! (get "arg-name"))
+ =]_[=(. down-name)=]}],
+ AC_CACHE_CHECK([whether [=check=]], [=(. cv-name)=],
+ [=(. cv-name)=]=[=
+ (if (~~ (get "type") "with|enable") "no" "yes") =])
+ ) # end of AC_ARG_[=arg-name=][=
+
+ INVOKE emit-results =][=
+
+ENDDEF emit-enablement
+
+# # # # # # # # # SET-LANGUAGE # # # # # # # # =][=
+
+DEFINE set-language
+
+=]
+ AC_CACHE_VAL([[=(. cv-name)=]],[[=
+ CASE language =][=
+ == "" =][=(define pop-language "")=][=
+ == default =][=(define pop-language "")=][=
+ * =]
+ AC_LANG_PUSH([=language=])[=
+ (define pop-language (sprintf "
+ AC_LANG_POP(%s)" (get "language"))) =][=
+
+ ESAC =][=
+
+ IF (exist? "cflags")
+
+=]
+ [=(. group-pfx)=]save_CPPFLAGS="${CPPFLAGS}"
+ CPPFLAGS="[= cflags =] ${CPPFLAGS}"[=
+ (set! pop-language (string-append pop-language
+ "\n CPPFLAGS=\"${" group-pfx "save_CPPFLAGS}\"" )) =][=
+
+ ENDIF cflags exists =][=
+
+ IF (exist? "libs")
+
+=]
+ [=(. group-pfx)=]save_LIBS="${LIBS}"
+ LIBS="[= libs =] ${LIBS}"[=
+ (set! pop-language (string-append pop-language
+ "\n LIBS=\"${" group-pfx "save_LIBS}\"" )) =][=
+
+ ENDIF libs exists =][=
+
+ENDDEF set-language
+
+# # # # # # # # # # WITH # # # # # # # # # =][=
+
+DEFINE try-with =][=
+ INVOKE emit-enablement
+ arg-name = WITH =][=
+ENDDEF try-with =][=
+
+# # # # # # # # # # WITHOUT # # # # # # # =][=
+
+DEFINE try-without =][=
+ (set! cv-name (string-append group-pfx "cv_with_" down-name)) =][=
+ INVOKE emit-enablement
+ arg-name = WITH =][=
+ENDDEF try-without =][=
+
+# # # # # # # WITH-GROUP # # # # # # =][=
+
+DEFINE try-with-group =][=
+ (define group-name (string-downcase (string->c-name! (get "name"))))
+ =][=
+
+ INVOKE emit-enablement
+ type = with
+ arg-name = WITH =][=
+ (define save-mname mac-name) =][=
+
+ FOR subgroup =][=
+ (set-ctx (string-append group-name "_" (get "subtype")))
+ =][=
+ INVOKE emit-enablement
+ type = with
+ arg-name = WITH
+ check = (get "subtext")
+ =][=
+ ENDFOR subgroup =][=
+
+ (set! mac-name save-mname)
+ (set! good-subst 0)
+ (set! bad-subst 0)
+ (set! good-text "")
+ (set! bad-text "") =][=
+
+ FOR grp-valid =]
+ if [= (get "grp-test") =]
+ then[=
+ FOR grp-action =][=
+ INVOKE collect-act =][=
+ ENDFOR grp-action =][=
+ (emit (if (> (string-length good-text) 1)
+ (string-append "\n" good-text)
+ " :"))
+ (if (> (string-length bad-text) 1)
+ (string-append "\n else\n" bad-text) "")
+ =]
+ fi[=
+ ENDFOR grp-valid =][=
+
+ENDDEF try-with-group =][=
+
+# # # # # # # # # # ENABLE # # # # # # # # # =][=
+
+DEFINE try-enable =][=
+ INVOKE emit-enablement
+ arg-name = ENABLE =][=
+ENDDEF try-enable =][=
+
+# # # # # # # # # # DISABLE # # # # # # # # # =][=
+
+DEFINE try-disable =][=
+ (set! cv-name (string-append group-pfx "cv_enable_" down-name)) =][=
+ INVOKE emit-enablement
+ arg-name = ENABLE =][=
+ENDDEF try-disable =][=
+
+# # # # # # # # # # WITHLIB # # # # # # # =][=
+
+DEFINE try-withlib =][=
+
+ # # # # # # # # options # # # # # # #
+
+=]
+ AC_ARG_WITH([[=
+ (set! cv-name (string-append group-pfx "cv_with_lib" down-name))
+ (set! lib-name (string-append "lib" down-name))
+ lib-name =]],
+ AS_HELP_STRING([--with-lib[=(string-tr down-name "_" "-")
+ =]], [[=(. lib-name)=] installation prefix]),
+ [[=(. cv-name)=]_root=${with_lib[=(string-tr down-name "-" "_")=]}],
+ AC_CACHE_CHECK([whether with-[=(. lib-name)=] was specified], [=
+ (. cv-name)=]_root,
+ [=(. cv-name)=]_root=no)
+ ) # end of AC_ARG_WITH [=(. lib-name)=]
+
+ if test "${with_[=(. lib-name)=]+set}" = set && \
+ test "X${withval}" = Xno
+ then ## disabled by request
+ [=(. cv-name)=]_root=no
+ [=(. cv-name)=]_cflags=no
+ [=(. cv-name)=]_libs=no
+ else
+
+ AC_ARG_WITH([[=(. lib-name)=]-cflags],
+ AS_HELP_STRING([--with-lib[=(string-tr down-name "_A-Z" "-a-z")
+ =]-cflags], [[=(. lib-name)=] compile flags]),
+ [[=(. cv-name)=]_cflags=${with_[=(. lib-name)=]_cflags}],
+ AC_CACHE_CHECK([whether with-[=(. lib-name)=]-cflags was specified], [=
+ (. cv-name)=]_cflags,
+ [=(. cv-name)=]_cflags=no)
+ ) # end of AC_ARG_WITH [=(. lib-name)=]-cflags
+
+ AC_ARG_WITH([[=(. lib-name)=]-libs],
+ AS_HELP_STRING([--with-lib[=(string-tr down-name "_A-Z" "-a-z")
+ =]-libs], [[=(. lib-name)=] link command arguments]),
+ [[=(. cv-name)=]_libs=${with_[=(. lib-name)=]_libs}],
+ AC_CACHE_CHECK([whether with-[=(. lib-name)=]-libs was specified], [=
+ (. cv-name)=]_libs,
+ [=(. cv-name)=]_libs=no)
+ ) # end of AC_ARG_WITH [=(. lib-name)=]-libs
+[=
+
+ # # # # # # set cflags/libs # # # # # #
+
+=]
+ case "X${[=(. cv-name)=]_cflags}" in
+ Xyes|Xno|X )
+ case "X${[=(. cv-name)=]_root}" in
+ Xyes|Xno|X ) [=(. cv-name)=]_cflags=no ;;
+ * ) [=(. cv-name)=]_cflags=-I${[=(. cv-name)=]_root}/include ;;
+ esac
+ esac
+ case "X${[=(. cv-name)=]_libs}" in
+ Xyes|Xno|X )
+ case "X${[=(. cv-name)=]_root}" in
+ Xyes|Xno|X ) [=(. cv-name)=]_libs=no ;;
+ * ) [=(. cv-name)=]_libs="-L${[=(. cv-name)
+ =]_root}/lib -l[=(. down-name)=]";;
+ esac
+ esac
+ [=(. group-pfx)=]save_CPPFLAGS="${CPPFLAGS}"
+ [=(. group-pfx)=]save_LIBS="${LIBS}"[=
+ (set! bad-text (sprintf
+ "\n CPPFLAGS=\"${%1$ssave_CPPFLAGS}\"
+ LIBS=\"${%1$ssave_LIBS}\"" group-pfx )) =][=
+
+ # # # # # # check config script # # # # # =][=
+
+ IF (exist? "config")
+
+=]
+ case "X${[=
+
+ (define tmp-text (if (exist? "config.script") (get "config.script")
+ (string-append down-name "-config") ))
+
+ cv-name =]_cflags}" in
+ Xyes|Xno|X )
+ f=`[=(. tmp-text)=] [= config.cflags-arg =] 2>/dev/null` || f=''
+ test -n "${f}" && [=(. cv-name)=]_cflags="${f}" && \
+ AC_MSG_NOTICE([[=(. tmp-text)=] used for CFLAGS: $f]) ;;
+ esac
+ case "X${[=(. cv-name)=]_libs}" in
+ Xyes|Xno|X )
+ f=`[=(. tmp-text)=] [= config.libs-arg =] 2>/dev/null` || f=''
+ test -n "${f}" && [=(. cv-name)=]_libs="${f}" && \
+ AC_MSG_NOTICE([[=(. tmp-text)=] used for LIBS: $f]) ;;
+ esac[=
+
+ ENDIF (exist? "config")
+
+ =][= # # # # set cflags/libs # # # #
+
+=]
+ fi ## disabled by request
+
+ case "X${[=(. cv-name)=]_cflags}" in
+ Xyes|Xno|X )
+ [=(. cv-name)=]_cflags="" ;;
+ * ) CPPFLAGS="${CPPFLAGS} ${[=(. cv-name)=]_cflags}" ;;
+ esac
+ case "X${[=(. cv-name)=]_libs}" in
+ Xyes|Xno|X )[=
+ IF (not (exist? "libname")) =]
+ LIBS="${LIBS} -l[=(. down-name)=]"
+ [=(. cv-name)=]_libs="-l[=(. down-name)=]"[=
+
+ ELIF (> (string-length (get "libname")) 0) =]
+ LIBS="${LIBS} -l[=(get "libname")=]"
+ [=(. cv-name)=]_libs="-l[=(get "libname")=]"[=
+ ELSE =]
+ [=(. cv-name)=]_libs=""[=
+ ENDIF =] ;;
+ * )
+ LIBS="${LIBS} ${[=(. cv-name)=]_libs}" ;;
+ esac[=
+
+ # # # # # # # # testing # # # # # # #
+
+ =]
+ LIB[=(. up-name)=]_CFLAGS=""
+ LIB[=(. up-name)=]_LIBS=""[=
+
+ CASE run-mode =][=
+
+ == link =]
+ AC_MSG_CHECKING([whether [=(. lib-name)=] can be linked with])[=
+ set-language =]
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([[[=(protect-text c-text)=]]])],
+ [[=(. cv-name)=]=yes],
+ [[=(. cv-name)=]=no]) # end of AC_LINK_IFELSE [=
+
+ == run =]
+ AC_MSG_CHECKING([whether [=(. lib-name)=] functions properly])[=
+ set-language =]
+ AC_RUN_IFELSE([[=(protect-text c-text)=]],
+ [[=(. cv-name)=]=yes], [[=(. cv-name)=]=no],
+ [[=(. cv-name)=]=no]) # end of AC_RUN_IFELSE [=
+
+ ESAC =][=
+
+ end-feat-test =][=
+
+ENDDEF try-withlib =][=
+
+# # # # # # # # # # TEST # # # # # # # # # =][=
+
+DEFINE try-test =][=
+
+ start-feat-test =]
+ AC_CACHE_VAL([[=(. cv-name)=]],[
+ [=(. cv-name)=]=[= (sub-shell-str
+ (string-append "exec 2> /dev/null\n" (get "code")) ) =]
+ if test $? -ne 0 || test -z "$[=(. cv-name)=]"
+ then [=(. cv-name)=]=no
+ fi
+ ]) # end of CACHE_VAL of [=(. cv-name)=]
+ AC_MSG_RESULT([${[=(. cv-name)=]}])[=
+ emit-results =][=
+
+ENDDEF try-test =][=
+
+# # # # # # # # # # RUN # # # # # # # # # =][=
+
+DEFINE try-run =][=
+
+ start-feat-test =][=
+ set-language =]
+ AC_RUN_IFELSE([[=(protect-text c-text)=]],
+ [[=(. cv-name)=]=yes],[[=(. cv-name)=]=no],[[=
+ (. cv-name)=]=no]
+ ) # end of RUN_IFELSE[=
+ end-feat-test =][=
+
+ENDDEF try-run =][=
+
+# # # # # # # # # # LINK # # # # # # # # # =][=
+
+DEFINE try-link =][=
+
+ start-feat-test =][=
+ set-language =]
+ AC_TRY_LINK([[= (protect-text (shellf
+ "egrep '^#' <<_EOF_\n%s\n_EOF_" c-text )) =]],
+ [[= (protect-text (shellf
+ "egrep -v '^#' <<_EOF_\n%s\n_EOF_" c-text )) =]],
+ [[=(. cv-name)=]=yes],[[=(. cv-name)=]=no]
+ ) # end of TRY_LINK[=
+ end-feat-test =][=
+
+ENDDEF try-link =][=
+
+# # # # # # # # # # COMPILE # # # # # # # # # # =][=
+
+DEFINE try-compile =][=
+
+ start-feat-test =][=
+ set-language =]
+ AC_TRY_COMPILE([= % includes "[%s]" =],[[=(protect-text c-text)=]],
+ [[=(. cv-name)=]=yes],[[=(. cv-name)=]=no]
+ ) # end of TRY_COMPILE[=
+ end-feat-test =][=
+
+ENDDEF try-compile =]
diff --git a/config/conftest.tpl b/config/conftest.tpl
new file mode 100644
index 0000000..b5278c9
--- /dev/null
+++ b/config/conftest.tpl
@@ -0,0 +1,133 @@
+[= AutoGen5 template -*- Mode: M4 -*-
+
+null
+
+## Time-stamp: "2012-01-02 20:00:21 bkorb"
+##
+## This file is part of AutoGen.
+##
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# This template uses the following definitions:
+#
+# 1. group - defines a prefix for the names. The default is "ac".
+# 2. test - an autoconf test to perform:
+# 2.a name - name of the test
+# 2.b type - "run", "link" or "compile"
+# 2.c check - short display name for user entertainment
+# 2.d code - the test code to compile, link and/or run.
+# 2.e doc - useful explanitory text
+# 2.f require - if there are conftest prerequisites
+# 2.g author - [optional] name of test's author
+
+(setenv "SHELL" "/bin/sh")
+
+=][=
+
+INCLUDE "confmacs.tlib" =][=
+
+(define group-id (string-downcase! (get "group")))
+(if (= (string-length group-id) 0)
+ (set! group-id "ac")
+ (string->c-name! group-id) )
+(define group-pfx (string-append group-id "_"))
+
+(define ofile "")
+(define separate-macros #t)
+
+(if (exist? "output-file")
+ (begin
+ (set! ofile (get "output-file"))
+ (set! separate-macros #f)
+ (shellf "echo sending output to %s >&2" ofile)
+ )
+
+ (begin
+ (set! ofile
+ (string-append (string-downcase! (get "group")) "_macros.m4") )
+) )
+(out-switch ofile)
+(define ofile-list ofile)
+(define do-all-name (string-append
+ "INVOKE_" (string-upcase! (get "group")) "_MACROS" ))
+
+(dne "dnl " "dnl ") =][=
+
+IF (exist? "do-first") =]
+dnl
+dnl do always before generated macros:
+dnl
+AC_DEFUN([[= (. do-all-name) =]_FIRST],[
+[= (prefix " " (join "\n" (stack "do-first"))) =]
+])
+[= (if (exist? "do-always") "\n\n") =][=
+
+ENDIF do-first =][=
+
+IF (exist? "do-always") =]
+dnl
+dnl do always after generated macros:
+dnl
+AC_DEFUN([[= (. do-all-name) =]_LAST],[
+[if test X${[= (. do-all-name) =]_LAST_done} != Xyes ; then]
+[= (prefix " " (join "\n" (stack "do-always"))) =]
+[ [= (. do-all-name) =]_LAST_done=yes
+fi]])
+[=
+ENDIF do-always =]
+dnl
+dnl @synopsis [=(. do-all-name)=]
+dnl
+dnl This macro will invoke the AutoConf macros specified in [=(def-file)=]
+dnl that have not been disabled with "omit-invocation".
+dnl[=
+
+(if (not separate-macros) (out-push-new))
+
+=]
+AC_DEFUN([[=(. do-all-name)=]],[[=
+
+(if (exist? "do-first")
+ (string-append "\n AC_REQUIRE([" do-all-name "_FIRST])")) =][=
+
+FOR test =][=
+ (define author-name (get "author"))
+ (set-ctx (get "name"))
+ (if separate-macros
+ (begin
+ (set! ofile (string-append (string-downcase mac-name) ".m4" ))
+ (out-push-new ofile)
+ (set! ofile-list (string-append ofile-list "\n" ofile))
+ )
+ (out-suspend "main-macro")
+ ) =][=
+
+ INVOKE emit-macro =]
+[=(if separate-macros (out-pop) (out-resume "main-macro")) =][=
+
+ IF (not (exist? "omit-invocation")) =]
+ # Check to see if [=check=].
+ [=(. mac-name) =]
+[=ENDIF =][=
+ENDFOR test =][=
+(if (not separate-macros)
+ (out-pop #t)) =][=
+(if (exist? "do-always")
+ (string-append "\n " do-all-name "_LAST"))
+=]
+]) # end AC_DEFUN of [=(. do-all-name)=][=
+
+# end conftest.tpl =]
diff --git a/config/depcomp b/config/depcomp
new file mode 100755
index 0000000..debb6ff
--- /dev/null
+++ b/config/depcomp
@@ -0,0 +1,707 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2012-03-27.16; # UTC
+
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by 'PROGRAMS ARGS'.
+ object Object file output by 'PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputting dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+# A tabulation character.
+tab=' '
+# A newline character.
+nl='
+'
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvisualcpp
+fi
+
+if test "$depmode" = msvc7msys; then
+ # This is just like msvc7 but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u='sed s,\\\\,/,g'
+ depmode=msvc7
+fi
+
+if test "$depmode" = xlc; then
+ # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
+ gccflag=-qmakedep=gcc,-MF
+ depmode=gcc
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am. Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+ for arg
+ do
+ case $arg in
+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+ *) set fnord "$@" "$arg" ;;
+ esac
+ shift # fnord
+ shift # $arg
+ done
+ "$@"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the "deleted header file" problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' "$nl" < "$tmpdepfile" |
+## Some versions of gcc put a space before the ':'. On the theory
+## that the space means something, we add a space to the output as
+## well. hp depmode also adds that space, but also prefixes the VPATH
+## to the object. Take care to not repeat it in the output.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
+ | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like '#:fec' to the end of the
+ # dependency line.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr "$nl" ' ' >> "$depfile"
+ echo >> "$depfile"
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' "$nl" < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+xlc)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts '$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$base.u
+ tmpdepfile3=$dir.libs/$base.u
+ "$@" -Wc,-M
+ else
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$dir$base.u
+ tmpdepfile3=$dir$base.u
+ "$@" -M
+ fi
+ stat=$?
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form 'foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # '$object: dependent.h' and one to simply 'dependent.h:'.
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
+ # However on
+ # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using '\':
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+ # tcc 0.9.26 (FIXME still under development at the moment of writing)
+ # will emit a similar output, but also prepend the continuation lines
+ # with horizontal tabulation characters.
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form 'foo.o: dependent.h',
+ # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # '$object: dependent.h' and one to simply 'dependent.h:'.
+ sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
+ < "$tmpdepfile" > "$depfile"
+ sed '
+ s/[ '"$tab"'][ '"$tab"']*/ /g
+ s/^ *//
+ s/ *\\*$//
+ s/^[^:]*: *//
+ /^$/d
+ /:$/d
+ s/$/ :/
+ ' < "$tmpdepfile" >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp2)
+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+ # compilers, which have integrated preprocessors. The correct option
+ # to use with these is +Maked; it writes dependencies to a file named
+ # 'foo.d', which lands next to the object file, wherever that
+ # happens to be.
+ # Much of this is similar to the tru64 case; see comments there.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir.libs/$base.d
+ "$@" -Wc,+Maked
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ "$@" +Maked
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+ # Add 'dependent.h:' lines.
+ sed -ne '2,${
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile" "$tmpdepfile2"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in 'foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mechanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+msvc7)
+ if test "$libtool" = yes; then
+ showIncludes=-Wc,-showIncludes
+ else
+ showIncludes=-showIncludes
+ fi
+ "$@" $showIncludes > "$tmpdepfile"
+ stat=$?
+ grep -v '^Note: including file: ' "$tmpdepfile"
+ if test "$stat" = 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ # The first sed program below extracts the file names and escapes
+ # backslashes for cygpath. The second sed program outputs the file
+ # name when reading, but also accumulates all include files in the
+ # hold buffer in order to output them again at the end. This only
+ # works with sed implementations that can handle large buffers.
+ sed < "$tmpdepfile" -n '
+/^Note: including file: *\(.*\)/ {
+ s//\1/
+ s/\\/\\\\/g
+ p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+ s/.*/'"$tab"'/
+ G
+ p
+}' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvc7msys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove '-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for ':'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' "$nl" < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no eat=no
+ for arg
+ do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ if test $eat = yes; then
+ eat=no
+ continue
+ fi
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -arch)
+ eat=yes ;;
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix=`echo "$object" | sed 's/^.*\././'`
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ # makedepend may prepend the VPATH from the source file name to the object.
+ # No need to regex-escape $object, excess matching of '.' is harmless.
+ sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove '-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E 2>/dev/null |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+ echo "$tab" >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvcmsys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/config/extensions.m4 b/config/extensions.m4
new file mode 100644
index 0000000..7131ad7
--- /dev/null
+++ b/config/extensions.m4
@@ -0,0 +1,118 @@
+# serial 9 -*- Autoconf -*-
+# Enable extensions on systems that normally disable them.
+
+# Copyright (C) 2003, 2006-2012 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
+# Autoconf. Perhaps we can remove this once we can assume Autoconf
+# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
+# enough in this area it's likely we'll need to redefine
+# AC_USE_SYSTEM_EXTENSIONS for quite some time.
+
+# If autoconf reports a warning
+# warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+# the fix is
+# 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked
+# but always AC_REQUIREd,
+# 2) to ensure that for each occurrence of
+# AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+# or
+# AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+# the corresponding gnulib module description has 'extensions' among
+# its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
+# invocation occurs in gl_EARLY, not in gl_INIT.
+
+# AC_USE_SYSTEM_EXTENSIONS
+# ------------------------
+# Enable extensions on systems that normally disable them,
+# typically due to standards-conformance issues.
+# Remember that #undef in AH_VERBATIM gets replaced with #define by
+# AC_DEFINE. The goal here is to define all known feature-enabling
+# macros, then, if reports of conflicts are made, disable macros that
+# cause problems on some platforms (such as __EXTENSIONS__).
+AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
+[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
+AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
+
+ AC_REQUIRE([AC_CANONICAL_HOST])
+
+ AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
+ if test "$MINIX" = yes; then
+ AC_DEFINE([_POSIX_SOURCE], [1],
+ [Define to 1 if you need to in order for `stat' and other
+ things to work.])
+ AC_DEFINE([_POSIX_1_SOURCE], [2],
+ [Define to 2 if the system does not provide POSIX.1 features
+ except with this defined.])
+ AC_DEFINE([_MINIX], [1],
+ [Define to 1 if on MINIX.])
+ fi
+
+ dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500,
+ dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already
+ dnl provided.
+ case "$host_os" in
+ hpux*)
+ AC_DEFINE([_XOPEN_SOURCE], [500],
+ [Define to 500 only on HP-UX.])
+ ;;
+ esac
+
+ AH_VERBATIM([__EXTENSIONS__],
+[/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+])
+ AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+ [ac_cv_safe_to_define___extensions__],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+# define __EXTENSIONS__ 1
+ ]AC_INCLUDES_DEFAULT])],
+ [ac_cv_safe_to_define___extensions__=yes],
+ [ac_cv_safe_to_define___extensions__=no])])
+ test $ac_cv_safe_to_define___extensions__ = yes &&
+ AC_DEFINE([__EXTENSIONS__])
+ AC_DEFINE([_ALL_SOURCE])
+ AC_DEFINE([_GNU_SOURCE])
+ AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
+ AC_DEFINE([_TANDEM_SOURCE])
+])# AC_USE_SYSTEM_EXTENSIONS
+
+# gl_USE_SYSTEM_EXTENSIONS
+# ------------------------
+# Enable extensions on systems that normally disable them,
+# typically due to standards-conformance issues.
+AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
+[
+ dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS.
+ dnl gnulib does not need it. But if it gets required by third-party macros
+ dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a
+ dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS".
+ dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE,
+ dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck.
+ AC_REQUIRE([AC_GNU_SOURCE])
+
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+])
diff --git a/config/gendocs.sh b/config/gendocs.sh
new file mode 100755
index 0000000..c8abd55
--- /dev/null
+++ b/config/gendocs.sh
@@ -0,0 +1,385 @@
+#!/bin/sh -e
+# gendocs.sh -- generate a GNU manual in many formats. This script is
+# mentioned in maintain.texi. See the help message below for usage details.
+
+scriptversion=2011-04-08.14
+
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Original author: Mohit Agarwal.
+# Send bug reports and any other correspondence to bug-texinfo@gnu.org.
+#
+# The latest version of this script, and the companion template, is
+# available from Texinfo CVS:
+# http://savannah.gnu.org/cgi-bin/viewcvs/texinfo/texinfo/util/gendocs.sh
+# http://savannah.gnu.org/cgi-bin/viewcvs/texinfo/texinfo/util/gendocs_template
+#
+# An up-to-date copy is also maintained in Gnulib (gnu.org/software/gnulib).
+
+prog=`basename "$0"`
+srcdir=`pwd`
+
+scripturl="http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/texinfo/texinfo/util/gendocs.sh"
+templateurl="http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/texinfo/texinfo/util/gendocs_template"
+
+: ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="}
+: ${MAKEINFO="makeinfo"}
+: ${TEXI2DVI="texi2dvi -t @finalout"}
+: ${DVIPS="dvips"}
+: ${DOCBOOK2HTML="docbook2html"}
+: ${DOCBOOK2PDF="docbook2pdf"}
+: ${DOCBOOK2PS="docbook2ps"}
+: ${DOCBOOK2TXT="docbook2txt"}
+: ${GENDOCS_TEMPLATE_DIR="."}
+: ${TEXI2HTML="texi2html"}
+unset CDPATH
+unset use_texi2html
+
+version="gendocs.sh $scriptversion
+
+Copyright 2010 Free Software Foundation, Inc.
+There is NO warranty. You may redistribute this software
+under the terms of the GNU General Public License.
+For more information about these matters, see the files named COPYING."
+
+usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE
+
+Generate various output formats from PACKAGE.texinfo (or .texi or .txi) source.
+See the GNU Maintainers document for a more extensive discussion:
+ http://www.gnu.org/prep/maintain_toc.html
+
+Options:
+ -s SRCFILE read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi}
+ -o OUTDIR write files into OUTDIR, instead of manual/.
+ --email ADR use ADR as contact in generated web pages.
+ --docbook convert to DocBook too (xml, txt, html, pdf and ps).
+ --html ARG pass indicated ARG to makeinfo or texi2html for HTML targets.
+ --texi2html use texi2html to generate HTML targets.
+ --help display this help and exit successfully.
+ --version display version information and exit successfully.
+
+Simple example: $prog --email bug-gnu-emacs@gnu.org emacs \"GNU Emacs Manual\"
+
+Typical sequence:
+ cd PACKAGESOURCE/doc
+ wget \"$scripturl\"
+ wget \"$templateurl\"
+ $prog --email BUGLIST MANUAL \"GNU MANUAL - One-line description\"
+
+Output will be in a new subdirectory \"manual\" (by default, use -o OUTDIR
+to override). Move all the new files into your web CVS tree, as
+explained in the Web Pages node of maintain.texi.
+
+Please use the --email ADDRESS option to specify your bug-reporting
+address in the generated HTML pages.
+
+MANUAL-TITLE is included as part of the HTML <title> of the overall
+manual/index.html file. It should include the name of the package being
+documented. manual/index.html is created by substitution from the file
+$GENDOCS_TEMPLATE_DIR/gendocs_template. (Feel free to modify the
+generic template for your own purposes.)
+
+If you have several manuals, you'll need to run this script several
+times with different MANUAL values, specifying a different output
+directory with -o each time. Then write (by hand) an overall index.html
+with links to them all.
+
+If a manual's Texinfo sources are spread across several directories,
+first copy or symlink all Texinfo sources into a single directory.
+(Part of the script's work is to make a tar.gz of the sources.)
+
+You can set the environment variables MAKEINFO, TEXI2DVI, TEXI2HTML, and
+DVIPS to control the programs that get executed, and
+GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is
+looked for. With --docbook, the environment variables DOCBOOK2HTML,
+DOCBOOK2PDF, DOCBOOK2PS, and DOCBOOK2TXT are also respected.
+
+By default, makeinfo and texi2dvi are run in the default (English)
+locale, since that's the language of most Texinfo manuals. If you
+happen to have a non-English manual and non-English web site, see the
+SETLANG setting in the source.
+
+Email bug reports or enhancement requests to bug-texinfo@gnu.org.
+"
+
+calcsize()
+{
+ size=`ls -ksl $1 | awk '{print $1}'`
+ echo $size
+}
+
+MANUAL_TITLE=
+PACKAGE=
+EMAIL=webmasters@gnu.org # please override with --email
+htmlarg=
+outdir=manual
+srcfile=
+
+while test $# -gt 0; do
+ case $1 in
+ --email) shift; EMAIL=$1;;
+ --help) echo "$usage"; exit 0;;
+ --version) echo "$version"; exit 0;;
+ -s) shift; srcfile=$1;;
+ -o) shift; outdir=$1;;
+ --docbook) docbook=yes;;
+ --html) shift; htmlarg=$1;;
+ --texi2html) use_texi2html=1;;
+ -*)
+ echo "$0: Unknown option \`$1'." >&2
+ echo "$0: Try \`--help' for more information." >&2
+ exit 1;;
+ *)
+ if test -z "$PACKAGE"; then
+ PACKAGE=$1
+ elif test -z "$MANUAL_TITLE"; then
+ MANUAL_TITLE=$1
+ else
+ echo "$0: extra non-option argument \`$1'." >&2
+ exit 1
+ fi;;
+ esac
+ shift
+done
+
+# For most of the following, the base name is just $PACKAGE
+base=$PACKAGE
+
+if test -n "$srcfile"; then
+ # but here, we use the basename of $srcfile
+ base=`basename "$srcfile"`
+ case $base in
+ *.txi|*.texi|*.texinfo) base=`echo "$base"|sed 's/\.[texinfo]*$//'`;;
+ esac
+ PACKAGE=$base
+elif test -s "$srcdir/$PACKAGE.texinfo"; then
+ srcfile=$srcdir/$PACKAGE.texinfo
+elif test -s "$srcdir/$PACKAGE.texi"; then
+ srcfile=$srcdir/$PACKAGE.texi
+elif test -s "$srcdir/$PACKAGE.txi"; then
+ srcfile=$srcdir/$PACKAGE.txi
+else
+ echo "$0: cannot find .texinfo or .texi or .txi for $PACKAGE in $srcdir." >&2
+ exit 1
+fi
+
+if test ! -r $GENDOCS_TEMPLATE_DIR/gendocs_template; then
+ echo "$0: cannot read $GENDOCS_TEMPLATE_DIR/gendocs_template." >&2
+ echo "$0: it is available from $templateurl." >&2
+ exit 1
+fi
+
+case $outdir in
+ /*) abs_outdir=$outdir;;
+ *) abs_outdir=$srcdir/$outdir;;
+esac
+
+echo Generating output formats for $srcfile
+
+cmd="$SETLANG $MAKEINFO -o $PACKAGE.info \"$srcfile\""
+echo "Generating info files... ($cmd)"
+eval "$cmd"
+mkdir -p "$outdir/"
+tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info*
+info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"`
+# do not mv the info files, there's no point in having them available
+# separately on the web.
+
+cmd="$SETLANG ${TEXI2DVI} \"$srcfile\""
+echo "Generating dvi ... ($cmd)"
+eval "$cmd"
+
+# now, before we compress dvi:
+echo Generating postscript...
+${DVIPS} $PACKAGE -o
+gzip -f -9 $PACKAGE.ps
+ps_gz_size=`calcsize $PACKAGE.ps.gz`
+mv $PACKAGE.ps.gz "$outdir/"
+
+# compress/finish dvi:
+gzip -f -9 $PACKAGE.dvi
+dvi_gz_size=`calcsize $PACKAGE.dvi.gz`
+mv $PACKAGE.dvi.gz "$outdir/"
+
+cmd="$SETLANG ${TEXI2DVI} --pdf \"$srcfile\""
+echo "Generating pdf ... ($cmd)"
+eval "$cmd"
+pdf_size=`calcsize $PACKAGE.pdf`
+mv $PACKAGE.pdf "$outdir/"
+
+cmd="$SETLANG $MAKEINFO -o $PACKAGE.txt --no-split --no-headers \"$srcfile\""
+echo "Generating ASCII... ($cmd)"
+eval "$cmd"
+ascii_size=`calcsize $PACKAGE.txt`
+gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
+ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"`
+mv $PACKAGE.txt "$outdir/"
+
+html_split()
+{
+ opt="--split=$1 $htmlarg --node-files"
+ cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $opt \"$srcfile\""
+ echo "Generating html by $1... ($cmd)"
+ eval "$cmd"
+ split_html_dir=$PACKAGE.html
+ (
+ cd ${split_html_dir} || exit 1
+ ln -sf ${PACKAGE}.html index.html
+ tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html
+ )
+ eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"`
+ rm -f "$outdir"/html_$1/*.html
+ mkdir -p "$outdir/html_$1/"
+ mv ${split_html_dir}/*.html "$outdir/html_$1/"
+ rmdir ${split_html_dir}
+}
+
+if test -z "$use_texi2html"; then
+ opt="--no-split --html -o $PACKAGE.html $htmlarg"
+ cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
+ echo "Generating monolithic html... ($cmd)"
+ rm -rf $PACKAGE.html # in case a directory is left over
+ eval "$cmd"
+ html_mono_size=`calcsize $PACKAGE.html`
+ gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
+ html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
+ mv $PACKAGE.html "$outdir/"
+
+ cmd="$SETLANG $MAKEINFO --html -o $PACKAGE.html $htmlarg \"$srcfile\""
+ echo "Generating html by node... ($cmd)"
+ eval "$cmd"
+ split_html_dir=$PACKAGE.html
+ (
+ cd ${split_html_dir} || exit 1
+ tar -czf "$abs_outdir/${PACKAGE}.html_node.tar.gz" -- *.html
+ )
+ html_node_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node.tar.gz"`
+ rm -f "$outdir"/html_node/*.html
+ mkdir -p "$outdir/html_node/"
+ mv ${split_html_dir}/*.html "$outdir/html_node/"
+ rmdir ${split_html_dir}
+else
+ cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $htmlarg \"$srcfile\""
+ echo "Generating monolithic html... ($cmd)"
+ rm -rf $PACKAGE.html # in case a directory is left over
+ eval "$cmd"
+ html_mono_size=`calcsize $PACKAGE.html`
+ gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
+ html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
+ mv $PACKAGE.html "$outdir/"
+
+ html_split node
+ html_split chapter
+ html_split section
+fi
+
+echo Making .tar.gz for sources...
+d=`dirname $srcfile`
+(
+ cd "$d"
+ srcfiles=`ls *.texinfo *.texi *.txi *.eps 2>/dev/null` || true
+ tar cvzfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles
+)
+texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
+
+if test -n "$docbook"; then
+ cmd="$SETLANG $MAKEINFO -o - --docbook \"$srcfile\" > ${srcdir}/$PACKAGE-db.xml"
+ echo "Generating docbook XML... ($cmd)"
+ eval "$cmd"
+ docbook_xml_size=`calcsize $PACKAGE-db.xml`
+ gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
+ docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"`
+ mv $PACKAGE-db.xml "$outdir/"
+
+ split_html_db_dir=html_node_db
+ cmd="${DOCBOOK2HTML} -o $split_html_db_dir \"${outdir}/$PACKAGE-db.xml\""
+ echo "Generating docbook HTML... ($cmd)"
+ eval "$cmd"
+ (
+ cd ${split_html_db_dir} || exit 1
+ tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
+ )
+ html_node_db_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node_db.tar.gz"`
+ rm -f "$outdir"/html_node_db/*.html
+ mkdir -p "$outdir/html_node_db"
+ mv ${split_html_db_dir}/*.html "$outdir/html_node_db/"
+ rmdir ${split_html_db_dir}
+
+ cmd="${DOCBOOK2TXT} \"${outdir}/$PACKAGE-db.xml\""
+ echo "Generating docbook ASCII... ($cmd)"
+ eval "$cmd"
+ docbook_ascii_size=`calcsize $PACKAGE-db.txt`
+ mv $PACKAGE-db.txt "$outdir/"
+
+ cmd="${DOCBOOK2PS} \"${outdir}/$PACKAGE-db.xml\""
+ echo "Generating docbook PS... ($cmd)"
+ eval "$cmd"
+ gzip -f -9 -c $PACKAGE-db.ps >"$outdir/$PACKAGE-db.ps.gz"
+ docbook_ps_gz_size=`calcsize "$outdir/$PACKAGE-db.ps.gz"`
+ mv $PACKAGE-db.ps "$outdir/"
+
+ cmd="${DOCBOOK2PDF} \"${outdir}/$PACKAGE-db.xml\""
+ echo "Generating docbook PDF... ($cmd)"
+ eval "$cmd"
+ docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
+ mv $PACKAGE-db.pdf "$outdir/"
+fi
+
+echo "Writing index file..."
+if test -z "$use_texi2html"; then
+ CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\
+ /%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d"
+else
+ CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d"
+fi
+curdate=`$SETLANG date '+%B %d, %Y'`
+sed \
+ -e "s!%%TITLE%%!$MANUAL_TITLE!g" \
+ -e "s!%%EMAIL%%!$EMAIL!g" \
+ -e "s!%%PACKAGE%%!$PACKAGE!g" \
+ -e "s!%%DATE%%!$curdate!g" \
+ -e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \
+ -e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \
+ -e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \
+ -e "s!%%HTML_SECTION_TGZ_SIZE%%!$html_section_tgz_size!g" \
+ -e "s!%%HTML_CHAPTER_TGZ_SIZE%%!$html_chapter_tgz_size!g" \
+ -e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \
+ -e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \
+ -e "s!%%PDF_SIZE%%!$pdf_size!g" \
+ -e "s!%%PS_GZ_SIZE%%!$ps_gz_size!g" \
+ -e "s!%%ASCII_SIZE%%!$ascii_size!g" \
+ -e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \
+ -e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \
+ -e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \
+ -e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \
+ -e "s!%%DOCBOOK_PS_GZ_SIZE%%!$docbook_ps_gz_size!g" \
+ -e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \
+ -e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \
+ -e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \
+ -e "s,%%SCRIPTURL%%,$scripturl,g" \
+ -e "s!%%SCRIPTNAME%%!$prog!g" \
+ -e "$CONDS" \
+$GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html"
+
+echo "Done, see $outdir/ subdirectory for new files."
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/config/gnulib-cache.m4 b/config/gnulib-cache.m4
new file mode 100644
index 0000000..55d0c8c
--- /dev/null
+++ b/config/gnulib-cache.m4
@@ -0,0 +1,51 @@
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this file. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License,
+# this file may be distributed as part of a program that
+# contains a configuration script generated by Autoconf, under
+# the same distribution terms as the rest of that program.
+#
+# Generated by gnulib-tool.
+#
+# This file represents the specification of how gnulib-tool is used.
+# It acts as a cache: It is written and read by gnulib-tool.
+# In projects that use version control, this file is meant to be put under
+# version control, like the configure.ac and various Makefile.am files.
+
+
+# Specification in the form of a command-line invocation:
+# gnulib-tool --import --dir=. --local-dir=tmp --lib=do_not_make_me --source-base=autoopts --m4-base=config --doc-base=doc --tests-base=tests --aux-dir=config --lgpl=2 --makefile-name=gnulib.mk --no-conditional-dependencies --libtool --macro-prefix=gl gendocs gettext-h parse-duration
+
+# Specification in the form of a few gnulib-tool.m4 macro invocations:
+gl_LOCAL_DIR([tmp])
+gl_MODULES([
+ gendocs
+ gettext-h
+ parse-duration
+])
+gl_AVOID([])
+gl_SOURCE_BASE([autoopts])
+gl_M4_BASE([config])
+gl_PO_BASE([])
+gl_DOC_BASE([doc])
+gl_TESTS_BASE([tests])
+gl_LIB([do_not_make_me])
+gl_LGPL([2])
+gl_MAKEFILE_NAME([gnulib.mk])
+gl_LIBTOOL
+gl_MACRO_PREFIX([gl])
+gl_PO_DOMAIN([])
+gl_WITNESS_C_DOMAIN([])
diff --git a/config/gnulib-comp.m4 b/config/gnulib-comp.m4
new file mode 100644
index 0000000..53243ab
--- /dev/null
+++ b/config/gnulib-comp.m4
@@ -0,0 +1,207 @@
+# DO NOT EDIT! GENERATED AUTOMATICALLY!
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this file. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License,
+# this file may be distributed as part of a program that
+# contains a configuration script generated by Autoconf, under
+# the same distribution terms as the rest of that program.
+#
+# Generated by gnulib-tool.
+#
+# This file represents the compiled summary of the specification in
+# gnulib-cache.m4. It lists the computed macro invocations that need
+# to be invoked from configure.ac.
+# In projects that use version control, this file can be treated like
+# other built files.
+
+
+# This macro should be invoked from ./configure.ac, in the section
+# "Checks for programs", right after AC_PROG_CC, and certainly before
+# any checks for libraries, header files, types and library functions.
+AC_DEFUN([gl_EARLY],
+[
+ m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace
+ m4_pattern_allow([^gl_ES$])dnl a valid locale name
+ m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
+ m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
+ AC_REQUIRE([gl_PROG_AR_RANLIB])
+ # Code from module gendocs:
+ # Code from module gettext-h:
+ # Code from module parse-duration:
+])
+
+# This macro should be invoked from ./configure.ac, in the section
+# "Check for header files, types and library functions".
+AC_DEFUN([gl_INIT],
+[
+ AM_CONDITIONAL([GL_COND_LIBTOOL], [true])
+ gl_cond_libtool=true
+ gl_m4_base='config'
+ m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
+ m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
+ m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
+ m4_pushdef([gl_LIBSOURCES_LIST], [])
+ m4_pushdef([gl_LIBSOURCES_DIR], [])
+ gl_COMMON
+ gl_source_base='autoopts'
+AC_SUBST([LIBINTL])
+AC_SUBST([LTLIBINTL])
+AC_REQUIRE([AC_C_INLINE])
+ # End of code from modules
+ m4_ifval(gl_LIBSOURCES_LIST, [
+ m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
+ for gl_file in ]gl_LIBSOURCES_LIST[ ; do
+ if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then
+ echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2
+ exit 1
+ fi
+ done])dnl
+ m4_if(m4_sysval, [0], [],
+ [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
+ ])
+ m4_popdef([gl_LIBSOURCES_DIR])
+ m4_popdef([gl_LIBSOURCES_LIST])
+ m4_popdef([AC_LIBSOURCES])
+ m4_popdef([AC_REPLACE_FUNCS])
+ m4_popdef([AC_LIBOBJ])
+ AC_CONFIG_COMMANDS_PRE([
+ gl_libobjs=
+ gl_ltlibobjs=
+ if test -n "$gl_LIBOBJS"; then
+ # Remove the extension.
+ sed_drop_objext='s/\.o$//;s/\.obj$//'
+ for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
+ gl_libobjs="$gl_libobjs $i.$ac_objext"
+ gl_ltlibobjs="$gl_ltlibobjs $i.lo"
+ done
+ fi
+ AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
+ AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
+ ])
+ gltests_libdeps=
+ gltests_ltlibdeps=
+ m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ]))
+ m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS]))
+ m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES]))
+ m4_pushdef([gltests_LIBSOURCES_LIST], [])
+ m4_pushdef([gltests_LIBSOURCES_DIR], [])
+ gl_COMMON
+ gl_source_base='tests'
+changequote(,)dnl
+ gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS
+changequote([, ])dnl
+ AC_SUBST([gltests_WITNESS])
+ gl_module_indicator_condition=$gltests_WITNESS
+ m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition])
+ m4_popdef([gl_MODULE_INDICATOR_CONDITION])
+ m4_ifval(gltests_LIBSOURCES_LIST, [
+ m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
+ for gl_file in ]gltests_LIBSOURCES_LIST[ ; do
+ if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then
+ echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2
+ exit 1
+ fi
+ done])dnl
+ m4_if(m4_sysval, [0], [],
+ [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
+ ])
+ m4_popdef([gltests_LIBSOURCES_DIR])
+ m4_popdef([gltests_LIBSOURCES_LIST])
+ m4_popdef([AC_LIBSOURCES])
+ m4_popdef([AC_REPLACE_FUNCS])
+ m4_popdef([AC_LIBOBJ])
+ AC_CONFIG_COMMANDS_PRE([
+ gltests_libobjs=
+ gltests_ltlibobjs=
+ if test -n "$gltests_LIBOBJS"; then
+ # Remove the extension.
+ sed_drop_objext='s/\.o$//;s/\.obj$//'
+ for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
+ gltests_libobjs="$gltests_libobjs $i.$ac_objext"
+ gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
+ done
+ fi
+ AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
+ AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
+ ])
+])
+
+# Like AC_LIBOBJ, except that the module name goes
+# into gl_LIBOBJS instead of into LIBOBJS.
+AC_DEFUN([gl_LIBOBJ], [
+ AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl
+ gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"
+])
+
+# Like AC_REPLACE_FUNCS, except that the module name goes
+# into gl_LIBOBJS instead of into LIBOBJS.
+AC_DEFUN([gl_REPLACE_FUNCS], [
+ m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
+ AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])
+])
+
+# Like AC_LIBSOURCES, except the directory where the source file is
+# expected is derived from the gnulib-tool parameterization,
+# and alloca is special cased (for the alloca-opt module).
+# We could also entirely rely on EXTRA_lib..._SOURCES.
+AC_DEFUN([gl_LIBSOURCES], [
+ m4_foreach([_gl_NAME], [$1], [
+ m4_if(_gl_NAME, [alloca.c], [], [
+ m4_define([gl_LIBSOURCES_DIR], [autoopts])
+ m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ])
+ ])
+ ])
+])
+
+# Like AC_LIBOBJ, except that the module name goes
+# into gltests_LIBOBJS instead of into LIBOBJS.
+AC_DEFUN([gltests_LIBOBJ], [
+ AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl
+ gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext"
+])
+
+# Like AC_REPLACE_FUNCS, except that the module name goes
+# into gltests_LIBOBJS instead of into LIBOBJS.
+AC_DEFUN([gltests_REPLACE_FUNCS], [
+ m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
+ AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)])
+])
+
+# Like AC_LIBSOURCES, except the directory where the source file is
+# expected is derived from the gnulib-tool parameterization,
+# and alloca is special cased (for the alloca-opt module).
+# We could also entirely rely on EXTRA_lib..._SOURCES.
+AC_DEFUN([gltests_LIBSOURCES], [
+ m4_foreach([_gl_NAME], [$1], [
+ m4_if(_gl_NAME, [alloca.c], [], [
+ m4_define([gltests_LIBSOURCES_DIR], [tests])
+ m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ])
+ ])
+ ])
+])
+
+# This macro records the list of files which have been installed by
+# gnulib-tool and may be removed by future gnulib-tool invocations.
+AC_DEFUN([gl_FILE_LIST], [
+ build-aux/gendocs.sh
+ doc/gendocs_template
+ lib/gettext.h
+ lib/parse-duration.c
+ lib/parse-duration.h
+ m4/00gnulib.m4
+ m4/gnulib-common.m4
+ m4/onceonly.m4
+])
diff --git a/config/install-sh b/config/install-sh
new file mode 100755
index 0000000..377bb86
--- /dev/null
+++ b/config/install-sh
@@ -0,0 +1,527 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2011-11-20.07; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# 'make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" "" $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t) dst_arg=$2
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call 'install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ do_exit='(exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+ trap "ret=130; $do_exit" 2
+ trap "ret=141; $do_exit" 13
+ trap "ret=143; $do_exit" 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names problematic for 'test' and other utilities.
+ case $src in
+ -* | [=\(\)!]) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+ dst=$dst_arg
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ [-=\(\)!]*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test X"$d" = X && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/config/libopts.m4 b/config/libopts.m4
new file mode 100644
index 0000000..e954aea
--- /dev/null
+++ b/config/libopts.m4
@@ -0,0 +1,442 @@
+dnl -*- buffer-read-only: t -*- vi: set ro:
+dnl
+dnl DO NOT EDIT THIS FILE (libopts.m4)
+dnl
+dnl It has been AutoGen-ed August 11, 2012 at 09:41:10 AM by AutoGen 5.16.2pre7
+dnl From the definitions libopts.def
+dnl and the template file conftest.tpl
+dnl
+dnl do always before generated macros:
+dnl
+AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[
+ AC_REQUIRE([AC_HEADER_STDC])
+ AC_HEADER_DIRENT
+
+ # =================
+ # AC_CHECK_HEADERS
+ # =================
+ AC_CHECK_HEADERS([ \
+ sys/mman.h sys/param.h sys/poll.h sys/procset.h \
+ sys/select.h sys/socket.h sys/stropts.h sys/time.h \
+ sys/un.h sys/wait.h dlfcn.h errno.h \
+ fcntl.h libgen.h memory.h netinet/in.h \
+ setjmp.h stdbool.h sysexits.h unistd.h \
+ utime.h])
+
+ AC_CHECK_HEADERS([stdarg.h varargs.h],
+ [lo_have_arg_hdr=true;break],
+ [lo_have_arg_hdr=false])
+
+ AC_CHECK_HEADERS([string.h strings.h],
+ [lo_have_str_hdr=true;break],
+ [lo_have_str_hdr=false])
+
+ AC_CHECK_HEADERS([limits.h sys/limits.h values.h],
+ [lo_have_lim_hdr=true;break],
+ [lo_have_lim_hdr=false])
+
+ AC_CHECK_HEADERS([inttypes.h stdint.h],
+ [lo_have_typ_hdr=true;break],
+ [lo_have_typ_hdr=false])
+
+ # ----------------------------------------------------------------------
+ # check for various programs used during the build.
+ # On OS/X, "wchar.h" needs "runetype.h" to work properly.
+ # ----------------------------------------------------------------------
+ AC_CHECK_HEADERS([runetype.h wchar.h], [], [],[
+ AC_INCLUDES_DEFAULT
+ #if HAVE_RUNETYPE_H
+ # include <runetype.h>
+ #endif
+ ])
+
+ # --------------------------------------------
+ # Verify certain entries from AC_CHECK_HEADERS
+ # --------------------------------------------
+ [for f in sys_types sys_mman sys_param sys_stat sys_wait \
+ string errno stdlib memory setjmp
+ do eval as_ac_var=\${ac_cv_header_${f}_h+set}
+ test "${as_ac_var}" = set || {
+ ]AC_MSG_ERROR([you must have ${f}.h on your system])[
+ }
+ done
+
+ ${lo_have_arg_hdr} || \
+ ]AC_MSG_ERROR([you must have stdarg.h or varargs.h on your system])[
+
+ ${lo_have_str_hdr} || \
+ ]AC_MSG_ERROR([you must have string.h or strings.h on your system])[
+
+ ${lo_have_lim_hdr} || \
+ ]AC_MSG_ERROR(
+ [you must have one of limits.h, sys/limits.h or values.h])[
+
+ ${lo_have_typ_hdr} || \
+ ]AC_MSG_ERROR([you must have inttypes.h or stdint.h on your system])
+
+ # ----------------------------------------------------------------------
+ # Checks for typedefs
+ # ----------------------------------------------------------------------
+ AC_CHECK_TYPES(wchar_t)
+ AC_CHECK_TYPES(wint_t, [], [], [
+ AC_INCLUDES_DEFAULT
+ #if HAVE_RUNETYPE_H
+ # include <runetype.h>
+ #endif
+ #if HAVE_WCHAR_H
+ # include <wchar.h>
+ #endif
+ ])
+ AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
+ intptr_t, uintptr_t, uint_t, pid_t, size_t])
+ AC_CHECK_SIZEOF(char*, 8)
+ AC_CHECK_SIZEOF(int, 4)
+ AC_CHECK_SIZEOF(long, 8)
+ AC_CHECK_SIZEOF(short, 2)
+
+ # ----------------------------------------------------------------------
+ # AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind.
+ # ----------------------------------------------------------------------
+ AC_CHECK_LIB(gen, pathfind)
+ AC_FUNC_VPRINTF
+ AC_FUNC_FORK
+ AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr \
+ strrchr strsignal fchmod fstat chmod])
+ AC_PROG_SED
+ [while :
+ do
+ POSIX_SHELL=`which bash`
+ test -x "$POSIX_SHELL" && break
+ POSIX_SHELL=`which dash`
+ test -x "$POSIX_SHELL" && break
+ POSIX_SHELL=/usr/xpg4/bin/sh
+ test -x "$POSIX_SHELL" && break
+ POSIX_SHELL=`/bin/sh -c '
+ exec 2>/dev/null
+ if ! true ; then exit 1 ; fi
+ echo /bin/sh'`
+ test -x "$POSIX_SHELL" && break
+ ]AC_MSG_ERROR([cannot locate a working POSIX shell])[
+ done]
+ AC_DEFINE_UNQUOTED([POSIX_SHELL], ["${POSIX_SHELL}"],
+ [define to a working POSIX compliant shell])
+ AC_SUBST([POSIX_SHELL])
+])
+
+dnl
+dnl @synopsis INVOKE_LIBOPTS_MACROS
+dnl
+dnl This macro will invoke the AutoConf macros specified in libopts.def
+dnl that have not been disabled with "omit-invocation".
+dnl
+AC_DEFUN([LIBOPTS_WITH_REGEX_HEADER],[
+ AC_ARG_WITH([regex-header],
+ AS_HELP_STRING([--with-regex-header], [a reg expr header is specified]),
+ [libopts_cv_with_regex_header=${with_regex_header}],
+ AC_CACHE_CHECK([whether a reg expr header is specified], libopts_cv_with_regex_header,
+ libopts_cv_with_regex_header=no)
+ ) # end of AC_ARG_WITH
+ if test "X${libopts_cv_with_regex_header}" != Xno
+ then
+ AC_DEFINE_UNQUOTED([REGEX_HEADER],[<${libopts_cv_with_regex_header}>])
+ else
+ AC_DEFINE([REGEX_HEADER],[<regex.h>],[name of regex header file])
+ fi
+
+]) # end of AC_DEFUN of LIBOPTS_WITH_REGEX_HEADER
+
+
+AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[
+ AC_ARG_WITH([libregex],
+ AS_HELP_STRING([--with-libregex], [libregex installation prefix]),
+ [libopts_cv_with_libregex_root=${with_libregex}],
+ AC_CACHE_CHECK([whether with-libregex was specified], libopts_cv_with_libregex_root,
+ libopts_cv_with_libregex_root=no)
+ ) # end of AC_ARG_WITH libregex
+
+ if test "${with_libregex+set}" = set && \
+ test "X${withval}" = Xno
+ then ## disabled by request
+ libopts_cv_with_libregex_root=no
+ libopts_cv_with_libregex_cflags=no
+ libopts_cv_with_libregex_libs=no
+ else
+
+ AC_ARG_WITH([libregex-cflags],
+ AS_HELP_STRING([--with-libregex-cflags], [libregex compile flags]),
+ [libopts_cv_with_libregex_cflags=${with_libregex_cflags}],
+ AC_CACHE_CHECK([whether with-libregex-cflags was specified], libopts_cv_with_libregex_cflags,
+ libopts_cv_with_libregex_cflags=no)
+ ) # end of AC_ARG_WITH libregex-cflags
+
+ AC_ARG_WITH([libregex-libs],
+ AS_HELP_STRING([--with-libregex-libs], [libregex link command arguments]),
+ [libopts_cv_with_libregex_libs=${with_libregex_libs}],
+ AC_CACHE_CHECK([whether with-libregex-libs was specified], libopts_cv_with_libregex_libs,
+ libopts_cv_with_libregex_libs=no)
+ ) # end of AC_ARG_WITH libregex-libs
+
+ case "X${libopts_cv_with_libregex_cflags}" in
+ Xyes|Xno|X )
+ case "X${libopts_cv_with_libregex_root}" in
+ Xyes|Xno|X ) libopts_cv_with_libregex_cflags=no ;;
+ * ) libopts_cv_with_libregex_cflags=-I${libopts_cv_with_libregex_root}/include ;;
+ esac
+ esac
+ case "X${libopts_cv_with_libregex_libs}" in
+ Xyes|Xno|X )
+ case "X${libopts_cv_with_libregex_root}" in
+ Xyes|Xno|X ) libopts_cv_with_libregex_libs=no ;;
+ * ) libopts_cv_with_libregex_libs="-L${libopts_cv_with_libregex_root}/lib -lregex";;
+ esac
+ esac
+ libopts_save_CPPFLAGS="${CPPFLAGS}"
+ libopts_save_LIBS="${LIBS}"
+ fi ## disabled by request
+
+ case "X${libopts_cv_with_libregex_cflags}" in
+ Xyes|Xno|X )
+ libopts_cv_with_libregex_cflags="" ;;
+ * ) CPPFLAGS="${CPPFLAGS} ${libopts_cv_with_libregex_cflags}" ;;
+ esac
+ case "X${libopts_cv_with_libregex_libs}" in
+ Xyes|Xno|X )
+ libopts_cv_with_libregex_libs="" ;;
+ * )
+ LIBS="${LIBS} ${libopts_cv_with_libregex_libs}" ;;
+ esac
+ LIBREGEX_CFLAGS=""
+ LIBREGEX_LIBS=""
+ AC_MSG_CHECKING([whether libregex functions properly])
+ AC_CACHE_VAL([libopts_cv_with_libregex],[
+ AC_RUN_IFELSE([@%:@include <stdio.h>
+@%:@include <stdlib.h>
+@%:@include <sys/types.h>
+@%:@include REGEX_HEADER
+static regex_t re;
+void comp_re( char const* pzPat ) {
+ int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE );
+ if (res == 0) return;
+ exit( res ); }
+int main() {
+ regmatch_t m@<:@2@:>@;
+ comp_re( "^.*\@S|@" );
+ comp_re( "()|no.*" );
+ comp_re( "." );
+ if (regexec( &re, "X", 2, m, 0 ) != 0) return 1;
+ if ((m@<:@0@:>@.rm_so != 0) || (m@<:@0@:>@.rm_eo != 1)) {
+ fputs( "error: regex -->.<-- did not match\n", stderr );
+ return 1;
+ }
+ return 0; }],
+ [libopts_cv_with_libregex=yes], [libopts_cv_with_libregex=no],
+ [libopts_cv_with_libregex=no]) # end of AC_RUN_IFELSE
+ ]) # end of AC_CACHE_VAL for libopts_cv_with_libregex
+ AC_MSG_RESULT([${libopts_cv_with_libregex}])
+ if test "X${libopts_cv_with_libregex}" != Xno
+ then
+ AC_DEFINE([WITH_LIBREGEX],[1],
+ [Define this if a working libregex can be found])
+ else
+ CPPFLAGS="${libopts_save_CPPFLAGS}"
+ LIBS="${libopts_save_LIBS}"
+ fi
+
+]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX
+
+
+AC_DEFUN([LIBOPTS_RUN_PATHFIND],[
+ AC_MSG_CHECKING([whether pathfind(3) works])
+ AC_CACHE_VAL([libopts_cv_run_pathfind],[
+ AC_RUN_IFELSE([@%:@include <string.h>
+@%:@include <stdlib.h>
+int main (int argc, char** argv) {
+ char* pz = pathfind( getenv( "PATH" ), "sh", "x" );
+ return (pz == 0) ? 1 : 0;
+}],
+ [libopts_cv_run_pathfind=yes],[libopts_cv_run_pathfind=no],[libopts_cv_run_pathfind=no]
+ ) # end of RUN_IFELSE
+ ]) # end of AC_CACHE_VAL for libopts_cv_run_pathfind
+ AC_MSG_RESULT([${libopts_cv_run_pathfind}])
+ if test "X${libopts_cv_run_pathfind}" != Xno
+ then
+ AC_DEFINE([HAVE_PATHFIND],[1],
+ [Define this if pathfind(3) works])
+ fi
+
+]) # end of AC_DEFUN of LIBOPTS_RUN_PATHFIND
+
+
+AC_DEFUN([LIBOPTS_TEST_DEV_ZERO],[
+ AC_MSG_CHECKING([whether /dev/zero is readable device])
+ AC_CACHE_VAL([libopts_cv_test_dev_zero],[
+ libopts_cv_test_dev_zero=`exec 2> /dev/null
+dzero=\`ls -lL /dev/zero | egrep ^c......r\`
+test -z "${dzero}" && exit 1
+echo ${dzero}`
+ if test $? -ne 0 || test -z "$libopts_cv_test_dev_zero"
+ then libopts_cv_test_dev_zero=no
+ fi
+ ]) # end of CACHE_VAL of libopts_cv_test_dev_zero
+ AC_MSG_RESULT([${libopts_cv_test_dev_zero}])
+ if test "X${libopts_cv_test_dev_zero}" != Xno
+ then
+ AC_DEFINE([HAVE_DEV_ZERO],[1],
+ [Define this if /dev/zero is readable device])
+ fi
+
+]) # end of AC_DEFUN of LIBOPTS_TEST_DEV_ZERO
+
+
+AC_DEFUN([LIBOPTS_RUN_REALPATH],[
+ AC_MSG_CHECKING([whether we have a functional realpath(3C)])
+ AC_CACHE_VAL([libopts_cv_run_realpath],[
+ AC_RUN_IFELSE([@%:@include <limits.h>
+@%:@include <stdlib.h>
+int main (int argc, char** argv) {
+@%:@ifndef PATH_MAX
+choke me!!
+@%:@else
+ char zPath@<:@PATH_MAX+1@:>@;
+@%:@endif
+ char *pz = realpath(argv@<:@0@:>@, zPath);
+ return (pz == zPath) ? 0 : 1;
+}],
+ [libopts_cv_run_realpath=yes],[libopts_cv_run_realpath=no],[libopts_cv_run_realpath=no]
+ ) # end of RUN_IFELSE
+ ]) # end of AC_CACHE_VAL for libopts_cv_run_realpath
+ AC_MSG_RESULT([${libopts_cv_run_realpath}])
+ if test "X${libopts_cv_run_realpath}" != Xno
+ then
+ AC_DEFINE([HAVE_REALPATH],[1],
+ [Define this if we have a functional realpath(3C)])
+ fi
+
+]) # end of AC_DEFUN of LIBOPTS_RUN_REALPATH
+
+
+AC_DEFUN([LIBOPTS_RUN_STRFTIME],[
+ AC_MSG_CHECKING([whether strftime() works])
+ AC_CACHE_VAL([libopts_cv_run_strftime],[
+ AC_RUN_IFELSE([@%:@include <time.h>
+@%:@include <string.h>
+char t_buf@<:@ 64 @:>@;
+int main() {
+ static char const z@<:@@:>@ = "Thursday Aug 28 240";
+ struct tm tm;
+ tm.tm_sec = 36; /* seconds after the minute @<:@0, 61@:>@ */
+ tm.tm_min = 44; /* minutes after the hour @<:@0, 59@:>@ */
+ tm.tm_hour = 12; /* hour since midnight @<:@0, 23@:>@ */
+ tm.tm_mday = 28; /* day of the month @<:@1, 31@:>@ */
+ tm.tm_mon = 7; /* months since January @<:@0, 11@:>@ */
+ tm.tm_year = 86; /* years since 1900 */
+ tm.tm_wday = 4; /* days since Sunday @<:@0, 6@:>@ */
+ tm.tm_yday = 239; /* days since January 1 @<:@0, 365@:>@ */
+ tm.tm_isdst = 1; /* flag for daylight savings time */
+ strftime( t_buf, sizeof( t_buf ), "%A %b %d %j", &tm );
+ return (strcmp( t_buf, z ) != 0); }],
+ [libopts_cv_run_strftime=yes],[libopts_cv_run_strftime=no],[libopts_cv_run_strftime=no]
+ ) # end of RUN_IFELSE
+ ]) # end of AC_CACHE_VAL for libopts_cv_run_strftime
+ AC_MSG_RESULT([${libopts_cv_run_strftime}])
+ if test "X${libopts_cv_run_strftime}" != Xno
+ then
+ AC_DEFINE([HAVE_STRFTIME],[1],
+ [Define this if strftime() works])
+ fi
+
+]) # end of AC_DEFUN of LIBOPTS_RUN_STRFTIME
+
+
+AC_DEFUN([LIBOPTS_RUN_FOPEN_BINARY],[
+ AC_MSG_CHECKING([whether fopen accepts "b" mode])
+ AC_CACHE_VAL([libopts_cv_run_fopen_binary],[
+ AC_RUN_IFELSE([@%:@include <stdio.h>
+int main (int argc, char** argv) {
+FILE* fp = fopen("conftest.@S|@ac_ext", "rb");
+return (fp == NULL) ? 1 : fclose(fp); }],
+ [libopts_cv_run_fopen_binary=yes],[libopts_cv_run_fopen_binary=no],[libopts_cv_run_fopen_binary=no]
+ ) # end of RUN_IFELSE
+ ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary
+ AC_MSG_RESULT([${libopts_cv_run_fopen_binary}])
+ if test "X${libopts_cv_run_fopen_binary}" != Xno
+ then
+ AC_DEFINE([FOPEN_BINARY_FLAG],"b",
+ [fopen(3) accepts a 'b' in the mode flag])
+ else
+ AC_DEFINE([FOPEN_BINARY_FLAG],"",
+ [fopen(3) accepts a 'b' in the mode flag])
+ fi
+
+]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_BINARY
+
+
+AC_DEFUN([LIBOPTS_RUN_FOPEN_TEXT],[
+ AC_MSG_CHECKING([whether fopen accepts "t" mode])
+ AC_CACHE_VAL([libopts_cv_run_fopen_text],[
+ AC_RUN_IFELSE([@%:@include <stdio.h>
+int main (int argc, char** argv) {
+FILE* fp = fopen("conftest.@S|@ac_ext", "rt");
+return (fp == NULL) ? 1 : fclose(fp); }],
+ [libopts_cv_run_fopen_text=yes],[libopts_cv_run_fopen_text=no],[libopts_cv_run_fopen_text=no]
+ ) # end of RUN_IFELSE
+ ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_text
+ AC_MSG_RESULT([${libopts_cv_run_fopen_text}])
+ if test "X${libopts_cv_run_fopen_text}" != Xno
+ then
+ AC_DEFINE([FOPEN_TEXT_FLAG],"t",
+ [fopen(3) accepts a 't' in the mode flag])
+ else
+ AC_DEFINE([FOPEN_TEXT_FLAG],"",
+ [fopen(3) accepts a 't' in the mode flag])
+ fi
+
+]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_TEXT
+
+
+AC_DEFUN([LIBOPTS_DISABLE_OPTIONAL_ARGS],[
+ AC_ARG_ENABLE([optional-args],
+ AS_HELP_STRING([--disable-optional-args], [not wanting optional option args]),
+ [libopts_cv_enable_optional_args=${enable_optional_args}],
+ AC_CACHE_CHECK([whether not wanting optional option args], libopts_cv_enable_optional_args,
+ libopts_cv_enable_optional_args=yes)
+ ) # end of AC_ARG_ENABLE
+ if test "X${libopts_cv_enable_optional_args}" = Xno
+ then
+ AC_DEFINE([NO_OPTIONAL_OPT_ARGS], [1],
+ [Define this if optional arguments are disallowed])
+ fi
+
+]) # end of AC_DEFUN of LIBOPTS_DISABLE_OPTIONAL_ARGS
+
+
+AC_DEFUN([INVOKE_LIBOPTS_MACROS],[
+ AC_REQUIRE([INVOKE_LIBOPTS_MACROS_FIRST])
+ # Check to see if a reg expr header is specified.
+ LIBOPTS_WITH_REGEX_HEADER
+
+ # Check to see if a working libregex can be found.
+ LIBOPTS_WITHLIB_REGEX
+
+ # Check to see if pathfind(3) works.
+ LIBOPTS_RUN_PATHFIND
+
+ # Check to see if /dev/zero is readable device.
+ LIBOPTS_TEST_DEV_ZERO
+
+ # Check to see if we have a functional realpath(3C).
+ LIBOPTS_RUN_REALPATH
+
+ # Check to see if strftime() works.
+ LIBOPTS_RUN_STRFTIME
+
+ # Check to see if fopen accepts "b" mode.
+ LIBOPTS_RUN_FOPEN_BINARY
+
+ # Check to see if fopen accepts "t" mode.
+ LIBOPTS_RUN_FOPEN_TEXT
+
+ # Check to see if not wanting optional option args.
+ LIBOPTS_DISABLE_OPTIONAL_ARGS
+
+]) # end AC_DEFUN of INVOKE_LIBOPTS_MACROS
diff --git a/config/liboptschk.m4 b/config/liboptschk.m4
new file mode 100644
index 0000000..4a45bde
--- /dev/null
+++ b/config/liboptschk.m4
@@ -0,0 +1,29 @@
+# liboptschk.m4 serial 2 (autogen - 5.11.4)
+dnl Copyright (c) 2005-2012 by Bruce Korb - all rights reserved
+dnl
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl Time-stamp: "2010-12-07 12:57:56 bkorb"
+dnl
+AC_DEFUN([ag_FIND_LIBOPTS],
+ [if test "X${ac_cv_header_autoopts_options_h}" = Xno
+ then :
+ else
+ f=`autoopts-config cflags` 2>/dev/null
+ if test X"${f}" = X
+ then
+ :
+ else
+ AC_DEFINE([HAVE_LIBOPTS],[1],[define if we can find libopts])
+ CFLAGS="${CFLAGS} ${f}"
+ ao_CFLAGS="${f}"
+ AC_SUBST(ao_CFLAGS)
+
+ f=`autoopts-config ldflags` 2>/dev/null
+ LIBS="${LIBS} ${f}"
+ ao_LIBS="${f}"
+ AC_SUBST(ao_LIBS)
+ fi
+ fi])
diff --git a/config/libtool.m4 b/config/libtool.m4
new file mode 100644
index 0000000..44e0ecf
--- /dev/null
+++ b/config/libtool.m4
@@ -0,0 +1,7982 @@
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 57 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+ [m4_default([$3],
+ [m4_fatal([Libtool version $1 or higher is required],
+ 63)])],
+ [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+ *\ * | *\ *)
+ AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+ case $cc_temp in
+ compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+ distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
+dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ _LT_PATH_MAGIC
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+ [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME. Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+ [m4_ifval([$1], [$1], [$2])])
+ lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+ m4_ifval([$4],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+ lt_dict_add_subkey([lt_decl_dict], [$2],
+ [tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+ [0], [m4_fatal([$0: too few arguments: $#])],
+ [1], [m4_fatal([$0: too few arguments: $#: $1])],
+ [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+ [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+ [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+ m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_if([$2], [],
+ m4_quote(lt_decl_varnames),
+ m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+ lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'. VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly. In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+# <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+ [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+# # Some comment about what VAR is for.
+# visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+ [description])))[]dnl
+m4_pushdef([_libtool_name],
+ m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+ [0], [_libtool_name=[$]$1],
+ [1], [_libtool_name=$lt_[]$1],
+ [2], [_libtool_name=$lt_[]$1],
+ [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script. Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+ m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'. Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+ dnl If the libtool generation code has been placed in $CONFIG_LT,
+ dnl instead of duplicating it all over again into config.status,
+ dnl then we will have config.status run $CONFIG_LT later, so it
+ dnl needs to know what name is stored there:
+ [AC_CONFIG_COMMANDS([libtool],
+ [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+ dnl If the libtool generation code is destined for config.status,
+ dnl expand the accumulated commands and init code now:
+ [AC_CONFIG_COMMANDS([libtool],
+ [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable. If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins. After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script. The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+ echo
+ AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+
+Report bugs to <bug-libtool@gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2011 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+ case $[1] in
+ --version | --v* | -V )
+ echo "$lt_cl_version"; exit 0 ;;
+ --help | --h* | -h )
+ echo "$lt_cl_help"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --quiet | --q* | --silent | --s* | -q )
+ lt_cl_silent=: ;;
+
+ -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+ *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+ esac
+ shift
+done
+
+if $lt_cl_silent; then
+ exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure. Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+ lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars. Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+ m4_if(_LT_TAG, [C], [
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+ _LT_PROG_LTMAIN
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ _LT_PROG_REPLACE_SHELLFNS
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+# autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+ [C], [_LT_LANG(C)],
+ [C++], [_LT_LANG(CXX)],
+ [Go], [_LT_LANG(GO)],
+ [Java], [_LT_LANG(GCJ)],
+ [Fortran 77], [_LT_LANG(F77)],
+ [Fortran], [_LT_LANG(FC)],
+ [Windows Resource], [_LT_LANG(RC)],
+ [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+ [_LT_LANG($1)],
+ [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+ [LT_SUPPORTED_TAG([$1])dnl
+ m4_append([_LT_TAGS], [$1 ])dnl
+ m4_define([_LT_LANG_]$1[_enabled], [])dnl
+ _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+m4_ifndef([AC_PROG_GO], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_GO. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+############################################################
+m4_defun([AC_PROG_GO],
+[AC_LANG_PUSH(Go)dnl
+AC_ARG_VAR([GOC], [Go compiler command])dnl
+AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
+_AC_ARG_VAR_LDFLAGS()dnl
+AC_CHECK_TOOL(GOC, gccgo)
+if test -z "$GOC"; then
+ if test -n "$ac_tool_prefix"; then
+ AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
+ fi
+fi
+if test -z "$GOC"; then
+ AC_CHECK_PROG(GOC, gccgo, gccgo, false)
+fi
+])#m4_defun
+])#m4_ifndef
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [LT_LANG(CXX)],
+ [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+ [LT_LANG(F77)],
+ [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+ [LT_LANG(FC)],
+ [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [m4_ifdef([AC_PROG_GCJ],
+ [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([A][M_PROG_GCJ],
+ [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([LT_PROG_GCJ],
+ [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([AC_PROG_GO],
+ [LT_LANG(GO)],
+ [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+ [LT_LANG(RC)],
+ [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+ case $host_os in
+ rhapsody* | darwin*)
+ AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+ AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+ AC_CHECK_TOOL([LIPO], [lipo], [:])
+ AC_CHECK_TOOL([OTOOL], [otool], [:])
+ AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+ _LT_DECL([], [DSYMUTIL], [1],
+ [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+ _LT_DECL([], [NMEDIT], [1],
+ [Tool to change global to local symbols on Mac OS X])
+ _LT_DECL([], [LIPO], [1],
+ [Tool to manipulate fat objects and archives on Mac OS X])
+ _LT_DECL([], [OTOOL], [1],
+ [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+ _LT_DECL([], [OTOOL64], [1],
+ [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+ AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+ [lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ # If there is a non-empty error log, and "single_module"
+ # appears in it, assume the flag caused a linker warning
+ if test -s conftest.err && $GREP single_module conftest.err; then
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ # Otherwise, if the output was created with a 0 exit code from
+ # the compiler, it worked.
+ elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi])
+
+ AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+ [lt_cv_ld_exported_symbols_list],
+ [lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [lt_cv_ld_exported_symbols_list=yes],
+ [lt_cv_ld_exported_symbols_list=no])
+ LDFLAGS="$save_LDFLAGS"
+ ])
+
+ AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+ [lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+ echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+ $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+ echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+ $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -s conftest.err && $GREP force_load conftest.err; then
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+ ])
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[[012]]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES([TAG])
+# ---------------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+ m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+ m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
+ [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes])
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ m4_if([$1], [CXX],
+[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+ fi
+],[])
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+ lt_aix_libpath_sed='[
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }]'
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi],[])
+ if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+ _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+ fi
+ ])
+ aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO "$*"
+}
+
+case "$ECHO" in
+ printf*) AC_MSG_RESULT([printf]) ;;
+ print*) AC_MSG_RESULT([print -r]) ;;
+ *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test "X`printf %s $ECHO`" = "X$ECHO" \
+ || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[ --with-sysroot[=DIR] Search for dependent libraries within DIR
+ (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted. We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+ if test "$GCC" = yes; then
+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+ fi
+ ;; #(
+ /*)
+ lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+ ;; #(
+ no|'')
+ ;; #(
+ *)
+ AC_MSG_RESULT([${with_sysroot}])
+ AC_MSG_ERROR([The sysroot must be an absolute path.])
+ ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+ [AS_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_LANG_PUSH(C)
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_LANG_POP])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*)
+ case $host in
+ i?86-*-solaris*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ sparc*-*-solaris*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
+ if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+ LD="${LD-ld}_sol2"
+ fi
+ ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+ [lt_cv_ar_at_file=no
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+ [echo conftest.$ac_objext > conftest.lst
+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+ AC_TRY_EVAL([lt_ar_try])
+ if test "$ac_status" -eq 0; then
+ # Ensure the archiver fails upon bogus file names.
+ rm -f conftest.$ac_objext libconftest.a
+ AC_TRY_EVAL([lt_ar_try])
+ if test "$ac_status" -ne 0; then
+ lt_cv_ar_at_file=@
+ fi
+ fi
+ rm -f conftest.* libconftest.a
+ ])
+ ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+ archiver_list_spec=
+else
+ archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+ [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+ [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+ [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+ [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$3"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ fi
+ $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$5], , :, [$5])
+else
+ m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $3"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&AS_MESSAGE_LOG_FD
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ else
+ $2=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$4], , :, [$4])
+else
+ m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | cegcc*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ os2*)
+ # The test takes a long time on OS/2.
+ lt_cv_sys_max_cmd_len=8192
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+ AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+ AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+ [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+ [$4]
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}]
+_LT_EOF
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) $1 ;;
+ x$lt_dlneed_uscore) $2 ;;
+ x$lt_dlunknown|x*) $3 ;;
+ esac
+ else :
+ # compilation failed
+ $3
+ fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ])
+ ;;
+
+ *)
+ AC_CHECK_FUNC([shl_load],
+ [lt_cv_dlopen="shl_load"],
+ [AC_CHECK_LIB([dld], [shl_load],
+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+ [AC_CHECK_FUNC([dlopen],
+ [lt_cv_dlopen="dlopen"],
+ [AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+ [AC_CHECK_LIB([svld], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+ [AC_CHECK_LIB([dld], [dld_link],
+ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+ ])
+ ])
+ ])
+ ])
+ ])
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ AC_CACHE_CHECK([whether a program can dlopen itself],
+ lt_cv_dlopen_self, [dnl
+ _LT_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+ lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+ ])
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+ lt_cv_dlopen_self_static, [dnl
+ _LT_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+ lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
+ ])
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+ [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+ [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+ [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+ fi
+ fi
+ chmod u+w . 2>&AS_MESSAGE_LOG_FD
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+ [Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ AC_MSG_CHECKING([if we can lock with hard links])
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ AC_MSG_RESULT([$hard_links])
+ if test "$hard_links" = no; then
+ AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+ [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+ [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+ test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+ test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+ test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+ # Linking always hardcodes the temporary library directory.
+ _LT_TAGVAR(hardcode_action, $1)=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ _LT_TAGVAR(hardcode_action, $1)=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+ test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+ [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+ [], [
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+ if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[[4-9]]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[[01]] | aix4.[[01]].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[[45]]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$cc_basename in
+ yes,*)
+ # gcc
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ ;;
+
+ *,cl*)
+ # Native MSVC
+ libname_spec='$name'
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='${libname}.dll.lib'
+
+ case $build_os in
+ mingw*)
+ sys_lib_search_path_spec=
+ lt_save_ifs=$IFS
+ IFS=';'
+ for lt_path in $LIB
+ do
+ IFS=$lt_save_ifs
+ # Let DOS variable expansion print the short 8.3 style file name.
+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+ done
+ IFS=$lt_save_ifs
+ # Convert to MSYS style.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+ ;;
+ cygwin*)
+ # Convert to unix form, then to dos form, then back to unix form
+ # but this time dos style (no spaces!) so that the unix form looks
+ # like /cygdrive/c/PROGRA~1:/cygdr...
+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ *)
+ sys_lib_search_path_spec="$LIB"
+ if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+ # It is most probably a Windows format PATH.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # FIXME: find the short name or the path components, as spaces are
+ # common. (e.g. "Program Files" -> "PROGRA~1")
+ ;;
+ esac
+
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+ dynamic_linker='Win32 link.exe'
+ ;;
+
+ *)
+ # Assume MSVC wrapper
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ dynamic_linker='Win32 ld.exe'
+ ;;
+ esac
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[[23]].*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2.*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+haiku*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ postinstall_cmds='chmod 555 $lib'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[[3-9]]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+ [lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+ [lt_cv_shlibpath_overrides_runpath=yes])])
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+ ])
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[[89]] | openbsd2.[[89]].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+ [Variables whose values should be saved in libtool wrapper scripts and
+ restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+ [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+ [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+ [[List of archive names. First name is the real one, the rest are links.
+ The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+ [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+ [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+ [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+ [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+ [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+ [[As "finish_cmds", except a single script fragment to be evaled but
+ not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+ [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+ [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+ [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] | ?:[\\/]*])
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word. This closes a longstanding sh security hole.
+ ac_dummy="m4_if([$2], , $PATH, [$2])"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$1; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ AC_MSG_RESULT($MAGIC_CMD)
+else
+ AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+ [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+ [AS_HELP_STRING([--with-gnu-ld],
+ [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+ [test "$withval" = no || with_gnu_ld=yes],
+ [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ AC_MSG_CHECKING([for ld used by $CC])
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [[\\/]]* | ?:[[\\/]]*)
+ re_direlt='/[[^/]][[^/]]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ AC_MSG_CHECKING([for GNU ld])
+else
+ AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ AC_MSG_RESULT($LD)
+else
+ AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+ lt_cv_ld_reload_flag,
+ [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ if test "$GCC" != yes; then
+ reload_cmds=false
+ fi
+ ;;
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[[45]]*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ # Keep this pattern in sync with the one in func_win32_libid.
+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc*)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+haiku*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[[3-9]]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+ case $host_os in
+ mingw* | pw32*)
+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+ want_nocaseglob=yes
+ else
+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+ fi
+ ;;
+ esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+ [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+ [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+ [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+ [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+ AC_SUBST([DUMPBIN])
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+ [lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+ cat conftest.out >&AS_MESSAGE_LOG_FD
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+# -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+ # two different shell functions defined in ltmain.sh
+ # decide which to use based on capabilities of $DLLTOOL
+ case `$DLLTOOL --help 2>&1` in
+ *--identify-strict*)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+ ;;
+ *)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+ ;;
+ esac
+ ;;
+*)
+ # fallback: assume linklib IS sharedlib
+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+ ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+ [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+ [lt_cv_path_mainfest_tool=no
+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+ lt_cv_path_mainfest_tool=yes
+ fi
+ rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+ MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, cos, LIBM="-lm")
+ ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+ case $cc_basename in
+ nvcc*)
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+ esac
+
+ _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+ lt_cv_prog_compiler_rtti_exceptions,
+ [-fno-rtti -fno-exceptions], [],
+ [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+ [Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[[BCDT]]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[[ABCDGISTW]]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDEGRST]]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[[BCDEGRST]]'
+ ;;
+osf*)
+ symcode='[[BCDEGQRST]]'
+ ;;
+solaris*)
+ symcode='[[BDRT]]'
+ ;;
+sco3.2v5*)
+ symcode='[[DT]]'
+ ;;
+sysv4.2uw2*)
+ symcode='[[DT]]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[[ABDT]]'
+ ;;
+sysv4)
+ symcode='[[DFNSTU]]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK ['"\
+" {last_section=section; section=\$ 3};"\
+" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx]"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if AC_TRY_EVAL(ac_compile); then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT@&t@_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT@&t@_DLSYM_CONST
+#else
+# define LT@&t@_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+LT@&t@_DLSYM_CONST struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_globsym_save_LIBS=$LIBS
+ lt_globsym_save_CFLAGS=$CFLAGS
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS=$lt_globsym_save_LIBS
+ CFLAGS=$lt_globsym_save_CFLAGS
+ else
+ echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ AC_MSG_RESULT(failed)
+else
+ AC_MSG_RESULT(ok)
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+ nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+ [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+ [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+ [lt_cv_sys_global_symbol_to_c_name_address], [1],
+ [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+ [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+ [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+ [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)=
+ ;;
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix[[4-9]]*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ ;;
+ esac
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ fi
+ ;;
+ aCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ ecpc* )
+ # old Intel C++ for x86_64 which still supported -KPIC.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ icpc* )
+ # Intel C++, used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+ # IBM XL 8.0, 9.0 on PPC and BlueGene
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd*)
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+],
+[
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)=
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+ if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
+ fi
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC (with -KPIC) is the default.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+ ;;
+ nagfor*)
+ # NAG Fortran compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ ccc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All Alpha code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xl* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+ ;;
+ *Sun\ F* | *Sun*Fortran*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ *Intel*\ [[CF]]*Compiler*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ *Portland\ Group*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All OSF/1 code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ rdos*)
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ unicos*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+])
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+ ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+ [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+ [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+ "" | " "*) ;;
+ *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+ esac],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+ [Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+ [How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+ _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+ $lt_tmp_static_flag,
+ [],
+ [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+ [Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ case $host_os in
+ aix[[4-9]]*)
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global defined
+ # symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+ ;;
+ cygwin* | mingw* | cegcc*)
+ case $cc_basename in
+ cl*)
+ _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ ;;
+ *)
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+ ;;
+ esac
+ ;;
+ *)
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+], [
+ runpath_var=
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(archive_cmds, $1)=
+ _LT_TAGVAR(archive_expsym_cmds, $1)=
+ _LT_TAGVAR(compiler_needs_object, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(hardcode_automatic, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ _LT_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_TAGVAR(inherit_rpath, $1)=no
+ _LT_TAGVAR(link_all_deplibs, $1)=unknown
+ _LT_TAGVAR(module_cmds, $1)=
+ _LT_TAGVAR(module_expsym_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+ _LT_TAGVAR(thread_safe_flag_spec, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ _LT_TAGVAR(include_expsyms, $1)=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+ *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[[3-9]]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ haiku*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group f77 and f90 compilers
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ tmp_sharedflag='--shared' ;;
+ xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+ ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf* | bgf* | bgxlf* | mpixlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+
+ if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+ runpath_var=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ fi
+ ;;
+
+ aix[[4-9]]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[[45]]*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ case $cc_basename in
+ cl*)
+ # Native MSVC
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+ # Don't use ranlib
+ _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+ _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # Assume MSVC wrapper
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ # FIXME: Should let the user specify the lib program.
+ _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+ esac
+ ;;
+
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2.*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ m4_if($1, [], [
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ _LT_LINKER_OPTION([if $CC understands -b],
+ _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+ [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+ [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+ [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ # This should be the same for all languages, so no per-tag cache variable.
+ AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+ [lt_cv_irix_exported_symbol],
+ [save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE(
+ [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+ [C++], [[int foo (void) { return 0; }]],
+ [Fortran 77], [[
+ subroutine foo
+ end]],
+ [Fortran], [[
+ subroutine foo
+ end]])])],
+ [lt_cv_irix_exported_symbol=yes],
+ [lt_cv_irix_exported_symbol=no])
+ LDFLAGS="$save_LDFLAGS"])
+ if test "$lt_cv_irix_exported_symbol" = yes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ fi
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ else
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ os2*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ ;;
+ motorola)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4.3*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+ [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+ # Assume -lc should be added
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $_LT_TAGVAR(archive_cmds, $1) in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+ [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+ [$RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+ pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+ then
+ lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ else
+ lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ fi
+ _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+ ])
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+ [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+ [enable_shared_with_static_runtimes], [0],
+ [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+ [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+ [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+ [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+ [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+ [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+ [Commands used to build a loadable module if different from building
+ a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+ [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+ [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+ [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+ [Flag to hardcode $libdir into a binary during linking.
+ This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+ [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary and the resulting library dependency is
+ "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+ library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+ [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+ [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+ [Set to "yes" if building a shared library automatically hardcodes DIR
+ into the library and all subsequent libraries and executables linked
+ against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+ [Set to yes if linker adds runtime paths of dependent libraries
+ to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+ [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+ [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+ [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+ [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+ [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+ [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+ [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+ [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+ LT_SYS_DLOPEN_SELF
+ _LT_CMD_STRIPLIB
+
+ # Report which library types will actually be built
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_PROG_CXXCPP
+else
+ _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="int some_variable = 0;"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC=$CC
+ lt_save_CFLAGS=$CFLAGS
+ lt_save_LD=$LD
+ lt_save_GCC=$GCC
+ GCC=$GXX
+ lt_save_with_gnu_ld=$with_gnu_ld
+ lt_save_path_LD=$lt_cv_path_LD
+ if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+ else
+ $as_unset lt_cv_prog_gnu_ld
+ fi
+ if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+ else
+ $as_unset lt_cv_path_LD
+ fi
+ test -z "${LDCXX+set}" || LD=$LDCXX
+ CC=${CXX-"c++"}
+ CFLAGS=$CXXFLAGS
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ # We don't want -fno-exception when compiling C++ code, so set the
+ # no_builtin_flag separately
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+ else
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+ fi
+
+ if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+ LT_PATH_LD
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+ $GREP 'no-whole-archive' > /dev/null; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ fi
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+ fi
+
+ # PORTME: fill in a description of your system's C++ link characteristics
+ AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ if test "$GXX" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to
+ # export.
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty
+ # executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX([$1])
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared
+ # libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ case $GXX,$cc_basename in
+ ,cl* | no,cl*)
+ # Native MSVC
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ # Don't use ranlib
+ _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+ _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ func_to_tool_file "$lt_outputfile"~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # g++
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ freebsd2.*)
+ # C++ shared libraries reported to be fairly broken before
+ # switch to ELF
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ freebsd-elf*)
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ gnu*)
+ ;;
+
+ haiku*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ hpux9*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+ fi
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+ esac
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc* | ecpc* )
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ case `$CC -V` in
+ *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+ _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ $RANLIB $oldlib'
+ _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ *) # Version 6 and above use weak symbols
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+ ;;
+ xl* | mpixl* | bgxl*)
+ # IBM XL 8.0 on PPC, with GNU ld
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='func_echo_all'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ m88k*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+
+ *nto* | *qnx*)
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd=func_echo_all
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ case $host in
+ osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+ *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+ esac
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ case $host in
+ osf3*)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+ $RM $lib.exp'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ case $host in
+ osf3*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ psos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ ;;
+ esac
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+ output_verbose_link_cmd='func_echo_all'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+ if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+ fi
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+ '"$_LT_TAGVAR(old_archive_cmds, $1)"
+ _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+ '"$_LT_TAGVAR(reload_cmds, $1)"
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+ test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+ _LT_TAGVAR(GCC, $1)="$GXX"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ CC=$lt_save_CC
+ CFLAGS=$lt_save_CFLAGS
+ LDCXX=$LD
+ LD=$lt_save_LD
+ GCC=$lt_save_GCC
+ with_gnu_ld=$lt_save_with_gnu_ld
+ lt_cv_path_LDCXX=$lt_cv_path_LD
+ lt_cv_path_LD=$lt_save_path_LD
+ lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+ esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library. It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer*4 a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+ private int a;
+ public void bar (void) {
+ a = 0;
+ }
+};
+_LT_EOF
+], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
+package foo
+func foo() {
+}
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ for p in `eval "$output_verbose_link_cmd"`; do
+ case ${prev}${p} in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" ||
+ test $p = "-R"; then
+ prev=$p
+ continue
+ fi
+
+ # Expand the sysroot to ease extracting the directories later.
+ if test -z "$prev"; then
+ case $p in
+ -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+ -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+ -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+ esac
+ fi
+ case $p in
+ =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+ esac
+ if test "$pre_test_object_deps_done" = no; then
+ case ${prev} in
+ -L | -R)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+ _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+ fi
+ fi
+ prev=
+ ;;
+
+ *.lto.$objext) ;; # Ignore GCC LTO objects
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+ _LT_TAGVAR(predep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+ fi
+ else
+ if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+ _LT_TAGVAR(postdep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ _LT_TAGVAR(predep_objects,$1)=
+ _LT_TAGVAR(postdep_objects,$1)=
+ _LT_TAGVAR(postdeps,$1)=
+ ;;
+
+linux*)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC* | sunCC*)
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+ [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+ [Dependencies to place before and after the objects being linked to
+ create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+ [The library search path used internally by the compiler when linking
+ a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+ _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC="$CC"
+ lt_save_GCC=$GCC
+ lt_save_CFLAGS=$CFLAGS
+ CC=${F77-"f77"}
+ CFLAGS=$FFLAGS
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+ GCC=$G77
+ if test -n "$compiler"; then
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_TAGVAR(GCC, $1)="$G77"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC="$lt_save_CC"
+ CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+ _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC="$CC"
+ lt_save_GCC=$GCC
+ lt_save_CFLAGS=$CFLAGS
+ CC=${FC-"f95"}
+ CFLAGS=$FCFLAGS
+ compiler=$CC
+ GCC=$ac_cv_fc_compiler_gnu
+
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC=$lt_save_CC
+ CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_GO_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Go compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GO_CONFIG],
+[AC_REQUIRE([LT_PROG_GO])dnl
+AC_LANG_SAVE
+
+# Source file extension for Go test sources.
+ac_ext=go
+
+# Object file extension for compiled Go test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="package main; func main() { }"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='package main; func main() { }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GOC-"gccgo"}
+CFLAGS=$GOFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# Go did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GO_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+ :
+ _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+ [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+ [AC_CHECK_TOOL(GCJ, gcj,)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_GO
+# ----------
+AC_DEFUN([LT_PROG_GO],
+[AC_CHECK_TOOL(GOC, gccgo,)
+])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible. Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+ [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_SED. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+############################################################
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,b/c, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
+
+
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+ _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac])
+
+ _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+ func_basename_result="${1##*/}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+ func_split_long_opt_name=${1%%=*}
+ func_split_long_opt_arg=${1#*=}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+ func_split_short_opt_arg=${1#??}
+ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
+
+ _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac])
+
+ _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo])
+
+ _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))])
+
+ _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}])
+fi
+
+if test x"$lt_shell_append" = xyes; then
+ _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"])
+
+ _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+ func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+ eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
+
+ # Save a `func_append' function call where possible by direct use of '+='
+ sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+else
+ # Save a `func_append' function call even when '+=' is not available
+ sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+ AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path). These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+ ;;
+ esac
+ ;;
+ *-*-cygwin* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+ ;;
+ esac
+ ;;
+ * ) # unhandled hosts (and "normal" native builds)
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+ [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ esac
+ ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+ [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
diff --git a/config/ltmain.sh b/config/ltmain.sh
new file mode 100644
index 0000000..63ae69d
--- /dev/null
+++ b/config/ltmain.sh
@@ -0,0 +1,9655 @@
+
+# libtool (GNU libtool) 2.4.2
+# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions. There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Usage: $progname [OPTION]... [MODE-ARG]...
+#
+# Provide generalized library-building support services.
+#
+# --config show all configuration variables
+# --debug enable verbose shell tracing
+# -n, --dry-run display commands without modifying any files
+# --features display basic configuration information and exit
+# --mode=MODE use operation mode MODE
+# --preserve-dup-deps don't remove duplicate dependency libraries
+# --quiet, --silent don't print informational messages
+# --no-quiet, --no-silent
+# print informational messages (default)
+# --no-warn don't display warning messages
+# --tag=TAG use configuration variables from tag TAG
+# -v, --verbose print more informational messages than default
+# --no-verbose don't print the extra informational messages
+# --version print version information
+# -h, --help, --help-all print short, long, or detailed help message
+#
+# MODE must be one of the following:
+#
+# clean remove files from the build directory
+# compile compile a source file into a libtool object
+# execute automatically set library path, then run a program
+# finish complete the installation of libtool libraries
+# install install libraries or executables
+# link create a library or an executable
+# uninstall remove libraries from an installed directory
+#
+# MODE-ARGS vary depending on the MODE. When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
+# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+# host-triplet: $host
+# shell: $SHELL
+# compiler: $LTCC
+# compiler flags: $LTCFLAGS
+# linker: $LD (gnu? $with_gnu_ld)
+# $progname: (GNU libtool) 2.4.2
+# automake: $automake_version
+# autoconf: $autoconf_version
+#
+# Report bugs to <bug-libtool@gnu.org>.
+# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
+# General help using GNU software: <http://www.gnu.org/gethelp/>.
+
+PROGRAM=libtool
+PACKAGE=libtool
+VERSION=2.4.2
+TIMESTAMP=""
+package_revision=1.3337
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
+# NLS nuisances: We save the old values to restore during execute mode.
+lt_user_locale=
+lt_safe_locale=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+ eval "if test \"\${$lt_var+set}\" = set; then
+ save_$lt_var=\$$lt_var
+ $lt_var=C
+ export $lt_var
+ lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+ lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+ fi"
+done
+LC_ALL=C
+LANGUAGE=C
+export LANGUAGE LC_ALL
+
+$lt_unset CDPATH
+
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+
+
+: ${CP="cp -f"}
+test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" $lt_nl"
+
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+} # func_dirname may be replaced by extended shell implementation
+
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+} # func_basename may be replaced by extended shell implementation
+
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+ func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
+} # func_dirname_and_basename may be replaced by extended shell implementation
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+ esac
+} # func_stripname may be replaced by extended shell implementation
+
+
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+ s@/\./@/@g
+ t dotsl
+ s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+# value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+ # Start from root dir and reassemble the path.
+ func_normal_abspath_result=
+ func_normal_abspath_tpath=$1
+ func_normal_abspath_altnamespace=
+ case $func_normal_abspath_tpath in
+ "")
+ # Empty path, that just means $cwd.
+ func_stripname '' '/' "`pwd`"
+ func_normal_abspath_result=$func_stripname_result
+ return
+ ;;
+ # The next three entries are used to spot a run of precisely
+ # two leading slashes without using negated character classes;
+ # we take advantage of case's first-match behaviour.
+ ///*)
+ # Unusual form of absolute path, do nothing.
+ ;;
+ //*)
+ # Not necessarily an ordinary path; POSIX reserves leading '//'
+ # and for example Cygwin uses it to access remote file shares
+ # over CIFS/SMB, so we conserve a leading double slash if found.
+ func_normal_abspath_altnamespace=/
+ ;;
+ /*)
+ # Absolute path, do nothing.
+ ;;
+ *)
+ # Relative path, prepend $cwd.
+ func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+ ;;
+ esac
+ # Cancel out all the simple stuff to save iterations. We also want
+ # the path to end with a slash for ease of parsing, so make sure
+ # there is one (and only one) here.
+ func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+ while :; do
+ # Processed it all yet?
+ if test "$func_normal_abspath_tpath" = / ; then
+ # If we ascended to the root using ".." the result may be empty now.
+ if test -z "$func_normal_abspath_result" ; then
+ func_normal_abspath_result=/
+ fi
+ break
+ fi
+ func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$pathcar"`
+ func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+ -e "$pathcdr"`
+ # Figure out what to do with it
+ case $func_normal_abspath_tcomponent in
+ "")
+ # Trailing empty path component, ignore it.
+ ;;
+ ..)
+ # Parent dir; strip last assembled component from result.
+ func_dirname "$func_normal_abspath_result"
+ func_normal_abspath_result=$func_dirname_result
+ ;;
+ *)
+ # Actual path component, append it.
+ func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+ ;;
+ esac
+ done
+ # Restore leading double-slash if one was found on entry.
+ func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+# value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+ func_relative_path_result=
+ func_normal_abspath "$1"
+ func_relative_path_tlibdir=$func_normal_abspath_result
+ func_normal_abspath "$2"
+ func_relative_path_tbindir=$func_normal_abspath_result
+
+ # Ascend the tree starting from libdir
+ while :; do
+ # check if we have found a prefix of bindir
+ case $func_relative_path_tbindir in
+ $func_relative_path_tlibdir)
+ # found an exact match
+ func_relative_path_tcancelled=
+ break
+ ;;
+ $func_relative_path_tlibdir*)
+ # found a matching prefix
+ func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+ func_relative_path_tcancelled=$func_stripname_result
+ if test -z "$func_relative_path_result"; then
+ func_relative_path_result=.
+ fi
+ break
+ ;;
+ *)
+ func_dirname $func_relative_path_tlibdir
+ func_relative_path_tlibdir=${func_dirname_result}
+ if test "x$func_relative_path_tlibdir" = x ; then
+ # Have to descend all the way to the root!
+ func_relative_path_result=../$func_relative_path_result
+ func_relative_path_tcancelled=$func_relative_path_tbindir
+ break
+ fi
+ func_relative_path_result=../$func_relative_path_result
+ ;;
+ esac
+ done
+
+ # Now calculate path; take care to avoid doubling-up slashes.
+ func_stripname '' '/' "$func_relative_path_result"
+ func_relative_path_result=$func_stripname_result
+ func_stripname '/' '/' "$func_relative_path_tcancelled"
+ if test "x$func_stripname_result" != x ; then
+ func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+ fi
+
+ # Normalisation. If bindir is libdir, return empty string,
+ # else relative path ending with a slash; either way, target
+ # file name can be directly appended.
+ if test ! -z "$func_relative_path_result"; then
+ func_stripname './' '' "$func_relative_path_result/"
+ func_relative_path_result=$func_stripname_result
+ fi
+}
+
+# The name of this program:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+ [\\/]*|[A-Za-z]:\\*) ;;
+ *[\\/]*)
+ progdir=$func_dirname_result
+ progdir=`cd "$progdir" && pwd`
+ progpath="$progdir/$progname"
+ ;;
+ *)
+ save_IFS="$IFS"
+ IFS=${PATH_SEPARATOR-:}
+ for progdir in $PATH; do
+ IFS="$save_IFS"
+ test -x "$progdir/$progname" && break
+ done
+ IFS="$save_IFS"
+ test -n "$progdir" || progdir=`pwd`
+ progpath="$progdir/$progname"
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+
+# Sed substitution that converts a w32 file name or path
+# which contains forward slashes, into one that contains
+# (escaped) backslashes. A very naive implementation.
+lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+ s/$bs4/&\\
+/g
+ s/^$bs2$dollar/$bs&/
+ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+ s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+ $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+ $opt_verbose && func_echo ${1+"$@"}
+
+ # A bug in bash halts the script if the last line of a function
+ # fails when set -e is in force, so we need another command to
+ # work around that:
+ :
+}
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO "$*"
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+ $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+ $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+
+ # bash bug again:
+ :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+ func_error ${1+"$@"}
+ exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+ func_error ${1+"$@"}
+ func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information." ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+ $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+ my_directory_path="$1"
+ my_dir_list=
+
+ if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+ # Protect directory names starting with `-'
+ case $my_directory_path in
+ -*) my_directory_path="./$my_directory_path" ;;
+ esac
+
+ # While some portion of DIR does not yet exist...
+ while test ! -d "$my_directory_path"; do
+ # ...make a list in topmost first order. Use a colon delimited
+ # list incase some portion of path contains whitespace.
+ my_dir_list="$my_directory_path:$my_dir_list"
+
+ # If the last portion added has no slash in it, the list is done
+ case $my_directory_path in */*) ;; *) break ;; esac
+
+ # ...otherwise throw away the child directory and loop
+ my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+ done
+ my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+
+ save_mkdir_p_IFS="$IFS"; IFS=':'
+ for my_dir in $my_dir_list; do
+ IFS="$save_mkdir_p_IFS"
+ # mkdir can fail with a `File exist' error if two processes
+ # try to create one of the directories concurrently. Don't
+ # stop in that case!
+ $MKDIR "$my_dir" 2>/dev/null || :
+ done
+ IFS="$save_mkdir_p_IFS"
+
+ # Bail out if we (or some other process) failed to create a directory.
+ test -d "$my_directory_path" || \
+ func_fatal_error "Failed to create \`$1'"
+ fi
+}
+
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible. If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+ my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+ if test "$opt_dry_run" = ":"; then
+ # Return a directory name, but don't create it in dry-run mode
+ my_tmpdir="${my_template}-$$"
+ else
+
+ # If mktemp works, use that first and foremost
+ my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+ if test ! -d "$my_tmpdir"; then
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $MKDIR "$my_tmpdir"
+ umask $save_mktempdir_umask
+ fi
+
+ # If we're not in dry-run mode, bomb out on failure
+ test -d "$my_tmpdir" || \
+ func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+ fi
+
+ $ECHO "$my_tmpdir"
+}
+
+
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
+{
+ case $1 in
+ *[\\\`\"\$]*)
+ func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
+ *)
+ func_quote_for_eval_unquoted_result="$1" ;;
+ esac
+
+ case $func_quote_for_eval_unquoted_result in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting, command substitution and and variable
+ # expansion for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+ ;;
+ *)
+ func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+ esac
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+ case $1 in
+ *[\\\`\"]*)
+ my_arg=`$ECHO "$1" | $SED \
+ -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+ *)
+ my_arg="$1" ;;
+ esac
+
+ case $my_arg in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting and command substitution for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ my_arg="\"$my_arg\""
+ ;;
+ esac
+
+ func_quote_for_expand_result="$my_arg"
+}
+
+
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
+
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+
+ if ${opt_dry_run-false}; then :; else
+ eval "$my_cmd"
+ my_status=$?
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
+ fi
+ fi
+}
+
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it. Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
+
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+
+ if ${opt_dry_run-false}; then :; else
+ eval "$lt_user_locale
+ $my_cmd"
+ my_status=$?
+ eval "$lt_safe_locale"
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
+ fi
+ fi
+}
+
+# func_tr_sh
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result. All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+ case $1 in
+ [0-9]* | *[!a-zA-Z0-9_]*)
+ func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
+ ;;
+ * )
+ func_tr_sh_result=$1
+ ;;
+ esac
+}
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+ $opt_debug
+
+ $SED -n '/(C)/!b go
+ :more
+ /\./!{
+ N
+ s/\n# / /
+ b more
+ }
+ :go
+ /^# '$PROGRAM' (GNU /,/# warranty; / {
+ s/^# //
+ s/^# *$//
+ s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+ p
+ }' < "$progpath"
+ exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+ $opt_debug
+
+ $SED -n '/^# Usage:/,/^# *.*--help/ {
+ s/^# //
+ s/^# *$//
+ s/\$progname/'$progname'/
+ p
+ }' < "$progpath"
+ echo
+ $ECHO "run \`$progname --help | more' for full usage"
+ exit $?
+}
+
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
+func_help ()
+{
+ $opt_debug
+
+ $SED -n '/^# Usage:/,/# Report bugs to/ {
+ :print
+ s/^# //
+ s/^# *$//
+ s*\$progname*'$progname'*
+ s*\$host*'"$host"'*
+ s*\$SHELL*'"$SHELL"'*
+ s*\$LTCC*'"$LTCC"'*
+ s*\$LTCFLAGS*'"$LTCFLAGS"'*
+ s*\$LD*'"$LD"'*
+ s/\$with_gnu_ld/'"$with_gnu_ld"'/
+ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
+ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
+ p
+ d
+ }
+ /^# .* home page:/b print
+ /^# General help using/b print
+ ' < "$progpath"
+ ret=$?
+ if test -z "$1"; then
+ exit $ret
+ fi
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+ $opt_debug
+
+ func_error "missing argument for $1."
+ exit_cmd=exit
+}
+
+
+# func_split_short_opt shortopt
+# Set func_split_short_opt_name and func_split_short_opt_arg shell
+# variables after splitting SHORTOPT after the 2nd character.
+func_split_short_opt ()
+{
+ my_sed_short_opt='1s/^\(..\).*$/\1/;q'
+ my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
+
+ func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
+ func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
+} # func_split_short_opt may be replaced by extended shell implementation
+
+
+# func_split_long_opt longopt
+# Set func_split_long_opt_name and func_split_long_opt_arg shell
+# variables after splitting LONGOPT at the `=' sign.
+func_split_long_opt ()
+{
+ my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+ my_sed_long_arg='1s/^--[^=]*=//'
+
+ func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
+ func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
+} # func_split_long_opt may be replaced by extended shell implementation
+
+exit_cmd=:
+
+
+
+
+
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
+
+# Global variables.
+nonopt=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end. This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "${1}=\$${1}\${2}"
+} # func_append may be replaced by extended shell implementation
+
+# func_append_quoted var value
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+func_append_quoted ()
+{
+ func_quote_for_eval "${2}"
+ eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
+} # func_append_quoted may be replaced by extended shell implementation
+
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=`expr "${@}"`
+} # func_arith may be replaced by extended shell implementation
+
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
+} # func_len may be replaced by extended shell implementation
+
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+} # func_lo2o may be replaced by extended shell implementation
+
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+} # func_xform may be replaced by extended shell implementation
+
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+ func_error ${1+"$@"}
+ func_error "See the $PACKAGE documentation for more information."
+ func_fatal_error "Fatal configuration error."
+}
+
+
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+ re_begincf='^# ### BEGIN LIBTOOL'
+ re_endcf='^# ### END LIBTOOL'
+
+ # Default configuration.
+ $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+ # Now print the configurations for the tags.
+ for tagname in $taglist; do
+ $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+ done
+
+ exit $?
+}
+
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+ echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ echo "enable shared libraries"
+ else
+ echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ echo "enable static libraries"
+ else
+ echo "disable static libraries"
+ fi
+
+ exit $?
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+ # Global variable:
+ tagname="$1"
+
+ re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+ re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+ sed_extractcf="/$re_begincf/,/$re_endcf/p"
+
+ # Validate tagname.
+ case $tagname in
+ *[!-_A-Za-z0-9,/]*)
+ func_fatal_error "invalid tag name: $tagname"
+ ;;
+ esac
+
+ # Don't test for the "default" C tag, as we know it's
+ # there but not specially marked.
+ case $tagname in
+ CC) ;;
+ *)
+ if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+ taglist="$taglist $tagname"
+
+ # Evaluate the configuration. Be careful to quote the path
+ # and the sed script, to avoid splitting on whitespace, but
+ # also don't use non-portable quotes within backquotes within
+ # quotes we have to do it in 2 steps:
+ extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+ eval "$extractedcf"
+ else
+ func_error "ignoring unknown tag $tagname"
+ fi
+ ;;
+ esac
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+ if test "$package_revision" != "$macro_revision"; then
+ if test "$VERSION" != "$macro_version"; then
+ if test -z "$macro_version"; then
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+ fi
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+ fi
+
+ exit $EXIT_MISMATCH
+ fi
+}
+
+
+# Shorthand for --mode=foo, only valid as the first argument
+case $1 in
+clean|clea|cle|cl)
+ shift; set dummy --mode clean ${1+"$@"}; shift
+ ;;
+compile|compil|compi|comp|com|co|c)
+ shift; set dummy --mode compile ${1+"$@"}; shift
+ ;;
+execute|execut|execu|exec|exe|ex|e)
+ shift; set dummy --mode execute ${1+"$@"}; shift
+ ;;
+finish|finis|fini|fin|fi|f)
+ shift; set dummy --mode finish ${1+"$@"}; shift
+ ;;
+install|instal|insta|inst|ins|in|i)
+ shift; set dummy --mode install ${1+"$@"}; shift
+ ;;
+link|lin|li|l)
+ shift; set dummy --mode link ${1+"$@"}; shift
+ ;;
+uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+ shift; set dummy --mode uninstall ${1+"$@"}; shift
+ ;;
+esac
+
+
+
+# Option defaults:
+opt_debug=:
+opt_dry_run=false
+opt_config=false
+opt_preserve_dup_deps=false
+opt_features=false
+opt_finish=false
+opt_help=false
+opt_help_all=false
+opt_silent=:
+opt_warning=:
+opt_verbose=:
+opt_silent=false
+opt_verbose=false
+
+
+# Parse options once, thoroughly. This comes as soon as possible in the
+# script to make things like `--version' happen as quickly as we can.
+{
+ # this just eases exit handling
+ while test $# -gt 0; do
+ opt="$1"
+ shift
+ case $opt in
+ --debug|-x) opt_debug='set -x'
+ func_echo "enabling shell trace mode"
+ $opt_debug
+ ;;
+ --dry-run|--dryrun|-n)
+ opt_dry_run=:
+ ;;
+ --config)
+ opt_config=:
+func_config
+ ;;
+ --dlopen|-dlopen)
+ optarg="$1"
+ opt_dlopen="${opt_dlopen+$opt_dlopen
+}$optarg"
+ shift
+ ;;
+ --preserve-dup-deps)
+ opt_preserve_dup_deps=:
+ ;;
+ --features)
+ opt_features=:
+func_features
+ ;;
+ --finish)
+ opt_finish=:
+set dummy --mode finish ${1+"$@"}; shift
+ ;;
+ --help)
+ opt_help=:
+ ;;
+ --help-all)
+ opt_help_all=:
+opt_help=': help-all'
+ ;;
+ --mode)
+ test $# = 0 && func_missing_arg $opt && break
+ optarg="$1"
+ opt_mode="$optarg"
+case $optarg in
+ # Valid mode arguments:
+ clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+ # Catch anything else as an error
+ *) func_error "invalid argument for $opt"
+ exit_cmd=exit
+ break
+ ;;
+esac
+ shift
+ ;;
+ --no-silent|--no-quiet)
+ opt_silent=false
+func_append preserve_args " $opt"
+ ;;
+ --no-warning|--no-warn)
+ opt_warning=false
+func_append preserve_args " $opt"
+ ;;
+ --no-verbose)
+ opt_verbose=false
+func_append preserve_args " $opt"
+ ;;
+ --silent|--quiet)
+ opt_silent=:
+func_append preserve_args " $opt"
+ opt_verbose=false
+ ;;
+ --verbose|-v)
+ opt_verbose=:
+func_append preserve_args " $opt"
+opt_silent=false
+ ;;
+ --tag)
+ test $# = 0 && func_missing_arg $opt && break
+ optarg="$1"
+ opt_tag="$optarg"
+func_append preserve_args " $opt $optarg"
+func_enable_tag "$optarg"
+ shift
+ ;;
+
+ -\?|-h) func_usage ;;
+ --help) func_help ;;
+ --version) func_version ;;
+
+ # Separate optargs to long options:
+ --*=*)
+ func_split_long_opt "$opt"
+ set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
+ shift
+ ;;
+
+ # Separate non-argument short options:
+ -\?*|-h*|-n*|-v*)
+ func_split_short_opt "$opt"
+ set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
+ shift
+ ;;
+
+ --) break ;;
+ -*) func_fatal_help "unrecognized option \`$opt'" ;;
+ *) set dummy "$opt" ${1+"$@"}; shift; break ;;
+ esac
+ done
+
+ # Validate options:
+
+ # save first non-option argument
+ if test "$#" -gt 0; then
+ nonopt="$opt"
+ shift
+ fi
+
+ # preserve --debug
+ test "$opt_debug" = : || func_append preserve_args " --debug"
+
+ case $host in
+ *cygwin* | *mingw* | *pw32* | *cegcc*)
+ # don't eliminate duplications in $postdeps and $predeps
+ opt_duplicate_compiler_generated_deps=:
+ ;;
+ *)
+ opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+ ;;
+ esac
+
+ $opt_help || {
+ # Sanity checks first:
+ func_check_version_match
+
+ if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ func_fatal_configuration "not configured to build any kind of library"
+ fi
+
+ # Darwin sucks
+ eval std_shrext=\"$shrext_cmds\"
+
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
+ func_error "unrecognized option \`-dlopen'"
+ $ECHO "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$progname --help --mode=$opt_mode' for more information."
+ }
+
+
+ # Bail if the options were screwed
+ $exit_cmd $EXIT_FAILURE
+}
+
+
+
+
+## ----------- ##
+## Main. ##
+## ----------- ##
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+ test -f "$1" &&
+ $SED -e 4q "$1" 2>/dev/null \
+ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs. To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway. Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+ lalib_p=no
+ if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+ for lalib_p_l in 1 2 3 4
+ do
+ read lalib_p_line
+ case "$lalib_p_line" in
+ \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+ esac
+ done
+ exec 0<&5 5<&-
+ fi
+ test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+ func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+ func_ltwrapper_exec_suffix=
+ case $1 in
+ *.exe) ;;
+ *) func_ltwrapper_exec_suffix=.exe ;;
+ esac
+ $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+ func_dirname_and_basename "$1" "" "."
+ func_stripname '' '.exe' "$func_basename_result"
+ func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+ func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+ $opt_debug
+ save_ifs=$IFS; IFS='~'
+ for cmd in $1; do
+ IFS=$save_ifs
+ eval cmd=\"$cmd\"
+ func_show_eval "$cmd" "${2-:}"
+ done
+ IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)! Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+ $opt_debug
+ case $1 in
+ */* | *\\*) . "$1" ;;
+ *) . "./$1" ;;
+ esac
+}
+
+
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH with a sysroot. Store the result into
+# func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+ func_resolve_sysroot_result=$1
+ case $func_resolve_sysroot_result in
+ =*)
+ func_stripname '=' '' "$func_resolve_sysroot_result"
+ func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+ ;;
+ esac
+}
+
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+ case "$lt_sysroot:$1" in
+ ?*:"$lt_sysroot"*)
+ func_stripname "$lt_sysroot" '' "$1"
+ func_replace_sysroot_result="=$func_stripname_result"
+ ;;
+ *)
+ # Including no sysroot.
+ func_replace_sysroot_result=$1
+ ;;
+ esac
+}
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+ $opt_debug
+ if test -n "$available_tags" && test -z "$tagname"; then
+ CC_quoted=
+ for arg in $CC; do
+ func_append_quoted CC_quoted "$arg"
+ done
+ CC_expanded=`func_echo_all $CC`
+ CC_quoted_expanded=`func_echo_all $CC_quoted`
+ case $@ in
+ # Blanks in the command may have been stripped by the calling shell,
+ # but not from the CC environment variable when configure was run.
+ " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+ # Blanks at the start of $base_compile will cause this to fail
+ # if we don't check for them as well.
+ *)
+ for z in $available_tags; do
+ if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+ CC_quoted=
+ for arg in $CC; do
+ # Double-quote args containing other shell metacharacters.
+ func_append_quoted CC_quoted "$arg"
+ done
+ CC_expanded=`func_echo_all $CC`
+ CC_quoted_expanded=`func_echo_all $CC_quoted`
+ case "$@ " in
+ " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+ # The compiler in the base compile command matches
+ # the one in the tagged configuration.
+ # Assume this is the tagged configuration we want.
+ tagname=$z
+ break
+ ;;
+ esac
+ fi
+ done
+ # If $tagname still isn't set, then no tagged configuration
+ # was found and let the user know that the "--tag" command
+ # line option must be used.
+ if test -z "$tagname"; then
+ func_echo "unable to infer tagged configuration"
+ func_fatal_error "specify a tag with \`--tag'"
+# else
+# func_verbose "using $tagname tagged configuration"
+ fi
+ ;;
+ esac
+ fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+ write_libobj=${1}
+ if test "$build_libtool_libs" = yes; then
+ write_lobj=\'${2}\'
+ else
+ write_lobj=none
+ fi
+
+ if test "$build_old_libs" = yes; then
+ write_oldobj=\'${3}\'
+ else
+ write_oldobj=none
+ fi
+
+ $opt_dry_run || {
+ cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+ $MV "${write_libobj}T" "${write_libobj}"
+ }
+}
+
+
+##################################################
+# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
+##################################################
+
+# func_convert_core_file_wine_to_w32 ARG
+# Helper function used by file name conversion functions when $build is *nix,
+# and $host is mingw, cygwin, or some other w32 environment. Relies on a
+# correctly configured wine environment available, with the winepath program
+# in $build's $PATH.
+#
+# ARG is the $build file name to be converted to w32 format.
+# Result is available in $func_convert_core_file_wine_to_w32_result, and will
+# be empty on error (or when ARG is empty)
+func_convert_core_file_wine_to_w32 ()
+{
+ $opt_debug
+ func_convert_core_file_wine_to_w32_result="$1"
+ if test -n "$1"; then
+ # Unfortunately, winepath does not exit with a non-zero error code, so we
+ # are forced to check the contents of stdout. On the other hand, if the
+ # command is not found, the shell will set an exit code of 127 and print
+ # *an error message* to stdout. So we must check for both error code of
+ # zero AND non-empty stdout, which explains the odd construction:
+ func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
+ if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+ func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
+ $SED -e "$lt_sed_naive_backslashify"`
+ else
+ func_convert_core_file_wine_to_w32_result=
+ fi
+ fi
+}
+# end: func_convert_core_file_wine_to_w32
+
+
+# func_convert_core_path_wine_to_w32 ARG
+# Helper function used by path conversion functions when $build is *nix, and
+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
+# configured wine environment available, with the winepath program in $build's
+# $PATH. Assumes ARG has no leading or trailing path separator characters.
+#
+# ARG is path to be converted from $build format to win32.
+# Result is available in $func_convert_core_path_wine_to_w32_result.
+# Unconvertible file (directory) names in ARG are skipped; if no directory names
+# are convertible, then the result may be empty.
+func_convert_core_path_wine_to_w32 ()
+{
+ $opt_debug
+ # unfortunately, winepath doesn't convert paths, only file names
+ func_convert_core_path_wine_to_w32_result=""
+ if test -n "$1"; then
+ oldIFS=$IFS
+ IFS=:
+ for func_convert_core_path_wine_to_w32_f in $1; do
+ IFS=$oldIFS
+ func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
+ if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+ if test -z "$func_convert_core_path_wine_to_w32_result"; then
+ func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+ else
+ func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
+ fi
+ fi
+ done
+ IFS=$oldIFS
+ fi
+}
+# end: func_convert_core_path_wine_to_w32
+
+
+# func_cygpath ARGS...
+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
+# (2), returns the Cygwin file name or path in func_cygpath_result (input
+# file name or path is assumed to be in w32 format, as previously converted
+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
+# or path in func_cygpath_result (input file name or path is assumed to be in
+# Cygwin format). Returns an empty string on error.
+#
+# ARGS are passed to cygpath, with the last one being the file name or path to
+# be converted.
+#
+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
+# environment variable; do not put it in $PATH.
+func_cygpath ()
+{
+ $opt_debug
+ if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
+ func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
+ if test "$?" -ne 0; then
+ # on failure, ensure result is empty
+ func_cygpath_result=
+ fi
+ else
+ func_cygpath_result=
+ func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+ fi
+}
+#end: func_cygpath
+
+
+# func_convert_core_msys_to_w32 ARG
+# Convert file name or path ARG from MSYS format to w32 format. Return
+# result in func_convert_core_msys_to_w32_result.
+func_convert_core_msys_to_w32 ()
+{
+ $opt_debug
+ # awkward: cmd appends spaces to result
+ func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+ $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_file_check ARG1 ARG2
+# Verify that ARG1 (a file name in $build format) was converted to $host
+# format in ARG2. Otherwise, emit an error message, but continue (resetting
+# func_to_host_file_result to ARG1).
+func_convert_file_check ()
+{
+ $opt_debug
+ if test -z "$2" && test -n "$1" ; then
+ func_error "Could not determine host file name corresponding to"
+ func_error " \`$1'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback:
+ func_to_host_file_result="$1"
+ fi
+}
+# end func_convert_file_check
+
+
+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
+# Verify that FROM_PATH (a path in $build format) was converted to $host
+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
+# func_to_host_file_result to a simplistic fallback value (see below).
+func_convert_path_check ()
+{
+ $opt_debug
+ if test -z "$4" && test -n "$3"; then
+ func_error "Could not determine the host path corresponding to"
+ func_error " \`$3'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback. This is a deliberately simplistic "conversion" and
+ # should not be "improved". See libtool.info.
+ if test "x$1" != "x$2"; then
+ lt_replace_pathsep_chars="s|$1|$2|g"
+ func_to_host_path_result=`echo "$3" |
+ $SED -e "$lt_replace_pathsep_chars"`
+ else
+ func_to_host_path_result="$3"
+ fi
+ fi
+}
+# end func_convert_path_check
+
+
+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
+# and appending REPL if ORIG matches BACKPAT.
+func_convert_path_front_back_pathsep ()
+{
+ $opt_debug
+ case $4 in
+ $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+ ;;
+ esac
+ case $4 in
+ $2 ) func_append func_to_host_path_result "$3"
+ ;;
+ esac
+}
+# end func_convert_path_front_back_pathsep
+
+
+##################################################
+# $build to $host FILE NAME CONVERSION FUNCTIONS #
+##################################################
+# invoked via `$to_host_file_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# Result will be available in $func_to_host_file_result.
+
+
+# func_to_host_file ARG
+# Converts the file name ARG from $build format to $host format. Return result
+# in func_to_host_file_result.
+func_to_host_file ()
+{
+ $opt_debug
+ $to_host_file_cmd "$1"
+}
+# end func_to_host_file
+
+
+# func_to_tool_file ARG LAZY
+# converts the file name ARG from $build format to toolchain format. Return
+# result in func_to_tool_file_result. If the conversion in use is listed
+# in (the comma separated) LAZY, no conversion takes place.
+func_to_tool_file ()
+{
+ $opt_debug
+ case ,$2, in
+ *,"$to_tool_file_cmd",*)
+ func_to_tool_file_result=$1
+ ;;
+ *)
+ $to_tool_file_cmd "$1"
+ func_to_tool_file_result=$func_to_host_file_result
+ ;;
+ esac
+}
+# end func_to_tool_file
+
+
+# func_convert_file_noop ARG
+# Copy ARG to func_to_host_file_result.
+func_convert_file_noop ()
+{
+ func_to_host_file_result="$1"
+}
+# end func_convert_file_noop
+
+
+# func_convert_file_msys_to_w32 ARG
+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper. Returns result in
+# func_to_host_file_result.
+func_convert_file_msys_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_msys_to_w32 "$1"
+ func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_w32
+
+
+# func_convert_file_cygwin_to_w32 ARG
+# Convert file name ARG from Cygwin to w32 format. Returns result in
+# func_to_host_file_result.
+func_convert_file_cygwin_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
+ # LT_CYGPATH in this case.
+ func_to_host_file_result=`cygpath -m "$1"`
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_cygwin_to_w32
+
+
+# func_convert_file_nix_to_w32 ARG
+# Convert file name ARG from *nix to w32 format. Requires a wine environment
+# and a working winepath. Returns result in func_to_host_file_result.
+func_convert_file_nix_to_w32 ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_file_wine_to_w32 "$1"
+ func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_w32
+
+
+# func_convert_file_msys_to_cygwin ARG
+# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_file_msys_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ func_convert_core_msys_to_w32 "$1"
+ func_cygpath -u "$func_convert_core_msys_to_w32_result"
+ func_to_host_file_result="$func_cygpath_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_cygwin
+
+
+# func_convert_file_nix_to_cygwin ARG
+# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
+# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
+# in func_to_host_file_result.
+func_convert_file_nix_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_file_result="$1"
+ if test -n "$1"; then
+ # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
+ func_convert_core_file_wine_to_w32 "$1"
+ func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
+ func_to_host_file_result="$func_cygpath_result"
+ fi
+ func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_cygwin
+
+
+#############################################
+# $build to $host PATH CONVERSION FUNCTIONS #
+#############################################
+# invoked via `$to_host_path_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# The result will be available in $func_to_host_path_result.
+#
+# Path separators are also converted from $build format to $host format. If
+# ARG begins or ends with a path separator character, it is preserved (but
+# converted to $host format) on output.
+#
+# All path conversion functions are named using the following convention:
+# file name conversion function : func_convert_file_X_to_Y ()
+# path conversion function : func_convert_path_X_to_Y ()
+# where, for any given $build/$host combination the 'X_to_Y' value is the
+# same. If conversion functions are added for new $build/$host combinations,
+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
+# will break.
+
+
+# func_init_to_host_path_cmd
+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
+# appropriate value, based on the value of $to_host_file_cmd.
+to_host_path_cmd=
+func_init_to_host_path_cmd ()
+{
+ $opt_debug
+ if test -z "$to_host_path_cmd"; then
+ func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
+ to_host_path_cmd="func_convert_path_${func_stripname_result}"
+ fi
+}
+
+
+# func_to_host_path ARG
+# Converts the path ARG from $build format to $host format. Return result
+# in func_to_host_path_result.
+func_to_host_path ()
+{
+ $opt_debug
+ func_init_to_host_path_cmd
+ $to_host_path_cmd "$1"
+}
+# end func_to_host_path
+
+
+# func_convert_path_noop ARG
+# Copy ARG to func_to_host_path_result.
+func_convert_path_noop ()
+{
+ func_to_host_path_result="$1"
+}
+# end func_convert_path_noop
+
+
+# func_convert_path_msys_to_w32 ARG
+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper. Returns result in
+# func_to_host_path_result.
+func_convert_path_msys_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # Remove leading and trailing path separator characters from ARG. MSYS
+ # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
+ # and winepath ignores them completely.
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+ func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_msys_to_w32
+
+
+# func_convert_path_cygwin_to_w32 ARG
+# Convert path ARG from Cygwin to w32 format. Returns result in
+# func_to_host_file_result.
+func_convert_path_cygwin_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_cygwin_to_w32
+
+
+# func_convert_path_nix_to_w32 ARG
+# Convert path ARG from *nix to w32 format. Requires a wine environment and
+# a working winepath. Returns result in func_to_host_file_result.
+func_convert_path_nix_to_w32 ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+ func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+ func_convert_path_check : ";" \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+ fi
+}
+# end func_convert_path_nix_to_w32
+
+
+# func_convert_path_msys_to_cygwin ARG
+# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_path_msys_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # See func_convert_path_msys_to_w32:
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+ func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+ func_to_host_path_result="$func_cygpath_result"
+ func_convert_path_check : : \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+ fi
+}
+# end func_convert_path_msys_to_cygwin
+
+
+# func_convert_path_nix_to_cygwin ARG
+# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
+# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
+# func_to_host_file_result.
+func_convert_path_nix_to_cygwin ()
+{
+ $opt_debug
+ func_to_host_path_result="$1"
+ if test -n "$1"; then
+ # Remove leading and trailing path separator characters from
+ # ARG. msys behavior is inconsistent here, cygpath turns them
+ # into '.;' and ';.', and winepath ignores them completely.
+ func_stripname : : "$1"
+ func_to_host_path_tmp1=$func_stripname_result
+ func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+ func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
+ func_to_host_path_result="$func_cygpath_result"
+ func_convert_path_check : : \
+ "$func_to_host_path_tmp1" "$func_to_host_path_result"
+ func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+ fi
+}
+# end func_convert_path_nix_to_cygwin
+
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+ $opt_debug
+ # Get the compilation command and the source file.
+ base_compile=
+ srcfile="$nonopt" # always keep a non-empty value in "srcfile"
+ suppress_opt=yes
+ suppress_output=
+ arg_mode=normal
+ libobj=
+ later=
+ pie_flag=
+
+ for arg
+ do
+ case $arg_mode in
+ arg )
+ # do not "continue". Instead, add this to base_compile
+ lastarg="$arg"
+ arg_mode=normal
+ ;;
+
+ target )
+ libobj="$arg"
+ arg_mode=normal
+ continue
+ ;;
+
+ normal )
+ # Accept any command-line options.
+ case $arg in
+ -o)
+ test -n "$libobj" && \
+ func_fatal_error "you cannot specify \`-o' more than once"
+ arg_mode=target
+ continue
+ ;;
+
+ -pie | -fpie | -fPIE)
+ func_append pie_flag " $arg"
+ continue
+ ;;
+
+ -shared | -static | -prefer-pic | -prefer-non-pic)
+ func_append later " $arg"
+ continue
+ ;;
+
+ -no-suppress)
+ suppress_opt=no
+ continue
+ ;;
+
+ -Xcompiler)
+ arg_mode=arg # the next one goes into the "base_compile" arg list
+ continue # The current "srcfile" will either be retained or
+ ;; # replaced later. I would guess that would be a bug.
+
+ -Wc,*)
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
+ lastarg=
+ save_ifs="$IFS"; IFS=','
+ for arg in $args; do
+ IFS="$save_ifs"
+ func_append_quoted lastarg "$arg"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$lastarg"
+ lastarg=$func_stripname_result
+
+ # Add the arguments to base_compile.
+ func_append base_compile " $lastarg"
+ continue
+ ;;
+
+ *)
+ # Accept the current argument as the source file.
+ # The previous "srcfile" becomes the current argument.
+ #
+ lastarg="$srcfile"
+ srcfile="$arg"
+ ;;
+ esac # case $arg
+ ;;
+ esac # case $arg_mode
+
+ # Aesthetically quote the previous argument.
+ func_append_quoted base_compile "$lastarg"
+ done # for arg
+
+ case $arg_mode in
+ arg)
+ func_fatal_error "you must specify an argument for -Xcompile"
+ ;;
+ target)
+ func_fatal_error "you must specify a target with \`-o'"
+ ;;
+ *)
+ # Get the name of the library object.
+ test -z "$libobj" && {
+ func_basename "$srcfile"
+ libobj="$func_basename_result"
+ }
+ ;;
+ esac
+
+ # Recognize several different file suffixes.
+ # If the user specifies -o file.o, it is replaced with file.lo
+ case $libobj in
+ *.[cCFSifmso] | \
+ *.ada | *.adb | *.ads | *.asm | \
+ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
+ func_xform "$libobj"
+ libobj=$func_xform_result
+ ;;
+ esac
+
+ case $libobj in
+ *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+ *)
+ func_fatal_error "cannot determine name of library object from \`$libobj'"
+ ;;
+ esac
+
+ func_infer_tag $base_compile
+
+ for arg in $later; do
+ case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ continue
+ ;;
+
+ -static)
+ build_libtool_libs=no
+ build_old_libs=yes
+ continue
+ ;;
+
+ -prefer-pic)
+ pic_mode=yes
+ continue
+ ;;
+
+ -prefer-non-pic)
+ pic_mode=no
+ continue
+ ;;
+ esac
+ done
+
+ func_quote_for_eval "$libobj"
+ test "X$libobj" != "X$func_quote_for_eval_result" \
+ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && func_warning "libobj name \`$libobj' may not contain shell special characters."
+ func_dirname_and_basename "$obj" "/" ""
+ objname="$func_basename_result"
+ xdir="$func_dirname_result"
+ lobj=${xdir}$objdir/$objname
+
+ test -z "$base_compile" && \
+ func_fatal_help "you must specify a compilation command"
+
+ # Delete any leftover library objects.
+ if test "$build_old_libs" = yes; then
+ removelist="$obj $lobj $libobj ${libobj}T"
+ else
+ removelist="$lobj $libobj ${libobj}T"
+ fi
+
+ # On Cygwin there's no "real" PIC flag so we must build both object types
+ case $host_os in
+ cygwin* | mingw* | pw32* | os2* | cegcc*)
+ pic_mode=default
+ ;;
+ esac
+ if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+ # non-PIC code in shared libraries is not supported
+ pic_mode=default
+ fi
+
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+ lockfile="$output_obj.lock"
+ else
+ output_obj=
+ need_locks=no
+ lockfile=
+ fi
+
+ # Lock this critical section if it is needed
+ # We use this script file to make the link, it avoids creating a new file
+ if test "$need_locks" = yes; then
+ until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+ func_echo "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ elif test "$need_locks" = warn; then
+ if test -f "$lockfile"; then
+ $ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+ func_append removelist " $output_obj"
+ $ECHO "$srcfile" > "$lockfile"
+ fi
+
+ $opt_dry_run || $RM $removelist
+ func_append removelist " $lockfile"
+ trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+ func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
+ srcfile=$func_to_tool_file_result
+ func_quote_for_eval "$srcfile"
+ qsrcfile=$func_quote_for_eval_result
+
+ # Only build a PIC object if we are building libtool libraries.
+ if test "$build_libtool_libs" = yes; then
+ # Without this assignment, base_compile gets emptied.
+ fbsd_hideous_sh_bug=$base_compile
+
+ if test "$pic_mode" != no; then
+ command="$base_compile $qsrcfile $pic_flag"
+ else
+ # Don't build PIC code
+ command="$base_compile $qsrcfile"
+ fi
+
+ func_mkdir_p "$xdir$objdir"
+
+ if test -z "$output_obj"; then
+ # Place PIC objects in $objdir
+ func_append command " -o $lobj"
+ fi
+
+ func_show_eval_locale "$command" \
+ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed, then go on to compile the next one
+ if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+ func_show_eval '$MV "$output_obj" "$lobj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+ fi
+
+ # Allow error messages only from the first compilation.
+ if test "$suppress_opt" = yes; then
+ suppress_output=' >/dev/null 2>&1'
+ fi
+ fi
+
+ # Only build a position-dependent object if we build old libraries.
+ if test "$build_old_libs" = yes; then
+ if test "$pic_mode" != yes; then
+ # Don't build PIC code
+ command="$base_compile $qsrcfile$pie_flag"
+ else
+ command="$base_compile $qsrcfile $pic_flag"
+ fi
+ if test "$compiler_c_o" = yes; then
+ func_append command " -o $obj"
+ fi
+
+ # Suppress compiler output if we already did a PIC compilation.
+ func_append command "$suppress_output"
+ func_show_eval_locale "$command" \
+ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+ if test "$need_locks" = warn &&
+ test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+ $ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together. If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+ $opt_dry_run || $RM $removelist
+ exit $EXIT_FAILURE
+ fi
+
+ # Just move the object if needed
+ if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+ func_show_eval '$MV "$output_obj" "$obj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+ fi
+ fi
+
+ $opt_dry_run || {
+ func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ removelist=$lockfile
+ $RM "$lockfile"
+ fi
+ }
+
+ exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+ test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+ # We need to display help for each of the modes.
+ case $opt_mode in
+ "")
+ # Generic help is extracted from the usage comments
+ # at the start of this file.
+ func_help
+ ;;
+
+ clean)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+ compile)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -no-suppress do not suppress compiler output for multiple passes
+ -prefer-pic try to build PIC objects only
+ -prefer-non-pic try to build non-PIC objects only
+ -shared do not build a \`.o' file suitable for static linking
+ -static only build a \`.o' file suitable for static linking
+ -Wc,FLAG pass FLAG directly to the compiler
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+ execute)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+ finish)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+ install)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+ -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+ link)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -bindir BINDIR specify path to binaries directory (for systems where
+ libraries must be found in the PATH setting at runtime)
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-fast-install disable the fast-install mode
+ -no-install link a not-installable executable
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -objectlist FILE Use a list of object files found in FILE to specify objects
+ -precious-files-regex REGEX
+ don't remove output files matching REGEX
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -shared only do dynamic linking of libtool libraries
+ -shrext SUFFIX override the standard shared library file extension
+ -static do not do any dynamic linking of uninstalled libtool libraries
+ -static-libtool-libs
+ do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+ -weak LIBNAME declare that the target provides the LIBNAME interface
+ -Wc,FLAG
+ -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
+ -Wl,FLAG
+ -Xlinker FLAG pass linker-specific FLAG directly to the linker
+ -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+ uninstall)
+ $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+ *)
+ func_fatal_help "invalid operation mode \`$opt_mode'"
+ ;;
+ esac
+
+ echo
+ $ECHO "Try \`$progname --help' for more information about other modes."
+}
+
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+ if test "$opt_help" = :; then
+ func_mode_help
+ else
+ {
+ func_help noexit
+ for opt_mode in compile link execute install finish uninstall clean; do
+ func_mode_help
+ done
+ } | sed -n '1p; 2,$s/^Usage:/ or: /p'
+ {
+ func_help noexit
+ for opt_mode in compile link execute install finish uninstall clean; do
+ echo
+ func_mode_help
+ done
+ } |
+ sed '1d
+ /^When reporting/,/^Report/{
+ H
+ d
+ }
+ $x
+ /information about other modes/d
+ /more detailed .*MODE/d
+ s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+ fi
+ exit $?
+fi
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+ $opt_debug
+ # The first argument is the command name.
+ cmd="$nonopt"
+ test -z "$cmd" && \
+ func_fatal_help "you must specify a COMMAND"
+
+ # Handle -dlopen flags immediately.
+ for file in $opt_dlopen; do
+ test -f "$file" \
+ || func_fatal_help "\`$file' is not a file"
+
+ dir=
+ case $file in
+ *.la)
+ func_resolve_sysroot "$file"
+ file=$func_resolve_sysroot_result
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+ func_source "$file"
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && \
+ func_warning "\`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+
+ if test -f "$dir/$objdir/$dlname"; then
+ func_append dir "/$objdir"
+ else
+ if test ! -f "$dir/$dlname"; then
+ func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+ fi
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ ;;
+
+ *)
+ func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case $file in
+ -* | *.la | *.lo ) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if func_ltwrapper_script_p "$file"; then
+ func_source "$file"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ elif func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ func_source "$func_ltwrapper_scriptname_result"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ func_append_quoted args "$file"
+ done
+
+ if test "X$opt_dry_run" = Xfalse; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved environment variables
+ for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+ do
+ eval "if test \"\${save_$lt_var+set}\" = set; then
+ $lt_var=\$save_$lt_var; export $lt_var
+ else
+ $lt_unset $lt_var
+ fi"
+ done
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+ echo "export $shlibpath_var"
+ fi
+ $ECHO "$cmd$args"
+ exit $EXIT_SUCCESS
+ fi
+}
+
+test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+ $opt_debug
+ libs=
+ libdirs=
+ admincmds=
+
+ for opt in "$nonopt" ${1+"$@"}
+ do
+ if test -d "$opt"; then
+ func_append libdirs " $opt"
+
+ elif test -f "$opt"; then
+ if func_lalib_unsafe_p "$opt"; then
+ func_append libs " $opt"
+ else
+ func_warning "\`$opt' is not a valid libtool archive"
+ fi
+
+ else
+ func_fatal_error "invalid argument \`$opt'"
+ fi
+ done
+
+ if test -n "$libs"; then
+ if test -n "$lt_sysroot"; then
+ sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+ sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+ else
+ sysroot_cmd=
+ fi
+
+ # Remove sysroot references
+ if $opt_dry_run; then
+ for lib in $libs; do
+ echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+ done
+ else
+ tmpdir=`func_mktempdir`
+ for lib in $libs; do
+ sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+ > $tmpdir/tmp-la
+ mv -f $tmpdir/tmp-la $lib
+ done
+ ${RM}r "$tmpdir"
+ fi
+ fi
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $opt_dry_run || eval "$cmds" || func_append admincmds "
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ $opt_silent && exit $EXIT_SUCCESS
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ echo "----------------------------------------------------------------------"
+ echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ $ECHO " $libdir"
+ done
+ echo
+ echo "If you ever happen to want to link against installed libraries"
+ echo "in a given directory, LIBDIR, you must either use libtool, and"
+ echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ $ECHO " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ $ECHO " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ echo
+
+ echo "See any operating system documentation about shared libraries for"
+ case $host in
+ solaris2.[6789]|solaris2.1[0-9])
+ echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+ echo "pages."
+ ;;
+ *)
+ echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ ;;
+ esac
+ echo "----------------------------------------------------------------------"
+ fi
+ exit $EXIT_SUCCESS
+}
+
+test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+ $opt_debug
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+ # Allow the use of GNU shtool's install command.
+ case $nonopt in *shtool*) :;; *) false;; esac; then
+ # Aesthetically quote it.
+ func_quote_for_eval "$nonopt"
+ install_prog="$func_quote_for_eval_result "
+ arg=$1
+ shift
+ else
+ install_prog=
+ arg=$nonopt
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ func_quote_for_eval "$arg"
+ func_append install_prog "$func_quote_for_eval_result"
+ install_shared_prog=$install_prog
+ case " $install_prog " in
+ *[\\\ /]cp\ *) install_cp=: ;;
+ *) install_cp=false ;;
+ esac
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ no_mode=:
+ for arg
+ do
+ arg2=
+ if test -n "$dest"; then
+ func_append files " $dest"
+ dest=$arg
+ continue
+ fi
+
+ case $arg in
+ -d) isdir=yes ;;
+ -f)
+ if $install_cp; then :; else
+ prev=$arg
+ fi
+ ;;
+ -g | -m | -o)
+ prev=$arg
+ ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*)
+ ;;
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ if test "x$prev" = x-m && test -n "$install_override_mode"; then
+ arg2=$install_override_mode
+ no_mode=false
+ fi
+ prev=
+ else
+ dest=$arg
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ func_quote_for_eval "$arg"
+ func_append install_prog " $func_quote_for_eval_result"
+ if test -n "$arg2"; then
+ func_quote_for_eval "$arg2"
+ fi
+ func_append install_shared_prog " $func_quote_for_eval_result"
+ done
+
+ test -z "$install_prog" && \
+ func_fatal_help "you must specify an install program"
+
+ test -n "$prev" && \
+ func_fatal_help "the \`$prev' option requires an argument"
+
+ if test -n "$install_override_mode" && $no_mode; then
+ if $install_cp; then :; else
+ func_quote_for_eval "$install_override_mode"
+ func_append install_shared_prog " -m $func_quote_for_eval_result"
+ fi
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ func_fatal_help "no file or destination specified"
+ else
+ func_fatal_help "you must specify a destination"
+ fi
+ fi
+
+ # Strip any trailing slash from the destination.
+ func_stripname '' '/' "$dest"
+ dest=$func_stripname_result
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ func_dirname_and_basename "$dest" "" "."
+ destdir="$func_dirname_result"
+ destname="$func_basename_result"
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files; shift
+ test "$#" -gt 1 && \
+ func_fatal_help "\`$dest' is not a directory"
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ func_fatal_help "\`$destdir' must be an absolute directory name"
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case $file in
+ *.$libext)
+ # Do the static libraries later.
+ func_append staticlibs " $file"
+ ;;
+
+ *.la)
+ func_resolve_sysroot "$file"
+ file=$func_resolve_sysroot_result
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$file' is not a valid libtool archive"
+
+ library_names=
+ old_library=
+ relink_command=
+ func_source "$file"
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) func_append current_libdirs " $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) func_append future_libdirs " $libdir" ;;
+ esac
+ fi
+
+ func_dirname "$file" "/" ""
+ dir="$func_dirname_result"
+ func_append dir "$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ # At present, this check doesn't affect windows .dll's that
+ # are installed into $libdir/../bin (currently, that works fine)
+ # but it's something to keep an eye on.
+ test "$inst_prefix_dir" = "$destdir" && \
+ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+ fi
+
+ func_warning "relinking \`$file'"
+ func_show_eval "$relink_command" \
+ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names; shift
+ if test -n "$1"; then
+ realname="$1"
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+ 'exit $?'
+ tstripme="$stripme"
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ case $realname in
+ *.dll.a)
+ tstripme=""
+ ;;
+ esac
+ ;;
+ esac
+ if test -n "$tstripme" && test -n "$striplib"; then
+ func_show_eval "$striplib $destdir/$realname" 'exit $?'
+ fi
+
+ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
+ for linkname
+ do
+ test "$linkname" != "$realname" \
+ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ func_execute_cmds "$postinstall_cmds" 'exit $?'
+ fi
+
+ # Install the pseudo-library for information purposes.
+ func_basename "$file"
+ name="$func_basename_result"
+ instname="$dir/$name"i
+ func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && func_append staticlibs " $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ func_basename "$file"
+ destfile="$func_basename_result"
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ func_lo2o "$destfile"
+ staticdest=$func_lo2o_result
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ func_fatal_help "cannot copy a libtool object to \`$destfile'"
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ test -n "$destfile" && \
+ func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ func_lo2o "$file"
+ staticobj=$func_lo2o_result
+ func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ func_basename "$file"
+ destfile="$func_basename_result"
+ destfile="$destdir/$destfile"
+ fi
+
+ # If the file is missing, and there is a .exe on the end, strip it
+ # because it is most likely a libtool script we actually want to
+ # install
+ stripped_ext=""
+ case $file in
+ *.exe)
+ if test ! -f "$file"; then
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ stripped_ext=".exe"
+ fi
+ ;;
+ esac
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin* | *mingw*)
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ wrapper=$func_ltwrapper_scriptname_result
+ else
+ func_stripname '' '.exe' "$file"
+ wrapper=$func_stripname_result
+ fi
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if func_ltwrapper_script_p "$wrapper"; then
+ notinst_deplibs=
+ relink_command=
+
+ func_source "$wrapper"
+
+ # Check the variables that should have been set.
+ test -z "$generated_by_libtool_version" && \
+ func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ func_source "$lib"
+ fi
+ libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ func_warning "\`$lib' has not been installed in \`$libdir'"
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ func_source "$wrapper"
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ $opt_dry_run || {
+ if test "$finalize" = yes; then
+ tmpdir=`func_mktempdir`
+ func_basename "$file$stripped_ext"
+ file="$func_basename_result"
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $opt_silent || {
+ func_quote_for_expand "$relink_command"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ if eval "$relink_command"; then :
+ else
+ func_error "error: relink \`$file' with the above command before installing it"
+ $opt_dry_run || ${RM}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ func_warning "cannot relink \`$file'"
+ fi
+ }
+ else
+ # Install the binary that we compiled earlier.
+ file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ # remove .exe since cygwin /usr/bin/install will append another
+ # one anyway
+ case $install_prog,$host in
+ */usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ func_stripname '' '.exe' "$destfile"
+ destfile=$func_stripname_result
+ ;;
+ esac
+ ;;
+ esac
+ func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+ $opt_dry_run || if test -n "$outputname"; then
+ ${RM}r "$tmpdir"
+ fi
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ func_basename "$file"
+ name="$func_basename_result"
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+ func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+ tool_oldlib=$func_to_tool_file_result
+
+ func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+ if test -n "$stripme" && test -n "$old_striplib"; then
+ func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
+ fi
+
+ # Do each command in the postinstall commands.
+ func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+ done
+
+ test -n "$future_libdirs" && \
+ func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ $opt_dry_run && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+ else
+ exit $EXIT_SUCCESS
+ fi
+}
+
+test "$opt_mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+ $opt_debug
+ my_outputname="$1"
+ my_originator="$2"
+ my_pic_p="${3-no}"
+ my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+ my_dlsyms=
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ my_dlsyms="${my_outputname}S.c"
+ else
+ func_error "not configured to extract global symbols from dlpreopened files"
+ fi
+ fi
+
+ if test -n "$my_dlsyms"; then
+ case $my_dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${my_outputname}.nm"
+
+ func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+ # Parse the name list into a source file.
+ func_verbose "creating $output_objdir/$my_dlsyms"
+
+ $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ func_verbose "generating symbol list for \`$output'"
+
+ $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ for progfile in $progfiles; do
+ func_to_tool_file "$progfile" func_convert_file_msys_to_w32
+ func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+ $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $opt_dry_run || {
+ eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $opt_dry_run || {
+ eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$outputname.exp"
+ $opt_dry_run || {
+ $RM $export_symbols
+ eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ else
+ $opt_dry_run || {
+ eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ fi
+ fi
+
+ for dlprefile in $dlprefiles; do
+ func_verbose "extracting global C symbols from \`$dlprefile'"
+ func_basename "$dlprefile"
+ name="$func_basename_result"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ # if an import library, we need to obtain dlname
+ if func_win32_import_lib_p "$dlprefile"; then
+ func_tr_sh "$dlprefile"
+ eval "curr_lafile=\$libfile_$func_tr_sh_result"
+ dlprefile_dlbasename=""
+ if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
+ # Use subshell, to avoid clobbering current variable values
+ dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
+ if test -n "$dlprefile_dlname" ; then
+ func_basename "$dlprefile_dlname"
+ dlprefile_dlbasename="$func_basename_result"
+ else
+ # no lafile. user explicitly requested -dlpreopen <import library>.
+ $sharedlib_from_linklib_cmd "$dlprefile"
+ dlprefile_dlbasename=$sharedlib_from_linklib_result
+ fi
+ fi
+ $opt_dry_run || {
+ if test -n "$dlprefile_dlbasename" ; then
+ eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
+ else
+ func_warning "Could not compute DLL name from $name"
+ eval '$ECHO ": $name " >> "$nlist"'
+ fi
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
+ $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
+ }
+ else # not an import lib
+ $opt_dry_run || {
+ eval '$ECHO ": $name " >> "$nlist"'
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
+ fi
+ ;;
+ *)
+ $opt_dry_run || {
+ eval '$ECHO ": $name " >> "$nlist"'
+ func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+ eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
+ ;;
+ esac
+ done
+
+ $opt_dry_run || {
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $MV "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if $GREP -v "^: " < "$nlist" |
+ if sort -k 3 </dev/null >/dev/null 2>&1; then
+ sort -k 3
+ else
+ sort +2
+ fi |
+ uniq > "$nlist"S; then
+ :
+ else
+ $GREP -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+ else
+ echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+ fi
+
+ echo >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols. */
+typedef struct {
+ const char *name;
+ void *address;
+} lt_dlsymlist;
+extern LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+ { \"$my_originator\", (void *) 0 },"
+
+ case $need_lib_prefix in
+ no)
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ *)
+ eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ esac
+ echo >> "$output_objdir/$my_dlsyms" "\
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ } # !$opt_dry_run
+
+ pic_flag_for_symtable=
+ case "$compile_command " in
+ *" -static "*) ;;
+ *)
+ case $host in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+ *-*-hpux*)
+ pic_flag_for_symtable=" $pic_flag" ;;
+ *)
+ if test "X$my_pic_p" != Xno; then
+ pic_flag_for_symtable=" $pic_flag"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ symtab_cflags=
+ for arg in $LTCFLAGS; do
+ case $arg in
+ -pie | -fpie | -fPIE) ;;
+ *) func_append symtab_cflags " $arg" ;;
+ esac
+ done
+
+ # Now compile the dynamic symbol file.
+ func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+ # Clean up the generated files.
+ func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+ # Transform the symbol file into the correct name.
+ symfileobj="$output_objdir/${my_outputname}S.$objext"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ if test -f "$output_objdir/$my_outputname.def"; then
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ else
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ fi
+ ;;
+ *)
+ compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+ ;;
+ esac
+ ;;
+ *)
+ func_fatal_error "unknown suffix for \`$my_dlsyms'"
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
+
+ # Nullify the symbol file.
+ compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+ finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+ fi
+}
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
+func_win32_libid ()
+{
+ $opt_debug
+ win32_libid_type="unknown"
+ win32_fileres=`file -L $1 2>/dev/null`
+ case $win32_fileres in
+ *ar\ archive\ import\ library*) # definitely import
+ win32_libid_type="x86 archive import"
+ ;;
+ *ar\ archive*) # could be an import, or static
+ # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
+ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
+ $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+ $SED -n -e '
+ 1,100{
+ / I /{
+ s,.*,import,
+ p
+ q
+ }
+ }'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
+ fi
+ ;;
+ *DLL*)
+ win32_libid_type="x86 DLL"
+ ;;
+ *executable*) # but shell scripts are "executable" too...
+ case $win32_fileres in
+ *MS\ Windows\ PE\ Intel*)
+ win32_libid_type="x86 DLL"
+ ;;
+ esac
+ ;;
+ esac
+ $ECHO "$win32_libid_type"
+}
+
+# func_cygming_dll_for_implib ARG
+#
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+# Invoked by eval'ing the libtool variable
+# $sharedlib_from_linklib_cmd
+# Result is available in the variable
+# $sharedlib_from_linklib_result
+func_cygming_dll_for_implib ()
+{
+ $opt_debug
+ sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
+}
+
+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
+#
+# The is the core of a fallback implementation of a
+# platform-specific function to extract the name of the
+# DLL associated with the specified import library LIBNAME.
+#
+# SECTION_NAME is either .idata$6 or .idata$7, depending
+# on the platform and compiler that created the implib.
+#
+# Echos the name of the DLL associated with the
+# specified import library.
+func_cygming_dll_for_implib_fallback_core ()
+{
+ $opt_debug
+ match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
+ $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
+ $SED '/^Contents of section '"$match_literal"':/{
+ # Place marker at beginning of archive member dllname section
+ s/.*/====MARK====/
+ p
+ d
+ }
+ # These lines can sometimes be longer than 43 characters, but
+ # are always uninteresting
+ /:[ ]*file format pe[i]\{,1\}-/d
+ /^In archive [^:]*:/d
+ # Ensure marker is printed
+ /^====MARK====/p
+ # Remove all lines with less than 43 characters
+ /^.\{43\}/!d
+ # From remaining lines, remove first 43 characters
+ s/^.\{43\}//' |
+ $SED -n '
+ # Join marker and all lines until next marker into a single line
+ /^====MARK====/ b para
+ H
+ $ b para
+ b
+ :para
+ x
+ s/\n//g
+ # Remove the marker
+ s/^====MARK====//
+ # Remove trailing dots and whitespace
+ s/[\. \t]*$//
+ # Print
+ /./p' |
+ # we now have a list, one entry per line, of the stringified
+ # contents of the appropriate section of all members of the
+ # archive which possess that section. Heuristic: eliminate
+ # all those which have a first or second character that is
+ # a '.' (that is, objdump's representation of an unprintable
+ # character.) This should work for all archives with less than
+ # 0x302f exports -- but will fail for DLLs whose name actually
+ # begins with a literal '.' or a single character followed by
+ # a '.'.
+ #
+ # Of those that remain, print the first one.
+ $SED -e '/^\./d;/^.\./d;q'
+}
+
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+ $opt_debug
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+ test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+ $opt_debug
+ func_to_tool_file "$1" func_convert_file_msys_to_w32
+ func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+ test -n "$func_cygming_ms_implib_tmp"
+}
+
+# func_cygming_dll_for_implib_fallback ARG
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+#
+# This fallback implementation is for use when $DLLTOOL
+# does not support the --identify-strict option.
+# Invoked by eval'ing the libtool variable
+# $sharedlib_from_linklib_cmd
+# Result is available in the variable
+# $sharedlib_from_linklib_result
+func_cygming_dll_for_implib_fallback ()
+{
+ $opt_debug
+ if func_cygming_gnu_implib_p "$1" ; then
+ # binutils import library
+ sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
+ elif func_cygming_ms_implib_p "$1" ; then
+ # ms-generated import library
+ sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
+ else
+ # unknown
+ sharedlib_from_linklib_result=""
+ fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ $opt_debug
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+ if test "$lock_old_archive_extraction" = yes; then
+ lockfile=$f_ex_an_ar_oldlib.lock
+ until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+ func_echo "Waiting for $lockfile to be removed"
+ sleep 2
+ done
+ fi
+ func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+ 'stat=$?; rm -f "$lockfile"; exit $stat'
+ if test "$lock_old_archive_extraction" = yes; then
+ $opt_dry_run || rm -f "$lockfile"
+ fi
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+ fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ $opt_debug
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+
+ for my_xlib in $my_oldlibs; do
+ # Extract the objects.
+ case $my_xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+ *) my_xabs=`pwd`"/$my_xlib" ;;
+ esac
+ func_basename "$my_xlib"
+ my_xlib="$func_basename_result"
+ my_xlib_u=$my_xlib
+ while :; do
+ case " $extracted_archives " in
+ *" $my_xlib_u "*)
+ func_arith $extracted_serial + 1
+ extracted_serial=$func_arith_result
+ my_xlib_u=lt$extracted_serial-$my_xlib ;;
+ *) break ;;
+ esac
+ done
+ extracted_archives="$extracted_archives $my_xlib_u"
+ my_xdir="$my_gentop/$my_xlib_u"
+
+ func_mkdir_p "$my_xdir"
+
+ case $host in
+ *-darwin*)
+ func_verbose "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ $opt_dry_run || {
+ darwin_orig_dir=`pwd`
+ cd $my_xdir || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`basename "$darwin_archive"`
+ darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+ cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+ cd "$darwin_curdir"
+ $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+ done # $darwin_arches
+ ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+ $LIPO -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ $RM -rf unfat-$$
+ cd "$darwin_orig_dir"
+ else
+ cd $darwin_orig_dir
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ } # !$opt_dry_run
+ ;;
+ *)
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+ done
+
+ func_extract_archives_result="$my_oldobjs"
+}
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable. Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take. If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory. This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+ func_emit_wrapper_arg1=${1-no}
+
+ $ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variables:
+ generated_by_libtool_version='$macro_version'
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$ECHO are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ file=\"\$0\""
+
+ qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+ $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+ ECHO=\"$qECHO\"
+ fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+ lt_script_arg0=\$0
+ shift
+ for lt_opt
+ do
+ case \"\$lt_opt\" in
+ --lt-debug) lt_option_debug=1 ;;
+ --lt-dump-script)
+ lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+ test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+ lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+ cat \"\$lt_dump_D/\$lt_dump_F\"
+ exit 0
+ ;;
+ --lt-*)
+ \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+ exit 1
+ ;;
+ esac
+ done
+
+ # Print the debug banner immediately:
+ if test -n \"\$lt_option_debug\"; then
+ echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+ fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+ lt_dump_args_N=1;
+ for lt_arg
+ do
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+ lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+ done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
+"
+ case $host in
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2* | *-cegcc*)
+ $ECHO "\
+ if test -n \"\$lt_option_debug\"; then
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+ func_lt_dump_args \${1+\"\$@\"} 1>&2
+ fi
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $ECHO "\
+ if test -n \"\$lt_option_debug\"; then
+ \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+ func_lt_dump_args \${1+\"\$@\"} 1>&2
+ fi
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $ECHO "\
+ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+ exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+ case \" \$* \" in
+ *\\ --lt-*)
+ for lt_wr_arg
+ do
+ case \$lt_wr_arg in
+ --lt-*) ;;
+ *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+ esac
+ shift
+ done ;;
+ esac
+ func_exec_program_core \${1+\"\$@\"}
+}
+
+ # Parse options
+ func_parse_lt_options \"\$0\" \${1+\"\$@\"}
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
+ done
+
+ # Usually 'no', except on cygwin/mingw when embedded into
+ # the cwrapper.
+ WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+ if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+ # special case for '.'
+ if test \"\$thisdir\" = \".\"; then
+ thisdir=\`pwd\`
+ fi
+ # remove .libs from thisdir
+ case \"\$thisdir\" in
+ *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
+ $objdir ) thisdir=. ;;
+ esac
+ fi
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $ECHO "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" ||
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $MKDIR \"\$progdir\"
+ else
+ $RM \"\$progdir/\$file\"
+ fi"
+
+ $ECHO "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $ECHO \"\$relink_command_output\" >&2
+ $RM \"\$progdir/\$file\"
+ exit 1
+ fi
+ fi
+
+ $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $RM \"\$progdir/\$program\";
+ $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $RM \"\$progdir/\$file\"
+ fi"
+ else
+ $ECHO "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $ECHO "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # fixup the dll searchpath if we need to.
+ #
+ # Fix the DLL searchpath if we need to. Do this before prepending
+ # to shlibpath, because on Windows, both are PATH and uninstalled
+ # libraries must come first.
+ if test -n "$dllsearchpath"; then
+ $ECHO "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $ECHO "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ $ECHO "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+ func_exec_program \${1+\"\$@\"}
+ fi
+ else
+ # The program doesn't exist.
+ \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+ \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+ \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit 1
+ fi
+fi\
+"
+}
+
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+ cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+ Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+ The $output program cannot be directly executed until all the libtool
+ libraries that it depends on are installed.
+
+ This wrapper executable should never be moved out of the build directory.
+ If it is, it will not operate correctly.
+*/
+EOF
+ cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+# include <io.h>
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat _stat
+# define chmod _chmod
+# define getcwd _getcwd
+# define putenv _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+# define _INTPTR_T_DEFINED
+# define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat _stat
+# define chmod _chmod
+# define getcwd _getcwd
+# define putenv _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+/* path handling portability macros */
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+ defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
+# ifndef DIR_SEPARATOR_2
+# define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+# define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+ if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#if defined(LT_DEBUGWRAPPER)
+static int lt_debug = 1;
+#else
+static int lt_debug = 0;
+#endif
+
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
+EOF
+
+ cat <<EOF
+volatile const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ func_to_host_path "$temp_rpath"
+ cat <<EOF
+const char * LIB_PATH_VALUE = "$func_to_host_path_result";
+EOF
+ else
+ cat <<"EOF"
+const char * LIB_PATH_VALUE = "";
+EOF
+ fi
+
+ if test -n "$dllsearchpath"; then
+ func_to_host_path "$dllsearchpath:"
+ cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE = "$func_to_host_path_result";
+EOF
+ else
+ cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE = "";
+EOF
+ fi
+
+ if test "$fast_install" = yes; then
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+ else
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+ fi
+
+
+ cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX "--lt-"
+
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
+static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
+
+int
+main (int argc, char *argv[])
+{
+ char **newargz;
+ int newargc;
+ char *tmp_pathspec;
+ char *actual_cwrapper_path;
+ char *actual_cwrapper_name;
+ char *target_name;
+ char *lt_argv_zero;
+ intptr_t rval = 127;
+
+ int i;
+
+ program_name = (char *) xstrdup (base_name (argv[0]));
+ newargz = XMALLOC (char *, argc + 1);
+
+ /* very simple arg parsing; don't want to rely on getopt
+ * also, copy all non cwrapper options to newargz, except
+ * argz[0], which is handled differently
+ */
+ newargc=0;
+ for (i = 1; i < argc; i++)
+ {
+ if (strcmp (argv[i], dumpscript_opt) == 0)
+ {
+EOF
+ case "$host" in
+ *mingw* | *cygwin* )
+ # make stdout use "unix" line endings
+ echo " setmode(1,_O_BINARY);"
+ ;;
+ esac
+
+ cat <<"EOF"
+ lt_dump_script (stdout);
+ return 0;
+ }
+ if (strcmp (argv[i], debug_opt) == 0)
+ {
+ lt_debug = 1;
+ continue;
+ }
+ if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+ {
+ /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+ namespace, but it is not one of the ones we know about and
+ have already dealt with, above (inluding dump-script), then
+ report an error. Otherwise, targets might begin to believe
+ they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+ namespace. The first time any user complains about this, we'll
+ need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+ or a configure.ac-settable value.
+ */
+ lt_fatal (__FILE__, __LINE__,
+ "unrecognized %s option: '%s'",
+ ltwrapper_option_prefix, argv[i]);
+ }
+ /* otherwise ... */
+ newargz[++newargc] = xstrdup (argv[i]);
+ }
+ newargz[++newargc] = NULL;
+
+EOF
+ cat <<EOF
+ /* The GNU banner must be the first non-error debug message */
+ lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
+EOF
+ cat <<"EOF"
+ lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
+ lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
+
+ tmp_pathspec = find_executable (argv[0]);
+ if (tmp_pathspec == NULL)
+ lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) found exe (before symlink chase) at: %s\n",
+ tmp_pathspec);
+
+ actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) found exe (after symlink chase) at: %s\n",
+ actual_cwrapper_path);
+ XFREE (tmp_pathspec);
+
+ actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
+ strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+ /* wrapper name transforms */
+ strendzap (actual_cwrapper_name, ".exe");
+ tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+ XFREE (actual_cwrapper_name);
+ actual_cwrapper_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ /* target_name transforms -- use actual target program name; might have lt- prefix */
+ target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+ strendzap (target_name, ".exe");
+ tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+ XFREE (target_name);
+ target_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) libtool target name: %s\n",
+ target_name);
+EOF
+
+ cat <<EOF
+ newargz[0] =
+ XMALLOC (char, (strlen (actual_cwrapper_path) +
+ strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+ strcpy (newargz[0], actual_cwrapper_path);
+ strcat (newargz[0], "$objdir");
+ strcat (newargz[0], "/");
+EOF
+
+ cat <<"EOF"
+ /* stop here, and copy so we don't have to do this twice */
+ tmp_pathspec = xstrdup (newargz[0]);
+
+ /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+ strcat (newargz[0], actual_cwrapper_name);
+
+ /* DO want the lt- prefix here if it exists, so use target_name */
+ lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+ XFREE (tmp_pathspec);
+ tmp_pathspec = NULL;
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ {
+ char* p;
+ while ((p = strchr (newargz[0], '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ }
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+ XFREE (target_name);
+ XFREE (actual_cwrapper_path);
+ XFREE (actual_cwrapper_name);
+
+ lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+ lt_setenv ("DUALCASE", "1"); /* for MSK sh */
+ /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
+ be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
+ because on Windows, both *_VARNAMEs are PATH but uninstalled
+ libraries must come first. */
+ lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+ lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+
+ lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
+ nonnull (lt_argv_zero));
+ for (i = 0; i < newargc; i++)
+ {
+ lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
+ i, nonnull (newargz[i]));
+ }
+
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ /* execv doesn't actually work on mingw as expected on unix */
+ newargz = prepare_spawn (newargz);
+ rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+ if (rval == -1)
+ {
+ /* failed to start process */
+ lt_debugprintf (__FILE__, __LINE__,
+ "(main) failed to launch target \"%s\": %s\n",
+ lt_argv_zero, nonnull (strerror (errno)));
+ return 127;
+ }
+ return rval;
+EOF
+ ;;
+ *)
+ cat <<"EOF"
+ execv (lt_argv_zero, newargz);
+ return rval; /* =127, but avoids unused variable warning */
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+ void *p = (void *) malloc (num);
+ if (!p)
+ lt_fatal (__FILE__, __LINE__, "memory exhausted");
+
+ return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+ return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
+ string) : NULL;
+}
+
+const char *
+base_name (const char *name)
+{
+ const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ return base;
+}
+
+int
+check_executable (const char *path)
+{
+ struct stat st;
+
+ lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
+ nonempty (path));
+ if ((!path) || (!*path))
+ return 0;
+
+ if ((stat (path, &st) >= 0)
+ && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+ return 1;
+ else
+ return 0;
+}
+
+int
+make_executable (const char *path)
+{
+ int rval = 0;
+ struct stat st;
+
+ lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+ nonempty (path));
+ if ((!path) || (!*path))
+ return 0;
+
+ if (stat (path, &st) >= 0)
+ {
+ rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+ }
+ return rval;
+}
+
+/* Searches for the full path of the wrapper. Returns
+ newly allocated full path name if found, NULL otherwise
+ Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+ int has_slash = 0;
+ const char *p;
+ const char *p_next;
+ /* static buffer for getcwd */
+ char tmp[LT_PATHMAX + 1];
+ int tmp_len;
+ char *concat_name;
+
+ lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+ nonempty (wrapper));
+
+ if ((wrapper == NULL) || (*wrapper == '\0'))
+ return NULL;
+
+ /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+ else
+ {
+#endif
+ if (IS_DIR_SEPARATOR (wrapper[0]))
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ }
+#endif
+
+ for (p = wrapper; *p; p++)
+ if (*p == '/')
+ {
+ has_slash = 1;
+ break;
+ }
+ if (!has_slash)
+ {
+ /* no slashes; search PATH */
+ const char *path = getenv ("PATH");
+ if (path != NULL)
+ {
+ for (p = path; *p; p = p_next)
+ {
+ const char *q;
+ size_t p_len;
+ for (q = p; *q; q++)
+ if (IS_PATH_SEPARATOR (*q))
+ break;
+ p_len = q - p;
+ p_next = (*q == '\0' ? q : q + 1);
+ if (p_len == 0)
+ {
+ /* empty path: current directory */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+ nonnull (strerror (errno)));
+ tmp_len = strlen (tmp);
+ concat_name =
+ XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+ }
+ else
+ {
+ concat_name =
+ XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, p, p_len);
+ concat_name[p_len] = '/';
+ strcpy (concat_name + p_len + 1, wrapper);
+ }
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ }
+ }
+ /* not found in PATH; assume curdir */
+ }
+ /* Relative path | not found in path: prepend cwd */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+ nonnull (strerror (errno)));
+ tmp_len = strlen (tmp);
+ concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+
+ if (check_executable (concat_name))
+ return concat_name;
+ XFREE (concat_name);
+ return NULL;
+}
+
+char *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+ return xstrdup (pathspec);
+#else
+ char buf[LT_PATHMAX];
+ struct stat s;
+ char *tmp_pathspec = xstrdup (pathspec);
+ char *p;
+ int has_symlinks = 0;
+ while (strlen (tmp_pathspec) && !has_symlinks)
+ {
+ lt_debugprintf (__FILE__, __LINE__,
+ "checking path component for symlinks: %s\n",
+ tmp_pathspec);
+ if (lstat (tmp_pathspec, &s) == 0)
+ {
+ if (S_ISLNK (s.st_mode) != 0)
+ {
+ has_symlinks = 1;
+ break;
+ }
+
+ /* search backwards for last DIR_SEPARATOR */
+ p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+ while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ p--;
+ if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ {
+ /* no more DIR_SEPARATORS left */
+ break;
+ }
+ *p = '\0';
+ }
+ else
+ {
+ lt_fatal (__FILE__, __LINE__,
+ "error accessing file \"%s\": %s",
+ tmp_pathspec, nonnull (strerror (errno)));
+ }
+ }
+ XFREE (tmp_pathspec);
+
+ if (!has_symlinks)
+ {
+ return xstrdup (pathspec);
+ }
+
+ tmp_pathspec = realpath (pathspec, buf);
+ if (tmp_pathspec == 0)
+ {
+ lt_fatal (__FILE__, __LINE__,
+ "could not follow symlinks for %s", pathspec);
+ }
+ return xstrdup (tmp_pathspec);
+#endif
+}
+
+char *
+strendzap (char *str, const char *pat)
+{
+ size_t len, patlen;
+
+ assert (str != NULL);
+ assert (pat != NULL);
+
+ len = strlen (str);
+ patlen = strlen (pat);
+
+ if (patlen <= len)
+ {
+ str += len - patlen;
+ if (strcmp (str, pat) == 0)
+ *str = '\0';
+ }
+ return str;
+}
+
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+ va_list args;
+ if (lt_debug)
+ {
+ (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+ va_start (args, fmt);
+ (void) vfprintf (stderr, fmt, args);
+ va_end (args);
+ }
+}
+
+static void
+lt_error_core (int exit_status, const char *file,
+ int line, const char *mode,
+ const char *message, va_list ap)
+{
+ fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
+ vfprintf (stderr, message, ap);
+ fprintf (stderr, ".\n");
+
+ if (exit_status >= 0)
+ exit (exit_status);
+}
+
+void
+lt_fatal (const char *file, int line, const char *message, ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
+ va_end (ap);
+}
+
+static const char *
+nonnull (const char *s)
+{
+ return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+ return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_setenv) setting '%s' to '%s'\n",
+ nonnull (name), nonnull (value));
+ {
+#ifdef HAVE_SETENV
+ /* always make a copy, for consistency with !HAVE_SETENV */
+ char *str = xstrdup (value);
+ setenv (name, str, 1);
+#else
+ int len = strlen (name) + 1 + strlen (value) + 1;
+ char *str = XMALLOC (char, len);
+ sprintf (str, "%s=%s", name, value);
+ if (putenv (str) != EXIT_SUCCESS)
+ {
+ XFREE (str);
+ }
+#endif
+ }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+ char *new_value;
+ if (orig_value && *orig_value)
+ {
+ int orig_value_len = strlen (orig_value);
+ int add_len = strlen (add);
+ new_value = XMALLOC (char, add_len + orig_value_len + 1);
+ if (to_end)
+ {
+ strcpy (new_value, orig_value);
+ strcpy (new_value + orig_value_len, add);
+ }
+ else
+ {
+ strcpy (new_value, add);
+ strcpy (new_value + add_len, orig_value);
+ }
+ }
+ else
+ {
+ new_value = xstrdup (add);
+ }
+ return new_value;
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+ nonnull (name), nonnull (value));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ /* some systems can't cope with a ':'-terminated path #' */
+ int len = strlen (new_value);
+ while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+ {
+ new_value[len-1] = '\0';
+ }
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+ lt_debugprintf (__FILE__, __LINE__,
+ "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+ nonnull (name), nonnull (value));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+EOF
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+ Note that spawn() does not by itself call the command interpreter
+ (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+ ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&v);
+ v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+ }) ? "cmd.exe" : "command.com").
+ Instead it simply concatenates the arguments, separated by ' ', and calls
+ CreateProcess(). We must quote the arguments since Win32 CreateProcess()
+ interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+ special way:
+ - Space and tab are interpreted as delimiters. They are not treated as
+ delimiters if they are surrounded by double quotes: "...".
+ - Unescaped double quotes are removed from the input. Their only effect is
+ that within double quotes, space and tab are treated like normal
+ characters.
+ - Backslashes not followed by double quotes are not special.
+ - But 2*n+1 backslashes followed by a double quote become
+ n backslashes followed by a double quote (n >= 0):
+ \" -> "
+ \\\" -> \"
+ \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+ size_t argc;
+ char **new_argv;
+ size_t i;
+
+ /* Count number of arguments. */
+ for (argc = 0; argv[argc] != NULL; argc++)
+ ;
+
+ /* Allocate new argument vector. */
+ new_argv = XMALLOC (char *, argc + 1);
+
+ /* Put quoted arguments into the new argument vector. */
+ for (i = 0; i < argc; i++)
+ {
+ const char *string = argv[i];
+
+ if (string[0] == '\0')
+ new_argv[i] = xstrdup ("\"\"");
+ else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+ {
+ int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+ size_t length;
+ unsigned int backslashes;
+ const char *s;
+ char *quoted_string;
+ char *p;
+
+ length = 0;
+ backslashes = 0;
+ if (quote_around)
+ length++;
+ for (s = string; *s != '\0'; s++)
+ {
+ char c = *s;
+ if (c == '"')
+ length += backslashes + 1;
+ length++;
+ if (c == '\\')
+ backslashes++;
+ else
+ backslashes = 0;
+ }
+ if (quote_around)
+ length += backslashes + 1;
+
+ quoted_string = XMALLOC (char, length + 1);
+
+ p = quoted_string;
+ backslashes = 0;
+ if (quote_around)
+ *p++ = '"';
+ for (s = string; *s != '\0'; s++)
+ {
+ char c = *s;
+ if (c == '"')
+ {
+ unsigned int j;
+ for (j = backslashes + 1; j > 0; j--)
+ *p++ = '\\';
+ }
+ *p++ = c;
+ if (c == '\\')
+ backslashes++;
+ else
+ backslashes = 0;
+ }
+ if (quote_around)
+ {
+ unsigned int j;
+ for (j = backslashes; j > 0; j--)
+ *p++ = '\\';
+ *p++ = '"';
+ }
+ *p = '\0';
+
+ new_argv[i] = quoted_string;
+ }
+ else
+ new_argv[i] = (char *) string;
+ }
+ new_argv[argc] = NULL;
+
+ return new_argv;
+}
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+ func_emit_wrapper yes |
+ $SED -n -e '
+s/^\(.\{79\}\)\(..*\)/\1\
+\2/
+h
+s/\([\\"]\)/\\\1/g
+s/$/\\n/
+s/\([^\n]*\).*/ fputs ("\1", f);/p
+g
+D'
+ cat <<"EOF"
+}
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+ $opt_debug
+ case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+ *import*) : ;;
+ *) false ;;
+ esac
+}
+
+# func_mode_link arg...
+func_mode_link ()
+{
+ $opt_debug
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ # It is impossible to link a dll without this setting, and
+ # we shouldn't force the makefile maintainer to figure out
+ # which system we are compiling for in order to pass an extra
+ # flag for every libtool invocation.
+ # allow_undefined=no
+
+ # FIXME: Unfortunately, there are problems with the above when trying
+ # to make a dll which has undefined symbols, in which case not
+ # even a static library is built. For now, we need to specify
+ # -no-undefined on the libtool link line when we can be certain
+ # that all symbols are satisfied, otherwise we get a static library.
+ allow_undefined=yes
+ ;;
+ *)
+ allow_undefined=yes
+ ;;
+ esac
+ libtool_args=$nonopt
+ base_compile="$nonopt $@"
+ compile_command=$nonopt
+ finalize_command=$nonopt
+
+ compile_rpath=
+ finalize_rpath=
+ compile_shlibpath=
+ finalize_shlibpath=
+ convenience=
+ old_convenience=
+ deplibs=
+ old_deplibs=
+ compiler_flags=
+ linker_flags=
+ dllsearchpath=
+ lib_search_path=`pwd`
+ inst_prefix_dir=
+ new_inherited_linker_flags=
+
+ avoid_version=no
+ bindir=
+ dlfiles=
+ dlprefiles=
+ dlself=no
+ export_dynamic=no
+ export_symbols=
+ export_symbols_regex=
+ generated=
+ libobjs=
+ ltlibs=
+ module=no
+ no_install=no
+ objs=
+ non_pic_objects=
+ precious_files_regex=
+ prefer_static_libs=no
+ preload=no
+ prev=
+ prevarg=
+ release=
+ rpath=
+ xrpath=
+ perm_rpath=
+ temp_rpath=
+ thread_safe=no
+ vinfo=
+ vinfo_number=no
+ weak_libs=
+ single_module="${wl}-single_module"
+ func_infer_tag $base_compile
+
+ # We need to know -static, to get the right output filenames.
+ for arg
+ do
+ case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ break
+ ;;
+ -all-static | -static | -static-libtool-libs)
+ case $arg in
+ -all-static)
+ if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+ func_warning "complete static linking is impossible in this configuration"
+ fi
+ if test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ -static)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=built
+ ;;
+ -static-libtool-libs)
+ if test -z "$pic_flag" && test -n "$link_static_flag"; then
+ dlopen_self=$dlopen_self_static
+ fi
+ prefer_static_libs=yes
+ ;;
+ esac
+ build_libtool_libs=no
+ build_old_libs=yes
+ break
+ ;;
+ esac
+ done
+
+ # See if our shared archives depend on static archives.
+ test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+ # Go through the arguments, transforming them on the way.
+ while test "$#" -gt 0; do
+ arg="$1"
+ shift
+ func_quote_for_eval "$arg"
+ qarg=$func_quote_for_eval_unquoted_result
+ func_append libtool_args " $func_quote_for_eval_result"
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ output)
+ func_append compile_command " @OUTPUT@"
+ func_append finalize_command " @OUTPUT@"
+ ;;
+ esac
+
+ case $prev in
+ bindir)
+ bindir="$arg"
+ prev=
+ continue
+ ;;
+ dlfiles|dlprefiles)
+ if test "$preload" = no; then
+ # Add the symbol object into the linking commands.
+ func_append compile_command " @SYMFILE@"
+ func_append finalize_command " @SYMFILE@"
+ preload=yes
+ fi
+ case $arg in
+ *.la | *.lo) ;; # We handle these cases below.
+ force)
+ if test "$dlself" = no; then
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ self)
+ if test "$prev" = dlprefiles; then
+ dlself=yes
+ elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+ dlself=yes
+ else
+ dlself=needless
+ export_dynamic=yes
+ fi
+ prev=
+ continue
+ ;;
+ *)
+ if test "$prev" = dlfiles; then
+ func_append dlfiles " $arg"
+ else
+ func_append dlprefiles " $arg"
+ fi
+ prev=
+ continue
+ ;;
+ esac
+ ;;
+ expsyms)
+ export_symbols="$arg"
+ test -f "$arg" \
+ || func_fatal_error "symbol file \`$arg' does not exist"
+ prev=
+ continue
+ ;;
+ expsyms_regex)
+ export_symbols_regex="$arg"
+ prev=
+ continue
+ ;;
+ framework)
+ case $host in
+ *-*-darwin*)
+ case "$deplibs " in
+ *" $qarg.ltframework "*) ;;
+ *) func_append deplibs " $qarg.ltframework" # this is fixed later
+ ;;
+ esac
+ ;;
+ esac
+ prev=
+ continue
+ ;;
+ inst_prefix)
+ inst_prefix_dir="$arg"
+ prev=
+ continue
+ ;;
+ objectlist)
+ if test -f "$arg"; then
+ save_arg=$arg
+ moreargs=
+ for fil in `cat "$save_arg"`
+ do
+# func_append moreargs " $fil"
+ arg=$fil
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if func_lalib_unsafe_p "$arg"; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ func_source "$arg"
+
+ if test -z "$pic_object" ||
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none &&
+ test "$non_pic_object" = none; then
+ func_fatal_error "cannot find name of object for \`$arg'"
+ fi
+
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ func_append dlfiles " $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ func_append dlprefiles " $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ func_append libobjs " $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ func_append non_pic_objects " $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if $opt_dry_run; then
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
+ fi
+ fi
+ done
+ else
+ func_fatal_error "link input file \`$arg' does not exist"
+ fi
+ arg=$save_arg
+ prev=
+ continue
+ ;;
+ precious_regex)
+ precious_files_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
+ prev=
+ continue
+ ;;
+ rpath | xrpath)
+ # We need an absolute path.
+ case $arg in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ func_fatal_error "only absolute run-paths are allowed"
+ ;;
+ esac
+ if test "$prev" = rpath; then
+ case "$rpath " in
+ *" $arg "*) ;;
+ *) func_append rpath " $arg" ;;
+ esac
+ else
+ case "$xrpath " in
+ *" $arg "*) ;;
+ *) func_append xrpath " $arg" ;;
+ esac
+ fi
+ prev=
+ continue
+ ;;
+ shrext)
+ shrext_cmds="$arg"
+ prev=
+ continue
+ ;;
+ weak)
+ func_append weak_libs " $arg"
+ prev=
+ continue
+ ;;
+ xcclinker)
+ func_append linker_flags " $qarg"
+ func_append compiler_flags " $qarg"
+ prev=
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
+ continue
+ ;;
+ xcompiler)
+ func_append compiler_flags " $qarg"
+ prev=
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
+ continue
+ ;;
+ xlinker)
+ func_append linker_flags " $qarg"
+ func_append compiler_flags " $wl$qarg"
+ prev=
+ func_append compile_command " $wl$qarg"
+ func_append finalize_command " $wl$qarg"
+ continue
+ ;;
+ *)
+ eval "$prev=\"\$arg\""
+ prev=
+ continue
+ ;;
+ esac
+ fi # test -n "$prev"
+
+ prevarg="$arg"
+
+ case $arg in
+ -all-static)
+ if test -n "$link_static_flag"; then
+ # See comment for -static flag below, for more details.
+ func_append compile_command " $link_static_flag"
+ func_append finalize_command " $link_static_flag"
+ fi
+ continue
+ ;;
+
+ -allow-undefined)
+ # FIXME: remove this flag sometime in the future.
+ func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+ ;;
+
+ -avoid-version)
+ avoid_version=yes
+ continue
+ ;;
+
+ -bindir)
+ prev=bindir
+ continue
+ ;;
+
+ -dlopen)
+ prev=dlfiles
+ continue
+ ;;
+
+ -dlpreopen)
+ prev=dlprefiles
+ continue
+ ;;
+
+ -export-dynamic)
+ export_dynamic=yes
+ continue
+ ;;
+
+ -export-symbols | -export-symbols-regex)
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ func_fatal_error "more than one -exported-symbols argument is not allowed"
+ fi
+ if test "X$arg" = "X-export-symbols"; then
+ prev=expsyms
+ else
+ prev=expsyms_regex
+ fi
+ continue
+ ;;
+
+ -framework)
+ prev=framework
+ continue
+ ;;
+
+ -inst-prefix-dir)
+ prev=inst_prefix
+ continue
+ ;;
+
+ # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+ # so, if we see these flags be careful not to treat them like -L
+ -L[A-Z][A-Z]*:*)
+ case $with_gcc/$host in
+ no/*-*-irix* | /*-*-irix*)
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ ;;
+ esac
+ continue
+ ;;
+
+ -L*)
+ func_stripname "-L" '' "$arg"
+ if test -z "$func_stripname_result"; then
+ if test "$#" -gt 0; then
+ func_fatal_error "require no space between \`-L' and \`$1'"
+ else
+ func_fatal_error "need path for \`-L' option"
+ fi
+ fi
+ func_resolve_sysroot "$func_stripname_result"
+ dir=$func_resolve_sysroot_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ test -z "$absdir" && \
+ func_fatal_error "cannot determine absolute directory name of \`$dir'"
+ dir="$absdir"
+ ;;
+ esac
+ case "$deplibs " in
+ *" -L$dir "* | *" $arg "*)
+ # Will only happen for absolute or sysroot arguments
+ ;;
+ *)
+ # Preserve sysroot, but never include relative directories
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
+ *) func_append deplibs " -L$dir" ;;
+ esac
+ func_append lib_search_path " $dir"
+ ;;
+ esac
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$dir:"*) ;;
+ ::) dllsearchpath=$dir;;
+ *) func_append dllsearchpath ":$dir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
+ *) func_append dllsearchpath ":$testbindir";;
+ esac
+ ;;
+ esac
+ continue
+ ;;
+
+ -l*)
+ if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ # These systems don't actually have a C or math library (as such)
+ continue
+ ;;
+ *-*-os2*)
+ # These systems don't actually have a C library (as such)
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C and math libraries are in the System framework
+ func_append deplibs " System.ltframework"
+ continue
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ test "X$arg" = "X-lc" && continue
+ ;;
+ esac
+ elif test "X$arg" = "X-lc_r"; then
+ case $host in
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc_r directly, use -pthread flag.
+ continue
+ ;;
+ esac
+ fi
+ func_append deplibs " $arg"
+ continue
+ ;;
+
+ -module)
+ module=yes
+ continue
+ ;;
+
+ # Tru64 UNIX uses -model [arg] to determine the layout of C++
+ # classes, name mangling, and exception handling.
+ # Darwin uses the -arch flag to determine output architecture.
+ -model|-arch|-isysroot|--sysroot)
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ prev=xcompiler
+ continue
+ ;;
+
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ case "$new_inherited_linker_flags " in
+ *" $arg "*) ;;
+ * ) func_append new_inherited_linker_flags " $arg" ;;
+ esac
+ continue
+ ;;
+
+ -multi_module)
+ single_module="${wl}-multi_module"
+ continue
+ ;;
+
+ -no-fast-install)
+ fast_install=no
+ continue
+ ;;
+
+ -no-install)
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+ # The PATH hackery in wrapper scripts is required on Windows
+ # and Darwin in order for the loader to find any dlls it needs.
+ func_warning "\`-no-install' is ignored for $host"
+ func_warning "assuming \`-no-fast-install' instead"
+ fast_install=no
+ ;;
+ *) no_install=yes ;;
+ esac
+ continue
+ ;;
+
+ -no-undefined)
+ allow_undefined=no
+ continue
+ ;;
+
+ -objectlist)
+ prev=objectlist
+ continue
+ ;;
+
+ -o) prev=output ;;
+
+ -precious-files-regex)
+ prev=precious_regex
+ continue
+ ;;
+
+ -release)
+ prev=release
+ continue
+ ;;
+
+ -rpath)
+ prev=rpath
+ continue
+ ;;
+
+ -R)
+ prev=xrpath
+ continue
+ ;;
+
+ -R*)
+ func_stripname '-R' '' "$arg"
+ dir=$func_stripname_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ =*)
+ func_stripname '=' '' "$dir"
+ dir=$lt_sysroot$func_stripname_result
+ ;;
+ *)
+ func_fatal_error "only absolute run-paths are allowed"
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) func_append xrpath " $dir" ;;
+ esac
+ continue
+ ;;
+
+ -shared)
+ # The effects of -shared are defined in a previous loop.
+ continue
+ ;;
+
+ -shrext)
+ prev=shrext
+ continue
+ ;;
+
+ -static | -static-libtool-libs)
+ # The effects of -static are defined in a previous loop.
+ # We used to do the same as -all-static on platforms that
+ # didn't have a PIC flag, but the assumption that the effects
+ # would be equivalent was wrong. It would break on at least
+ # Digital Unix and AIX.
+ continue
+ ;;
+
+ -thread-safe)
+ thread_safe=yes
+ continue
+ ;;
+
+ -version-info)
+ prev=vinfo
+ continue
+ ;;
+
+ -version-number)
+ prev=vinfo
+ vinfo_number=yes
+ continue
+ ;;
+
+ -weak)
+ prev=weak
+ continue
+ ;;
+
+ -Wc,*)
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ func_quote_for_eval "$flag"
+ func_append arg " $func_quote_for_eval_result"
+ func_append compiler_flags " $func_quote_for_eval_result"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
+ ;;
+
+ -Wl,*)
+ func_stripname '-Wl,' '' "$arg"
+ args=$func_stripname_result
+ arg=
+ save_ifs="$IFS"; IFS=','
+ for flag in $args; do
+ IFS="$save_ifs"
+ func_quote_for_eval "$flag"
+ func_append arg " $wl$func_quote_for_eval_result"
+ func_append compiler_flags " $wl$func_quote_for_eval_result"
+ func_append linker_flags " $func_quote_for_eval_result"
+ done
+ IFS="$save_ifs"
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
+ ;;
+
+ -Xcompiler)
+ prev=xcompiler
+ continue
+ ;;
+
+ -Xlinker)
+ prev=xlinker
+ continue
+ ;;
+
+ -XCClinker)
+ prev=xcclinker
+ continue
+ ;;
+
+ # -msg_* for osf cc
+ -msg_*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+
+ # Flags to be passed through unchanged, with rationale:
+ # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
+ # -r[0-9][0-9]* specify processor for the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+ # +DA*, +DD* enable 64-bit mode for the HP compiler
+ # -q* compiler args for the IBM compiler
+ # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+ # -F/path path to uninstalled frameworks, gcc on darwin
+ # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
+ # @file GCC response files
+ # -tp=* Portland pgcc target processor selection
+ # --sysroot=* for sysroot support
+ # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+ -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ func_append compiler_flags " $arg"
+ continue
+ ;;
+
+ # Some other compiler flag.
+ -* | +*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+
+ *.$objext)
+ # A standard object.
+ func_append objs " $arg"
+ ;;
+
+ *.lo)
+ # A libtool-controlled object.
+
+ # Check to see that this really is a libtool object.
+ if func_lalib_unsafe_p "$arg"; then
+ pic_object=
+ non_pic_object=
+
+ # Read the .lo file
+ func_source "$arg"
+
+ if test -z "$pic_object" ||
+ test -z "$non_pic_object" ||
+ test "$pic_object" = none &&
+ test "$non_pic_object" = none; then
+ func_fatal_error "cannot find name of object for \`$arg'"
+ fi
+
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ if test "$pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ pic_object="$xdir$pic_object"
+
+ if test "$prev" = dlfiles; then
+ if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+ func_append dlfiles " $pic_object"
+ prev=
+ continue
+ else
+ # If libtool objects are unsupported, then we need to preload.
+ prev=dlprefiles
+ fi
+ fi
+
+ # CHECK ME: I think I busted this. -Ossama
+ if test "$prev" = dlprefiles; then
+ # Preload the old-style object.
+ func_append dlprefiles " $pic_object"
+ prev=
+ fi
+
+ # A PIC object.
+ func_append libobjs " $pic_object"
+ arg="$pic_object"
+ fi
+
+ # Non-PIC object.
+ if test "$non_pic_object" != none; then
+ # Prepend the subdirectory the object is found in.
+ non_pic_object="$xdir$non_pic_object"
+
+ # A standard non-PIC object
+ func_append non_pic_objects " $non_pic_object"
+ if test -z "$pic_object" || test "$pic_object" = none ; then
+ arg="$non_pic_object"
+ fi
+ else
+ # If the PIC object exists, use it instead.
+ # $xdir was prepended to $pic_object above.
+ non_pic_object="$pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ fi
+ else
+ # Only an error if not doing a dry-run.
+ if $opt_dry_run; then
+ # Extract subdirectory from the argument.
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
+ fi
+ fi
+ ;;
+
+ *.$libext)
+ # An archive.
+ func_append deplibs " $arg"
+ func_append old_deplibs " $arg"
+ continue
+ ;;
+
+ *.la)
+ # A libtool-controlled library.
+
+ func_resolve_sysroot "$arg"
+ if test "$prev" = dlfiles; then
+ # This library was specified with -dlopen.
+ func_append dlfiles " $func_resolve_sysroot_result"
+ prev=
+ elif test "$prev" = dlprefiles; then
+ # The library was specified with -dlpreopen.
+ func_append dlprefiles " $func_resolve_sysroot_result"
+ prev=
+ else
+ func_append deplibs " $func_resolve_sysroot_result"
+ fi
+ continue
+ ;;
+
+ # Some other compiler argument.
+ *)
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+ esac # arg
+
+ # Now actually substitute the argument into the commands.
+ if test -n "$arg"; then
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ fi
+ done # argument parsing loop
+
+ test -n "$prev" && \
+ func_fatal_help "the \`$prevarg' option requires an argument"
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+ eval arg=\"$export_dynamic_flag_spec\"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ fi
+
+ oldlibs=
+ # calculate the name of the file, without its directory
+ func_basename "$output"
+ outputname="$func_basename_result"
+ libobjs_save="$libobjs"
+
+ if test -n "$shlibpath_var"; then
+ # get the directories listed in $shlibpath_var
+ eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+ else
+ shlib_search_path=
+ fi
+ eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+ eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+ func_dirname "$output" "/" ""
+ output_objdir="$func_dirname_result$objdir"
+ func_to_tool_file "$output_objdir/"
+ tool_output_objdir=$func_to_tool_file_result
+ # Create the object directory.
+ func_mkdir_p "$output_objdir"
+
+ # Determine the type of output
+ case $output in
+ "")
+ func_fatal_help "you must specify an output file"
+ ;;
+ *.$libext) linkmode=oldlib ;;
+ *.lo | *.$objext) linkmode=obj ;;
+ *.la) linkmode=lib ;;
+ *) linkmode=prog ;; # Anything else should be a program.
+ esac
+
+ specialdeplibs=
+
+ libs=
+ # Find all interdependent deplibs by searching for libraries
+ # that are linked more than once (e.g. -la -lb -la)
+ for deplib in $deplibs; do
+ if $opt_preserve_dup_deps ; then
+ case "$libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append libs " $deplib"
+ done
+
+ if test "$linkmode" = lib; then
+ libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+ # Compute libraries that are listed more than once in $predeps
+ # $postdeps and mark them as special (i.e., whose duplicates are
+ # not to be eliminated).
+ pre_post_deps=
+ if $opt_duplicate_compiler_generated_deps; then
+ for pre_post_dep in $predeps $postdeps; do
+ case "$pre_post_deps " in
+ *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+ esac
+ func_append pre_post_deps " $pre_post_dep"
+ done
+ fi
+ pre_post_deps=
+ fi
+
+ deplibs=
+ newdependency_libs=
+ newlib_search_path=
+ need_relink=no # whether we're linking any uninstalled libtool libraries
+ notinst_deplibs= # not-installed libtool libraries
+ notinst_path= # paths that contain not-installed libtool libraries
+
+ case $linkmode in
+ lib)
+ passes="conv dlpreopen link"
+ for file in $dlfiles $dlprefiles; do
+ case $file in
+ *.la) ;;
+ *)
+ func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+ ;;
+ esac
+ done
+ ;;
+ prog)
+ compile_deplibs=
+ finalize_deplibs=
+ alldeplibs=no
+ newdlfiles=
+ newdlprefiles=
+ passes="conv scan dlopen dlpreopen link"
+ ;;
+ *) passes="conv"
+ ;;
+ esac
+
+ for pass in $passes; do
+ # The preopen pass in lib mode reverses $deplibs; put it back here
+ # so that -L comes before libs that need it for instance...
+ if test "$linkmode,$pass" = "lib,link"; then
+ ## FIXME: Find the place where the list is rebuilt in the wrong
+ ## order, and fix it there properly
+ tmp_deplibs=
+ for deplib in $deplibs; do
+ tmp_deplibs="$deplib $tmp_deplibs"
+ done
+ deplibs="$tmp_deplibs"
+ fi
+
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan"; then
+ libs="$deplibs"
+ deplibs=
+ fi
+ if test "$linkmode" = prog; then
+ case $pass in
+ dlopen) libs="$dlfiles" ;;
+ dlpreopen) libs="$dlprefiles" ;;
+ link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ esac
+ fi
+ if test "$linkmode,$pass" = "lib,dlpreopen"; then
+ # Collect and forward deplibs of preopened libtool libs
+ for lib in $dlprefiles; do
+ # Ignore non-libtool-libs
+ dependency_libs=
+ func_resolve_sysroot "$lib"
+ case $lib in
+ *.la) func_source "$func_resolve_sysroot_result" ;;
+ esac
+
+ # Collect preopened libtool deplibs, except any this library
+ # has declared as weak libs
+ for deplib in $dependency_libs; do
+ func_basename "$deplib"
+ deplib_base=$func_basename_result
+ case " $weak_libs " in
+ *" $deplib_base "*) ;;
+ *) func_append deplibs " $deplib" ;;
+ esac
+ done
+ done
+ libs="$dlprefiles"
+ fi
+ if test "$pass" = dlopen; then
+ # Collect dlpreopened libraries
+ save_deplibs="$deplibs"
+ deplibs=
+ fi
+
+ for deplib in $libs; do
+ lib=
+ found=no
+ case $deplib in
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ func_append compiler_flags " $deplib"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) func_append new_inherited_linker_flags " $deplib" ;;
+ esac
+ fi
+ fi
+ continue
+ ;;
+ -l*)
+ if test "$linkmode" != lib && test "$linkmode" != prog; then
+ func_warning "\`-l' is ignored for archives/objects"
+ continue
+ fi
+ func_stripname '-l' '' "$deplib"
+ name=$func_stripname_result
+ if test "$linkmode" = lib; then
+ searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+ else
+ searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+ fi
+ for searchdir in $searchdirs; do
+ for search_ext in .la $std_shrext .so .a; do
+ # Search the libtool library
+ lib="$searchdir/lib${name}${search_ext}"
+ if test -f "$lib"; then
+ if test "$search_ext" = ".la"; then
+ found=yes
+ else
+ found=no
+ fi
+ break 2
+ fi
+ done
+ done
+ if test "$found" != yes; then
+ # deplib doesn't seem to be a libtool library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ else # deplib is a libtool library
+ # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+ # We need to do some special things here, and not later.
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $deplib "*)
+ if func_lalib_p "$lib"; then
+ library_names=
+ old_library=
+ func_source "$lib"
+ for l in $old_library $library_names; do
+ ll="$l"
+ done
+ if test "X$ll" = "X$old_library" ; then # only static version available
+ found=no
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
+ lib=$ladir/$old_library
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+ fi
+ continue
+ fi
+ fi
+ ;;
+ *) ;;
+ esac
+ fi
+ fi
+ ;; # -l
+ *.ltframework)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) func_append new_inherited_linker_flags " $deplib" ;;
+ esac
+ fi
+ fi
+ continue
+ ;;
+ -L*)
+ case $linkmode in
+ lib)
+ deplibs="$deplib $deplibs"
+ test "$pass" = conv && continue
+ newdependency_libs="$deplib $newdependency_libs"
+ func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ prog)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ if test "$pass" = scan; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ *)
+ func_warning "\`-L' is ignored for archives/objects"
+ ;;
+ esac # linkmode
+ continue
+ ;; # -L
+ -R*)
+ if test "$pass" = link; then
+ func_stripname '-R' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ dir=$func_resolve_sysroot_result
+ # Make sure the xrpath contains only unique directories.
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) func_append xrpath " $dir" ;;
+ esac
+ fi
+ deplibs="$deplib $deplibs"
+ continue
+ ;;
+ *.la)
+ func_resolve_sysroot "$deplib"
+ lib=$func_resolve_sysroot_result
+ ;;
+ *.$libext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ continue
+ fi
+ case $linkmode in
+ lib)
+ # Linking convenience modules into shared libraries is allowed,
+ # but linking other static libraries is non-portable.
+ case " $dlpreconveniencelibs " in
+ *" $deplib "*) ;;
+ *)
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ valid_a_lib=yes
+ fi
+ ;;
+ pass_all)
+ valid_a_lib=yes
+ ;;
+ esac
+ if test "$valid_a_lib" != yes; then
+ echo
+ $ECHO "*** Warning: Trying to link with static lib archive $deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because the file extensions .$libext of this argument makes me believe"
+ echo "*** that it is just a static archive that I should not use here."
+ else
+ echo
+ $ECHO "*** Warning: Linking the shared library $output against the"
+ $ECHO "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
+ ;;
+ esac
+ continue
+ ;;
+ prog)
+ if test "$pass" != link; then
+ deplibs="$deplib $deplibs"
+ else
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ fi
+ continue
+ ;;
+ esac # linkmode
+ ;; # *.$libext
+ *.lo | *.$objext)
+ if test "$pass" = conv; then
+ deplibs="$deplib $deplibs"
+ elif test "$linkmode" = prog; then
+ if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+ # If there is no dlopen support or we're linking statically,
+ # we need to preload.
+ func_append newdlprefiles " $deplib"
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ func_append newdlfiles " $deplib"
+ fi
+ fi
+ continue
+ ;;
+ %DEPLIBS%)
+ alldeplibs=yes
+ continue
+ ;;
+ esac # case $deplib
+
+ if test "$found" = yes || test -f "$lib"; then :
+ else
+ func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+ fi
+
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$lib" \
+ || func_fatal_error "\`$lib' is not a valid libtool archive"
+
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
+
+ dlname=
+ dlopen=
+ dlpreopen=
+ libdir=
+ library_names=
+ old_library=
+ inherited_linker_flags=
+ # If the library was installed with an old release of libtool,
+ # it will not redefine variables installed, or shouldnotlink
+ installed=yes
+ shouldnotlink=no
+ avoidtemprpath=
+
+
+ # Read the .la file
+ func_source "$lib"
+
+ # Convert "-framework foo" to "foo.ltframework"
+ if test -n "$inherited_linker_flags"; then
+ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+ for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+ case " $new_inherited_linker_flags " in
+ *" $tmp_inherited_linker_flag "*) ;;
+ *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
+ esac
+ done
+ fi
+ dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ if test "$linkmode,$pass" = "lib,link" ||
+ test "$linkmode,$pass" = "prog,scan" ||
+ { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+ test -n "$dlopen" && func_append dlfiles " $dlopen"
+ test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+ fi
+
+ if test "$pass" = conv; then
+ # Only check for convenience libraries
+ deplibs="$lib $deplibs"
+ if test -z "$libdir"; then
+ if test -z "$old_library"; then
+ func_fatal_error "cannot find name of link library for \`$lib'"
+ fi
+ # It is a libtool convenience library, so add in its objects.
+ func_append convenience " $ladir/$objdir/$old_library"
+ func_append old_convenience " $ladir/$objdir/$old_library"
+ elif test "$linkmode" != prog && test "$linkmode" != lib; then
+ func_fatal_error "\`$lib' is not a convenience library"
+ fi
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append tmp_libs " $deplib"
+ done
+ continue
+ fi # $pass = conv
+
+
+ # Get the name of the library we link against.
+ linklib=
+ if test -n "$old_library" &&
+ { test "$prefer_static_libs" = yes ||
+ test "$prefer_static_libs,$installed" = "built,no"; }; then
+ linklib=$old_library
+ else
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
+ fi
+ if test -z "$linklib"; then
+ func_fatal_error "cannot find name of link library for \`$lib'"
+ fi
+
+ # This library was specified with -dlopen.
+ if test "$pass" = dlopen; then
+ if test -z "$libdir"; then
+ func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+ fi
+ if test -z "$dlname" ||
+ test "$dlopen_support" != yes ||
+ test "$build_libtool_libs" = no; then
+ # If there is no dlname, no dlopen support or we're linking
+ # statically, we need to preload. We also need to preload any
+ # dependent libraries so libltdl's deplib preloader doesn't
+ # bomb out in the load deplibs phase.
+ func_append dlprefiles " $lib $dependency_libs"
+ else
+ func_append newdlfiles " $lib"
+ fi
+ continue
+ fi # $pass = dlopen
+
+ # We need an absolute path.
+ case $ladir in
+ [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+ *)
+ abs_ladir=`cd "$ladir" && pwd`
+ if test -z "$abs_ladir"; then
+ func_warning "cannot determine absolute directory name of \`$ladir'"
+ func_warning "passing it literally to the linker, although it might fail"
+ abs_ladir="$ladir"
+ fi
+ ;;
+ esac
+ func_basename "$lib"
+ laname="$func_basename_result"
+
+ # Find the relevant object directory and library name.
+ if test "X$installed" = Xyes; then
+ if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ func_warning "library \`$lib' was moved."
+ dir="$ladir"
+ absdir="$abs_ladir"
+ libdir="$abs_ladir"
+ else
+ dir="$lt_sysroot$libdir"
+ absdir="$lt_sysroot$libdir"
+ fi
+ test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+ else
+ if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ dir="$ladir"
+ absdir="$abs_ladir"
+ # Remove this search path later
+ func_append notinst_path " $abs_ladir"
+ else
+ dir="$ladir/$objdir"
+ absdir="$abs_ladir/$objdir"
+ # Remove this search path later
+ func_append notinst_path " $abs_ladir"
+ fi
+ fi # $installed = yes
+ func_stripname 'lib' '.la' "$laname"
+ name=$func_stripname_result
+
+ # This library was specified with -dlpreopen.
+ if test "$pass" = dlpreopen; then
+ if test -z "$libdir" && test "$linkmode" = prog; then
+ func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+ fi
+ case "$host" in
+ # special handling for platforms with PE-DLLs.
+ *cygwin* | *mingw* | *cegcc* )
+ # Linker will automatically link against shared library if both
+ # static and shared are present. Therefore, ensure we extract
+ # symbols from the import library if a shared library is present
+ # (otherwise, the dlopen module name will be incorrect). We do
+ # this by putting the import library name into $newdlprefiles.
+ # We recover the dlopen module name by 'saving' the la file
+ # name in a special purpose variable, and (later) extracting the
+ # dlname from the la file.
+ if test -n "$dlname"; then
+ func_tr_sh "$dir/$linklib"
+ eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
+ func_append newdlprefiles " $dir/$linklib"
+ else
+ func_append newdlprefiles " $dir/$old_library"
+ # Keep a list of preopened convenience libraries to check
+ # that they are being used correctly in the link pass.
+ test -z "$libdir" && \
+ func_append dlpreconveniencelibs " $dir/$old_library"
+ fi
+ ;;
+ * )
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ func_append newdlprefiles " $dir/$old_library"
+ # Keep a list of preopened convenience libraries to check
+ # that they are being used correctly in the link pass.
+ test -z "$libdir" && \
+ func_append dlpreconveniencelibs " $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ func_append newdlprefiles " $dir/$dlname"
+ else
+ func_append newdlprefiles " $dir/$linklib"
+ fi
+ ;;
+ esac
+ fi # $pass = dlpreopen
+
+ if test -z "$libdir"; then
+ # Link the convenience library
+ if test "$linkmode" = lib; then
+ deplibs="$dir/$old_library $deplibs"
+ elif test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$dir/$old_library $compile_deplibs"
+ finalize_deplibs="$dir/$old_library $finalize_deplibs"
+ else
+ deplibs="$lib $deplibs" # used for prog,scan pass
+ fi
+ continue
+ fi
+
+
+ if test "$linkmode" = prog && test "$pass" != link; then
+ func_append newlib_search_path " $ladir"
+ deplibs="$lib $deplibs"
+
+ linkalldeplibs=no
+ if test "$link_all_deplibs" != no || test -z "$library_names" ||
+ test "$build_libtool_libs" = no; then
+ linkalldeplibs=yes
+ fi
+
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ -L*) func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result"
+ func_append newlib_search_path " $func_resolve_sysroot_result"
+ ;;
+ esac
+ # Need to link against all dependency_libs?
+ if test "$linkalldeplibs" = yes; then
+ deplibs="$deplib $deplibs"
+ else
+ # Need to hardcode shared library paths
+ # or/and link against static libraries
+ newdependency_libs="$deplib $newdependency_libs"
+ fi
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ esac
+ fi
+ func_append tmp_libs " $deplib"
+ done # for deplib
+ continue
+ fi # $linkmode = prog...
+
+ if test "$linkmode,$pass" = "prog,link"; then
+ if test -n "$library_names" &&
+ { { test "$prefer_static_libs" = no ||
+ test "$prefer_static_libs,$installed" = "built,yes"; } ||
+ test -z "$old_library"; }; then
+ # We need to hardcode the library path
+ if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+ # Make sure the rpath contains only unique directories.
+ case "$temp_rpath:" in
+ *"$absdir:"*) ;;
+ *) func_append temp_rpath "$absdir:" ;;
+ esac
+ fi
+
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) func_append compile_rpath " $absdir" ;;
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ ;;
+ esac
+ fi # $linkmode,$pass = prog,link...
+
+ if test "$alldeplibs" = yes &&
+ { test "$deplibs_check_method" = pass_all ||
+ { test "$build_libtool_libs" = yes &&
+ test -n "$library_names"; }; }; then
+ # We only need to search for static libraries
+ continue
+ fi
+ fi
+
+ link_static=no # Whether the deplib will be linked statically
+ use_static_libs=$prefer_static_libs
+ if test "$use_static_libs" = built && test "$installed" = yes; then
+ use_static_libs=no
+ fi
+ if test -n "$library_names" &&
+ { test "$use_static_libs" = no || test -z "$old_library"; }; then
+ case $host in
+ *cygwin* | *mingw* | *cegcc*)
+ # No point in relinking DLLs because paths are not encoded
+ func_append notinst_deplibs " $lib"
+ need_relink=no
+ ;;
+ *)
+ if test "$installed" = no; then
+ func_append notinst_deplibs " $lib"
+ need_relink=yes
+ fi
+ ;;
+ esac
+ # This is a shared library
+
+ # Warn about portability, can't link against -module's on some
+ # systems (darwin). Don't bleat about dlopened modules though!
+ dlopenmodule=""
+ for dlpremoduletest in $dlprefiles; do
+ if test "X$dlpremoduletest" = "X$lib"; then
+ dlopenmodule="$dlpremoduletest"
+ break
+ fi
+ done
+ if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+ echo
+ if test "$linkmode" = prog; then
+ $ECHO "*** Warning: Linking the executable $output against the loadable module"
+ else
+ $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+ fi
+ $ECHO "*** $linklib is not portable!"
+ fi
+ if test "$linkmode" = lib &&
+ test "$hardcode_into_libs" = yes; then
+ # Hardcode the library path.
+ # Skip directories that are in the system default run-time
+ # search path.
+ case " $sys_lib_dlsearch_path " in
+ *" $absdir "*) ;;
+ *)
+ case "$compile_rpath " in
+ *" $absdir "*) ;;
+ *) func_append compile_rpath " $absdir" ;;
+ esac
+ ;;
+ esac
+ case " $sys_lib_dlsearch_path " in
+ *" $libdir "*) ;;
+ *)
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ ;;
+ esac
+ fi
+
+ if test -n "$old_archive_from_expsyms_cmds"; then
+ # figure out the soname
+ set dummy $library_names
+ shift
+ realname="$1"
+ shift
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ # use dlname if we got it. it's perfectly good, no?
+ if test -n "$dlname"; then
+ soname="$dlname"
+ elif test -n "$soname_spec"; then
+ # bleh windows
+ case $host in
+ *cygwin* | mingw* | *cegcc*)
+ func_arith $current - $age
+ major=$func_arith_result
+ versuffix="-$major"
+ ;;
+ esac
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+
+ # Make a new name for the extract_expsyms_cmds to use
+ soroot="$soname"
+ func_basename "$soroot"
+ soname="$func_basename_result"
+ func_stripname 'lib' '.dll' "$soname"
+ newlib=libimp-$func_stripname_result.a
+
+ # If the library has no export list, then create one now
+ if test -f "$output_objdir/$soname-def"; then :
+ else
+ func_verbose "extracting exported symbol list from \`$soname'"
+ func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+ fi
+
+ # Create $newlib
+ if test -f "$output_objdir/$newlib"; then :; else
+ func_verbose "generating import library for \`$soname'"
+ func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+ fi
+ # make sure the library variables are pointing to the new library
+ dir=$output_objdir
+ linklib=$newlib
+ fi # test -n "$old_archive_from_expsyms_cmds"
+
+ if test "$linkmode" = prog || test "$opt_mode" != relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ lib_linked=yes
+ case $hardcode_action in
+ immediate | unsupported)
+ if test "$hardcode_direct" = no; then
+ add="$dir/$linklib"
+ case $host in
+ *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+ *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+ *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+ *-*-unixware7*) add_dir="-L$dir" ;;
+ *-*-darwin* )
+ # if the lib is a (non-dlopened) module then we can not
+ # link against it, someone is ignoring the earlier warnings
+ if /usr/bin/file -L $add 2> /dev/null |
+ $GREP ": [^:]* bundle" >/dev/null ; then
+ if test "X$dlopenmodule" != "X$lib"; then
+ $ECHO "*** Warning: lib $linklib is a module, not a shared library"
+ if test -z "$old_library" ; then
+ echo
+ echo "*** And there doesn't seem to be a static archive available"
+ echo "*** The link will probably fail, sorry"
+ else
+ add="$dir/$old_library"
+ fi
+ elif test -n "$old_library"; then
+ add="$dir/$old_library"
+ fi
+ fi
+ esac
+ elif test "$hardcode_minus_L" = no; then
+ case $host in
+ *-*-sunos*) add_shlibpath="$dir" ;;
+ esac
+ add_dir="-L$dir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = no; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ relink)
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$absdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ func_append add_dir " -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ add_shlibpath="$dir"
+ add="-l$name"
+ else
+ lib_linked=no
+ fi
+ ;;
+ *) lib_linked=no ;;
+ esac
+
+ if test "$lib_linked" != yes; then
+ func_fatal_configuration "unsupported hardcode properties"
+ fi
+
+ if test -n "$add_shlibpath"; then
+ case :$compile_shlibpath: in
+ *":$add_shlibpath:"*) ;;
+ *) func_append compile_shlibpath "$add_shlibpath:" ;;
+ esac
+ fi
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+ test -n "$add" && compile_deplibs="$add $compile_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ if test "$hardcode_direct" != yes &&
+ test "$hardcode_minus_L" != yes &&
+ test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) func_append finalize_shlibpath "$libdir:" ;;
+ esac
+ fi
+ fi
+ fi
+
+ if test "$linkmode" = prog || test "$opt_mode" = relink; then
+ add_shlibpath=
+ add_dir=
+ add=
+ # Finalize command for both is simple: just hardcode it.
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
+ add="$libdir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+ add_dir="-L$libdir"
+ add="-l$name"
+ elif test "$hardcode_shlibpath_var" = yes; then
+ case :$finalize_shlibpath: in
+ *":$libdir:"*) ;;
+ *) func_append finalize_shlibpath "$libdir:" ;;
+ esac
+ add="-l$name"
+ elif test "$hardcode_automatic" = yes; then
+ if test -n "$inst_prefix_dir" &&
+ test -f "$inst_prefix_dir$libdir/$linklib" ; then
+ add="$inst_prefix_dir$libdir/$linklib"
+ else
+ add="$libdir/$linklib"
+ fi
+ else
+ # We cannot seem to hardcode it, guess we'll fake it.
+ add_dir="-L$libdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+ [\\/]*)
+ func_append add_dir " -L$inst_prefix_dir$libdir"
+ ;;
+ esac
+ fi
+ add="-l$name"
+ fi
+
+ if test "$linkmode" = prog; then
+ test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+ test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+ else
+ test -n "$add_dir" && deplibs="$add_dir $deplibs"
+ test -n "$add" && deplibs="$add $deplibs"
+ fi
+ fi
+ elif test "$linkmode" = prog; then
+ # Here we assume that one of hardcode_direct or hardcode_minus_L
+ # is not unsupported. This is valid on all known static and
+ # shared platforms.
+ if test "$hardcode_direct" != unsupported; then
+ test -n "$old_library" && linklib="$old_library"
+ compile_deplibs="$dir/$linklib $compile_deplibs"
+ finalize_deplibs="$dir/$linklib $finalize_deplibs"
+ else
+ compile_deplibs="-l$name -L$dir $compile_deplibs"
+ finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+ fi
+ elif test "$build_libtool_libs" = yes; then
+ # Not a shared library
+ if test "$deplibs_check_method" != pass_all; then
+ # We're trying link a shared library against a static one
+ # but the system doesn't support it.
+
+ # Just print a warning and add the library to dependency_libs so
+ # that the program can be linked against the static library.
+ echo
+ $ECHO "*** Warning: This system can not link to static lib archive $lib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have."
+ if test "$module" = yes; then
+ echo "*** But as you try to build a module library, libtool will still create "
+ echo "*** a static module, that should work as long as the dlopening application"
+ echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ else
+ deplibs="$dir/$old_library $deplibs"
+ link_static=yes
+ fi
+ fi # link shared/static library?
+
+ if test "$linkmode" = lib; then
+ if test -n "$dependency_libs" &&
+ { test "$hardcode_into_libs" != yes ||
+ test "$build_old_libs" = yes ||
+ test "$link_static" = yes; }; then
+ # Extract -R from dependency_libs
+ temp_deplibs=
+ for libdir in $dependency_libs; do
+ case $libdir in
+ -R*) func_stripname '-R' '' "$libdir"
+ temp_xrpath=$func_stripname_result
+ case " $xrpath " in
+ *" $temp_xrpath "*) ;;
+ *) func_append xrpath " $temp_xrpath";;
+ esac;;
+ *) func_append temp_deplibs " $libdir";;
+ esac
+ done
+ dependency_libs="$temp_deplibs"
+ fi
+
+ func_append newlib_search_path " $absdir"
+ # Link against this library
+ test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+ # ... and its dependency_libs
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ newdependency_libs="$deplib $newdependency_libs"
+ case $deplib in
+ -L*) func_stripname '-L' '' "$deplib"
+ func_resolve_sysroot "$func_stripname_result";;
+ *) func_resolve_sysroot "$deplib" ;;
+ esac
+ if $opt_preserve_dup_deps ; then
+ case "$tmp_libs " in
+ *" $func_resolve_sysroot_result "*)
+ func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+ esac
+ fi
+ func_append tmp_libs " $func_resolve_sysroot_result"
+ done
+
+ if test "$link_all_deplibs" != no; then
+ # Add the search paths of all dependency libraries
+ for deplib in $dependency_libs; do
+ path=
+ case $deplib in
+ -L*) path="$deplib" ;;
+ *.la)
+ func_resolve_sysroot "$deplib"
+ deplib=$func_resolve_sysroot_result
+ func_dirname "$deplib" "" "."
+ dir=$func_dirname_result
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+ *)
+ absdir=`cd "$dir" && pwd`
+ if test -z "$absdir"; then
+ func_warning "cannot determine absolute directory name of \`$dir'"
+ absdir="$dir"
+ fi
+ ;;
+ esac
+ if $GREP "^installed=no" $deplib > /dev/null; then
+ case $host in
+ *-*-darwin*)
+ depdepl=
+ eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+ if test -n "$deplibrary_names" ; then
+ for tmp in $deplibrary_names ; do
+ depdepl=$tmp
+ done
+ if test -f "$absdir/$objdir/$depdepl" ; then
+ depdepl="$absdir/$objdir/$depdepl"
+ darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ if test -z "$darwin_install_name"; then
+ darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ fi
+ func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+ func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+ path=
+ fi
+ fi
+ ;;
+ *)
+ path="-L$absdir/$objdir"
+ ;;
+ esac
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ test "$absdir" != "$libdir" && \
+ func_warning "\`$deplib' seems to be moved"
+
+ path="-L$absdir"
+ fi
+ ;;
+ esac
+ case " $deplibs " in
+ *" $path "*) ;;
+ *) deplibs="$path $deplibs" ;;
+ esac
+ done
+ fi # link_all_deplibs != no
+ fi # linkmode = lib
+ done # for deplib in $libs
+ if test "$pass" = link; then
+ if test "$linkmode" = "prog"; then
+ compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+ finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+ else
+ compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ fi
+ fi
+ dependency_libs="$newdependency_libs"
+ if test "$pass" = dlpreopen; then
+ # Link the dlpreopened libraries before other libraries
+ for deplib in $save_deplibs; do
+ deplibs="$deplib $deplibs"
+ done
+ fi
+ if test "$pass" != dlopen; then
+ if test "$pass" != conv; then
+ # Make sure lib_search_path contains only unique directories.
+ lib_search_path=
+ for dir in $newlib_search_path; do
+ case "$lib_search_path " in
+ *" $dir "*) ;;
+ *) func_append lib_search_path " $dir" ;;
+ esac
+ done
+ newlib_search_path=
+ fi
+
+ if test "$linkmode,$pass" != "prog,link"; then
+ vars="deplibs"
+ else
+ vars="compile_deplibs finalize_deplibs"
+ fi
+ for var in $vars dependency_libs; do
+ # Add libraries to $var in reverse order
+ eval tmp_libs=\"\$$var\"
+ new_libs=
+ for deplib in $tmp_libs; do
+ # FIXME: Pedantically, this is the right thing to do, so
+ # that some nasty dependency loop isn't accidentally
+ # broken:
+ #new_libs="$deplib $new_libs"
+ # Pragmatically, this seems to cause very few problems in
+ # practice:
+ case $deplib in
+ -L*) new_libs="$deplib $new_libs" ;;
+ -R*) ;;
+ *)
+ # And here is the reason: when a library appears more
+ # than once as an explicit dependence of a library, or
+ # is implicitly linked in more than once by the
+ # compiler, it is considered special, and multiple
+ # occurrences thereof are not removed. Compare this
+ # with having the same library being listed as a
+ # dependency of multiple other libraries: in this case,
+ # we know (pedantically, we assume) the library does not
+ # need to be listed more than once, so we keep only the
+ # last copy. This is not always right, but it is rare
+ # enough that we require users that really mean to play
+ # such unportable linking tricks to link the library
+ # using -Wl,-lname, so that libtool does not consider it
+ # for duplicate removal.
+ case " $specialdeplibs " in
+ *" $deplib "*) new_libs="$deplib $new_libs" ;;
+ *)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) new_libs="$deplib $new_libs" ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ done
+ tmp_libs=
+ for deplib in $new_libs; do
+ case $deplib in
+ -L*)
+ case " $tmp_libs " in
+ *" $deplib "*) ;;
+ *) func_append tmp_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append tmp_libs " $deplib" ;;
+ esac
+ done
+ eval $var=\"$tmp_libs\"
+ done # for var
+ fi
+ # Last step: remove runtime libs from dependency_libs
+ # (they stay in deplibs)
+ tmp_libs=
+ for i in $dependency_libs ; do
+ case " $predeps $postdeps $compiler_lib_search_path " in
+ *" $i "*)
+ i=""
+ ;;
+ esac
+ if test -n "$i" ; then
+ func_append tmp_libs " $i"
+ fi
+ done
+ dependency_libs=$tmp_libs
+ done # for pass
+ if test "$linkmode" = prog; then
+ dlfiles="$newdlfiles"
+ fi
+ if test "$linkmode" = prog || test "$linkmode" = lib; then
+ dlprefiles="$newdlprefiles"
+ fi
+
+ case $linkmode in
+ oldlib)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for archives"
+ fi
+
+ case " $deplibs" in
+ *\ -l* | *\ -L*)
+ func_warning "\`-l' and \`-L' are ignored for archives" ;;
+ esac
+
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for archives"
+
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for archives"
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for archives"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for archives"
+
+ test -n "$export_symbols$export_symbols_regex" && \
+ func_warning "\`-export-symbols' is ignored for archives"
+
+ # Now set the variables for building old libraries.
+ build_libtool_libs=no
+ oldlibs="$output"
+ func_append objs "$old_deplibs"
+ ;;
+
+ lib)
+ # Make sure we only generate libraries of the form `libNAME.la'.
+ case $outputname in
+ lib*)
+ func_stripname 'lib' '.la' "$outputname"
+ name=$func_stripname_result
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ ;;
+ *)
+ test "$module" = no && \
+ func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
+ if test "$need_lib_prefix" != no; then
+ # Add the "lib" prefix for modules if required
+ func_stripname '' '.la' "$outputname"
+ name=$func_stripname_result
+ eval shared_ext=\"$shrext_cmds\"
+ eval libname=\"$libname_spec\"
+ else
+ func_stripname '' '.la' "$outputname"
+ libname=$func_stripname_result
+ fi
+ ;;
+ esac
+
+ if test -n "$objs"; then
+ if test "$deplibs_check_method" != pass_all; then
+ func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+ else
+ echo
+ $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+ $ECHO "*** objects $objs is not portable!"
+ func_append libobjs " $objs"
+ fi
+ fi
+
+ test "$dlself" != no && \
+ func_warning "\`-dlopen self' is ignored for libtool libraries"
+
+ set dummy $rpath
+ shift
+ test "$#" -gt 1 && \
+ func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+ install_libdir="$1"
+
+ oldlibs=
+ if test -z "$rpath"; then
+ if test "$build_libtool_libs" = yes; then
+ # Building a libtool convenience library.
+ # Some compilers have problems with a `.al' extension so
+ # convenience libraries should have the same extension an
+ # archive normally would.
+ oldlibs="$output_objdir/$libname.$libext $oldlibs"
+ build_libtool_libs=convenience
+ build_old_libs=yes
+ fi
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for convenience libraries"
+ else
+
+ # Parse the version information argument.
+ save_ifs="$IFS"; IFS=':'
+ set dummy $vinfo 0 0 0
+ shift
+ IFS="$save_ifs"
+
+ test -n "$7" && \
+ func_fatal_help "too many parameters to \`-version-info'"
+
+ # convert absolute version numbers to libtool ages
+ # this retains compatibility with .la files and attempts
+ # to make the code below a bit more comprehensible
+
+ case $vinfo_number in
+ yes)
+ number_major="$1"
+ number_minor="$2"
+ number_revision="$3"
+ #
+ # There are really only two kinds -- those that
+ # use the current revision as the major version
+ # and those that subtract age and use age as
+ # a minor version. But, then there is irix
+ # which has an extra 1 added just for fun
+ #
+ case $version_type in
+ # correct linux to gnu/linux during the next big refactor
+ darwin|linux|osf|windows|none)
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
+ age="$number_minor"
+ revision="$number_revision"
+ ;;
+ freebsd-aout|freebsd-elf|qnx|sunos)
+ current="$number_major"
+ revision="$number_minor"
+ age="0"
+ ;;
+ irix|nonstopux)
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
+ age="$number_minor"
+ revision="$number_minor"
+ lt_irix_increment=no
+ ;;
+ esac
+ ;;
+ no)
+ current="$1"
+ revision="$2"
+ age="$3"
+ ;;
+ esac
+
+ # Check that each of the things are valid numbers.
+ case $current in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "CURRENT \`$current' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ case $revision in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "REVISION \`$revision' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ case $age in
+ 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+ *)
+ func_error "AGE \`$age' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ ;;
+ esac
+
+ if test "$age" -gt "$current"; then
+ func_error "AGE \`$age' is greater than the current interface number \`$current'"
+ func_fatal_error "\`$vinfo' is not valid version information"
+ fi
+
+ # Calculate the version variables.
+ major=
+ versuffix=
+ verstring=
+ case $version_type in
+ none) ;;
+
+ darwin)
+ # Like Linux, but with the current version available in
+ # verstring for coding it into the library header
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix="$major.$age.$revision"
+ # Darwin ld doesn't like 0 for these options...
+ func_arith $current + 1
+ minor_current=$func_arith_result
+ xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+ verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+ ;;
+
+ freebsd-aout)
+ major=".$current"
+ versuffix=".$current.$revision";
+ ;;
+
+ freebsd-elf)
+ major=".$current"
+ versuffix=".$current"
+ ;;
+
+ irix | nonstopux)
+ if test "X$lt_irix_increment" = "Xno"; then
+ func_arith $current - $age
+ else
+ func_arith $current - $age + 1
+ fi
+ major=$func_arith_result
+
+ case $version_type in
+ nonstopux) verstring_prefix=nonstopux ;;
+ *) verstring_prefix=sgi ;;
+ esac
+ verstring="$verstring_prefix$major.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$revision
+ while test "$loop" -ne 0; do
+ func_arith $revision - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
+ verstring="$verstring_prefix$major.$iface:$verstring"
+ done
+
+ # Before this point, $major must not contain `.'.
+ major=.$major
+ versuffix="$major.$revision"
+ ;;
+
+ linux) # correct to gnu/linux during the next big refactor
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix="$major.$age.$revision"
+ ;;
+
+ osf)
+ func_arith $current - $age
+ major=.$func_arith_result
+ versuffix=".$current.$age.$revision"
+ verstring="$current.$age.$revision"
+
+ # Add in all the interfaces that we are compatible with.
+ loop=$age
+ while test "$loop" -ne 0; do
+ func_arith $current - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
+ verstring="$verstring:${iface}.0"
+ done
+
+ # Make executables depend on our current version.
+ func_append verstring ":${current}.0"
+ ;;
+
+ qnx)
+ major=".$current"
+ versuffix=".$current"
+ ;;
+
+ sunos)
+ major=".$current"
+ versuffix=".$current.$revision"
+ ;;
+
+ windows)
+ # Use '-' rather than '.', since we only want one
+ # extension on DOS 8.3 filesystems.
+ func_arith $current - $age
+ major=$func_arith_result
+ versuffix="-$major"
+ ;;
+
+ *)
+ func_fatal_configuration "unknown library version type \`$version_type'"
+ ;;
+ esac
+
+ # Clear the version info if we defaulted, and they specified a release.
+ if test -z "$vinfo" && test -n "$release"; then
+ major=
+ case $version_type in
+ darwin)
+ # we can't check for "0.0" in archive_cmds due to quoting
+ # problems, so we reset it completely
+ verstring=
+ ;;
+ *)
+ verstring="0.0"
+ ;;
+ esac
+ if test "$need_version" = no; then
+ versuffix=
+ else
+ versuffix=".0.0"
+ fi
+ fi
+
+ # Remove version info from name if versioning should be avoided
+ if test "$avoid_version" = yes && test "$need_version" = no; then
+ major=
+ versuffix=
+ verstring=""
+ fi
+
+ # Check to see if the archive will have undefined symbols.
+ if test "$allow_undefined" = yes; then
+ if test "$allow_undefined_flag" = unsupported; then
+ func_warning "undefined symbols not allowed in $host shared libraries"
+ build_libtool_libs=no
+ build_old_libs=yes
+ fi
+ else
+ # Don't allow undefined symbols.
+ allow_undefined_flag="$no_undefined_flag"
+ fi
+
+ fi
+
+ func_generate_dlsyms "$libname" "$libname" "yes"
+ func_append libobjs " $symfileobj"
+ test "X$libobjs" = "X " && libobjs=
+
+ if test "$opt_mode" != relink; then
+ # Remove our outputs, but don't remove object files since they
+ # may have been created when compiling PIC objects.
+ removelist=
+ tempremovelist=`$ECHO "$output_objdir/*"`
+ for p in $tempremovelist; do
+ case $p in
+ *.$objext | *.gcno)
+ ;;
+ $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+ if test "X$precious_files_regex" != "X"; then
+ if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
+ continue
+ fi
+ fi
+ func_append removelist " $p"
+ ;;
+ *) ;;
+ esac
+ done
+ test -n "$removelist" && \
+ func_show_eval "${RM}r \$removelist"
+ fi
+
+ # Now set the variables for building old libraries.
+ if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+ func_append oldlibs " $output_objdir/$libname.$libext"
+
+ # Transform .lo files to .o files.
+ oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+ fi
+
+ # Eliminate all temporary directories.
+ #for path in $notinst_path; do
+ # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+ # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+ # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+ #done
+
+ if test -n "$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ temp_xrpath=
+ for libdir in $xrpath; do
+ func_replace_sysroot "$libdir"
+ func_append temp_xrpath " -R$func_replace_sysroot_result"
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ done
+ if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+ dependency_libs="$temp_xrpath $dependency_libs"
+ fi
+ fi
+
+ # Make sure dlfiles contains only unique files that won't be dlpreopened
+ old_dlfiles="$dlfiles"
+ dlfiles=
+ for lib in $old_dlfiles; do
+ case " $dlprefiles $dlfiles " in
+ *" $lib "*) ;;
+ *) func_append dlfiles " $lib" ;;
+ esac
+ done
+
+ # Make sure dlprefiles contains only unique files
+ old_dlprefiles="$dlprefiles"
+ dlprefiles=
+ for lib in $old_dlprefiles; do
+ case "$dlprefiles " in
+ *" $lib "*) ;;
+ *) func_append dlprefiles " $lib" ;;
+ esac
+ done
+
+ if test "$build_libtool_libs" = yes; then
+ if test -n "$rpath"; then
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ # these systems don't actually have a c library (as such)!
+ ;;
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # Rhapsody C library is in the System framework
+ func_append deplibs " System.ltframework"
+ ;;
+ *-*-netbsd*)
+ # Don't link with libc until the a.out ld.so is fixed.
+ ;;
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+ # Do not include libc due to us having libc/libc_r.
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ ;;
+ *)
+ # Add libc to deplibs on all other systems if necessary.
+ if test "$build_libtool_need_lc" = "yes"; then
+ func_append deplibs " -lc"
+ fi
+ ;;
+ esac
+ fi
+
+ # Transform deplibs into only deplibs that can be linked in shared.
+ name_save=$name
+ libname_save=$libname
+ release_save=$release
+ versuffix_save=$versuffix
+ major_save=$major
+ # I'm not sure if I'm treating the release correctly. I think
+ # release should show up in the -l (ie -lgmp5) so we don't want to
+ # add it in twice. Is that correct?
+ release=""
+ versuffix=""
+ major=""
+ newdeplibs=
+ droppeddeps=no
+ case $deplibs_check_method in
+ pass_all)
+ # Don't check for shared/static. Everything works.
+ # This might be a little naive. We might want to check
+ # whether the library exists or not. But this is on
+ # osf3 & osf4 and I'm not really sure... Just
+ # implementing what was already the behavior.
+ newdeplibs=$deplibs
+ ;;
+ test_compile)
+ # This code stresses the "libraries are programs" paradigm to its
+ # limits. Maybe even breaks it. We compile a program, linking it
+ # against the deplibs as a proxy for the library. Then we can check
+ # whether they linked in statically or dynamically with ldd.
+ $opt_dry_run || $RM conftest.c
+ cat > conftest.c <<EOF
+ int main() { return 0; }
+EOF
+ $opt_dry_run || $RM conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+ ldd_output=`ldd conftest`
+ for i in $deplibs; do
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ func_append newdeplibs " $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ func_append newdeplibs " $i"
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which I believe you do not have"
+ echo "*** because a test_compile did reveal that the linker did not use it for"
+ echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ fi
+ fi
+ ;;
+ *)
+ func_append newdeplibs " $i"
+ ;;
+ esac
+ done
+ else
+ # Error occurred in the first compile. Let's try to salvage
+ # the situation: Compile a separate program for each library.
+ for i in $deplibs; do
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
+ $opt_dry_run || $RM conftest
+ if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+ ldd_output=`ldd conftest`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $i "*)
+ func_append newdeplibs " $i"
+ i=""
+ ;;
+ esac
+ fi
+ if test -n "$i" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+ func_append newdeplibs " $i"
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because a test_compile did reveal that the linker did not use this one"
+ echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ fi
+ fi
+ else
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
+ echo "*** make it link in! You will probably need to install it or some"
+ echo "*** library that it depends on before this library will be fully"
+ echo "*** functional. Installing it before continuing would be even better."
+ fi
+ ;;
+ *)
+ func_append newdeplibs " $i"
+ ;;
+ esac
+ done
+ fi
+ ;;
+ file_magic*)
+ set dummy $deplibs_check_method; shift
+ file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ for a_deplib in $deplibs; do
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ if test -n "$file_magic_glob"; then
+ libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
+ else
+ libnameglob=$libname
+ fi
+ test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ if test "$want_nocaseglob" = yes; then
+ shopt -s nocaseglob
+ potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+ $nocaseglob
+ else
+ potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+ fi
+ for potent_lib in $potential_libs; do
+ # Follow soft links.
+ if ls -lLd "$potent_lib" 2>/dev/null |
+ $GREP " -> " >/dev/null; then
+ continue
+ fi
+ # The statement above tries to avoid entering an
+ # endless loop below, in case of cyclic links.
+ # We might still enter an endless loop, since a link
+ # loop can be closed while we follow links,
+ # but so what?
+ potlib="$potent_lib"
+ while test -h "$potlib" 2>/dev/null; do
+ potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+ case $potliblink in
+ [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+ *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+ $SED -e 10q |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+ else
+ $ECHO "*** with $libname and none of the candidates passed a file format test"
+ $ECHO "*** using a file magic. Last file checked: $potlib"
+ fi
+ fi
+ ;;
+ *)
+ # Add a -L argument.
+ func_append newdeplibs " $a_deplib"
+ ;;
+ esac
+ done # Gone through all deplibs.
+ ;;
+ match_pattern*)
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ for a_deplib in $deplibs; do
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ case " $predeps $postdeps " in
+ *" $a_deplib "*)
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ ;;
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+ potlib="$potent_lib" # see symlink-check above in file_magic test
+ if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
+ $EGREP "$match_pattern_regex" > /dev/null; then
+ func_append newdeplibs " $a_deplib"
+ a_deplib=""
+ break 2
+ fi
+ done
+ done
+ fi
+ if test -n "$a_deplib" ; then
+ droppeddeps=yes
+ echo
+ $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+ echo "*** I have the capability to make that library automatically link in when"
+ echo "*** you link to this library. But I can only do this if you have a"
+ echo "*** shared version of the library, which you do not appear to have"
+ echo "*** because I did check the linker path looking for a file starting"
+ if test -z "$potlib" ; then
+ $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+ else
+ $ECHO "*** with $libname and none of the candidates passed a file format test"
+ $ECHO "*** using a regex pattern. Last file checked: $potlib"
+ fi
+ fi
+ ;;
+ *)
+ # Add a -L argument.
+ func_append newdeplibs " $a_deplib"
+ ;;
+ esac
+ done # Gone through all deplibs.
+ ;;
+ none | unknown | *)
+ newdeplibs=""
+ tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+ if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+ for i in $predeps $postdeps ; do
+ # can't use Xsed below, because $i might contain '/'
+ tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+ done
+ fi
+ case $tmp_deplibs in
+ *[!\ \ ]*)
+ echo
+ if test "X$deplibs_check_method" = "Xnone"; then
+ echo "*** Warning: inter-library dependencies are not supported in this platform."
+ else
+ echo "*** Warning: inter-library dependencies are not known to be supported."
+ fi
+ echo "*** All declared inter-library dependencies are being dropped."
+ droppeddeps=yes
+ ;;
+ esac
+ ;;
+ esac
+ versuffix=$versuffix_save
+ major=$major_save
+ release=$release_save
+ libname=$libname_save
+ name=$name_save
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library with the System framework
+ newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+ ;;
+ esac
+
+ if test "$droppeddeps" = yes; then
+ if test "$module" = yes; then
+ echo
+ echo "*** Warning: libtool could not satisfy all declared inter-library"
+ $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
+ echo "*** a static module, that should work as long as the dlopening"
+ echo "*** application is linked with the -dlopen flag."
+ if test -z "$global_symbol_pipe"; then
+ echo
+ echo "*** However, this would only work if libtool was able to extract symbol"
+ echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ echo "*** not find such a program. So, this module is probably useless."
+ echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ fi
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ else
+ echo "*** The inter-library dependencies that have been dropped here will be"
+ echo "*** automatically added whenever a program is linked with this library"
+ echo "*** or is declared to -dlopen it."
+
+ if test "$allow_undefined" = no; then
+ echo
+ echo "*** Since this library must not contain undefined symbols,"
+ echo "*** because either the platform does not support them or"
+ echo "*** it was explicitly requested with -no-undefined,"
+ echo "*** libtool will only create a static version of it."
+ if test "$build_old_libs" = no; then
+ oldlibs="$output_objdir/$libname.$libext"
+ build_libtool_libs=module
+ build_old_libs=yes
+ else
+ build_libtool_libs=no
+ fi
+ fi
+ fi
+ fi
+ # Done checking deplibs!
+ deplibs=$newdeplibs
+ fi
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ case $host in
+ *-*-darwin*)
+ newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
+ esac
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $deplibs " in
+ *" -L$path/$objdir "*)
+ func_append new_libs " -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ done
+ deplibs="$new_libs"
+
+ # All the library-specific variables (install_libdir is set above).
+ library_names=
+ old_library=
+ dlname=
+
+ # Test again, we may have decided not to build it any more
+ if test "$build_libtool_libs" = yes; then
+ # Remove ${wl} instances when linking with ld.
+ # FIXME: should test the right _cmds variable.
+ case $archive_cmds in
+ *\$LD\ *) wl= ;;
+ esac
+ if test "$hardcode_into_libs" = yes; then
+ # Hardcode the library paths
+ hardcode_libdirs=
+ dep_rpath=
+ rpath="$finalize_rpath"
+ test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+ for libdir in $rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ func_replace_sysroot "$libdir"
+ libdir=$func_replace_sysroot_result
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append dep_rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append perm_rpath " $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
+ fi
+ if test -n "$runpath_var" && test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+ fi
+ test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+ fi
+
+ shlibpath="$finalize_shlibpath"
+ test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ if test -n "$shlibpath"; then
+ eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+ fi
+
+ # Get the real and link names of the library.
+ eval shared_ext=\"$shrext_cmds\"
+ eval library_names=\"$library_names_spec\"
+ set dummy $library_names
+ shift
+ realname="$1"
+ shift
+
+ if test -n "$soname_spec"; then
+ eval soname=\"$soname_spec\"
+ else
+ soname="$realname"
+ fi
+ if test -z "$dlname"; then
+ dlname=$soname
+ fi
+
+ lib="$output_objdir/$realname"
+ linknames=
+ for link
+ do
+ func_append linknames " $link"
+ done
+
+ # Use standard objects if they are pic
+ test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ test "X$libobjs" = "X " && libobjs=
+
+ delfiles=
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+ export_symbols="$output_objdir/$libname.uexp"
+ func_append delfiles " $export_symbols"
+ fi
+
+ orig_export_symbols=
+ case $host_os in
+ cygwin* | mingw* | cegcc*)
+ if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+ # exporting using user supplied symfile
+ if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+ # and it's NOT already a .def file. Must figure out
+ # which of the given symbols are data symbols and tag
+ # them as such. So, trigger use of export_symbols_cmds.
+ # export_symbols gets reassigned inside the "prepare
+ # the list of exported symbols" if statement, so the
+ # include_expsyms logic still works.
+ orig_export_symbols="$export_symbols"
+ export_symbols=
+ always_export_symbols=yes
+ fi
+ fi
+ ;;
+ esac
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+ func_verbose "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $opt_dry_run || $RM $export_symbols
+ cmds=$export_symbols_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd1 in $cmds; do
+ IFS="$save_ifs"
+ # Take the normal branch if the nm_file_list_spec branch
+ # doesn't work or if tool conversion is not needed.
+ case $nm_file_list_spec~$to_tool_file_cmd in
+ *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
+ try_normal_branch=yes
+ eval cmd=\"$cmd1\"
+ func_len " $cmd"
+ len=$func_len_result
+ ;;
+ *)
+ try_normal_branch=no
+ ;;
+ esac
+ if test "$try_normal_branch" = yes \
+ && { test "$len" -lt "$max_cmd_len" \
+ || test "$max_cmd_len" -le -1; }
+ then
+ func_show_eval "$cmd" 'exit $?'
+ skipped_export=false
+ elif test -n "$nm_file_list_spec"; then
+ func_basename "$output"
+ output_la=$func_basename_result
+ save_libobjs=$libobjs
+ save_output=$output
+ output=${output_objdir}/${output_la}.nm
+ func_to_tool_file "$output"
+ libobjs=$nm_file_list_spec$func_to_tool_file_result
+ func_append delfiles " $output"
+ func_verbose "creating $NM input file list: $output"
+ for obj in $save_libobjs; do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result"
+ done > "$output"
+ eval cmd=\"$cmd1\"
+ func_show_eval "$cmd" 'exit $?'
+ output=$save_output
+ libobjs=$save_libobjs
+ skipped_export=false
+ else
+ # The command line is too long to execute in one step.
+ func_verbose "using reloadable object file for export list..."
+ skipped_export=:
+ # Break out early, otherwise skipped_export may be
+ # set to false by a later but shorter cmd.
+ break
+ fi
+ done
+ IFS="$save_ifs"
+ if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+ fi
+
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+ fi
+
+ tmp_deplibs=
+ for test_deplib in $deplibs; do
+ case " $convenience " in
+ *" $test_deplib "*) ;;
+ *)
+ func_append tmp_deplibs " $test_deplib"
+ ;;
+ esac
+ done
+ deplibs="$tmp_deplibs"
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec" &&
+ test "$compiler_needs_object" = yes &&
+ test -z "$libobjs"; then
+ # extract the archives, so we have objects to list.
+ # TODO: could optimize this to just extract one archive.
+ whole_archive_flag_spec=
+ fi
+ if test -n "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
+ else
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $convenience
+ func_append libobjs " $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+ eval flag=\"$thread_safe_flag_spec\"
+ func_append linker_flags " $flag"
+ fi
+
+ # Make a backup of the uninstalled library when relinking
+ if test "$opt_mode" = relink; then
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+ fi
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ eval test_cmds=\"$module_expsym_cmds\"
+ cmds=$module_expsym_cmds
+ else
+ eval test_cmds=\"$module_cmds\"
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval test_cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
+ else
+ eval test_cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
+ fi
+ fi
+
+ if test "X$skipped_export" != "X:" &&
+ func_len " $test_cmds" &&
+ len=$func_len_result &&
+ test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ :
+ else
+ # The command line is too long to link in one step, link piecewise
+ # or, if using GNU ld and skipped_export is not :, use a linker
+ # script.
+
+ # Save the value of $output and $libobjs because we want to
+ # use them later. If we have whole_archive_flag_spec, we
+ # want to use save_libobjs as it was before
+ # whole_archive_flag_spec was expanded, because we can't
+ # assume the linker understands whole_archive_flag_spec.
+ # This may have to be revisited, in case too many
+ # convenience libraries get linked in and end up exceeding
+ # the spec.
+ if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+ fi
+ save_output=$output
+ func_basename "$output"
+ output_la=$func_basename_result
+
+ # Clear the reloadable object creation command queue and
+ # initialize k to one.
+ test_cmds=
+ concat_cmds=
+ objlist=
+ last_robj=
+ k=1
+
+ if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+ output=${output_objdir}/${output_la}.lnkscript
+ func_verbose "creating GNU ld script: $output"
+ echo 'INPUT (' > $output
+ for obj in $save_libobjs
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result" >> $output
+ done
+ echo ')' >> $output
+ func_append delfiles " $output"
+ func_to_tool_file "$output"
+ output=$func_to_tool_file_result
+ elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+ output=${output_objdir}/${output_la}.lnk
+ func_verbose "creating linker input file list: $output"
+ : > $output
+ set x $save_libobjs
+ shift
+ firstobj=
+ if test "$compiler_needs_object" = yes; then
+ firstobj="$1 "
+ shift
+ fi
+ for obj
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result" >> $output
+ done
+ func_append delfiles " $output"
+ func_to_tool_file "$output"
+ output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+ else
+ if test -n "$save_libobjs"; then
+ func_verbose "creating reloadable object files..."
+ output=$output_objdir/$output_la-${k}.$objext
+ eval test_cmds=\"$reload_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ if test "X$objlist" = X ||
+ test "$len" -lt "$max_cmd_len"; then
+ func_append objlist " $obj"
+ else
+ # The command $test_cmds is almost too long, add a
+ # command to the queue.
+ if test "$k" -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ reload_objs=$objlist
+ eval concat_cmds=\"$reload_cmds\"
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
+ reload_objs="$objlist $last_robj"
+ eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
+ fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
+ func_arith $k + 1
+ k=$func_arith_result
+ output=$output_objdir/$output_la-${k}.$objext
+ objlist=" $obj"
+ func_len " $last_robj"
+ func_arith $len0 + $func_len_result
+ len=$func_arith_result
+ fi
+ done
+ # Handle the remaining objects by creating one last
+ # reloadable object file. All subsequent reloadable object
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ reload_objs="$objlist $last_robj"
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+ if test -n "$last_robj"; then
+ eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+ fi
+ func_append delfiles " $output"
+
+ else
+ output=
+ fi
+
+ if ${skipped_export-false}; then
+ func_verbose "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $opt_dry_run || $RM $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+ if test -n "$last_robj"; then
+ eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+ fi
+ fi
+
+ test -n "$save_libobjs" &&
+ func_verbose "creating a temporary reloadable object file: $output"
+
+ # Loop through the commands generated above and execute them.
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
+ IFS="$save_ifs"
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+
+ if ${skipped_export-false}; then
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+ fi
+ fi
+
+ libobjs=$output
+ # Restore the value of output.
+ output=$save_output
+
+ if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+ eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+ # Expand the library linking commands again to reset the
+ # value of $libobjs for piecewise linking.
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+ cmds=$module_expsym_cmds
+ else
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ cmds=$archive_expsym_cmds
+ else
+ cmds=$archive_cmds
+ fi
+ fi
+ fi
+
+ if test -n "$delfiles"; then
+ # Append the command to remove temporary files to $cmds.
+ eval cmds=\"\$cmds~\$RM $delfiles\"
+ fi
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $dlprefiles
+ func_append libobjs " $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+
+ # Restore the uninstalled library and exit
+ if test "$opt_mode" = relink; then
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+
+ if test -n "$convenience"; then
+ if test -z "$whole_archive_flag_spec"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ # Create links to the real library.
+ for linkname in $linknames; do
+ if test "$realname" != "$linkname"; then
+ func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+ fi
+ done
+
+ # If -module or -export-dynamic was specified, set the dlname.
+ if test "$module" = yes || test "$export_dynamic" = yes; then
+ # On all known operating systems, these are identical.
+ dlname="$soname"
+ fi
+ fi
+ ;;
+
+ obj)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for objects"
+ fi
+
+ case " $deplibs" in
+ *\ -l* | *\ -L*)
+ func_warning "\`-l' and \`-L' are ignored for objects" ;;
+ esac
+
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for objects"
+
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for objects"
+
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for objects"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for objects"
+
+ case $output in
+ *.lo)
+ test -n "$objs$old_deplibs" && \
+ func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+ libobj=$output
+ func_lo2o "$libobj"
+ obj=$func_lo2o_result
+ ;;
+ *)
+ libobj=
+ obj="$output"
+ ;;
+ esac
+
+ # Delete the old objects.
+ $opt_dry_run || $RM $obj $libobj
+
+ # Objects from convenience libraries. This assumes
+ # single-version convenience libraries. Whenever we create
+ # different ones for PIC/non-PIC, this we'll have to duplicate
+ # the extraction.
+ reload_conv_objs=
+ gentop=
+ # reload_cmds runs $LD directly, so let us get rid of
+ # -Wl from whole_archive_flag_spec and hope we can get by with
+ # turning comma into space..
+ wl=
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+ eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+ reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+ else
+ gentop="$output_objdir/${obj}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $convenience
+ reload_conv_objs="$reload_objs $func_extract_archives_result"
+ fi
+ fi
+
+ # If we're not building shared, we need to use non_pic_objs
+ test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+
+ # Create the old-style object.
+ reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+ output="$obj"
+ func_execute_cmds "$reload_cmds" 'exit $?'
+
+ # Exit if we aren't doing a library object file.
+ if test -z "$libobj"; then
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$build_libtool_libs" != yes; then
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ # $show "echo timestamp > $libobj"
+ # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+ if test -n "$pic_flag" || test "$pic_mode" != default; then
+ # Only do commands if we really have different PIC objects.
+ reload_objs="$libobjs $reload_conv_objs"
+ output="$libobj"
+ func_execute_cmds "$reload_cmds" 'exit $?'
+ fi
+
+ if test -n "$gentop"; then
+ func_show_eval '${RM}r "$gentop"'
+ fi
+
+ exit $EXIT_SUCCESS
+ ;;
+
+ prog)
+ case $host in
+ *cygwin*) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result.exe;;
+ esac
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for programs"
+
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for programs"
+
+ test "$preload" = yes \
+ && test "$dlopen_support" = unknown \
+ && test "$dlopen_self" = unknown \
+ && test "$dlopen_self_static" = unknown && \
+ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+ case $host in
+ *-*-rhapsody* | *-*-darwin1.[012])
+ # On Rhapsody replace the C library is the System framework
+ compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+ finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+ ;;
+ esac
+
+ case $host in
+ *-*-darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ # But is supposedly fixed on 10.4 or later (yay!).
+ if test "$tagname" = CXX ; then
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+ 10.[0123])
+ func_append compile_command " ${wl}-bind_at_load"
+ func_append finalize_command " ${wl}-bind_at_load"
+ ;;
+ esac
+ fi
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
+ esac
+
+
+ # move library search paths that coincide with paths to not yet
+ # installed libraries to the beginning of the library search list
+ new_libs=
+ for path in $notinst_path; do
+ case " $new_libs " in
+ *" -L$path/$objdir "*) ;;
+ *)
+ case " $compile_deplibs " in
+ *" -L$path/$objdir "*)
+ func_append new_libs " -L$path/$objdir" ;;
+ esac
+ ;;
+ esac
+ done
+ for deplib in $compile_deplibs; do
+ case $deplib in
+ -L*)
+ case " $new_libs " in
+ *" $deplib "*) ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ ;;
+ *) func_append new_libs " $deplib" ;;
+ esac
+ done
+ compile_deplibs="$new_libs"
+
+
+ func_append compile_command " $compile_deplibs"
+ func_append finalize_command " $finalize_deplibs"
+
+ if test -n "$rpath$xrpath"; then
+ # If the user specified any rpath flags, then add them.
+ for libdir in $rpath $xrpath; do
+ # This is the magic to use -rpath.
+ case "$finalize_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_rpath " $libdir" ;;
+ esac
+ done
+ fi
+
+ # Now hardcode the library paths
+ rpath=
+ hardcode_libdirs=
+ for libdir in $compile_rpath $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append perm_rpath " $libdir" ;;
+ esac
+ fi
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+ case :$dllsearchpath: in
+ *":$libdir:"*) ;;
+ ::) dllsearchpath=$libdir;;
+ *) func_append dllsearchpath ":$libdir";;
+ esac
+ case :$dllsearchpath: in
+ *":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
+ *) func_append dllsearchpath ":$testbindir";;
+ esac
+ ;;
+ esac
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ compile_rpath="$rpath"
+
+ rpath=
+ hardcode_libdirs=
+ for libdir in $finalize_rpath; do
+ if test -n "$hardcode_libdir_flag_spec"; then
+ if test -n "$hardcode_libdir_separator"; then
+ if test -z "$hardcode_libdirs"; then
+ hardcode_libdirs="$libdir"
+ else
+ # Just accumulate the unique libdirs.
+ case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+ *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+ ;;
+ *)
+ func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ ;;
+ esac
+ fi
+ else
+ eval flag=\"$hardcode_libdir_flag_spec\"
+ func_append rpath " $flag"
+ fi
+ elif test -n "$runpath_var"; then
+ case "$finalize_perm_rpath " in
+ *" $libdir "*) ;;
+ *) func_append finalize_perm_rpath " $libdir" ;;
+ esac
+ fi
+ done
+ # Substitute the hardcoded libdirs into the rpath.
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ eval rpath=\" $hardcode_libdir_flag_spec\"
+ fi
+ finalize_rpath="$rpath"
+
+ if test -n "$libobjs" && test "$build_old_libs" = yes; then
+ # Transform all the library objects into standard objects.
+ compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ fi
+
+ func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+
+ # template prelinking step
+ if test -n "$prelink_cmds"; then
+ func_execute_cmds "$prelink_cmds" 'exit $?'
+ fi
+
+ wrappers_required=yes
+ case $host in
+ *cegcc* | *mingw32ce*)
+ # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+ wrappers_required=no
+ ;;
+ *cygwin* | *mingw* )
+ if test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ *)
+ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ esac
+ if test "$wrappers_required" = no; then
+ # Replace the output file specification.
+ compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ link_command="$compile_command$compile_rpath"
+
+ # We have no uninstalled library dependencies, so finalize right now.
+ exit_status=0
+ func_show_eval "$link_command" 'exit_status=$?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ # Delete the generated files.
+ if test -f "$output_objdir/${outputname}S.${objext}"; then
+ func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+ fi
+
+ exit $exit_status
+ fi
+
+ if test -n "$compile_shlibpath$finalize_shlibpath"; then
+ compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+ fi
+ if test -n "$finalize_shlibpath"; then
+ finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+ fi
+
+ compile_var=
+ finalize_var=
+ if test -n "$runpath_var"; then
+ if test -n "$perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ if test -n "$finalize_perm_rpath"; then
+ # We should set the runpath_var.
+ rpath=
+ for dir in $finalize_perm_rpath; do
+ func_append rpath "$dir:"
+ done
+ finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+ fi
+ fi
+
+ if test "$no_install" = yes; then
+ # We don't need to create a wrapper script.
+ link_command="$compile_var$compile_command$compile_rpath"
+ # Replace the output file specification.
+ link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ # Delete the old output file.
+ $opt_dry_run || $RM $output
+ # Link the executable and exit
+ func_show_eval "$link_command" 'exit $?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ exit $EXIT_SUCCESS
+ fi
+
+ if test "$hardcode_action" = relink; then
+ # Fast installation is not supported
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+ func_warning "this platform does not like uninstalled shared libraries"
+ func_warning "\`$output' will be relinked during installation"
+ else
+ if test "$fast_install" != no; then
+ link_command="$finalize_var$compile_command$finalize_rpath"
+ if test "$fast_install" = yes; then
+ relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+ else
+ # fast_install is set to needless
+ relink_command=
+ fi
+ else
+ link_command="$compile_var$compile_command$compile_rpath"
+ relink_command="$finalize_var$finalize_command$finalize_rpath"
+ fi
+ fi
+
+ # Replace the output file specification.
+ link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+ # Delete the old output files.
+ $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+ func_show_eval "$link_command" 'exit $?'
+
+ if test -n "$postlink_cmds"; then
+ func_to_tool_file "$output_objdir/$outputname"
+ postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+ func_execute_cmds "$postlink_cmds" 'exit $?'
+ fi
+
+ # Now create the wrapper script.
+ func_verbose "creating $output"
+
+ # Quote the relink command for shipping.
+ if test -n "$relink_command"; then
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+ fi
+ done
+ relink_command="(cd `pwd`; $relink_command)"
+ relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ fi
+
+ # Only actually do things if not in dry run mode.
+ $opt_dry_run || {
+ # win32 will think the script is a binary if it has
+ # a .exe suffix, so we strip it off here.
+ case $output in
+ *.exe) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result ;;
+ esac
+ # test for cygwin because mv fails w/o .exe extensions
+ case $host in
+ *cygwin*)
+ exeext=.exe
+ func_stripname '' '.exe' "$outputname"
+ outputname=$func_stripname_result ;;
+ *) exeext= ;;
+ esac
+ case $host in
+ *cygwin* | *mingw* )
+ func_dirname_and_basename "$output" "" "."
+ output_name=$func_basename_result
+ output_path=$func_dirname_result
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
+ $RM $cwrappersource $cwrapper
+ trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+ func_emit_cwrapperexe_src > $cwrappersource
+
+ # The wrapper executable is built using the $host compiler,
+ # because it contains $host paths and files. If cross-
+ # compiling, it, like the target executable, must be
+ # executed on the $host or under an emulation environment.
+ $opt_dry_run || {
+ $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+ $STRIP $cwrapper
+ }
+
+ # Now, create the wrapper script for func_source use:
+ func_ltwrapper_scriptname $cwrapper
+ $RM $func_ltwrapper_scriptname_result
+ trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+ $opt_dry_run || {
+ # note: this script will not be executed, so do not chmod.
+ if test "x$build" = "x$host" ; then
+ $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+ else
+ func_emit_wrapper no > $func_ltwrapper_scriptname_result
+ fi
+ }
+ ;;
+ * )
+ $RM $output
+ trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+ func_emit_wrapper no > $output
+ chmod +x $output
+ ;;
+ esac
+ }
+ exit $EXIT_SUCCESS
+ ;;
+ esac
+
+ # See if we need to build an old-fashioned archive.
+ for oldlib in $oldlibs; do
+
+ if test "$build_libtool_libs" = convenience; then
+ oldobjs="$libobjs_save $symfileobj"
+ addlibs="$convenience"
+ build_libtool_libs=no
+ else
+ if test "$build_libtool_libs" = module; then
+ oldobjs="$libobjs_save"
+ build_libtool_libs=no
+ else
+ oldobjs="$old_deplibs $non_pic_objects"
+ if test "$preload" = yes && test -f "$symfileobj"; then
+ func_append oldobjs " $symfileobj"
+ fi
+ fi
+ addlibs="$old_convenience"
+ fi
+
+ if test -n "$addlibs"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $addlibs
+ func_append oldobjs " $func_extract_archives_result"
+ fi
+
+ # Do each command in the archive commands.
+ if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+ cmds=$old_archive_from_new_cmds
+ else
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+
+ func_extract_archives $gentop $dlprefiles
+ func_append oldobjs " $func_extract_archives_result"
+ fi
+
+ # POSIX demands no paths to be encoded in archives. We have
+ # to avoid creating archives with duplicate basenames if we
+ # might have to extract them afterwards, e.g., when creating a
+ # static archive out of a convenience library, or when linking
+ # the entirety of a libtool archive into another (currently
+ # not supported by libtool).
+ if (for obj in $oldobjs
+ do
+ func_basename "$obj"
+ $ECHO "$func_basename_result"
+ done | sort | sort -uc >/dev/null 2>&1); then
+ :
+ else
+ echo "copying selected object files to avoid basename conflicts..."
+ gentop="$output_objdir/${outputname}x"
+ func_append generated " $gentop"
+ func_mkdir_p "$gentop"
+ save_oldobjs=$oldobjs
+ oldobjs=
+ counter=1
+ for obj in $save_oldobjs
+ do
+ func_basename "$obj"
+ objbase="$func_basename_result"
+ case " $oldobjs " in
+ " ") oldobjs=$obj ;;
+ *[\ /]"$objbase "*)
+ while :; do
+ # Make sure we don't pick an alternate name that also
+ # overlaps.
+ newobj=lt$counter-$objbase
+ func_arith $counter + 1
+ counter=$func_arith_result
+ case " $oldobjs " in
+ *[\ /]"$newobj "*) ;;
+ *) if test ! -f "$gentop/$newobj"; then break; fi ;;
+ esac
+ done
+ func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+ func_append oldobjs " $gentop/$newobj"
+ ;;
+ *) func_append oldobjs " $obj" ;;
+ esac
+ done
+ fi
+ func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
+ tool_oldlib=$func_to_tool_file_result
+ eval cmds=\"$old_archive_cmds\"
+
+ func_len " $cmds"
+ len=$func_len_result
+ if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ cmds=$old_archive_cmds
+ elif test -n "$archiver_list_spec"; then
+ func_verbose "using command file archive linking..."
+ for obj in $oldobjs
+ do
+ func_to_tool_file "$obj"
+ $ECHO "$func_to_tool_file_result"
+ done > $output_objdir/$libname.libcmd
+ func_to_tool_file "$output_objdir/$libname.libcmd"
+ oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+ cmds=$old_archive_cmds
+ else
+ # the command line is too long to link in one step, link in parts
+ func_verbose "using piecewise archive linking..."
+ save_RANLIB=$RANLIB
+ RANLIB=:
+ objlist=
+ concat_cmds=
+ save_oldobjs=$oldobjs
+ oldobjs=
+ # Is there a better way of finding the last object in the list?
+ for obj in $save_oldobjs
+ do
+ last_oldobj=$obj
+ done
+ eval test_cmds=\"$old_archive_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+ for obj in $save_oldobjs
+ do
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ func_append objlist " $obj"
+ if test "$len" -lt "$max_cmd_len"; then
+ :
+ else
+ # the above command should be used before it gets too long
+ oldobjs=$objlist
+ if test "$obj" = "$last_oldobj" ; then
+ RANLIB=$save_RANLIB
+ fi
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+ objlist=
+ len=$len0
+ fi
+ done
+ RANLIB=$save_RANLIB
+ oldobjs=$objlist
+ if test "X$oldobjs" = "X" ; then
+ eval cmds=\"\$concat_cmds\"
+ else
+ eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+ fi
+ fi
+ fi
+ func_execute_cmds "$cmds" 'exit $?'
+ done
+
+ test -n "$generated" && \
+ func_show_eval "${RM}r$generated"
+
+ # Now create the libtool archive.
+ case $output in
+ *.la)
+ old_library=
+ test "$build_old_libs" = yes && old_library="$libname.$libext"
+ func_verbose "creating $output"
+
+ # Preserve any variables that may affect compiler behavior
+ for var in $variables_saved_for_relink; do
+ if eval test -z \"\${$var+set}\"; then
+ relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+ elif eval var_value=\$$var; test -z "$var_value"; then
+ relink_command="$var=; export $var; $relink_command"
+ else
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+ fi
+ done
+ # Quote the link command for shipping.
+ relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+ relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ if test "$hardcode_automatic" = yes ; then
+ relink_command=
+ fi
+
+ # Only create the output if not a dry run.
+ $opt_dry_run || {
+ for installed in no yes; do
+ if test "$installed" = yes; then
+ if test -z "$install_libdir"; then
+ break
+ fi
+ output="$output_objdir/$outputname"i
+ # Replace all uninstalled libtool libraries with the installed ones
+ newdependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ *.la)
+ func_basename "$deplib"
+ name="$func_basename_result"
+ func_resolve_sysroot "$deplib"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ -L*)
+ func_stripname -L '' "$deplib"
+ func_replace_sysroot "$func_stripname_result"
+ func_append newdependency_libs " -L$func_replace_sysroot_result"
+ ;;
+ -R*)
+ func_stripname -R '' "$deplib"
+ func_replace_sysroot "$func_stripname_result"
+ func_append newdependency_libs " -R$func_replace_sysroot_result"
+ ;;
+ *) func_append newdependency_libs " $deplib" ;;
+ esac
+ done
+ dependency_libs="$newdependency_libs"
+ newdlfiles=
+
+ for lib in $dlfiles; do
+ case $lib in
+ *.la)
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ *) func_append newdlfiles " $lib" ;;
+ esac
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ *.la)
+ # Only pass preopened files to the pseudo-archive (for
+ # eventual linking with the app. that links it) if we
+ # didn't already link the preopened objects directly into
+ # the library:
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
+ ;;
+ esac
+ done
+ dlprefiles="$newdlprefiles"
+ else
+ newdlfiles=
+ for lib in $dlfiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ func_append newdlfiles " $abs"
+ done
+ dlfiles="$newdlfiles"
+ newdlprefiles=
+ for lib in $dlprefiles; do
+ case $lib in
+ [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+ *) abs=`pwd`"/$lib" ;;
+ esac
+ func_append newdlprefiles " $abs"
+ done
+ dlprefiles="$newdlprefiles"
+ fi
+ $RM $output
+ # place dlname in correct position for cygwin
+ # In fact, it would be nice if we could use this code for all target
+ # systems that can't hard-code library paths into their executables
+ # and that have no shared library path variable independent of PATH,
+ # but it turns out we can't easily determine that from inspecting
+ # libtool variables, so we have to hard-code the OSs to which it
+ # applies here; at the moment, that means platforms that use the PE
+ # object format with DLL files. See the long comment at the top of
+ # tests/bindir.at for full details.
+ tdlname=$dlname
+ case $host,$output,$installed,$module,$dlname in
+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+ # If a -bindir argument was supplied, place the dll there.
+ if test "x$bindir" != x ;
+ then
+ func_relative_path "$install_libdir" "$bindir"
+ tdlname=$func_relative_path_result$dlname
+ else
+ # Otherwise fall back on heuristic.
+ tdlname=../bin/$dlname
+ fi
+ ;;
+ esac
+ $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+ if test "$installed" = no && test "$need_relink" = yes; then
+ $ECHO >> $output "\
+relink_command=\"$relink_command\""
+ fi
+ done
+ }
+
+ # Do a symbolic link so that the libtool archive can be found in
+ # LD_LIBRARY_PATH before the program is installed.
+ func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+ ;;
+ esac
+ exit $EXIT_SUCCESS
+}
+
+{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
+ func_mode_link ${1+"$@"}
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+ $opt_debug
+ RM="$nonopt"
+ files=
+ rmforce=
+ exit_status=0
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ for arg
+ do
+ case $arg in
+ -f) func_append RM " $arg"; rmforce=yes ;;
+ -*) func_append RM " $arg" ;;
+ *) func_append files " $arg" ;;
+ esac
+ done
+
+ test -z "$RM" && \
+ func_fatal_help "you must specify an RM program"
+
+ rmdirs=
+
+ for file in $files; do
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ if test "X$dir" = X.; then
+ odir="$objdir"
+ else
+ odir="$dir/$objdir"
+ fi
+ func_basename "$file"
+ name="$func_basename_result"
+ test "$opt_mode" = uninstall && odir="$dir"
+
+ # Remember odir for removal later, being careful to avoid duplicates
+ if test "$opt_mode" = clean; then
+ case " $rmdirs " in
+ *" $odir "*) ;;
+ *) func_append rmdirs " $odir" ;;
+ esac
+ fi
+
+ # Don't error if the file doesn't exist and rm -f was used.
+ if { test -L "$file"; } >/dev/null 2>&1 ||
+ { test -h "$file"; } >/dev/null 2>&1 ||
+ test -f "$file"; then
+ :
+ elif test -d "$file"; then
+ exit_status=1
+ continue
+ elif test "$rmforce" = yes; then
+ continue
+ fi
+
+ rmfiles="$file"
+
+ case $name in
+ *.la)
+ # Possibly a libtool archive, so verify it.
+ if func_lalib_p "$file"; then
+ func_source $dir/$name
+
+ # Delete the libtool libraries and symlinks.
+ for n in $library_names; do
+ func_append rmfiles " $odir/$n"
+ done
+ test -n "$old_library" && func_append rmfiles " $odir/$old_library"
+
+ case "$opt_mode" in
+ clean)
+ case " $library_names " in
+ *" $dlname "*) ;;
+ *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+ esac
+ test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+ ;;
+ uninstall)
+ if test -n "$library_names"; then
+ # Do each command in the postuninstall commands.
+ func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+ fi
+
+ if test -n "$old_library"; then
+ # Do each command in the old_postuninstall commands.
+ func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+ fi
+ # FIXME: should reinstall the best remaining shared library.
+ ;;
+ esac
+ fi
+ ;;
+
+ *.lo)
+ # Possibly a libtool object, so verify it.
+ if func_lalib_p "$file"; then
+
+ # Read the .lo file
+ func_source $dir/$name
+
+ # Add PIC object to the list of files to remove.
+ if test -n "$pic_object" &&
+ test "$pic_object" != none; then
+ func_append rmfiles " $dir/$pic_object"
+ fi
+
+ # Add non-PIC object to the list of files to remove.
+ if test -n "$non_pic_object" &&
+ test "$non_pic_object" != none; then
+ func_append rmfiles " $dir/$non_pic_object"
+ fi
+ fi
+ ;;
+
+ *)
+ if test "$opt_mode" = clean ; then
+ noexename=$name
+ case $file in
+ *.exe)
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ func_stripname '' '.exe' "$name"
+ noexename=$func_stripname_result
+ # $file with .exe has already been added to rmfiles,
+ # add $file without .exe
+ func_append rmfiles " $file"
+ ;;
+ esac
+ # Do a test to see if this is a libtool program.
+ if func_ltwrapper_p "$file"; then
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ relink_command=
+ func_source $func_ltwrapper_scriptname_result
+ func_append rmfiles " $func_ltwrapper_scriptname_result"
+ else
+ relink_command=
+ func_source $dir/$noexename
+ fi
+
+ # note $name still contains .exe if it was in $file originally
+ # as does the version of $file that was added into $rmfiles
+ func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
+ if test "$fast_install" = yes && test -n "$relink_command"; then
+ func_append rmfiles " $odir/lt-$name"
+ fi
+ if test "X$noexename" != "X$name" ; then
+ func_append rmfiles " $odir/lt-${noexename}.c"
+ fi
+ fi
+ fi
+ ;;
+ esac
+ func_show_eval "$RM $rmfiles" 'exit_status=1'
+ done
+
+ # Try to remove the ${objdir}s in the directories where we deleted files
+ for dir in $rmdirs; do
+ if test -d "$dir"; then
+ func_show_eval "rmdir $dir >/dev/null 2>&1"
+ fi
+ done
+
+ exit $exit_status
+}
+
+{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
+ func_mode_uninstall ${1+"$@"}
+
+test -z "$opt_mode" && {
+ help="$generic_help"
+ func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+ func_fatal_help "invalid operation mode \`$opt_mode'"
+
+if test -n "$exec_cmd"; then
+ eval exec "$exec_cmd"
+ exit $EXIT_FAILURE
+fi
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries. Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them. This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration. But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
+# vi:sw=2
+
diff --git a/config/ltoptions.m4 b/config/ltoptions.m4
new file mode 100644
index 0000000..5d9acd8
--- /dev/null
+++ b/config/ltoptions.m4
@@ -0,0 +1,384 @@
+# Helper functions for option handling. -*- Autoconf -*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 7 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it. Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+ _LT_MANGLE_DEFUN([$1], [$2]),
+ [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+ [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME. If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+ dnl
+ dnl Simply set some default values (i.e off) if boolean options were not
+ dnl specified:
+ _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+ ])
+ _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+ ])
+ dnl
+ dnl If no reference was made to various pairs of opposing options, then
+ dnl we run the default mode handler for the pair. For example, if neither
+ dnl `shared' nor `disable-shared' was passed, we enable building of shared
+ dnl archives by default:
+ _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+ _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+ [_LT_ENABLE_FAST_INSTALL])
+ ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS], [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+ [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+ [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+ _LT_DECL([build_libtool_libs], [enable_shared], [0],
+ [Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+ [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+ [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+ _LT_DECL([build_old_libs], [enable_static], [0],
+ [Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+ [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+ [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+ [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+ [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
+ [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+ [lt_p=${PACKAGE-default}
+ case $withval in
+ yes|no) pic_mode=$withval ;;
+ *)
+ pic_mode=default
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for lt_pkg in $withval; do
+ IFS="$lt_save_ifs"
+ if test "X$lt_pkg" = "X$lt_p"; then
+ pic_mode=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+ [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+ [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+ [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+ [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+ [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/config/ltsugar.m4 b/config/ltsugar.m4
new file mode 100644
index 0000000..9000a05
--- /dev/null
+++ b/config/ltsugar.m4
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+ [$#], [2], [[$2]],
+ [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+ [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+ [$#], 1, [],
+ [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+ m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+ [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+ [m4_foreach([_Lt_suffix],
+ ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+ [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+ [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+ [lt_append([$1], [$2], [$3])$4],
+ [$5])],
+ [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+ m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+ m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+ [$5],
+ [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+ [lt_join(m4_quote(m4_default([$4], [[, ]])),
+ lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+ [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
diff --git a/config/ltversion.m4 b/config/ltversion.m4
new file mode 100644
index 0000000..07a8602
--- /dev/null
+++ b/config/ltversion.m4
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers -*- Autoconf -*-
+#
+# Copyright (C) 2004 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# @configure_input@
+
+# serial 3337 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4.2])
+m4_define([LT_PACKAGE_REVISION], [1.3337])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4.2'
+macro_revision='1.3337'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
diff --git a/config/lt~obsolete.m4 b/config/lt~obsolete.m4
new file mode 100644
index 0000000..c573da9
--- /dev/null
+++ b/config/lt~obsolete.m4
@@ -0,0 +1,98 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 5 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else. This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
diff --git a/config/missing b/config/missing
new file mode 100755
index 0000000..5b59069
--- /dev/null
+++ b/config/missing
@@ -0,0 +1,380 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Time-stamp: "2006-09-23 19:27:18 bkorb"
+
+scriptversion=2010-02-24.08
+
+# Copyright (c) 2006-2012 by Bruce Korb - all rights reserved
+# Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case $1 in
+ lex|yacc)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $1 in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case $f in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f y.tab.h; then
+ echo >y.tab.h
+ fi
+ if test ! -f y.tab.c; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f lex.yy.c; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit 1
+ fi
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case $firstarg in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case $firstarg in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ autogen )
+ echo "Your autogen is either missing or out of date. Update from" 1>&2
+ echo " ${2-ftp://ftp.gnu.org/gnu/autogen/}" 1>&2
+ exit_code=1
+ ;;
+
+ *)
+ f=`dirname $0`/`basename $1`
+ if [ -f $f.missing ]
+ then
+ . $f.missing
+ else
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ fi
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/config/mk-shdefs.in b/config/mk-shdefs.in
new file mode 100644
index 0000000..aa388cc
--- /dev/null
+++ b/config/mk-shdefs.in
@@ -0,0 +1,108 @@
+#! @CONFIG_SHELL@
+# -*- Mode: shell-script -*-
+
+die() {
+ echo "$prog fatal error: $*"
+ kill -TERM $progpid
+ exit 1
+} >&2
+
+init() {
+ prog=`basename $1 .sh`
+ progpid=$$
+
+ SED='@SED@'
+ AWK='@AWK@'
+ GREP='@GREP@'
+ EGREP='@EGREP@'
+ target=`basename $2`
+ builddir=`dirname $2`
+ builddir=`cd $builddir && pwd`
+ srcdir=`dirname $1`
+ srcdir=`cd $srcdir >/dev/null && pwd`
+
+ cd ${builddir} || die no builddir
+
+ # top_builddir may be relative to the build directory that corresponds
+ # to the source directory for this file. Make it absolute
+ #
+ top_builddir=`cd @top_builddir@ >/dev/null && pwd`
+ top_srcdir=`
+ cd ${builddir} >/dev/null && cd @top_srcdir@ >/dev/null && pwd`
+
+ rm -f ${target}
+ exec 3> shdef-temp.in || die cannot create output
+ cd ..
+}
+
+mk_config() {
+ cat >&3 <<- _EOF_
+ prefix='@prefix@'
+ exec_prefix="@exec_prefix@"
+ PACKAGE_TARNAME='@PACKAGE_TARNAME@'
+ _EOF_
+
+ # Skip the stuff we force to be first
+ #
+ skip_list='top_srcdir|top_builddir|prefix|exec_prefix|PACKAGE_TARNAME'
+
+ # skip the autoconf/automake internal names
+ #
+ skip_list=${skip_list}"|a[mc]_.*|.*_TRUE|.*_FALSE|HAVE_.*|AM*"
+
+ # These must be in the correct order. Ensure it and don't do 'em twice
+ #
+ eval_fmt='eval "%s=\\"@%s@\\""\n'
+ for v in datarootdir mandir localedir infodir docdir datadir \
+ libdir libexecdir sbindir bindir \
+ includedir localstatedir sharedstatedir sysconfdir oldincludedir
+ do printf "${eval_fmt}" $v $v
+ skip_list=${skip_list}"|$v"
+ done >&3
+
+ for f in `${GREP} '^S\["' config.status`
+ do
+ v=`echo "$f" | ${SED} 's/".=.*//;s/[SD]\["//'`
+ x=`echo "$v" | ${EGREP} "^($skip_list)\$"`
+ test "X$x" = X || continue
+
+ case "$f" in
+ *'$('* ) : ;; # no make file only substitutions
+ *'missing --run '* ) : ;; # no bootstrap tools
+ S*\$* ) printf "${eval_fmt}" $v $v ;;
+ S* ) echo "$v='@$v@'" ;;
+ esac
+ done >&3
+
+ exec 3>&-
+}
+
+configure() {
+ cd config
+
+ ../config.status --file shdef-temp
+ {
+ cmd='`set -o | '${AWK}" '/^allexport/ {print \$2}'"\`
+ cat <<- _EOF_
+ #! `which echo` this-file-should-be-sourced,-not-executed
+ # -*- Mode: shell-script -*-
+
+ case "$cmd" in
+ on ) cleara=: ;;
+ * ) cleara='set +a' ; set -a ;;
+ esac
+
+ top_srcdir="$top_srcdir"
+ top_builddir="$top_builddir"
+ _EOF_
+
+ cat shdef-temp
+ echo 'eval $cleara'
+ } > ${target}
+
+ rm -f shdef-temp*
+}
+
+init $0 $1
+mk_config
+configure
diff --git a/config/onceonly.m4 b/config/onceonly.m4
new file mode 100644
index 0000000..275d73c
--- /dev/null
+++ b/config/onceonly.m4
@@ -0,0 +1,104 @@
+# onceonly.m4 serial 9
+dnl Copyright (C) 2002-2003, 2005-2006, 2008-2012 Free Software Foundation,
+dnl Inc.
+dnl
+dnl This file is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This file is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this file. If not, see <http://www.gnu.org/licenses/>.
+dnl
+dnl As a special exception to the GNU General Public License,
+dnl this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+dnl This file defines some "once only" variants of standard autoconf macros.
+dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
+dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
+dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
+dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL
+dnl The advantage is that the check for each of the headers/functions/decls
+dnl will be put only once into the 'configure' file. It keeps the size of
+dnl the 'configure' file down, and avoids redundant output when 'configure'
+dnl is run.
+dnl The drawback is that the checks cannot be conditionalized. If you write
+dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
+dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
+dnl empty, and the check will be inserted before the body of the AC_DEFUNed
+dnl function.
+
+dnl The original code implemented AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE
+dnl in terms of AC_DEFUN and AC_REQUIRE. This implementation uses diversions to
+dnl named sections DEFAULTS and INIT_PREPARE in order to check all requested
+dnl headers at once, thus reducing the size of 'configure'. It is known to work
+dnl with autoconf 2.57..2.62 at least . The size reduction is ca. 9%.
+
+dnl Autoconf version 2.59 plus gnulib is required; this file is not needed
+dnl with Autoconf 2.60 or greater. But note that autoconf's implementation of
+dnl AC_CHECK_DECLS_ONCE expects a comma-separated list of symbols as first
+dnl argument!
+AC_PREREQ([2.59])
+
+# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
+# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
+AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
+ :
+ m4_foreach_w([gl_HEADER_NAME], [$1], [
+ AC_DEFUN([gl_CHECK_HEADER_]m4_quote(m4_translit(gl_HEADER_NAME,
+ [./-], [___])), [
+ m4_divert_text([INIT_PREPARE],
+ [gl_header_list="$gl_header_list gl_HEADER_NAME"])
+ gl_HEADERS_EXPANSION
+ AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
+ [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
+ ])
+ AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(m4_translit(gl_HEADER_NAME,
+ [./-], [___])))
+ ])
+])
+m4_define([gl_HEADERS_EXPANSION], [
+ m4_divert_text([DEFAULTS], [gl_header_list=])
+ AC_CHECK_HEADERS([$gl_header_list])
+ m4_define([gl_HEADERS_EXPANSION], [])
+])
+
+# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
+# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
+AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
+ :
+ m4_foreach_w([gl_FUNC_NAME], [$1], [
+ AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
+ m4_divert_text([INIT_PREPARE],
+ [gl_func_list="$gl_func_list gl_FUNC_NAME"])
+ gl_FUNCS_EXPANSION
+ AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
+ [Define to 1 if you have the ']m4_defn([gl_FUNC_NAME])[' function.])
+ ])
+ AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
+ ])
+])
+m4_define([gl_FUNCS_EXPANSION], [
+ m4_divert_text([DEFAULTS], [gl_func_list=])
+ AC_CHECK_FUNCS([$gl_func_list])
+ m4_define([gl_FUNCS_EXPANSION], [])
+])
+
+# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
+# AC_CHECK_DECLS(DECL1, DECL2, ...).
+AC_DEFUN([AC_CHECK_DECLS_ONCE], [
+ :
+ m4_foreach_w([gl_DECL_NAME], [$1], [
+ AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
+ AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
+ ])
+ AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
+ ])
+])
diff --git a/config/snprintfv.m4 b/config/snprintfv.m4
new file mode 100644
index 0000000..02d6fd0
--- /dev/null
+++ b/config/snprintfv.m4
@@ -0,0 +1,98 @@
+
+dnl AC_SNPRINTFV_CONVENIENCE[(dir)] - sets LIBSNPRINTFV to the link flags for
+dnl the snprintfv convenience library and INCSNPRINTFV to the include flags for
+dnl the snprintfv header and adds --enable-snprintfv-convenience to the
+dnl configure arguments. Note that AC_CONFIG_SUBDIRS is not called. If DIR
+dnl is not provided, it is assumed to be `snprintfv'. LIBSNPRINTFV will be
+dnl prefixed with '${top_builddir}/' and INCSNPRINTFV will be prefixed with
+dnl '${top_srcdir}/' (note the single quotes!). If your package is not
+dnl flat and you're not using automake, define top_builddir and
+dnl top_srcdir appropriately in the Makefiles.
+AC_DEFUN([AC_SNPRINTFV_CONVENIENCE],
+[case $enable_snprintfv_convenience in
+ no) AC_MSG_ERROR([this package needs a convenience snprintfv]) ;;
+ "") enable_snprintfv_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-snprintfv-convenience" ;;
+ esac
+ LIBSNPRINTFV='${top_builddir}/'ifelse($#,1,[$1],['snprintfv'])/snprintfv/libsnprintfvc.la
+ INCSNPRINTFV='-I${top_builddir}/'ifelse($#,1,[$1],['snprintfv'])' -I${top_srcdir}/'ifelse($#,1,[$1],['snprintfv'])
+ AC_SUBST(LIBSNPRINTFV)
+ AC_SUBST(INCSNPRINTFV)
+])
+
+AC_DEFUN([INVOKE_SNPRINTFV_MACROS],[
+ AC_SNPRINTFV_CONVENIENCE
+ # ----------------------------------------------------------------------
+ # Set up and process configure options
+ # ----------------------------------------------------------------------
+ AC_ARG_ENABLE(snprintfv-install,
+ [ --enable-snprintfv-install install libsnprintfv [yes]])
+ AM_CONDITIONAL(INSTALL_SNPRINTFV,
+ test x"${enable_snprintfv_install-no}" != xno)
+ AM_CONDITIONAL(CONVENIENCE_SNPRINTFV,
+ test x"${enable_snprintfv_convenience-no}" != xno)
+ AM_CONDITIONAL(SUBDIR_SNPRINTFV,
+ test x"${enable_subdir-no}" != xno)
+
+ AM_WITH_DMALLOC
+ AC_PROG_AWK
+
+ # ----------------------------------------------------------------------
+ # check for various programs used during the build.
+ # On OS/X, "wchar.h" needs "runetype.h" to work properly.
+ # ----------------------------------------------------------------------
+ AC_CHECK_HEADERS([runetype.h wchar.h], [], [],[
+ AC_INCLUDES_DEFAULT
+ #if HAVE_RUNETYPE_H
+ # include <runetype.h>
+ #endif
+ ])
+ dnl am_cv_prog_cc_stdc is set by AC_PROG_CC_STDC
+ case x$am_cv_prog_cc_stdc in
+ xno)
+ # Non ansi C => won't work with stdarg.h
+ AC_CHECK_HEADER(varargs.h)
+ ;;
+ *)
+ case x$ac_cv_header_varargs_h in
+ xyes)
+ # Parent package is using varargs.h which is incompatible with
+ # stdarg.h, so we do the same.
+ AC_CHECK_HEADER(varargs.h)
+ ;;
+ *)
+ # If stdarg.h is present define HAVE_STDARG_H, otherwise if varargs.h
+ # is present define HAVE_VARARGS_H.
+ AC_CHECK_HEADERS(stdarg.h varargs.h, break)
+ ;;
+ esac
+ ;;
+ esac
+
+ case x$ac_cv_header_stdarg_h$ac_cv_header_varargs_h in
+ x*yes*) ;;
+ *) AC_MSG_ERROR(Could not find either stdarg.h or varargs.h.) ;;
+ esac
+
+ # ----------------------------------------------------------------------
+ # Checks for typedefs
+ # ----------------------------------------------------------------------
+ AC_CHECK_TYPES(wchar_t)
+ AC_CHECK_TYPES(wint_t, [], [], [
+ AC_INCLUDES_DEFAULT
+ #if HAVE_RUNETYPE_H
+ # include <runetype.h>
+ #endif
+ #if HAVE_WCHAR_H
+ # include <wchar.h>
+ #endif
+ ])
+ AC_CHECK_TYPES([long double])
+
+ # ----------------------------------------------------------------------
+ # Checks for library calls
+ # ----------------------------------------------------------------------
+ AC_REPLACE_FUNCS(strtoul ldexpl frexpl)
+ AC_CHECK_LIB(m, log)
+ AC_CHECK_FUNCS(copysign copysignl)
+])
diff --git a/config/texinfo.tex b/config/texinfo.tex
new file mode 100644
index 0000000..a5a7b2b
--- /dev/null
+++ b/config/texinfo.tex
@@ -0,0 +1,10013 @@
+% texinfo.tex -- TeX macros to handle Texinfo files.
+%
+% Load plain if necessary, i.e., if running under initex.
+\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
+%
+\def\texinfoversion{2012-06-05.14}
+%
+% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
+% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+% 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+%
+% This texinfo.tex file is free software: you can redistribute it and/or
+% modify it under the terms of the GNU General Public License as
+% published by the Free Software Foundation, either version 3 of the
+% License, or (at your option) any later version.
+%
+% This texinfo.tex file is distributed in the hope that it will be
+% useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+% General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+% As a special exception, when this file is read by TeX when processing
+% a Texinfo source document, you may use the result without
+% restriction. (This has been our intent since Texinfo was invented.)
+%
+% Please try the latest version of texinfo.tex before submitting bug
+% reports; you can get the latest version from:
+% http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
+% http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
+% http://www.gnu.org/software/texinfo/ (the Texinfo home page)
+% The texinfo.tex in any given distribution could well be out
+% of date, so if that's what you're using, please check.
+%
+% Send bug reports to bug-texinfo@gnu.org. Please include including a
+% complete document in each bug report with which we can reproduce the
+% problem. Patches are, of course, greatly appreciated.
+%
+% To process a Texinfo manual with TeX, it's most reliable to use the
+% texi2dvi shell script that comes with the distribution. For a simple
+% manual foo.texi, however, you can get away with this:
+% tex foo.texi
+% texindex foo.??
+% tex foo.texi
+% tex foo.texi
+% dvips foo.dvi -o # or whatever; this makes foo.ps.
+% The extra TeX runs get the cross-reference information correct.
+% Sometimes one run after texindex suffices, and sometimes you need more
+% than two; texi2dvi does it as many times as necessary.
+%
+% It is possible to adapt texinfo.tex for other languages, to some
+% extent. You can get the existing language-specific files from the
+% full Texinfo distribution.
+%
+% The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
+
+
+\message{Loading texinfo [version \texinfoversion]:}
+
+% If in a .fmt file, print the version number
+% and turn on active characters that we couldn't do earlier because
+% they might have appeared in the input file name.
+\everyjob{\message{[Texinfo version \texinfoversion]}%
+ \catcode`+=\active \catcode`\_=\active}
+
+\chardef\other=12
+
+% We never want plain's \outer definition of \+ in Texinfo.
+% For @tex, we can use \tabalign.
+\let\+ = \relax
+
+% Save some plain tex macros whose names we will redefine.
+\let\ptexb=\b
+\let\ptexbullet=\bullet
+\let\ptexc=\c
+\let\ptexcomma=\,
+\let\ptexdot=\.
+\let\ptexdots=\dots
+\let\ptexend=\end
+\let\ptexequiv=\equiv
+\let\ptexexclam=\!
+\let\ptexfootnote=\footnote
+\let\ptexgtr=>
+\let\ptexhat=^
+\let\ptexi=\i
+\let\ptexindent=\indent
+\let\ptexinsert=\insert
+\let\ptexlbrace=\{
+\let\ptexless=<
+\let\ptexnewwrite\newwrite
+\let\ptexnoindent=\noindent
+\let\ptexplus=+
+\let\ptexraggedright=\raggedright
+\let\ptexrbrace=\}
+\let\ptexslash=\/
+\let\ptexstar=\*
+\let\ptext=\t
+\let\ptextop=\top
+{\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
+
+% If this character appears in an error message or help string, it
+% starts a new line in the output.
+\newlinechar = `^^J
+
+% Use TeX 3.0's \inputlineno to get the line number, for better error
+% messages, but if we're using an old version of TeX, don't do anything.
+%
+\ifx\inputlineno\thisisundefined
+ \let\linenumber = \empty % Pre-3.0.
+\else
+ \def\linenumber{l.\the\inputlineno:\space}
+\fi
+
+% Set up fixed words for English if not already set.
+\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
+\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
+\ifx\putworderror\undefined \gdef\putworderror{error}\fi
+\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
+\ifx\putwordin\undefined \gdef\putwordin{in}\fi
+\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
+\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
+\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
+\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
+\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
+\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
+\ifx\putwordof\undefined \gdef\putwordof{of}\fi
+\ifx\putwordon\undefined \gdef\putwordon{on}\fi
+\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
+\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
+\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
+\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
+\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
+\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
+\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
+%
+\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
+\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
+\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
+\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
+\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
+\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
+\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
+\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
+\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
+\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
+\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
+\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
+%
+\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
+\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
+\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
+\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
+\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
+
+% Since the category of space is not known, we have to be careful.
+\chardef\spacecat = 10
+\def\spaceisspace{\catcode`\ =\spacecat}
+
+% sometimes characters are active, so we need control sequences.
+\chardef\ampChar = `\&
+\chardef\colonChar = `\:
+\chardef\commaChar = `\,
+\chardef\dashChar = `\-
+\chardef\dotChar = `\.
+\chardef\exclamChar= `\!
+\chardef\hashChar = `\#
+\chardef\lquoteChar= `\`
+\chardef\questChar = `\?
+\chardef\rquoteChar= `\'
+\chardef\semiChar = `\;
+\chardef\slashChar = `\/
+\chardef\underChar = `\_
+
+% Ignore a token.
+%
+\def\gobble#1{}
+
+% The following is used inside several \edef's.
+\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
+
+% Hyphenation fixes.
+\hyphenation{
+ Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
+ ap-pen-dix bit-map bit-maps
+ data-base data-bases eshell fall-ing half-way long-est man-u-script
+ man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
+ par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
+ spell-ing spell-ings
+ stand-alone strong-est time-stamp time-stamps which-ever white-space
+ wide-spread wrap-around
+}
+
+% Margin to add to right of even pages, to left of odd pages.
+\newdimen\bindingoffset
+\newdimen\normaloffset
+\newdimen\pagewidth \newdimen\pageheight
+
+% For a final copy, take out the rectangles
+% that mark overfull boxes (in case you have decided
+% that the text looks ok even though it passes the margin).
+%
+\def\finalout{\overfullrule=0pt }
+
+% Sometimes it is convenient to have everything in the transcript file
+% and nothing on the terminal. We don't just call \tracingall here,
+% since that produces some useless output on the terminal. We also make
+% some effort to order the tracing commands to reduce output in the log
+% file; cf. trace.sty in LaTeX.
+%
+\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
+\def\loggingall{%
+ \tracingstats2
+ \tracingpages1
+ \tracinglostchars2 % 2 gives us more in etex
+ \tracingparagraphs1
+ \tracingoutput1
+ \tracingmacros2
+ \tracingrestores1
+ \showboxbreadth\maxdimen \showboxdepth\maxdimen
+ \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
+ \tracingscantokens1
+ \tracingifs1
+ \tracinggroups1
+ \tracingnesting2
+ \tracingassigns1
+ \fi
+ \tracingcommands3 % 3 gives us more in etex
+ \errorcontextlines16
+}%
+
+% @errormsg{MSG}. Do the index-like expansions on MSG, but if things
+% aren't perfect, it's not the end of the world, being an error message,
+% after all.
+%
+\def\errormsg{\begingroup \indexnofonts \doerrormsg}
+\def\doerrormsg#1{\errmessage{#1}}
+
+% add check for \lastpenalty to plain's definitions. If the last thing
+% we did was a \nobreak, we don't want to insert more space.
+%
+\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
+ \removelastskip\penalty-50\smallskip\fi\fi}
+\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
+ \removelastskip\penalty-100\medskip\fi\fi}
+\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
+ \removelastskip\penalty-200\bigskip\fi\fi}
+
+% Do @cropmarks to get crop marks.
+%
+\newif\ifcropmarks
+\let\cropmarks = \cropmarkstrue
+%
+% Dimensions to add cropmarks at corners.
+% Added by P. A. MacKay, 12 Nov. 1986
+%
+\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
+\newdimen\cornerlong \cornerlong=1pc
+\newdimen\cornerthick \cornerthick=.3pt
+\newdimen\topandbottommargin \topandbottommargin=.75in
+
+% Output a mark which sets \thischapter, \thissection and \thiscolor.
+% We dump everything together because we only have one kind of mark.
+% This works because we only use \botmark / \topmark, not \firstmark.
+%
+% A mark contains a subexpression of the \ifcase ... \fi construct.
+% \get*marks macros below extract the needed part using \ifcase.
+%
+% Another complication is to let the user choose whether \thischapter
+% (\thissection) refers to the chapter (section) in effect at the top
+% of a page, or that at the bottom of a page. The solution is
+% described on page 260 of The TeXbook. It involves outputting two
+% marks for the sectioning macros, one before the section break, and
+% one after. I won't pretend I can describe this better than DEK...
+\def\domark{%
+ \toks0=\expandafter{\lastchapterdefs}%
+ \toks2=\expandafter{\lastsectiondefs}%
+ \toks4=\expandafter{\prevchapterdefs}%
+ \toks6=\expandafter{\prevsectiondefs}%
+ \toks8=\expandafter{\lastcolordefs}%
+ \mark{%
+ \the\toks0 \the\toks2
+ \noexpand\or \the\toks4 \the\toks6
+ \noexpand\else \the\toks8
+ }%
+}
+% \topmark doesn't work for the very first chapter (after the title
+% page or the contents), so we use \firstmark there -- this gets us
+% the mark with the chapter defs, unless the user sneaks in, e.g.,
+% @setcolor (or @url, or @link, etc.) between @contents and the very
+% first @chapter.
+\def\gettopheadingmarks{%
+ \ifcase0\topmark\fi
+ \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
+}
+\def\getbottomheadingmarks{\ifcase1\botmark\fi}
+\def\getcolormarks{\ifcase2\topmark\fi}
+
+% Avoid "undefined control sequence" errors.
+\def\lastchapterdefs{}
+\def\lastsectiondefs{}
+\def\prevchapterdefs{}
+\def\prevsectiondefs{}
+\def\lastcolordefs{}
+
+% Main output routine.
+\chardef\PAGE = 255
+\output = {\onepageout{\pagecontents\PAGE}}
+
+\newbox\headlinebox
+\newbox\footlinebox
+
+% \onepageout takes a vbox as an argument. Note that \pagecontents
+% does insertions, but you have to call it yourself.
+\def\onepageout#1{%
+ \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
+ %
+ \ifodd\pageno \advance\hoffset by \bindingoffset
+ \else \advance\hoffset by -\bindingoffset\fi
+ %
+ % Do this outside of the \shipout so @code etc. will be expanded in
+ % the headline as they should be, not taken literally (outputting ''code).
+ \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
+ \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
+ \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
+ \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
+ %
+ {%
+ % Have to do this stuff outside the \shipout because we want it to
+ % take effect in \write's, yet the group defined by the \vbox ends
+ % before the \shipout runs.
+ %
+ \indexdummies % don't expand commands in the output.
+ \normalturnoffactive % \ in index entries must not stay \, e.g., if
+ % the page break happens to be in the middle of an example.
+ % We don't want .vr (or whatever) entries like this:
+ % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
+ % "\acronym" won't work when it's read back in;
+ % it needs to be
+ % {\code {{\tt \backslashcurfont }acronym}
+ \shipout\vbox{%
+ % Do this early so pdf references go to the beginning of the page.
+ \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
+ %
+ \ifcropmarks \vbox to \outervsize\bgroup
+ \hsize = \outerhsize
+ \vskip-\topandbottommargin
+ \vtop to0pt{%
+ \line{\ewtop\hfil\ewtop}%
+ \nointerlineskip
+ \line{%
+ \vbox{\moveleft\cornerthick\nstop}%
+ \hfill
+ \vbox{\moveright\cornerthick\nstop}%
+ }%
+ \vss}%
+ \vskip\topandbottommargin
+ \line\bgroup
+ \hfil % center the page within the outer (page) hsize.
+ \ifodd\pageno\hskip\bindingoffset\fi
+ \vbox\bgroup
+ \fi
+ %
+ \unvbox\headlinebox
+ \pagebody{#1}%
+ \ifdim\ht\footlinebox > 0pt
+ % Only leave this space if the footline is nonempty.
+ % (We lessened \vsize for it in \oddfootingyyy.)
+ % The \baselineskip=24pt in plain's \makefootline has no effect.
+ \vskip 24pt
+ \unvbox\footlinebox
+ \fi
+ %
+ \ifcropmarks
+ \egroup % end of \vbox\bgroup
+ \hfil\egroup % end of (centering) \line\bgroup
+ \vskip\topandbottommargin plus1fill minus1fill
+ \boxmaxdepth = \cornerthick
+ \vbox to0pt{\vss
+ \line{%
+ \vbox{\moveleft\cornerthick\nsbot}%
+ \hfill
+ \vbox{\moveright\cornerthick\nsbot}%
+ }%
+ \nointerlineskip
+ \line{\ewbot\hfil\ewbot}%
+ }%
+ \egroup % \vbox from first cropmarks clause
+ \fi
+ }% end of \shipout\vbox
+ }% end of group with \indexdummies
+ \advancepageno
+ \ifnum\outputpenalty>-20000 \else\dosupereject\fi
+}
+
+\newinsert\margin \dimen\margin=\maxdimen
+
+\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
+{\catcode`\@ =11
+\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
+% marginal hacks, juha@viisa.uucp (Juha Takala)
+\ifvoid\margin\else % marginal info is present
+ \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
+\dimen@=\dp#1\relax \unvbox#1\relax
+\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
+\ifr@ggedbottom \kern-\dimen@ \vfil \fi}
+}
+
+% Here are the rules for the cropmarks. Note that they are
+% offset so that the space between them is truly \outerhsize or \outervsize
+% (P. A. MacKay, 12 November, 1986)
+%
+\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
+\def\nstop{\vbox
+ {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
+\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
+\def\nsbot{\vbox
+ {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
+
+% Parse an argument, then pass it to #1. The argument is the rest of
+% the input line (except we remove a trailing comment). #1 should be a
+% macro which expects an ordinary undelimited TeX argument.
+%
+\def\parsearg{\parseargusing{}}
+\def\parseargusing#1#2{%
+ \def\argtorun{#2}%
+ \begingroup
+ \obeylines
+ \spaceisspace
+ #1%
+ \parseargline\empty% Insert the \empty token, see \finishparsearg below.
+}
+
+{\obeylines %
+ \gdef\parseargline#1^^M{%
+ \endgroup % End of the group started in \parsearg.
+ \argremovecomment #1\comment\ArgTerm%
+ }%
+}
+
+% First remove any @comment, then any @c comment.
+\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
+\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
+
+% Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
+%
+% \argremovec might leave us with trailing space, e.g.,
+% @end itemize @c foo
+% This space token undergoes the same procedure and is eventually removed
+% by \finishparsearg.
+%
+\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
+\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
+\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
+ \def\temp{#3}%
+ \ifx\temp\empty
+ % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
+ \let\temp\finishparsearg
+ \else
+ \let\temp\argcheckspaces
+ \fi
+ % Put the space token in:
+ \temp#1 #3\ArgTerm
+}
+
+% If a _delimited_ argument is enclosed in braces, they get stripped; so
+% to get _exactly_ the rest of the line, we had to prevent such situation.
+% We prepended an \empty token at the very beginning and we expand it now,
+% just before passing the control to \argtorun.
+% (Similarly, we have to think about #3 of \argcheckspacesY above: it is
+% either the null string, or it ends with \^^M---thus there is no danger
+% that a pair of braces would be stripped.
+%
+% But first, we have to remove the trailing space token.
+%
+\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
+
+% \parseargdef\foo{...}
+% is roughly equivalent to
+% \def\foo{\parsearg\Xfoo}
+% \def\Xfoo#1{...}
+%
+% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my
+% favourite TeX trick. --kasal, 16nov03
+
+\def\parseargdef#1{%
+ \expandafter \doparseargdef \csname\string#1\endcsname #1%
+}
+\def\doparseargdef#1#2{%
+ \def#2{\parsearg#1}%
+ \def#1##1%
+}
+
+% Several utility definitions with active space:
+{
+ \obeyspaces
+ \gdef\obeyedspace{ }
+
+ % Make each space character in the input produce a normal interword
+ % space in the output. Don't allow a line break at this space, as this
+ % is used only in environments like @example, where each line of input
+ % should produce a line of output anyway.
+ %
+ \gdef\sepspaces{\obeyspaces\let =\tie}
+
+ % If an index command is used in an @example environment, any spaces
+ % therein should become regular spaces in the raw index file, not the
+ % expansion of \tie (\leavevmode \penalty \@M \ ).
+ \gdef\unsepspaces{\let =\space}
+}
+
+
+\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
+
+% Define the framework for environments in texinfo.tex. It's used like this:
+%
+% \envdef\foo{...}
+% \def\Efoo{...}
+%
+% It's the responsibility of \envdef to insert \begingroup before the
+% actual body; @end closes the group after calling \Efoo. \envdef also
+% defines \thisenv, so the current environment is known; @end checks
+% whether the environment name matches. The \checkenv macro can also be
+% used to check whether the current environment is the one expected.
+%
+% Non-false conditionals (@iftex, @ifset) don't fit into this, so they
+% are not treated as environments; they don't open a group. (The
+% implementation of @end takes care not to call \endgroup in this
+% special case.)
+
+
+% At run-time, environments start with this:
+\def\startenvironment#1{\begingroup\def\thisenv{#1}}
+% initialize
+\let\thisenv\empty
+
+% ... but they get defined via ``\envdef\foo{...}'':
+\long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
+\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
+
+% Check whether we're in the right environment:
+\def\checkenv#1{%
+ \def\temp{#1}%
+ \ifx\thisenv\temp
+ \else
+ \badenverr
+ \fi
+}
+
+% Environment mismatch, #1 expected:
+\def\badenverr{%
+ \errhelp = \EMsimple
+ \errmessage{This command can appear only \inenvironment\temp,
+ not \inenvironment\thisenv}%
+}
+\def\inenvironment#1{%
+ \ifx#1\empty
+ outside of any environment%
+ \else
+ in environment \expandafter\string#1%
+ \fi
+}
+
+% @end foo executes the definition of \Efoo.
+% But first, it executes a specialized version of \checkenv
+%
+\parseargdef\end{%
+ \if 1\csname iscond.#1\endcsname
+ \else
+ % The general wording of \badenverr may not be ideal.
+ \expandafter\checkenv\csname#1\endcsname
+ \csname E#1\endcsname
+ \endgroup
+ \fi
+}
+
+\newhelp\EMsimple{Press RETURN to continue.}
+
+
+% Be sure we're in horizontal mode when doing a tie, since we make space
+% equivalent to this in @example-like environments. Otherwise, a space
+% at the beginning of a line will start with \penalty -- and
+% since \penalty is valid in vertical mode, we'd end up putting the
+% penalty on the vertical list instead of in the new paragraph.
+{\catcode`@ = 11
+ % Avoid using \@M directly, because that causes trouble
+ % if the definition is written into an index file.
+ \global\let\tiepenalty = \@M
+ \gdef\tie{\leavevmode\penalty\tiepenalty\ }
+}
+
+% @: forces normal size whitespace following.
+\def\:{\spacefactor=1000 }
+
+% @* forces a line break.
+\def\*{\hfil\break\hbox{}\ignorespaces}
+
+% @/ allows a line break.
+\let\/=\allowbreak
+
+% @. is an end-of-sentence period.
+\def\.{.\spacefactor=\endofsentencespacefactor\space}
+
+% @! is an end-of-sentence bang.
+\def\!{!\spacefactor=\endofsentencespacefactor\space}
+
+% @? is an end-of-sentence query.
+\def\?{?\spacefactor=\endofsentencespacefactor\space}
+
+% @frenchspacing on|off says whether to put extra space after punctuation.
+%
+\def\onword{on}
+\def\offword{off}
+%
+\parseargdef\frenchspacing{%
+ \def\temp{#1}%
+ \ifx\temp\onword \plainfrenchspacing
+ \else\ifx\temp\offword \plainnonfrenchspacing
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
+ \fi\fi
+}
+
+% @w prevents a word break. Without the \leavevmode, @w at the
+% beginning of a paragraph, when TeX is still in vertical mode, would
+% produce a whole line of output instead of starting the paragraph.
+\def\w#1{\leavevmode\hbox{#1}}
+
+% @group ... @end group forces ... to be all on one page, by enclosing
+% it in a TeX vbox. We use \vtop instead of \vbox to construct the box
+% to keep its height that of a normal line. According to the rules for
+% \topskip (p.114 of the TeXbook), the glue inserted is
+% max (\topskip - \ht (first item), 0). If that height is large,
+% therefore, no glue is inserted, and the space between the headline and
+% the text is small, which looks bad.
+%
+% Another complication is that the group might be very large. This can
+% cause the glue on the previous page to be unduly stretched, because it
+% does not have much material. In this case, it's better to add an
+% explicit \vfill so that the extra space is at the bottom. The
+% threshold for doing this is if the group is more than \vfilllimit
+% percent of a page (\vfilllimit can be changed inside of @tex).
+%
+\newbox\groupbox
+\def\vfilllimit{0.7}
+%
+\envdef\group{%
+ \ifnum\catcode`\^^M=\active \else
+ \errhelp = \groupinvalidhelp
+ \errmessage{@group invalid in context where filling is enabled}%
+ \fi
+ \startsavinginserts
+ %
+ \setbox\groupbox = \vtop\bgroup
+ % Do @comment since we are called inside an environment such as
+ % @example, where each end-of-line in the input causes an
+ % end-of-line in the output. We don't want the end-of-line after
+ % the `@group' to put extra space in the output. Since @group
+ % should appear on a line by itself (according to the Texinfo
+ % manual), we don't worry about eating any user text.
+ \comment
+}
+%
+% The \vtop produces a box with normal height and large depth; thus, TeX puts
+% \baselineskip glue before it, and (when the next line of text is done)
+% \lineskip glue after it. Thus, space below is not quite equal to space
+% above. But it's pretty close.
+\def\Egroup{%
+ % To get correct interline space between the last line of the group
+ % and the first line afterwards, we have to propagate \prevdepth.
+ \endgraf % Not \par, as it may have been set to \lisppar.
+ \global\dimen1 = \prevdepth
+ \egroup % End the \vtop.
+ % \dimen0 is the vertical size of the group's box.
+ \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
+ % \dimen2 is how much space is left on the page (more or less).
+ \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
+ % if the group doesn't fit on the current page, and it's a big big
+ % group, force a page break.
+ \ifdim \dimen0 > \dimen2
+ \ifdim \pagetotal < \vfilllimit\pageheight
+ \page
+ \fi
+ \fi
+ \box\groupbox
+ \prevdepth = \dimen1
+ \checkinserts
+}
+%
+% TeX puts in an \escapechar (i.e., `@') at the beginning of the help
+% message, so this ends up printing `@group can only ...'.
+%
+\newhelp\groupinvalidhelp{%
+group can only be used in environments such as @example,^^J%
+where each line of input produces a line of output.}
+
+% @need space-in-mils
+% forces a page break if there is not space-in-mils remaining.
+
+\newdimen\mil \mil=0.001in
+
+\parseargdef\need{%
+ % Ensure vertical mode, so we don't make a big box in the middle of a
+ % paragraph.
+ \par
+ %
+ % If the @need value is less than one line space, it's useless.
+ \dimen0 = #1\mil
+ \dimen2 = \ht\strutbox
+ \advance\dimen2 by \dp\strutbox
+ \ifdim\dimen0 > \dimen2
+ %
+ % Do a \strut just to make the height of this box be normal, so the
+ % normal leading is inserted relative to the preceding line.
+ % And a page break here is fine.
+ \vtop to #1\mil{\strut\vfil}%
+ %
+ % TeX does not even consider page breaks if a penalty added to the
+ % main vertical list is 10000 or more. But in order to see if the
+ % empty box we just added fits on the page, we must make it consider
+ % page breaks. On the other hand, we don't want to actually break the
+ % page after the empty box. So we use a penalty of 9999.
+ %
+ % There is an extremely small chance that TeX will actually break the
+ % page at this \penalty, if there are no other feasible breakpoints in
+ % sight. (If the user is using lots of big @group commands, which
+ % almost-but-not-quite fill up a page, TeX will have a hard time doing
+ % good page breaking, for example.) However, I could not construct an
+ % example where a page broke at this \penalty; if it happens in a real
+ % document, then we can reconsider our strategy.
+ \penalty9999
+ %
+ % Back up by the size of the box, whether we did a page break or not.
+ \kern -#1\mil
+ %
+ % Do not allow a page break right after this kern.
+ \nobreak
+ \fi
+}
+
+% @br forces paragraph break (and is undocumented).
+
+\let\br = \par
+
+% @page forces the start of a new page.
+%
+\def\page{\par\vfill\supereject}
+
+% @exdent text....
+% outputs text on separate line in roman font, starting at standard page margin
+
+% This records the amount of indent in the innermost environment.
+% That's how much \exdent should take out.
+\newskip\exdentamount
+
+% This defn is used inside fill environments such as @defun.
+\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
+
+% This defn is used inside nofill environments such as @example.
+\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
+ \leftline{\hskip\leftskip{\rm#1}}}}
+
+% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
+% paragraph. For more general purposes, use the \margin insertion
+% class. WHICH is `l' or `r'. Not documented, written for gawk manual.
+%
+\newskip\inmarginspacing \inmarginspacing=1cm
+\def\strutdepth{\dp\strutbox}
+%
+\def\doinmargin#1#2{\strut\vadjust{%
+ \nobreak
+ \kern-\strutdepth
+ \vtop to \strutdepth{%
+ \baselineskip=\strutdepth
+ \vss
+ % if you have multiple lines of stuff to put here, you'll need to
+ % make the vbox yourself of the appropriate size.
+ \ifx#1l%
+ \llap{\ignorespaces #2\hskip\inmarginspacing}%
+ \else
+ \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
+ \fi
+ \null
+ }%
+}}
+\def\inleftmargin{\doinmargin l}
+\def\inrightmargin{\doinmargin r}
+%
+% @inmargin{TEXT [, RIGHT-TEXT]}
+% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
+% else use TEXT for both).
+%
+\def\inmargin#1{\parseinmargin #1,,\finish}
+\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
+ \setbox0 = \hbox{\ignorespaces #2}%
+ \ifdim\wd0 > 0pt
+ \def\lefttext{#1}% have both texts
+ \def\righttext{#2}%
+ \else
+ \def\lefttext{#1}% have only one text
+ \def\righttext{#1}%
+ \fi
+ %
+ \ifodd\pageno
+ \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
+ \else
+ \def\temp{\inleftmargin\lefttext}%
+ \fi
+ \temp
+}
+
+% @| inserts a changebar to the left of the current line. It should
+% surround any changed text. This approach does *not* work if the
+% change spans more than two lines of output. To handle that, we would
+% have adopt a much more difficult approach (putting marks into the main
+% vertical list for the beginning and end of each change). This command
+% is not documented, not supported, and doesn't work.
+%
+\def\|{%
+ % \vadjust can only be used in horizontal mode.
+ \leavevmode
+ %
+ % Append this vertical mode material after the current line in the output.
+ \vadjust{%
+ % We want to insert a rule with the height and depth of the current
+ % leading; that is exactly what \strutbox is supposed to record.
+ \vskip-\baselineskip
+ %
+ % \vadjust-items are inserted at the left edge of the type. So
+ % the \llap here moves out into the left-hand margin.
+ \llap{%
+ %
+ % For a thicker or thinner bar, change the `1pt'.
+ \vrule height\baselineskip width1pt
+ %
+ % This is the space between the bar and the text.
+ \hskip 12pt
+ }%
+ }%
+}
+
+% @include FILE -- \input text of FILE.
+%
+\def\include{\parseargusing\filenamecatcodes\includezzz}
+\def\includezzz#1{%
+ \pushthisfilestack
+ \def\thisfile{#1}%
+ {%
+ \makevalueexpandable % we want to expand any @value in FILE.
+ \turnoffactive % and allow special characters in the expansion
+ \indexnofonts % Allow `@@' and other weird things in file names.
+ \wlog{texinfo.tex: doing @include of #1^^J}%
+ \edef\temp{\noexpand\input #1 }%
+ %
+ % This trickery is to read FILE outside of a group, in case it makes
+ % definitions, etc.
+ \expandafter
+ }\temp
+ \popthisfilestack
+}
+\def\filenamecatcodes{%
+ \catcode`\\=\other
+ \catcode`~=\other
+ \catcode`^=\other
+ \catcode`_=\other
+ \catcode`|=\other
+ \catcode`<=\other
+ \catcode`>=\other
+ \catcode`+=\other
+ \catcode`-=\other
+ \catcode`\`=\other
+ \catcode`\'=\other
+}
+
+\def\pushthisfilestack{%
+ \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
+}
+\def\pushthisfilestackX{%
+ \expandafter\pushthisfilestackY\thisfile\StackTerm
+}
+\def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
+ \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
+}
+
+\def\popthisfilestack{\errthisfilestackempty}
+\def\errthisfilestackempty{\errmessage{Internal error:
+ the stack of filenames is empty.}}
+%
+\def\thisfile{}
+
+% @center line
+% outputs that line, centered.
+%
+\parseargdef\center{%
+ \ifhmode
+ \let\centersub\centerH
+ \else
+ \let\centersub\centerV
+ \fi
+ \centersub{\hfil \ignorespaces#1\unskip \hfil}%
+ \let\centersub\relax % don't let the definition persist, just in case
+}
+\def\centerH#1{{%
+ \hfil\break
+ \advance\hsize by -\leftskip
+ \advance\hsize by -\rightskip
+ \line{#1}%
+ \break
+}}
+%
+\newcount\centerpenalty
+\def\centerV#1{%
+ % The idea here is the same as in \startdefun, \cartouche, etc.: if
+ % @center is the first thing after a section heading, we need to wipe
+ % out the negative parskip inserted by \sectionheading, but still
+ % prevent a page break here.
+ \centerpenalty = \lastpenalty
+ \ifnum\centerpenalty>10000 \vskip\parskip \fi
+ \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
+ \line{\kern\leftskip #1\kern\rightskip}%
+}
+
+% @sp n outputs n lines of vertical space
+%
+\parseargdef\sp{\vskip #1\baselineskip}
+
+% @comment ...line which is ignored...
+% @c is the same as @comment
+% @ignore ... @end ignore is another way to write a comment
+%
+\def\comment{\begingroup \catcode`\^^M=\other%
+\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
+\commentxxx}
+{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
+%
+\let\c=\comment
+
+% @paragraphindent NCHARS
+% We'll use ems for NCHARS, close enough.
+% NCHARS can also be the word `asis' or `none'.
+% We cannot feasibly implement @paragraphindent asis, though.
+%
+\def\asisword{asis} % no translation, these are keywords
+\def\noneword{none}
+%
+\parseargdef\paragraphindent{%
+ \def\temp{#1}%
+ \ifx\temp\asisword
+ \else
+ \ifx\temp\noneword
+ \defaultparindent = 0pt
+ \else
+ \defaultparindent = #1em
+ \fi
+ \fi
+ \parindent = \defaultparindent
+}
+
+% @exampleindent NCHARS
+% We'll use ems for NCHARS like @paragraphindent.
+% It seems @exampleindent asis isn't necessary, but
+% I preserve it to make it similar to @paragraphindent.
+\parseargdef\exampleindent{%
+ \def\temp{#1}%
+ \ifx\temp\asisword
+ \else
+ \ifx\temp\noneword
+ \lispnarrowing = 0pt
+ \else
+ \lispnarrowing = #1em
+ \fi
+ \fi
+}
+
+% @firstparagraphindent WORD
+% If WORD is `none', then suppress indentation of the first paragraph
+% after a section heading. If WORD is `insert', then do indent at such
+% paragraphs.
+%
+% The paragraph indentation is suppressed or not by calling
+% \suppressfirstparagraphindent, which the sectioning commands do.
+% We switch the definition of this back and forth according to WORD.
+% By default, we suppress indentation.
+%
+\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
+\def\insertword{insert}
+%
+\parseargdef\firstparagraphindent{%
+ \def\temp{#1}%
+ \ifx\temp\noneword
+ \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
+ \else\ifx\temp\insertword
+ \let\suppressfirstparagraphindent = \relax
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @firstparagraphindent option `\temp'}%
+ \fi\fi
+}
+
+% Here is how we actually suppress indentation. Redefine \everypar to
+% \kern backwards by \parindent, and then reset itself to empty.
+%
+% We also make \indent itself not actually do anything until the next
+% paragraph.
+%
+\gdef\dosuppressfirstparagraphindent{%
+ \gdef\indent{%
+ \restorefirstparagraphindent
+ \indent
+ }%
+ \gdef\noindent{%
+ \restorefirstparagraphindent
+ \noindent
+ }%
+ \global\everypar = {%
+ \kern -\parindent
+ \restorefirstparagraphindent
+ }%
+}
+
+\gdef\restorefirstparagraphindent{%
+ \global \let \indent = \ptexindent
+ \global \let \noindent = \ptexnoindent
+ \global \everypar = {}%
+}
+
+
+% @refill is a no-op.
+\let\refill=\relax
+
+% If working on a large document in chapters, it is convenient to
+% be able to disable indexing, cross-referencing, and contents, for test runs.
+% This is done with @novalidate (before @setfilename).
+%
+\newif\iflinks \linkstrue % by default we want the aux files.
+\let\novalidate = \linksfalse
+
+% @setfilename is done at the beginning of every texinfo file.
+% So open here the files we need to have open while reading the input.
+% This makes it possible to make a .fmt file for texinfo.
+\def\setfilename{%
+ \fixbackslash % Turn off hack to swallow `\input texinfo'.
+ \iflinks
+ \tryauxfile
+ % Open the new aux file. TeX will close it automatically at exit.
+ \immediate\openout\auxfile=\jobname.aux
+ \fi % \openindices needs to do some work in any case.
+ \openindices
+ \let\setfilename=\comment % Ignore extra @setfilename cmds.
+ %
+ % If texinfo.cnf is present on the system, read it.
+ % Useful for site-wide @afourpaper, etc.
+ \openin 1 texinfo.cnf
+ \ifeof 1 \else \input texinfo.cnf \fi
+ \closein 1
+ %
+ \comment % Ignore the actual filename.
+}
+
+% Called from \setfilename.
+%
+\def\openindices{%
+ \newindex{cp}%
+ \newcodeindex{fn}%
+ \newcodeindex{vr}%
+ \newcodeindex{tp}%
+ \newcodeindex{ky}%
+ \newcodeindex{pg}%
+}
+
+% @bye.
+\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
+
+
+\message{pdf,}
+% adobe `portable' document format
+\newcount\tempnum
+\newcount\lnkcount
+\newtoks\filename
+\newcount\filenamelength
+\newcount\pgn
+\newtoks\toksA
+\newtoks\toksB
+\newtoks\toksC
+\newtoks\toksD
+\newbox\boxA
+\newcount\countA
+\newif\ifpdf
+\newif\ifpdfmakepagedest
+
+% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
+% can be set). So we test for \relax and 0 as well as being undefined.
+\ifx\pdfoutput\thisisundefined
+\else
+ \ifx\pdfoutput\relax
+ \else
+ \ifcase\pdfoutput
+ \else
+ \pdftrue
+ \fi
+ \fi
+\fi
+
+% PDF uses PostScript string constants for the names of xref targets,
+% for display in the outlines, and in other places. Thus, we have to
+% double any backslashes. Otherwise, a name like "\node" will be
+% interpreted as a newline (\n), followed by o, d, e. Not good.
+%
+% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
+% related messages. The final outcome is that it is up to the TeX user
+% to double the backslashes and otherwise make the string valid, so
+% that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
+% do this reliably, so we use it.
+
+% #1 is a control sequence in which to do the replacements,
+% which we \xdef.
+\def\txiescapepdf#1{%
+ \ifx\pdfescapestring\thisisundefined
+ % No primitive available; should we give a warning or log?
+ % Many times it won't matter.
+ \else
+ % The expandable \pdfescapestring primitive escapes parentheses,
+ % backslashes, and other special chars.
+ \xdef#1{\pdfescapestring{#1}}%
+ \fi
+}
+
+\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
+with PDF output, and none of those formats could be found. (.eps cannot
+be supported due to the design of the PDF format; use regular TeX (DVI
+output) for that.)}
+
+\ifpdf
+ %
+ % Color manipulation macros based on pdfcolor.tex,
+ % except using rgb instead of cmyk; the latter is said to render as a
+ % very dark gray on-screen and a very dark halftone in print, instead
+ % of actual black.
+ \def\rgbDarkRed{0.50 0.09 0.12}
+ \def\rgbBlack{0 0 0}
+ %
+ % k sets the color for filling (usual text, etc.);
+ % K sets the color for stroking (thin rules, e.g., normal _'s).
+ \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
+ %
+ % Set color, and create a mark which defines \thiscolor accordingly,
+ % so that \makeheadline knows which color to restore.
+ \def\setcolor#1{%
+ \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
+ \domark
+ \pdfsetcolor{#1}%
+ }
+ %
+ \def\maincolor{\rgbBlack}
+ \pdfsetcolor{\maincolor}
+ \edef\thiscolor{\maincolor}
+ \def\lastcolordefs{}
+ %
+ \def\makefootline{%
+ \baselineskip24pt
+ \line{\pdfsetcolor{\maincolor}\the\footline}%
+ }
+ %
+ \def\makeheadline{%
+ \vbox to 0pt{%
+ \vskip-22.5pt
+ \line{%
+ \vbox to8.5pt{}%
+ % Extract \thiscolor definition from the marks.
+ \getcolormarks
+ % Typeset the headline with \maincolor, then restore the color.
+ \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
+ }%
+ \vss
+ }%
+ \nointerlineskip
+ }
+ %
+ %
+ \pdfcatalog{/PageMode /UseOutlines}
+ %
+ % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
+ \def\dopdfimage#1#2#3{%
+ \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
+ \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
+ %
+ % pdftex (and the PDF format) support .pdf, .png, .jpg (among
+ % others). Let's try in that order, PDF first since if
+ % someone has a scalable image, presumably better to use that than a
+ % bitmap.
+ \let\pdfimgext=\empty
+ \begingroup
+ \openin 1 #1.pdf \ifeof 1
+ \openin 1 #1.PDF \ifeof 1
+ \openin 1 #1.png \ifeof 1
+ \openin 1 #1.jpg \ifeof 1
+ \openin 1 #1.jpeg \ifeof 1
+ \openin 1 #1.JPG \ifeof 1
+ \errhelp = \nopdfimagehelp
+ \errmessage{Could not find image file #1 for pdf}%
+ \else \gdef\pdfimgext{JPG}%
+ \fi
+ \else \gdef\pdfimgext{jpeg}%
+ \fi
+ \else \gdef\pdfimgext{jpg}%
+ \fi
+ \else \gdef\pdfimgext{png}%
+ \fi
+ \else \gdef\pdfimgext{PDF}%
+ \fi
+ \else \gdef\pdfimgext{pdf}%
+ \fi
+ \closein 1
+ \endgroup
+ %
+ % without \immediate, ancient pdftex seg faults when the same image is
+ % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
+ \ifnum\pdftexversion < 14
+ \immediate\pdfimage
+ \else
+ \immediate\pdfximage
+ \fi
+ \ifdim \wd0 >0pt width \pdfimagewidth \fi
+ \ifdim \wd2 >0pt height \pdfimageheight \fi
+ \ifnum\pdftexversion<13
+ #1.\pdfimgext
+ \else
+ {#1.\pdfimgext}%
+ \fi
+ \ifnum\pdftexversion < 14 \else
+ \pdfrefximage \pdflastximage
+ \fi}
+ %
+ \def\pdfmkdest#1{{%
+ % We have to set dummies so commands such as @code, and characters
+ % such as \, aren't expanded when present in a section title.
+ \indexnofonts
+ \turnoffactive
+ \makevalueexpandable
+ \def\pdfdestname{#1}%
+ \txiescapepdf\pdfdestname
+ \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
+ }}
+ %
+ % used to mark target names; must be expandable.
+ \def\pdfmkpgn#1{#1}
+ %
+ % by default, use a color that is dark enough to print on paper as
+ % nearly black, but still distinguishable for online viewing.
+ \def\urlcolor{\rgbDarkRed}
+ \def\linkcolor{\rgbDarkRed}
+ \def\endlink{\setcolor{\maincolor}\pdfendlink}
+ %
+ % Adding outlines to PDF; macros for calculating structure of outlines
+ % come from Petr Olsak
+ \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
+ \else \csname#1\endcsname \fi}
+ \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
+ \advance\tempnum by 1
+ \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
+ %
+ % #1 is the section text, which is what will be displayed in the
+ % outline by the pdf viewer. #2 is the pdf expression for the number
+ % of subentries (or empty, for subsubsections). #3 is the node text,
+ % which might be empty if this toc entry had no corresponding node.
+ % #4 is the page number
+ %
+ \def\dopdfoutline#1#2#3#4{%
+ % Generate a link to the node text if that exists; else, use the
+ % page number. We could generate a destination for the section
+ % text in the case where a section has no node, but it doesn't
+ % seem worth the trouble, since most documents are normally structured.
+ \edef\pdfoutlinedest{#3}%
+ \ifx\pdfoutlinedest\empty
+ \def\pdfoutlinedest{#4}%
+ \else
+ \txiescapepdf\pdfoutlinedest
+ \fi
+ %
+ % Also escape PDF chars in the display string.
+ \edef\pdfoutlinetext{#1}%
+ \txiescapepdf\pdfoutlinetext
+ %
+ \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
+ }
+ %
+ \def\pdfmakeoutlines{%
+ \begingroup
+ % Read toc silently, to get counts of subentries for \pdfoutline.
+ \def\partentry##1##2##3##4{}% ignore parts in the outlines
+ \def\numchapentry##1##2##3##4{%
+ \def\thischapnum{##2}%
+ \def\thissecnum{0}%
+ \def\thissubsecnum{0}%
+ }%
+ \def\numsecentry##1##2##3##4{%
+ \advancenumber{chap\thischapnum}%
+ \def\thissecnum{##2}%
+ \def\thissubsecnum{0}%
+ }%
+ \def\numsubsecentry##1##2##3##4{%
+ \advancenumber{sec\thissecnum}%
+ \def\thissubsecnum{##2}%
+ }%
+ \def\numsubsubsecentry##1##2##3##4{%
+ \advancenumber{subsec\thissubsecnum}%
+ }%
+ \def\thischapnum{0}%
+ \def\thissecnum{0}%
+ \def\thissubsecnum{0}%
+ %
+ % use \def rather than \let here because we redefine \chapentry et
+ % al. a second time, below.
+ \def\appentry{\numchapentry}%
+ \def\appsecentry{\numsecentry}%
+ \def\appsubsecentry{\numsubsecentry}%
+ \def\appsubsubsecentry{\numsubsubsecentry}%
+ \def\unnchapentry{\numchapentry}%
+ \def\unnsecentry{\numsecentry}%
+ \def\unnsubsecentry{\numsubsecentry}%
+ \def\unnsubsubsecentry{\numsubsubsecentry}%
+ \readdatafile{toc}%
+ %
+ % Read toc second time, this time actually producing the outlines.
+ % The `-' means take the \expnumber as the absolute number of
+ % subentries, which we calculated on our first read of the .toc above.
+ %
+ % We use the node names as the destinations.
+ \def\numchapentry##1##2##3##4{%
+ \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
+ \def\numsecentry##1##2##3##4{%
+ \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
+ \def\numsubsecentry##1##2##3##4{%
+ \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
+ \def\numsubsubsecentry##1##2##3##4{% count is always zero
+ \dopdfoutline{##1}{}{##3}{##4}}%
+ %
+ % PDF outlines are displayed using system fonts, instead of
+ % document fonts. Therefore we cannot use special characters,
+ % since the encoding is unknown. For example, the eogonek from
+ % Latin 2 (0xea) gets translated to a | character. Info from
+ % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
+ %
+ % TODO this right, we have to translate 8-bit characters to
+ % their "best" equivalent, based on the @documentencoding. Too
+ % much work for too little return. Just use the ASCII equivalents
+ % we use for the index sort strings.
+ %
+ \indexnofonts
+ \setupdatafile
+ % We can have normal brace characters in the PDF outlines, unlike
+ % Texinfo index files. So set that up.
+ \def\{{\lbracecharliteral}%
+ \def\}{\rbracecharliteral}%
+ \catcode`\\=\active \otherbackslash
+ \input \tocreadfilename
+ \endgroup
+ }
+ {\catcode`[=1 \catcode`]=2
+ \catcode`{=\other \catcode`}=\other
+ \gdef\lbracecharliteral[{]%
+ \gdef\rbracecharliteral[}]%
+ ]
+ %
+ \def\skipspaces#1{\def\PP{#1}\def\D{|}%
+ \ifx\PP\D\let\nextsp\relax
+ \else\let\nextsp\skipspaces
+ \addtokens{\filename}{\PP}%
+ \advance\filenamelength by 1
+ \fi
+ \nextsp}
+ \def\getfilename#1{%
+ \filenamelength=0
+ % If we don't expand the argument now, \skipspaces will get
+ % snagged on things like "@value{foo}".
+ \edef\temp{#1}%
+ \expandafter\skipspaces\temp|\relax
+ }
+ \ifnum\pdftexversion < 14
+ \let \startlink \pdfannotlink
+ \else
+ \let \startlink \pdfstartlink
+ \fi
+ % make a live url in pdf output.
+ \def\pdfurl#1{%
+ \begingroup
+ % it seems we really need yet another set of dummies; have not
+ % tried to figure out what each command should do in the context
+ % of @url. for now, just make @/ a no-op, that's the only one
+ % people have actually reported a problem with.
+ %
+ \normalturnoffactive
+ \def\@{@}%
+ \let\/=\empty
+ \makevalueexpandable
+ % do we want to go so far as to use \indexnofonts instead of just
+ % special-casing \var here?
+ \def\var##1{##1}%
+ %
+ \leavevmode\setcolor{\urlcolor}%
+ \startlink attr{/Border [0 0 0]}%
+ user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
+ \endgroup}
+ \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
+ \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
+ \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
+ \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
+ \def\maketoks{%
+ \expandafter\poptoks\the\toksA|ENDTOKS|\relax
+ \ifx\first0\adn0
+ \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
+ \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
+ \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
+ \else
+ \ifnum0=\countA\else\makelink\fi
+ \ifx\first.\let\next=\done\else
+ \let\next=\maketoks
+ \addtokens{\toksB}{\the\toksD}
+ \ifx\first,\addtokens{\toksB}{\space}\fi
+ \fi
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+ \next}
+ \def\makelink{\addtokens{\toksB}%
+ {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
+ \def\pdflink#1{%
+ \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
+ \setcolor{\linkcolor}#1\endlink}
+ \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
+\else
+ % non-pdf mode
+ \let\pdfmkdest = \gobble
+ \let\pdfurl = \gobble
+ \let\endlink = \relax
+ \let\setcolor = \gobble
+ \let\pdfsetcolor = \gobble
+ \let\pdfmakeoutlines = \relax
+\fi % \ifx\pdfoutput
+
+
+\message{fonts,}
+
+% Change the current font style to #1, remembering it in \curfontstyle.
+% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
+% italics, not bold italics.
+%
+\def\setfontstyle#1{%
+ \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
+ \csname ten#1\endcsname % change the current font
+}
+
+% Select #1 fonts with the current style.
+%
+\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname}
+
+\def\rm{\fam=0 \setfontstyle{rm}}
+\def\it{\fam=\itfam \setfontstyle{it}}
+\def\sl{\fam=\slfam \setfontstyle{sl}}
+\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
+\def\tt{\fam=\ttfam \setfontstyle{tt}}
+
+% Unfortunately, we have to override this for titles and the like, since
+% in those cases "rm" is bold. Sigh.
+\def\rmisbold{\rm\def\curfontstyle{bf}}
+
+% Texinfo sort of supports the sans serif font style, which plain TeX does not.
+% So we set up a \sf.
+\newfam\sffam
+\def\sf{\fam=\sffam \setfontstyle{sf}}
+\let\li = \sf % Sometimes we call it \li, not \sf.
+
+% We don't need math for this font style.
+\def\ttsl{\setfontstyle{ttsl}}
+
+
+% Set the baselineskip to #1, and the lineskip and strut size
+% correspondingly. There is no deep meaning behind these magic numbers
+% used as factors; they just match (closely enough) what Knuth defined.
+%
+\def\lineskipfactor{.08333}
+\def\strutheightpercent{.70833}
+\def\strutdepthpercent {.29167}
+%
+% can get a sort of poor man's double spacing by redefining this.
+\def\baselinefactor{1}
+%
+\newdimen\textleading
+\def\setleading#1{%
+ \dimen0 = #1\relax
+ \normalbaselineskip = \baselinefactor\dimen0
+ \normallineskip = \lineskipfactor\normalbaselineskip
+ \normalbaselines
+ \setbox\strutbox =\hbox{%
+ \vrule width0pt height\strutheightpercent\baselineskip
+ depth \strutdepthpercent \baselineskip
+ }%
+}
+
+% PDF CMaps. See also LaTeX's t1.cmap.
+%
+% do nothing with this by default.
+\expandafter\let\csname cmapOT1\endcsname\gobble
+\expandafter\let\csname cmapOT1IT\endcsname\gobble
+\expandafter\let\csname cmapOT1TT\endcsname\gobble
+
+% if we are producing pdf, and we have \pdffontattr, then define cmaps.
+% (\pdffontattr was introduced many years ago, but people still run
+% older pdftex's; it's easy to conditionalize, so we do.)
+\ifpdf \ifx\pdffontattr\thisisundefined \else
+ \begingroup
+ \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
+ \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
+%%DocumentNeededResources: ProcSet (CIDInit)
+%%IncludeResource: ProcSet (CIDInit)
+%%BeginResource: CMap (TeX-OT1-0)
+%%Title: (TeX-OT1-0 TeX OT1 0)
+%%Version: 1.000
+%%EndComments
+/CIDInit /ProcSet findresource begin
+12 dict begin
+begincmap
+/CIDSystemInfo
+<< /Registry (TeX)
+/Ordering (OT1)
+/Supplement 0
+>> def
+/CMapName /TeX-OT1-0 def
+/CMapType 2 def
+1 begincodespacerange
+<00> <7F>
+endcodespacerange
+8 beginbfrange
+<00> <01> <0393>
+<09> <0A> <03A8>
+<23> <26> <0023>
+<28> <3B> <0028>
+<3F> <5B> <003F>
+<5D> <5E> <005D>
+<61> <7A> <0061>
+<7B> <7C> <2013>
+endbfrange
+40 beginbfchar
+<02> <0398>
+<03> <039B>
+<04> <039E>
+<05> <03A0>
+<06> <03A3>
+<07> <03D2>
+<08> <03A6>
+<0B> <00660066>
+<0C> <00660069>
+<0D> <0066006C>
+<0E> <006600660069>
+<0F> <00660066006C>
+<10> <0131>
+<11> <0237>
+<12> <0060>
+<13> <00B4>
+<14> <02C7>
+<15> <02D8>
+<16> <00AF>
+<17> <02DA>
+<18> <00B8>
+<19> <00DF>
+<1A> <00E6>
+<1B> <0153>
+<1C> <00F8>
+<1D> <00C6>
+<1E> <0152>
+<1F> <00D8>
+<21> <0021>
+<22> <201D>
+<27> <2019>
+<3C> <00A1>
+<3D> <003D>
+<3E> <00BF>
+<5C> <201C>
+<5F> <02D9>
+<60> <2018>
+<7D> <02DD>
+<7E> <007E>
+<7F> <00A8>
+endbfchar
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+end
+%%EndResource
+%%EOF
+ }\endgroup
+ \expandafter\edef\csname cmapOT1\endcsname#1{%
+ \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
+ }%
+%
+% \cmapOT1IT
+ \begingroup
+ \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
+ \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
+%%DocumentNeededResources: ProcSet (CIDInit)
+%%IncludeResource: ProcSet (CIDInit)
+%%BeginResource: CMap (TeX-OT1IT-0)
+%%Title: (TeX-OT1IT-0 TeX OT1IT 0)
+%%Version: 1.000
+%%EndComments
+/CIDInit /ProcSet findresource begin
+12 dict begin
+begincmap
+/CIDSystemInfo
+<< /Registry (TeX)
+/Ordering (OT1IT)
+/Supplement 0
+>> def
+/CMapName /TeX-OT1IT-0 def
+/CMapType 2 def
+1 begincodespacerange
+<00> <7F>
+endcodespacerange
+8 beginbfrange
+<00> <01> <0393>
+<09> <0A> <03A8>
+<25> <26> <0025>
+<28> <3B> <0028>
+<3F> <5B> <003F>
+<5D> <5E> <005D>
+<61> <7A> <0061>
+<7B> <7C> <2013>
+endbfrange
+42 beginbfchar
+<02> <0398>
+<03> <039B>
+<04> <039E>
+<05> <03A0>
+<06> <03A3>
+<07> <03D2>
+<08> <03A6>
+<0B> <00660066>
+<0C> <00660069>
+<0D> <0066006C>
+<0E> <006600660069>
+<0F> <00660066006C>
+<10> <0131>
+<11> <0237>
+<12> <0060>
+<13> <00B4>
+<14> <02C7>
+<15> <02D8>
+<16> <00AF>
+<17> <02DA>
+<18> <00B8>
+<19> <00DF>
+<1A> <00E6>
+<1B> <0153>
+<1C> <00F8>
+<1D> <00C6>
+<1E> <0152>
+<1F> <00D8>
+<21> <0021>
+<22> <201D>
+<23> <0023>
+<24> <00A3>
+<27> <2019>
+<3C> <00A1>
+<3D> <003D>
+<3E> <00BF>
+<5C> <201C>
+<5F> <02D9>
+<60> <2018>
+<7D> <02DD>
+<7E> <007E>
+<7F> <00A8>
+endbfchar
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+end
+%%EndResource
+%%EOF
+ }\endgroup
+ \expandafter\edef\csname cmapOT1IT\endcsname#1{%
+ \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
+ }%
+%
+% \cmapOT1TT
+ \begingroup
+ \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
+ \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
+%%DocumentNeededResources: ProcSet (CIDInit)
+%%IncludeResource: ProcSet (CIDInit)
+%%BeginResource: CMap (TeX-OT1TT-0)
+%%Title: (TeX-OT1TT-0 TeX OT1TT 0)
+%%Version: 1.000
+%%EndComments
+/CIDInit /ProcSet findresource begin
+12 dict begin
+begincmap
+/CIDSystemInfo
+<< /Registry (TeX)
+/Ordering (OT1TT)
+/Supplement 0
+>> def
+/CMapName /TeX-OT1TT-0 def
+/CMapType 2 def
+1 begincodespacerange
+<00> <7F>
+endcodespacerange
+5 beginbfrange
+<00> <01> <0393>
+<09> <0A> <03A8>
+<21> <26> <0021>
+<28> <5F> <0028>
+<61> <7E> <0061>
+endbfrange
+32 beginbfchar
+<02> <0398>
+<03> <039B>
+<04> <039E>
+<05> <03A0>
+<06> <03A3>
+<07> <03D2>
+<08> <03A6>
+<0B> <2191>
+<0C> <2193>
+<0D> <0027>
+<0E> <00A1>
+<0F> <00BF>
+<10> <0131>
+<11> <0237>
+<12> <0060>
+<13> <00B4>
+<14> <02C7>
+<15> <02D8>
+<16> <00AF>
+<17> <02DA>
+<18> <00B8>
+<19> <00DF>
+<1A> <00E6>
+<1B> <0153>
+<1C> <00F8>
+<1D> <00C6>
+<1E> <0152>
+<1F> <00D8>
+<20> <2423>
+<27> <2019>
+<60> <2018>
+<7F> <00A8>
+endbfchar
+endcmap
+CMapName currentdict /CMap defineresource pop
+end
+end
+%%EndResource
+%%EOF
+ }\endgroup
+ \expandafter\edef\csname cmapOT1TT\endcsname#1{%
+ \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
+ }%
+\fi\fi
+
+
+% Set the font macro #1 to the font named \fontprefix#2.
+% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
+% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
+% Example:
+% #1 = \textrm
+% #2 = \rmshape
+% #3 = 10
+% #4 = \mainmagstep
+% #5 = OT1
+%
+\def\setfont#1#2#3#4#5{%
+ \font#1=\fontprefix#2#3 scaled #4
+ \csname cmap#5\endcsname#1%
+}
+% This is what gets called when #5 of \setfont is empty.
+\let\cmap\gobble
+%
+% (end of cmaps)
+
+% Use cm as the default font prefix.
+% To specify the font prefix, you must define \fontprefix
+% before you read in texinfo.tex.
+\ifx\fontprefix\thisisundefined
+\def\fontprefix{cm}
+\fi
+% Support font families that don't use the same naming scheme as CM.
+\def\rmshape{r}
+\def\rmbshape{bx} % where the normal face is bold
+\def\bfshape{b}
+\def\bxshape{bx}
+\def\ttshape{tt}
+\def\ttbshape{tt}
+\def\ttslshape{sltt}
+\def\itshape{ti}
+\def\itbshape{bxti}
+\def\slshape{sl}
+\def\slbshape{bxsl}
+\def\sfshape{ss}
+\def\sfbshape{ss}
+\def\scshape{csc}
+\def\scbshape{csc}
+
+% Definitions for a main text size of 11pt. (The default in Texinfo.)
+%
+\def\definetextfontsizexi{%
+% Text fonts (11.2pt, magstep1).
+\def\textnominalsize{11pt}
+\edef\mainmagstep{\magstephalf}
+\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
+\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
+\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
+\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
+\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
+\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
+\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
+\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
+\font\texti=cmmi10 scaled \mainmagstep
+\font\textsy=cmsy10 scaled \mainmagstep
+\def\textecsize{1095}
+
+% A few fonts for @defun names and args.
+\setfont\defbf\bfshape{10}{\magstep1}{OT1}
+\setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
+\setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
+\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
+
+% Fonts for indices, footnotes, small examples (9pt).
+\def\smallnominalsize{9pt}
+\setfont\smallrm\rmshape{9}{1000}{OT1}
+\setfont\smalltt\ttshape{9}{1000}{OT1TT}
+\setfont\smallbf\bfshape{10}{900}{OT1}
+\setfont\smallit\itshape{9}{1000}{OT1IT}
+\setfont\smallsl\slshape{9}{1000}{OT1}
+\setfont\smallsf\sfshape{9}{1000}{OT1}
+\setfont\smallsc\scshape{10}{900}{OT1}
+\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
+\font\smalli=cmmi9
+\font\smallsy=cmsy9
+\def\smallecsize{0900}
+
+% Fonts for small examples (8pt).
+\def\smallernominalsize{8pt}
+\setfont\smallerrm\rmshape{8}{1000}{OT1}
+\setfont\smallertt\ttshape{8}{1000}{OT1TT}
+\setfont\smallerbf\bfshape{10}{800}{OT1}
+\setfont\smallerit\itshape{8}{1000}{OT1IT}
+\setfont\smallersl\slshape{8}{1000}{OT1}
+\setfont\smallersf\sfshape{8}{1000}{OT1}
+\setfont\smallersc\scshape{10}{800}{OT1}
+\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
+\font\smalleri=cmmi8
+\font\smallersy=cmsy8
+\def\smallerecsize{0800}
+
+% Fonts for title page (20.4pt):
+\def\titlenominalsize{20pt}
+\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
+\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
+\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
+\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
+\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
+\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
+\let\titlebf=\titlerm
+\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
+\font\titlei=cmmi12 scaled \magstep3
+\font\titlesy=cmsy10 scaled \magstep4
+\def\titleecsize{2074}
+
+% Chapter (and unnumbered) fonts (17.28pt).
+\def\chapnominalsize{17pt}
+\setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
+\setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
+\setfont\chapsl\slbshape{10}{\magstep3}{OT1}
+\setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
+\setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
+\setfont\chapsf\sfbshape{17}{1000}{OT1}
+\let\chapbf=\chaprm
+\setfont\chapsc\scbshape{10}{\magstep3}{OT1}
+\font\chapi=cmmi12 scaled \magstep2
+\font\chapsy=cmsy10 scaled \magstep3
+\def\chapecsize{1728}
+
+% Section fonts (14.4pt).
+\def\secnominalsize{14pt}
+\setfont\secrm\rmbshape{12}{\magstep1}{OT1}
+\setfont\secit\itbshape{10}{\magstep2}{OT1IT}
+\setfont\secsl\slbshape{10}{\magstep2}{OT1}
+\setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
+\setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
+\setfont\secsf\sfbshape{12}{\magstep1}{OT1}
+\let\secbf\secrm
+\setfont\secsc\scbshape{10}{\magstep2}{OT1}
+\font\seci=cmmi12 scaled \magstep1
+\font\secsy=cmsy10 scaled \magstep2
+\def\sececsize{1440}
+
+% Subsection fonts (13.15pt).
+\def\ssecnominalsize{13pt}
+\setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
+\setfont\ssecit\itbshape{10}{1315}{OT1IT}
+\setfont\ssecsl\slbshape{10}{1315}{OT1}
+\setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
+\setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
+\setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
+\let\ssecbf\ssecrm
+\setfont\ssecsc\scbshape{10}{1315}{OT1}
+\font\sseci=cmmi12 scaled \magstephalf
+\font\ssecsy=cmsy10 scaled 1315
+\def\ssececsize{1200}
+
+% Reduced fonts for @acro in text (10pt).
+\def\reducednominalsize{10pt}
+\setfont\reducedrm\rmshape{10}{1000}{OT1}
+\setfont\reducedtt\ttshape{10}{1000}{OT1TT}
+\setfont\reducedbf\bfshape{10}{1000}{OT1}
+\setfont\reducedit\itshape{10}{1000}{OT1IT}
+\setfont\reducedsl\slshape{10}{1000}{OT1}
+\setfont\reducedsf\sfshape{10}{1000}{OT1}
+\setfont\reducedsc\scshape{10}{1000}{OT1}
+\setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
+\font\reducedi=cmmi10
+\font\reducedsy=cmsy10
+\def\reducedecsize{1000}
+
+\textleading = 13.2pt % line spacing for 11pt CM
+\textfonts % reset the current fonts
+\rm
+} % end of 11pt text font size definitions, \definetextfontsizexi
+
+
+% Definitions to make the main text be 10pt Computer Modern, with
+% section, chapter, etc., sizes following suit. This is for the GNU
+% Press printing of the Emacs 22 manual. Maybe other manuals in the
+% future. Used with @smallbook, which sets the leading to 12pt.
+%
+\def\definetextfontsizex{%
+% Text fonts (10pt).
+\def\textnominalsize{10pt}
+\edef\mainmagstep{1000}
+\setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
+\setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
+\setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
+\setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
+\setfont\textsl\slshape{10}{\mainmagstep}{OT1}
+\setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
+\setfont\textsc\scshape{10}{\mainmagstep}{OT1}
+\setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
+\font\texti=cmmi10 scaled \mainmagstep
+\font\textsy=cmsy10 scaled \mainmagstep
+\def\textecsize{1000}
+
+% A few fonts for @defun names and args.
+\setfont\defbf\bfshape{10}{\magstephalf}{OT1}
+\setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
+\setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
+\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
+
+% Fonts for indices, footnotes, small examples (9pt).
+\def\smallnominalsize{9pt}
+\setfont\smallrm\rmshape{9}{1000}{OT1}
+\setfont\smalltt\ttshape{9}{1000}{OT1TT}
+\setfont\smallbf\bfshape{10}{900}{OT1}
+\setfont\smallit\itshape{9}{1000}{OT1IT}
+\setfont\smallsl\slshape{9}{1000}{OT1}
+\setfont\smallsf\sfshape{9}{1000}{OT1}
+\setfont\smallsc\scshape{10}{900}{OT1}
+\setfont\smallttsl\ttslshape{10}{900}{OT1TT}
+\font\smalli=cmmi9
+\font\smallsy=cmsy9
+\def\smallecsize{0900}
+
+% Fonts for small examples (8pt).
+\def\smallernominalsize{8pt}
+\setfont\smallerrm\rmshape{8}{1000}{OT1}
+\setfont\smallertt\ttshape{8}{1000}{OT1TT}
+\setfont\smallerbf\bfshape{10}{800}{OT1}
+\setfont\smallerit\itshape{8}{1000}{OT1IT}
+\setfont\smallersl\slshape{8}{1000}{OT1}
+\setfont\smallersf\sfshape{8}{1000}{OT1}
+\setfont\smallersc\scshape{10}{800}{OT1}
+\setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
+\font\smalleri=cmmi8
+\font\smallersy=cmsy8
+\def\smallerecsize{0800}
+
+% Fonts for title page (20.4pt):
+\def\titlenominalsize{20pt}
+\setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
+\setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
+\setfont\titlesl\slbshape{10}{\magstep4}{OT1}
+\setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
+\setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
+\setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
+\let\titlebf=\titlerm
+\setfont\titlesc\scbshape{10}{\magstep4}{OT1}
+\font\titlei=cmmi12 scaled \magstep3
+\font\titlesy=cmsy10 scaled \magstep4
+\def\titleecsize{2074}
+
+% Chapter fonts (14.4pt).
+\def\chapnominalsize{14pt}
+\setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
+\setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
+\setfont\chapsl\slbshape{10}{\magstep2}{OT1}
+\setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
+\setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
+\setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
+\let\chapbf\chaprm
+\setfont\chapsc\scbshape{10}{\magstep2}{OT1}
+\font\chapi=cmmi12 scaled \magstep1
+\font\chapsy=cmsy10 scaled \magstep2
+\def\chapecsize{1440}
+
+% Section fonts (12pt).
+\def\secnominalsize{12pt}
+\setfont\secrm\rmbshape{12}{1000}{OT1}
+\setfont\secit\itbshape{10}{\magstep1}{OT1IT}
+\setfont\secsl\slbshape{10}{\magstep1}{OT1}
+\setfont\sectt\ttbshape{12}{1000}{OT1TT}
+\setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
+\setfont\secsf\sfbshape{12}{1000}{OT1}
+\let\secbf\secrm
+\setfont\secsc\scbshape{10}{\magstep1}{OT1}
+\font\seci=cmmi12
+\font\secsy=cmsy10 scaled \magstep1
+\def\sececsize{1200}
+
+% Subsection fonts (10pt).
+\def\ssecnominalsize{10pt}
+\setfont\ssecrm\rmbshape{10}{1000}{OT1}
+\setfont\ssecit\itbshape{10}{1000}{OT1IT}
+\setfont\ssecsl\slbshape{10}{1000}{OT1}
+\setfont\ssectt\ttbshape{10}{1000}{OT1TT}
+\setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
+\setfont\ssecsf\sfbshape{10}{1000}{OT1}
+\let\ssecbf\ssecrm
+\setfont\ssecsc\scbshape{10}{1000}{OT1}
+\font\sseci=cmmi10
+\font\ssecsy=cmsy10
+\def\ssececsize{1000}
+
+% Reduced fonts for @acro in text (9pt).
+\def\reducednominalsize{9pt}
+\setfont\reducedrm\rmshape{9}{1000}{OT1}
+\setfont\reducedtt\ttshape{9}{1000}{OT1TT}
+\setfont\reducedbf\bfshape{10}{900}{OT1}
+\setfont\reducedit\itshape{9}{1000}{OT1IT}
+\setfont\reducedsl\slshape{9}{1000}{OT1}
+\setfont\reducedsf\sfshape{9}{1000}{OT1}
+\setfont\reducedsc\scshape{10}{900}{OT1}
+\setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
+\font\reducedi=cmmi9
+\font\reducedsy=cmsy9
+\def\reducedecsize{0900}
+
+\divide\parskip by 2 % reduce space between paragraphs
+\textleading = 12pt % line spacing for 10pt CM
+\textfonts % reset the current fonts
+\rm
+} % end of 10pt text font size definitions, \definetextfontsizex
+
+
+% We provide the user-level command
+% @fonttextsize 10
+% (or 11) to redefine the text font size. pt is assumed.
+%
+\def\xiword{11}
+\def\xword{10}
+\def\xwordpt{10pt}
+%
+\parseargdef\fonttextsize{%
+ \def\textsizearg{#1}%
+ %\wlog{doing @fonttextsize \textsizearg}%
+ %
+ % Set \globaldefs so that documents can use this inside @tex, since
+ % makeinfo 4.8 does not support it, but we need it nonetheless.
+ %
+ \begingroup \globaldefs=1
+ \ifx\textsizearg\xword \definetextfontsizex
+ \else \ifx\textsizearg\xiword \definetextfontsizexi
+ \else
+ \errhelp=\EMsimple
+ \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
+ \fi\fi
+ \endgroup
+}
+
+
+% In order for the font changes to affect most math symbols and letters,
+% we have to define the \textfont of the standard families. Since
+% texinfo doesn't allow for producing subscripts and superscripts except
+% in the main text, we don't bother to reset \scriptfont and
+% \scriptscriptfont (which would also require loading a lot more fonts).
+%
+\def\resetmathfonts{%
+ \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
+ \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
+ \textfont\ttfam=\tentt \textfont\sffam=\tensf
+}
+
+% The font-changing commands redefine the meanings of \tenSTYLE, instead
+% of just \STYLE. We do this because \STYLE needs to also set the
+% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire
+% \tenSTYLE to set the current font.
+%
+% Each font-changing command also sets the names \lsize (one size lower)
+% and \lllsize (three sizes lower). These relative commands are used in
+% the LaTeX logo and acronyms.
+%
+% This all needs generalizing, badly.
+%
+\def\textfonts{%
+ \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
+ \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
+ \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
+ \let\tenttsl=\textttsl
+ \def\curfontsize{text}%
+ \def\lsize{reduced}\def\lllsize{smaller}%
+ \resetmathfonts \setleading{\textleading}}
+\def\titlefonts{%
+ \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
+ \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
+ \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
+ \let\tenttsl=\titlettsl
+ \def\curfontsize{title}%
+ \def\lsize{chap}\def\lllsize{subsec}%
+ \resetmathfonts \setleading{27pt}}
+\def\titlefont#1{{\titlefonts\rmisbold #1}}
+\def\chapfonts{%
+ \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
+ \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
+ \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
+ \let\tenttsl=\chapttsl
+ \def\curfontsize{chap}%
+ \def\lsize{sec}\def\lllsize{text}%
+ \resetmathfonts \setleading{19pt}}
+\def\secfonts{%
+ \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
+ \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
+ \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
+ \let\tenttsl=\secttsl
+ \def\curfontsize{sec}%
+ \def\lsize{subsec}\def\lllsize{reduced}%
+ \resetmathfonts \setleading{16pt}}
+\def\subsecfonts{%
+ \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
+ \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
+ \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
+ \let\tenttsl=\ssecttsl
+ \def\curfontsize{ssec}%
+ \def\lsize{text}\def\lllsize{small}%
+ \resetmathfonts \setleading{15pt}}
+\let\subsubsecfonts = \subsecfonts
+\def\reducedfonts{%
+ \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl
+ \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc
+ \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy
+ \let\tenttsl=\reducedttsl
+ \def\curfontsize{reduced}%
+ \def\lsize{small}\def\lllsize{smaller}%
+ \resetmathfonts \setleading{10.5pt}}
+\def\smallfonts{%
+ \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
+ \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
+ \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
+ \let\tenttsl=\smallttsl
+ \def\curfontsize{small}%
+ \def\lsize{smaller}\def\lllsize{smaller}%
+ \resetmathfonts \setleading{10.5pt}}
+\def\smallerfonts{%
+ \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
+ \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
+ \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
+ \let\tenttsl=\smallerttsl
+ \def\curfontsize{smaller}%
+ \def\lsize{smaller}\def\lllsize{smaller}%
+ \resetmathfonts \setleading{9.5pt}}
+
+% Fonts for short table of contents.
+\setfont\shortcontrm\rmshape{12}{1000}{OT1}
+\setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
+\setfont\shortcontsl\slshape{12}{1000}{OT1}
+\setfont\shortconttt\ttshape{12}{1000}{OT1TT}
+
+% Define these just so they can be easily changed for other fonts.
+\def\angleleft{$\langle$}
+\def\angleright{$\rangle$}
+
+% Set the fonts to use with the @small... environments.
+\let\smallexamplefonts = \smallfonts
+
+% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
+% can fit this many characters:
+% 8.5x11=86 smallbook=72 a4=90 a5=69
+% If we use \scriptfonts (8pt), then we can fit this many characters:
+% 8.5x11=90+ smallbook=80 a4=90+ a5=77
+% For me, subjectively, the few extra characters that fit aren't worth
+% the additional smallness of 8pt. So I'm making the default 9pt.
+%
+% By the way, for comparison, here's what fits with @example (10pt):
+% 8.5x11=71 smallbook=60 a4=75 a5=58
+% --karl, 24jan03.
+
+% Set up the default fonts, so we can use them for creating boxes.
+%
+\definetextfontsizexi
+
+
+\message{markup,}
+
+% Check if we are currently using a typewriter font. Since all the
+% Computer Modern typewriter fonts have zero interword stretch (and
+% shrink), and it is reasonable to expect all typewriter fonts to have
+% this property, we can check that font parameter.
+%
+\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
+
+% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
+% define and register \INITMACRO to be called on markup style changes.
+% \INITMACRO can check \currentmarkupstyle for the innermost
+% style and the set of \ifmarkupSTYLE switches for all styles
+% currently in effect.
+\newif\ifmarkupvar
+\newif\ifmarkupsamp
+\newif\ifmarkupkey
+%\newif\ifmarkupfile % @file == @samp.
+%\newif\ifmarkupoption % @option == @samp.
+\newif\ifmarkupcode
+\newif\ifmarkupkbd
+%\newif\ifmarkupenv % @env == @code.
+%\newif\ifmarkupcommand % @command == @code.
+\newif\ifmarkuptex % @tex (and part of @math, for now).
+\newif\ifmarkupexample
+\newif\ifmarkupverb
+\newif\ifmarkupverbatim
+
+\let\currentmarkupstyle\empty
+
+\def\setupmarkupstyle#1{%
+ \csname markup#1true\endcsname
+ \def\currentmarkupstyle{#1}%
+ \markupstylesetup
+}
+
+\let\markupstylesetup\empty
+
+\def\defmarkupstylesetup#1{%
+ \expandafter\def\expandafter\markupstylesetup
+ \expandafter{\markupstylesetup #1}%
+ \def#1%
+}
+
+% Markup style setup for left and right quotes.
+\defmarkupstylesetup\markupsetuplq{%
+ \expandafter\let\expandafter \temp
+ \csname markupsetuplq\currentmarkupstyle\endcsname
+ \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
+}
+
+\defmarkupstylesetup\markupsetuprq{%
+ \expandafter\let\expandafter \temp
+ \csname markupsetuprq\currentmarkupstyle\endcsname
+ \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
+}
+
+{
+\catcode`\'=\active
+\catcode`\`=\active
+
+\gdef\markupsetuplqdefault{\let`\lq}
+\gdef\markupsetuprqdefault{\let'\rq}
+
+\gdef\markupsetcodequoteleft{\let`\codequoteleft}
+\gdef\markupsetcodequoteright{\let'\codequoteright}
+
+\gdef\markupsetnoligaturesquoteleft{\let`\noligaturesquoteleft}
+}
+
+\let\markupsetuplqcode \markupsetcodequoteleft
+\let\markupsetuprqcode \markupsetcodequoteright
+%
+\let\markupsetuplqexample \markupsetcodequoteleft
+\let\markupsetuprqexample \markupsetcodequoteright
+%
+\let\markupsetuplqsamp \markupsetcodequoteleft
+\let\markupsetuprqsamp \markupsetcodequoteright
+%
+\let\markupsetuplqverb \markupsetcodequoteleft
+\let\markupsetuprqverb \markupsetcodequoteright
+%
+\let\markupsetuplqverbatim \markupsetcodequoteleft
+\let\markupsetuprqverbatim \markupsetcodequoteright
+
+\let\markupsetuplqkbd \markupsetnoligaturesquoteleft
+
+% Allow an option to not use regular directed right quote/apostrophe
+% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
+% The undirected quote is ugly, so don't make it the default, but it
+% works for pasting with more pdf viewers (at least evince), the
+% lilypond developers report. xpdf does work with the regular 0x27.
+%
+\def\codequoteright{%
+ \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
+ \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
+ '%
+ \else \char'15 \fi
+ \else \char'15 \fi
+}
+%
+% and a similar option for the left quote char vs. a grave accent.
+% Modern fonts display ASCII 0x60 as a grave accent, so some people like
+% the code environments to do likewise.
+%
+\def\codequoteleft{%
+ \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
+ \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
+ % [Knuth] pp. 380,381,391
+ % \relax disables Spanish ligatures ?` and !` of \tt font.
+ \relax`%
+ \else \char'22 \fi
+ \else \char'22 \fi
+}
+
+% Commands to set the quote options.
+%
+\parseargdef\codequoteundirected{%
+ \def\temp{#1}%
+ \ifx\temp\onword
+ \expandafter\let\csname SETtxicodequoteundirected\endcsname
+ = t%
+ \else\ifx\temp\offword
+ \expandafter\let\csname SETtxicodequoteundirected\endcsname
+ = \relax
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
+ \fi\fi
+}
+%
+\parseargdef\codequotebacktick{%
+ \def\temp{#1}%
+ \ifx\temp\onword
+ \expandafter\let\csname SETtxicodequotebacktick\endcsname
+ = t%
+ \else\ifx\temp\offword
+ \expandafter\let\csname SETtxicodequotebacktick\endcsname
+ = \relax
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
+ \fi\fi
+}
+
+% [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
+\def\noligaturesquoteleft{\relax\lq}
+
+% Count depth in font-changes, for error checks
+\newcount\fontdepth \fontdepth=0
+
+% Font commands.
+
+% #1 is the font command (\sl or \it), #2 is the text to slant.
+% If we are in a monospaced environment, however, 1) always use \ttsl,
+% and 2) do not add an italic correction.
+\def\dosmartslant#1#2{%
+ \ifusingtt
+ {{\ttsl #2}\let\next=\relax}%
+ {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
+ \next
+}
+\def\smartslanted{\dosmartslant\sl}
+\def\smartitalic{\dosmartslant\it}
+
+% Output an italic correction unless \next (presumed to be the following
+% character) is such as not to need one.
+\def\smartitaliccorrection{%
+ \ifx\next,%
+ \else\ifx\next-%
+ \else\ifx\next.%
+ \else\ptexslash
+ \fi\fi\fi
+ \aftersmartic
+}
+
+% like \smartslanted except unconditionally uses \ttsl, and no ic.
+% @var is set to this for defun arguments.
+\def\ttslanted#1{{\ttsl #1}}
+
+% @cite is like \smartslanted except unconditionally use \sl. We never want
+% ttsl for book titles, do we?
+\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
+
+\def\aftersmartic{}
+\def\var#1{%
+ \let\saveaftersmartic = \aftersmartic
+ \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
+ \smartslanted{#1}%
+}
+
+\let\i=\smartitalic
+\let\slanted=\smartslanted
+\let\dfn=\smartslanted
+\let\emph=\smartitalic
+
+% Explicit font changes: @r, @sc, undocumented @ii.
+\def\r#1{{\rm #1}} % roman font
+\def\sc#1{{\smallcaps#1}} % smallcaps font
+\def\ii#1{{\it #1}} % italic font
+
+% @b, explicit bold. Also @strong.
+\def\b#1{{\bf #1}}
+\let\strong=\b
+
+% @sansserif, explicit sans.
+\def\sansserif#1{{\sf #1}}
+
+% We can't just use \exhyphenpenalty, because that only has effect at
+% the end of a paragraph. Restore normal hyphenation at the end of the
+% group within which \nohyphenation is presumably called.
+%
+\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
+\def\restorehyphenation{\hyphenchar\font = `- }
+
+% Set sfcode to normal for the chars that usually have another value.
+% Can't use plain's \frenchspacing because it uses the `\x notation, and
+% sometimes \x has an active definition that messes things up.
+%
+\catcode`@=11
+ \def\plainfrenchspacing{%
+ \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
+ \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
+ \def\endofsentencespacefactor{1000}% for @. and friends
+ }
+ \def\plainnonfrenchspacing{%
+ \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
+ \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
+ \def\endofsentencespacefactor{3000}% for @. and friends
+ }
+\catcode`@=\other
+\def\endofsentencespacefactor{3000}% default
+
+% @t, explicit typewriter.
+\def\t#1{%
+ {\tt \rawbackslash \plainfrenchspacing #1}%
+ \null
+}
+
+% @samp.
+\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
+
+% definition of @key that produces a lozenge. Doesn't adjust to text size.
+%\setfont\keyrm\rmshape{8}{1000}{OT1}
+%\font\keysy=cmsy9
+%\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
+% \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
+% \vbox{\hrule\kern-0.4pt
+% \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
+% \kern-0.4pt\hrule}%
+% \kern-.06em\raise0.4pt\hbox{\angleright}}}}
+
+% definition of @key with no lozenge. If the current font is already
+% monospace, don't change it; that way, we respect @kbdinputstyle. But
+% if it isn't monospace, then use \tt.
+%
+\def\key#1{{\setupmarkupstyle{key}%
+ \nohyphenation
+ \ifmonospace\else\tt\fi
+ #1}\null}
+
+% ctrl is no longer a Texinfo command.
+\def\ctrl #1{{\tt \rawbackslash \hat}#1}
+
+% @file, @option are the same as @samp.
+\let\file=\samp
+\let\option=\samp
+
+% @code is a modification of @t,
+% which makes spaces the same size as normal in the surrounding text.
+\def\tclose#1{%
+ {%
+ % Change normal interword space to be same as for the current font.
+ \spaceskip = \fontdimen2\font
+ %
+ % Switch to typewriter.
+ \tt
+ %
+ % But `\ ' produces the large typewriter interword space.
+ \def\ {{\spaceskip = 0pt{} }}%
+ %
+ % Turn off hyphenation.
+ \nohyphenation
+ %
+ \rawbackslash
+ \plainfrenchspacing
+ #1%
+ }%
+ \null % reset spacefactor to 1000
+}
+
+% We *must* turn on hyphenation at `-' and `_' in @code.
+% Otherwise, it is too hard to avoid overfull hboxes
+% in the Emacs manual, the Library manual, etc.
+
+% Unfortunately, TeX uses one parameter (\hyphenchar) to control
+% both hyphenation at - and hyphenation within words.
+% We must therefore turn them both off (\tclose does that)
+% and arrange explicitly to hyphenate at a dash.
+% -- rms.
+{
+ \catcode`\-=\active \catcode`\_=\active
+ \catcode`\'=\active \catcode`\`=\active
+ \global\let'=\rq \global\let`=\lq % default definitions
+ %
+ \global\def\code{\begingroup
+ \setupmarkupstyle{code}%
+ % The following should really be moved into \setupmarkupstyle handlers.
+ \catcode\dashChar=\active \catcode\underChar=\active
+ \ifallowcodebreaks
+ \let-\codedash
+ \let_\codeunder
+ \else
+ \let-\realdash
+ \let_\realunder
+ \fi
+ \codex
+ }
+}
+
+\def\codex #1{\tclose{#1}\endgroup}
+
+\def\realdash{-}
+\def\codedash{-\discretionary{}{}{}}
+\def\codeunder{%
+ % this is all so @math{@code{var_name}+1} can work. In math mode, _
+ % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
+ % will therefore expand the active definition of _, which is us
+ % (inside @code that is), therefore an endless loop.
+ \ifusingtt{\ifmmode
+ \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
+ \else\normalunderscore \fi
+ \discretionary{}{}{}}%
+ {\_}%
+}
+
+% An additional complication: the above will allow breaks after, e.g.,
+% each of the four underscores in __typeof__. This is undesirable in
+% some manuals, especially if they don't have long identifiers in
+% general. @allowcodebreaks provides a way to control this.
+%
+\newif\ifallowcodebreaks \allowcodebreakstrue
+
+\def\keywordtrue{true}
+\def\keywordfalse{false}
+
+\parseargdef\allowcodebreaks{%
+ \def\txiarg{#1}%
+ \ifx\txiarg\keywordtrue
+ \allowcodebreakstrue
+ \else\ifx\txiarg\keywordfalse
+ \allowcodebreaksfalse
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
+ \fi\fi
+}
+
+% @uref (abbreviation for `urlref') takes an optional (comma-separated)
+% second argument specifying the text to display and an optional third
+% arg as text to display instead of (rather than in addition to) the url
+% itself. First (mandatory) arg is the url.
+% (This \urefnobreak definition isn't used now, leaving it for a while
+% for comparison.)
+\def\urefnobreak#1{\dourefnobreak #1,,,\finish}
+\def\dourefnobreak#1,#2,#3,#4\finish{\begingroup
+ \unsepspaces
+ \pdfurl{#1}%
+ \setbox0 = \hbox{\ignorespaces #3}%
+ \ifdim\wd0 > 0pt
+ \unhbox0 % third arg given, show only that
+ \else
+ \setbox0 = \hbox{\ignorespaces #2}%
+ \ifdim\wd0 > 0pt
+ \ifpdf
+ \unhbox0 % PDF: 2nd arg given, show only it
+ \else
+ \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
+ \fi
+ \else
+ \code{#1}% only url given, so show it
+ \fi
+ \fi
+ \endlink
+\endgroup}
+
+% This \urefbreak definition is the active one.
+\def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
+\let\uref=\urefbreak
+\def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
+\def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
+ \unsepspaces
+ \pdfurl{#1}%
+ \setbox0 = \hbox{\ignorespaces #3}%
+ \ifdim\wd0 > 0pt
+ \unhbox0 % third arg given, show only that
+ \else
+ \setbox0 = \hbox{\ignorespaces #2}%
+ \ifdim\wd0 > 0pt
+ \ifpdf
+ \unhbox0 % PDF: 2nd arg given, show only it
+ \else
+ \unhbox0\ (\urefcode{#1})% DVI: 2nd arg given, show both it and url
+ \fi
+ \else
+ \urefcode{#1}% only url given, so show it
+ \fi
+ \fi
+ \endlink
+\endgroup}
+
+% Allow line breaks around only a few characters (only).
+\def\urefcatcodes{%
+ \catcode\ampChar=\active \catcode\dotChar=\active
+ \catcode\hashChar=\active \catcode\questChar=\active
+ \catcode\slashChar=\active
+}
+{
+ \urefcatcodes
+ %
+ \global\def\urefcode{\begingroup
+ \setupmarkupstyle{code}%
+ \urefcatcodes
+ \let&\urefcodeamp
+ \let.\urefcodedot
+ \let#\urefcodehash
+ \let?\urefcodequest
+ \let/\urefcodeslash
+ \codex
+ }
+ %
+ % By default, they are just regular characters.
+ \global\def&{\normalamp}
+ \global\def.{\normaldot}
+ \global\def#{\normalhash}
+ \global\def?{\normalquest}
+ \global\def/{\normalslash}
+}
+
+% we put a little stretch before and after the breakable chars, to help
+% line breaking of long url's. The unequal skips make look better in
+% cmtt at least, especially for dots.
+\def\urefprestretch{\urefprebreak \hskip0pt plus.13em }
+\def\urefpoststretch{\urefpostbreak \hskip0pt plus.1em }
+%
+\def\urefcodeamp{\urefprestretch \&\urefpoststretch}
+\def\urefcodedot{\urefprestretch .\urefpoststretch}
+\def\urefcodehash{\urefprestretch \#\urefpoststretch}
+\def\urefcodequest{\urefprestretch ?\urefpoststretch}
+\def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
+{
+ \catcode`\/=\active
+ \global\def\urefcodeslashfinish{%
+ \urefprestretch \slashChar
+ % Allow line break only after the final / in a sequence of
+ % slashes, to avoid line break between the slashes in http://.
+ \ifx\next/\else \urefpoststretch \fi
+ }
+}
+
+% One more complication: by default we'll break after the special
+% characters, but some people like to break before the special chars, so
+% allow that. Also allow no breaking at all, for manual control.
+%
+\parseargdef\urefbreakstyle{%
+ \def\txiarg{#1}%
+ \ifx\txiarg\wordnone
+ \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
+ \else\ifx\txiarg\wordbefore
+ \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
+ \else\ifx\txiarg\wordafter
+ \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
+ \fi\fi\fi
+}
+\def\wordafter{after}
+\def\wordbefore{before}
+\def\wordnone{none}
+
+\urefbreakstyle after
+
+% @url synonym for @uref, since that's how everyone uses it.
+%
+\let\url=\uref
+
+% rms does not like angle brackets --karl, 17may97.
+% So now @email is just like @uref, unless we are pdf.
+%
+%\def\email#1{\angleleft{\tt #1}\angleright}
+\ifpdf
+ \def\email#1{\doemail#1,,\finish}
+ \def\doemail#1,#2,#3\finish{\begingroup
+ \unsepspaces
+ \pdfurl{mailto:#1}%
+ \setbox0 = \hbox{\ignorespaces #2}%
+ \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
+ \endlink
+ \endgroup}
+\else
+ \let\email=\uref
+\fi
+
+% @kbd is like @code, except that if the argument is just one @key command,
+% then @kbd has no effect.
+\def\kbd#1{{\setupmarkupstyle{kbd}\def\look{#1}\expandafter\kbdfoo\look??\par}}
+
+% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
+% `example' (@kbd uses ttsl only inside of @example and friends),
+% or `code' (@kbd uses normal tty font always).
+\parseargdef\kbdinputstyle{%
+ \def\txiarg{#1}%
+ \ifx\txiarg\worddistinct
+ \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
+ \else\ifx\txiarg\wordexample
+ \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
+ \else\ifx\txiarg\wordcode
+ \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
+ \fi\fi\fi
+}
+\def\worddistinct{distinct}
+\def\wordexample{example}
+\def\wordcode{code}
+
+% Default is `distinct'.
+\kbdinputstyle distinct
+
+\def\xkey{\key}
+\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
+\ifx\one\xkey\ifx\threex\three \key{#2}%
+\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
+\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi}
+
+% For @indicateurl, @env, @command quotes seem unnecessary, so use \code.
+\let\indicateurl=\code
+\let\env=\code
+\let\command=\code
+
+% @clicksequence{File @click{} Open ...}
+\def\clicksequence#1{\begingroup #1\endgroup}
+
+% @clickstyle @arrow (by default)
+\parseargdef\clickstyle{\def\click{#1}}
+\def\click{\arrow}
+
+% Typeset a dimension, e.g., `in' or `pt'. The only reason for the
+% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
+%
+\def\dmn#1{\thinspace #1}
+
+% @l was never documented to mean ``switch to the Lisp font'',
+% and it is not used as such in any manual I can find. We need it for
+% Polish suppressed-l. --karl, 22sep96.
+%\def\l#1{{\li #1}\null}
+
+% @acronym for "FBI", "NATO", and the like.
+% We print this one point size smaller, since it's intended for
+% all-uppercase.
+%
+\def\acronym#1{\doacronym #1,,\finish}
+\def\doacronym#1,#2,#3\finish{%
+ {\selectfonts\lsize #1}%
+ \def\temp{#2}%
+ \ifx\temp\empty \else
+ \space ({\unsepspaces \ignorespaces \temp \unskip})%
+ \fi
+ \null % reset \spacefactor=1000
+}
+
+% @abbr for "Comput. J." and the like.
+% No font change, but don't do end-of-sentence spacing.
+%
+\def\abbr#1{\doabbr #1,,\finish}
+\def\doabbr#1,#2,#3\finish{%
+ {\plainfrenchspacing #1}%
+ \def\temp{#2}%
+ \ifx\temp\empty \else
+ \space ({\unsepspaces \ignorespaces \temp \unskip})%
+ \fi
+ \null % reset \spacefactor=1000
+}
+
+% @asis just yields its argument. Used with @table, for example.
+%
+\def\asis#1{#1}
+
+% @math outputs its argument in math mode.
+%
+% One complication: _ usually means subscripts, but it could also mean
+% an actual _ character, as in @math{@var{some_variable} + 1}. So make
+% _ active, and distinguish by seeing if the current family is \slfam,
+% which is what @var uses.
+{
+ \catcode`\_ = \active
+ \gdef\mathunderscore{%
+ \catcode`\_=\active
+ \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
+ }
+}
+% Another complication: we want \\ (and @\) to output a math (or tt) \.
+% FYI, plain.tex uses \\ as a temporary control sequence (for no
+% particular reason), but this is not advertised and we don't care.
+%
+% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
+\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
+%
+\def\math{%
+ \tex
+ \mathunderscore
+ \let\\ = \mathbackslash
+ \mathactive
+ % make the texinfo accent commands work in math mode
+ \let\"=\ddot
+ \let\'=\acute
+ \let\==\bar
+ \let\^=\hat
+ \let\`=\grave
+ \let\u=\breve
+ \let\v=\check
+ \let\~=\tilde
+ \let\dotaccent=\dot
+ $\finishmath
+}
+\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
+
+% Some active characters (such as <) are spaced differently in math.
+% We have to reset their definitions in case the @math was an argument
+% to a command which sets the catcodes (such as @item or @section).
+%
+{
+ \catcode`^ = \active
+ \catcode`< = \active
+ \catcode`> = \active
+ \catcode`+ = \active
+ \catcode`' = \active
+ \gdef\mathactive{%
+ \let^ = \ptexhat
+ \let< = \ptexless
+ \let> = \ptexgtr
+ \let+ = \ptexplus
+ \let' = \ptexquoteright
+ }
+}
+
+% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
+% Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
+% except specified as a normal braced arg, so no newlines to worry about.
+%
+\def\outfmtnametex{tex}
+%
+\long\def\inlinefmt#1{\doinlinefmt #1,\finish}
+\long\def\doinlinefmt#1,#2,\finish{%
+ \def\inlinefmtname{#1}%
+ \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
+}
+% For raw, must switch into @tex before parsing the argument, to avoid
+% setting catcodes prematurely. Doing it this way means that, for
+% example, @inlineraw{html, foo{bar} gets a parse error instead of being
+% ignored. But this isn't important because if people want a literal
+% *right* brace they would have to use a command anyway, so they may as
+% well use a command to get a left brace too. We could re-use the
+% delimiter character idea from \verb, but it seems like overkill.
+%
+\long\def\inlineraw{\tex \doinlineraw}
+\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
+\def\doinlinerawtwo#1,#2,\finish{%
+ \def\inlinerawname{#1}%
+ \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
+ \endgroup % close group opened by \tex.
+}
+
+
+\message{glyphs,}
+% and logos.
+
+% @@ prints an @, as does @atchar{}.
+\def\@{\char64 }
+\let\atchar=\@
+
+% @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
+% Unless we're in typewriter, use \ecfont because the CM text fonts do
+% not have braces, and we don't want to switch into math.
+\def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
+\def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
+\let\{=\mylbrace \let\lbracechar=\{
+\let\}=\myrbrace \let\rbracechar=\}
+\begingroup
+ % Definitions to produce \{ and \} commands for indices,
+ % and @{ and @} for the aux/toc files.
+ \catcode`\{ = \other \catcode`\} = \other
+ \catcode`\[ = 1 \catcode`\] = 2
+ \catcode`\! = 0 \catcode`\\ = \other
+ !gdef!lbracecmd[\{]%
+ !gdef!rbracecmd[\}]%
+ !gdef!lbraceatcmd[@{]%
+ !gdef!rbraceatcmd[@}]%
+!endgroup
+
+% @comma{} to avoid , parsing problems.
+\let\comma = ,
+
+% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
+% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
+\let\, = \ptexc
+\let\dotaccent = \ptexdot
+\def\ringaccent#1{{\accent23 #1}}
+\let\tieaccent = \ptext
+\let\ubaraccent = \ptexb
+\let\udotaccent = \d
+
+% Other special characters: @questiondown @exclamdown @ordf @ordm
+% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
+\def\questiondown{?`}
+\def\exclamdown{!`}
+\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}}
+\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}}
+
+% Dotless i and dotless j, used for accents.
+\def\imacro{i}
+\def\jmacro{j}
+\def\dotless#1{%
+ \def\temp{#1}%
+ \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
+ \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
+ \else \errmessage{@dotless can be used only with i or j}%
+ \fi\fi
+}
+
+% The \TeX{} logo, as in plain, but resetting the spacing so that a
+% period following counts as ending a sentence. (Idea found in latex.)
+%
+\edef\TeX{\TeX \spacefactor=1000 }
+
+% @LaTeX{} logo. Not quite the same results as the definition in
+% latex.ltx, since we use a different font for the raised A; it's most
+% convenient for us to use an explicitly smaller font, rather than using
+% the \scriptstyle font (since we don't reset \scriptstyle and
+% \scriptscriptstyle).
+%
+\def\LaTeX{%
+ L\kern-.36em
+ {\setbox0=\hbox{T}%
+ \vbox to \ht0{\hbox{%
+ \ifx\textnominalsize\xwordpt
+ % for 10pt running text, \lllsize (8pt) is too small for the A in LaTeX.
+ % Revert to plain's \scriptsize, which is 7pt.
+ \count255=\the\fam $\fam\count255 \scriptstyle A$%
+ \else
+ % For 11pt, we can use our lllsize.
+ \selectfonts\lllsize A%
+ \fi
+ }%
+ \vss
+ }}%
+ \kern-.15em
+ \TeX
+}
+
+% Some math mode symbols.
+\def\bullet{$\ptexbullet$}
+\def\geq{\ifmmode \ge\else $\ge$\fi}
+\def\leq{\ifmmode \le\else $\le$\fi}
+\def\minus{\ifmmode -\else $-$\fi}
+
+% @dots{} outputs an ellipsis using the current font.
+% We do .5em per period so that it has the same spacing in the cm
+% typewriter fonts as three actual period characters; on the other hand,
+% in other typewriter fonts three periods are wider than 1.5em. So do
+% whichever is larger.
+%
+\def\dots{%
+ \leavevmode
+ \setbox0=\hbox{...}% get width of three periods
+ \ifdim\wd0 > 1.5em
+ \dimen0 = \wd0
+ \else
+ \dimen0 = 1.5em
+ \fi
+ \hbox to \dimen0{%
+ \hskip 0pt plus.25fil
+ .\hskip 0pt plus1fil
+ .\hskip 0pt plus1fil
+ .\hskip 0pt plus.5fil
+ }%
+}
+
+% @enddots{} is an end-of-sentence ellipsis.
+%
+\def\enddots{%
+ \dots
+ \spacefactor=\endofsentencespacefactor
+}
+
+% @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
+%
+% Since these characters are used in examples, they should be an even number of
+% \tt widths. Each \tt character is 1en, so two makes it 1em.
+%
+\def\point{$\star$}
+\def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
+\def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
+\def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
+\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
+\def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
+
+% The @error{} command.
+% Adapted from the TeXbook's \boxit.
+%
+\newbox\errorbox
+%
+{\tentt \global\dimen0 = 3em}% Width of the box.
+\dimen2 = .55pt % Thickness of rules
+% The text. (`r' is open on the right, `e' somewhat less so on the left.)
+\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
+%
+\setbox\errorbox=\hbox to \dimen0{\hfil
+ \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
+ \advance\hsize by -2\dimen2 % Rules.
+ \vbox{%
+ \hrule height\dimen2
+ \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
+ \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
+ \kern3pt\vrule width\dimen2}% Space to right.
+ \hrule height\dimen2}
+ \hfil}
+%
+\def\error{\leavevmode\lower.7ex\copy\errorbox}
+
+% @pounds{} is a sterling sign, which Knuth put in the CM italic font.
+%
+\def\pounds{{\it\$}}
+
+% @euro{} comes from a separate font, depending on the current style.
+% We use the free feym* fonts from the eurosym package by Henrik
+% Theiling, which support regular, slanted, bold and bold slanted (and
+% "outlined" (blackboard board, sort of) versions, which we don't need).
+% It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
+%
+% Although only regular is the truly official Euro symbol, we ignore
+% that. The Euro is designed to be slightly taller than the regular
+% font height.
+%
+% feymr - regular
+% feymo - slanted
+% feybr - bold
+% feybo - bold slanted
+%
+% There is no good (free) typewriter version, to my knowledge.
+% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
+% Hmm.
+%
+% Also doesn't work in math. Do we need to do math with euro symbols?
+% Hope not.
+%
+%
+\def\euro{{\eurofont e}}
+\def\eurofont{%
+ % We set the font at each command, rather than predefining it in
+ % \textfonts and the other font-switching commands, so that
+ % installations which never need the symbol don't have to have the
+ % font installed.
+ %
+ % There is only one designed size (nominal 10pt), so we always scale
+ % that to the current nominal size.
+ %
+ % By the way, simply using "at 1em" works for cmr10 and the like, but
+ % does not work for cmbx10 and other extended/shrunken fonts.
+ %
+ \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
+ %
+ \ifx\curfontstyle\bfstylename
+ % bold:
+ \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
+ \else
+ % regular:
+ \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
+ \fi
+ \thiseurofont
+}
+
+% Glyphs from the EC fonts. We don't use \let for the aliases, because
+% sometimes we redefine the original macro, and the alias should reflect
+% the redefinition.
+%
+% Use LaTeX names for the Icelandic letters.
+\def\DH{{\ecfont \char"D0}} % Eth
+\def\dh{{\ecfont \char"F0}} % eth
+\def\TH{{\ecfont \char"DE}} % Thorn
+\def\th{{\ecfont \char"FE}} % thorn
+%
+\def\guillemetleft{{\ecfont \char"13}}
+\def\guillemotleft{\guillemetleft}
+\def\guillemetright{{\ecfont \char"14}}
+\def\guillemotright{\guillemetright}
+\def\guilsinglleft{{\ecfont \char"0E}}
+\def\guilsinglright{{\ecfont \char"0F}}
+\def\quotedblbase{{\ecfont \char"12}}
+\def\quotesinglbase{{\ecfont \char"0D}}
+%
+% This positioning is not perfect (see the ogonek LaTeX package), but
+% we have the precomposed glyphs for the most common cases. We put the
+% tests to use those glyphs in the single \ogonek macro so we have fewer
+% dummy definitions to worry about for index entries, etc.
+%
+% ogonek is also used with other letters in Lithuanian (IOU), but using
+% the precomposed glyphs for those is not so easy since they aren't in
+% the same EC font.
+\def\ogonek#1{{%
+ \def\temp{#1}%
+ \ifx\temp\macrocharA\Aogonek
+ \else\ifx\temp\macrochara\aogonek
+ \else\ifx\temp\macrocharE\Eogonek
+ \else\ifx\temp\macrochare\eogonek
+ \else
+ \ecfont \setbox0=\hbox{#1}%
+ \ifdim\ht0=1ex\accent"0C #1%
+ \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
+ \fi
+ \fi\fi\fi\fi
+ }%
+}
+\def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
+\def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
+\def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
+\def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
+%
+% Use the ec* fonts (cm-super in outline format) for non-CM glyphs.
+\def\ecfont{%
+ % We can't distinguish serif/sans and italic/slanted, but this
+ % is used for crude hacks anyway (like adding French and German
+ % quotes to documents typeset with CM, where we lose kerning), so
+ % hopefully nobody will notice/care.
+ \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
+ \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
+ \ifx\curfontstyle\bfstylename
+ % bold:
+ \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
+ \else
+ % regular:
+ \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
+ \fi
+ \thisecfont
+}
+
+% @registeredsymbol - R in a circle. The font for the R should really
+% be smaller yet, but lllsize is the best we can do for now.
+% Adapted from the plain.tex definition of \copyright.
+%
+\def\registeredsymbol{%
+ $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}%
+ \hfil\crcr\Orb}}%
+ }$%
+}
+
+% @textdegree - the normal degrees sign.
+%
+\def\textdegree{$^\circ$}
+
+% Laurent Siebenmann reports \Orb undefined with:
+% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
+% so we'll define it if necessary.
+%
+\ifx\Orb\thisisundefined
+\def\Orb{\mathhexbox20D}
+\fi
+
+% Quotes.
+\chardef\quotedblleft="5C
+\chardef\quotedblright=`\"
+\chardef\quoteleft=`\`
+\chardef\quoteright=`\'
+
+
+\message{page headings,}
+
+\newskip\titlepagetopglue \titlepagetopglue = 1.5in
+\newskip\titlepagebottomglue \titlepagebottomglue = 2pc
+
+% First the title page. Must do @settitle before @titlepage.
+\newif\ifseenauthor
+\newif\iffinishedtitlepage
+
+% Do an implicit @contents or @shortcontents after @end titlepage if the
+% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
+%
+\newif\ifsetcontentsaftertitlepage
+ \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
+\newif\ifsetshortcontentsaftertitlepage
+ \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
+
+\parseargdef\shorttitlepage{%
+ \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
+ \endgroup\page\hbox{}\page}
+
+\envdef\titlepage{%
+ % Open one extra group, as we want to close it in the middle of \Etitlepage.
+ \begingroup
+ \parindent=0pt \textfonts
+ % Leave some space at the very top of the page.
+ \vglue\titlepagetopglue
+ % No rule at page bottom unless we print one at the top with @title.
+ \finishedtitlepagetrue
+ %
+ % Most title ``pages'' are actually two pages long, with space
+ % at the top of the second. We don't want the ragged left on the second.
+ \let\oldpage = \page
+ \def\page{%
+ \iffinishedtitlepage\else
+ \finishtitlepage
+ \fi
+ \let\page = \oldpage
+ \page
+ \null
+ }%
+}
+
+\def\Etitlepage{%
+ \iffinishedtitlepage\else
+ \finishtitlepage
+ \fi
+ % It is important to do the page break before ending the group,
+ % because the headline and footline are only empty inside the group.
+ % If we use the new definition of \page, we always get a blank page
+ % after the title page, which we certainly don't want.
+ \oldpage
+ \endgroup
+ %
+ % Need this before the \...aftertitlepage checks so that if they are
+ % in effect the toc pages will come out with page numbers.
+ \HEADINGSon
+ %
+ % If they want short, they certainly want long too.
+ \ifsetshortcontentsaftertitlepage
+ \shortcontents
+ \contents
+ \global\let\shortcontents = \relax
+ \global\let\contents = \relax
+ \fi
+ %
+ \ifsetcontentsaftertitlepage
+ \contents
+ \global\let\contents = \relax
+ \global\let\shortcontents = \relax
+ \fi
+}
+
+\def\finishtitlepage{%
+ \vskip4pt \hrule height 2pt width \hsize
+ \vskip\titlepagebottomglue
+ \finishedtitlepagetrue
+}
+
+% Macros to be used within @titlepage:
+
+\let\subtitlerm=\tenrm
+\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
+
+\parseargdef\title{%
+ \checkenv\titlepage
+ \leftline{\titlefonts\rmisbold #1}
+ % print a rule at the page bottom also.
+ \finishedtitlepagefalse
+ \vskip4pt \hrule height 4pt width \hsize \vskip4pt
+}
+
+\parseargdef\subtitle{%
+ \checkenv\titlepage
+ {\subtitlefont \rightline{#1}}%
+}
+
+% @author should come last, but may come many times.
+% It can also be used inside @quotation.
+%
+\parseargdef\author{%
+ \def\temp{\quotation}%
+ \ifx\thisenv\temp
+ \def\quotationauthor{#1}% printed in \Equotation.
+ \else
+ \checkenv\titlepage
+ \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
+ {\secfonts\rmisbold \leftline{#1}}%
+ \fi
+}
+
+
+% Set up page headings and footings.
+
+\let\thispage=\folio
+
+\newtoks\evenheadline % headline on even pages
+\newtoks\oddheadline % headline on odd pages
+\newtoks\evenfootline % footline on even pages
+\newtoks\oddfootline % footline on odd pages
+
+% Now make TeX use those variables
+\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
+ \else \the\evenheadline \fi}}
+\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
+ \else \the\evenfootline \fi}\HEADINGShook}
+\let\HEADINGShook=\relax
+
+% Commands to set those variables.
+% For example, this is what @headings on does
+% @evenheading @thistitle|@thispage|@thischapter
+% @oddheading @thischapter|@thispage|@thistitle
+% @evenfooting @thisfile||
+% @oddfooting ||@thisfile
+
+
+\def\evenheading{\parsearg\evenheadingxxx}
+\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
+\def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
+\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\def\oddheading{\parsearg\oddheadingxxx}
+\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
+\def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
+\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
+
+\def\evenfooting{\parsearg\evenfootingxxx}
+\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
+\def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
+\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
+
+\def\oddfooting{\parsearg\oddfootingxxx}
+\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
+\def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
+ \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
+ %
+ % Leave some space for the footline. Hopefully ok to assume
+ % @evenfooting will not be used by itself.
+ \global\advance\pageheight by -12pt
+ \global\advance\vsize by -12pt
+}
+
+\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
+
+% @evenheadingmarks top \thischapter <- chapter at the top of a page
+% @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
+%
+% The same set of arguments for:
+%
+% @oddheadingmarks
+% @evenfootingmarks
+% @oddfootingmarks
+% @everyheadingmarks
+% @everyfootingmarks
+
+\def\evenheadingmarks{\headingmarks{even}{heading}}
+\def\oddheadingmarks{\headingmarks{odd}{heading}}
+\def\evenfootingmarks{\headingmarks{even}{footing}}
+\def\oddfootingmarks{\headingmarks{odd}{footing}}
+\def\everyheadingmarks#1 {\headingmarks{even}{heading}{#1}
+ \headingmarks{odd}{heading}{#1} }
+\def\everyfootingmarks#1 {\headingmarks{even}{footing}{#1}
+ \headingmarks{odd}{footing}{#1} }
+% #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
+\def\headingmarks#1#2#3 {%
+ \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
+ \global\expandafter\let\csname get#1#2marks\endcsname \temp
+}
+
+\everyheadingmarks bottom
+\everyfootingmarks bottom
+
+% @headings double turns headings on for double-sided printing.
+% @headings single turns headings on for single-sided printing.
+% @headings off turns them off.
+% @headings on same as @headings double, retained for compatibility.
+% @headings after turns on double-sided headings after this page.
+% @headings doubleafter turns on double-sided headings after this page.
+% @headings singleafter turns on single-sided headings after this page.
+% By default, they are off at the start of a document,
+% and turned `on' after @end titlepage.
+
+\def\headings #1 {\csname HEADINGS#1\endcsname}
+
+\def\headingsoff{% non-global headings elimination
+ \evenheadline={\hfil}\evenfootline={\hfil}%
+ \oddheadline={\hfil}\oddfootline={\hfil}%
+}
+
+\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
+\HEADINGSoff % it's the default
+
+% When we turn headings on, set the page number to 1.
+% For double-sided printing, put current file name in lower left corner,
+% chapter name on inside top of right hand pages, document
+% title on inside top of left hand pages, and page numbers on outside top
+% edge of all pages.
+\def\HEADINGSdouble{%
+\global\pageno=1
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\folio\hfil\thistitle}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chapoddpage
+}
+\let\contentsalignmacro = \chappager
+
+% For single-sided printing, chapter title goes across top left of page,
+% page number on top right.
+\def\HEADINGSsingle{%
+\global\pageno=1
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\thischapter\hfil\folio}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chappager
+}
+\def\HEADINGSon{\HEADINGSdouble}
+
+\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
+\let\HEADINGSdoubleafter=\HEADINGSafter
+\def\HEADINGSdoublex{%
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\folio\hfil\thistitle}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chapoddpage
+}
+
+\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
+\def\HEADINGSsinglex{%
+\global\evenfootline={\hfil}
+\global\oddfootline={\hfil}
+\global\evenheadline={\line{\thischapter\hfil\folio}}
+\global\oddheadline={\line{\thischapter\hfil\folio}}
+\global\let\contentsalignmacro = \chappager
+}
+
+% Subroutines used in generating headings
+% This produces Day Month Year style of output.
+% Only define if not already defined, in case a txi-??.tex file has set
+% up a different format (e.g., txi-cs.tex does this).
+\ifx\today\thisisundefined
+\def\today{%
+ \number\day\space
+ \ifcase\month
+ \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
+ \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
+ \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
+ \fi
+ \space\number\year}
+\fi
+
+% @settitle line... specifies the title of the document, for headings.
+% It generates no output of its own.
+\def\thistitle{\putwordNoTitle}
+\def\settitle{\parsearg{\gdef\thistitle}}
+
+
+\message{tables,}
+% Tables -- @table, @ftable, @vtable, @item(x).
+
+% default indentation of table text
+\newdimen\tableindent \tableindent=.8in
+% default indentation of @itemize and @enumerate text
+\newdimen\itemindent \itemindent=.3in
+% margin between end of table item and start of table text.
+\newdimen\itemmargin \itemmargin=.1in
+
+% used internally for \itemindent minus \itemmargin
+\newdimen\itemmax
+
+% Note @table, @ftable, and @vtable define @item, @itemx, etc., with
+% these defs.
+% They also define \itemindex
+% to index the item name in whatever manner is desired (perhaps none).
+
+\newif\ifitemxneedsnegativevskip
+
+\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
+
+\def\internalBitem{\smallbreak \parsearg\itemzzz}
+\def\internalBitemx{\itemxpar \parsearg\itemzzz}
+
+\def\itemzzz #1{\begingroup %
+ \advance\hsize by -\rightskip
+ \advance\hsize by -\tableindent
+ \setbox0=\hbox{\itemindicate{#1}}%
+ \itemindex{#1}%
+ \nobreak % This prevents a break before @itemx.
+ %
+ % If the item text does not fit in the space we have, put it on a line
+ % by itself, and do not allow a page break either before or after that
+ % line. We do not start a paragraph here because then if the next
+ % command is, e.g., @kindex, the whatsit would get put into the
+ % horizontal list on a line by itself, resulting in extra blank space.
+ \ifdim \wd0>\itemmax
+ %
+ % Make this a paragraph so we get the \parskip glue and wrapping,
+ % but leave it ragged-right.
+ \begingroup
+ \advance\leftskip by-\tableindent
+ \advance\hsize by\tableindent
+ \advance\rightskip by0pt plus1fil\relax
+ \leavevmode\unhbox0\par
+ \endgroup
+ %
+ % We're going to be starting a paragraph, but we don't want the
+ % \parskip glue -- logically it's part of the @item we just started.
+ \nobreak \vskip-\parskip
+ %
+ % Stop a page break at the \parskip glue coming up. However, if
+ % what follows is an environment such as @example, there will be no
+ % \parskip glue; then the negative vskip we just inserted would
+ % cause the example and the item to crash together. So we use this
+ % bizarre value of 10001 as a signal to \aboveenvbreak to insert
+ % \parskip glue after all. Section titles are handled this way also.
+ %
+ \penalty 10001
+ \endgroup
+ \itemxneedsnegativevskipfalse
+ \else
+ % The item text fits into the space. Start a paragraph, so that the
+ % following text (if any) will end up on the same line.
+ \noindent
+ % Do this with kerns and \unhbox so that if there is a footnote in
+ % the item text, it can migrate to the main vertical list and
+ % eventually be printed.
+ \nobreak\kern-\tableindent
+ \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
+ \unhbox0
+ \nobreak\kern\dimen0
+ \endgroup
+ \itemxneedsnegativevskiptrue
+ \fi
+}
+
+\def\item{\errmessage{@item while not in a list environment}}
+\def\itemx{\errmessage{@itemx while not in a list environment}}
+
+% @table, @ftable, @vtable.
+\envdef\table{%
+ \let\itemindex\gobble
+ \tablecheck{table}%
+}
+\envdef\ftable{%
+ \def\itemindex ##1{\doind {fn}{\code{##1}}}%
+ \tablecheck{ftable}%
+}
+\envdef\vtable{%
+ \def\itemindex ##1{\doind {vr}{\code{##1}}}%
+ \tablecheck{vtable}%
+}
+\def\tablecheck#1{%
+ \ifnum \the\catcode`\^^M=\active
+ \endgroup
+ \errmessage{This command won't work in this context; perhaps the problem is
+ that we are \inenvironment\thisenv}%
+ \def\next{\doignore{#1}}%
+ \else
+ \let\next\tablex
+ \fi
+ \next
+}
+\def\tablex#1{%
+ \def\itemindicate{#1}%
+ \parsearg\tabley
+}
+\def\tabley#1{%
+ {%
+ \makevalueexpandable
+ \edef\temp{\noexpand\tablez #1\space\space\space}%
+ \expandafter
+ }\temp \endtablez
+}
+\def\tablez #1 #2 #3 #4\endtablez{%
+ \aboveenvbreak
+ \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
+ \ifnum 0#2>0 \tableindent=#2\mil \fi
+ \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
+ \itemmax=\tableindent
+ \advance \itemmax by -\itemmargin
+ \advance \leftskip by \tableindent
+ \exdentamount=\tableindent
+ \parindent = 0pt
+ \parskip = \smallskipamount
+ \ifdim \parskip=0pt \parskip=2pt \fi
+ \let\item = \internalBitem
+ \let\itemx = \internalBitemx
+}
+\def\Etable{\endgraf\afterenvbreak}
+\let\Eftable\Etable
+\let\Evtable\Etable
+\let\Eitemize\Etable
+\let\Eenumerate\Etable
+
+% This is the counter used by @enumerate, which is really @itemize
+
+\newcount \itemno
+
+\envdef\itemize{\parsearg\doitemize}
+
+\def\doitemize#1{%
+ \aboveenvbreak
+ \itemmax=\itemindent
+ \advance\itemmax by -\itemmargin
+ \advance\leftskip by \itemindent
+ \exdentamount=\itemindent
+ \parindent=0pt
+ \parskip=\smallskipamount
+ \ifdim\parskip=0pt \parskip=2pt \fi
+ %
+ % Try typesetting the item mark that if the document erroneously says
+ % something like @itemize @samp (intending @table), there's an error
+ % right away at the @itemize. It's not the best error message in the
+ % world, but it's better than leaving it to the @item. This means if
+ % the user wants an empty mark, they have to say @w{} not just @w.
+ \def\itemcontents{#1}%
+ \setbox0 = \hbox{\itemcontents}%
+ %
+ % @itemize with no arg is equivalent to @itemize @bullet.
+ \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
+ %
+ \let\item=\itemizeitem
+}
+
+% Definition of @item while inside @itemize and @enumerate.
+%
+\def\itemizeitem{%
+ \advance\itemno by 1 % for enumerations
+ {\let\par=\endgraf \smallbreak}% reasonable place to break
+ {%
+ % If the document has an @itemize directly after a section title, a
+ % \nobreak will be last on the list, and \sectionheading will have
+ % done a \vskip-\parskip. In that case, we don't want to zero
+ % parskip, or the item text will crash with the heading. On the
+ % other hand, when there is normal text preceding the item (as there
+ % usually is), we do want to zero parskip, or there would be too much
+ % space. In that case, we won't have a \nobreak before. At least
+ % that's the theory.
+ \ifnum\lastpenalty<10000 \parskip=0in \fi
+ \noindent
+ \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
+ %
+ \vadjust{\penalty 1200}}% not good to break after first line of item.
+ \flushcr
+}
+
+% \splitoff TOKENS\endmark defines \first to be the first token in
+% TOKENS, and \rest to be the remainder.
+%
+\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
+
+% Allow an optional argument of an uppercase letter, lowercase letter,
+% or number, to specify the first label in the enumerated list. No
+% argument is the same as `1'.
+%
+\envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
+\def\enumeratey #1 #2\endenumeratey{%
+ % If we were given no argument, pretend we were given `1'.
+ \def\thearg{#1}%
+ \ifx\thearg\empty \def\thearg{1}\fi
+ %
+ % Detect if the argument is a single token. If so, it might be a
+ % letter. Otherwise, the only valid thing it can be is a number.
+ % (We will always have one token, because of the test we just made.
+ % This is a good thing, since \splitoff doesn't work given nothing at
+ % all -- the first parameter is undelimited.)
+ \expandafter\splitoff\thearg\endmark
+ \ifx\rest\empty
+ % Only one token in the argument. It could still be anything.
+ % A ``lowercase letter'' is one whose \lccode is nonzero.
+ % An ``uppercase letter'' is one whose \lccode is both nonzero, and
+ % not equal to itself.
+ % Otherwise, we assume it's a number.
+ %
+ % We need the \relax at the end of the \ifnum lines to stop TeX from
+ % continuing to look for a <number>.
+ %
+ \ifnum\lccode\expandafter`\thearg=0\relax
+ \numericenumerate % a number (we hope)
+ \else
+ % It's a letter.
+ \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
+ \lowercaseenumerate % lowercase letter
+ \else
+ \uppercaseenumerate % uppercase letter
+ \fi
+ \fi
+ \else
+ % Multiple tokens in the argument. We hope it's a number.
+ \numericenumerate
+ \fi
+}
+
+% An @enumerate whose labels are integers. The starting integer is
+% given in \thearg.
+%
+\def\numericenumerate{%
+ \itemno = \thearg
+ \startenumeration{\the\itemno}%
+}
+
+% The starting (lowercase) letter is in \thearg.
+\def\lowercaseenumerate{%
+ \itemno = \expandafter`\thearg
+ \startenumeration{%
+ % Be sure we're not beyond the end of the alphabet.
+ \ifnum\itemno=0
+ \errmessage{No more lowercase letters in @enumerate; get a bigger
+ alphabet}%
+ \fi
+ \char\lccode\itemno
+ }%
+}
+
+% The starting (uppercase) letter is in \thearg.
+\def\uppercaseenumerate{%
+ \itemno = \expandafter`\thearg
+ \startenumeration{%
+ % Be sure we're not beyond the end of the alphabet.
+ \ifnum\itemno=0
+ \errmessage{No more uppercase letters in @enumerate; get a bigger
+ alphabet}
+ \fi
+ \char\uccode\itemno
+ }%
+}
+
+% Call \doitemize, adding a period to the first argument and supplying the
+% common last two arguments. Also subtract one from the initial value in
+% \itemno, since @item increments \itemno.
+%
+\def\startenumeration#1{%
+ \advance\itemno by -1
+ \doitemize{#1.}\flushcr
+}
+
+% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
+% to @enumerate.
+%
+\def\alphaenumerate{\enumerate{a}}
+\def\capsenumerate{\enumerate{A}}
+\def\Ealphaenumerate{\Eenumerate}
+\def\Ecapsenumerate{\Eenumerate}
+
+
+% @multitable macros
+% Amy Hendrickson, 8/18/94, 3/6/96
+%
+% @multitable ... @end multitable will make as many columns as desired.
+% Contents of each column will wrap at width given in preamble. Width
+% can be specified either with sample text given in a template line,
+% or in percent of \hsize, the current width of text on page.
+
+% Table can continue over pages but will only break between lines.
+
+% To make preamble:
+%
+% Either define widths of columns in terms of percent of \hsize:
+% @multitable @columnfractions .25 .3 .45
+% @item ...
+%
+% Numbers following @columnfractions are the percent of the total
+% current hsize to be used for each column. You may use as many
+% columns as desired.
+
+
+% Or use a template:
+% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
+% @item ...
+% using the widest term desired in each column.
+
+% Each new table line starts with @item, each subsequent new column
+% starts with @tab. Empty columns may be produced by supplying @tab's
+% with nothing between them for as many times as empty columns are needed,
+% ie, @tab@tab@tab will produce two empty columns.
+
+% @item, @tab do not need to be on their own lines, but it will not hurt
+% if they are.
+
+% Sample multitable:
+
+% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
+% @item first col stuff @tab second col stuff @tab third col
+% @item
+% first col stuff
+% @tab
+% second col stuff
+% @tab
+% third col
+% @item first col stuff @tab second col stuff
+% @tab Many paragraphs of text may be used in any column.
+%
+% They will wrap at the width determined by the template.
+% @item@tab@tab This will be in third column.
+% @end multitable
+
+% Default dimensions may be reset by user.
+% @multitableparskip is vertical space between paragraphs in table.
+% @multitableparindent is paragraph indent in table.
+% @multitablecolmargin is horizontal space to be left between columns.
+% @multitablelinespace is space to leave between table items, baseline
+% to baseline.
+% 0pt means it depends on current normal line spacing.
+%
+\newskip\multitableparskip
+\newskip\multitableparindent
+\newdimen\multitablecolspace
+\newskip\multitablelinespace
+\multitableparskip=0pt
+\multitableparindent=6pt
+\multitablecolspace=12pt
+\multitablelinespace=0pt
+
+% Macros used to set up halign preamble:
+%
+\let\endsetuptable\relax
+\def\xendsetuptable{\endsetuptable}
+\let\columnfractions\relax
+\def\xcolumnfractions{\columnfractions}
+\newif\ifsetpercent
+
+% #1 is the @columnfraction, usually a decimal number like .5, but might
+% be just 1. We just use it, whatever it is.
+%
+\def\pickupwholefraction#1 {%
+ \global\advance\colcount by 1
+ \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
+ \setuptable
+}
+
+\newcount\colcount
+\def\setuptable#1{%
+ \def\firstarg{#1}%
+ \ifx\firstarg\xendsetuptable
+ \let\go = \relax
+ \else
+ \ifx\firstarg\xcolumnfractions
+ \global\setpercenttrue
+ \else
+ \ifsetpercent
+ \let\go\pickupwholefraction
+ \else
+ \global\advance\colcount by 1
+ \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
+ % separator; typically that is always in the input, anyway.
+ \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
+ \fi
+ \fi
+ \ifx\go\pickupwholefraction
+ % Put the argument back for the \pickupwholefraction call, so
+ % we'll always have a period there to be parsed.
+ \def\go{\pickupwholefraction#1}%
+ \else
+ \let\go = \setuptable
+ \fi%
+ \fi
+ \go
+}
+
+% multitable-only commands.
+%
+% @headitem starts a heading row, which we typeset in bold.
+% Assignments have to be global since we are inside the implicit group
+% of an alignment entry. \everycr resets \everytab so we don't have to
+% undo it ourselves.
+\def\headitemfont{\b}% for people to use in the template row; not changeable
+\def\headitem{%
+ \checkenv\multitable
+ \crcr
+ \global\everytab={\bf}% can't use \headitemfont since the parsing differs
+ \the\everytab % for the first item
+}%
+%
+% A \tab used to include \hskip1sp. But then the space in a template
+% line is not enough. That is bad. So let's go back to just `&' until
+% we again encounter the problem the 1sp was intended to solve.
+% --karl, nathan@acm.org, 20apr99.
+\def\tab{\checkenv\multitable &\the\everytab}%
+
+% @multitable ... @end multitable definitions:
+%
+\newtoks\everytab % insert after every tab.
+%
+\envdef\multitable{%
+ \vskip\parskip
+ \startsavinginserts
+ %
+ % @item within a multitable starts a normal row.
+ % We use \def instead of \let so that if one of the multitable entries
+ % contains an @itemize, we don't choke on the \item (seen as \crcr aka
+ % \endtemplate) expanding \doitemize.
+ \def\item{\crcr}%
+ %
+ \tolerance=9500
+ \hbadness=9500
+ \setmultitablespacing
+ \parskip=\multitableparskip
+ \parindent=\multitableparindent
+ \overfullrule=0pt
+ \global\colcount=0
+ %
+ \everycr = {%
+ \noalign{%
+ \global\everytab={}%
+ \global\colcount=0 % Reset the column counter.
+ % Check for saved footnotes, etc.
+ \checkinserts
+ % Keeps underfull box messages off when table breaks over pages.
+ %\filbreak
+ % Maybe so, but it also creates really weird page breaks when the
+ % table breaks over pages. Wouldn't \vfil be better? Wait until the
+ % problem manifests itself, so it can be fixed for real --karl.
+ }%
+ }%
+ %
+ \parsearg\domultitable
+}
+\def\domultitable#1{%
+ % To parse everything between @multitable and @item:
+ \setuptable#1 \endsetuptable
+ %
+ % This preamble sets up a generic column definition, which will
+ % be used as many times as user calls for columns.
+ % \vtop will set a single line and will also let text wrap and
+ % continue for many paragraphs if desired.
+ \halign\bgroup &%
+ \global\advance\colcount by 1
+ \multistrut
+ \vtop{%
+ % Use the current \colcount to find the correct column width:
+ \hsize=\expandafter\csname col\the\colcount\endcsname
+ %
+ % In order to keep entries from bumping into each other
+ % we will add a \leftskip of \multitablecolspace to all columns after
+ % the first one.
+ %
+ % If a template has been used, we will add \multitablecolspace
+ % to the width of each template entry.
+ %
+ % If the user has set preamble in terms of percent of \hsize we will
+ % use that dimension as the width of the column, and the \leftskip
+ % will keep entries from bumping into each other. Table will start at
+ % left margin and final column will justify at right margin.
+ %
+ % Make sure we don't inherit \rightskip from the outer environment.
+ \rightskip=0pt
+ \ifnum\colcount=1
+ % The first column will be indented with the surrounding text.
+ \advance\hsize by\leftskip
+ \else
+ \ifsetpercent \else
+ % If user has not set preamble in terms of percent of \hsize
+ % we will advance \hsize by \multitablecolspace.
+ \advance\hsize by \multitablecolspace
+ \fi
+ % In either case we will make \leftskip=\multitablecolspace:
+ \leftskip=\multitablecolspace
+ \fi
+ % Ignoring space at the beginning and end avoids an occasional spurious
+ % blank line, when TeX decides to break the line at the space before the
+ % box from the multistrut, so the strut ends up on a line by itself.
+ % For example:
+ % @multitable @columnfractions .11 .89
+ % @item @code{#}
+ % @tab Legal holiday which is valid in major parts of the whole country.
+ % Is automatically provided with highlighting sequences respectively
+ % marking characters.
+ \noindent\ignorespaces##\unskip\multistrut
+ }\cr
+}
+\def\Emultitable{%
+ \crcr
+ \egroup % end the \halign
+ \global\setpercentfalse
+}
+
+\def\setmultitablespacing{%
+ \def\multistrut{\strut}% just use the standard line spacing
+ %
+ % Compute \multitablelinespace (if not defined by user) for use in
+ % \multitableparskip calculation. We used define \multistrut based on
+ % this, but (ironically) that caused the spacing to be off.
+ % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
+\ifdim\multitablelinespace=0pt
+\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
+\global\advance\multitablelinespace by-\ht0
+\fi
+% Test to see if parskip is larger than space between lines of
+% table. If not, do nothing.
+% If so, set to same dimension as multitablelinespace.
+\ifdim\multitableparskip>\multitablelinespace
+\global\multitableparskip=\multitablelinespace
+\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
+ % than skip between lines in the table.
+\fi%
+\ifdim\multitableparskip=0pt
+\global\multitableparskip=\multitablelinespace
+\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
+ % than skip between lines in the table.
+\fi}
+
+
+\message{conditionals,}
+
+% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
+% @ifnotxml always succeed. They currently do nothing; we don't
+% attempt to check whether the conditionals are properly nested. But we
+% have to remember that they are conditionals, so that @end doesn't
+% attempt to close an environment group.
+%
+\def\makecond#1{%
+ \expandafter\let\csname #1\endcsname = \relax
+ \expandafter\let\csname iscond.#1\endcsname = 1
+}
+\makecond{iftex}
+\makecond{ifnotdocbook}
+\makecond{ifnothtml}
+\makecond{ifnotinfo}
+\makecond{ifnotplaintext}
+\makecond{ifnotxml}
+
+% Ignore @ignore, @ifhtml, @ifinfo, and the like.
+%
+\def\direntry{\doignore{direntry}}
+\def\documentdescription{\doignore{documentdescription}}
+\def\docbook{\doignore{docbook}}
+\def\html{\doignore{html}}
+\def\ifdocbook{\doignore{ifdocbook}}
+\def\ifhtml{\doignore{ifhtml}}
+\def\ifinfo{\doignore{ifinfo}}
+\def\ifnottex{\doignore{ifnottex}}
+\def\ifplaintext{\doignore{ifplaintext}}
+\def\ifxml{\doignore{ifxml}}
+\def\ignore{\doignore{ignore}}
+\def\menu{\doignore{menu}}
+\def\xml{\doignore{xml}}
+
+% Ignore text until a line `@end #1', keeping track of nested conditionals.
+%
+% A count to remember the depth of nesting.
+\newcount\doignorecount
+
+\def\doignore#1{\begingroup
+ % Scan in ``verbatim'' mode:
+ \obeylines
+ \catcode`\@ = \other
+ \catcode`\{ = \other
+ \catcode`\} = \other
+ %
+ % Make sure that spaces turn into tokens that match what \doignoretext wants.
+ \spaceisspace
+ %
+ % Count number of #1's that we've seen.
+ \doignorecount = 0
+ %
+ % Swallow text until we reach the matching `@end #1'.
+ \dodoignore{#1}%
+}
+
+{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
+ \obeylines %
+ %
+ \gdef\dodoignore#1{%
+ % #1 contains the command name as a string, e.g., `ifinfo'.
+ %
+ % Define a command to find the next `@end #1'.
+ \long\def\doignoretext##1^^M@end #1{%
+ \doignoretextyyy##1^^M@#1\_STOP_}%
+ %
+ % And this command to find another #1 command, at the beginning of a
+ % line. (Otherwise, we would consider a line `@c @ifset', for
+ % example, to count as an @ifset for nesting.)
+ \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
+ %
+ % And now expand that command.
+ \doignoretext ^^M%
+ }%
+}
+
+\def\doignoreyyy#1{%
+ \def\temp{#1}%
+ \ifx\temp\empty % Nothing found.
+ \let\next\doignoretextzzz
+ \else % Found a nested condition, ...
+ \advance\doignorecount by 1
+ \let\next\doignoretextyyy % ..., look for another.
+ % If we're here, #1 ends with ^^M\ifinfo (for example).
+ \fi
+ \next #1% the token \_STOP_ is present just after this macro.
+}
+
+% We have to swallow the remaining "\_STOP_".
+%
+\def\doignoretextzzz#1{%
+ \ifnum\doignorecount = 0 % We have just found the outermost @end.
+ \let\next\enddoignore
+ \else % Still inside a nested condition.
+ \advance\doignorecount by -1
+ \let\next\doignoretext % Look for the next @end.
+ \fi
+ \next
+}
+
+% Finish off ignored text.
+{ \obeylines%
+ % Ignore anything after the last `@end #1'; this matters in verbatim
+ % environments, where otherwise the newline after an ignored conditional
+ % would result in a blank line in the output.
+ \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
+}
+
+
+% @set VAR sets the variable VAR to an empty value.
+% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
+%
+% Since we want to separate VAR from REST-OF-LINE (which might be
+% empty), we can't just use \parsearg; we have to insert a space of our
+% own to delimit the rest of the line, and then take it out again if we
+% didn't need it.
+% We rely on the fact that \parsearg sets \catcode`\ =10.
+%
+\parseargdef\set{\setyyy#1 \endsetyyy}
+\def\setyyy#1 #2\endsetyyy{%
+ {%
+ \makevalueexpandable
+ \def\temp{#2}%
+ \edef\next{\gdef\makecsname{SET#1}}%
+ \ifx\temp\empty
+ \next{}%
+ \else
+ \setzzz#2\endsetzzz
+ \fi
+ }%
+}
+% Remove the trailing space \setxxx inserted.
+\def\setzzz#1 \endsetzzz{\next{#1}}
+
+% @clear VAR clears (i.e., unsets) the variable VAR.
+%
+\parseargdef\clear{%
+ {%
+ \makevalueexpandable
+ \global\expandafter\let\csname SET#1\endcsname=\relax
+ }%
+}
+
+% @value{foo} gets the text saved in variable foo.
+\def\value{\begingroup\makevalueexpandable\valuexxx}
+\def\valuexxx#1{\expandablevalue{#1}\endgroup}
+{
+ \catcode`\- = \active \catcode`\_ = \active
+ %
+ \gdef\makevalueexpandable{%
+ \let\value = \expandablevalue
+ % We don't want these characters active, ...
+ \catcode`\-=\other \catcode`\_=\other
+ % ..., but we might end up with active ones in the argument if
+ % we're called from @code, as @code{@value{foo-bar_}}, though.
+ % So \let them to their normal equivalents.
+ \let-\realdash \let_\normalunderscore
+ }
+}
+
+% We have this subroutine so that we can handle at least some @value's
+% properly in indexes (we call \makevalueexpandable in \indexdummies).
+% The command has to be fully expandable (if the variable is set), since
+% the result winds up in the index file. This means that if the
+% variable's value contains other Texinfo commands, it's almost certain
+% it will fail (although perhaps we could fix that with sufficient work
+% to do a one-level expansion on the result, instead of complete).
+%
+\def\expandablevalue#1{%
+ \expandafter\ifx\csname SET#1\endcsname\relax
+ {[No value for ``#1'']}%
+ \message{Variable `#1', used in @value, is not set.}%
+ \else
+ \csname SET#1\endcsname
+ \fi
+}
+
+% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
+% with @set.
+%
+% To get special treatment of `@end ifset,' call \makeond and the redefine.
+%
+\makecond{ifset}
+\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
+\def\doifset#1#2{%
+ {%
+ \makevalueexpandable
+ \let\next=\empty
+ \expandafter\ifx\csname SET#2\endcsname\relax
+ #1% If not set, redefine \next.
+ \fi
+ \expandafter
+ }\next
+}
+\def\ifsetfail{\doignore{ifset}}
+
+% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
+% defined with @set, or has been undefined with @clear.
+%
+% The `\else' inside the `\doifset' parameter is a trick to reuse the
+% above code: if the variable is not set, do nothing, if it is set,
+% then redefine \next to \ifclearfail.
+%
+\makecond{ifclear}
+\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
+\def\ifclearfail{\doignore{ifclear}}
+
+% @dircategory CATEGORY -- specify a category of the dir file
+% which this file should belong to. Ignore this in TeX.
+\let\dircategory=\comment
+
+% @defininfoenclose.
+\let\definfoenclose=\comment
+
+
+\message{indexing,}
+% Index generation facilities
+
+% Define \newwrite to be identical to plain tex's \newwrite
+% except not \outer, so it can be used within macros and \if's.
+\edef\newwrite{\makecsname{ptexnewwrite}}
+
+% \newindex {foo} defines an index named foo.
+% It automatically defines \fooindex such that
+% \fooindex ...rest of line... puts an entry in the index foo.
+% It also defines \fooindfile to be the number of the output channel for
+% the file that accumulates this index. The file's extension is foo.
+% The name of an index should be no more than 2 characters long
+% for the sake of vms.
+%
+\def\newindex#1{%
+ \iflinks
+ \expandafter\newwrite \csname#1indfile\endcsname
+ \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
+ \fi
+ \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
+ \noexpand\doindex{#1}}
+}
+
+% @defindex foo == \newindex{foo}
+%
+\def\defindex{\parsearg\newindex}
+
+% Define @defcodeindex, like @defindex except put all entries in @code.
+%
+\def\defcodeindex{\parsearg\newcodeindex}
+%
+\def\newcodeindex#1{%
+ \iflinks
+ \expandafter\newwrite \csname#1indfile\endcsname
+ \openout \csname#1indfile\endcsname \jobname.#1
+ \fi
+ \expandafter\xdef\csname#1index\endcsname{%
+ \noexpand\docodeindex{#1}}%
+}
+
+
+% @synindex foo bar makes index foo feed into index bar.
+% Do this instead of @defindex foo if you don't want it as a separate index.
+%
+% @syncodeindex foo bar similar, but put all entries made for index foo
+% inside @code.
+%
+\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
+\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
+
+% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
+% #3 the target index (bar).
+\def\dosynindex#1#2#3{%
+ % Only do \closeout if we haven't already done it, else we'll end up
+ % closing the target index.
+ \expandafter \ifx\csname donesynindex#2\endcsname \relax
+ % The \closeout helps reduce unnecessary open files; the limit on the
+ % Acorn RISC OS is a mere 16 files.
+ \expandafter\closeout\csname#2indfile\endcsname
+ \expandafter\let\csname donesynindex#2\endcsname = 1
+ \fi
+ % redefine \fooindfile:
+ \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
+ \expandafter\let\csname#2indfile\endcsname=\temp
+ % redefine \fooindex:
+ \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
+}
+
+% Define \doindex, the driver for all \fooindex macros.
+% Argument #1 is generated by the calling \fooindex macro,
+% and it is "foo", the name of the index.
+
+% \doindex just uses \parsearg; it calls \doind for the actual work.
+% This is because \doind is more useful to call from other macros.
+
+% There is also \dosubind {index}{topic}{subtopic}
+% which makes an entry in a two-level index such as the operation index.
+
+\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
+\def\singleindexer #1{\doind{\indexname}{#1}}
+
+% like the previous two, but they put @code around the argument.
+\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
+\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
+
+% Take care of Texinfo commands that can appear in an index entry.
+% Since there are some commands we want to expand, and others we don't,
+% we have to laboriously prevent expansion for those that we don't.
+%
+\def\indexdummies{%
+ \escapechar = `\\ % use backslash in output files.
+ \def\@{@}% change to @@ when we switch to @ as escape char in index files.
+ \def\ {\realbackslash\space }%
+ %
+ % Need these unexpandable (because we define \tt as a dummy)
+ % definitions when @{ or @} appear in index entry text. Also, more
+ % complicated, when \tex is in effect and \{ is a \delimiter again.
+ % We can't use \lbracecmd and \rbracecmd because texindex assumes
+ % braces and backslashes are used only as delimiters. Perhaps we
+ % should define @lbrace and @rbrace commands a la @comma.
+ \def\{{{\tt\char123}}%
+ \def\}{{\tt\char125}}%
+ %
+ % I don't entirely understand this, but when an index entry is
+ % generated from a macro call, the \endinput which \scanmacro inserts
+ % causes processing to be prematurely terminated. This is,
+ % apparently, because \indexsorttmp is fully expanded, and \endinput
+ % is an expandable command. The redefinition below makes \endinput
+ % disappear altogether for that purpose -- although logging shows that
+ % processing continues to some further point. On the other hand, it
+ % seems \endinput does not hurt in the printed index arg, since that
+ % is still getting written without apparent harm.
+ %
+ % Sample source (mac-idx3.tex, reported by Graham Percival to
+ % help-texinfo, 22may06):
+ % @macro funindex {WORD}
+ % @findex xyz
+ % @end macro
+ % ...
+ % @funindex commtest
+ %
+ % The above is not enough to reproduce the bug, but it gives the flavor.
+ %
+ % Sample whatsit resulting:
+ % .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}}
+ %
+ % So:
+ \let\endinput = \empty
+ %
+ % Do the redefinitions.
+ \commondummies
+}
+
+% For the aux and toc files, @ is the escape character. So we want to
+% redefine everything using @ as the escape character (instead of
+% \realbackslash, still used for index files). When everything uses @,
+% this will be simpler.
+%
+\def\atdummies{%
+ \def\@{@@}%
+ \def\ {@ }%
+ \let\{ = \lbraceatcmd
+ \let\} = \rbraceatcmd
+ %
+ % Do the redefinitions.
+ \commondummies
+ \otherbackslash
+}
+
+% Called from \indexdummies and \atdummies.
+%
+\def\commondummies{%
+ %
+ % \definedummyword defines \#1 as \string\#1\space, thus effectively
+ % preventing its expansion. This is used only for control words,
+ % not control letters, because the \space would be incorrect for
+ % control characters, but is needed to separate the control word
+ % from whatever follows.
+ %
+ % For control letters, we have \definedummyletter, which omits the
+ % space.
+ %
+ % These can be used both for control words that take an argument and
+ % those that do not. If it is followed by {arg} in the input, then
+ % that will dutifully get written to the index (or wherever).
+ %
+ \def\definedummyword ##1{\def##1{\string##1\space}}%
+ \def\definedummyletter##1{\def##1{\string##1}}%
+ \let\definedummyaccent\definedummyletter
+ %
+ \commondummiesnofonts
+ %
+ \definedummyletter\_%
+ \definedummyletter\-%
+ %
+ % Non-English letters.
+ \definedummyword\AA
+ \definedummyword\AE
+ \definedummyword\DH
+ \definedummyword\L
+ \definedummyword\O
+ \definedummyword\OE
+ \definedummyword\TH
+ \definedummyword\aa
+ \definedummyword\ae
+ \definedummyword\dh
+ \definedummyword\exclamdown
+ \definedummyword\l
+ \definedummyword\o
+ \definedummyword\oe
+ \definedummyword\ordf
+ \definedummyword\ordm
+ \definedummyword\questiondown
+ \definedummyword\ss
+ \definedummyword\th
+ %
+ % Although these internal commands shouldn't show up, sometimes they do.
+ \definedummyword\bf
+ \definedummyword\gtr
+ \definedummyword\hat
+ \definedummyword\less
+ \definedummyword\sf
+ \definedummyword\sl
+ \definedummyword\tclose
+ \definedummyword\tt
+ %
+ \definedummyword\LaTeX
+ \definedummyword\TeX
+ %
+ % Assorted special characters.
+ \definedummyword\arrow
+ \definedummyword\bullet
+ \definedummyword\comma
+ \definedummyword\copyright
+ \definedummyword\registeredsymbol
+ \definedummyword\dots
+ \definedummyword\enddots
+ \definedummyword\entrybreak
+ \definedummyword\equiv
+ \definedummyword\error
+ \definedummyword\euro
+ \definedummyword\expansion
+ \definedummyword\geq
+ \definedummyword\guillemetleft
+ \definedummyword\guillemetright
+ \definedummyword\guilsinglleft
+ \definedummyword\guilsinglright
+ \definedummyword\lbracechar
+ \definedummyword\leq
+ \definedummyword\minus
+ \definedummyword\ogonek
+ \definedummyword\pounds
+ \definedummyword\point
+ \definedummyword\print
+ \definedummyword\quotedblbase
+ \definedummyword\quotedblleft
+ \definedummyword\quotedblright
+ \definedummyword\quoteleft
+ \definedummyword\quoteright
+ \definedummyword\quotesinglbase
+ \definedummyword\rbracechar
+ \definedummyword\result
+ \definedummyword\textdegree
+ %
+ % We want to disable all macros so that they are not expanded by \write.
+ \macrolist
+ %
+ \normalturnoffactive
+ %
+ % Handle some cases of @value -- where it does not contain any
+ % (non-fully-expandable) commands.
+ \makevalueexpandable
+}
+
+% \commondummiesnofonts: common to \commondummies and \indexnofonts.
+%
+\def\commondummiesnofonts{%
+ % Control letters and accents.
+ \definedummyletter\!%
+ \definedummyaccent\"%
+ \definedummyaccent\'%
+ \definedummyletter\*%
+ \definedummyaccent\,%
+ \definedummyletter\.%
+ \definedummyletter\/%
+ \definedummyletter\:%
+ \definedummyaccent\=%
+ \definedummyletter\?%
+ \definedummyaccent\^%
+ \definedummyaccent\`%
+ \definedummyaccent\~%
+ \definedummyword\u
+ \definedummyword\v
+ \definedummyword\H
+ \definedummyword\dotaccent
+ \definedummyword\ogonek
+ \definedummyword\ringaccent
+ \definedummyword\tieaccent
+ \definedummyword\ubaraccent
+ \definedummyword\udotaccent
+ \definedummyword\dotless
+ %
+ % Texinfo font commands.
+ \definedummyword\b
+ \definedummyword\i
+ \definedummyword\r
+ \definedummyword\sansserif
+ \definedummyword\sc
+ \definedummyword\slanted
+ \definedummyword\t
+ %
+ % Commands that take arguments.
+ \definedummyword\abbr
+ \definedummyword\acronym
+ \definedummyword\anchor
+ \definedummyword\cite
+ \definedummyword\code
+ \definedummyword\command
+ \definedummyword\dfn
+ \definedummyword\dmn
+ \definedummyword\email
+ \definedummyword\emph
+ \definedummyword\env
+ \definedummyword\file
+ \definedummyword\image
+ \definedummyword\indicateurl
+ \definedummyword\inforef
+ \definedummyword\kbd
+ \definedummyword\key
+ \definedummyword\math
+ \definedummyword\option
+ \definedummyword\pxref
+ \definedummyword\ref
+ \definedummyword\samp
+ \definedummyword\strong
+ \definedummyword\tie
+ \definedummyword\uref
+ \definedummyword\url
+ \definedummyword\var
+ \definedummyword\verb
+ \definedummyword\w
+ \definedummyword\xref
+}
+
+% \indexnofonts is used when outputting the strings to sort the index
+% by, and when constructing control sequence names. It eliminates all
+% control sequences and just writes whatever the best ASCII sort string
+% would be for a given command (usually its argument).
+%
+\def\indexnofonts{%
+ % Accent commands should become @asis.
+ \def\definedummyaccent##1{\let##1\asis}%
+ % We can just ignore other control letters.
+ \def\definedummyletter##1{\let##1\empty}%
+ % All control words become @asis by default; overrides below.
+ \let\definedummyword\definedummyaccent
+ %
+ \commondummiesnofonts
+ %
+ % Don't no-op \tt, since it isn't a user-level command
+ % and is used in the definitions of the active chars like <, >, |, etc.
+ % Likewise with the other plain tex font commands.
+ %\let\tt=\asis
+ %
+ \def\ { }%
+ \def\@{@}%
+ \def\_{\normalunderscore}%
+ \def\-{}% @- shouldn't affect sorting
+ %
+ % Unfortunately, texindex is not prepared to handle braces in the
+ % content at all. So for index sorting, we map @{ and @} to strings
+ % starting with |, since that ASCII character is between ASCII { and }.
+ \def\{{|a}%
+ \def\lbracechar{|a}%
+ %
+ \def\}{|b}%
+ \def\rbracechar{|b}%
+ %
+ % Non-English letters.
+ \def\AA{AA}%
+ \def\AE{AE}%
+ \def\DH{DZZ}%
+ \def\L{L}%
+ \def\OE{OE}%
+ \def\O{O}%
+ \def\TH{ZZZ}%
+ \def\aa{aa}%
+ \def\ae{ae}%
+ \def\dh{dzz}%
+ \def\exclamdown{!}%
+ \def\l{l}%
+ \def\oe{oe}%
+ \def\ordf{a}%
+ \def\ordm{o}%
+ \def\o{o}%
+ \def\questiondown{?}%
+ \def\ss{ss}%
+ \def\th{zzz}%
+ %
+ \def\LaTeX{LaTeX}%
+ \def\TeX{TeX}%
+ %
+ % Assorted special characters.
+ % (The following {} will end up in the sort string, but that's ok.)
+ \def\arrow{->}%
+ \def\bullet{bullet}%
+ \def\comma{,}%
+ \def\copyright{copyright}%
+ \def\dots{...}%
+ \def\enddots{...}%
+ \def\equiv{==}%
+ \def\error{error}%
+ \def\euro{euro}%
+ \def\expansion{==>}%
+ \def\geq{>=}%
+ \def\guillemetleft{<<}%
+ \def\guillemetright{>>}%
+ \def\guilsinglleft{<}%
+ \def\guilsinglright{>}%
+ \def\leq{<=}%
+ \def\minus{-}%
+ \def\point{.}%
+ \def\pounds{pounds}%
+ \def\print{-|}%
+ \def\quotedblbase{"}%
+ \def\quotedblleft{"}%
+ \def\quotedblright{"}%
+ \def\quoteleft{`}%
+ \def\quoteright{'}%
+ \def\quotesinglbase{,}%
+ \def\registeredsymbol{R}%
+ \def\result{=>}%
+ \def\textdegree{o}%
+ %
+ \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax
+ \else \indexlquoteignore \fi
+ %
+ % We need to get rid of all macros, leaving only the arguments (if present).
+ % Of course this is not nearly correct, but it is the best we can do for now.
+ % makeinfo does not expand macros in the argument to @deffn, which ends up
+ % writing an index entry, and texindex isn't prepared for an index sort entry
+ % that starts with \.
+ %
+ % Since macro invocations are followed by braces, we can just redefine them
+ % to take a single TeX argument. The case of a macro invocation that
+ % goes to end-of-line is not handled.
+ %
+ \macrolist
+}
+
+% Undocumented (for FSFS 2nd ed.): @set txiindexlquoteignore makes us
+% ignore left quotes in the sort term.
+{\catcode`\`=\active
+ \gdef\indexlquoteignore{\let`=\empty}}
+
+\let\indexbackslash=0 %overridden during \printindex.
+\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
+
+% Most index entries go through here, but \dosubind is the general case.
+% #1 is the index name, #2 is the entry text.
+\def\doind#1#2{\dosubind{#1}{#2}{}}
+
+% Workhorse for all \fooindexes.
+% #1 is name of index, #2 is stuff to put there, #3 is subentry --
+% empty if called from \doind, as we usually are (the main exception
+% is with most defuns, which call us directly).
+%
+\def\dosubind#1#2#3{%
+ \iflinks
+ {%
+ % Store the main index entry text (including the third arg).
+ \toks0 = {#2}%
+ % If third arg is present, precede it with a space.
+ \def\thirdarg{#3}%
+ \ifx\thirdarg\empty \else
+ \toks0 = \expandafter{\the\toks0 \space #3}%
+ \fi
+ %
+ \edef\writeto{\csname#1indfile\endcsname}%
+ %
+ \safewhatsit\dosubindwrite
+ }%
+ \fi
+}
+
+% Write the entry in \toks0 to the index file:
+%
+\def\dosubindwrite{%
+ % Put the index entry in the margin if desired.
+ \ifx\SETmarginindex\relax\else
+ \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
+ \fi
+ %
+ % Remember, we are within a group.
+ \indexdummies % Must do this here, since \bf, etc expand at this stage
+ \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now
+ % so it will be output as is; and it will print as backslash.
+ %
+ % Process the index entry with all font commands turned off, to
+ % get the string to sort by.
+ {\indexnofonts
+ \edef\temp{\the\toks0}% need full expansion
+ \xdef\indexsorttmp{\temp}%
+ }%
+ %
+ % Set up the complete index entry, with both the sort key and
+ % the original text, including any font commands. We write
+ % three arguments to \entry to the .?? file (four in the
+ % subentry case), texindex reduces to two when writing the .??s
+ % sorted result.
+ \edef\temp{%
+ \write\writeto{%
+ \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}%
+ }%
+ \temp
+}
+
+% Take care of unwanted page breaks/skips around a whatsit:
+%
+% If a skip is the last thing on the list now, preserve it
+% by backing up by \lastskip, doing the \write, then inserting
+% the skip again. Otherwise, the whatsit generated by the
+% \write or \pdfdest will make \lastskip zero. The result is that
+% sequences like this:
+% @end defun
+% @tindex whatever
+% @defun ...
+% will have extra space inserted, because the \medbreak in the
+% start of the @defun won't see the skip inserted by the @end of
+% the previous defun.
+%
+% But don't do any of this if we're not in vertical mode. We
+% don't want to do a \vskip and prematurely end a paragraph.
+%
+% Avoid page breaks due to these extra skips, too.
+%
+% But wait, there is a catch there:
+% We'll have to check whether \lastskip is zero skip. \ifdim is not
+% sufficient for this purpose, as it ignores stretch and shrink parts
+% of the skip. The only way seems to be to check the textual
+% representation of the skip.
+%
+% The following is almost like \def\zeroskipmacro{0.0pt} except that
+% the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
+%
+\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
+%
+\newskip\whatsitskip
+\newcount\whatsitpenalty
+%
+% ..., ready, GO:
+%
+\def\safewhatsit#1{\ifhmode
+ #1%
+ \else
+ % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
+ \whatsitskip = \lastskip
+ \edef\lastskipmacro{\the\lastskip}%
+ \whatsitpenalty = \lastpenalty
+ %
+ % If \lastskip is nonzero, that means the last item was a
+ % skip. And since a skip is discardable, that means this
+ % -\whatsitskip glue we're inserting is preceded by a
+ % non-discardable item, therefore it is not a potential
+ % breakpoint, therefore no \nobreak needed.
+ \ifx\lastskipmacro\zeroskipmacro
+ \else
+ \vskip-\whatsitskip
+ \fi
+ %
+ #1%
+ %
+ \ifx\lastskipmacro\zeroskipmacro
+ % If \lastskip was zero, perhaps the last item was a penalty, and
+ % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
+ % to re-insert the same penalty (values >10000 are used for various
+ % signals); since we just inserted a non-discardable item, any
+ % following glue (such as a \parskip) would be a breakpoint. For example:
+ % @deffn deffn-whatever
+ % @vindex index-whatever
+ % Description.
+ % would allow a break between the index-whatever whatsit
+ % and the "Description." paragraph.
+ \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
+ \else
+ % On the other hand, if we had a nonzero \lastskip,
+ % this make-up glue would be preceded by a non-discardable item
+ % (the whatsit from the \write), so we must insert a \nobreak.
+ \nobreak\vskip\whatsitskip
+ \fi
+\fi}
+
+% The index entry written in the file actually looks like
+% \entry {sortstring}{page}{topic}
+% or
+% \entry {sortstring}{page}{topic}{subtopic}
+% The texindex program reads in these files and writes files
+% containing these kinds of lines:
+% \initial {c}
+% before the first topic whose initial is c
+% \entry {topic}{pagelist}
+% for a topic that is used without subtopics
+% \primary {topic}
+% for the beginning of a topic that is used with subtopics
+% \secondary {subtopic}{pagelist}
+% for each subtopic.
+
+% Define the user-accessible indexing commands
+% @findex, @vindex, @kindex, @cindex.
+
+\def\findex {\fnindex}
+\def\kindex {\kyindex}
+\def\cindex {\cpindex}
+\def\vindex {\vrindex}
+\def\tindex {\tpindex}
+\def\pindex {\pgindex}
+
+\def\cindexsub {\begingroup\obeylines\cindexsub}
+{\obeylines %
+\gdef\cindexsub "#1" #2^^M{\endgroup %
+\dosubind{cp}{#2}{#1}}}
+
+% Define the macros used in formatting output of the sorted index material.
+
+% @printindex causes a particular index (the ??s file) to get printed.
+% It does not print any chapter heading (usually an @unnumbered).
+%
+\parseargdef\printindex{\begingroup
+ \dobreak \chapheadingskip{10000}%
+ %
+ \smallfonts \rm
+ \tolerance = 9500
+ \plainfrenchspacing
+ \everypar = {}% don't want the \kern\-parindent from indentation suppression.
+ %
+ % See if the index file exists and is nonempty.
+ % Change catcode of @ here so that if the index file contains
+ % \initial {@}
+ % as its first line, TeX doesn't complain about mismatched braces
+ % (because it thinks @} is a control sequence).
+ \catcode`\@ = 11
+ \openin 1 \jobname.#1s
+ \ifeof 1
+ % \enddoublecolumns gets confused if there is no text in the index,
+ % and it loses the chapter title and the aux file entries for the
+ % index. The easiest way to prevent this problem is to make sure
+ % there is some text.
+ \putwordIndexNonexistent
+ \else
+ %
+ % If the index file exists but is empty, then \openin leaves \ifeof
+ % false. We have to make TeX try to read something from the file, so
+ % it can discover if there is anything in it.
+ \read 1 to \temp
+ \ifeof 1
+ \putwordIndexIsEmpty
+ \else
+ % Index files are almost Texinfo source, but we use \ as the escape
+ % character. It would be better to use @, but that's too big a change
+ % to make right now.
+ \def\indexbackslash{\backslashcurfont}%
+ \catcode`\\ = 0
+ \escapechar = `\\
+ \begindoublecolumns
+ \input \jobname.#1s
+ \enddoublecolumns
+ \fi
+ \fi
+ \closein 1
+\endgroup}
+
+% These macros are used by the sorted index file itself.
+% Change them to control the appearance of the index.
+
+\def\initial#1{{%
+ % Some minor font changes for the special characters.
+ \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
+ %
+ % Remove any glue we may have, we'll be inserting our own.
+ \removelastskip
+ %
+ % We like breaks before the index initials, so insert a bonus.
+ \nobreak
+ \vskip 0pt plus 3\baselineskip
+ \penalty 0
+ \vskip 0pt plus -3\baselineskip
+ %
+ % Typeset the initial. Making this add up to a whole number of
+ % baselineskips increases the chance of the dots lining up from column
+ % to column. It still won't often be perfect, because of the stretch
+ % we need before each entry, but it's better.
+ %
+ % No shrink because it confuses \balancecolumns.
+ \vskip 1.67\baselineskip plus .5\baselineskip
+ \leftline{\secbf #1}%
+ % Do our best not to break after the initial.
+ \nobreak
+ \vskip .33\baselineskip plus .1\baselineskip
+}}
+
+% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
+% then page number (#2) flushed to the right margin. It is used for index
+% and table of contents entries. The paragraph is indented by \leftskip.
+%
+% A straightforward implementation would start like this:
+% \def\entry#1#2{...
+% But this freezes the catcodes in the argument, and can cause problems to
+% @code, which sets - active. This problem was fixed by a kludge---
+% ``-'' was active throughout whole index, but this isn't really right.
+% The right solution is to prevent \entry from swallowing the whole text.
+% --kasal, 21nov03
+\def\entry{%
+ \begingroup
+ %
+ % Start a new paragraph if necessary, so our assignments below can't
+ % affect previous text.
+ \par
+ %
+ % Do not fill out the last line with white space.
+ \parfillskip = 0in
+ %
+ % No extra space above this paragraph.
+ \parskip = 0in
+ %
+ % Do not prefer a separate line ending with a hyphen to fewer lines.
+ \finalhyphendemerits = 0
+ %
+ % \hangindent is only relevant when the entry text and page number
+ % don't both fit on one line. In that case, bob suggests starting the
+ % dots pretty far over on the line. Unfortunately, a large
+ % indentation looks wrong when the entry text itself is broken across
+ % lines. So we use a small indentation and put up with long leaders.
+ %
+ % \hangafter is reset to 1 (which is the value we want) at the start
+ % of each paragraph, so we need not do anything with that.
+ \hangindent = 2em
+ %
+ % When the entry text needs to be broken, just fill out the first line
+ % with blank space.
+ \rightskip = 0pt plus1fil
+ %
+ % A bit of stretch before each entry for the benefit of balancing
+ % columns.
+ \vskip 0pt plus1pt
+ %
+ % When reading the text of entry, convert explicit line breaks
+ % from @* into spaces. The user might give these in long section
+ % titles, for instance.
+ \def\*{\unskip\space\ignorespaces}%
+ \def\entrybreak{\hfil\break}%
+ %
+ % Swallow the left brace of the text (first parameter):
+ \afterassignment\doentry
+ \let\temp =
+}
+\def\entrybreak{\unskip\space\ignorespaces}%
+\def\doentry{%
+ \bgroup % Instead of the swallowed brace.
+ \noindent
+ \aftergroup\finishentry
+ % And now comes the text of the entry.
+}
+\def\finishentry#1{%
+ % #1 is the page number.
+ %
+ % The following is kludged to not output a line of dots in the index if
+ % there are no page numbers. The next person who breaks this will be
+ % cursed by a Unix daemon.
+ \setbox\boxA = \hbox{#1}%
+ \ifdim\wd\boxA = 0pt
+ \ %
+ \else
+ %
+ % If we must, put the page number on a line of its own, and fill out
+ % this line with blank space. (The \hfil is overwhelmed with the
+ % fill leaders glue in \indexdotfill if the page number does fit.)
+ \hfil\penalty50
+ \null\nobreak\indexdotfill % Have leaders before the page number.
+ %
+ % The `\ ' here is removed by the implicit \unskip that TeX does as
+ % part of (the primitive) \par. Without it, a spurious underfull
+ % \hbox ensues.
+ \ifpdf
+ \pdfgettoks#1.%
+ \ \the\toksA
+ \else
+ \ #1%
+ \fi
+ \fi
+ \par
+ \endgroup
+}
+
+% Like plain.tex's \dotfill, except uses up at least 1 em.
+\def\indexdotfill{\cleaders
+ \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill}
+
+\def\primary #1{\line{#1\hfil}}
+
+\newskip\secondaryindent \secondaryindent=0.5cm
+\def\secondary#1#2{{%
+ \parfillskip=0in
+ \parskip=0in
+ \hangindent=1in
+ \hangafter=1
+ \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
+ \ifpdf
+ \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
+ \else
+ #2
+ \fi
+ \par
+}}
+
+% Define two-column mode, which we use to typeset indexes.
+% Adapted from the TeXbook, page 416, which is to say,
+% the manmac.tex format used to print the TeXbook itself.
+\catcode`\@=11
+
+\newbox\partialpage
+\newdimen\doublecolumnhsize
+
+\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
+ % Grab any single-column material above us.
+ \output = {%
+ %
+ % Here is a possibility not foreseen in manmac: if we accumulate a
+ % whole lot of material, we might end up calling this \output
+ % routine twice in a row (see the doublecol-lose test, which is
+ % essentially a couple of indexes with @setchapternewpage off). In
+ % that case we just ship out what is in \partialpage with the normal
+ % output routine. Generally, \partialpage will be empty when this
+ % runs and this will be a no-op. See the indexspread.tex test case.
+ \ifvoid\partialpage \else
+ \onepageout{\pagecontents\partialpage}%
+ \fi
+ %
+ \global\setbox\partialpage = \vbox{%
+ % Unvbox the main output page.
+ \unvbox\PAGE
+ \kern-\topskip \kern\baselineskip
+ }%
+ }%
+ \eject % run that output routine to set \partialpage
+ %
+ % Use the double-column output routine for subsequent pages.
+ \output = {\doublecolumnout}%
+ %
+ % Change the page size parameters. We could do this once outside this
+ % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
+ % format, but then we repeat the same computation. Repeating a couple
+ % of assignments once per index is clearly meaningless for the
+ % execution time, so we may as well do it in one place.
+ %
+ % First we halve the line length, less a little for the gutter between
+ % the columns. We compute the gutter based on the line length, so it
+ % changes automatically with the paper format. The magic constant
+ % below is chosen so that the gutter has the same value (well, +-<1pt)
+ % as it did when we hard-coded it.
+ %
+ % We put the result in a separate register, \doublecolumhsize, so we
+ % can restore it in \pagesofar, after \hsize itself has (potentially)
+ % been clobbered.
+ %
+ \doublecolumnhsize = \hsize
+ \advance\doublecolumnhsize by -.04154\hsize
+ \divide\doublecolumnhsize by 2
+ \hsize = \doublecolumnhsize
+ %
+ % Double the \vsize as well. (We don't need a separate register here,
+ % since nobody clobbers \vsize.)
+ \vsize = 2\vsize
+}
+
+% The double-column output routine for all double-column pages except
+% the last.
+%
+\def\doublecolumnout{%
+ \splittopskip=\topskip \splitmaxdepth=\maxdepth
+ % Get the available space for the double columns -- the normal
+ % (undoubled) page height minus any material left over from the
+ % previous page.
+ \dimen@ = \vsize
+ \divide\dimen@ by 2
+ \advance\dimen@ by -\ht\partialpage
+ %
+ % box0 will be the left-hand column, box2 the right.
+ \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
+ \onepageout\pagesofar
+ \unvbox255
+ \penalty\outputpenalty
+}
+%
+% Re-output the contents of the output page -- any previous material,
+% followed by the two boxes we just split, in box0 and box2.
+\def\pagesofar{%
+ \unvbox\partialpage
+ %
+ \hsize = \doublecolumnhsize
+ \wd0=\hsize \wd2=\hsize
+ \hbox to\pagewidth{\box0\hfil\box2}%
+}
+%
+% All done with double columns.
+\def\enddoublecolumns{%
+ % The following penalty ensures that the page builder is exercised
+ % _before_ we change the output routine. This is necessary in the
+ % following situation:
+ %
+ % The last section of the index consists only of a single entry.
+ % Before this section, \pagetotal is less than \pagegoal, so no
+ % break occurs before the last section starts. However, the last
+ % section, consisting of \initial and the single \entry, does not
+ % fit on the page and has to be broken off. Without the following
+ % penalty the page builder will not be exercised until \eject
+ % below, and by that time we'll already have changed the output
+ % routine to the \balancecolumns version, so the next-to-last
+ % double-column page will be processed with \balancecolumns, which
+ % is wrong: The two columns will go to the main vertical list, with
+ % the broken-off section in the recent contributions. As soon as
+ % the output routine finishes, TeX starts reconsidering the page
+ % break. The two columns and the broken-off section both fit on the
+ % page, because the two columns now take up only half of the page
+ % goal. When TeX sees \eject from below which follows the final
+ % section, it invokes the new output routine that we've set after
+ % \balancecolumns below; \onepageout will try to fit the two columns
+ % and the final section into the vbox of \pageheight (see
+ % \pagebody), causing an overfull box.
+ %
+ % Note that glue won't work here, because glue does not exercise the
+ % page builder, unlike penalties (see The TeXbook, pp. 280-281).
+ \penalty0
+ %
+ \output = {%
+ % Split the last of the double-column material. Leave it on the
+ % current page, no automatic page break.
+ \balancecolumns
+ %
+ % If we end up splitting too much material for the current page,
+ % though, there will be another page break right after this \output
+ % invocation ends. Having called \balancecolumns once, we do not
+ % want to call it again. Therefore, reset \output to its normal
+ % definition right away. (We hope \balancecolumns will never be
+ % called on to balance too much material, but if it is, this makes
+ % the output somewhat more palatable.)
+ \global\output = {\onepageout{\pagecontents\PAGE}}%
+ }%
+ \eject
+ \endgroup % started in \begindoublecolumns
+ %
+ % \pagegoal was set to the doubled \vsize above, since we restarted
+ % the current page. We're now back to normal single-column
+ % typesetting, so reset \pagegoal to the normal \vsize (after the
+ % \endgroup where \vsize got restored).
+ \pagegoal = \vsize
+}
+%
+% Called at the end of the double column material.
+\def\balancecolumns{%
+ \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
+ \dimen@ = \ht0
+ \advance\dimen@ by \topskip
+ \advance\dimen@ by-\baselineskip
+ \divide\dimen@ by 2 % target to split to
+ %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
+ \splittopskip = \topskip
+ % Loop until we get a decent breakpoint.
+ {%
+ \vbadness = 10000
+ \loop
+ \global\setbox3 = \copy0
+ \global\setbox1 = \vsplit3 to \dimen@
+ \ifdim\ht3>\dimen@
+ \global\advance\dimen@ by 1pt
+ \repeat
+ }%
+ %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
+ \setbox0=\vbox to\dimen@{\unvbox1}%
+ \setbox2=\vbox to\dimen@{\unvbox3}%
+ %
+ \pagesofar
+}
+\catcode`\@ = \other
+
+
+\message{sectioning,}
+% Chapters, sections, etc.
+
+% Let's start with @part.
+\outer\parseargdef\part{\partzzz{#1}}
+\def\partzzz#1{%
+ \chapoddpage
+ \null
+ \vskip.3\vsize % move it down on the page a bit
+ \begingroup
+ \noindent \titlefonts\rmisbold #1\par % the text
+ \let\lastnode=\empty % no node to associate with
+ \writetocentry{part}{#1}{}% but put it in the toc
+ \headingsoff % no headline or footline on the part page
+ \chapoddpage
+ \endgroup
+}
+
+% \unnumberedno is an oxymoron. But we count the unnumbered
+% sections so that we can refer to them unambiguously in the pdf
+% outlines by their "section number". We avoid collisions with chapter
+% numbers by starting them at 10000. (If a document ever has 10000
+% chapters, we're in trouble anyway, I'm sure.)
+\newcount\unnumberedno \unnumberedno = 10000
+\newcount\chapno
+\newcount\secno \secno=0
+\newcount\subsecno \subsecno=0
+\newcount\subsubsecno \subsubsecno=0
+
+% This counter is funny since it counts through charcodes of letters A, B, ...
+\newcount\appendixno \appendixno = `\@
+%
+% \def\appendixletter{\char\the\appendixno}
+% We do the following ugly conditional instead of the above simple
+% construct for the sake of pdftex, which needs the actual
+% letter in the expansion, not just typeset.
+%
+\def\appendixletter{%
+ \ifnum\appendixno=`A A%
+ \else\ifnum\appendixno=`B B%
+ \else\ifnum\appendixno=`C C%
+ \else\ifnum\appendixno=`D D%
+ \else\ifnum\appendixno=`E E%
+ \else\ifnum\appendixno=`F F%
+ \else\ifnum\appendixno=`G G%
+ \else\ifnum\appendixno=`H H%
+ \else\ifnum\appendixno=`I I%
+ \else\ifnum\appendixno=`J J%
+ \else\ifnum\appendixno=`K K%
+ \else\ifnum\appendixno=`L L%
+ \else\ifnum\appendixno=`M M%
+ \else\ifnum\appendixno=`N N%
+ \else\ifnum\appendixno=`O O%
+ \else\ifnum\appendixno=`P P%
+ \else\ifnum\appendixno=`Q Q%
+ \else\ifnum\appendixno=`R R%
+ \else\ifnum\appendixno=`S S%
+ \else\ifnum\appendixno=`T T%
+ \else\ifnum\appendixno=`U U%
+ \else\ifnum\appendixno=`V V%
+ \else\ifnum\appendixno=`W W%
+ \else\ifnum\appendixno=`X X%
+ \else\ifnum\appendixno=`Y Y%
+ \else\ifnum\appendixno=`Z Z%
+ % The \the is necessary, despite appearances, because \appendixletter is
+ % expanded while writing the .toc file. \char\appendixno is not
+ % expandable, thus it is written literally, thus all appendixes come out
+ % with the same letter (or @) in the toc without it.
+ \else\char\the\appendixno
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
+
+% Each @chapter defines these (using marks) as the number+name, number
+% and name of the chapter. Page headings and footings can use
+% these. @section does likewise.
+\def\thischapter{}
+\def\thischapternum{}
+\def\thischaptername{}
+\def\thissection{}
+\def\thissectionnum{}
+\def\thissectionname{}
+
+\newcount\absseclevel % used to calculate proper heading level
+\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
+
+% @raisesections: treat @section as chapter, @subsection as section, etc.
+\def\raisesections{\global\advance\secbase by -1}
+\let\up=\raisesections % original BFox name
+
+% @lowersections: treat @chapter as section, @section as subsection, etc.
+\def\lowersections{\global\advance\secbase by 1}
+\let\down=\lowersections % original BFox name
+
+% we only have subsub.
+\chardef\maxseclevel = 3
+%
+% A numbered section within an unnumbered changes to unnumbered too.
+% To achieve this, remember the "biggest" unnum. sec. we are currently in:
+\chardef\unnlevel = \maxseclevel
+%
+% Trace whether the current chapter is an appendix or not:
+% \chapheadtype is "N" or "A", unnumbered chapters are ignored.
+\def\chapheadtype{N}
+
+% Choose a heading macro
+% #1 is heading type
+% #2 is heading level
+% #3 is text for heading
+\def\genhead#1#2#3{%
+ % Compute the abs. sec. level:
+ \absseclevel=#2
+ \advance\absseclevel by \secbase
+ % Make sure \absseclevel doesn't fall outside the range:
+ \ifnum \absseclevel < 0
+ \absseclevel = 0
+ \else
+ \ifnum \absseclevel > 3
+ \absseclevel = 3
+ \fi
+ \fi
+ % The heading type:
+ \def\headtype{#1}%
+ \if \headtype U%
+ \ifnum \absseclevel < \unnlevel
+ \chardef\unnlevel = \absseclevel
+ \fi
+ \else
+ % Check for appendix sections:
+ \ifnum \absseclevel = 0
+ \edef\chapheadtype{\headtype}%
+ \else
+ \if \headtype A\if \chapheadtype N%
+ \errmessage{@appendix... within a non-appendix chapter}%
+ \fi\fi
+ \fi
+ % Check for numbered within unnumbered:
+ \ifnum \absseclevel > \unnlevel
+ \def\headtype{U}%
+ \else
+ \chardef\unnlevel = 3
+ \fi
+ \fi
+ % Now print the heading:
+ \if \headtype U%
+ \ifcase\absseclevel
+ \unnumberedzzz{#3}%
+ \or \unnumberedseczzz{#3}%
+ \or \unnumberedsubseczzz{#3}%
+ \or \unnumberedsubsubseczzz{#3}%
+ \fi
+ \else
+ \if \headtype A%
+ \ifcase\absseclevel
+ \appendixzzz{#3}%
+ \or \appendixsectionzzz{#3}%
+ \or \appendixsubseczzz{#3}%
+ \or \appendixsubsubseczzz{#3}%
+ \fi
+ \else
+ \ifcase\absseclevel
+ \chapterzzz{#3}%
+ \or \seczzz{#3}%
+ \or \numberedsubseczzz{#3}%
+ \or \numberedsubsubseczzz{#3}%
+ \fi
+ \fi
+ \fi
+ \suppressfirstparagraphindent
+}
+
+% an interface:
+\def\numhead{\genhead N}
+\def\apphead{\genhead A}
+\def\unnmhead{\genhead U}
+
+% @chapter, @appendix, @unnumbered. Increment top-level counter, reset
+% all lower-level sectioning counters to zero.
+%
+% Also set \chaplevelprefix, which we prepend to @float sequence numbers
+% (e.g., figures), q.v. By default (before any chapter), that is empty.
+\let\chaplevelprefix = \empty
+%
+\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
+\def\chapterzzz#1{%
+ % section resetting is \global in case the chapter is in a group, such
+ % as an @include file.
+ \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
+ \global\advance\chapno by 1
+ %
+ % Used for \float.
+ \gdef\chaplevelprefix{\the\chapno.}%
+ \resetallfloatnos
+ %
+ % \putwordChapter can contain complex things in translations.
+ \toks0=\expandafter{\putwordChapter}%
+ \message{\the\toks0 \space \the\chapno}%
+ %
+ % Write the actual heading.
+ \chapmacro{#1}{Ynumbered}{\the\chapno}%
+ %
+ % So @section and the like are numbered underneath this chapter.
+ \global\let\section = \numberedsec
+ \global\let\subsection = \numberedsubsec
+ \global\let\subsubsection = \numberedsubsubsec
+}
+
+\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
+%
+\def\appendixzzz#1{%
+ \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
+ \global\advance\appendixno by 1
+ \gdef\chaplevelprefix{\appendixletter.}%
+ \resetallfloatnos
+ %
+ % \putwordAppendix can contain complex things in translations.
+ \toks0=\expandafter{\putwordAppendix}%
+ \message{\the\toks0 \space \appendixletter}%
+ %
+ \chapmacro{#1}{Yappendix}{\appendixletter}%
+ %
+ \global\let\section = \appendixsec
+ \global\let\subsection = \appendixsubsec
+ \global\let\subsubsection = \appendixsubsubsec
+}
+
+% normally unnmhead0 calls unnumberedzzz:
+\outer\parseargdef\unnumbered{\unnmhead0{#1}}
+\def\unnumberedzzz#1{%
+ \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
+ \global\advance\unnumberedno by 1
+ %
+ % Since an unnumbered has no number, no prefix for figures.
+ \global\let\chaplevelprefix = \empty
+ \resetallfloatnos
+ %
+ % This used to be simply \message{#1}, but TeX fully expands the
+ % argument to \message. Therefore, if #1 contained @-commands, TeX
+ % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
+ % expanded @cite (which turns out to cause errors because \cite is meant
+ % to be executed, not expanded).
+ %
+ % Anyway, we don't want the fully-expanded definition of @cite to appear
+ % as a result of the \message, we just want `@cite' itself. We use
+ % \the<toks register> to achieve this: TeX expands \the<toks> only once,
+ % simply yielding the contents of <toks register>. (We also do this for
+ % the toc entries.)
+ \toks0 = {#1}%
+ \message{(\the\toks0)}%
+ %
+ \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
+ %
+ \global\let\section = \unnumberedsec
+ \global\let\subsection = \unnumberedsubsec
+ \global\let\subsubsection = \unnumberedsubsubsec
+}
+
+% @centerchap is like @unnumbered, but the heading is centered.
+\outer\parseargdef\centerchap{%
+ % Well, we could do the following in a group, but that would break
+ % an assumption that \chapmacro is called at the outermost level.
+ % Thus we are safer this way: --kasal, 24feb04
+ \let\centerparametersmaybe = \centerparameters
+ \unnmhead0{#1}%
+ \let\centerparametersmaybe = \relax
+}
+
+% @top is like @unnumbered.
+\let\top\unnumbered
+
+% Sections.
+%
+\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
+\def\seczzz#1{%
+ \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
+ \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
+}
+
+% normally calls appendixsectionzzz:
+\outer\parseargdef\appendixsection{\apphead1{#1}}
+\def\appendixsectionzzz#1{%
+ \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
+ \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
+}
+\let\appendixsec\appendixsection
+
+% normally calls unnumberedseczzz:
+\outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
+\def\unnumberedseczzz#1{%
+ \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
+ \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
+}
+
+% Subsections.
+%
+% normally calls numberedsubseczzz:
+\outer\parseargdef\numberedsubsec{\numhead2{#1}}
+\def\numberedsubseczzz#1{%
+ \global\subsubsecno=0 \global\advance\subsecno by 1
+ \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
+}
+
+% normally calls appendixsubseczzz:
+\outer\parseargdef\appendixsubsec{\apphead2{#1}}
+\def\appendixsubseczzz#1{%
+ \global\subsubsecno=0 \global\advance\subsecno by 1
+ \sectionheading{#1}{subsec}{Yappendix}%
+ {\appendixletter.\the\secno.\the\subsecno}%
+}
+
+% normally calls unnumberedsubseczzz:
+\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
+\def\unnumberedsubseczzz#1{%
+ \global\subsubsecno=0 \global\advance\subsecno by 1
+ \sectionheading{#1}{subsec}{Ynothing}%
+ {\the\unnumberedno.\the\secno.\the\subsecno}%
+}
+
+% Subsubsections.
+%
+% normally numberedsubsubseczzz:
+\outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
+\def\numberedsubsubseczzz#1{%
+ \global\advance\subsubsecno by 1
+ \sectionheading{#1}{subsubsec}{Ynumbered}%
+ {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
+}
+
+% normally appendixsubsubseczzz:
+\outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
+\def\appendixsubsubseczzz#1{%
+ \global\advance\subsubsecno by 1
+ \sectionheading{#1}{subsubsec}{Yappendix}%
+ {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
+}
+
+% normally unnumberedsubsubseczzz:
+\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
+\def\unnumberedsubsubseczzz#1{%
+ \global\advance\subsubsecno by 1
+ \sectionheading{#1}{subsubsec}{Ynothing}%
+ {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
+}
+
+% These macros control what the section commands do, according
+% to what kind of chapter we are in (ordinary, appendix, or unnumbered).
+% Define them by default for a numbered chapter.
+\let\section = \numberedsec
+\let\subsection = \numberedsubsec
+\let\subsubsection = \numberedsubsubsec
+
+% Define @majorheading, @heading and @subheading
+
+% NOTE on use of \vbox for chapter headings, section headings, and such:
+% 1) We use \vbox rather than the earlier \line to permit
+% overlong headings to fold.
+% 2) \hyphenpenalty is set to 10000 because hyphenation in a
+% heading is obnoxious; this forbids it.
+% 3) Likewise, headings look best if no \parindent is used, and
+% if justification is not attempted. Hence \raggedright.
+
+\def\majorheading{%
+ {\advance\chapheadingskip by 10pt \chapbreak }%
+ \parsearg\chapheadingzzz
+}
+
+\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
+\def\chapheadingzzz#1{%
+ {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+ \parindent=0pt\ptexraggedright
+ \rmisbold #1\hfill}}%
+ \bigskip \par\penalty 200\relax
+ \suppressfirstparagraphindent
+}
+
+% @heading, @subheading, @subsubheading.
+\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
+ \suppressfirstparagraphindent}
+\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
+ \suppressfirstparagraphindent}
+\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
+ \suppressfirstparagraphindent}
+
+% These macros generate a chapter, section, etc. heading only
+% (including whitespace, linebreaking, etc. around it),
+% given all the information in convenient, parsed form.
+
+% Args are the skip and penalty (usually negative)
+\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
+
+% Parameter controlling skip before chapter headings (if needed)
+\newskip\chapheadingskip
+
+% Define plain chapter starts, and page on/off switching for it.
+\def\chapbreak{\dobreak \chapheadingskip {-4000}}
+\def\chappager{\par\vfill\supereject}
+% Because \domark is called before \chapoddpage, the filler page will
+% get the headings for the next chapter, which is wrong. But we don't
+% care -- we just disable all headings on the filler page.
+\def\chapoddpage{%
+ \chappager
+ \ifodd\pageno \else
+ \begingroup
+ \headingsoff
+ \null
+ \chappager
+ \endgroup
+ \fi
+}
+
+\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
+
+\def\CHAPPAGoff{%
+\global\let\contentsalignmacro = \chappager
+\global\let\pchapsepmacro=\chapbreak
+\global\let\pagealignmacro=\chappager}
+
+\def\CHAPPAGon{%
+\global\let\contentsalignmacro = \chappager
+\global\let\pchapsepmacro=\chappager
+\global\let\pagealignmacro=\chappager
+\global\def\HEADINGSon{\HEADINGSsingle}}
+
+\def\CHAPPAGodd{%
+\global\let\contentsalignmacro = \chapoddpage
+\global\let\pchapsepmacro=\chapoddpage
+\global\let\pagealignmacro=\chapoddpage
+\global\def\HEADINGSon{\HEADINGSdouble}}
+
+\CHAPPAGon
+
+% Chapter opening.
+%
+% #1 is the text, #2 is the section type (Ynumbered, Ynothing,
+% Yappendix, Yomitfromtoc), #3 the chapter number.
+%
+% To test against our argument.
+\def\Ynothingkeyword{Ynothing}
+\def\Yomitfromtockeyword{Yomitfromtoc}
+\def\Yappendixkeyword{Yappendix}
+%
+\def\chapmacro#1#2#3{%
+ % Insert the first mark before the heading break (see notes for \domark).
+ \let\prevchapterdefs=\lastchapterdefs
+ \let\prevsectiondefs=\lastsectiondefs
+ \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
+ \gdef\thissection{}}%
+ %
+ \def\temptype{#2}%
+ \ifx\temptype\Ynothingkeyword
+ \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
+ \gdef\thischapter{\thischaptername}}%
+ \else\ifx\temptype\Yomitfromtockeyword
+ \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
+ \gdef\thischapter{}}%
+ \else\ifx\temptype\Yappendixkeyword
+ \toks0={#1}%
+ \xdef\lastchapterdefs{%
+ \gdef\noexpand\thischaptername{\the\toks0}%
+ \gdef\noexpand\thischapternum{\appendixletter}%
+ % \noexpand\putwordAppendix avoids expanding indigestible
+ % commands in some of the translations.
+ \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
+ \noexpand\thischapternum:
+ \noexpand\thischaptername}%
+ }%
+ \else
+ \toks0={#1}%
+ \xdef\lastchapterdefs{%
+ \gdef\noexpand\thischaptername{\the\toks0}%
+ \gdef\noexpand\thischapternum{\the\chapno}%
+ % \noexpand\putwordChapter avoids expanding indigestible
+ % commands in some of the translations.
+ \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
+ \noexpand\thischapternum:
+ \noexpand\thischaptername}%
+ }%
+ \fi\fi\fi
+ %
+ % Output the mark. Pass it through \safewhatsit, to take care of
+ % the preceding space.
+ \safewhatsit\domark
+ %
+ % Insert the chapter heading break.
+ \pchapsepmacro
+ %
+ % Now the second mark, after the heading break. No break points
+ % between here and the heading.
+ \let\prevchapterdefs=\lastchapterdefs
+ \let\prevsectiondefs=\lastsectiondefs
+ \domark
+ %
+ {%
+ \chapfonts \rmisbold
+ %
+ % Have to define \lastsection before calling \donoderef, because the
+ % xref code eventually uses it. On the other hand, it has to be called
+ % after \pchapsepmacro, or the headline will change too soon.
+ \gdef\lastsection{#1}%
+ %
+ % Only insert the separating space if we have a chapter/appendix
+ % number, and don't print the unnumbered ``number''.
+ \ifx\temptype\Ynothingkeyword
+ \setbox0 = \hbox{}%
+ \def\toctype{unnchap}%
+ \else\ifx\temptype\Yomitfromtockeyword
+ \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
+ \def\toctype{omit}%
+ \else\ifx\temptype\Yappendixkeyword
+ \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
+ \def\toctype{app}%
+ \else
+ \setbox0 = \hbox{#3\enspace}%
+ \def\toctype{numchap}%
+ \fi\fi\fi
+ %
+ % Write the toc entry for this chapter. Must come before the
+ % \donoderef, because we include the current node name in the toc
+ % entry, and \donoderef resets it to empty.
+ \writetocentry{\toctype}{#1}{#3}%
+ %
+ % For pdftex, we have to write out the node definition (aka, make
+ % the pdfdest) after any page break, but before the actual text has
+ % been typeset. If the destination for the pdf outline is after the
+ % text, then jumping from the outline may wind up with the text not
+ % being visible, for instance under high magnification.
+ \donoderef{#2}%
+ %
+ % Typeset the actual heading.
+ \nobreak % Avoid page breaks at the interline glue.
+ \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
+ \hangindent=\wd0 \centerparametersmaybe
+ \unhbox0 #1\par}%
+ }%
+ \nobreak\bigskip % no page break after a chapter title
+ \nobreak
+}
+
+% @centerchap -- centered and unnumbered.
+\let\centerparametersmaybe = \relax
+\def\centerparameters{%
+ \advance\rightskip by 3\rightskip
+ \leftskip = \rightskip
+ \parfillskip = 0pt
+}
+
+
+% I don't think this chapter style is supported any more, so I'm not
+% updating it with the new noderef stuff. We'll see. --karl, 11aug03.
+%
+\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
+%
+\def\unnchfopen #1{%
+\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+ \parindent=0pt\ptexraggedright
+ \rmisbold #1\hfill}}\bigskip \par\nobreak
+}
+\def\chfopen #1#2{\chapoddpage {\chapfonts
+\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
+\par\penalty 5000 %
+}
+\def\centerchfopen #1{%
+\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+ \parindent=0pt
+ \hfill {\rmisbold #1}\hfill}}\bigskip \par\nobreak
+}
+\def\CHAPFopen{%
+ \global\let\chapmacro=\chfopen
+ \global\let\centerchapmacro=\centerchfopen}
+
+
+% Section titles. These macros combine the section number parts and
+% call the generic \sectionheading to do the printing.
+%
+\newskip\secheadingskip
+\def\secheadingbreak{\dobreak \secheadingskip{-1000}}
+
+% Subsection titles.
+\newskip\subsecheadingskip
+\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
+
+% Subsubsection titles.
+\def\subsubsecheadingskip{\subsecheadingskip}
+\def\subsubsecheadingbreak{\subsecheadingbreak}
+
+
+% Print any size, any type, section title.
+%
+% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is
+% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
+% section number.
+%
+\def\seckeyword{sec}
+%
+\def\sectionheading#1#2#3#4{%
+ {%
+ \checkenv{}% should not be in an environment.
+ %
+ % Switch to the right set of fonts.
+ \csname #2fonts\endcsname \rmisbold
+ %
+ \def\sectionlevel{#2}%
+ \def\temptype{#3}%
+ %
+ % Insert first mark before the heading break (see notes for \domark).
+ \let\prevsectiondefs=\lastsectiondefs
+ \ifx\temptype\Ynothingkeyword
+ \ifx\sectionlevel\seckeyword
+ \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
+ \gdef\thissection{\thissectionname}}%
+ \fi
+ \else\ifx\temptype\Yomitfromtockeyword
+ % Don't redefine \thissection.
+ \else\ifx\temptype\Yappendixkeyword
+ \ifx\sectionlevel\seckeyword
+ \toks0={#1}%
+ \xdef\lastsectiondefs{%
+ \gdef\noexpand\thissectionname{\the\toks0}%
+ \gdef\noexpand\thissectionnum{#4}%
+ % \noexpand\putwordSection avoids expanding indigestible
+ % commands in some of the translations.
+ \gdef\noexpand\thissection{\noexpand\putwordSection{}
+ \noexpand\thissectionnum:
+ \noexpand\thissectionname}%
+ }%
+ \fi
+ \else
+ \ifx\sectionlevel\seckeyword
+ \toks0={#1}%
+ \xdef\lastsectiondefs{%
+ \gdef\noexpand\thissectionname{\the\toks0}%
+ \gdef\noexpand\thissectionnum{#4}%
+ % \noexpand\putwordSection avoids expanding indigestible
+ % commands in some of the translations.
+ \gdef\noexpand\thissection{\noexpand\putwordSection{}
+ \noexpand\thissectionnum:
+ \noexpand\thissectionname}%
+ }%
+ \fi
+ \fi\fi\fi
+ %
+ % Go into vertical mode. Usually we'll already be there, but we
+ % don't want the following whatsit to end up in a preceding paragraph
+ % if the document didn't happen to have a blank line.
+ \par
+ %
+ % Output the mark. Pass it through \safewhatsit, to take care of
+ % the preceding space.
+ \safewhatsit\domark
+ %
+ % Insert space above the heading.
+ \csname #2headingbreak\endcsname
+ %
+ % Now the second mark, after the heading break. No break points
+ % between here and the heading.
+ \let\prevsectiondefs=\lastsectiondefs
+ \domark
+ %
+ % Only insert the space after the number if we have a section number.
+ \ifx\temptype\Ynothingkeyword
+ \setbox0 = \hbox{}%
+ \def\toctype{unn}%
+ \gdef\lastsection{#1}%
+ \else\ifx\temptype\Yomitfromtockeyword
+ % for @headings -- no section number, don't include in toc,
+ % and don't redefine \lastsection.
+ \setbox0 = \hbox{}%
+ \def\toctype{omit}%
+ \let\sectionlevel=\empty
+ \else\ifx\temptype\Yappendixkeyword
+ \setbox0 = \hbox{#4\enspace}%
+ \def\toctype{app}%
+ \gdef\lastsection{#1}%
+ \else
+ \setbox0 = \hbox{#4\enspace}%
+ \def\toctype{num}%
+ \gdef\lastsection{#1}%
+ \fi\fi\fi
+ %
+ % Write the toc entry (before \donoderef). See comments in \chapmacro.
+ \writetocentry{\toctype\sectionlevel}{#1}{#4}%
+ %
+ % Write the node reference (= pdf destination for pdftex).
+ % Again, see comments in \chapmacro.
+ \donoderef{#3}%
+ %
+ % Interline glue will be inserted when the vbox is completed.
+ % That glue will be a valid breakpoint for the page, since it'll be
+ % preceded by a whatsit (usually from the \donoderef, or from the
+ % \writetocentry if there was no node). We don't want to allow that
+ % break, since then the whatsits could end up on page n while the
+ % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
+ \nobreak
+ %
+ % Output the actual section heading.
+ \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
+ \hangindent=\wd0 % zero if no section number
+ \unhbox0 #1}%
+ }%
+ % Add extra space after the heading -- half of whatever came above it.
+ % Don't allow stretch, though.
+ \kern .5 \csname #2headingskip\endcsname
+ %
+ % Do not let the kern be a potential breakpoint, as it would be if it
+ % was followed by glue.
+ \nobreak
+ %
+ % We'll almost certainly start a paragraph next, so don't let that
+ % glue accumulate. (Not a breakpoint because it's preceded by a
+ % discardable item.) However, when a paragraph is not started next
+ % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
+ % or the negative glue will cause weirdly wrong output, typically
+ % obscuring the section heading with something else.
+ \vskip-\parskip
+ %
+ % This is so the last item on the main vertical list is a known
+ % \penalty > 10000, so \startdefun, etc., can recognize the situation
+ % and do the needful.
+ \penalty 10001
+}
+
+
+\message{toc,}
+% Table of contents.
+\newwrite\tocfile
+
+% Write an entry to the toc file, opening it if necessary.
+% Called from @chapter, etc.
+%
+% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
+% We append the current node name (if any) and page number as additional
+% arguments for the \{chap,sec,...}entry macros which will eventually
+% read this. The node name is used in the pdf outlines as the
+% destination to jump to.
+%
+% We open the .toc file for writing here instead of at @setfilename (or
+% any other fixed time) so that @contents can be anywhere in the document.
+% But if #1 is `omit', then we don't do anything. This is used for the
+% table of contents chapter openings themselves.
+%
+\newif\iftocfileopened
+\def\omitkeyword{omit}%
+%
+\def\writetocentry#1#2#3{%
+ \edef\writetoctype{#1}%
+ \ifx\writetoctype\omitkeyword \else
+ \iftocfileopened\else
+ \immediate\openout\tocfile = \jobname.toc
+ \global\tocfileopenedtrue
+ \fi
+ %
+ \iflinks
+ {\atdummies
+ \edef\temp{%
+ \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
+ \temp
+ }%
+ \fi
+ \fi
+ %
+ % Tell \shipout to create a pdf destination on each page, if we're
+ % writing pdf. These are used in the table of contents. We can't
+ % just write one on every page because the title pages are numbered
+ % 1 and 2 (the page numbers aren't printed), and so are the first
+ % two pages of the document. Thus, we'd have two destinations named
+ % `1', and two named `2'.
+ \ifpdf \global\pdfmakepagedesttrue \fi
+}
+
+
+% These characters do not print properly in the Computer Modern roman
+% fonts, so we must take special care. This is more or less redundant
+% with the Texinfo input format setup at the end of this file.
+%
+\def\activecatcodes{%
+ \catcode`\"=\active
+ \catcode`\$=\active
+ \catcode`\<=\active
+ \catcode`\>=\active
+ \catcode`\\=\active
+ \catcode`\^=\active
+ \catcode`\_=\active
+ \catcode`\|=\active
+ \catcode`\~=\active
+}
+
+
+% Read the toc file, which is essentially Texinfo input.
+\def\readtocfile{%
+ \setupdatafile
+ \activecatcodes
+ \input \tocreadfilename
+}
+
+\newskip\contentsrightmargin \contentsrightmargin=1in
+\newcount\savepageno
+\newcount\lastnegativepageno \lastnegativepageno = -1
+
+% Prepare to read what we've written to \tocfile.
+%
+\def\startcontents#1{%
+ % If @setchapternewpage on, and @headings double, the contents should
+ % start on an odd page, unlike chapters. Thus, we maintain
+ % \contentsalignmacro in parallel with \pagealignmacro.
+ % From: Torbjorn Granlund <tege@matematik.su.se>
+ \contentsalignmacro
+ \immediate\closeout\tocfile
+ %
+ % Don't need to put `Contents' or `Short Contents' in the headline.
+ % It is abundantly clear what they are.
+ \chapmacro{#1}{Yomitfromtoc}{}%
+ %
+ \savepageno = \pageno
+ \begingroup % Set up to handle contents files properly.
+ \raggedbottom % Worry more about breakpoints than the bottom.
+ \advance\hsize by -\contentsrightmargin % Don't use the full line length.
+ %
+ % Roman numerals for page numbers.
+ \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
+}
+
+% redefined for the two-volume lispref. We always output on
+% \jobname.toc even if this is redefined.
+%
+\def\tocreadfilename{\jobname.toc}
+
+% Normal (long) toc.
+%
+\def\contents{%
+ \startcontents{\putwordTOC}%
+ \openin 1 \tocreadfilename\space
+ \ifeof 1 \else
+ \readtocfile
+ \fi
+ \vfill \eject
+ \contentsalignmacro % in case @setchapternewpage odd is in effect
+ \ifeof 1 \else
+ \pdfmakeoutlines
+ \fi
+ \closein 1
+ \endgroup
+ \lastnegativepageno = \pageno
+ \global\pageno = \savepageno
+}
+
+% And just the chapters.
+\def\summarycontents{%
+ \startcontents{\putwordShortTOC}%
+ %
+ \let\partentry = \shortpartentry
+ \let\numchapentry = \shortchapentry
+ \let\appentry = \shortchapentry
+ \let\unnchapentry = \shortunnchapentry
+ % We want a true roman here for the page numbers.
+ \secfonts
+ \let\rm=\shortcontrm \let\bf=\shortcontbf
+ \let\sl=\shortcontsl \let\tt=\shortconttt
+ \rm
+ \hyphenpenalty = 10000
+ \advance\baselineskip by 1pt % Open it up a little.
+ \def\numsecentry##1##2##3##4{}
+ \let\appsecentry = \numsecentry
+ \let\unnsecentry = \numsecentry
+ \let\numsubsecentry = \numsecentry
+ \let\appsubsecentry = \numsecentry
+ \let\unnsubsecentry = \numsecentry
+ \let\numsubsubsecentry = \numsecentry
+ \let\appsubsubsecentry = \numsecentry
+ \let\unnsubsubsecentry = \numsecentry
+ \openin 1 \tocreadfilename\space
+ \ifeof 1 \else
+ \readtocfile
+ \fi
+ \closein 1
+ \vfill \eject
+ \contentsalignmacro % in case @setchapternewpage odd is in effect
+ \endgroup
+ \lastnegativepageno = \pageno
+ \global\pageno = \savepageno
+}
+\let\shortcontents = \summarycontents
+
+% Typeset the label for a chapter or appendix for the short contents.
+% The arg is, e.g., `A' for an appendix, or `3' for a chapter.
+%
+\def\shortchaplabel#1{%
+ % This space should be enough, since a single number is .5em, and the
+ % widest letter (M) is 1em, at least in the Computer Modern fonts.
+ % But use \hss just in case.
+ % (This space doesn't include the extra space that gets added after
+ % the label; that gets put in by \shortchapentry above.)
+ %
+ % We'd like to right-justify chapter numbers, but that looks strange
+ % with appendix letters. And right-justifying numbers and
+ % left-justifying letters looks strange when there is less than 10
+ % chapters. Have to read the whole toc once to know how many chapters
+ % there are before deciding ...
+ \hbox to 1em{#1\hss}%
+}
+
+% These macros generate individual entries in the table of contents.
+% The first argument is the chapter or section name.
+% The last argument is the page number.
+% The arguments in between are the chapter number, section number, ...
+
+% Parts, in the main contents. Replace the part number, which doesn't
+% exist, with an empty box. Let's hope all the numbers have the same width.
+% Also ignore the page number, which is conventionally not printed.
+\def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
+\def\partentry#1#2#3#4{\dochapentry{\numeralbox\labelspace#1}{}}
+%
+% Parts, in the short toc.
+\def\shortpartentry#1#2#3#4{%
+ \penalty-300
+ \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
+ \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
+}
+
+% Chapters, in the main contents.
+\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
+%
+% Chapters, in the short toc.
+% See comments in \dochapentry re vbox and related settings.
+\def\shortchapentry#1#2#3#4{%
+ \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
+}
+
+% Appendices, in the main contents.
+% Need the word Appendix, and a fixed-size box.
+%
+\def\appendixbox#1{%
+ % We use M since it's probably the widest letter.
+ \setbox0 = \hbox{\putwordAppendix{} M}%
+ \hbox to \wd0{\putwordAppendix{} #1\hss}}
+%
+\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}}
+
+% Unnumbered chapters.
+\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
+\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
+
+% Sections.
+\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
+\let\appsecentry=\numsecentry
+\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
+
+% Subsections.
+\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
+\let\appsubsecentry=\numsubsecentry
+\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
+
+% And subsubsections.
+\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
+\let\appsubsubsecentry=\numsubsubsecentry
+\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
+
+% This parameter controls the indentation of the various levels.
+% Same as \defaultparindent.
+\newdimen\tocindent \tocindent = 15pt
+
+% Now for the actual typesetting. In all these, #1 is the text and #2 is the
+% page number.
+%
+% If the toc has to be broken over pages, we want it to be at chapters
+% if at all possible; hence the \penalty.
+\def\dochapentry#1#2{%
+ \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
+ \begingroup
+ \chapentryfonts
+ \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+ \endgroup
+ \nobreak\vskip .25\baselineskip plus.1\baselineskip
+}
+
+\def\dosecentry#1#2{\begingroup
+ \secentryfonts \leftskip=\tocindent
+ \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+\endgroup}
+
+\def\dosubsecentry#1#2{\begingroup
+ \subsecentryfonts \leftskip=2\tocindent
+ \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+\endgroup}
+
+\def\dosubsubsecentry#1#2{\begingroup
+ \subsubsecentryfonts \leftskip=3\tocindent
+ \tocentry{#1}{\dopageno\bgroup#2\egroup}%
+\endgroup}
+
+% We use the same \entry macro as for the index entries.
+\let\tocentry = \entry
+
+% Space between chapter (or whatever) number and the title.
+\def\labelspace{\hskip1em \relax}
+
+\def\dopageno#1{{\rm #1}}
+\def\doshortpageno#1{{\rm #1}}
+
+\def\chapentryfonts{\secfonts \rm}
+\def\secentryfonts{\textfonts}
+\def\subsecentryfonts{\textfonts}
+\def\subsubsecentryfonts{\textfonts}
+
+
+\message{environments,}
+% @foo ... @end foo.
+
+% @tex ... @end tex escapes into raw TeX temporarily.
+% One exception: @ is still an escape character, so that @end tex works.
+% But \@ or @@ will get a plain @ character.
+
+\envdef\tex{%
+ \setupmarkupstyle{tex}%
+ \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
+ \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
+ \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
+ \catcode `\%=14
+ \catcode `\+=\other
+ \catcode `\"=\other
+ \catcode `\|=\other
+ \catcode `\<=\other
+ \catcode `\>=\other
+ \catcode`\`=\other
+ \catcode`\'=\other
+ \escapechar=`\\
+ %
+ % ' is active in math mode (mathcode"8000). So reset it, and all our
+ % other math active characters (just in case), to plain's definitions.
+ \mathactive
+ %
+ \let\b=\ptexb
+ \let\bullet=\ptexbullet
+ \let\c=\ptexc
+ \let\,=\ptexcomma
+ \let\.=\ptexdot
+ \let\dots=\ptexdots
+ \let\equiv=\ptexequiv
+ \let\!=\ptexexclam
+ \let\i=\ptexi
+ \let\indent=\ptexindent
+ \let\noindent=\ptexnoindent
+ \let\{=\ptexlbrace
+ \let\+=\tabalign
+ \let\}=\ptexrbrace
+ \let\/=\ptexslash
+ \let\*=\ptexstar
+ \let\t=\ptext
+ \expandafter \let\csname top\endcsname=\ptextop % outer
+ \let\frenchspacing=\plainfrenchspacing
+ %
+ \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
+ \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
+ \def\@{@}%
+}
+% There is no need to define \Etex.
+
+% Define @lisp ... @end lisp.
+% @lisp environment forms a group so it can rebind things,
+% including the definition of @end lisp (which normally is erroneous).
+
+% Amount to narrow the margins by for @lisp.
+\newskip\lispnarrowing \lispnarrowing=0.4in
+
+% This is the definition that ^^M gets inside @lisp, @example, and other
+% such environments. \null is better than a space, since it doesn't
+% have any width.
+\def\lisppar{\null\endgraf}
+
+% This space is always present above and below environments.
+\newskip\envskipamount \envskipamount = 0pt
+
+% Make spacing and below environment symmetrical. We use \parskip here
+% to help in doing that, since in @example-like environments \parskip
+% is reset to zero; thus the \afterenvbreak inserts no space -- but the
+% start of the next paragraph will insert \parskip.
+%
+\def\aboveenvbreak{{%
+ % =10000 instead of <10000 because of a special case in \itemzzz and
+ % \sectionheading, q.v.
+ \ifnum \lastpenalty=10000 \else
+ \advance\envskipamount by \parskip
+ \endgraf
+ \ifdim\lastskip<\envskipamount
+ \removelastskip
+ % it's not a good place to break if the last penalty was \nobreak
+ % or better ...
+ \ifnum\lastpenalty<10000 \penalty-50 \fi
+ \vskip\envskipamount
+ \fi
+ \fi
+}}
+
+\let\afterenvbreak = \aboveenvbreak
+
+% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
+% also clear it, so that its embedded environments do the narrowing again.
+\let\nonarrowing=\relax
+
+% @cartouche ... @end cartouche: draw rectangle w/rounded corners around
+% environment contents.
+\font\circle=lcircle10
+\newdimen\circthick
+\newdimen\cartouter\newdimen\cartinner
+\newskip\normbskip\newskip\normpskip\newskip\normlskip
+\circthick=\fontdimen8\circle
+%
+\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
+\def\ctr{{\hskip 6pt\circle\char'010}}
+\def\cbl{{\circle\char'012\hskip -6pt}}
+\def\cbr{{\hskip 6pt\circle\char'011}}
+\def\carttop{\hbox to \cartouter{\hskip\lskip
+ \ctl\leaders\hrule height\circthick\hfil\ctr
+ \hskip\rskip}}
+\def\cartbot{\hbox to \cartouter{\hskip\lskip
+ \cbl\leaders\hrule height\circthick\hfil\cbr
+ \hskip\rskip}}
+%
+\newskip\lskip\newskip\rskip
+
+\envdef\cartouche{%
+ \ifhmode\par\fi % can't be in the midst of a paragraph.
+ \startsavinginserts
+ \lskip=\leftskip \rskip=\rightskip
+ \leftskip=0pt\rightskip=0pt % we want these *outside*.
+ \cartinner=\hsize \advance\cartinner by-\lskip
+ \advance\cartinner by-\rskip
+ \cartouter=\hsize
+ \advance\cartouter by 18.4pt % allow for 3pt kerns on either
+ % side, and for 6pt waste from
+ % each corner char, and rule thickness
+ \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
+ % Flag to tell @lisp, etc., not to narrow margin.
+ \let\nonarrowing = t%
+ %
+ % If this cartouche directly follows a sectioning command, we need the
+ % \parskip glue (backspaced over by default) or the cartouche can
+ % collide with the section heading.
+ \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
+ %
+ \vbox\bgroup
+ \baselineskip=0pt\parskip=0pt\lineskip=0pt
+ \carttop
+ \hbox\bgroup
+ \hskip\lskip
+ \vrule\kern3pt
+ \vbox\bgroup
+ \kern3pt
+ \hsize=\cartinner
+ \baselineskip=\normbskip
+ \lineskip=\normlskip
+ \parskip=\normpskip
+ \vskip -\parskip
+ \comment % For explanation, see the end of def\group.
+}
+\def\Ecartouche{%
+ \ifhmode\par\fi
+ \kern3pt
+ \egroup
+ \kern3pt\vrule
+ \hskip\rskip
+ \egroup
+ \cartbot
+ \egroup
+ \checkinserts
+}
+
+
+% This macro is called at the beginning of all the @example variants,
+% inside a group.
+\newdimen\nonfillparindent
+\def\nonfillstart{%
+ \aboveenvbreak
+ \hfuzz = 12pt % Don't be fussy
+ \sepspaces % Make spaces be word-separators rather than space tokens.
+ \let\par = \lisppar % don't ignore blank lines
+ \obeylines % each line of input is a line of output
+ \parskip = 0pt
+ % Turn off paragraph indentation but redefine \indent to emulate
+ % the normal \indent.
+ \nonfillparindent=\parindent
+ \parindent = 0pt
+ \let\indent\nonfillindent
+ %
+ \emergencystretch = 0pt % don't try to avoid overfull boxes
+ \ifx\nonarrowing\relax
+ \advance \leftskip by \lispnarrowing
+ \exdentamount=\lispnarrowing
+ \else
+ \let\nonarrowing = \relax
+ \fi
+ \let\exdent=\nofillexdent
+}
+
+\begingroup
+\obeyspaces
+% We want to swallow spaces (but not other tokens) after the fake
+% @indent in our nonfill-environments, where spaces are normally
+% active and set to @tie, resulting in them not being ignored after
+% @indent.
+\gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
+\gdef\nonfillindentcheck{%
+\ifx\temp %
+\expandafter\nonfillindentgobble%
+\else%
+\leavevmode\nonfillindentbox%
+\fi%
+}%
+\endgroup
+\def\nonfillindentgobble#1{\nonfillindent}
+\def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
+
+% If you want all examples etc. small: @set dispenvsize small.
+% If you want even small examples the full size: @set dispenvsize nosmall.
+% This affects the following displayed environments:
+% @example, @display, @format, @lisp
+%
+\def\smallword{small}
+\def\nosmallword{nosmall}
+\let\SETdispenvsize\relax
+\def\setnormaldispenv{%
+ \ifx\SETdispenvsize\smallword
+ % end paragraph for sake of leading, in case document has no blank
+ % line. This is redundant with what happens in \aboveenvbreak, but
+ % we need to do it before changing the fonts, and it's inconvenient
+ % to change the fonts afterward.
+ \ifnum \lastpenalty=10000 \else \endgraf \fi
+ \smallexamplefonts \rm
+ \fi
+}
+\def\setsmalldispenv{%
+ \ifx\SETdispenvsize\nosmallword
+ \else
+ \ifnum \lastpenalty=10000 \else \endgraf \fi
+ \smallexamplefonts \rm
+ \fi
+}
+
+% We often define two environments, @foo and @smallfoo.
+% Let's do it in one command. #1 is the env name, #2 the definition.
+\def\makedispenvdef#1#2{%
+ \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
+ \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
+ \expandafter\let\csname E#1\endcsname \afterenvbreak
+ \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
+}
+
+% Define two environment synonyms (#1 and #2) for an environment.
+\def\maketwodispenvdef#1#2#3{%
+ \makedispenvdef{#1}{#3}%
+ \makedispenvdef{#2}{#3}%
+}
+%
+% @lisp: indented, narrowed, typewriter font;
+% @example: same as @lisp.
+%
+% @smallexample and @smalllisp: use smaller fonts.
+% Originally contributed by Pavel@xerox.
+%
+\maketwodispenvdef{lisp}{example}{%
+ \nonfillstart
+ \tt\setupmarkupstyle{example}%
+ \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
+ \gobble % eat return
+}
+% @display/@smalldisplay: same as @lisp except keep current font.
+%
+\makedispenvdef{display}{%
+ \nonfillstart
+ \gobble
+}
+
+% @format/@smallformat: same as @display except don't narrow margins.
+%
+\makedispenvdef{format}{%
+ \let\nonarrowing = t%
+ \nonfillstart
+ \gobble
+}
+
+% @flushleft: same as @format, but doesn't obey \SETdispenvsize.
+\envdef\flushleft{%
+ \let\nonarrowing = t%
+ \nonfillstart
+ \gobble
+}
+\let\Eflushleft = \afterenvbreak
+
+% @flushright.
+%
+\envdef\flushright{%
+ \let\nonarrowing = t%
+ \nonfillstart
+ \advance\leftskip by 0pt plus 1fill\relax
+ \gobble
+}
+\let\Eflushright = \afterenvbreak
+
+
+% @raggedright does more-or-less normal line breaking but no right
+% justification. From plain.tex.
+\envdef\raggedright{%
+ \rightskip0pt plus2em \spaceskip.3333em \xspaceskip.5em\relax
+}
+\let\Eraggedright\par
+
+\envdef\raggedleft{%
+ \parindent=0pt \leftskip0pt plus2em
+ \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
+ \hbadness=10000 % Last line will usually be underfull, so turn off
+ % badness reporting.
+}
+\let\Eraggedleft\par
+
+\envdef\raggedcenter{%
+ \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
+ \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
+ \hbadness=10000 % Last line will usually be underfull, so turn off
+ % badness reporting.
+}
+\let\Eraggedcenter\par
+
+
+% @quotation does normal linebreaking (hence we can't use \nonfillstart)
+% and narrows the margins. We keep \parskip nonzero in general, since
+% we're doing normal filling. So, when using \aboveenvbreak and
+% \afterenvbreak, temporarily make \parskip 0.
+%
+\makedispenvdef{quotation}{\quotationstart}
+%
+\def\quotationstart{%
+ {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
+ \parindent=0pt
+ %
+ % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
+ \ifx\nonarrowing\relax
+ \advance\leftskip by \lispnarrowing
+ \advance\rightskip by \lispnarrowing
+ \exdentamount = \lispnarrowing
+ \else
+ \let\nonarrowing = \relax
+ \fi
+ \parsearg\quotationlabel
+}
+
+% We have retained a nonzero parskip for the environment, since we're
+% doing normal filling.
+%
+\def\Equotation{%
+ \par
+ \ifx\quotationauthor\thisisundefined\else
+ % indent a bit.
+ \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
+ \fi
+ {\parskip=0pt \afterenvbreak}%
+}
+\def\Esmallquotation{\Equotation}
+
+% If we're given an argument, typeset it in bold with a colon after.
+\def\quotationlabel#1{%
+ \def\temp{#1}%
+ \ifx\temp\empty \else
+ {\bf #1: }%
+ \fi
+}
+
+
+% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
+% If we want to allow any <char> as delimiter,
+% we need the curly braces so that makeinfo sees the @verb command, eg:
+% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
+%
+% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
+%
+% [Knuth] p.344; only we need to do the other characters Texinfo sets
+% active too. Otherwise, they get lost as the first character on a
+% verbatim line.
+\def\dospecials{%
+ \do\ \do\\\do\{\do\}\do\$\do\&%
+ \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
+ \do\<\do\>\do\|\do\@\do+\do\"%
+ % Don't do the quotes -- if we do, @set txicodequoteundirected and
+ % @set txicodequotebacktick will not have effect on @verb and
+ % @verbatim, and ?` and !` ligatures won't get disabled.
+ %\do\`\do\'%
+}
+%
+% [Knuth] p. 380
+\def\uncatcodespecials{%
+ \def\do##1{\catcode`##1=\other}\dospecials}
+%
+% Setup for the @verb command.
+%
+% Eight spaces for a tab
+\begingroup
+ \catcode`\^^I=\active
+ \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
+\endgroup
+%
+\def\setupverb{%
+ \tt % easiest (and conventionally used) font for verbatim
+ \def\par{\leavevmode\endgraf}%
+ \setupmarkupstyle{verb}%
+ \tabeightspaces
+ % Respect line breaks,
+ % print special symbols as themselves, and
+ % make each space count
+ % must do in this order:
+ \obeylines \uncatcodespecials \sepspaces
+}
+
+% Setup for the @verbatim environment
+%
+% Real tab expansion.
+\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
+%
+% We typeset each line of the verbatim in an \hbox, so we can handle
+% tabs. The \global is in case the verbatim line starts with an accent,
+% or some other command that starts with a begin-group. Otherwise, the
+% entire \verbbox would disappear at the corresponding end-group, before
+% it is typeset. Meanwhile, we can't have nested verbatim commands
+% (can we?), so the \global won't be overwriting itself.
+\newbox\verbbox
+\def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
+%
+\begingroup
+ \catcode`\^^I=\active
+ \gdef\tabexpand{%
+ \catcode`\^^I=\active
+ \def^^I{\leavevmode\egroup
+ \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
+ \divide\dimen\verbbox by\tabw
+ \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
+ \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
+ \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
+ }%
+ }
+\endgroup
+
+% start the verbatim environment.
+\def\setupverbatim{%
+ \let\nonarrowing = t%
+ \nonfillstart
+ \tt % easiest (and conventionally used) font for verbatim
+ % The \leavevmode here is for blank lines. Otherwise, we would
+ % never \starttabox and the \egroup would end verbatim mode.
+ \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
+ \tabexpand
+ \setupmarkupstyle{verbatim}%
+ % Respect line breaks,
+ % print special symbols as themselves, and
+ % make each space count.
+ % Must do in this order:
+ \obeylines \uncatcodespecials \sepspaces
+ \everypar{\starttabbox}%
+}
+
+% Do the @verb magic: verbatim text is quoted by unique
+% delimiter characters. Before first delimiter expect a
+% right brace, after last delimiter expect closing brace:
+%
+% \def\doverb'{'<char>#1<char>'}'{#1}
+%
+% [Knuth] p. 382; only eat outer {}
+\begingroup
+ \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
+ \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
+\endgroup
+%
+\def\verb{\begingroup\setupverb\doverb}
+%
+%
+% Do the @verbatim magic: define the macro \doverbatim so that
+% the (first) argument ends when '@end verbatim' is reached, ie:
+%
+% \def\doverbatim#1@end verbatim{#1}
+%
+% For Texinfo it's a lot easier than for LaTeX,
+% because texinfo's \verbatim doesn't stop at '\end{verbatim}':
+% we need not redefine '\', '{' and '}'.
+%
+% Inspired by LaTeX's verbatim command set [latex.ltx]
+%
+\begingroup
+ \catcode`\ =\active
+ \obeylines %
+ % ignore everything up to the first ^^M, that's the newline at the end
+ % of the @verbatim input line itself. Otherwise we get an extra blank
+ % line in the output.
+ \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
+ % We really want {...\end verbatim} in the body of the macro, but
+ % without the active space; thus we have to use \xdef and \gobble.
+\endgroup
+%
+\envdef\verbatim{%
+ \setupverbatim\doverbatim
+}
+\let\Everbatim = \afterenvbreak
+
+
+% @verbatiminclude FILE - insert text of file in verbatim environment.
+%
+\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
+%
+\def\doverbatiminclude#1{%
+ {%
+ \makevalueexpandable
+ \setupverbatim
+ \indexnofonts % Allow `@@' and other weird things in file names.
+ \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
+ \input #1
+ \afterenvbreak
+ }%
+}
+
+% @copying ... @end copying.
+% Save the text away for @insertcopying later.
+%
+% We save the uninterpreted tokens, rather than creating a box.
+% Saving the text in a box would be much easier, but then all the
+% typesetting commands (@smallbook, font changes, etc.) have to be done
+% beforehand -- and a) we want @copying to be done first in the source
+% file; b) letting users define the frontmatter in as flexible order as
+% possible is very desirable.
+%
+\def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
+\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
+%
+\def\insertcopying{%
+ \begingroup
+ \parindent = 0pt % paragraph indentation looks wrong on title page
+ \scanexp\copyingtext
+ \endgroup
+}
+
+
+\message{defuns,}
+% @defun etc.
+
+\newskip\defbodyindent \defbodyindent=.4in
+\newskip\defargsindent \defargsindent=50pt
+\newskip\deflastargmargin \deflastargmargin=18pt
+\newcount\defunpenalty
+
+% Start the processing of @deffn:
+\def\startdefun{%
+ \ifnum\lastpenalty<10000
+ \medbreak
+ \defunpenalty=10003 % Will keep this @deffn together with the
+ % following @def command, see below.
+ \else
+ % If there are two @def commands in a row, we'll have a \nobreak,
+ % which is there to keep the function description together with its
+ % header. But if there's nothing but headers, we need to allow a
+ % break somewhere. Check specifically for penalty 10002, inserted
+ % by \printdefunline, instead of 10000, since the sectioning
+ % commands also insert a nobreak penalty, and we don't want to allow
+ % a break between a section heading and a defun.
+ %
+ % As a further refinement, we avoid "club" headers by signalling
+ % with penalty of 10003 after the very first @deffn in the
+ % sequence (see above), and penalty of 10002 after any following
+ % @def command.
+ \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
+ %
+ % Similarly, after a section heading, do not allow a break.
+ % But do insert the glue.
+ \medskip % preceded by discardable penalty, so not a breakpoint
+ \fi
+ %
+ \parindent=0in
+ \advance\leftskip by \defbodyindent
+ \exdentamount=\defbodyindent
+}
+
+\def\dodefunx#1{%
+ % First, check whether we are in the right environment:
+ \checkenv#1%
+ %
+ % As above, allow line break if we have multiple x headers in a row.
+ % It's not a great place, though.
+ \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
+ %
+ % And now, it's time to reuse the body of the original defun:
+ \expandafter\gobbledefun#1%
+}
+\def\gobbledefun#1\startdefun{}
+
+% \printdefunline \deffnheader{text}
+%
+\def\printdefunline#1#2{%
+ \begingroup
+ % call \deffnheader:
+ #1#2 \endheader
+ % common ending:
+ \interlinepenalty = 10000
+ \advance\rightskip by 0pt plus 1fil\relax
+ \endgraf
+ \nobreak\vskip -\parskip
+ \penalty\defunpenalty % signal to \startdefun and \dodefunx
+ % Some of the @defun-type tags do not enable magic parentheses,
+ % rendering the following check redundant. But we don't optimize.
+ \checkparencounts
+ \endgroup
+}
+
+\def\Edefun{\endgraf\medbreak}
+
+% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
+% the only thing remaining is to define \deffnheader.
+%
+\def\makedefun#1{%
+ \expandafter\let\csname E#1\endcsname = \Edefun
+ \edef\temp{\noexpand\domakedefun
+ \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
+ \temp
+}
+
+% \domakedefun \deffn \deffnx \deffnheader
+%
+% Define \deffn and \deffnx, without parameters.
+% \deffnheader has to be defined explicitly.
+%
+\def\domakedefun#1#2#3{%
+ \envdef#1{%
+ \startdefun
+ \doingtypefnfalse % distinguish typed functions from all else
+ \parseargusing\activeparens{\printdefunline#3}%
+ }%
+ \def#2{\dodefunx#1}%
+ \def#3%
+}
+
+\newif\ifdoingtypefn % doing typed function?
+\newif\ifrettypeownline % typeset return type on its own line?
+
+% @deftypefnnewline on|off says whether the return type of typed functions
+% are printed on their own line. This affects @deftypefn, @deftypefun,
+% @deftypeop, and @deftypemethod.
+%
+\parseargdef\deftypefnnewline{%
+ \def\temp{#1}%
+ \ifx\temp\onword
+ \expandafter\let\csname SETtxideftypefnnl\endcsname
+ = \empty
+ \else\ifx\temp\offword
+ \expandafter\let\csname SETtxideftypefnnl\endcsname
+ = \relax
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @txideftypefnnl value `\temp',
+ must be on|off}%
+ \fi\fi
+}
+
+% Untyped functions:
+
+% @deffn category name args
+\makedefun{deffn}{\deffngeneral{}}
+
+% @deffn category class name args
+\makedefun{defop}#1 {\defopon{#1\ \putwordon}}
+
+% \defopon {category on}class name args
+\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
+
+% \deffngeneral {subind}category name args
+%
+\def\deffngeneral#1#2 #3 #4\endheader{%
+ % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
+ \dosubind{fn}{\code{#3}}{#1}%
+ \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
+}
+
+% Typed functions:
+
+% @deftypefn category type name args
+\makedefun{deftypefn}{\deftypefngeneral{}}
+
+% @deftypeop category class type name args
+\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
+
+% \deftypeopon {category on}class type name args
+\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
+
+% \deftypefngeneral {subind}category type name args
+%
+\def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
+ \dosubind{fn}{\code{#4}}{#1}%
+ \doingtypefntrue
+ \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
+}
+
+% Typed variables:
+
+% @deftypevr category type var args
+\makedefun{deftypevr}{\deftypecvgeneral{}}
+
+% @deftypecv category class type var args
+\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
+
+% \deftypecvof {category of}class type var args
+\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
+
+% \deftypecvgeneral {subind}category type var args
+%
+\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
+ \dosubind{vr}{\code{#4}}{#1}%
+ \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
+}
+
+% Untyped variables:
+
+% @defvr category var args
+\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
+
+% @defcv category class var args
+\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
+
+% \defcvof {category of}class var args
+\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
+
+% Types:
+
+% @deftp category name args
+\makedefun{deftp}#1 #2 #3\endheader{%
+ \doind{tp}{\code{#2}}%
+ \defname{#1}{}{#2}\defunargs{#3\unskip}%
+}
+
+% Remaining @defun-like shortcuts:
+\makedefun{defun}{\deffnheader{\putwordDeffunc} }
+\makedefun{defmac}{\deffnheader{\putwordDefmac} }
+\makedefun{defspec}{\deffnheader{\putwordDefspec} }
+\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
+\makedefun{defvar}{\defvrheader{\putwordDefvar} }
+\makedefun{defopt}{\defvrheader{\putwordDefopt} }
+\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
+\makedefun{defmethod}{\defopon\putwordMethodon}
+\makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
+\makedefun{defivar}{\defcvof\putwordInstanceVariableof}
+\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
+
+% \defname, which formats the name of the @def (not the args).
+% #1 is the category, such as "Function".
+% #2 is the return type, if any.
+% #3 is the function name.
+%
+% We are followed by (but not passed) the arguments, if any.
+%
+\def\defname#1#2#3{%
+ \par
+ % Get the values of \leftskip and \rightskip as they were outside the @def...
+ \advance\leftskip by -\defbodyindent
+ %
+ % Determine if we are typesetting the return type of a typed function
+ % on a line by itself.
+ \rettypeownlinefalse
+ \ifdoingtypefn % doing a typed function specifically?
+ % then check user option for putting return type on its own line:
+ \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
+ \rettypeownlinetrue
+ \fi
+ \fi
+ %
+ % How we'll format the category name. Putting it in brackets helps
+ % distinguish it from the body text that may end up on the next line
+ % just below it.
+ \def\temp{#1}%
+ \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
+ %
+ % Figure out line sizes for the paragraph shape. We'll always have at
+ % least two.
+ \tempnum = 2
+ %
+ % The first line needs space for \box0; but if \rightskip is nonzero,
+ % we need only space for the part of \box0 which exceeds it:
+ \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
+ %
+ % If doing a return type on its own line, we'll have another line.
+ \ifrettypeownline
+ \advance\tempnum by 1
+ \def\maybeshapeline{0in \hsize}%
+ \else
+ \def\maybeshapeline{}%
+ \fi
+ %
+ % The continuations:
+ \dimen2=\hsize \advance\dimen2 by -\defargsindent
+ %
+ % The final paragraph shape:
+ \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
+ %
+ % Put the category name at the right margin.
+ \noindent
+ \hbox to 0pt{%
+ \hfil\box0 \kern-\hsize
+ % \hsize has to be shortened this way:
+ \kern\leftskip
+ % Intentionally do not respect \rightskip, since we need the space.
+ }%
+ %
+ % Allow all lines to be underfull without complaint:
+ \tolerance=10000 \hbadness=10000
+ \exdentamount=\defbodyindent
+ {%
+ % defun fonts. We use typewriter by default (used to be bold) because:
+ % . we're printing identifiers, they should be in tt in principle.
+ % . in languages with many accents, such as Czech or French, it's
+ % common to leave accents off identifiers. The result looks ok in
+ % tt, but exceedingly strange in rm.
+ % . we don't want -- and --- to be treated as ligatures.
+ % . this still does not fix the ?` and !` ligatures, but so far no
+ % one has made identifiers using them :).
+ \df \tt
+ \def\temp{#2}% text of the return type
+ \ifx\temp\empty\else
+ \tclose{\temp}% typeset the return type
+ \ifrettypeownline
+ % put return type on its own line; prohibit line break following:
+ \hfil\vadjust{\nobreak}\break
+ \else
+ \space % type on same line, so just followed by a space
+ \fi
+ \fi % no return type
+ #3% output function name
+ }%
+ {\rm\enskip}% hskip 0.5 em of \tenrm
+ %
+ \boldbrax
+ % arguments will be output next, if any.
+}
+
+% Print arguments in slanted roman (not ttsl), inconsistently with using
+% tt for the name. This is because literal text is sometimes needed in
+% the argument list (groff manual), and ttsl and tt are not very
+% distinguishable. Prevent hyphenation at `-' chars.
+%
+\def\defunargs#1{%
+ % use sl by default (not ttsl),
+ % tt for the names.
+ \df \sl \hyphenchar\font=0
+ %
+ % On the other hand, if an argument has two dashes (for instance), we
+ % want a way to get ttsl. Let's try @var for that.
+ \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
+ #1%
+ \sl\hyphenchar\font=45
+}
+
+% We want ()&[] to print specially on the defun line.
+%
+\def\activeparens{%
+ \catcode`\(=\active \catcode`\)=\active
+ \catcode`\[=\active \catcode`\]=\active
+ \catcode`\&=\active
+}
+
+% Make control sequences which act like normal parenthesis chars.
+\let\lparen = ( \let\rparen = )
+
+% Be sure that we always have a definition for `(', etc. For example,
+% if the fn name has parens in it, \boldbrax will not be in effect yet,
+% so TeX would otherwise complain about undefined control sequence.
+{
+ \activeparens
+ \global\let(=\lparen \global\let)=\rparen
+ \global\let[=\lbrack \global\let]=\rbrack
+ \global\let& = \&
+
+ \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
+ \gdef\magicamp{\let&=\amprm}
+}
+
+\newcount\parencount
+
+% If we encounter &foo, then turn on ()-hacking afterwards
+\newif\ifampseen
+\def\amprm#1 {\ampseentrue{\bf\&#1 }}
+
+\def\parenfont{%
+ \ifampseen
+ % At the first level, print parens in roman,
+ % otherwise use the default font.
+ \ifnum \parencount=1 \rm \fi
+ \else
+ % The \sf parens (in \boldbrax) actually are a little bolder than
+ % the contained text. This is especially needed for [ and ] .
+ \sf
+ \fi
+}
+\def\infirstlevel#1{%
+ \ifampseen
+ \ifnum\parencount=1
+ #1%
+ \fi
+ \fi
+}
+\def\bfafterword#1 {#1 \bf}
+
+\def\opnr{%
+ \global\advance\parencount by 1
+ {\parenfont(}%
+ \infirstlevel \bfafterword
+}
+\def\clnr{%
+ {\parenfont)}%
+ \infirstlevel \sl
+ \global\advance\parencount by -1
+}
+
+\newcount\brackcount
+\def\lbrb{%
+ \global\advance\brackcount by 1
+ {\bf[}%
+}
+\def\rbrb{%
+ {\bf]}%
+ \global\advance\brackcount by -1
+}
+
+\def\checkparencounts{%
+ \ifnum\parencount=0 \else \badparencount \fi
+ \ifnum\brackcount=0 \else \badbrackcount \fi
+}
+% these should not use \errmessage; the glibc manual, at least, actually
+% has such constructs (when documenting function pointers).
+\def\badparencount{%
+ \message{Warning: unbalanced parentheses in @def...}%
+ \global\parencount=0
+}
+\def\badbrackcount{%
+ \message{Warning: unbalanced square brackets in @def...}%
+ \global\brackcount=0
+}
+
+
+\message{macros,}
+% @macro.
+
+% To do this right we need a feature of e-TeX, \scantokens,
+% which we arrange to emulate with a temporary file in ordinary TeX.
+\ifx\eTeXversion\thisisundefined
+ \newwrite\macscribble
+ \def\scantokens#1{%
+ \toks0={#1}%
+ \immediate\openout\macscribble=\jobname.tmp
+ \immediate\write\macscribble{\the\toks0}%
+ \immediate\closeout\macscribble
+ \input \jobname.tmp
+ }
+\fi
+
+\def\scanmacro#1{\begingroup
+ \newlinechar`\^^M
+ \let\xeatspaces\eatspaces
+ %
+ % Undo catcode changes of \startcontents and \doprintindex
+ % When called from @insertcopying or (short)caption, we need active
+ % backslash to get it printed correctly. Previously, we had
+ % \catcode`\\=\other instead. We'll see whether a problem appears
+ % with macro expansion. --kasal, 19aug04
+ \catcode`\@=0 \catcode`\\=\active \escapechar=`\@
+ %
+ % ... and for \example:
+ \spaceisspace
+ %
+ % The \empty here causes a following catcode 5 newline to be eaten as
+ % part of reading whitespace after a control sequence. It does not
+ % eat a catcode 13 newline. There's no good way to handle the two
+ % cases (untried: maybe e-TeX's \everyeof could help, though plain TeX
+ % would then have different behavior). See the Macro Details node in
+ % the manual for the workaround we recommend for macros and
+ % line-oriented commands.
+ %
+ \scantokens{#1\empty}%
+\endgroup}
+
+\def\scanexp#1{%
+ \edef\temp{\noexpand\scanmacro{#1}}%
+ \temp
+}
+
+\newcount\paramno % Count of parameters
+\newtoks\macname % Macro name
+\newif\ifrecursive % Is it recursive?
+
+% List of all defined macros in the form
+% \definedummyword\macro1\definedummyword\macro2...
+% Currently is also contains all @aliases; the list can be split
+% if there is a need.
+\def\macrolist{}
+
+% Add the macro to \macrolist
+\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
+\def\addtomacrolistxxx#1{%
+ \toks0 = \expandafter{\macrolist\definedummyword#1}%
+ \xdef\macrolist{\the\toks0}%
+}
+
+% Utility routines.
+% This does \let #1 = #2, with \csnames; that is,
+% \let \csname#1\endcsname = \csname#2\endcsname
+% (except of course we have to play expansion games).
+%
+\def\cslet#1#2{%
+ \expandafter\let
+ \csname#1\expandafter\endcsname
+ \csname#2\endcsname
+}
+
+% Trim leading and trailing spaces off a string.
+% Concepts from aro-bend problem 15 (see CTAN).
+{\catcode`\@=11
+\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
+\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
+\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
+\def\unbrace#1{#1}
+\unbrace{\gdef\trim@@@ #1 } #2@{#1}
+}
+
+% Trim a single trailing ^^M off a string.
+{\catcode`\^^M=\other \catcode`\Q=3%
+\gdef\eatcr #1{\eatcra #1Q^^MQ}%
+\gdef\eatcra#1^^MQ{\eatcrb#1Q}%
+\gdef\eatcrb#1Q#2Q{#1}%
+}
+
+% Macro bodies are absorbed as an argument in a context where
+% all characters are catcode 10, 11 or 12, except \ which is active
+% (as in normal texinfo). It is necessary to change the definition of \
+% to recognize macro arguments; this is the job of \mbodybackslash.
+%
+% Non-ASCII encodings make 8-bit characters active, so un-activate
+% them to avoid their expansion. Must do this non-globally, to
+% confine the change to the current group.
+%
+% It's necessary to have hard CRs when the macro is executed. This is
+% done by making ^^M (\endlinechar) catcode 12 when reading the macro
+% body, and then making it the \newlinechar in \scanmacro.
+%
+\def\scanctxt{% used as subroutine
+ \catcode`\"=\other
+ \catcode`\+=\other
+ \catcode`\<=\other
+ \catcode`\>=\other
+ \catcode`\@=\other
+ \catcode`\^=\other
+ \catcode`\_=\other
+ \catcode`\|=\other
+ \catcode`\~=\other
+ \ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
+}
+
+\def\scanargctxt{% used for copying and captions, not macros.
+ \scanctxt
+ \catcode`\\=\other
+ \catcode`\^^M=\other
+}
+
+\def\macrobodyctxt{% used for @macro definitions
+ \scanctxt
+ \catcode`\{=\other
+ \catcode`\}=\other
+ \catcode`\^^M=\other
+ \usembodybackslash
+}
+
+\def\macroargctxt{% used when scanning invocations
+ \scanctxt
+ \catcode`\\=0
+}
+% why catcode 0 for \ in the above? To recognize \\ \{ \} as "escapes"
+% for the single characters \ { }. Thus, we end up with the "commands"
+% that would be written @\ @{ @} in a Texinfo document.
+%
+% We already have @{ and @}. For @\, we define it here, and only for
+% this purpose, to produce a typewriter backslash (so, the @\ that we
+% define for @math can't be used with @macro calls):
+%
+\def\\{\normalbackslash}%
+%
+% We would like to do this for \, too, since that is what makeinfo does.
+% But it is not possible, because Texinfo already has a command @, for a
+% cedilla accent. Documents must use @comma{} instead.
+%
+% \anythingelse will almost certainly be an error of some kind.
+
+
+% \mbodybackslash is the definition of \ in @macro bodies.
+% It maps \foo\ => \csname macarg.foo\endcsname => #N
+% where N is the macro parameter number.
+% We define \csname macarg.\endcsname to be \realbackslash, so
+% \\ in macro replacement text gets you a backslash.
+%
+{\catcode`@=0 @catcode`@\=@active
+ @gdef@usembodybackslash{@let\=@mbodybackslash}
+ @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
+}
+\expandafter\def\csname macarg.\endcsname{\realbackslash}
+
+\def\margbackslash#1{\char`\#1 }
+
+\def\macro{\recursivefalse\parsearg\macroxxx}
+\def\rmacro{\recursivetrue\parsearg\macroxxx}
+
+\def\macroxxx#1{%
+ \getargs{#1}% now \macname is the macname and \argl the arglist
+ \ifx\argl\empty % no arguments
+ \paramno=0\relax
+ \else
+ \expandafter\parsemargdef \argl;%
+ \if\paramno>256\relax
+ \ifx\eTeXversion\thisisundefined
+ \errhelp = \EMsimple
+ \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
+ \fi
+ \fi
+ \fi
+ \if1\csname ismacro.\the\macname\endcsname
+ \message{Warning: redefining \the\macname}%
+ \else
+ \expandafter\ifx\csname \the\macname\endcsname \relax
+ \else \errmessage{Macro name \the\macname\space already defined}\fi
+ \global\cslet{macsave.\the\macname}{\the\macname}%
+ \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
+ \addtomacrolist{\the\macname}%
+ \fi
+ \begingroup \macrobodyctxt
+ \ifrecursive \expandafter\parsermacbody
+ \else \expandafter\parsemacbody
+ \fi}
+
+\parseargdef\unmacro{%
+ \if1\csname ismacro.#1\endcsname
+ \global\cslet{#1}{macsave.#1}%
+ \global\expandafter\let \csname ismacro.#1\endcsname=0%
+ % Remove the macro name from \macrolist:
+ \begingroup
+ \expandafter\let\csname#1\endcsname \relax
+ \let\definedummyword\unmacrodo
+ \xdef\macrolist{\macrolist}%
+ \endgroup
+ \else
+ \errmessage{Macro #1 not defined}%
+ \fi
+}
+
+% Called by \do from \dounmacro on each macro. The idea is to omit any
+% macro definitions that have been changed to \relax.
+%
+\def\unmacrodo#1{%
+ \ifx #1\relax
+ % remove this
+ \else
+ \noexpand\definedummyword \noexpand#1%
+ \fi
+}
+
+% This makes use of the obscure feature that if the last token of a
+% <parameter list> is #, then the preceding argument is delimited by
+% an opening brace, and that opening brace is not consumed.
+\def\getargs#1{\getargsxxx#1{}}
+\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
+\def\getmacname#1 #2\relax{\macname={#1}}
+\def\getmacargs#1{\def\argl{#1}}
+
+% For macro processing make @ a letter so that we can make Texinfo private macro names.
+\edef\texiatcatcode{\the\catcode`\@}
+\catcode `@=11\relax
+
+% Parse the optional {params} list. Set up \paramno and \paramlist
+% so \defmacro knows what to do. Define \macarg.BLAH for each BLAH
+% in the params list to some hook where the argument si to be expanded. If
+% there are less than 10 arguments that hook is to be replaced by ##N where N
+% is the position in that list, that is to say the macro arguments are to be
+% defined `a la TeX in the macro body.
+%
+% That gets used by \mbodybackslash (above).
+%
+% We need to get `macro parameter char #' into several definitions.
+% The technique used is stolen from LaTeX: let \hash be something
+% unexpandable, insert that wherever you need a #, and then redefine
+% it to # just before using the token list produced.
+%
+% The same technique is used to protect \eatspaces till just before
+% the macro is used.
+%
+% If there are 10 or more arguments, a different technique is used, where the
+% hook remains in the body, and when macro is to be expanded the body is
+% processed again to replace the arguments.
+%
+% In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
+% argument N value and then \edef the body (nothing else will expand because of
+% the catcode regime underwhich the body was input).
+%
+% If you compile with TeX (not eTeX), and you have macros with 10 or more
+% arguments, you need that no macro has more than 256 arguments, otherwise an
+% error is produced.
+\def\parsemargdef#1;{%
+ \paramno=0\def\paramlist{}%
+ \let\hash\relax
+ \let\xeatspaces\relax
+ \parsemargdefxxx#1,;,%
+ % In case that there are 10 or more arguments we parse again the arguments
+ % list to set new definitions for the \macarg.BLAH macros corresponding to
+ % each BLAH argument. It was anyhow needed to parse already once this list
+ % in order to count the arguments, and as macros with at most 9 arguments
+ % are by far more frequent than macro with 10 or more arguments, defining
+ % twice the \macarg.BLAH macros does not cost too much processing power.
+ \ifnum\paramno<10\relax\else
+ \paramno0\relax
+ \parsemmanyargdef@@#1,;,% 10 or more arguments
+ \fi
+}
+\def\parsemargdefxxx#1,{%
+ \if#1;\let\next=\relax
+ \else \let\next=\parsemargdefxxx
+ \advance\paramno by 1
+ \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
+ {\xeatspaces{\hash\the\paramno}}%
+ \edef\paramlist{\paramlist\hash\the\paramno,}%
+ \fi\next}
+
+\def\parsemmanyargdef@@#1,{%
+ \if#1;\let\next=\relax
+ \else
+ \let\next=\parsemmanyargdef@@
+ \edef\tempb{\eatspaces{#1}}%
+ \expandafter\def\expandafter\tempa
+ \expandafter{\csname macarg.\tempb\endcsname}%
+ % Note that we need some extra \noexpand\noexpand, this is because we
+ % don't want \the to be expanded in the \parsermacbody as it uses an
+ % \xdef .
+ \expandafter\edef\tempa
+ {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
+ \advance\paramno by 1\relax
+ \fi\next}
+
+% These two commands read recursive and nonrecursive macro bodies.
+% (They're different since rec and nonrec macros end differently.)
+%
+
+\catcode `\@\texiatcatcode
+\long\def\parsemacbody#1@end macro%
+{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
+\long\def\parsermacbody#1@end rmacro%
+{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
+\catcode `\@=11\relax
+
+\let\endargs@\relax
+\let\nil@\relax
+\def\nilm@{\nil@}%
+\long\def\nillm@{\nil@}%
+
+% This macro is expanded during the Texinfo macro expansion, not during its
+% definition. It gets all the arguments values and assigns them to macros
+% macarg.ARGNAME
+%
+% #1 is the macro name
+% #2 is the list of argument names
+% #3 is the list of argument values
+\def\getargvals@#1#2#3{%
+ \def\macargdeflist@{}%
+ \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
+ \def\paramlist{#2,\nil@}%
+ \def\macroname{#1}%
+ \begingroup
+ \macroargctxt
+ \def\argvaluelist{#3,\nil@}%
+ \def\@tempa{#3}%
+ \ifx\@tempa\empty
+ \setemptyargvalues@
+ \else
+ \getargvals@@
+ \fi
+}
+
+%
+\def\getargvals@@{%
+ \ifx\paramlist\nilm@
+ % Some sanity check needed here that \argvaluelist is also empty.
+ \ifx\argvaluelist\nillm@
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Too many arguments in macro `\macroname'!}%
+ \fi
+ \let\next\macargexpandinbody@
+ \else
+ \ifx\argvaluelist\nillm@
+ % No more arguments values passed to macro. Set remaining named-arg
+ % macros to empty.
+ \let\next\setemptyargvalues@
+ \else
+ % pop current arg name into \@tempb
+ \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
+ \expandafter\@tempa\expandafter{\paramlist}%
+ % pop current argument value into \@tempc
+ \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
+ \expandafter\@tempa\expandafter{\argvaluelist}%
+ % Here \@tempb is the current arg name and \@tempc is the current arg value.
+ % First place the new argument macro definition into \@tempd
+ \expandafter\macname\expandafter{\@tempc}%
+ \expandafter\let\csname macarg.\@tempb\endcsname\relax
+ \expandafter\def\expandafter\@tempe\expandafter{%
+ \csname macarg.\@tempb\endcsname}%
+ \edef\@tempd{\long\def\@tempe{\the\macname}}%
+ \push@\@tempd\macargdeflist@
+ \let\next\getargvals@@
+ \fi
+ \fi
+ \next
+}
+
+\def\push@#1#2{%
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter#2%
+ \expandafter\expandafter\expandafter{%
+ \expandafter#1#2}%
+}
+
+% Replace arguments by their values in the macro body, and place the result
+% in macro \@tempa
+\def\macvalstoargs@{%
+ % To do this we use the property that token registers that are \the'ed
+ % within an \edef expand only once. So we are going to place all argument
+ % values into respective token registers.
+ %
+ % First we save the token context, and initialize argument numbering.
+ \begingroup
+ \paramno0\relax
+ % Then, for each argument number #N, we place the corresponding argument
+ % value into a new token list register \toks#N
+ \expandafter\putargsintokens@\saveparamlist@,;,%
+ % Then, we expand the body so that argument are replaced by their
+ % values. The trick for values not to be expanded themselves is that they
+ % are within tokens and that tokens expand only once in an \edef .
+ \edef\@tempc{\csname mac.\macroname .body\endcsname}%
+ % Now we restore the token stack pointer to free the token list registers
+ % which we have used, but we make sure that expanded body is saved after
+ % group.
+ \expandafter
+ \endgroup
+ \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
+ }
+
+\def\macargexpandinbody@{%
+ %% Define the named-macro outside of this group and then close this group.
+ \expandafter
+ \endgroup
+ \macargdeflist@
+ % First the replace in body the macro arguments by their values, the result
+ % is in \@tempa .
+ \macvalstoargs@
+ % Then we point at the \norecurse or \gobble (for recursive) macro value
+ % with \@tempb .
+ \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
+ % Depending on whether it is recursive or not, we need some tailing
+ % \egroup .
+ \ifx\@tempb\gobble
+ \let\@tempc\relax
+ \else
+ \let\@tempc\egroup
+ \fi
+ % And now we do the real job:
+ \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
+ \@tempd
+}
+
+\def\putargsintokens@#1,{%
+ \if#1;\let\next\relax
+ \else
+ \let\next\putargsintokens@
+ % First we allocate the new token list register, and give it a temporary
+ % alias \@tempb .
+ \toksdef\@tempb\the\paramno
+ % Then we place the argument value into that token list register.
+ \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
+ \expandafter\@tempb\expandafter{\@tempa}%
+ \advance\paramno by 1\relax
+ \fi
+ \next
+}
+
+% Save the token stack pointer into macro #1
+\def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}}
+% Restore the token stack pointer from number in macro #1
+\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax}
+% newtoks that can be used non \outer .
+\def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi}
+
+% Tailing missing arguments are set to empty
+\def\setemptyargvalues@{%
+ \ifx\paramlist\nilm@
+ \let\next\macargexpandinbody@
+ \else
+ \expandafter\setemptyargvaluesparser@\paramlist\endargs@
+ \let\next\setemptyargvalues@
+ \fi
+ \next
+}
+
+\def\setemptyargvaluesparser@#1,#2\endargs@{%
+ \expandafter\def\expandafter\@tempa\expandafter{%
+ \expandafter\def\csname macarg.#1\endcsname{}}%
+ \push@\@tempa\macargdeflist@
+ \def\paramlist{#2}%
+}
+
+% #1 is the element target macro
+% #2 is the list macro
+% #3,#4\endargs@ is the list value
+\def\pop@#1#2#3,#4\endargs@{%
+ \def#1{#3}%
+ \def#2{#4}%
+}
+\long\def\longpop@#1#2#3,#4\endargs@{%
+ \long\def#1{#3}%
+ \long\def#2{#4}%
+}
+
+% This defines a Texinfo @macro. There are eight cases: recursive and
+% nonrecursive macros of zero, one, up to nine, and many arguments.
+% Much magic with \expandafter here.
+% \xdef is used so that macro definitions will survive the file
+% they're defined in; @include reads the file inside a group.
+%
+\def\defmacro{%
+ \let\hash=##% convert placeholders to macro parameter chars
+ \ifrecursive
+ \ifcase\paramno
+ % 0
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \noexpand\scanmacro{\temp}}%
+ \or % 1
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \bgroup\noexpand\macroargctxt
+ \noexpand\braceorline
+ \expandafter\noexpand\csname\the\macname xxx\endcsname}%
+ \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
+ \egroup\noexpand\scanmacro{\temp}}%
+ \else
+ \ifnum\paramno<10\relax % at most 9
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \bgroup\noexpand\macroargctxt
+ \noexpand\csname\the\macname xx\endcsname}%
+ \expandafter\xdef\csname\the\macname xx\endcsname##1{%
+ \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
+ \expandafter\expandafter
+ \expandafter\xdef
+ \expandafter\expandafter
+ \csname\the\macname xxx\endcsname
+ \paramlist{\egroup\noexpand\scanmacro{\temp}}%
+ \else % 10 or more
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \noexpand\getargvals@{\the\macname}{\argl}%
+ }%
+ \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
+ \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
+ \fi
+ \fi
+ \else
+ \ifcase\paramno
+ % 0
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \noexpand\norecurse{\the\macname}%
+ \noexpand\scanmacro{\temp}\egroup}%
+ \or % 1
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \bgroup\noexpand\macroargctxt
+ \noexpand\braceorline
+ \expandafter\noexpand\csname\the\macname xxx\endcsname}%
+ \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
+ \egroup
+ \noexpand\norecurse{\the\macname}%
+ \noexpand\scanmacro{\temp}\egroup}%
+ \else % at most 9
+ \ifnum\paramno<10\relax
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \bgroup\noexpand\macroargctxt
+ \expandafter\noexpand\csname\the\macname xx\endcsname}%
+ \expandafter\xdef\csname\the\macname xx\endcsname##1{%
+ \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
+ \expandafter\expandafter
+ \expandafter\xdef
+ \expandafter\expandafter
+ \csname\the\macname xxx\endcsname
+ \paramlist{%
+ \egroup
+ \noexpand\norecurse{\the\macname}%
+ \noexpand\scanmacro{\temp}\egroup}%
+ \else % 10 or more:
+ \expandafter\xdef\csname\the\macname\endcsname{%
+ \noexpand\getargvals@{\the\macname}{\argl}%
+ }%
+ \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp
+ \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse
+ \fi
+ \fi
+ \fi}
+
+\catcode `\@\texiatcatcode\relax
+
+\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
+
+% \braceorline decides whether the next nonwhitespace character is a
+% {. If so it reads up to the closing }, if not, it reads the whole
+% line. Whatever was read is then fed to the next control sequence
+% as an argument (by \parsebrace or \parsearg).
+%
+\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
+\def\braceorlinexxx{%
+ \ifx\nchar\bgroup\else
+ \expandafter\parsearg
+ \fi \macnamexxx}
+
+
+% @alias.
+% We need some trickery to remove the optional spaces around the equal
+% sign. Make them active and then expand them all to nothing.
+%
+\def\alias{\parseargusing\obeyspaces\aliasxxx}
+\def\aliasxxx #1{\aliasyyy#1\relax}
+\def\aliasyyy #1=#2\relax{%
+ {%
+ \expandafter\let\obeyedspace=\empty
+ \addtomacrolist{#1}%
+ \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
+ }%
+ \next
+}
+
+
+\message{cross references,}
+
+\newwrite\auxfile
+\newif\ifhavexrefs % True if xref values are known.
+\newif\ifwarnedxrefs % True if we warned once that they aren't known.
+
+% @inforef is relatively simple.
+\def\inforef #1{\inforefzzz #1,,,,**}
+\def\inforefzzz #1,#2,#3,#4**{%
+ \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
+ node \samp{\ignorespaces#1{}}}
+
+% @node's only job in TeX is to define \lastnode, which is used in
+% cross-references. The @node line might or might not have commas, and
+% might or might not have spaces before the first comma, like:
+% @node foo , bar , ...
+% We don't want such trailing spaces in the node name.
+%
+\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
+%
+% also remove a trailing comma, in case of something like this:
+% @node Help-Cross, , , Cross-refs
+\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
+\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
+
+\let\nwnode=\node
+\let\lastnode=\empty
+
+% Write a cross-reference definition for the current node. #1 is the
+% type (Ynumbered, Yappendix, Ynothing).
+%
+\def\donoderef#1{%
+ \ifx\lastnode\empty\else
+ \setref{\lastnode}{#1}%
+ \global\let\lastnode=\empty
+ \fi
+}
+
+% @anchor{NAME} -- define xref target at arbitrary point.
+%
+\newcount\savesfregister
+%
+\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
+\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
+\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
+
+% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
+% anchor), which consists of three parts:
+% 1) NAME-title - the current sectioning name taken from \lastsection,
+% or the anchor name.
+% 2) NAME-snt - section number and type, passed as the SNT arg, or
+% empty for anchors.
+% 3) NAME-pg - the page number.
+%
+% This is called from \donoderef, \anchor, and \dofloat. In the case of
+% floats, there is an additional part, which is not written here:
+% 4) NAME-lof - the text as it should appear in a @listoffloats.
+%
+\def\setref#1#2{%
+ \pdfmkdest{#1}%
+ \iflinks
+ {%
+ \atdummies % preserve commands, but don't expand them
+ \edef\writexrdef##1##2{%
+ \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
+ ##1}{##2}}% these are parameters of \writexrdef
+ }%
+ \toks0 = \expandafter{\lastsection}%
+ \immediate \writexrdef{title}{\the\toks0 }%
+ \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
+ \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
+ }%
+ \fi
+}
+
+% @xrefautosectiontitle on|off says whether @section(ing) names are used
+% automatically in xrefs, if the third arg is not explicitly specified.
+% This was provided as a "secret" @set xref-automatic-section-title
+% variable, now it's official.
+%
+\parseargdef\xrefautomaticsectiontitle{%
+ \def\temp{#1}%
+ \ifx\temp\onword
+ \expandafter\let\csname SETxref-automatic-section-title\endcsname
+ = \empty
+ \else\ifx\temp\offword
+ \expandafter\let\csname SETxref-automatic-section-title\endcsname
+ = \relax
+ \else
+ \errhelp = \EMsimple
+ \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
+ must be on|off}%
+ \fi\fi
+}
+
+%
+% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
+% the node name, #2 the name of the Info cross-reference, #3 the printed
+% node name, #4 the name of the Info file, #5 the name of the printed
+% manual. All but the node name can be omitted.
+%
+\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
+\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
+\def\ref#1{\xrefX[#1,,,,,,,]}
+%
+\newbox\toprefbox
+\newbox\printedrefnamebox
+\newbox\infofilenamebox
+\newbox\printedmanualbox
+%
+\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
+ \unsepspaces
+ %
+ % Get args without leading/trailing spaces.
+ \def\printedrefname{\ignorespaces #3}%
+ \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
+ %
+ \def\infofilename{\ignorespaces #4}%
+ \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
+ %
+ \def\printedmanual{\ignorespaces #5}%
+ \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
+ %
+ % If the printed reference name (arg #3) was not explicitly given in
+ % the @xref, figure out what we want to use.
+ \ifdim \wd\printedrefnamebox = 0pt
+ % No printed node name was explicitly given.
+ \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
+ % Not auto section-title: use node name inside the square brackets.
+ \def\printedrefname{\ignorespaces #1}%
+ \else
+ % Auto section-title: use chapter/section title inside
+ % the square brackets if we have it.
+ \ifdim \wd\printedmanualbox > 0pt
+ % It is in another manual, so we don't have it; use node name.
+ \def\printedrefname{\ignorespaces #1}%
+ \else
+ \ifhavexrefs
+ % We (should) know the real title if we have the xref values.
+ \def\printedrefname{\refx{#1-title}{}}%
+ \else
+ % Otherwise just copy the Info node name.
+ \def\printedrefname{\ignorespaces #1}%
+ \fi%
+ \fi
+ \fi
+ \fi
+ %
+ % Make link in pdf output.
+ \ifpdf
+ {\indexnofonts
+ \turnoffactive
+ \makevalueexpandable
+ % This expands tokens, so do it after making catcode changes, so _
+ % etc. don't get their TeX definitions. This ignores all spaces in
+ % #4, including (wrongly) those in the middle of the filename.
+ \getfilename{#4}%
+ %
+ % This (wrongly) does not take account of leading or trailing
+ % spaces in #1, which should be ignored.
+ \edef\pdfxrefdest{#1}%
+ \ifx\pdfxrefdest\empty
+ \def\pdfxrefdest{Top}% no empty targets
+ \else
+ \txiescapepdf\pdfxrefdest % escape PDF special chars
+ \fi
+ %
+ \leavevmode
+ \startlink attr{/Border [0 0 0]}%
+ \ifnum\filenamelength>0
+ goto file{\the\filename.pdf} name{\pdfxrefdest}%
+ \else
+ goto name{\pdfmkpgn{\pdfxrefdest}}%
+ \fi
+ }%
+ \setcolor{\linkcolor}%
+ \fi
+ %
+ % Float references are printed completely differently: "Figure 1.2"
+ % instead of "[somenode], p.3". We distinguish them by the
+ % LABEL-title being set to a magic string.
+ {%
+ % Have to otherify everything special to allow the \csname to
+ % include an _ in the xref name, etc.
+ \indexnofonts
+ \turnoffactive
+ \expandafter\global\expandafter\let\expandafter\Xthisreftitle
+ \csname XR#1-title\endcsname
+ }%
+ \iffloat\Xthisreftitle
+ % If the user specified the print name (third arg) to the ref,
+ % print it instead of our usual "Figure 1.2".
+ \ifdim\wd\printedrefnamebox = 0pt
+ \refx{#1-snt}{}%
+ \else
+ \printedrefname
+ \fi
+ %
+ % If the user also gave the printed manual name (fifth arg), append
+ % "in MANUALNAME".
+ \ifdim \wd\printedmanualbox > 0pt
+ \space \putwordin{} \cite{\printedmanual}%
+ \fi
+ \else
+ % node/anchor (non-float) references.
+ %
+ % If we use \unhbox to print the node names, TeX does not insert
+ % empty discretionaries after hyphens, which means that it will not
+ % find a line break at a hyphen in a node names. Since some manuals
+ % are best written with fairly long node names, containing hyphens,
+ % this is a loss. Therefore, we give the text of the node name
+ % again, so it is as if TeX is seeing it for the first time.
+ %
+ \ifdim \wd\printedmanualbox > 0pt
+ % Cross-manual reference with a printed manual name.
+ %
+ \crossmanualxref{\cite{\printedmanual\unskip}}%
+ %
+ \else\ifdim \wd\infofilenamebox > 0pt
+ % Cross-manual reference with only an info filename (arg 4), no
+ % printed manual name (arg 5). This is essentially the same as
+ % the case above; we output the filename, since we have nothing else.
+ %
+ \crossmanualxref{\code{\infofilename\unskip}}%
+ %
+ \else
+ % Reference within this manual.
+ %
+ % _ (for example) has to be the character _ for the purposes of the
+ % control sequence corresponding to the node, but it has to expand
+ % into the usual \leavevmode...\vrule stuff for purposes of
+ % printing. So we \turnoffactive for the \refx-snt, back on for the
+ % printing, back off for the \refx-pg.
+ {\turnoffactive
+ % Only output a following space if the -snt ref is nonempty; for
+ % @unnumbered and @anchor, it won't be.
+ \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
+ \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
+ }%
+ % output the `[mynode]' via the macro below so it can be overridden.
+ \xrefprintnodename\printedrefname
+ %
+ % But we always want a comma and a space:
+ ,\space
+ %
+ % output the `page 3'.
+ \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
+ \fi\fi
+ \fi
+ \endlink
+\endgroup}
+
+% Output a cross-manual xref to #1. Used just above (twice).
+%
+% Only include the text "Section ``foo'' in" if the foo is neither
+% missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
+% "see The Foo Manual", the idea being to refer to the whole manual.
+%
+% But, this being TeX, we can't easily compare our node name against the
+% string "Top" while ignoring the possible spaces before and after in
+% the input. By adding the arbitrary 7sp below, we make it much less
+% likely that a real node name would have the same width as "Top" (e.g.,
+% in a monospaced font). Hopefully it will never happen in practice.
+%
+% For the same basic reason, we retypeset the "Top" at every
+% reference, since the current font is indeterminate.
+%
+\def\crossmanualxref#1{%
+ \setbox\toprefbox = \hbox{Top\kern7sp}%
+ \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
+ \ifdim \wd2 > 7sp % nonempty?
+ \ifdim \wd2 = \wd\toprefbox \else % same as Top?
+ \putwordSection{} ``\printedrefname'' \putwordin{}\space
+ \fi
+ \fi
+ #1%
+}
+
+% This macro is called from \xrefX for the `[nodename]' part of xref
+% output. It's a separate macro only so it can be changed more easily,
+% since square brackets don't work well in some documents. Particularly
+% one that Bob is working on :).
+%
+\def\xrefprintnodename#1{[#1]}
+
+% Things referred to by \setref.
+%
+\def\Ynothing{}
+\def\Yomitfromtoc{}
+\def\Ynumbered{%
+ \ifnum\secno=0
+ \putwordChapter@tie \the\chapno
+ \else \ifnum\subsecno=0
+ \putwordSection@tie \the\chapno.\the\secno
+ \else \ifnum\subsubsecno=0
+ \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
+ \else
+ \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
+ \fi\fi\fi
+}
+\def\Yappendix{%
+ \ifnum\secno=0
+ \putwordAppendix@tie @char\the\appendixno{}%
+ \else \ifnum\subsecno=0
+ \putwordSection@tie @char\the\appendixno.\the\secno
+ \else \ifnum\subsubsecno=0
+ \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
+ \else
+ \putwordSection@tie
+ @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
+ \fi\fi\fi
+}
+
+% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
+% If its value is nonempty, SUFFIX is output afterward.
+%
+\def\refx#1#2{%
+ {%
+ \indexnofonts
+ \otherbackslash
+ \expandafter\global\expandafter\let\expandafter\thisrefX
+ \csname XR#1\endcsname
+ }%
+ \ifx\thisrefX\relax
+ % If not defined, say something at least.
+ \angleleft un\-de\-fined\angleright
+ \iflinks
+ \ifhavexrefs
+ {\toks0 = {#1}% avoid expansion of possibly-complex value
+ \message{\linenumber Undefined cross reference `\the\toks0'.}}%
+ \else
+ \ifwarnedxrefs\else
+ \global\warnedxrefstrue
+ \message{Cross reference values unknown; you must run TeX again.}%
+ \fi
+ \fi
+ \fi
+ \else
+ % It's defined, so just use it.
+ \thisrefX
+ \fi
+ #2% Output the suffix in any case.
+}
+
+% This is the macro invoked by entries in the aux file. Usually it's
+% just a \def (we prepend XR to the control sequence name to avoid
+% collisions). But if this is a float type, we have more work to do.
+%
+\def\xrdef#1#2{%
+ {% The node name might contain 8-bit characters, which in our current
+ % implementation are changed to commands like @'e. Don't let these
+ % mess up the control sequence name.
+ \indexnofonts
+ \turnoffactive
+ \xdef\safexrefname{#1}%
+ }%
+ %
+ \expandafter\gdef\csname XR\safexrefname\endcsname{#2}% remember this xref
+ %
+ % Was that xref control sequence that we just defined for a float?
+ \expandafter\iffloat\csname XR\safexrefname\endcsname
+ % it was a float, and we have the (safe) float type in \iffloattype.
+ \expandafter\let\expandafter\floatlist
+ \csname floatlist\iffloattype\endcsname
+ %
+ % Is this the first time we've seen this float type?
+ \expandafter\ifx\floatlist\relax
+ \toks0 = {\do}% yes, so just \do
+ \else
+ % had it before, so preserve previous elements in list.
+ \toks0 = \expandafter{\floatlist\do}%
+ \fi
+ %
+ % Remember this xref in the control sequence \floatlistFLOATTYPE,
+ % for later use in \listoffloats.
+ \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
+ {\safexrefname}}%
+ \fi
+}
+
+% Read the last existing aux file, if any. No error if none exists.
+%
+\def\tryauxfile{%
+ \openin 1 \jobname.aux
+ \ifeof 1 \else
+ \readdatafile{aux}%
+ \global\havexrefstrue
+ \fi
+ \closein 1
+}
+
+\def\setupdatafile{%
+ \catcode`\^^@=\other
+ \catcode`\^^A=\other
+ \catcode`\^^B=\other
+ \catcode`\^^C=\other
+ \catcode`\^^D=\other
+ \catcode`\^^E=\other
+ \catcode`\^^F=\other
+ \catcode`\^^G=\other
+ \catcode`\^^H=\other
+ \catcode`\^^K=\other
+ \catcode`\^^L=\other
+ \catcode`\^^N=\other
+ \catcode`\^^P=\other
+ \catcode`\^^Q=\other
+ \catcode`\^^R=\other
+ \catcode`\^^S=\other
+ \catcode`\^^T=\other
+ \catcode`\^^U=\other
+ \catcode`\^^V=\other
+ \catcode`\^^W=\other
+ \catcode`\^^X=\other
+ \catcode`\^^Z=\other
+ \catcode`\^^[=\other
+ \catcode`\^^\=\other
+ \catcode`\^^]=\other
+ \catcode`\^^^=\other
+ \catcode`\^^_=\other
+ % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
+ % in xref tags, i.e., node names. But since ^^e4 notation isn't
+ % supported in the main text, it doesn't seem desirable. Furthermore,
+ % that is not enough: for node names that actually contain a ^
+ % character, we would end up writing a line like this: 'xrdef {'hat
+ % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
+ % argument, and \hat is not an expandable control sequence. It could
+ % all be worked out, but why? Either we support ^^ or we don't.
+ %
+ % The other change necessary for this was to define \auxhat:
+ % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
+ % and then to call \auxhat in \setq.
+ %
+ \catcode`\^=\other
+ %
+ % Special characters. Should be turned off anyway, but...
+ \catcode`\~=\other
+ \catcode`\[=\other
+ \catcode`\]=\other
+ \catcode`\"=\other
+ \catcode`\_=\other
+ \catcode`\|=\other
+ \catcode`\<=\other
+ \catcode`\>=\other
+ \catcode`\$=\other
+ \catcode`\#=\other
+ \catcode`\&=\other
+ \catcode`\%=\other
+ \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
+ %
+ % This is to support \ in node names and titles, since the \
+ % characters end up in a \csname. It's easier than
+ % leaving it active and making its active definition an actual \
+ % character. What I don't understand is why it works in the *value*
+ % of the xrdef. Seems like it should be a catcode12 \, and that
+ % should not typeset properly. But it works, so I'm moving on for
+ % now. --karl, 15jan04.
+ \catcode`\\=\other
+ %
+ % Make the characters 128-255 be printing characters.
+ {%
+ \count1=128
+ \def\loop{%
+ \catcode\count1=\other
+ \advance\count1 by 1
+ \ifnum \count1<256 \loop \fi
+ }%
+ }%
+ %
+ % @ is our escape character in .aux files, and we need braces.
+ \catcode`\{=1
+ \catcode`\}=2
+ \catcode`\@=0
+}
+
+\def\readdatafile#1{%
+\begingroup
+ \setupdatafile
+ \input\jobname.#1
+\endgroup}
+
+
+\message{insertions,}
+% including footnotes.
+
+\newcount \footnoteno
+
+% The trailing space in the following definition for supereject is
+% vital for proper filling; pages come out unaligned when you do a
+% pagealignmacro call if that space before the closing brace is
+% removed. (Generally, numeric constants should always be followed by a
+% space to prevent strange expansion errors.)
+\def\supereject{\par\penalty -20000\footnoteno =0 }
+
+% @footnotestyle is meaningful for Info output only.
+\let\footnotestyle=\comment
+
+{\catcode `\@=11
+%
+% Auto-number footnotes. Otherwise like plain.
+\gdef\footnote{%
+ \let\indent=\ptexindent
+ \let\noindent=\ptexnoindent
+ \global\advance\footnoteno by \@ne
+ \edef\thisfootno{$^{\the\footnoteno}$}%
+ %
+ % In case the footnote comes at the end of a sentence, preserve the
+ % extra spacing after we do the footnote number.
+ \let\@sf\empty
+ \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
+ %
+ % Remove inadvertent blank space before typesetting the footnote number.
+ \unskip
+ \thisfootno\@sf
+ \dofootnote
+}%
+
+% Don't bother with the trickery in plain.tex to not require the
+% footnote text as a parameter. Our footnotes don't need to be so general.
+%
+% Oh yes, they do; otherwise, @ifset (and anything else that uses
+% \parseargline) fails inside footnotes because the tokens are fixed when
+% the footnote is read. --karl, 16nov96.
+%
+\gdef\dofootnote{%
+ \insert\footins\bgroup
+ % We want to typeset this text as a normal paragraph, even if the
+ % footnote reference occurs in (for example) a display environment.
+ % So reset some parameters.
+ \hsize=\pagewidth
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\ht\strutbox % top baseline for broken footnotes
+ \splitmaxdepth\dp\strutbox
+ \floatingpenalty\@MM
+ \leftskip\z@skip
+ \rightskip\z@skip
+ \spaceskip\z@skip
+ \xspaceskip\z@skip
+ \parindent\defaultparindent
+ %
+ \smallfonts \rm
+ %
+ % Because we use hanging indentation in footnotes, a @noindent appears
+ % to exdent this text, so make it be a no-op. makeinfo does not use
+ % hanging indentation so @noindent can still be needed within footnote
+ % text after an @example or the like (not that this is good style).
+ \let\noindent = \relax
+ %
+ % Hang the footnote text off the number. Use \everypar in case the
+ % footnote extends for more than one paragraph.
+ \everypar = {\hang}%
+ \textindent{\thisfootno}%
+ %
+ % Don't crash into the line above the footnote text. Since this
+ % expands into a box, it must come within the paragraph, lest it
+ % provide a place where TeX can split the footnote.
+ \footstrut
+ %
+ % Invoke rest of plain TeX footnote routine.
+ \futurelet\next\fo@t
+}
+}%end \catcode `\@=11
+
+% In case a @footnote appears in a vbox, save the footnote text and create
+% the real \insert just after the vbox finished. Otherwise, the insertion
+% would be lost.
+% Similarly, if a @footnote appears inside an alignment, save the footnote
+% text to a box and make the \insert when a row of the table is finished.
+% And the same can be done for other insert classes. --kasal, 16nov03.
+
+% Replace the \insert primitive by a cheating macro.
+% Deeper inside, just make sure that the saved insertions are not spilled
+% out prematurely.
+%
+\def\startsavinginserts{%
+ \ifx \insert\ptexinsert
+ \let\insert\saveinsert
+ \else
+ \let\checkinserts\relax
+ \fi
+}
+
+% This \insert replacement works for both \insert\footins{foo} and
+% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
+%
+\def\saveinsert#1{%
+ \edef\next{\noexpand\savetobox \makeSAVEname#1}%
+ \afterassignment\next
+ % swallow the left brace
+ \let\temp =
+}
+\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
+\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
+
+\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
+
+\def\placesaveins#1{%
+ \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
+ {\box#1}%
+}
+
+% eat @SAVE -- beware, all of them have catcode \other:
+{
+ \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
+ \gdef\gobblesave @SAVE{}
+}
+
+% initialization:
+\def\newsaveins #1{%
+ \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
+ \next
+}
+\def\newsaveinsX #1{%
+ \csname newbox\endcsname #1%
+ \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
+ \checksaveins #1}%
+}
+
+% initialize:
+\let\checkinserts\empty
+\newsaveins\footins
+\newsaveins\margin
+
+
+% @image. We use the macros from epsf.tex to support this.
+% If epsf.tex is not installed and @image is used, we complain.
+%
+% Check for and read epsf.tex up front. If we read it only at @image
+% time, we might be inside a group, and then its definitions would get
+% undone and the next image would fail.
+\openin 1 = epsf.tex
+\ifeof 1 \else
+ % Do not bother showing banner with epsf.tex v2.7k (available in
+ % doc/epsf.tex and on ctan).
+ \def\epsfannounce{\toks0 = }%
+ \input epsf.tex
+\fi
+\closein 1
+%
+% We will only complain once about lack of epsf.tex.
+\newif\ifwarnednoepsf
+\newhelp\noepsfhelp{epsf.tex must be installed for images to
+ work. It is also included in the Texinfo distribution, or you can get
+ it from ftp://tug.org/tex/epsf.tex.}
+%
+\def\image#1{%
+ \ifx\epsfbox\thisisundefined
+ \ifwarnednoepsf \else
+ \errhelp = \noepsfhelp
+ \errmessage{epsf.tex not found, images will be ignored}%
+ \global\warnednoepsftrue
+ \fi
+ \else
+ \imagexxx #1,,,,,\finish
+ \fi
+}
+%
+% Arguments to @image:
+% #1 is (mandatory) image filename; we tack on .eps extension.
+% #2 is (optional) width, #3 is (optional) height.
+% #4 is (ignored optional) html alt text.
+% #5 is (ignored optional) extension.
+% #6 is just the usual extra ignored arg for parsing stuff.
+\newif\ifimagevmode
+\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
+ \catcode`\^^M = 5 % in case we're inside an example
+ \normalturnoffactive % allow _ et al. in names
+ % If the image is by itself, center it.
+ \ifvmode
+ \imagevmodetrue
+ \else \ifx\centersub\centerV
+ % for @center @image, we need a vbox so we can have our vertical space
+ \imagevmodetrue
+ \vbox\bgroup % vbox has better behavior than vtop herev
+ \fi\fi
+ %
+ \ifimagevmode
+ \nobreak\medskip
+ % Usually we'll have text after the image which will insert
+ % \parskip glue, so insert it here too to equalize the space
+ % above and below.
+ \nobreak\vskip\parskip
+ \nobreak
+ \fi
+ %
+ % Leave vertical mode so that indentation from an enclosing
+ % environment such as @quotation is respected.
+ % However, if we're at the top level, we don't want the
+ % normal paragraph indentation.
+ % On the other hand, if we are in the case of @center @image, we don't
+ % want to start a paragraph, which will create a hsize-width box and
+ % eradicate the centering.
+ \ifx\centersub\centerV\else \noindent \fi
+ %
+ % Output the image.
+ \ifpdf
+ \dopdfimage{#1}{#2}{#3}%
+ \else
+ % \epsfbox itself resets \epsf?size at each figure.
+ \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
+ \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
+ \epsfbox{#1.eps}%
+ \fi
+ %
+ \ifimagevmode
+ \medskip % space after a standalone image
+ \fi
+ \ifx\centersub\centerV \egroup \fi
+\endgroup}
+
+
+% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
+% etc. We don't actually implement floating yet, we always include the
+% float "here". But it seemed the best name for the future.
+%
+\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
+
+% There may be a space before second and/or third parameter; delete it.
+\def\eatcommaspace#1, {#1,}
+
+% #1 is the optional FLOATTYPE, the text label for this float, typically
+% "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
+% this float will not be numbered and cannot be referred to.
+%
+% #2 is the optional xref label. Also must be present for the float to
+% be referable.
+%
+% #3 is the optional positioning argument; for now, it is ignored. It
+% will somehow specify the positions allowed to float to (here, top, bottom).
+%
+% We keep a separate counter for each FLOATTYPE, which we reset at each
+% chapter-level command.
+\let\resetallfloatnos=\empty
+%
+\def\dofloat#1,#2,#3,#4\finish{%
+ \let\thiscaption=\empty
+ \let\thisshortcaption=\empty
+ %
+ % don't lose footnotes inside @float.
+ %
+ % BEWARE: when the floats start float, we have to issue warning whenever an
+ % insert appears inside a float which could possibly float. --kasal, 26may04
+ %
+ \startsavinginserts
+ %
+ % We can't be used inside a paragraph.
+ \par
+ %
+ \vtop\bgroup
+ \def\floattype{#1}%
+ \def\floatlabel{#2}%
+ \def\floatloc{#3}% we do nothing with this yet.
+ %
+ \ifx\floattype\empty
+ \let\safefloattype=\empty
+ \else
+ {%
+ % the floattype might have accents or other special characters,
+ % but we need to use it in a control sequence name.
+ \indexnofonts
+ \turnoffactive
+ \xdef\safefloattype{\floattype}%
+ }%
+ \fi
+ %
+ % If label is given but no type, we handle that as the empty type.
+ \ifx\floatlabel\empty \else
+ % We want each FLOATTYPE to be numbered separately (Figure 1,
+ % Table 1, Figure 2, ...). (And if no label, no number.)
+ %
+ \expandafter\getfloatno\csname\safefloattype floatno\endcsname
+ \global\advance\floatno by 1
+ %
+ {%
+ % This magic value for \lastsection is output by \setref as the
+ % XREFLABEL-title value. \xrefX uses it to distinguish float
+ % labels (which have a completely different output format) from
+ % node and anchor labels. And \xrdef uses it to construct the
+ % lists of floats.
+ %
+ \edef\lastsection{\floatmagic=\safefloattype}%
+ \setref{\floatlabel}{Yfloat}%
+ }%
+ \fi
+ %
+ % start with \parskip glue, I guess.
+ \vskip\parskip
+ %
+ % Don't suppress indentation if a float happens to start a section.
+ \restorefirstparagraphindent
+}
+
+% we have these possibilities:
+% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
+% @float Foo,lbl & no caption: Foo 1.1
+% @float Foo & @caption{Cap}: Foo: Cap
+% @float Foo & no caption: Foo
+% @float ,lbl & Caption{Cap}: 1.1: Cap
+% @float ,lbl & no caption: 1.1
+% @float & @caption{Cap}: Cap
+% @float & no caption:
+%
+\def\Efloat{%
+ \let\floatident = \empty
+ %
+ % In all cases, if we have a float type, it comes first.
+ \ifx\floattype\empty \else \def\floatident{\floattype}\fi
+ %
+ % If we have an xref label, the number comes next.
+ \ifx\floatlabel\empty \else
+ \ifx\floattype\empty \else % if also had float type, need tie first.
+ \appendtomacro\floatident{\tie}%
+ \fi
+ % the number.
+ \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
+ \fi
+ %
+ % Start the printed caption with what we've constructed in
+ % \floatident, but keep it separate; we need \floatident again.
+ \let\captionline = \floatident
+ %
+ \ifx\thiscaption\empty \else
+ \ifx\floatident\empty \else
+ \appendtomacro\captionline{: }% had ident, so need a colon between
+ \fi
+ %
+ % caption text.
+ \appendtomacro\captionline{\scanexp\thiscaption}%
+ \fi
+ %
+ % If we have anything to print, print it, with space before.
+ % Eventually this needs to become an \insert.
+ \ifx\captionline\empty \else
+ \vskip.5\parskip
+ \captionline
+ %
+ % Space below caption.
+ \vskip\parskip
+ \fi
+ %
+ % If have an xref label, write the list of floats info. Do this
+ % after the caption, to avoid chance of it being a breakpoint.
+ \ifx\floatlabel\empty \else
+ % Write the text that goes in the lof to the aux file as
+ % \floatlabel-lof. Besides \floatident, we include the short
+ % caption if specified, else the full caption if specified, else nothing.
+ {%
+ \atdummies
+ %
+ % since we read the caption text in the macro world, where ^^M
+ % is turned into a normal character, we have to scan it back, so
+ % we don't write the literal three characters "^^M" into the aux file.
+ \scanexp{%
+ \xdef\noexpand\gtemp{%
+ \ifx\thisshortcaption\empty
+ \thiscaption
+ \else
+ \thisshortcaption
+ \fi
+ }%
+ }%
+ \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
+ \ifx\gtemp\empty \else : \gtemp \fi}}%
+ }%
+ \fi
+ \egroup % end of \vtop
+ %
+ % place the captured inserts
+ %
+ % BEWARE: when the floats start floating, we have to issue warning
+ % whenever an insert appears inside a float which could possibly
+ % float. --kasal, 26may04
+ %
+ \checkinserts
+}
+
+% Append the tokens #2 to the definition of macro #1, not expanding either.
+%
+\def\appendtomacro#1#2{%
+ \expandafter\def\expandafter#1\expandafter{#1#2}%
+}
+
+% @caption, @shortcaption
+%
+\def\caption{\docaption\thiscaption}
+\def\shortcaption{\docaption\thisshortcaption}
+\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
+\def\defcaption#1#2{\egroup \def#1{#2}}
+
+% The parameter is the control sequence identifying the counter we are
+% going to use. Create it if it doesn't exist and assign it to \floatno.
+\def\getfloatno#1{%
+ \ifx#1\relax
+ % Haven't seen this figure type before.
+ \csname newcount\endcsname #1%
+ %
+ % Remember to reset this floatno at the next chap.
+ \expandafter\gdef\expandafter\resetallfloatnos
+ \expandafter{\resetallfloatnos #1=0 }%
+ \fi
+ \let\floatno#1%
+}
+
+% \setref calls this to get the XREFLABEL-snt value. We want an @xref
+% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
+% first read the @float command.
+%
+\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
+
+% Magic string used for the XREFLABEL-title value, so \xrefX can
+% distinguish floats from other xref types.
+\def\floatmagic{!!float!!}
+
+% #1 is the control sequence we are passed; we expand into a conditional
+% which is true if #1 represents a float ref. That is, the magic
+% \lastsection value which we \setref above.
+%
+\def\iffloat#1{\expandafter\doiffloat#1==\finish}
+%
+% #1 is (maybe) the \floatmagic string. If so, #2 will be the
+% (safe) float type for this float. We set \iffloattype to #2.
+%
+\def\doiffloat#1=#2=#3\finish{%
+ \def\temp{#1}%
+ \def\iffloattype{#2}%
+ \ifx\temp\floatmagic
+}
+
+% @listoffloats FLOATTYPE - print a list of floats like a table of contents.
+%
+\parseargdef\listoffloats{%
+ \def\floattype{#1}% floattype
+ {%
+ % the floattype might have accents or other special characters,
+ % but we need to use it in a control sequence name.
+ \indexnofonts
+ \turnoffactive
+ \xdef\safefloattype{\floattype}%
+ }%
+ %
+ % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
+ \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
+ \ifhavexrefs
+ % if the user said @listoffloats foo but never @float foo.
+ \message{\linenumber No `\safefloattype' floats to list.}%
+ \fi
+ \else
+ \begingroup
+ \leftskip=\tocindent % indent these entries like a toc
+ \let\do=\listoffloatsdo
+ \csname floatlist\safefloattype\endcsname
+ \endgroup
+ \fi
+}
+
+% This is called on each entry in a list of floats. We're passed the
+% xref label, in the form LABEL-title, which is how we save it in the
+% aux file. We strip off the -title and look up \XRLABEL-lof, which
+% has the text we're supposed to typeset here.
+%
+% Figures without xref labels will not be included in the list (since
+% they won't appear in the aux file).
+%
+\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
+\def\listoffloatsdoentry#1-title\finish{{%
+ % Can't fully expand XR#1-lof because it can contain anything. Just
+ % pass the control sequence. On the other hand, XR#1-pg is just the
+ % page number, and we want to fully expand that so we can get a link
+ % in pdf output.
+ \toksA = \expandafter{\csname XR#1-lof\endcsname}%
+ %
+ % use the same \entry macro we use to generate the TOC and index.
+ \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
+ \writeentry
+}}
+
+
+\message{localization,}
+
+% For single-language documents, @documentlanguage is usually given very
+% early, just after @documentencoding. Single argument is the language
+% (de) or locale (de_DE) abbreviation.
+%
+{
+ \catcode`\_ = \active
+ \globaldefs=1
+\parseargdef\documentlanguage{\begingroup
+ \let_=\normalunderscore % normal _ character for filenames
+ \tex % read txi-??.tex file in plain TeX.
+ % Read the file by the name they passed if it exists.
+ \openin 1 txi-#1.tex
+ \ifeof 1
+ \documentlanguagetrywithoutunderscore{#1_\finish}%
+ \else
+ \globaldefs = 1 % everything in the txi-LL files needs to persist
+ \input txi-#1.tex
+ \fi
+ \closein 1
+ \endgroup % end raw TeX
+\endgroup}
+%
+% If they passed de_DE, and txi-de_DE.tex doesn't exist,
+% try txi-de.tex.
+%
+\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
+ \openin 1 txi-#1.tex
+ \ifeof 1
+ \errhelp = \nolanghelp
+ \errmessage{Cannot read language file txi-#1.tex}%
+ \else
+ \globaldefs = 1 % everything in the txi-LL files needs to persist
+ \input txi-#1.tex
+ \fi
+ \closein 1
+}
+}% end of special _ catcode
+%
+\newhelp\nolanghelp{The given language definition file cannot be found or
+is empty. Maybe you need to install it? Putting it in the current
+directory should work if nowhere else does.}
+
+% This macro is called from txi-??.tex files; the first argument is the
+% \language name to set (without the "\lang@" prefix), the second and
+% third args are \{left,right}hyphenmin.
+%
+% The language names to pass are determined when the format is built.
+% See the etex.log file created at that time, e.g.,
+% /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
+%
+% With TeX Live 2008, etex now includes hyphenation patterns for all
+% available languages. This means we can support hyphenation in
+% Texinfo, at least to some extent. (This still doesn't solve the
+% accented characters problem.)
+%
+\catcode`@=11
+\def\txisetlanguage#1#2#3{%
+ % do not set the language if the name is undefined in the current TeX.
+ \expandafter\ifx\csname lang@#1\endcsname \relax
+ \message{no patterns for #1}%
+ \else
+ \global\language = \csname lang@#1\endcsname
+ \fi
+ % but there is no harm in adjusting the hyphenmin values regardless.
+ \global\lefthyphenmin = #2\relax
+ \global\righthyphenmin = #3\relax
+}
+
+% Helpers for encodings.
+% Set the catcode of characters 128 through 255 to the specified number.
+%
+\def\setnonasciicharscatcode#1{%
+ \count255=128
+ \loop\ifnum\count255<256
+ \global\catcode\count255=#1\relax
+ \advance\count255 by 1
+ \repeat
+}
+
+\def\setnonasciicharscatcodenonglobal#1{%
+ \count255=128
+ \loop\ifnum\count255<256
+ \catcode\count255=#1\relax
+ \advance\count255 by 1
+ \repeat
+}
+
+% @documentencoding sets the definition of non-ASCII characters
+% according to the specified encoding.
+%
+\parseargdef\documentencoding{%
+ % Encoding being declared for the document.
+ \def\declaredencoding{\csname #1.enc\endcsname}%
+ %
+ % Supported encodings: names converted to tokens in order to be able
+ % to compare them with \ifx.
+ \def\ascii{\csname US-ASCII.enc\endcsname}%
+ \def\latnine{\csname ISO-8859-15.enc\endcsname}%
+ \def\latone{\csname ISO-8859-1.enc\endcsname}%
+ \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
+ \def\utfeight{\csname UTF-8.enc\endcsname}%
+ %
+ \ifx \declaredencoding \ascii
+ \asciichardefs
+ %
+ \else \ifx \declaredencoding \lattwo
+ \setnonasciicharscatcode\active
+ \lattwochardefs
+ %
+ \else \ifx \declaredencoding \latone
+ \setnonasciicharscatcode\active
+ \latonechardefs
+ %
+ \else \ifx \declaredencoding \latnine
+ \setnonasciicharscatcode\active
+ \latninechardefs
+ %
+ \else \ifx \declaredencoding \utfeight
+ \setnonasciicharscatcode\active
+ \utfeightchardefs
+ %
+ \else
+ \message{Unknown document encoding #1, ignoring.}%
+ %
+ \fi % utfeight
+ \fi % latnine
+ \fi % latone
+ \fi % lattwo
+ \fi % ascii
+}
+
+% A message to be logged when using a character that isn't available
+% the default font encoding (OT1).
+%
+\def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}}
+
+% Take account of \c (plain) vs. \, (Texinfo) difference.
+\def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
+
+% First, make active non-ASCII characters in order for them to be
+% correctly categorized when TeX reads the replacement text of
+% macros containing the character definitions.
+\setnonasciicharscatcode\active
+%
+% Latin1 (ISO-8859-1) character definitions.
+\def\latonechardefs{%
+ \gdef^^a0{\tie}
+ \gdef^^a1{\exclamdown}
+ \gdef^^a2{\missingcharmsg{CENT SIGN}}
+ \gdef^^a3{{\pounds}}
+ \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
+ \gdef^^a5{\missingcharmsg{YEN SIGN}}
+ \gdef^^a6{\missingcharmsg{BROKEN BAR}}
+ \gdef^^a7{\S}
+ \gdef^^a8{\"{}}
+ \gdef^^a9{\copyright}
+ \gdef^^aa{\ordf}
+ \gdef^^ab{\guillemetleft}
+ \gdef^^ac{$\lnot$}
+ \gdef^^ad{\-}
+ \gdef^^ae{\registeredsymbol}
+ \gdef^^af{\={}}
+ %
+ \gdef^^b0{\textdegree}
+ \gdef^^b1{$\pm$}
+ \gdef^^b2{$^2$}
+ \gdef^^b3{$^3$}
+ \gdef^^b4{\'{}}
+ \gdef^^b5{$\mu$}
+ \gdef^^b6{\P}
+ %
+ \gdef^^b7{$^.$}
+ \gdef^^b8{\cedilla\ }
+ \gdef^^b9{$^1$}
+ \gdef^^ba{\ordm}
+ %
+ \gdef^^bb{\guillemetright}
+ \gdef^^bc{$1\over4$}
+ \gdef^^bd{$1\over2$}
+ \gdef^^be{$3\over4$}
+ \gdef^^bf{\questiondown}
+ %
+ \gdef^^c0{\`A}
+ \gdef^^c1{\'A}
+ \gdef^^c2{\^A}
+ \gdef^^c3{\~A}
+ \gdef^^c4{\"A}
+ \gdef^^c5{\ringaccent A}
+ \gdef^^c6{\AE}
+ \gdef^^c7{\cedilla C}
+ \gdef^^c8{\`E}
+ \gdef^^c9{\'E}
+ \gdef^^ca{\^E}
+ \gdef^^cb{\"E}
+ \gdef^^cc{\`I}
+ \gdef^^cd{\'I}
+ \gdef^^ce{\^I}
+ \gdef^^cf{\"I}
+ %
+ \gdef^^d0{\DH}
+ \gdef^^d1{\~N}
+ \gdef^^d2{\`O}
+ \gdef^^d3{\'O}
+ \gdef^^d4{\^O}
+ \gdef^^d5{\~O}
+ \gdef^^d6{\"O}
+ \gdef^^d7{$\times$}
+ \gdef^^d8{\O}
+ \gdef^^d9{\`U}
+ \gdef^^da{\'U}
+ \gdef^^db{\^U}
+ \gdef^^dc{\"U}
+ \gdef^^dd{\'Y}
+ \gdef^^de{\TH}
+ \gdef^^df{\ss}
+ %
+ \gdef^^e0{\`a}
+ \gdef^^e1{\'a}
+ \gdef^^e2{\^a}
+ \gdef^^e3{\~a}
+ \gdef^^e4{\"a}
+ \gdef^^e5{\ringaccent a}
+ \gdef^^e6{\ae}
+ \gdef^^e7{\cedilla c}
+ \gdef^^e8{\`e}
+ \gdef^^e9{\'e}
+ \gdef^^ea{\^e}
+ \gdef^^eb{\"e}
+ \gdef^^ec{\`{\dotless i}}
+ \gdef^^ed{\'{\dotless i}}
+ \gdef^^ee{\^{\dotless i}}
+ \gdef^^ef{\"{\dotless i}}
+ %
+ \gdef^^f0{\dh}
+ \gdef^^f1{\~n}
+ \gdef^^f2{\`o}
+ \gdef^^f3{\'o}
+ \gdef^^f4{\^o}
+ \gdef^^f5{\~o}
+ \gdef^^f6{\"o}
+ \gdef^^f7{$\div$}
+ \gdef^^f8{\o}
+ \gdef^^f9{\`u}
+ \gdef^^fa{\'u}
+ \gdef^^fb{\^u}
+ \gdef^^fc{\"u}
+ \gdef^^fd{\'y}
+ \gdef^^fe{\th}
+ \gdef^^ff{\"y}
+}
+
+% Latin9 (ISO-8859-15) encoding character definitions.
+\def\latninechardefs{%
+ % Encoding is almost identical to Latin1.
+ \latonechardefs
+ %
+ \gdef^^a4{\euro}
+ \gdef^^a6{\v S}
+ \gdef^^a8{\v s}
+ \gdef^^b4{\v Z}
+ \gdef^^b8{\v z}
+ \gdef^^bc{\OE}
+ \gdef^^bd{\oe}
+ \gdef^^be{\"Y}
+}
+
+% Latin2 (ISO-8859-2) character definitions.
+\def\lattwochardefs{%
+ \gdef^^a0{\tie}
+ \gdef^^a1{\ogonek{A}}
+ \gdef^^a2{\u{}}
+ \gdef^^a3{\L}
+ \gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
+ \gdef^^a5{\v L}
+ \gdef^^a6{\'S}
+ \gdef^^a7{\S}
+ \gdef^^a8{\"{}}
+ \gdef^^a9{\v S}
+ \gdef^^aa{\cedilla S}
+ \gdef^^ab{\v T}
+ \gdef^^ac{\'Z}
+ \gdef^^ad{\-}
+ \gdef^^ae{\v Z}
+ \gdef^^af{\dotaccent Z}
+ %
+ \gdef^^b0{\textdegree}
+ \gdef^^b1{\ogonek{a}}
+ \gdef^^b2{\ogonek{ }}
+ \gdef^^b3{\l}
+ \gdef^^b4{\'{}}
+ \gdef^^b5{\v l}
+ \gdef^^b6{\'s}
+ \gdef^^b7{\v{}}
+ \gdef^^b8{\cedilla\ }
+ \gdef^^b9{\v s}
+ \gdef^^ba{\cedilla s}
+ \gdef^^bb{\v t}
+ \gdef^^bc{\'z}
+ \gdef^^bd{\H{}}
+ \gdef^^be{\v z}
+ \gdef^^bf{\dotaccent z}
+ %
+ \gdef^^c0{\'R}
+ \gdef^^c1{\'A}
+ \gdef^^c2{\^A}
+ \gdef^^c3{\u A}
+ \gdef^^c4{\"A}
+ \gdef^^c5{\'L}
+ \gdef^^c6{\'C}
+ \gdef^^c7{\cedilla C}
+ \gdef^^c8{\v C}
+ \gdef^^c9{\'E}
+ \gdef^^ca{\ogonek{E}}
+ \gdef^^cb{\"E}
+ \gdef^^cc{\v E}
+ \gdef^^cd{\'I}
+ \gdef^^ce{\^I}
+ \gdef^^cf{\v D}
+ %
+ \gdef^^d0{\DH}
+ \gdef^^d1{\'N}
+ \gdef^^d2{\v N}
+ \gdef^^d3{\'O}
+ \gdef^^d4{\^O}
+ \gdef^^d5{\H O}
+ \gdef^^d6{\"O}
+ \gdef^^d7{$\times$}
+ \gdef^^d8{\v R}
+ \gdef^^d9{\ringaccent U}
+ \gdef^^da{\'U}
+ \gdef^^db{\H U}
+ \gdef^^dc{\"U}
+ \gdef^^dd{\'Y}
+ \gdef^^de{\cedilla T}
+ \gdef^^df{\ss}
+ %
+ \gdef^^e0{\'r}
+ \gdef^^e1{\'a}
+ \gdef^^e2{\^a}
+ \gdef^^e3{\u a}
+ \gdef^^e4{\"a}
+ \gdef^^e5{\'l}
+ \gdef^^e6{\'c}
+ \gdef^^e7{\cedilla c}
+ \gdef^^e8{\v c}
+ \gdef^^e9{\'e}
+ \gdef^^ea{\ogonek{e}}
+ \gdef^^eb{\"e}
+ \gdef^^ec{\v e}
+ \gdef^^ed{\'{\dotless{i}}}
+ \gdef^^ee{\^{\dotless{i}}}
+ \gdef^^ef{\v d}
+ %
+ \gdef^^f0{\dh}
+ \gdef^^f1{\'n}
+ \gdef^^f2{\v n}
+ \gdef^^f3{\'o}
+ \gdef^^f4{\^o}
+ \gdef^^f5{\H o}
+ \gdef^^f6{\"o}
+ \gdef^^f7{$\div$}
+ \gdef^^f8{\v r}
+ \gdef^^f9{\ringaccent u}
+ \gdef^^fa{\'u}
+ \gdef^^fb{\H u}
+ \gdef^^fc{\"u}
+ \gdef^^fd{\'y}
+ \gdef^^fe{\cedilla t}
+ \gdef^^ff{\dotaccent{}}
+}
+
+% UTF-8 character definitions.
+%
+% This code to support UTF-8 is based on LaTeX's utf8.def, with some
+% changes for Texinfo conventions. It is included here under the GPL by
+% permission from Frank Mittelbach and the LaTeX team.
+%
+\newcount\countUTFx
+\newcount\countUTFy
+\newcount\countUTFz
+
+\gdef\UTFviiiTwoOctets#1#2{\expandafter
+ \UTFviiiDefined\csname u8:#1\string #2\endcsname}
+%
+\gdef\UTFviiiThreeOctets#1#2#3{\expandafter
+ \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
+%
+\gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
+ \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
+
+\gdef\UTFviiiDefined#1{%
+ \ifx #1\relax
+ \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
+ \else
+ \expandafter #1%
+ \fi
+}
+
+\begingroup
+ \catcode`\~13
+ \catcode`\"12
+
+ \def\UTFviiiLoop{%
+ \global\catcode\countUTFx\active
+ \uccode`\~\countUTFx
+ \uppercase\expandafter{\UTFviiiTmp}%
+ \advance\countUTFx by 1
+ \ifnum\countUTFx < \countUTFy
+ \expandafter\UTFviiiLoop
+ \fi}
+
+ \countUTFx = "C2
+ \countUTFy = "E0
+ \def\UTFviiiTmp{%
+ \xdef~{\noexpand\UTFviiiTwoOctets\string~}}
+ \UTFviiiLoop
+
+ \countUTFx = "E0
+ \countUTFy = "F0
+ \def\UTFviiiTmp{%
+ \xdef~{\noexpand\UTFviiiThreeOctets\string~}}
+ \UTFviiiLoop
+
+ \countUTFx = "F0
+ \countUTFy = "F4
+ \def\UTFviiiTmp{%
+ \xdef~{\noexpand\UTFviiiFourOctets\string~}}
+ \UTFviiiLoop
+\endgroup
+
+\begingroup
+ \catcode`\"=12
+ \catcode`\<=12
+ \catcode`\.=12
+ \catcode`\,=12
+ \catcode`\;=12
+ \catcode`\!=12
+ \catcode`\~=13
+
+ \gdef\DeclareUnicodeCharacter#1#2{%
+ \countUTFz = "#1\relax
+ %\wlog{\space\space defining Unicode char U+#1 (decimal \the\countUTFz)}%
+ \begingroup
+ \parseXMLCharref
+ \def\UTFviiiTwoOctets##1##2{%
+ \csname u8:##1\string ##2\endcsname}%
+ \def\UTFviiiThreeOctets##1##2##3{%
+ \csname u8:##1\string ##2\string ##3\endcsname}%
+ \def\UTFviiiFourOctets##1##2##3##4{%
+ \csname u8:##1\string ##2\string ##3\string ##4\endcsname}%
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter
+ \gdef\UTFviiiTmp{#2}%
+ \endgroup}
+
+ \gdef\parseXMLCharref{%
+ \ifnum\countUTFz < "A0\relax
+ \errhelp = \EMsimple
+ \errmessage{Cannot define Unicode char value < 00A0}%
+ \else\ifnum\countUTFz < "800\relax
+ \parseUTFviiiA,%
+ \parseUTFviiiB C\UTFviiiTwoOctets.,%
+ \else\ifnum\countUTFz < "10000\relax
+ \parseUTFviiiA;%
+ \parseUTFviiiA,%
+ \parseUTFviiiB E\UTFviiiThreeOctets.{,;}%
+ \else
+ \parseUTFviiiA;%
+ \parseUTFviiiA,%
+ \parseUTFviiiA!%
+ \parseUTFviiiB F\UTFviiiFourOctets.{!,;}%
+ \fi\fi\fi
+ }
+
+ \gdef\parseUTFviiiA#1{%
+ \countUTFx = \countUTFz
+ \divide\countUTFz by 64
+ \countUTFy = \countUTFz
+ \multiply\countUTFz by 64
+ \advance\countUTFx by -\countUTFz
+ \advance\countUTFx by 128
+ \uccode `#1\countUTFx
+ \countUTFz = \countUTFy}
+
+ \gdef\parseUTFviiiB#1#2#3#4{%
+ \advance\countUTFz by "#10\relax
+ \uccode `#3\countUTFz
+ \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
+\endgroup
+
+\def\utfeightchardefs{%
+ \DeclareUnicodeCharacter{00A0}{\tie}
+ \DeclareUnicodeCharacter{00A1}{\exclamdown}
+ \DeclareUnicodeCharacter{00A3}{\pounds}
+ \DeclareUnicodeCharacter{00A8}{\"{ }}
+ \DeclareUnicodeCharacter{00A9}{\copyright}
+ \DeclareUnicodeCharacter{00AA}{\ordf}
+ \DeclareUnicodeCharacter{00AB}{\guillemetleft}
+ \DeclareUnicodeCharacter{00AD}{\-}
+ \DeclareUnicodeCharacter{00AE}{\registeredsymbol}
+ \DeclareUnicodeCharacter{00AF}{\={ }}
+
+ \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}
+ \DeclareUnicodeCharacter{00B4}{\'{ }}
+ \DeclareUnicodeCharacter{00B8}{\cedilla{ }}
+ \DeclareUnicodeCharacter{00BA}{\ordm}
+ \DeclareUnicodeCharacter{00BB}{\guillemetright}
+ \DeclareUnicodeCharacter{00BF}{\questiondown}
+
+ \DeclareUnicodeCharacter{00C0}{\`A}
+ \DeclareUnicodeCharacter{00C1}{\'A}
+ \DeclareUnicodeCharacter{00C2}{\^A}
+ \DeclareUnicodeCharacter{00C3}{\~A}
+ \DeclareUnicodeCharacter{00C4}{\"A}
+ \DeclareUnicodeCharacter{00C5}{\AA}
+ \DeclareUnicodeCharacter{00C6}{\AE}
+ \DeclareUnicodeCharacter{00C7}{\cedilla{C}}
+ \DeclareUnicodeCharacter{00C8}{\`E}
+ \DeclareUnicodeCharacter{00C9}{\'E}
+ \DeclareUnicodeCharacter{00CA}{\^E}
+ \DeclareUnicodeCharacter{00CB}{\"E}
+ \DeclareUnicodeCharacter{00CC}{\`I}
+ \DeclareUnicodeCharacter{00CD}{\'I}
+ \DeclareUnicodeCharacter{00CE}{\^I}
+ \DeclareUnicodeCharacter{00CF}{\"I}
+
+ \DeclareUnicodeCharacter{00D0}{\DH}
+ \DeclareUnicodeCharacter{00D1}{\~N}
+ \DeclareUnicodeCharacter{00D2}{\`O}
+ \DeclareUnicodeCharacter{00D3}{\'O}
+ \DeclareUnicodeCharacter{00D4}{\^O}
+ \DeclareUnicodeCharacter{00D5}{\~O}
+ \DeclareUnicodeCharacter{00D6}{\"O}
+ \DeclareUnicodeCharacter{00D8}{\O}
+ \DeclareUnicodeCharacter{00D9}{\`U}
+ \DeclareUnicodeCharacter{00DA}{\'U}
+ \DeclareUnicodeCharacter{00DB}{\^U}
+ \DeclareUnicodeCharacter{00DC}{\"U}
+ \DeclareUnicodeCharacter{00DD}{\'Y}
+ \DeclareUnicodeCharacter{00DE}{\TH}
+ \DeclareUnicodeCharacter{00DF}{\ss}
+
+ \DeclareUnicodeCharacter{00E0}{\`a}
+ \DeclareUnicodeCharacter{00E1}{\'a}
+ \DeclareUnicodeCharacter{00E2}{\^a}
+ \DeclareUnicodeCharacter{00E3}{\~a}
+ \DeclareUnicodeCharacter{00E4}{\"a}
+ \DeclareUnicodeCharacter{00E5}{\aa}
+ \DeclareUnicodeCharacter{00E6}{\ae}
+ \DeclareUnicodeCharacter{00E7}{\cedilla{c}}
+ \DeclareUnicodeCharacter{00E8}{\`e}
+ \DeclareUnicodeCharacter{00E9}{\'e}
+ \DeclareUnicodeCharacter{00EA}{\^e}
+ \DeclareUnicodeCharacter{00EB}{\"e}
+ \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}
+ \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}
+ \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}
+ \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}
+
+ \DeclareUnicodeCharacter{00F0}{\dh}
+ \DeclareUnicodeCharacter{00F1}{\~n}
+ \DeclareUnicodeCharacter{00F2}{\`o}
+ \DeclareUnicodeCharacter{00F3}{\'o}
+ \DeclareUnicodeCharacter{00F4}{\^o}
+ \DeclareUnicodeCharacter{00F5}{\~o}
+ \DeclareUnicodeCharacter{00F6}{\"o}
+ \DeclareUnicodeCharacter{00F8}{\o}
+ \DeclareUnicodeCharacter{00F9}{\`u}
+ \DeclareUnicodeCharacter{00FA}{\'u}
+ \DeclareUnicodeCharacter{00FB}{\^u}
+ \DeclareUnicodeCharacter{00FC}{\"u}
+ \DeclareUnicodeCharacter{00FD}{\'y}
+ \DeclareUnicodeCharacter{00FE}{\th}
+ \DeclareUnicodeCharacter{00FF}{\"y}
+
+ \DeclareUnicodeCharacter{0100}{\=A}
+ \DeclareUnicodeCharacter{0101}{\=a}
+ \DeclareUnicodeCharacter{0102}{\u{A}}
+ \DeclareUnicodeCharacter{0103}{\u{a}}
+ \DeclareUnicodeCharacter{0104}{\ogonek{A}}
+ \DeclareUnicodeCharacter{0105}{\ogonek{a}}
+ \DeclareUnicodeCharacter{0106}{\'C}
+ \DeclareUnicodeCharacter{0107}{\'c}
+ \DeclareUnicodeCharacter{0108}{\^C}
+ \DeclareUnicodeCharacter{0109}{\^c}
+ \DeclareUnicodeCharacter{0118}{\ogonek{E}}
+ \DeclareUnicodeCharacter{0119}{\ogonek{e}}
+ \DeclareUnicodeCharacter{010A}{\dotaccent{C}}
+ \DeclareUnicodeCharacter{010B}{\dotaccent{c}}
+ \DeclareUnicodeCharacter{010C}{\v{C}}
+ \DeclareUnicodeCharacter{010D}{\v{c}}
+ \DeclareUnicodeCharacter{010E}{\v{D}}
+
+ \DeclareUnicodeCharacter{0112}{\=E}
+ \DeclareUnicodeCharacter{0113}{\=e}
+ \DeclareUnicodeCharacter{0114}{\u{E}}
+ \DeclareUnicodeCharacter{0115}{\u{e}}
+ \DeclareUnicodeCharacter{0116}{\dotaccent{E}}
+ \DeclareUnicodeCharacter{0117}{\dotaccent{e}}
+ \DeclareUnicodeCharacter{011A}{\v{E}}
+ \DeclareUnicodeCharacter{011B}{\v{e}}
+ \DeclareUnicodeCharacter{011C}{\^G}
+ \DeclareUnicodeCharacter{011D}{\^g}
+ \DeclareUnicodeCharacter{011E}{\u{G}}
+ \DeclareUnicodeCharacter{011F}{\u{g}}
+
+ \DeclareUnicodeCharacter{0120}{\dotaccent{G}}
+ \DeclareUnicodeCharacter{0121}{\dotaccent{g}}
+ \DeclareUnicodeCharacter{0124}{\^H}
+ \DeclareUnicodeCharacter{0125}{\^h}
+ \DeclareUnicodeCharacter{0128}{\~I}
+ \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}
+ \DeclareUnicodeCharacter{012A}{\=I}
+ \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}
+ \DeclareUnicodeCharacter{012C}{\u{I}}
+ \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}
+
+ \DeclareUnicodeCharacter{0130}{\dotaccent{I}}
+ \DeclareUnicodeCharacter{0131}{\dotless{i}}
+ \DeclareUnicodeCharacter{0132}{IJ}
+ \DeclareUnicodeCharacter{0133}{ij}
+ \DeclareUnicodeCharacter{0134}{\^J}
+ \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}
+ \DeclareUnicodeCharacter{0139}{\'L}
+ \DeclareUnicodeCharacter{013A}{\'l}
+
+ \DeclareUnicodeCharacter{0141}{\L}
+ \DeclareUnicodeCharacter{0142}{\l}
+ \DeclareUnicodeCharacter{0143}{\'N}
+ \DeclareUnicodeCharacter{0144}{\'n}
+ \DeclareUnicodeCharacter{0147}{\v{N}}
+ \DeclareUnicodeCharacter{0148}{\v{n}}
+ \DeclareUnicodeCharacter{014C}{\=O}
+ \DeclareUnicodeCharacter{014D}{\=o}
+ \DeclareUnicodeCharacter{014E}{\u{O}}
+ \DeclareUnicodeCharacter{014F}{\u{o}}
+
+ \DeclareUnicodeCharacter{0150}{\H{O}}
+ \DeclareUnicodeCharacter{0151}{\H{o}}
+ \DeclareUnicodeCharacter{0152}{\OE}
+ \DeclareUnicodeCharacter{0153}{\oe}
+ \DeclareUnicodeCharacter{0154}{\'R}
+ \DeclareUnicodeCharacter{0155}{\'r}
+ \DeclareUnicodeCharacter{0158}{\v{R}}
+ \DeclareUnicodeCharacter{0159}{\v{r}}
+ \DeclareUnicodeCharacter{015A}{\'S}
+ \DeclareUnicodeCharacter{015B}{\'s}
+ \DeclareUnicodeCharacter{015C}{\^S}
+ \DeclareUnicodeCharacter{015D}{\^s}
+ \DeclareUnicodeCharacter{015E}{\cedilla{S}}
+ \DeclareUnicodeCharacter{015F}{\cedilla{s}}
+
+ \DeclareUnicodeCharacter{0160}{\v{S}}
+ \DeclareUnicodeCharacter{0161}{\v{s}}
+ \DeclareUnicodeCharacter{0162}{\cedilla{t}}
+ \DeclareUnicodeCharacter{0163}{\cedilla{T}}
+ \DeclareUnicodeCharacter{0164}{\v{T}}
+
+ \DeclareUnicodeCharacter{0168}{\~U}
+ \DeclareUnicodeCharacter{0169}{\~u}
+ \DeclareUnicodeCharacter{016A}{\=U}
+ \DeclareUnicodeCharacter{016B}{\=u}
+ \DeclareUnicodeCharacter{016C}{\u{U}}
+ \DeclareUnicodeCharacter{016D}{\u{u}}
+ \DeclareUnicodeCharacter{016E}{\ringaccent{U}}
+ \DeclareUnicodeCharacter{016F}{\ringaccent{u}}
+
+ \DeclareUnicodeCharacter{0170}{\H{U}}
+ \DeclareUnicodeCharacter{0171}{\H{u}}
+ \DeclareUnicodeCharacter{0174}{\^W}
+ \DeclareUnicodeCharacter{0175}{\^w}
+ \DeclareUnicodeCharacter{0176}{\^Y}
+ \DeclareUnicodeCharacter{0177}{\^y}
+ \DeclareUnicodeCharacter{0178}{\"Y}
+ \DeclareUnicodeCharacter{0179}{\'Z}
+ \DeclareUnicodeCharacter{017A}{\'z}
+ \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}
+ \DeclareUnicodeCharacter{017C}{\dotaccent{z}}
+ \DeclareUnicodeCharacter{017D}{\v{Z}}
+ \DeclareUnicodeCharacter{017E}{\v{z}}
+
+ \DeclareUnicodeCharacter{01C4}{D\v{Z}}
+ \DeclareUnicodeCharacter{01C5}{D\v{z}}
+ \DeclareUnicodeCharacter{01C6}{d\v{z}}
+ \DeclareUnicodeCharacter{01C7}{LJ}
+ \DeclareUnicodeCharacter{01C8}{Lj}
+ \DeclareUnicodeCharacter{01C9}{lj}
+ \DeclareUnicodeCharacter{01CA}{NJ}
+ \DeclareUnicodeCharacter{01CB}{Nj}
+ \DeclareUnicodeCharacter{01CC}{nj}
+ \DeclareUnicodeCharacter{01CD}{\v{A}}
+ \DeclareUnicodeCharacter{01CE}{\v{a}}
+ \DeclareUnicodeCharacter{01CF}{\v{I}}
+
+ \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}
+ \DeclareUnicodeCharacter{01D1}{\v{O}}
+ \DeclareUnicodeCharacter{01D2}{\v{o}}
+ \DeclareUnicodeCharacter{01D3}{\v{U}}
+ \DeclareUnicodeCharacter{01D4}{\v{u}}
+
+ \DeclareUnicodeCharacter{01E2}{\={\AE}}
+ \DeclareUnicodeCharacter{01E3}{\={\ae}}
+ \DeclareUnicodeCharacter{01E6}{\v{G}}
+ \DeclareUnicodeCharacter{01E7}{\v{g}}
+ \DeclareUnicodeCharacter{01E8}{\v{K}}
+ \DeclareUnicodeCharacter{01E9}{\v{k}}
+
+ \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}
+ \DeclareUnicodeCharacter{01F1}{DZ}
+ \DeclareUnicodeCharacter{01F2}{Dz}
+ \DeclareUnicodeCharacter{01F3}{dz}
+ \DeclareUnicodeCharacter{01F4}{\'G}
+ \DeclareUnicodeCharacter{01F5}{\'g}
+ \DeclareUnicodeCharacter{01F8}{\`N}
+ \DeclareUnicodeCharacter{01F9}{\`n}
+ \DeclareUnicodeCharacter{01FC}{\'{\AE}}
+ \DeclareUnicodeCharacter{01FD}{\'{\ae}}
+ \DeclareUnicodeCharacter{01FE}{\'{\O}}
+ \DeclareUnicodeCharacter{01FF}{\'{\o}}
+
+ \DeclareUnicodeCharacter{021E}{\v{H}}
+ \DeclareUnicodeCharacter{021F}{\v{h}}
+
+ \DeclareUnicodeCharacter{0226}{\dotaccent{A}}
+ \DeclareUnicodeCharacter{0227}{\dotaccent{a}}
+ \DeclareUnicodeCharacter{0228}{\cedilla{E}}
+ \DeclareUnicodeCharacter{0229}{\cedilla{e}}
+ \DeclareUnicodeCharacter{022E}{\dotaccent{O}}
+ \DeclareUnicodeCharacter{022F}{\dotaccent{o}}
+
+ \DeclareUnicodeCharacter{0232}{\=Y}
+ \DeclareUnicodeCharacter{0233}{\=y}
+ \DeclareUnicodeCharacter{0237}{\dotless{j}}
+
+ \DeclareUnicodeCharacter{02DB}{\ogonek{ }}
+
+ \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}
+ \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}
+ \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}
+ \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}
+ \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}
+ \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}
+ \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}
+ \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}
+ \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}
+ \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}
+ \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}
+ \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}
+
+ \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}
+ \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}
+
+ \DeclareUnicodeCharacter{1E20}{\=G}
+ \DeclareUnicodeCharacter{1E21}{\=g}
+ \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}
+ \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}
+ \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}
+ \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}
+ \DeclareUnicodeCharacter{1E26}{\"H}
+ \DeclareUnicodeCharacter{1E27}{\"h}
+
+ \DeclareUnicodeCharacter{1E30}{\'K}
+ \DeclareUnicodeCharacter{1E31}{\'k}
+ \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}
+ \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}
+ \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}
+ \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}
+ \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}
+ \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}
+ \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}
+ \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}
+ \DeclareUnicodeCharacter{1E3E}{\'M}
+ \DeclareUnicodeCharacter{1E3F}{\'m}
+
+ \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}
+ \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}
+ \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}
+ \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}
+ \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}
+ \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}
+ \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}
+ \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}
+ \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}
+ \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}
+
+ \DeclareUnicodeCharacter{1E54}{\'P}
+ \DeclareUnicodeCharacter{1E55}{\'p}
+ \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}
+ \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}
+ \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}
+ \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}
+ \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}
+ \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}
+ \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}
+ \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}
+
+ \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}
+ \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}
+ \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}
+ \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}
+ \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}
+ \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}
+ \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}
+ \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}
+ \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}
+ \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}
+
+ \DeclareUnicodeCharacter{1E7C}{\~V}
+ \DeclareUnicodeCharacter{1E7D}{\~v}
+ \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}
+ \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}
+
+ \DeclareUnicodeCharacter{1E80}{\`W}
+ \DeclareUnicodeCharacter{1E81}{\`w}
+ \DeclareUnicodeCharacter{1E82}{\'W}
+ \DeclareUnicodeCharacter{1E83}{\'w}
+ \DeclareUnicodeCharacter{1E84}{\"W}
+ \DeclareUnicodeCharacter{1E85}{\"w}
+ \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}
+ \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}
+ \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}
+ \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}
+ \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}
+ \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}
+ \DeclareUnicodeCharacter{1E8C}{\"X}
+ \DeclareUnicodeCharacter{1E8D}{\"x}
+ \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}
+ \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}
+
+ \DeclareUnicodeCharacter{1E90}{\^Z}
+ \DeclareUnicodeCharacter{1E91}{\^z}
+ \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}
+ \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}
+ \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}
+ \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}
+ \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}
+ \DeclareUnicodeCharacter{1E97}{\"t}
+ \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}
+ \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}
+
+ \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}
+ \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}
+
+ \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}
+ \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}
+ \DeclareUnicodeCharacter{1EBC}{\~E}
+ \DeclareUnicodeCharacter{1EBD}{\~e}
+
+ \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}
+ \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}
+ \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}
+ \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}
+
+ \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}
+ \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}
+
+ \DeclareUnicodeCharacter{1EF2}{\`Y}
+ \DeclareUnicodeCharacter{1EF3}{\`y}
+ \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}
+
+ \DeclareUnicodeCharacter{1EF8}{\~Y}
+ \DeclareUnicodeCharacter{1EF9}{\~y}
+
+ \DeclareUnicodeCharacter{2013}{--}
+ \DeclareUnicodeCharacter{2014}{---}
+ \DeclareUnicodeCharacter{2018}{\quoteleft}
+ \DeclareUnicodeCharacter{2019}{\quoteright}
+ \DeclareUnicodeCharacter{201A}{\quotesinglbase}
+ \DeclareUnicodeCharacter{201C}{\quotedblleft}
+ \DeclareUnicodeCharacter{201D}{\quotedblright}
+ \DeclareUnicodeCharacter{201E}{\quotedblbase}
+ \DeclareUnicodeCharacter{2022}{\bullet}
+ \DeclareUnicodeCharacter{2026}{\dots}
+ \DeclareUnicodeCharacter{2039}{\guilsinglleft}
+ \DeclareUnicodeCharacter{203A}{\guilsinglright}
+ \DeclareUnicodeCharacter{20AC}{\euro}
+
+ \DeclareUnicodeCharacter{2192}{\expansion}
+ \DeclareUnicodeCharacter{21D2}{\result}
+
+ \DeclareUnicodeCharacter{2212}{\minus}
+ \DeclareUnicodeCharacter{2217}{\point}
+ \DeclareUnicodeCharacter{2261}{\equiv}
+}% end of \utfeightchardefs
+
+
+% US-ASCII character definitions.
+\def\asciichardefs{% nothing need be done
+ \relax
+}
+
+% Make non-ASCII characters printable again for compatibility with
+% existing Texinfo documents that may use them, even without declaring a
+% document encoding.
+%
+\setnonasciicharscatcode \other
+
+
+\message{formatting,}
+
+\newdimen\defaultparindent \defaultparindent = 15pt
+
+\chapheadingskip = 15pt plus 4pt minus 2pt
+\secheadingskip = 12pt plus 3pt minus 2pt
+\subsecheadingskip = 9pt plus 2pt minus 2pt
+
+% Prevent underfull vbox error messages.
+\vbadness = 10000
+
+% Don't be very finicky about underfull hboxes, either.
+\hbadness = 6666
+
+% Following George Bush, get rid of widows and orphans.
+\widowpenalty=10000
+\clubpenalty=10000
+
+% Use TeX 3.0's \emergencystretch to help line breaking, but if we're
+% using an old version of TeX, don't do anything. We want the amount of
+% stretch added to depend on the line length, hence the dependence on
+% \hsize. We call this whenever the paper size is set.
+%
+\def\setemergencystretch{%
+ \ifx\emergencystretch\thisisundefined
+ % Allow us to assign to \emergencystretch anyway.
+ \def\emergencystretch{\dimen0}%
+ \else
+ \emergencystretch = .15\hsize
+ \fi
+}
+
+% Parameters in order: 1) textheight; 2) textwidth;
+% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
+% 7) physical page height; 8) physical page width.
+%
+% We also call \setleading{\textleading}, so the caller should define
+% \textleading. The caller should also set \parskip.
+%
+\def\internalpagesizes#1#2#3#4#5#6#7#8{%
+ \voffset = #3\relax
+ \topskip = #6\relax
+ \splittopskip = \topskip
+ %
+ \vsize = #1\relax
+ \advance\vsize by \topskip
+ \outervsize = \vsize
+ \advance\outervsize by 2\topandbottommargin
+ \pageheight = \vsize
+ %
+ \hsize = #2\relax
+ \outerhsize = \hsize
+ \advance\outerhsize by 0.5in
+ \pagewidth = \hsize
+ %
+ \normaloffset = #4\relax
+ \bindingoffset = #5\relax
+ %
+ \ifpdf
+ \pdfpageheight #7\relax
+ \pdfpagewidth #8\relax
+ % if we don't reset these, they will remain at "1 true in" of
+ % whatever layout pdftex was dumped with.
+ \pdfhorigin = 1 true in
+ \pdfvorigin = 1 true in
+ \fi
+ %
+ \setleading{\textleading}
+ %
+ \parindent = \defaultparindent
+ \setemergencystretch
+}
+
+% @letterpaper (the default).
+\def\letterpaper{{\globaldefs = 1
+ \parskip = 3pt plus 2pt minus 1pt
+ \textleading = 13.2pt
+ %
+ % If page is nothing but text, make it come out even.
+ \internalpagesizes{607.2pt}{6in}% that's 46 lines
+ {\voffset}{.25in}%
+ {\bindingoffset}{36pt}%
+ {11in}{8.5in}%
+}}
+
+% Use @smallbook to reset parameters for 7x9.25 trim size.
+\def\smallbook{{\globaldefs = 1
+ \parskip = 2pt plus 1pt
+ \textleading = 12pt
+ %
+ \internalpagesizes{7.5in}{5in}%
+ {-.2in}{0in}%
+ {\bindingoffset}{16pt}%
+ {9.25in}{7in}%
+ %
+ \lispnarrowing = 0.3in
+ \tolerance = 700
+ \hfuzz = 1pt
+ \contentsrightmargin = 0pt
+ \defbodyindent = .5cm
+}}
+
+% Use @smallerbook to reset parameters for 6x9 trim size.
+% (Just testing, parameters still in flux.)
+\def\smallerbook{{\globaldefs = 1
+ \parskip = 1.5pt plus 1pt
+ \textleading = 12pt
+ %
+ \internalpagesizes{7.4in}{4.8in}%
+ {-.2in}{-.4in}%
+ {0pt}{14pt}%
+ {9in}{6in}%
+ %
+ \lispnarrowing = 0.25in
+ \tolerance = 700
+ \hfuzz = 1pt
+ \contentsrightmargin = 0pt
+ \defbodyindent = .4cm
+}}
+
+% Use @afourpaper to print on European A4 paper.
+\def\afourpaper{{\globaldefs = 1
+ \parskip = 3pt plus 2pt minus 1pt
+ \textleading = 13.2pt
+ %
+ % Double-side printing via postscript on Laserjet 4050
+ % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
+ % To change the settings for a different printer or situation, adjust
+ % \normaloffset until the front-side and back-side texts align. Then
+ % do the same for \bindingoffset. You can set these for testing in
+ % your texinfo source file like this:
+ % @tex
+ % \global\normaloffset = -6mm
+ % \global\bindingoffset = 10mm
+ % @end tex
+ \internalpagesizes{673.2pt}{160mm}% that's 51 lines
+ {\voffset}{\hoffset}%
+ {\bindingoffset}{44pt}%
+ {297mm}{210mm}%
+ %
+ \tolerance = 700
+ \hfuzz = 1pt
+ \contentsrightmargin = 0pt
+ \defbodyindent = 5mm
+}}
+
+% Use @afivepaper to print on European A5 paper.
+% From romildo@urano.iceb.ufop.br, 2 July 2000.
+% He also recommends making @example and @lisp be small.
+\def\afivepaper{{\globaldefs = 1
+ \parskip = 2pt plus 1pt minus 0.1pt
+ \textleading = 12.5pt
+ %
+ \internalpagesizes{160mm}{120mm}%
+ {\voffset}{\hoffset}%
+ {\bindingoffset}{8pt}%
+ {210mm}{148mm}%
+ %
+ \lispnarrowing = 0.2in
+ \tolerance = 800
+ \hfuzz = 1.2pt
+ \contentsrightmargin = 0pt
+ \defbodyindent = 2mm
+ \tableindent = 12mm
+}}
+
+% A specific text layout, 24x15cm overall, intended for A4 paper.
+\def\afourlatex{{\globaldefs = 1
+ \afourpaper
+ \internalpagesizes{237mm}{150mm}%
+ {\voffset}{4.6mm}%
+ {\bindingoffset}{7mm}%
+ {297mm}{210mm}%
+ %
+ % Must explicitly reset to 0 because we call \afourpaper.
+ \globaldefs = 0
+}}
+
+% Use @afourwide to print on A4 paper in landscape format.
+\def\afourwide{{\globaldefs = 1
+ \afourpaper
+ \internalpagesizes{241mm}{165mm}%
+ {\voffset}{-2.95mm}%
+ {\bindingoffset}{7mm}%
+ {297mm}{210mm}%
+ \globaldefs = 0
+}}
+
+% @pagesizes TEXTHEIGHT[,TEXTWIDTH]
+% Perhaps we should allow setting the margins, \topskip, \parskip,
+% and/or leading, also. Or perhaps we should compute them somehow.
+%
+\parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
+\def\pagesizesyyy#1,#2,#3\finish{{%
+ \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
+ \globaldefs = 1
+ %
+ \parskip = 3pt plus 2pt minus 1pt
+ \setleading{\textleading}%
+ %
+ \dimen0 = #1\relax
+ \advance\dimen0 by \voffset
+ %
+ \dimen2 = \hsize
+ \advance\dimen2 by \normaloffset
+ %
+ \internalpagesizes{#1}{\hsize}%
+ {\voffset}{\normaloffset}%
+ {\bindingoffset}{44pt}%
+ {\dimen0}{\dimen2}%
+}}
+
+% Set default to letter.
+%
+\letterpaper
+
+
+\message{and turning on texinfo input format.}
+
+\def^^L{\par} % remove \outer, so ^L can appear in an @comment
+
+% DEL is a comment character, in case @c does not suffice.
+\catcode`\^^? = 14
+
+% Define macros to output various characters with catcode for normal text.
+\catcode`\"=\other \def\normaldoublequote{"}
+\catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
+\catcode`\+=\other \def\normalplus{+}
+\catcode`\<=\other \def\normalless{<}
+\catcode`\>=\other \def\normalgreater{>}
+\catcode`\^=\other \def\normalcaret{^}
+\catcode`\_=\other \def\normalunderscore{_}
+\catcode`\|=\other \def\normalverticalbar{|}
+\catcode`\~=\other \def\normaltilde{~}
+
+% This macro is used to make a character print one way in \tt
+% (where it can probably be output as-is), and another way in other fonts,
+% where something hairier probably needs to be done.
+%
+% #1 is what to print if we are indeed using \tt; #2 is what to print
+% otherwise. Since all the Computer Modern typewriter fonts have zero
+% interword stretch (and shrink), and it is reasonable to expect all
+% typewriter fonts to have this, we can check that font parameter.
+%
+\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
+
+% Same as above, but check for italic font. Actually this also catches
+% non-italic slanted fonts since it is impossible to distinguish them from
+% italic fonts. But since this is only used by $ and it uses \sl anyway
+% this is not a problem.
+\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
+
+% Turn off all special characters except @
+% (and those which the user can use as if they were ordinary).
+% Most of these we simply print from the \tt font, but for some, we can
+% use math or other variants that look better in normal text.
+
+\catcode`\"=\active
+\def\activedoublequote{{\tt\char34}}
+\let"=\activedoublequote
+\catcode`\~=\active
+\def~{{\tt\char126}}
+\chardef\hat=`\^
+\catcode`\^=\active
+\def^{{\tt \hat}}
+
+\catcode`\_=\active
+\def_{\ifusingtt\normalunderscore\_}
+\let\realunder=_
+% Subroutine for the previous macro.
+\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
+
+\catcode`\|=\active
+\def|{{\tt\char124}}
+\chardef \less=`\<
+\catcode`\<=\active
+\def<{{\tt \less}}
+\chardef \gtr=`\>
+\catcode`\>=\active
+\def>{{\tt \gtr}}
+\catcode`\+=\active
+\def+{{\tt \char 43}}
+\catcode`\$=\active
+\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
+
+% If a .fmt file is being used, characters that might appear in a file
+% name cannot be active until we have parsed the command line.
+% So turn them off again, and have \everyjob (or @setfilename) turn them on.
+% \otherifyactive is called near the end of this file.
+\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
+
+% Used sometimes to turn off (effectively) the active characters even after
+% parsing them.
+\def\turnoffactive{%
+ \normalturnoffactive
+ \otherbackslash
+}
+
+\catcode`\@=0
+
+% \backslashcurfont outputs one backslash character in current font,
+% as in \char`\\.
+\global\chardef\backslashcurfont=`\\
+\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
+
+% \realbackslash is an actual character `\' with catcode other, and
+% \doublebackslash is two of them (for the pdf outlines).
+{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
+
+% In texinfo, backslash is an active character; it prints the backslash
+% in fixed width font.
+\catcode`\\=\active % @ for escape char from now on.
+
+% The story here is that in math mode, the \char of \backslashcurfont
+% ends up printing the roman \ from the math symbol font (because \char
+% in math mode uses the \mathcode, and plain.tex sets
+% \mathcode`\\="026E). It seems better for @backslashchar{} to always
+% print a typewriter backslash, hence we use an explicit \mathchar,
+% which is the decimal equivalent of "715c (class 7, e.g., use \fam;
+% ignored family value; char position "5C). We can't use " for the
+% usual hex value because it has already been made active.
+@def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
+@let@backslashchar = @normalbackslash % @backslashchar{} is for user documents.
+
+% On startup, @fixbackslash assigns:
+% @let \ = @normalbackslash
+% \rawbackslash defines an active \ to do \backslashcurfont.
+% \otherbackslash defines an active \ to be a literal `\' character with
+% catcode other. We switch back and forth between these.
+@gdef@rawbackslash{@let\=@backslashcurfont}
+@gdef@otherbackslash{@let\=@realbackslash}
+
+% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
+% the literal character `\'.
+%
+@def@normalturnoffactive{%
+ @let"=@normaldoublequote
+ @let$=@normaldollar %$ font-lock fix
+ @let+=@normalplus
+ @let<=@normalless
+ @let>=@normalgreater
+ @let\=@normalbackslash
+ @let^=@normalcaret
+ @let_=@normalunderscore
+ @let|=@normalverticalbar
+ @let~=@normaltilde
+ @markupsetuplqdefault
+ @markupsetuprqdefault
+ @unsepspaces
+}
+
+% Make _ and + \other characters, temporarily.
+% This is canceled by @fixbackslash.
+@otherifyactive
+
+% If a .fmt file is being used, we don't want the `\input texinfo' to show up.
+% That is what \eatinput is for; after that, the `\' should revert to printing
+% a backslash.
+%
+@gdef@eatinput input texinfo{@fixbackslash}
+@global@let\ = @eatinput
+
+% On the other hand, perhaps the file did not have a `\input texinfo'. Then
+% the first `\' in the file would cause an error. This macro tries to fix
+% that, assuming it is called before the first `\' could plausibly occur.
+% Also turn back on active characters that might appear in the input
+% file name, in case not using a pre-dumped format.
+%
+@gdef@fixbackslash{%
+ @ifx\@eatinput @let\ = @normalbackslash @fi
+ @catcode`+=@active
+ @catcode`@_=@active
+}
+
+% Say @foo, not \foo, in error messages.
+@escapechar = `@@
+
+% These (along with & and #) are made active for url-breaking, so need
+% active definitions as the normal characters.
+@def@normaldot{.}
+@def@normalquest{?}
+@def@normalslash{/}
+
+% These look ok in all fonts, so just make them not special.
+% @hashchar{} gets its own user-level command, because of #line.
+@catcode`@& = @other @def@normalamp{&}
+@catcode`@# = @other @def@normalhash{#}
+@catcode`@% = @other @def@normalpercent{%}
+
+@let @hashchar = @normalhash
+
+@c Finally, make ` and ' active, so that txicodequoteundirected and
+@c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
+@c don't make ` and ' active, @code will not get them as active chars.
+@c Do this last of all since we use ` in the previous @catcode assignments.
+@catcode`@'=@active
+@catcode`@`=@active
+@markupsetuplqdefault
+@markupsetuprqdefault
+
+@c Local variables:
+@c eval: (add-hook 'write-file-hooks 'time-stamp)
+@c page-delimiter: "^\\\\message"
+@c time-stamp-start: "def\\\\texinfoversion{"
+@c time-stamp-format: "%:y-%02m-%02d.%02H"
+@c time-stamp-end: "}"
+@c End:
+
+@c vim:sw=2:
+
+@ignore
+ arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115
+@end ignore
diff --git a/config/unlocked-io.m4 b/config/unlocked-io.m4
new file mode 100644
index 0000000..c44adae
--- /dev/null
+++ b/config/unlocked-io.m4
@@ -0,0 +1,41 @@
+# unlocked-io.m4 serial 15
+
+# Copyright (C) 1998-2006, 2009-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+dnl From Jim Meyering.
+dnl
+dnl See if the glibc *_unlocked I/O macros or functions are available.
+dnl Use only those *_unlocked macros or functions that are declared
+dnl (because some of them were declared in Solaris 2.5.1 but were removed
+dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run
+dnl on Solaris 2.6).
+
+AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO],
+[
+ AC_DEFINE([USE_UNLOCKED_IO], [1],
+ [Define to 1 if you want getc etc. to use unlocked I/O if available.
+ Unlocked I/O can improve performance in unithreaded apps,
+ but it is not safe for multithreaded apps.])
+
+ dnl Persuade glibc and Solaris <stdio.h> to declare
+ dnl fgets_unlocked(), fputs_unlocked() etc.
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ AC_CHECK_DECLS_ONCE([clearerr_unlocked])
+ AC_CHECK_DECLS_ONCE([feof_unlocked])
+ AC_CHECK_DECLS_ONCE([ferror_unlocked])
+ AC_CHECK_DECLS_ONCE([fflush_unlocked])
+ AC_CHECK_DECLS_ONCE([fgets_unlocked])
+ AC_CHECK_DECLS_ONCE([fputc_unlocked])
+ AC_CHECK_DECLS_ONCE([fputs_unlocked])
+ AC_CHECK_DECLS_ONCE([fread_unlocked])
+ AC_CHECK_DECLS_ONCE([fwrite_unlocked])
+ AC_CHECK_DECLS_ONCE([getc_unlocked])
+ AC_CHECK_DECLS_ONCE([getchar_unlocked])
+ AC_CHECK_DECLS_ONCE([putc_unlocked])
+ AC_CHECK_DECLS_ONCE([putchar_unlocked])
+])
diff --git a/configure b/configure
new file mode 100755
index 0000000..265240d
--- /dev/null
+++ b/configure
@@ -0,0 +1,19443 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for GNU AutoGen 5.16.2.
+#
+# Report bugs to <autogen-users@lists.sourceforge.net>.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1
+
+ test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+ ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+ PATH=/empty FPATH=/empty; export PATH FPATH
+ test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: autogen-users@lists.sourceforge.net about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='GNU AutoGen'
+PACKAGE_TARNAME='autogen'
+PACKAGE_VERSION='5.16.2'
+PACKAGE_STRING='GNU AutoGen 5.16.2'
+PACKAGE_BUGREPORT='autogen-users@lists.sourceforge.net'
+PACKAGE_URL='http://www.gnu.org/software/autogen/'
+
+ac_unique_file="agen5/autogen.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+CONFIG_SHELL
+INCLIST
+ENABLE_STATIC
+DEBUG_ENABLED
+ac_aux_dir
+AG_TIMEOUT
+CLexe
+GDexe
+AGexe
+CLnam
+GDnam
+AGnam
+M4_SRC
+LIBOBJS
+SUBDIR_SNPRINTFV_FALSE
+SUBDIR_SNPRINTFV_TRUE
+CONVENIENCE_SNPRINTFV_FALSE
+CONVENIENCE_SNPRINTFV_TRUE
+INSTALL_SNPRINTFV_FALSE
+INSTALL_SNPRINTFV_TRUE
+INCSNPRINTFV
+LIBSNPRINTFV
+POSIX_SHELL
+AG_LDFLAGS
+HAVE_XML_LIB_FALSE
+HAVE_XML_LIB_TRUE
+AG_XML2
+LIBXML2_PATH
+LIBXML2_LIBS
+LIBXML2_CFLAGS
+GUILE_VERSION
+AG_GUILE
+LIBGUILE_PATH
+LIBGUILE_LIBS
+LIBGUILE_CFLAGS
+DO_SHELL_CMDS_FALSE
+DO_SHELL_CMDS_TRUE
+AGEN5_TESTS
+OPTS_TESTDIR
+DYNAMIC_AG
+NEED_PATHFIND_FALSE
+NEED_PATHFIND_TRUE
+TEXI2HTML
+GO_AGE
+GO_REVISION
+GO_CURRENT
+AO_TEMPLATE_VERSION
+AO_AGE
+AO_REVISION
+AO_CURRENT
+AG_MINOR_VERSION
+AG_MAJOR_VERSION
+AG_VERSION
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+MANIFEST_TOOL
+RANLIB
+ac_ct_AR
+AR
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+SED
+LIBTOOL
+OBJDUMP
+DLLTOOL
+AS
+EGREP
+GREP
+CPP
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+am__nodep
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_dependency_tracking
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+with_sysroot
+enable_libtool_lock
+with_dmalloc
+enable_shell
+with_libguile
+with_libguile_cflags
+with_libguile_libs
+with_libxml2
+with_libxml2_cflags
+with_libxml2_libs
+enable_debug
+with_packager
+with_packager_version
+with_packager_bug_reports
+with_regex_header
+with_libregex
+with_libregex_cflags
+with_libregex_libs
+enable_optional_args
+enable_snprintfv_install
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures GNU AutoGen 5.16.2 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/autogen]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+ --target=TARGET configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of GNU AutoGen 5.16.2:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-dependency-tracking
+ do not reject slow dependency extractors
+ --disable-dependency-tracking
+ speeds up one-time build
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-static[=PKGS] build static libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ --disable-shell shell scripts are desired
+ --enable-debug wanting autogen debugging
+ --disable-optional-args not wanting optional option args
+ --enable-snprintfv-install install libsnprintfv yes
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-sysroot=DIR Search for dependent libraries within DIR
+ (or the compiler's sysroot if not specified).
+ --with-dmalloc use dmalloc, as in http://www.dmalloc.com
+ --with-libguile libguile installation prefix
+ --with-libguile-cflags libguile compile flags
+ --with-libguile-libs libguile link command arguments
+ --with-libxml2 libxml2 installation prefix
+ --with-libxml2-cflags libxml2 compile flags
+ --with-libxml2-libs libxml2 link command arguments
+ --with-packager name of the packager of this software is supplied
+ --with-packager-version packager-specific version information is supplied
+ --with-packager-bug-reports
+ bug reporting URI/e-mail/etc. is supplied
+ --with-regex-header a reg expr header is specified
+ --with-libregex libregex installation prefix
+ --with-libregex-cflags libregex compile flags
+ --with-libregex-libs libregex link command arguments
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <autogen-users@lists.sourceforge.net>.
+GNU AutoGen home page: <http://www.gnu.org/software/autogen/>.
+General help using GNU software: <http://www.gnu.org/gethelp/>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+GNU AutoGen configure 5.16.2
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## -------------------------------------------------- ##
+## Report this to autogen-users@lists.sourceforge.net ##
+## -------------------------------------------------- ##"
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=no"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid; break
+else
+ as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=$ac_mid; break
+else
+ as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid
+else
+ as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (($2) < 0)
+ {
+ long int i = longval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%ld", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%lu", i);
+ }
+ /* Do not output a trailing newline, as this causes \r\n confusion
+ on some platforms. */
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+ ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+ fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by GNU AutoGen $as_me 5.16.2, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+ac_aux_dir=
+for ac_dir in config "$srcdir"/config; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if ${ac_cv_target+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$target_alias" = x; then
+ ac_cv_target=$ac_cv_host
+else
+ ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+. $srcdir/VERSION
+d=`dirname $0`
+ag_top_srcdir=`cd $d && pwd`
+ag_top_builddir=`pwd`
+am__api_version='1.12'
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+ alias in your environment" "$LINENO" 5
+ fi
+ if test "$2" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if ${ac_cv_path_mkdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+ done
+IFS=$as_save_IFS
+
+fi
+
+ test -d ./--version && rmdir ./--version
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='autogen'
+ VERSION='5.16.2'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
+
+
+
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+ ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
+if test "x$ac_cv_header_minix_config_h" = xyes; then :
+ MINIX=yes
+else
+ MINIX=
+fi
+
+
+ if test "$MINIX" = yes; then
+
+$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
+
+
+$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
+
+
+$as_echo "#define _MINIX 1" >>confdefs.h
+
+ fi
+
+ case "$host_os" in
+ hpux*)
+
+$as_echo "#define _XOPEN_SOURCE 500" >>confdefs.h
+
+ ;;
+ esac
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
+if ${ac_cv_safe_to_define___extensions__+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+# define __EXTENSIONS__ 1
+ $ac_includes_default
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_safe_to_define___extensions__=yes
+else
+ ac_cv_safe_to_define___extensions__=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+ test $ac_cv_safe_to_define___extensions__ = yes &&
+ $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
+
+ $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
+
+ $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
+
+ $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
+
+ $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
+
+
+enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AS+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AS"; then
+ ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AS="${ac_tool_prefix}as"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AS=$ac_cv_prog_AS
+if test -n "$AS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5
+$as_echo "$AS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AS"; then
+ ac_ct_AS=$AS
+ # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AS+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AS"; then
+ ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AS="as"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AS=$ac_cv_prog_ac_ct_AS
+if test -n "$ac_ct_AS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5
+$as_echo "$ac_ct_AS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AS" = x; then
+ AS="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AS=$ac_ct_AS
+ fi
+else
+ AS="$ac_cv_prog_AS"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DLLTOOL"; then
+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+ ac_ct_DLLTOOL=$DLLTOOL
+ # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DLLTOOL"; then
+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DLLTOOL" = x; then
+ DLLTOOL="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DLLTOOL=$ac_ct_DLLTOOL
+ fi
+else
+ DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+ ;;
+esac
+
+test -z "$AS" && AS=as
+
+
+
+
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+case `pwd` in
+ *\ * | *\ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.4.2'
+macro_revision='1.3337'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+ ECHO='printf %s\n'
+else
+ # Use this function as a fallback that always works.
+ func_fallback_echo ()
+ {
+ eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+ }
+ ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+ $ECHO ""
+}
+
+case "$ECHO" in
+ printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+ print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+ *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ { ac_script=; unset ac_script;}
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if ${ac_cv_path_FGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+ then ac_cv_path_FGREP="$GREP -F"
+ else
+ if test -z "$FGREP"; then
+ ac_path_FGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in fgrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_FGREP" || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+ # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'FGREP' >> "conftest.nl"
+ "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_FGREP="$ac_path_FGREP"
+ ac_path_FGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_FGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_FGREP"; then
+ as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_FGREP=$FGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ case $host in
+ *-*-mingw*)
+ # gcc leaves a trailing carriage return which upsets mingw
+ ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+ *)
+ ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+ esac
+ case $ac_prog in
+ # Accept absolute paths.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname of ld
+ ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+ while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ done
+ test -z "$LD" && LD="$ac_prog"
+ ;;
+ "")
+ # If it fails, then pretend we aren't using GCC.
+ ac_prog=ld
+ ;;
+ *)
+ # If it is relative, then search for the first ld in PATH.
+ with_gnu_ld=unknown
+ ;;
+ esac
+elif test "$with_gnu_ld" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if ${lt_cv_path_NM+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$DUMPBIN"; then :
+ # Let the user override the test.
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in dumpbin "link -dump"
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DUMPBIN"; then
+ ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$DUMPBIN" && break
+ done
+fi
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in dumpbin "link -dump"
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DUMPBIN"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_DUMPBIN" && break
+done
+
+ if test "x$ac_ct_DUMPBIN" = x; then
+ DUMPBIN=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DUMPBIN=$ac_ct_DUMPBIN
+ fi
+fi
+
+ case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+ *COFF*)
+ DUMPBIN="$DUMPBIN -symbols"
+ ;;
+ *)
+ DUMPBIN=:
+ ;;
+ esac
+ fi
+
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if ${lt_cv_nm_interface+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if ${lt_cv_sys_max_cmd_len+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | cegcc*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ mint*)
+ # On MiNT this can take a long time and run out of memory.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ os2*)
+ # The test takes a long time on OS/2.
+ lt_cv_sys_max_cmd_len=8192
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+ = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,b/c, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+ ;;
+ esac
+ ;;
+ *-*-cygwin* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+ ;;
+ *-*-cygwin* )
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+ * ) # otherwise, assume *nix
+ lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+ ;;
+ esac
+ ;;
+ * ) # unhandled hosts (and "normal" native builds)
+ lt_cv_to_host_file_cmd=func_convert_file_noop
+ ;;
+esac
+
+fi
+
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+ *-*-mingw* )
+ case $build in
+ *-*-mingw* ) # actually msys
+ lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+ ;;
+ esac
+ ;;
+esac
+
+fi
+
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if ${lt_cv_ld_reload_flag+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ if test "$GCC" != yes; then
+ reload_cmds=false
+ fi
+ ;;
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if ${lt_cv_deplibs_check_method+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[45]*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+ if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ # Keep this pattern in sync with the one in func_win32_libid.
+ lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc*)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+haiku*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+ case $host_os in
+ mingw* | pw32*)
+ if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+ want_nocaseglob=yes
+ else
+ file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+ fi
+ ;;
+ esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DLLTOOL"; then
+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+ ac_ct_DLLTOOL=$DLLTOOL
+ # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DLLTOOL"; then
+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DLLTOOL" = x; then
+ DLLTOOL="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DLLTOOL=$ac_ct_DLLTOOL
+ fi
+else
+ DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+ # two different shell functions defined in ltmain.sh
+ # decide which to use based on capabilities of $DLLTOOL
+ case `$DLLTOOL --help 2>&1` in
+ *--identify-strict*)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+ ;;
+ *)
+ lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+ ;;
+ esac
+ ;;
+*)
+ # fallback: assume linklib IS sharedlib
+ lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ for ac_prog in ar
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AR" && break
+ done
+fi
+if test -z "$AR"; then
+ ac_ct_AR=$AR
+ for ac_prog in ar
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_AR" && break
+done
+
+ if test "x$ac_ct_AR" = x; then
+ AR="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+fi
+
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ar_at_file=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ echo conftest.$ac_objext > conftest.lst
+ lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+ (eval $lt_ar_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if test "$ac_status" -eq 0; then
+ # Ensure the archiver fails upon bogus file names.
+ rm -f conftest.$ac_objext libconftest.a
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+ (eval $lt_ar_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if test "$ac_status" -ne 0; then
+ lt_cv_ar_at_file=@
+ fi
+ fi
+ rm -f conftest.* libconftest.a
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
+
+if test "x$lt_cv_ar_at_file" = xno; then
+ archiver_list_spec=
+else
+ archiver_list_spec=$lt_cv_ar_at_file
+fi
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
+fi
+
+case $host_os in
+ darwin*)
+ lock_old_archive_extraction=yes ;;
+ *)
+ lock_old_archive_extraction=no ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {last_section=section; section=\$ 3};"\
+" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+ lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+ (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+ relocations are performed -- see ld's documentation on pseudo-relocs. */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data. */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+LT_DLSYM_CONST struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_globsym_save_LIBS=$LIBS
+ lt_globsym_save_CFLAGS=$CFLAGS
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS=$lt_globsym_save_LIBS
+ CFLAGS=$lt_globsym_save_CFLAGS
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+ nm_file_list_spec='@'
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
+
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+ withval=$with_sysroot;
+else
+ with_sysroot=no
+fi
+
+
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+ if test "$GCC" = yes; then
+ lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+ fi
+ ;; #(
+ /*)
+ lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+ ;; #(
+ no|'')
+ ;; #(
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+ as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+ ;;
+esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if ${lt_cv_cc_needs_belf+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_cc_needs_belf=yes
+else
+ lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*)
+ case $host in
+ i?86-*-solaris*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ sparc*-*-solaris*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
+ if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
+ LD="${LD-ld}_sol2"
+ fi
+ ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$MANIFEST_TOOL"; then
+ ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+ ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+ # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_MANIFEST_TOOL"; then
+ ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_MANIFEST_TOOL" = x; then
+ MANIFEST_TOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
+ fi
+else
+ MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
+
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_path_mainfest_tool=no
+ echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+ $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+ cat conftest.err >&5
+ if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+ lt_cv_path_mainfest_tool=yes
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+ MANIFEST_TOOL=:
+fi
+
+
+
+
+
+
+ case $host_os in
+ rhapsody* | darwin*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DSYMUTIL"; then
+ ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+ ac_ct_DSYMUTIL=$DSYMUTIL
+ # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DSYMUTIL"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DSYMUTIL" = x; then
+ DSYMUTIL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ DSYMUTIL=$ac_ct_DSYMUTIL
+ fi
+else
+ DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NMEDIT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NMEDIT"; then
+ ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+ ac_ct_NMEDIT=$NMEDIT
+ # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_NMEDIT"; then
+ ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_NMEDIT="nmedit"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_NMEDIT" = x; then
+ NMEDIT=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ NMEDIT=$ac_ct_NMEDIT
+ fi
+else
+ NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_LIPO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$LIPO"; then
+ ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+ ac_ct_LIPO=$LIPO
+ # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_LIPO"; then
+ ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_LIPO="lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_LIPO" = x; then
+ LIPO=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ LIPO=$ac_ct_LIPO
+ fi
+else
+ LIPO="$ac_cv_prog_LIPO"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL"; then
+ ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+ ac_ct_OTOOL=$OTOOL
+ # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL"; then
+ ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OTOOL="otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL" = x; then
+ OTOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL=$ac_ct_OTOOL
+ fi
+else
+ OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL64+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL64"; then
+ ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+ ac_ct_OTOOL64=$OTOOL64
+ # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL64"; then
+ ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_OTOOL64="otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL64" = x; then
+ OTOOL64=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL64=$ac_ct_OTOOL64
+ fi
+else
+ OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if ${lt_cv_apple_cc_single_mod+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ # If there is a non-empty error log, and "single_module"
+ # appears in it, assume the flag caused a linker warning
+ if test -s conftest.err && $GREP single_module conftest.err; then
+ cat conftest.err >&5
+ # Otherwise, if the output was created with a 0 exit code from
+ # the compiler, it worked.
+ elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_ld_exported_symbols_list=yes
+else
+ lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_force_load=no
+ cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+ $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+ echo "$AR cru libconftest.a conftest.o" >&5
+ $AR cru libconftest.a conftest.o 2>&5
+ echo "$RANLIB libconftest.a" >&5
+ $RANLIB libconftest.a 2>&5
+ cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+ _lt_result=$?
+ if test -s conftest.err && $GREP force_load conftest.err; then
+ cat conftest.err >&5
+ elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+ lt_cv_ld_force_load=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[012]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+
+for ac_header in dlfcn.h
+do :
+ ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+# Set options
+
+
+
+ enable_dlopen=no
+
+
+
+ # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+ enableval=$enable_shared; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+ # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+ enableval=$enable_static; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+ withval=$with_pic; lt_p=${PACKAGE-default}
+ case $withval in
+ yes|no) pic_mode=$withval ;;
+ *)
+ pic_mode=default
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for lt_pkg in $withval; do
+ IFS="$lt_save_ifs"
+ if test "X$lt_pkg" = "X$lt_p"; then
+ pic_mode=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+ # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+ enableval=$enable_fast_install; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if ${lt_cv_objdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ case $cc_basename in
+ nvcc*)
+ lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+ *)
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+ esac
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+
+
+
+
+
+ lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
+ ;;
+
+ haiku*)
+ # PIC is the default for Haiku.
+ # The "-static" flag exists, but is broken.
+ lt_prog_compiler_static=
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+
+ case $cc_basename in
+ nvcc*) # Cuda Compiler Driver 2.2
+ lt_prog_compiler_wl='-Xlinker '
+ if test -n "$lt_prog_compiler_pic"; then
+ lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
+ fi
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='--shared'
+ lt_prog_compiler_static='--static'
+ ;;
+ nagfor*)
+ # NAG Fortran compiler
+ lt_prog_compiler_wl='-Wl,-Wl,,'
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ xl* | bgxl* | bgf* | mpixl*)
+ # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-qpic'
+ lt_prog_compiler_static='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
+ ;;
+ *Sun\ F* | *Sun*Fortran*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Qoption ld '
+ ;;
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ *Intel*\ [CF]*Compiler*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ *Portland\ Group*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+ case $lt_prog_compiler_pic in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
+else
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+ :
+else
+ lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ runpath_var=
+ allow_undefined_flag=
+ always_export_symbols=no
+ archive_cmds=
+ archive_expsym_cmds=
+ compiler_needs_object=no
+ enable_shared_with_static_runtimes=no
+ export_dynamic_flag_spec=
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ hardcode_automatic=no
+ hardcode_direct=no
+ hardcode_direct_absolute=no
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_separator=
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ inherit_rpath=no
+ link_all_deplibs=unknown
+ module_cmds=
+ module_expsym_cmds=
+ old_archive_from_new_cmds=
+ old_archive_from_expsyms_cmds=
+ thread_safe_flag_spec=
+ whole_archive_flag_spec=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # FIXME: the MSVC++ port hasn't been tested in a loooong time
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ if test "$GCC" != yes; then
+ with_gnu_ld=no
+ fi
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ ld_shlibs=yes
+
+ # On some targets, GNU ld is compatible enough with the native linker
+ # that we're better off using the native interface for both.
+ lt_use_gnu_ld_interface=no
+ if test "$with_gnu_ld" = yes; then
+ case $host_os in
+ aix*)
+ # The AIX port of GNU ld has always aspired to compatibility
+ # with the native linker. However, as the warning in the GNU ld
+ # block says, versions before 2.19.5* couldn't really create working
+ # shared libraries, regardless of the interface used.
+ case `$LD -v 2>&1` in
+ *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+ *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+ *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ ;;
+ *)
+ lt_use_gnu_ld_interface=yes
+ ;;
+ esac
+ fi
+
+ if test "$lt_use_gnu_ld_interface" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # Set some defaults for GNU ld with shared library support. These
+ # are reset later if shared libraries are not supported. Putting them
+ # here allows them to be overridden if necessary.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[3-9]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ export_dynamic_flag_spec='${wl}--export-all-symbols'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+ exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ haiku*)
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ link_all_deplibs=yes
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95* | pgfortran*)
+ # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ whole_archive_flag_spec=
+ tmp_sharedflag='--shared' ;;
+ xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ nvcc*) # Cuda Compiler Driver 2.2
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf* | bgf* | bgxlf* | mpixlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ hardcode_direct=unsupported
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" = ia64; then
+ # On IA64, the linker does run time linking by default, so we don't
+ # have to do anything special.
+ aix_use_runtimelinking=no
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ # Also, AIX nm treats weak defined symbols like other global
+ # defined symbols, whereas GNU nm marks them as "W".
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+ # Test if we are trying to use run time linking or normal
+ # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+ # need to do runtime linking.
+ case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ for ld_flag in $LDFLAGS; do
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ file_list_spec='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ collect2name=`${CC} -print-prog-name=collect2`
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+ then
+ # We have reworked collect2
+ :
+ else
+ # We have old collect2
+ hardcode_direct=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ export_dynamic_flag_spec='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath_+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath_
+fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ if test "${lt_cv_aix_libpath+set}" = set; then
+ aix_libpath=$lt_cv_aix_libpath
+else
+ if ${lt_cv_aix_libpath_+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\([^ ]*\) *$/\1/
+ p
+ }
+ }'
+ lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ # Check for a 64-bit object if we didn't find anything.
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ if test -z "$lt_cv_aix_libpath_"; then
+ lt_cv_aix_libpath_="/usr/lib:/lib"
+ fi
+
+fi
+
+ aix_libpath=$lt_cv_aix_libpath_
+fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ if test "$with_gnu_ld" = yes; then
+ # We only use this code for GNU lds that support --whole-archive.
+ whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ else
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ fi
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # When not using gcc, we currently assume that we are using
+ # Microsoft Visual C++.
+ # hardcode_libdir_flag_spec is actually meaningless, as there is
+ # no search path for DLLs.
+ case $cc_basename in
+ cl*)
+ # Native MSVC
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ file_list_spec='@'
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+ else
+ sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+ fi~
+ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+ linknames='
+ # The linker will not automatically build a static lib if we build a DLL.
+ # _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+ enable_shared_with_static_runtimes=yes
+ exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+ # Don't use ranlib
+ old_postinstall_cmds='chmod 644 $oldlib'
+ postlink_cmds='lt_outputfile="@OUTPUT@"~
+ lt_tool_outputfile="@TOOL_OUTPUT@"~
+ case $lt_outputfile in
+ *.exe|*.EXE) ;;
+ *)
+ lt_outputfile="$lt_outputfile.exe"
+ lt_tool_outputfile="$lt_tool_outputfile.exe"
+ ;;
+ esac~
+ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+ $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+ $RM "$lt_outputfile.manifest";
+ fi'
+ ;;
+ *)
+ # Assume MSVC wrapper
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ enable_shared_with_static_runtimes=yes
+ ;;
+ esac
+ ;;
+
+ darwin* | rhapsody*)
+
+
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ if test "$lt_cv_ld_force_load" = "yes"; then
+ whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+
+ else
+ whole_archive_flag_spec=''
+ fi
+ link_all_deplibs=yes
+ allow_undefined_flag="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=func_echo_all
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+ else
+ ld_shlibs=no
+ fi
+
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2.*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+
+ # Older versions of the 11.00 compiler do not understand -b yet
+ # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler__b=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -b"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler__b=yes
+ fi
+ else
+ lt_cv_prog_compiler__b=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ # This should be the same for all languages, so no per-tag cache variable.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo (void) { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_irix_exported_symbol=yes
+else
+ lt_cv_irix_exported_symbol=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+ if test "$lt_cv_irix_exported_symbol" = yes; then
+ archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ fi
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ inherit_rpath=yes
+ link_all_deplibs=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ hardcode_direct_absolute=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ os2*)
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ allow_undefined_flag=unsupported
+ archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_separator=:
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-R,$libdir'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+ (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ then
+ lt_cv_archive_cmds_need_lc=no
+ else
+ lt_cv_archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+ archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ case $host_os in
+ mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+ *) lt_sed_strip_eq="s,=/,/,g" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+ case $lt_search_path_spec in
+ *\;*)
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+ ;;
+ *)
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ esac
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[lt_foo]++; }
+ if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+ # AWK program above erroneously prepends '/' to C:/dos/paths
+ # for these hosts.
+ case $host_os in
+ mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+ $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+ esac
+ sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[4-9]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$cc_basename in
+ yes,*)
+ # gcc
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ ;;
+
+ *,cl*)
+ # Native MSVC
+ libname_spec='$name'
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ library_names_spec='${libname}.dll.lib'
+
+ case $build_os in
+ mingw*)
+ sys_lib_search_path_spec=
+ lt_save_ifs=$IFS
+ IFS=';'
+ for lt_path in $LIB
+ do
+ IFS=$lt_save_ifs
+ # Let DOS variable expansion print the short 8.3 style file name.
+ lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+ sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+ done
+ IFS=$lt_save_ifs
+ # Convert to MSYS style.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+ ;;
+ cygwin*)
+ # Convert to unix form, then to dos form, then back to unix form
+ # but this time dos style (no spaces!) so that the unix form looks
+ # like /cygdrive/c/PROGRA~1:/cygdr...
+ sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+ sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ ;;
+ *)
+ sys_lib_search_path_spec="$LIB"
+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # FIXME: find the short name or the path components, as spaces are
+ # common. (e.g. "Program Files" -> "PROGRA~1")
+ ;;
+ esac
+
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+ dynamic_linker='Win32 link.exe'
+ ;;
+
+ *)
+ # Assume MSVC wrapper
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ dynamic_linker='Win32 ld.exe'
+ ;;
+ esac
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[23].*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2.*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+haiku*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ dynamic_linker="$host_os runtime_loader"
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ postinstall_cmds='chmod 555 $lib'
+ # or fails outright, so override atomically:
+ install_override_mode=555
+ ;;
+
+interix[3-9]*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be glibc/ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+
+ # Some binutils ld are patched to set DT_RUNPATH
+ if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_shlibpath_overrides_runpath=no
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+ lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+fi
+
+ shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux # correct to gnu/linux during the next big refactor
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux # correct to gnu/linux during the next big refactor
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+ test -n "$runpath_var" ||
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+ test "$inherit_rpath" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+
+
+
+
+ if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+
+fi
+
+ ;;
+
+ *)
+ ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = xyes; then :
+ lt_cv_dlopen="shl_load"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if ${ac_cv_lib_dld_shl_load+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_shl_load=yes
+else
+ ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if ${ac_cv_lib_svld_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_svld_dlopen=yes
+else
+ ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if ${ac_cv_lib_dld_dld_link+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dld_dld_link=yes
+else
+ ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self_static+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+ correspondingly for the symbols needed. */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else
+ {
+ if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ else puts (dlerror ());
+ }
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ ;;
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+ # Report which library types will actually be built
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+# From configure.ac Revision: 4.34 .
+config_start_time=`date +%s 2>/dev/null`
+# ----------------------------------------------------------------------
+# Substitute VERSION vars here, so that they can be used by the Makefile
+# ----------------------------------------------------------------------
+
+
+
+
+
+
+AO_TEMPLATE_VERSION=`expr '(' $AO_CURRENT '*' 4096 ')' + $AO_REVISION`
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define AO_CURRENT $AO_CURRENT
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define AO_REVISION $AO_REVISION
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define AO_AGE $AO_AGE
+_ACEOF
+
+# ----------------------------------------------------------------------
+# Set up the environment to configure the snprintv subpackage using
+# this version of AutoGen (as opposed to any installed version).
+# ----------------------------------------------------------------------
+ag_srcdir=`\cd $srcdir && pwd`
+if test x$ag_srcdir != x && test -d $ag_srcdir; then
+ :
+else
+ ag_srcdir=..
+fi
+
+# ----------------------------------------------------------------------
+# If `configure' is invoked (in)directly via `make', ensure that it
+# encounters no `make' conflicts. Ignore error if shell does not have
+# unset, but at least set these to empty values.
+# ----------------------------------------------------------------------
+MFLAGS=
+MAKEFLAGS=
+MAKELEVEL=
+unset MFLAGS MAKEFLAGS MAKELEVEL 2>/dev/null
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if malloc debugging is wanted" >&5
+$as_echo_n "checking if malloc debugging is wanted... " >&6; }
+
+# Check whether --with-dmalloc was given.
+if test "${with_dmalloc+set}" = set; then :
+ withval=$with_dmalloc; if test "$withval" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define WITH_DMALLOC 1" >>confdefs.h
+
+ LIBS="$LIBS -ldmalloc"
+ LDFLAGS="$LDFLAGS -g"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+# ----------------------------------------------------------------------
+# check for various programs used during the build.
+# ----------------------------------------------------------------------
+if test "x$CC" != xcc; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
+$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
+$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
+fi
+set dummy $CC; ac_cc=`$as_echo "$2" |
+ sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+rm -f conftest2.*
+if { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } &&
+ test -f conftest2.$ac_objext && { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; };
+then
+ eval ac_cv_prog_cc_${ac_cc}_c_o=yes
+ if test "x$CC" != xcc; then
+ # Test first that cc exists at all.
+ if { ac_try='cc -c conftest.$ac_ext >&5'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+ rm -f conftest2.*
+ if { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } &&
+ test -f conftest2.$ac_objext && { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; };
+ then
+ # cc works too.
+ :
+ else
+ # cc exists but doesn't like -o.
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
+ fi
+ fi
+ fi
+else
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
+fi
+rm -f core conftest*
+
+fi
+if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
+
+fi
+
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+
+
+ case $ac_cv_prog_cc_stdc in #(
+ no) :
+ ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #(
+ *) :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
+$as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
+if ${ac_cv_prog_cc_c99+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c99=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <stdio.h>
+
+// Check varargs macros. These examples are taken from C99 6.10.3.5.
+#define debug(...) fprintf (stderr, __VA_ARGS__)
+#define showlist(...) puts (#__VA_ARGS__)
+#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
+static void
+test_varargs_macros (void)
+{
+ int x = 1234;
+ int y = 5678;
+ debug ("Flag");
+ debug ("X = %d\n", x);
+ showlist (The first, second, and third items.);
+ report (x>y, "x is %d but y is %d", x, y);
+}
+
+// Check long long types.
+#define BIG64 18446744073709551615ull
+#define BIG32 4294967295ul
+#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
+#if !BIG_OK
+ your preprocessor is broken;
+#endif
+#if BIG_OK
+#else
+ your preprocessor is broken;
+#endif
+static long long int bignum = -9223372036854775807LL;
+static unsigned long long int ubignum = BIG64;
+
+struct incomplete_array
+{
+ int datasize;
+ double data[];
+};
+
+struct named_init {
+ int number;
+ const wchar_t *name;
+ double average;
+};
+
+typedef const char *ccp;
+
+static inline int
+test_restrict (ccp restrict text)
+{
+ // See if C++-style comments work.
+ // Iterate through items via the restricted pointer.
+ // Also check for declarations in for loops.
+ for (unsigned int i = 0; *(text+i) != '\0'; ++i)
+ continue;
+ return 0;
+}
+
+// Check varargs and va_copy.
+static void
+test_varargs (const char *format, ...)
+{
+ va_list args;
+ va_start (args, format);
+ va_list args_copy;
+ va_copy (args_copy, args);
+
+ const char *str;
+ int number;
+ float fnumber;
+
+ while (*format)
+ {
+ switch (*format++)
+ {
+ case 's': // string
+ str = va_arg (args_copy, const char *);
+ break;
+ case 'd': // int
+ number = va_arg (args_copy, int);
+ break;
+ case 'f': // float
+ fnumber = va_arg (args_copy, double);
+ break;
+ default:
+ break;
+ }
+ }
+ va_end (args_copy);
+ va_end (args);
+}
+
+int
+main ()
+{
+
+ // Check bool.
+ _Bool success = false;
+
+ // Check restrict.
+ if (test_restrict ("String literal") == 0)
+ success = true;
+ char *restrict newvar = "Another string";
+
+ // Check varargs.
+ test_varargs ("s, d' f .", "string", 65, 34.234);
+ test_varargs_macros ();
+
+ // Check flexible array members.
+ struct incomplete_array *ia =
+ malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
+ ia->datasize = 10;
+ for (int i = 0; i < ia->datasize; ++i)
+ ia->data[i] = i * 1.234;
+
+ // Check named initializers.
+ struct named_init ni = {
+ .number = 34,
+ .name = L"Test wide string",
+ .average = 543.34343,
+ };
+
+ ni.number = 58;
+
+ int dynamic_array[ni.number];
+ dynamic_array[ni.number - 1] = 543;
+
+ // work around unused variable warnings
+ return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
+ || dynamic_array[ni.number - 1] != 543);
+
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c99=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c99" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c99" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c99"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
+$as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c99" != xno; then :
+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+ ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
+else
+ ac_cv_prog_cc_stdc=no
+fi
+
+fi
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5
+$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; }
+ if ${ac_cv_prog_cc_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+
+ case $ac_cv_prog_cc_stdc in #(
+ no) :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;; #(
+ '') :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;; #(
+ *) :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5
+$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;;
+esac
+
+
+
+
+
+
+
+
+ ac_fn_c_check_decl "$LINENO" "clearerr_unlocked" "ac_cv_have_decl_clearerr_unlocked" "$ac_includes_default"
+if test "x$ac_cv_have_decl_clearerr_unlocked" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_CLEARERR_UNLOCKED $ac_have_decl
+_ACEOF
+
+
+
+ ac_fn_c_check_decl "$LINENO" "feof_unlocked" "ac_cv_have_decl_feof_unlocked" "$ac_includes_default"
+if test "x$ac_cv_have_decl_feof_unlocked" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FEOF_UNLOCKED $ac_have_decl
+_ACEOF
+
+
+
+ ac_fn_c_check_decl "$LINENO" "ferror_unlocked" "ac_cv_have_decl_ferror_unlocked" "$ac_includes_default"
+if test "x$ac_cv_have_decl_ferror_unlocked" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FERROR_UNLOCKED $ac_have_decl
+_ACEOF
+
+
+
+ ac_fn_c_check_decl "$LINENO" "fflush_unlocked" "ac_cv_have_decl_fflush_unlocked" "$ac_includes_default"
+if test "x$ac_cv_have_decl_fflush_unlocked" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FFLUSH_UNLOCKED $ac_have_decl
+_ACEOF
+
+
+
+ ac_fn_c_check_decl "$LINENO" "fgets_unlocked" "ac_cv_have_decl_fgets_unlocked" "$ac_includes_default"
+if test "x$ac_cv_have_decl_fgets_unlocked" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FGETS_UNLOCKED $ac_have_decl
+_ACEOF
+
+
+
+ ac_fn_c_check_decl "$LINENO" "fputc_unlocked" "ac_cv_have_decl_fputc_unlocked" "$ac_includes_default"
+if test "x$ac_cv_have_decl_fputc_unlocked" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FPUTC_UNLOCKED $ac_have_decl
+_ACEOF
+
+
+
+ ac_fn_c_check_decl "$LINENO" "fputs_unlocked" "ac_cv_have_decl_fputs_unlocked" "$ac_includes_default"
+if test "x$ac_cv_have_decl_fputs_unlocked" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FPUTS_UNLOCKED $ac_have_decl
+_ACEOF
+
+
+
+ ac_fn_c_check_decl "$LINENO" "fread_unlocked" "ac_cv_have_decl_fread_unlocked" "$ac_includes_default"
+if test "x$ac_cv_have_decl_fread_unlocked" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FREAD_UNLOCKED $ac_have_decl
+_ACEOF
+
+
+
+ ac_fn_c_check_decl "$LINENO" "fwrite_unlocked" "ac_cv_have_decl_fwrite_unlocked" "$ac_includes_default"
+if test "x$ac_cv_have_decl_fwrite_unlocked" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FWRITE_UNLOCKED $ac_have_decl
+_ACEOF
+
+
+
+ ac_fn_c_check_decl "$LINENO" "getc_unlocked" "ac_cv_have_decl_getc_unlocked" "$ac_includes_default"
+if test "x$ac_cv_have_decl_getc_unlocked" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_GETC_UNLOCKED $ac_have_decl
+_ACEOF
+
+
+
+ ac_fn_c_check_decl "$LINENO" "getchar_unlocked" "ac_cv_have_decl_getchar_unlocked" "$ac_includes_default"
+if test "x$ac_cv_have_decl_getchar_unlocked" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_GETCHAR_UNLOCKED $ac_have_decl
+_ACEOF
+
+
+
+ ac_fn_c_check_decl "$LINENO" "putc_unlocked" "ac_cv_have_decl_putc_unlocked" "$ac_includes_default"
+if test "x$ac_cv_have_decl_putc_unlocked" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_PUTC_UNLOCKED $ac_have_decl
+_ACEOF
+
+
+
+ ac_fn_c_check_decl "$LINENO" "putchar_unlocked" "ac_cv_have_decl_putchar_unlocked" "$ac_includes_default"
+if test "x$ac_cv_have_decl_putchar_unlocked" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_PUTCHAR_UNLOCKED $ac_have_decl
+_ACEOF
+
+
+
+
+$as_echo "#define USE_UNLOCKED_IO 1" >>confdefs.h
+
+
+
+
+
+ :
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+
+
+
+# Extract the first word of "texi2html", so it can be a program name with args.
+set dummy texi2html; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_TEXI2HTML+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$TEXI2HTML"; then
+ ac_cv_prog_TEXI2HTML="$TEXI2HTML" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_TEXI2HTML="texi2html"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_prog_TEXI2HTML" && ac_cv_prog_TEXI2HTML=":"
+fi
+fi
+TEXI2HTML=$ac_cv_prog_TEXI2HTML
+if test -n "$TEXI2HTML"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEXI2HTML" >&5
+$as_echo "$TEXI2HTML" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if ${ac_cv_c_const+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this sort of thing. */
+ typedef int charset[2];
+ const charset cs = { 0, 0 };
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this sort of thing. */
+ char tx;
+ char *t = &tx;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; } bx;
+ struct s *b = &bx; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_const=yes
+else
+ ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+$as_echo "#define const /**/" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+# ----------------------------------------------------------------------
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+ LIBS="-ldl $LIBS"
+
+fi
+
+# ----------------------------------------------------------------------
+ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
+if test "x$ac_cv_type_mode_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
+$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
+if ${ac_cv_type_uid_t+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "uid_t" >/dev/null 2>&1; then :
+ ac_cv_type_uid_t=yes
+else
+ ac_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
+$as_echo "$ac_cv_type_uid_t" >&6; }
+if test $ac_cv_type_uid_t = no; then
+
+$as_echo "#define uid_t int" >>confdefs.h
+
+
+$as_echo "#define gid_t int" >>confdefs.h
+
+fi
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double with more range or precision than double" >&5
+$as_echo_n "checking for long double with more range or precision than double... " >&6; }
+if ${ac_cv_type_long_double_wider+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <float.h>
+ long double const a[] =
+ {
+ 0.0L, DBL_MIN, DBL_MAX, DBL_EPSILON,
+ LDBL_MIN, LDBL_MAX, LDBL_EPSILON
+ };
+ long double
+ f (long double x)
+ {
+ return ((x + (unsigned long int) 10) * (-1 / x) + a[0]
+ + (x ? f (x) : 'c'));
+ }
+
+int
+main ()
+{
+static int test_array [1 - 2 * !((0 < ((DBL_MAX_EXP < LDBL_MAX_EXP)
+ + (DBL_MANT_DIG < LDBL_MANT_DIG)
+ - (LDBL_MAX_EXP < DBL_MAX_EXP)
+ - (LDBL_MANT_DIG < DBL_MANT_DIG)))
+ && (int) LDBL_EPSILON == 0
+ )];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_type_long_double_wider=yes
+else
+ ac_cv_type_long_double_wider=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_double_wider" >&5
+$as_echo "$ac_cv_type_long_double_wider" >&6; }
+ if test $ac_cv_type_long_double_wider = yes; then
+
+$as_echo "#define HAVE_LONG_DOUBLE_WIDER 1" >>confdefs.h
+
+ fi
+
+ ac_cv_c_long_double=$ac_cv_type_long_double_wider
+ if test $ac_cv_c_long_double = yes; then
+
+$as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h
+
+ fi
+
+if test x$ac_cv_type_long_double = xno; then
+ snv_long_double=double
+else
+ snv_long_double='long double'
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define SNV_LONG_DOUBLE $snv_long_double
+_ACEOF
+
+ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
+if test "x$ac_cv_type_long_long" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LONG_LONG 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "uintmax_t" "ac_cv_type_uintmax_t" "$ac_includes_default"
+if test "x$ac_cv_type_uintmax_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UINTMAX_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_SIZE_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "wchar_t" "ac_cv_type_wchar_t" "$ac_includes_default"
+if test "x$ac_cv_type_wchar_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_WCHAR_T 1
+_ACEOF
+
+
+fi
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char*" >&5
+$as_echo_n "checking size of char*... " >&6; }
+if ${ac_cv_sizeof_charp+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char*))" "ac_cv_sizeof_charp" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_charp" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (char*)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_charp=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_charp" >&5
+$as_echo "$ac_cv_sizeof_charp" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_CHARP $ac_cv_sizeof_charp
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
+$as_echo_n "checking size of int... " >&6; }
+if ${ac_cv_sizeof_int+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_int" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (int)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_int=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
+$as_echo "$ac_cv_sizeof_int" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if ${ac_cv_sizeof_long+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_long" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (long)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_long=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
+$as_echo_n "checking size of short... " >&6; }
+if ${ac_cv_sizeof_short+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_short" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (short)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_short=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
+$as_echo "$ac_cv_sizeof_short" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
+
+
+# ----------------------------------------------------------------------
+for ac_func in strchr strlcpy snprintf dlopen
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing copysign" >&5
+$as_echo_n "checking for library containing copysign... " >&6; }
+if ${ac_cv_search_copysign+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char copysign ();
+int
+main ()
+{
+return copysign ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' m; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_copysign=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_copysign+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_copysign+:} false; then :
+
+else
+ ac_cv_search_copysign=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_copysign" >&5
+$as_echo "$ac_cv_search_copysign" >&6; }
+ac_res=$ac_cv_search_copysign
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+$as_echo "#define HAVE_COPYSIGN 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing copysignl" >&5
+$as_echo_n "checking for library containing copysignl... " >&6; }
+if ${ac_cv_search_copysignl+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char copysignl ();
+int
+main ()
+{
+return copysignl ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' m; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_copysignl=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_copysignl+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_copysignl+:} false; then :
+
+else
+ ac_cv_search_copysignl=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_copysignl" >&5
+$as_echo "$ac_cv_search_copysignl" >&6; }
+ac_res=$ac_cv_search_copysignl
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+$as_echo "#define HAVE_COPYSIGNL 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing modfl" >&5
+$as_echo_n "checking for library containing modfl... " >&6; }
+if ${ac_cv_search_modfl+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char modfl ();
+int
+main ()
+{
+return modfl ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' m; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_modfl=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_modfl+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_modfl+:} false; then :
+
+else
+ ac_cv_search_modfl=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_modfl" >&5
+$as_echo "$ac_cv_search_modfl" >&6; }
+ac_res=$ac_cv_search_modfl
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+$as_echo "#define HAVE_MODFL 1" >>confdefs.h
+
+fi
+
+
+# ----------------------------------------------------------------------
+# Check for the functions needed from libgen and libdl
+# ----------------------------------------------------------------------
+
+ if test X$ac_cv_func_pathfind = Xyes; then
+ NEED_PATHFIND_TRUE=
+ NEED_PATHFIND_FALSE='#'
+else
+ NEED_PATHFIND_TRUE='#'
+ NEED_PATHFIND_FALSE=
+fi
+
+if test X$ac_cv_func_dlopen = Xyes
+then DYNAMIC_AG=-export-dynamic
+else DYNAMIC_AG=""
+fi
+
+
+# ----------------------------------------------------------------------
+# Do all our own macros
+# ----------------------------------------------------------------------
+
+
+ ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+ as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
+$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
+if eval \${$as_ac_Header+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$ac_hdr>
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$as_ac_Header=yes"
+else
+ eval "$as_ac_Header=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$as_ac_Header
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
+fi
+
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if ${ac_cv_search_opendir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' dir; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_opendir+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_opendir+:} false; then :
+
+else
+ ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if ${ac_cv_search_opendir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' x; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if ${ac_cv_search_opendir+:} false; then :
+ break
+fi
+done
+if ${ac_cv_search_opendir+:} false; then :
+
+else
+ ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+fi
+
+
+ # =================
+ # AC_CHECK_HEADERS
+ # =================
+ for ac_header in \
+ sys/mman.h sys/param.h sys/poll.h sys/procset.h \
+ sys/select.h sys/socket.h sys/stropts.h sys/time.h \
+ sys/un.h sys/wait.h dlfcn.h errno.h \
+ fcntl.h libgen.h memory.h netinet/in.h \
+ setjmp.h stdbool.h sysexits.h unistd.h \
+ utime.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+ for ac_header in stdarg.h varargs.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ lo_have_arg_hdr=true;break
+else
+ lo_have_arg_hdr=false
+fi
+
+done
+
+
+ for ac_header in string.h strings.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ lo_have_str_hdr=true;break
+else
+ lo_have_str_hdr=false
+fi
+
+done
+
+
+ for ac_header in limits.h sys/limits.h values.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ lo_have_lim_hdr=true;break
+else
+ lo_have_lim_hdr=false
+fi
+
+done
+
+
+ for ac_header in inttypes.h stdint.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ lo_have_typ_hdr=true;break
+else
+ lo_have_typ_hdr=false
+fi
+
+done
+
+
+ # ----------------------------------------------------------------------
+ # check for various programs used during the build.
+ # On OS/X, "wchar.h" needs "runetype.h" to work properly.
+ # ----------------------------------------------------------------------
+ for ac_header in runetype.h wchar.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "
+ $ac_includes_default
+ #if HAVE_RUNETYPE_H
+ # include <runetype.h>
+ #endif
+
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+ # --------------------------------------------
+ # Verify certain entries from AC_CHECK_HEADERS
+ # --------------------------------------------
+ for f in sys_types sys_mman sys_param sys_stat sys_wait \
+ string errno stdlib memory setjmp
+ do eval as_ac_var=\${ac_cv_header_${f}_h+set}
+ test "${as_ac_var}" = set || {
+ as_fn_error $? "you must have ${f}.h on your system" "$LINENO" 5
+ }
+ done
+
+ ${lo_have_arg_hdr} || \
+ as_fn_error $? "you must have stdarg.h or varargs.h on your system" "$LINENO" 5
+
+ ${lo_have_str_hdr} || \
+ as_fn_error $? "you must have string.h or strings.h on your system" "$LINENO" 5
+
+ ${lo_have_lim_hdr} || \
+ as_fn_error $? "you must have one of limits.h, sys/limits.h or values.h" "$LINENO" 5
+
+ ${lo_have_typ_hdr} || \
+ as_fn_error $? "you must have inttypes.h or stdint.h on your system" "$LINENO" 5
+
+ # ----------------------------------------------------------------------
+ # Checks for typedefs
+ # ----------------------------------------------------------------------
+ ac_fn_c_check_type "$LINENO" "wchar_t" "ac_cv_type_wchar_t" "$ac_includes_default"
+if test "x$ac_cv_type_wchar_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_WCHAR_T 1
+_ACEOF
+
+
+fi
+
+ ac_fn_c_check_type "$LINENO" "wint_t" "ac_cv_type_wint_t" "
+ $ac_includes_default
+ #if HAVE_RUNETYPE_H
+ # include <runetype.h>
+ #endif
+ #if HAVE_WCHAR_H
+ # include <wchar.h>
+ #endif
+
+"
+if test "x$ac_cv_type_wint_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_WINT_T 1
+_ACEOF
+
+
+fi
+
+ ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default"
+if test "x$ac_cv_type_int8_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_INT8_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default"
+if test "x$ac_cv_type_uint8_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UINT8_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default"
+if test "x$ac_cv_type_int16_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_INT16_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default"
+if test "x$ac_cv_type_uint16_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UINT16_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default"
+if test "x$ac_cv_type_int32_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_INT32_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default"
+if test "x$ac_cv_type_uint32_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UINT32_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
+if test "x$ac_cv_type_intptr_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_INTPTR_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "$ac_includes_default"
+if test "x$ac_cv_type_uintptr_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UINTPTR_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "uint_t" "ac_cv_type_uint_t" "$ac_includes_default"
+if test "x$ac_cv_type_uint_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UINT_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_PID_T 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_SIZE_T 1
+_ACEOF
+
+
+fi
+
+ # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char*" >&5
+$as_echo_n "checking size of char*... " >&6; }
+if ${ac_cv_sizeof_charp+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char*))" "ac_cv_sizeof_charp" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_charp" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (char*)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_charp=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_charp" >&5
+$as_echo "$ac_cv_sizeof_charp" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_CHARP $ac_cv_sizeof_charp
+_ACEOF
+
+
+ # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
+$as_echo_n "checking size of int... " >&6; }
+if ${ac_cv_sizeof_int+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_int" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (int)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_int=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
+$as_echo "$ac_cv_sizeof_int" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+ # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if ${ac_cv_sizeof_long+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_long" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (long)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_long=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+
+ # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
+$as_echo_n "checking size of short... " >&6; }
+if ${ac_cv_sizeof_short+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_short" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (short)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_short=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
+$as_echo "$ac_cv_sizeof_short" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
+
+
+
+ # ----------------------------------------------------------------------
+ # AC_CHECK_LIB for SVR4 libgen, and use it if it defines pathfind.
+ # ----------------------------------------------------------------------
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pathfind in -lgen" >&5
+$as_echo_n "checking for pathfind in -lgen... " >&6; }
+if ${ac_cv_lib_gen_pathfind+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lgen $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pathfind ();
+int
+main ()
+{
+return pathfind ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_gen_pathfind=yes
+else
+ ac_cv_lib_gen_pathfind=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_pathfind" >&5
+$as_echo "$ac_cv_lib_gen_pathfind" >&6; }
+if test "x$ac_cv_lib_gen_pathfind" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBGEN 1
+_ACEOF
+
+ LIBS="-lgen $LIBS"
+
+fi
+
+ for ac_func in vprintf
+do :
+ ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf"
+if test "x$ac_cv_func_vprintf" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_VPRINTF 1
+_ACEOF
+
+ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt"
+if test "x$ac_cv_func__doprnt" = xyes; then :
+
+$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h
+
+fi
+
+fi
+done
+
+
+ for ac_header in vfork.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
+if test "x$ac_cv_header_vfork_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_VFORK_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_func in fork vfork
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+if test "x$ac_cv_func_fork" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5
+$as_echo_n "checking for working fork... " >&6; }
+if ${ac_cv_func_fork_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_fork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* By Ruediger Kuhlmann. */
+ return fork () < 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_fork_works=yes
+else
+ ac_cv_func_fork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5
+$as_echo "$ac_cv_func_fork_works" >&6; }
+
+else
+ ac_cv_func_fork_works=$ac_cv_func_fork
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+ case $host in
+ *-*-amigaos* | *-*-msdosdjgpp*)
+ # Override, as these systems have only a dummy fork() stub
+ ac_cv_func_fork_works=no
+ ;;
+ *)
+ ac_cv_func_fork_works=yes
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
+fi
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+if test "x$ac_cv_func_vfork" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5
+$as_echo_n "checking for working vfork... " >&6; }
+if ${ac_cv_func_vfork_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_vfork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Thanks to Paul Eggert for this test. */
+$ac_includes_default
+#include <sys/wait.h>
+#ifdef HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+ argument registers are propagated back to the parent. The compiler
+ is told about this with #include <vfork.h>, but some compilers
+ (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a
+ static variable whose address is put into a register that is
+ clobbered by the vfork. */
+static void
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
+{
+ static pid_t child;
+ if (!child) {
+ child = vfork ();
+ if (child < 0) {
+ perror ("vfork");
+ _exit(2);
+ }
+ if (!child) {
+ arg = getpid();
+ write(-1, "", 0);
+ _exit (arg);
+ }
+ }
+}
+
+int
+main ()
+{
+ pid_t parent = getpid ();
+ pid_t child;
+
+ sparc_address_test (0);
+
+ child = vfork ();
+
+ if (child == 0) {
+ /* Here is another test for sparc vfork register problems. This
+ test uses lots of local variables, at least as many local
+ variables as main has allocated so far including compiler
+ temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris
+ 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should
+ reuse the register of parent for one of the local variables,
+ since it will think that parent can't possibly be used any more
+ in this routine. Assigning to the local variable will thus
+ munge parent in the parent process. */
+ pid_t
+ p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+ p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+ /* Convince the compiler that p..p7 are live; otherwise, it might
+ use the same hardware register for all 8 local variables. */
+ if (p != p1 || p != p2 || p != p3 || p != p4
+ || p != p5 || p != p6 || p != p7)
+ _exit(1);
+
+ /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+ from child file descriptors. If the child closes a descriptor
+ before it execs or exits, this munges the parent's descriptor
+ as well. Test for this by closing stdout in the child. */
+ _exit(close(fileno(stdout)) != 0);
+ } else {
+ int status;
+ struct stat st;
+
+ while (wait(&status) != child)
+ ;
+ return (
+ /* Was there some problem with vforking? */
+ child < 0
+
+ /* Did the child fail? (This shouldn't happen.) */
+ || status
+
+ /* Did the vfork/compiler bug occur? */
+ || parent != getpid()
+
+ /* Did the file descriptor bug occur? */
+ || fstat(fileno(stdout), &st) != 0
+ );
+ }
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_vfork_works=yes
+else
+ ac_cv_func_vfork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5
+$as_echo "$ac_cv_func_vfork_works" >&6; }
+
+fi;
+if test "x$ac_cv_func_fork_works" = xcross; then
+ ac_cv_func_vfork_works=$ac_cv_func_vfork
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
+fi
+
+if test "x$ac_cv_func_vfork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
+
+else
+
+$as_echo "#define vfork fork" >>confdefs.h
+
+fi
+if test "x$ac_cv_func_fork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
+
+fi
+
+ for ac_func in mmap canonicalize_file_name snprintf strdup strchr \
+ strrchr strsignal fchmod fstat chmod
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ { ac_script=; unset ac_script;}
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_SED" || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+ while :
+ do
+ POSIX_SHELL=`which bash`
+ test -x "$POSIX_SHELL" && break
+ POSIX_SHELL=`which dash`
+ test -x "$POSIX_SHELL" && break
+ POSIX_SHELL=/usr/xpg4/bin/sh
+ test -x "$POSIX_SHELL" && break
+ POSIX_SHELL=`/bin/sh -c '
+ exec 2>/dev/null
+ if ! true ; then exit 1 ; fi
+ echo /bin/sh'`
+ test -x "$POSIX_SHELL" && break
+ as_fn_error $? "cannot locate a working POSIX shell" "$LINENO" 5
+ done
+
+cat >>confdefs.h <<_ACEOF
+#define POSIX_SHELL "${POSIX_SHELL}"
+_ACEOF
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5
+$as_echo_n "checking for unsigned long long int... " >&6; }
+if ${ac_cv_type_unsigned_long_long_int+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_unsigned_long_long_int=yes
+ if test "x${ac_cv_prog_cc_c99-no}" = xno; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ /* For now, do not test the preprocessor; as of 2007 there are too many
+ implementations with broken preprocessors. Perhaps this can
+ be revisited in 2012. In the meantime, code should not expect
+ #if to work with literals wider than 32 bits. */
+ /* Test literals. */
+ long long int ll = 9223372036854775807ll;
+ long long int nll = -9223372036854775807LL;
+ unsigned long long int ull = 18446744073709551615ULL;
+ /* Test constant expressions. */
+ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
+ ? 1 : -1)];
+ typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
+ ? 1 : -1)];
+ int i = 63;
+int
+main ()
+{
+/* Test availability of runtime routines for shift and division. */
+ long long int llmax = 9223372036854775807ll;
+ unsigned long long int ullmax = 18446744073709551615ull;
+ return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
+ | (llmax / ll) | (llmax % ll)
+ | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+ | (ullmax / ull) | (ullmax % ull));
+ ;
+ return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+else
+ ac_cv_type_unsigned_long_long_int=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5
+$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; }
+ if test $ac_cv_type_unsigned_long_long_int = yes; then
+
+$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h
+
+ fi
+
+
+ # Check to see if shell scripts are desired.
+
+ # Check whether --enable-shell was given.
+if test "${enable_shell+set}" = set; then :
+ enableval=$enable_shell; ag_cv_enable_shell=${enable_shell}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether shell scripts are desired" >&5
+$as_echo_n "checking whether shell scripts are desired... " >&6; }
+if ${ag_cv_enable_shell+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ag_cv_enable_shell=yes
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ag_cv_enable_shell" >&5
+$as_echo "$ag_cv_enable_shell" >&6; }
+
+fi
+ # end of AC_ARG_ENABLE
+ if test "X${ag_cv_enable_shell}" != Xno
+ then
+ for ac_header in vfork.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
+if test "x$ac_cv_header_vfork_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_VFORK_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_func in fork vfork
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+if test "x$ac_cv_func_fork" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5
+$as_echo_n "checking for working fork... " >&6; }
+if ${ac_cv_func_fork_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_fork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* By Ruediger Kuhlmann. */
+ return fork () < 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_fork_works=yes
+else
+ ac_cv_func_fork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5
+$as_echo "$ac_cv_func_fork_works" >&6; }
+
+else
+ ac_cv_func_fork_works=$ac_cv_func_fork
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+ case $host in
+ *-*-amigaos* | *-*-msdosdjgpp*)
+ # Override, as these systems have only a dummy fork() stub
+ ac_cv_func_fork_works=no
+ ;;
+ *)
+ ac_cv_func_fork_works=yes
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
+fi
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+if test "x$ac_cv_func_vfork" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5
+$as_echo_n "checking for working vfork... " >&6; }
+if ${ac_cv_func_vfork_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_vfork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Thanks to Paul Eggert for this test. */
+$ac_includes_default
+#include <sys/wait.h>
+#ifdef HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+ argument registers are propagated back to the parent. The compiler
+ is told about this with #include <vfork.h>, but some compilers
+ (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a
+ static variable whose address is put into a register that is
+ clobbered by the vfork. */
+static void
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
+{
+ static pid_t child;
+ if (!child) {
+ child = vfork ();
+ if (child < 0) {
+ perror ("vfork");
+ _exit(2);
+ }
+ if (!child) {
+ arg = getpid();
+ write(-1, "", 0);
+ _exit (arg);
+ }
+ }
+}
+
+int
+main ()
+{
+ pid_t parent = getpid ();
+ pid_t child;
+
+ sparc_address_test (0);
+
+ child = vfork ();
+
+ if (child == 0) {
+ /* Here is another test for sparc vfork register problems. This
+ test uses lots of local variables, at least as many local
+ variables as main has allocated so far including compiler
+ temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris
+ 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should
+ reuse the register of parent for one of the local variables,
+ since it will think that parent can't possibly be used any more
+ in this routine. Assigning to the local variable will thus
+ munge parent in the parent process. */
+ pid_t
+ p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+ p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+ /* Convince the compiler that p..p7 are live; otherwise, it might
+ use the same hardware register for all 8 local variables. */
+ if (p != p1 || p != p2 || p != p3 || p != p4
+ || p != p5 || p != p6 || p != p7)
+ _exit(1);
+
+ /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+ from child file descriptors. If the child closes a descriptor
+ before it execs or exits, this munges the parent's descriptor
+ as well. Test for this by closing stdout in the child. */
+ _exit(close(fileno(stdout)) != 0);
+ } else {
+ int status;
+ struct stat st;
+
+ while (wait(&status) != child)
+ ;
+ return (
+ /* Was there some problem with vforking? */
+ child < 0
+
+ /* Did the child fail? (This shouldn't happen.) */
+ || status
+
+ /* Did the vfork/compiler bug occur? */
+ || parent != getpid()
+
+ /* Did the file descriptor bug occur? */
+ || fstat(fileno(stdout), &st) != 0
+ );
+ }
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_vfork_works=yes
+else
+ ac_cv_func_vfork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5
+$as_echo "$ac_cv_func_vfork_works" >&6; }
+
+fi;
+if test "x$ac_cv_func_fork_works" = xcross; then
+ ac_cv_func_vfork_works=$ac_cv_func_vfork
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
+fi
+
+if test "x$ac_cv_func_vfork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
+
+else
+
+$as_echo "#define vfork fork" >>confdefs.h
+
+fi
+if test "x$ac_cv_func_fork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
+
+fi
+
+ fi
+
+
+
+ # Check to see if using shell scripts.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether using shell scripts" >&5
+$as_echo_n "checking whether using shell scripts... " >&6; }
+ if ${ag_cv_test_do_shell+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ ag_cv_test_do_shell=`exec 2> /dev/null
+test "x$ac_cv_func_fork_works" != xyes && \\
+ test "x$ac_cv_func_vfork_works" != xyes && exit 1
+test "x$ag_cv_enable_shell" = xyes || exit 1
+echo yes`
+ if test $? -ne 0 || test -z "$ag_cv_test_do_shell"
+ then ag_cv_test_do_shell=no
+ fi
+
+fi
+ # end of CACHE_VAL of ag_cv_test_do_shell
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ag_cv_test_do_shell}" >&5
+$as_echo "${ag_cv_test_do_shell}" >&6; }
+ if test "X${ag_cv_test_do_shell}" != Xno
+ then
+
+
+
+$as_echo "#define SHELL_ENABLED 1" >>confdefs.h
+
+OPTS_TESTDIR=test
+AGEN5_TESTS='$(SHELL_TESTS) $(NOSHELL_TESTS)'
+ else
+ OPTS_TESTDIR=
+AGEN5_TESTS='$(NOSHELL_TESTS)'
+ fi
+ if test "X${ag_cv_test_do_shell}" != Xno; then
+ DO_SHELL_CMDS_TRUE=
+ DO_SHELL_CMDS_FALSE='#'
+else
+ DO_SHELL_CMDS_TRUE='#'
+ DO_SHELL_CMDS_FALSE=
+fi
+
+
+
+
+ # Check to see if setjmp() links okay.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setjmp() links okay" >&5
+$as_echo_n "checking whether setjmp() links okay... " >&6; }
+ if ${ag_cv_link_setjmp+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <setjmp.h>
+int
+main ()
+{
+jmp_buf bf;
+if (setjmp(bf))
+ return 0;
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ag_cv_link_setjmp=yes
+else
+ ag_cv_link_setjmp=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext # end of TRY_LINK
+
+fi
+ # end of AC_CACHE_VAL for ag_cv_link_setjmp
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ag_cv_link_setjmp}" >&5
+$as_echo "${ag_cv_link_setjmp}" >&6; }
+ if test "X${ag_cv_link_setjmp}" != Xno
+ then
+
+$as_echo "#define HAVE_WORKING_SETJMP 1" >>confdefs.h
+
+ fi
+
+
+
+ # Check to see if sigsetjmp() links okay.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sigsetjmp() links okay" >&5
+$as_echo_n "checking whether sigsetjmp() links okay... " >&6; }
+ if ${ag_cv_link_sigsetjmp+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <setjmp.h>
+int
+main ()
+{
+sigjmp_buf bf;
+if (sigsetjmp(bf,0))
+ return 0;
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ag_cv_link_sigsetjmp=yes
+else
+ ag_cv_link_sigsetjmp=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext # end of TRY_LINK
+
+fi
+ # end of AC_CACHE_VAL for ag_cv_link_sigsetjmp
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ag_cv_link_sigsetjmp}" >&5
+$as_echo "${ag_cv_link_sigsetjmp}" >&6; }
+ if test "X${ag_cv_link_sigsetjmp}" != Xno
+ then
+
+$as_echo "#define HAVE_WORKING_SIGSETJMP 1" >>confdefs.h
+
+ fi
+
+
+
+ # Check to see if prefix for a working libguile installation.
+
+
+# Check whether --with-libguile was given.
+if test "${with_libguile+set}" = set; then :
+ withval=$with_libguile; ag_cv_with_libguile_root=${with_libguile}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libguile was specified" >&5
+$as_echo_n "checking whether with-libguile was specified... " >&6; }
+if ${ag_cv_with_libguile_root+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ag_cv_with_libguile_root=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ag_cv_with_libguile_root" >&5
+$as_echo "$ag_cv_with_libguile_root" >&6; }
+
+fi
+ # end of AC_ARG_WITH libguile
+
+ if test "${with_libguile+set}" = set && \
+ test "X${withval}" = Xno
+ then ## disabled by request
+ ag_cv_with_libguile_root=no
+ ag_cv_with_libguile_cflags=no
+ ag_cv_with_libguile_libs=no
+ else
+
+
+# Check whether --with-libguile-cflags was given.
+if test "${with_libguile_cflags+set}" = set; then :
+ withval=$with_libguile_cflags; ag_cv_with_libguile_cflags=${with_libguile_cflags}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libguile-cflags was specified" >&5
+$as_echo_n "checking whether with-libguile-cflags was specified... " >&6; }
+if ${ag_cv_with_libguile_cflags+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ag_cv_with_libguile_cflags=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ag_cv_with_libguile_cflags" >&5
+$as_echo "$ag_cv_with_libguile_cflags" >&6; }
+
+fi
+ # end of AC_ARG_WITH libguile-cflags
+
+
+# Check whether --with-libguile-libs was given.
+if test "${with_libguile_libs+set}" = set; then :
+ withval=$with_libguile_libs; ag_cv_with_libguile_libs=${with_libguile_libs}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libguile-libs was specified" >&5
+$as_echo_n "checking whether with-libguile-libs was specified... " >&6; }
+if ${ag_cv_with_libguile_libs+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ag_cv_with_libguile_libs=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ag_cv_with_libguile_libs" >&5
+$as_echo "$ag_cv_with_libguile_libs" >&6; }
+
+fi
+ # end of AC_ARG_WITH libguile-libs
+
+ case "X${ag_cv_with_libguile_cflags}" in
+ Xyes|Xno|X )
+ case "X${ag_cv_with_libguile_root}" in
+ Xyes|Xno|X ) ag_cv_with_libguile_cflags=no ;;
+ * ) ag_cv_with_libguile_cflags=-I${ag_cv_with_libguile_root}/include ;;
+ esac
+ esac
+ case "X${ag_cv_with_libguile_libs}" in
+ Xyes|Xno|X )
+ case "X${ag_cv_with_libguile_root}" in
+ Xyes|Xno|X ) ag_cv_with_libguile_libs=no ;;
+ * ) ag_cv_with_libguile_libs="-L${ag_cv_with_libguile_root}/lib -lguile";;
+ esac
+ esac
+ ag_save_CPPFLAGS="${CPPFLAGS}"
+ ag_save_LIBS="${LIBS}"
+ case "X${ag_cv_with_libguile_cflags}" in
+ Xyes|Xno|X )
+ f=`guile-config compile 2>/dev/null` || f=''
+ test -n "${f}" && ag_cv_with_libguile_cflags="${f}" && \
+ { $as_echo "$as_me:${as_lineno-$LINENO}: guile-config used for CFLAGS: $f" >&5
+$as_echo "$as_me: guile-config used for CFLAGS: $f" >&6;} ;;
+ esac
+ case "X${ag_cv_with_libguile_libs}" in
+ Xyes|Xno|X )
+ f=`guile-config link 2>/dev/null` || f=''
+ test -n "${f}" && ag_cv_with_libguile_libs="${f}" && \
+ { $as_echo "$as_me:${as_lineno-$LINENO}: guile-config used for LIBS: $f" >&5
+$as_echo "$as_me: guile-config used for LIBS: $f" >&6;} ;;
+ esac
+ fi ## disabled by request
+
+ case "X${ag_cv_with_libguile_cflags}" in
+ Xyes|Xno|X )
+ ag_cv_with_libguile_cflags="" ;;
+ * ) CPPFLAGS="${CPPFLAGS} ${ag_cv_with_libguile_cflags}" ;;
+ esac
+ case "X${ag_cv_with_libguile_libs}" in
+ Xyes|Xno|X )
+ LIBS="${LIBS} -lguile"
+ ag_cv_with_libguile_libs="-lguile" ;;
+ * )
+ LIBS="${LIBS} ${ag_cv_with_libguile_libs}" ;;
+ esac
+ LIBGUILE_CFLAGS=""
+ LIBGUILE_LIBS=""
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libguile can be linked with" >&5
+$as_echo_n "checking whether libguile can be linked with... " >&6; }
+ if ${ag_cv_with_libguile+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <libguile.h>
+#if ((SCM_MAJOR_VERSION * 100) + SCM_MINOR_VERSION) > 200
+This has not been tested with Guile 2.1. Remove this line to proceed.
+#endif
+int main () {
+ SCM fumble = SCM_UNDEFINED;
+ SCM bumble = SCM_UNDEFINED;
+ SCM stumble= SCM_UNDEFINED;
+ long lstumble;
+ stumble = scm_display( fumble, bumble );
+ lstumble = scm_ilength( fumble );
+ stumble = scm_c_eval_string( "stumble" );
+ scm_misc_error( "oops", "bad", bumble );
+ stumble = scm_num_eq_p( fumble, bumble );
+ scm_wrong_type_arg( "oops", 1, bumble );
+ return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ag_cv_with_libguile=yes
+else
+ ag_cv_with_libguile=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext # end of AC_LINK_IFELSE
+
+fi
+ # end of AC_CACHE_VAL for ag_cv_with_libguile
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ag_cv_with_libguile}" >&5
+$as_echo "${ag_cv_with_libguile}" >&6; }
+
+
+
+ if test "X${ag_cv_with_libguile}" != Xno
+ then
+ LIBGUILE_CFLAGS="${ag_cv_with_libguile_cflags}"
+ LIBGUILE_LIBS="${ag_cv_with_libguile_libs}"
+ case "${LIBGUILE_LIBS}" in *-L* )
+ LIBGUILE_PATH=`echo ,${LIBGUILE_LIBS} | sed 's/.*[, ]-L[ ]*//;s/[ ].*//'`
+ ;; * ) LIBGUILE_PATH='' ;; esac
+ CPPFLAGS="${ag_save_CPPFLAGS}"
+ LIBS="${ag_save_LIBS}"
+ else
+ CPPFLAGS="${ag_save_CPPFLAGS}"
+ LIBS="${ag_save_LIBS}"
+ LIBGUILE_CFLAGS=''
+ LIBGUILE_LIBS=''
+ LIBGUILE_PATH=''
+ as_fn_error $? "Cannot find libguile. libguile is required. Perhaps you need to install guile-devel?" "$LINENO" 5
+ fi
+
+
+
+
+ # Check to see if the guile version.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the guile version" >&5
+$as_echo_n "checking whether the guile version... " >&6; }
+ if ${ag_cv_test_guile_version+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ ag_cv_test_guile_version=`exec 2> /dev/null
+pkginfo=\`dpkg --list 2>/dev/null | egrep 'guile-0-9.-dev'\`
+if test -n "${pkginfo}"
+then echo ${pkginfo} | sed -e 's/.*guile-//' -e 's/-dev.*//'
+else
+ v=\`( guile-config --version 2>&1 ) | sed 's/.*Guile version *//'\`
+ test -z "${v}" && v=\`guile --version | sed 's/.*Guile *//;1q'\`
+ test -z "${v}" && exit 1
+ echo ${v}
+fi`
+ if test $? -ne 0 || test -z "$ag_cv_test_guile_version"
+ then ag_cv_test_guile_version=no
+ fi
+
+fi
+ # end of CACHE_VAL of ag_cv_test_guile_version
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ag_cv_test_guile_version}" >&5
+$as_echo "${ag_cv_test_guile_version}" >&6; }
+ if test "X${ag_cv_test_guile_version}" != Xno
+ then
+ set -- `IFS=' .' ; echo ${ag_cv_test_guile_version}`
+i=${3}
+test -z "${i}" && i=0
+GUILE_VERSION=`expr ${1} \* 100000 + ${2} \* 1000 + ${i}`
+
+cat >>confdefs.h <<_ACEOF
+#define GUILE_VERSION ${GUILE_VERSION}
+_ACEOF
+
+
+ else
+ as_fn_error $? "[Cannot determine Guile version number]" "$LINENO" 5
+ fi
+
+
+
+ # Check to see if a working libxml2 can be found.
+
+
+# Check whether --with-libxml2 was given.
+if test "${with_libxml2+set}" = set; then :
+ withval=$with_libxml2; ag_cv_with_libxml2_root=${with_libxml2}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libxml2 was specified" >&5
+$as_echo_n "checking whether with-libxml2 was specified... " >&6; }
+if ${ag_cv_with_libxml2_root+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ag_cv_with_libxml2_root=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ag_cv_with_libxml2_root" >&5
+$as_echo "$ag_cv_with_libxml2_root" >&6; }
+
+fi
+ # end of AC_ARG_WITH libxml2
+
+ if test "${with_libxml2+set}" = set && \
+ test "X${withval}" = Xno
+ then ## disabled by request
+ ag_cv_with_libxml2_root=no
+ ag_cv_with_libxml2_cflags=no
+ ag_cv_with_libxml2_libs=no
+ else
+
+
+# Check whether --with-libxml2-cflags was given.
+if test "${with_libxml2_cflags+set}" = set; then :
+ withval=$with_libxml2_cflags; ag_cv_with_libxml2_cflags=${with_libxml2_cflags}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libxml2-cflags was specified" >&5
+$as_echo_n "checking whether with-libxml2-cflags was specified... " >&6; }
+if ${ag_cv_with_libxml2_cflags+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ag_cv_with_libxml2_cflags=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ag_cv_with_libxml2_cflags" >&5
+$as_echo "$ag_cv_with_libxml2_cflags" >&6; }
+
+fi
+ # end of AC_ARG_WITH libxml2-cflags
+
+
+# Check whether --with-libxml2-libs was given.
+if test "${with_libxml2_libs+set}" = set; then :
+ withval=$with_libxml2_libs; ag_cv_with_libxml2_libs=${with_libxml2_libs}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libxml2-libs was specified" >&5
+$as_echo_n "checking whether with-libxml2-libs was specified... " >&6; }
+if ${ag_cv_with_libxml2_libs+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ag_cv_with_libxml2_libs=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ag_cv_with_libxml2_libs" >&5
+$as_echo "$ag_cv_with_libxml2_libs" >&6; }
+
+fi
+ # end of AC_ARG_WITH libxml2-libs
+
+ case "X${ag_cv_with_libxml2_cflags}" in
+ Xyes|Xno|X )
+ case "X${ag_cv_with_libxml2_root}" in
+ Xyes|Xno|X ) ag_cv_with_libxml2_cflags=no ;;
+ * ) ag_cv_with_libxml2_cflags=-I${ag_cv_with_libxml2_root}/include ;;
+ esac
+ esac
+ case "X${ag_cv_with_libxml2_libs}" in
+ Xyes|Xno|X )
+ case "X${ag_cv_with_libxml2_root}" in
+ Xyes|Xno|X ) ag_cv_with_libxml2_libs=no ;;
+ * ) ag_cv_with_libxml2_libs="-L${ag_cv_with_libxml2_root}/lib -lxml2";;
+ esac
+ esac
+ ag_save_CPPFLAGS="${CPPFLAGS}"
+ ag_save_LIBS="${LIBS}"
+ case "X${ag_cv_with_libxml2_cflags}" in
+ Xyes|Xno|X )
+ f=`xml2-config --cflags 2>/dev/null` || f=''
+ test -n "${f}" && ag_cv_with_libxml2_cflags="${f}" && \
+ { $as_echo "$as_me:${as_lineno-$LINENO}: xml2-config used for CFLAGS: $f" >&5
+$as_echo "$as_me: xml2-config used for CFLAGS: $f" >&6;} ;;
+ esac
+ case "X${ag_cv_with_libxml2_libs}" in
+ Xyes|Xno|X )
+ f=`xml2-config --libs 2>/dev/null` || f=''
+ test -n "${f}" && ag_cv_with_libxml2_libs="${f}" && \
+ { $as_echo "$as_me:${as_lineno-$LINENO}: xml2-config used for LIBS: $f" >&5
+$as_echo "$as_me: xml2-config used for LIBS: $f" >&6;} ;;
+ esac
+ fi ## disabled by request
+
+ case "X${ag_cv_with_libxml2_cflags}" in
+ Xyes|Xno|X )
+ ag_cv_with_libxml2_cflags="" ;;
+ * ) CPPFLAGS="${CPPFLAGS} ${ag_cv_with_libxml2_cflags}" ;;
+ esac
+ case "X${ag_cv_with_libxml2_libs}" in
+ Xyes|Xno|X )
+ LIBS="${LIBS} -lxml2"
+ ag_cv_with_libxml2_libs="-lxml2" ;;
+ * )
+ LIBS="${LIBS} ${ag_cv_with_libxml2_libs}" ;;
+ esac
+ LIBXML2_CFLAGS=""
+ LIBXML2_LIBS=""
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libxml2 can be linked with" >&5
+$as_echo_n "checking whether libxml2 can be linked with... " >&6; }
+ if ${ag_cv_with_libxml2+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+int main () {
+xmlDocPtr p = xmlParseFile( "mumble.xml" ); }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ag_cv_with_libxml2=yes
+else
+ ag_cv_with_libxml2=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext # end of AC_LINK_IFELSE
+
+fi
+ # end of AC_CACHE_VAL for ag_cv_with_libxml2
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ag_cv_with_libxml2}" >&5
+$as_echo "${ag_cv_with_libxml2}" >&6; }
+
+
+
+ if test "X${ag_cv_with_libxml2}" != Xno
+ then
+ LIBXML2_CFLAGS="${ag_cv_with_libxml2_cflags}"
+ LIBXML2_LIBS="${ag_cv_with_libxml2_libs}"
+ case "${LIBXML2_LIBS}" in *-L* )
+ LIBXML2_PATH=`echo ,${LIBXML2_LIBS} | sed 's/.*[, ]-L[ ]*//;s/[ ].*//'`
+ ;; * ) LIBXML2_PATH='' ;; esac
+ CPPFLAGS="${ag_save_CPPFLAGS}"
+ LIBS="${ag_save_LIBS}"
+
+ else
+ CPPFLAGS="${ag_save_CPPFLAGS}"
+ LIBS="${ag_save_LIBS}"
+ LIBXML2_CFLAGS=''
+ LIBXML2_LIBS=''
+ LIBXML2_PATH=''
+ fi
+
+ if test "X${ag_cv_with_libxml2}" != Xno; then
+ HAVE_XML_LIB_TRUE=
+ HAVE_XML_LIB_FALSE='#'
+else
+ HAVE_XML_LIB_TRUE='#'
+ HAVE_XML_LIB_FALSE=
+fi
+
+
+
+
+ # Check to see if sysinfo(2) is Solaris.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sysinfo(2) is Solaris" >&5
+$as_echo_n "checking whether sysinfo(2) is Solaris... " >&6; }
+ if ${ag_cv_run_solaris_sysinfo+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test "$cross_compiling" = yes; then :
+ ag_cv_run_solaris_sysinfo=no
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/systeminfo.h>
+int main() { char z[ 256 ];
+long sz = sysinfo(SI_SYSNAME, z, sizeof(z));
+return (sz > 0) ? 0 : 1; }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ag_cv_run_solaris_sysinfo=yes
+else
+ ag_cv_run_solaris_sysinfo=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+ # end of RUN_IFELSE
+
+fi
+ # end of AC_CACHE_VAL for ag_cv_run_solaris_sysinfo
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ag_cv_run_solaris_sysinfo}" >&5
+$as_echo "${ag_cv_run_solaris_sysinfo}" >&6; }
+ if test "X${ag_cv_run_solaris_sysinfo}" != Xno
+ then
+
+$as_echo "#define HAVE_SOLARIS_SYSINFO 1" >>confdefs.h
+
+ fi
+
+
+
+ # Check to see if strcspn matches prototype and works.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strcspn matches prototype and works" >&5
+$as_echo_n "checking whether strcspn matches prototype and works... " >&6; }
+ if ${ag_cv_run_strcspn+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test "$cross_compiling" = yes; then :
+ ag_cv_run_strcspn=no
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+int main (int argc, char** argv) {
+ char zRej[] = reject;
+ char zAcc[] = "a-ok-eject";
+ return strcspn( zAcc, zRej ) - 5;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ag_cv_run_strcspn=yes
+else
+ ag_cv_run_strcspn=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+ # end of RUN_IFELSE
+
+fi
+ # end of AC_CACHE_VAL for ag_cv_run_strcspn
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ag_cv_run_strcspn}" >&5
+$as_echo "${ag_cv_run_strcspn}" >&6; }
+ if test "X${ag_cv_run_strcspn}" != Xno
+ then
+
+$as_echo "#define HAVE_STRCSPN 1" >>confdefs.h
+
+ else
+ COMPATOBJ="$COMPATOBJ strcspn.lo"
+ fi
+
+
+
+ # Check to see if uname(2) is POSIX.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether uname(2) is POSIX" >&5
+$as_echo_n "checking whether uname(2) is POSIX... " >&6; }
+ if ${ag_cv_run_uname_syscall+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test "$cross_compiling" = yes; then :
+ ag_cv_run_uname_syscall=no
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/utsname.h>
+int main() { struct utsname unm;
+return uname( &unm ); }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ag_cv_run_uname_syscall=yes
+else
+ ag_cv_run_uname_syscall=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+ # end of RUN_IFELSE
+
+fi
+ # end of AC_CACHE_VAL for ag_cv_run_uname_syscall
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ag_cv_run_uname_syscall}" >&5
+$as_echo "${ag_cv_run_uname_syscall}" >&6; }
+ if test "X${ag_cv_run_uname_syscall}" != Xno
+ then
+
+$as_echo "#define HAVE_UNAME_SYSCALL 1" >>confdefs.h
+
+ fi
+
+
+
+ # Check to see if runtime library dirs can be specified.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether runtime library dirs can be specified" >&5
+$as_echo_n "checking whether runtime library dirs can be specified... " >&6; }
+ if ${ag_cv_test_ldflags+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ ag_cv_test_ldflags=`exec 2> /dev/null
+echo 'int main() { return 0; }' > conftest.$ac_ext
+libs="${LIBS}"
+LIBS="${LIBS} -Wl,-R/tmp"
+if (eval $ac_link) > /dev/null 2>&1
+then echo '-Wl,-R${libdir}' ; rm -f conftest* ; exit 0 ; fi
+LIBS="${libs} -R/tmp"
+if (eval $ac_link) > /dev/null 2>&1
+then echo '-R' ; rm -f conftest* ; exit 0 ; fi
+rm -f conftest* ; exit 1`
+ if test $? -ne 0 || test -z "$ag_cv_test_ldflags"
+ then ag_cv_test_ldflags=no
+ fi
+
+fi
+ # end of CACHE_VAL of ag_cv_test_ldflags
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ag_cv_test_ldflags}" >&5
+$as_echo "${ag_cv_test_ldflags}" >&6; }
+ if test "X${ag_cv_test_ldflags}" != Xno
+ then
+ AG_LDFLAGS="${ag_cv_test_ldflags}"
+ else
+ AG_LDFLAGS=''
+ fi
+
+
+
+
+ # Check to see if wanting autogen debugging.
+
+ # Check whether --enable-debug was given.
+if test "${enable_debug+set}" = set; then :
+ enableval=$enable_debug; ag_cv_enable_debug=${enable_debug}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether wanting autogen debugging" >&5
+$as_echo_n "checking whether wanting autogen debugging... " >&6; }
+if ${ag_cv_enable_debug+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ag_cv_enable_debug=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ag_cv_enable_debug" >&5
+$as_echo "$ag_cv_enable_debug" >&6; }
+
+fi
+ # end of AC_ARG_ENABLE
+ if test "X${ag_cv_enable_debug}" != Xno
+ then
+
+$as_echo "#define DEBUG_ENABLED 1" >>confdefs.h
+
+
+$as_echo "#define DEBUG_ENABLED 1" >>confdefs.h
+
+ CFLAGS="-g `echo $CFLAGS|sed 's%-g *%%g;s%-O0-9* *%%g'`"
+ f=`which dmalloc 2>/dev/null`
+ -n "$f" && LIBS="${LIBS} -ldmalloc"
+ fi
+
+
+
+ # Check to see if name of the packager of this software is supplied.
+
+
+# Check whether --with-packager was given.
+if test "${with_packager+set}" = set; then :
+ withval=$with_packager; ag_cv_with_group_packager=${with_packager}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether name of the packager of this software is supplied" >&5
+$as_echo_n "checking whether name of the packager of this software is supplied... " >&6; }
+if ${ag_cv_with_group_packager+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ag_cv_with_group_packager=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ag_cv_with_group_packager" >&5
+$as_echo "$ag_cv_with_group_packager" >&6; }
+
+fi
+ # end of AC_ARG_WITH
+ if test "X${ag_cv_with_group_packager}" != Xno
+ then
+
+cat >>confdefs.h <<_ACEOF
+#define WITH_PACKAGER "${withval}"
+_ACEOF
+
+ fi
+
+# Check whether --with-packager-version was given.
+if test "${with_packager_version+set}" = set; then :
+ withval=$with_packager_version; ag_cv_with_group_packager_version=${with_packager_version}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether packager-specific version information is supplied" >&5
+$as_echo_n "checking whether packager-specific version information is supplied... " >&6; }
+if ${ag_cv_with_group_packager_version+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ag_cv_with_group_packager_version=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ag_cv_with_group_packager_version" >&5
+$as_echo "$ag_cv_with_group_packager_version" >&6; }
+
+fi
+ # end of AC_ARG_WITH
+ if test "X${ag_cv_with_group_packager_version}" != Xno
+ then
+
+cat >>confdefs.h <<_ACEOF
+#define WITH_PACKAGER_VERSION "${withval}"
+_ACEOF
+
+ fi
+
+# Check whether --with-packager-bug-reports was given.
+if test "${with_packager_bug_reports+set}" = set; then :
+ withval=$with_packager_bug_reports; ag_cv_with_group_packager_bug_reports=${with_packager_bug_reports}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether bug reporting URI/e-mail/etc. is supplied" >&5
+$as_echo_n "checking whether bug reporting URI/e-mail/etc. is supplied... " >&6; }
+if ${ag_cv_with_group_packager_bug_reports+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ag_cv_with_group_packager_bug_reports=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ag_cv_with_group_packager_bug_reports" >&5
+$as_echo "$ag_cv_with_group_packager_bug_reports" >&6; }
+
+fi
+ # end of AC_ARG_WITH
+ if test "X${ag_cv_with_group_packager_bug_reports}" != Xno
+ then
+
+cat >>confdefs.h <<_ACEOF
+#define WITH_PACKAGER_BUG_REPORTS "${withval}"
+_ACEOF
+
+ fi
+ if test "X$with_packager" != "X" || \
+ test "X$with_packager_version$with_packager_bug_reports" = "X"
+ then :
+ else
+
+ as_fn_error $? "--with-packager-{bug-reports,version} require --with-packager" "$LINENO" 5
+ fi
+
+
+
+
+if test X${INVOKE_AG_MACROS_LAST_done} != Xyes ; then
+ for ac_header in libio.h ctype.h assert.h sys/resource.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+ # Check to see if a reg expr header is specified.
+
+
+# Check whether --with-regex-header was given.
+if test "${with_regex_header+set}" = set; then :
+ withval=$with_regex_header; libopts_cv_with_regex_header=${with_regex_header}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a reg expr header is specified" >&5
+$as_echo_n "checking whether a reg expr header is specified... " >&6; }
+if ${libopts_cv_with_regex_header+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ libopts_cv_with_regex_header=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_with_regex_header" >&5
+$as_echo "$libopts_cv_with_regex_header" >&6; }
+
+fi
+ # end of AC_ARG_WITH
+ if test "X${libopts_cv_with_regex_header}" != Xno
+ then
+ cat >>confdefs.h <<_ACEOF
+#define REGEX_HEADER <${libopts_cv_with_regex_header}>
+_ACEOF
+
+ else
+
+$as_echo "#define REGEX_HEADER <regex.h>" >>confdefs.h
+
+ fi
+
+
+
+ # Check to see if a working libregex can be found.
+
+
+# Check whether --with-libregex was given.
+if test "${with_libregex+set}" = set; then :
+ withval=$with_libregex; libopts_cv_with_libregex_root=${with_libregex}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libregex was specified" >&5
+$as_echo_n "checking whether with-libregex was specified... " >&6; }
+if ${libopts_cv_with_libregex_root+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ libopts_cv_with_libregex_root=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_with_libregex_root" >&5
+$as_echo "$libopts_cv_with_libregex_root" >&6; }
+
+fi
+ # end of AC_ARG_WITH libregex
+
+ if test "${with_libregex+set}" = set && \
+ test "X${withval}" = Xno
+ then ## disabled by request
+ libopts_cv_with_libregex_root=no
+ libopts_cv_with_libregex_cflags=no
+ libopts_cv_with_libregex_libs=no
+ else
+
+
+# Check whether --with-libregex-cflags was given.
+if test "${with_libregex_cflags+set}" = set; then :
+ withval=$with_libregex_cflags; libopts_cv_with_libregex_cflags=${with_libregex_cflags}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libregex-cflags was specified" >&5
+$as_echo_n "checking whether with-libregex-cflags was specified... " >&6; }
+if ${libopts_cv_with_libregex_cflags+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ libopts_cv_with_libregex_cflags=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_with_libregex_cflags" >&5
+$as_echo "$libopts_cv_with_libregex_cflags" >&6; }
+
+fi
+ # end of AC_ARG_WITH libregex-cflags
+
+
+# Check whether --with-libregex-libs was given.
+if test "${with_libregex_libs+set}" = set; then :
+ withval=$with_libregex_libs; libopts_cv_with_libregex_libs=${with_libregex_libs}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether with-libregex-libs was specified" >&5
+$as_echo_n "checking whether with-libregex-libs was specified... " >&6; }
+if ${libopts_cv_with_libregex_libs+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ libopts_cv_with_libregex_libs=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_with_libregex_libs" >&5
+$as_echo "$libopts_cv_with_libregex_libs" >&6; }
+
+fi
+ # end of AC_ARG_WITH libregex-libs
+
+ case "X${libopts_cv_with_libregex_cflags}" in
+ Xyes|Xno|X )
+ case "X${libopts_cv_with_libregex_root}" in
+ Xyes|Xno|X ) libopts_cv_with_libregex_cflags=no ;;
+ * ) libopts_cv_with_libregex_cflags=-I${libopts_cv_with_libregex_root}/include ;;
+ esac
+ esac
+ case "X${libopts_cv_with_libregex_libs}" in
+ Xyes|Xno|X )
+ case "X${libopts_cv_with_libregex_root}" in
+ Xyes|Xno|X ) libopts_cv_with_libregex_libs=no ;;
+ * ) libopts_cv_with_libregex_libs="-L${libopts_cv_with_libregex_root}/lib -lregex";;
+ esac
+ esac
+ libopts_save_CPPFLAGS="${CPPFLAGS}"
+ libopts_save_LIBS="${LIBS}"
+ fi ## disabled by request
+
+ case "X${libopts_cv_with_libregex_cflags}" in
+ Xyes|Xno|X )
+ libopts_cv_with_libregex_cflags="" ;;
+ * ) CPPFLAGS="${CPPFLAGS} ${libopts_cv_with_libregex_cflags}" ;;
+ esac
+ case "X${libopts_cv_with_libregex_libs}" in
+ Xyes|Xno|X )
+ libopts_cv_with_libregex_libs="" ;;
+ * )
+ LIBS="${LIBS} ${libopts_cv_with_libregex_libs}" ;;
+ esac
+ LIBREGEX_CFLAGS=""
+ LIBREGEX_LIBS=""
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libregex functions properly" >&5
+$as_echo_n "checking whether libregex functions properly... " >&6; }
+ if ${libopts_cv_with_libregex+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test "$cross_compiling" = yes; then :
+ libopts_cv_with_libregex=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include REGEX_HEADER
+static regex_t re;
+void comp_re( char const* pzPat ) {
+ int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE );
+ if (res == 0) return;
+ exit( res ); }
+int main() {
+ regmatch_t m[2];
+ comp_re( "^.*\$" );
+ comp_re( "()|no.*" );
+ comp_re( "." );
+ if (regexec( &re, "X", 2, m, 0 ) != 0) return 1;
+ if ((m[0].rm_so != 0) || (m[0].rm_eo != 1)) {
+ fputs( "error: regex -->.<-- did not match\n", stderr );
+ return 1;
+ }
+ return 0; }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ libopts_cv_with_libregex=yes
+else
+ libopts_cv_with_libregex=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+ # end of AC_RUN_IFELSE
+
+fi
+ # end of AC_CACHE_VAL for libopts_cv_with_libregex
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_with_libregex}" >&5
+$as_echo "${libopts_cv_with_libregex}" >&6; }
+ if test "X${libopts_cv_with_libregex}" != Xno
+ then
+
+$as_echo "#define WITH_LIBREGEX 1" >>confdefs.h
+
+ else
+ CPPFLAGS="${libopts_save_CPPFLAGS}"
+ LIBS="${libopts_save_LIBS}"
+ fi
+
+
+
+ # Check to see if pathfind(3) works.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pathfind(3) works" >&5
+$as_echo_n "checking whether pathfind(3) works... " >&6; }
+ if ${libopts_cv_run_pathfind+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test "$cross_compiling" = yes; then :
+ libopts_cv_run_pathfind=no
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+#include <stdlib.h>
+int main (int argc, char** argv) {
+ char* pz = pathfind( getenv( "PATH" ), "sh", "x" );
+ return (pz == 0) ? 1 : 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ libopts_cv_run_pathfind=yes
+else
+ libopts_cv_run_pathfind=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+ # end of RUN_IFELSE
+
+fi
+ # end of AC_CACHE_VAL for libopts_cv_run_pathfind
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_pathfind}" >&5
+$as_echo "${libopts_cv_run_pathfind}" >&6; }
+ if test "X${libopts_cv_run_pathfind}" != Xno
+ then
+
+$as_echo "#define HAVE_PATHFIND 1" >>confdefs.h
+
+ fi
+
+
+
+ # Check to see if /dev/zero is readable device.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether /dev/zero is readable device" >&5
+$as_echo_n "checking whether /dev/zero is readable device... " >&6; }
+ if ${libopts_cv_test_dev_zero+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ libopts_cv_test_dev_zero=`exec 2> /dev/null
+dzero=\`ls -lL /dev/zero | egrep ^c......r\`
+test -z "${dzero}" && exit 1
+echo ${dzero}`
+ if test $? -ne 0 || test -z "$libopts_cv_test_dev_zero"
+ then libopts_cv_test_dev_zero=no
+ fi
+
+fi
+ # end of CACHE_VAL of libopts_cv_test_dev_zero
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_test_dev_zero}" >&5
+$as_echo "${libopts_cv_test_dev_zero}" >&6; }
+ if test "X${libopts_cv_test_dev_zero}" != Xno
+ then
+
+$as_echo "#define HAVE_DEV_ZERO 1" >>confdefs.h
+
+ fi
+
+
+
+ # Check to see if we have a functional realpath(3C).
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have a functional realpath(3C)" >&5
+$as_echo_n "checking whether we have a functional realpath(3C)... " >&6; }
+ if ${libopts_cv_run_realpath+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test "$cross_compiling" = yes; then :
+ libopts_cv_run_realpath=no
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+#include <stdlib.h>
+int main (int argc, char** argv) {
+#ifndef PATH_MAX
+choke me!!
+#else
+ char zPath[PATH_MAX+1];
+#endif
+ char *pz = realpath(argv[0], zPath);
+ return (pz == zPath) ? 0 : 1;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ libopts_cv_run_realpath=yes
+else
+ libopts_cv_run_realpath=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+ # end of RUN_IFELSE
+
+fi
+ # end of AC_CACHE_VAL for libopts_cv_run_realpath
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_realpath}" >&5
+$as_echo "${libopts_cv_run_realpath}" >&6; }
+ if test "X${libopts_cv_run_realpath}" != Xno
+ then
+
+$as_echo "#define HAVE_REALPATH 1" >>confdefs.h
+
+ fi
+
+
+
+ # Check to see if strftime() works.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strftime() works" >&5
+$as_echo_n "checking whether strftime() works... " >&6; }
+ if ${libopts_cv_run_strftime+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test "$cross_compiling" = yes; then :
+ libopts_cv_run_strftime=no
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <time.h>
+#include <string.h>
+char t_buf[ 64 ];
+int main() {
+ static char const z[] = "Thursday Aug 28 240";
+ struct tm tm;
+ tm.tm_sec = 36; /* seconds after the minute [0, 61] */
+ tm.tm_min = 44; /* minutes after the hour [0, 59] */
+ tm.tm_hour = 12; /* hour since midnight [0, 23] */
+ tm.tm_mday = 28; /* day of the month [1, 31] */
+ tm.tm_mon = 7; /* months since January [0, 11] */
+ tm.tm_year = 86; /* years since 1900 */
+ tm.tm_wday = 4; /* days since Sunday [0, 6] */
+ tm.tm_yday = 239; /* days since January 1 [0, 365] */
+ tm.tm_isdst = 1; /* flag for daylight savings time */
+ strftime( t_buf, sizeof( t_buf ), "%A %b %d %j", &tm );
+ return (strcmp( t_buf, z ) != 0); }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ libopts_cv_run_strftime=yes
+else
+ libopts_cv_run_strftime=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+ # end of RUN_IFELSE
+
+fi
+ # end of AC_CACHE_VAL for libopts_cv_run_strftime
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_strftime}" >&5
+$as_echo "${libopts_cv_run_strftime}" >&6; }
+ if test "X${libopts_cv_run_strftime}" != Xno
+ then
+
+$as_echo "#define HAVE_STRFTIME 1" >>confdefs.h
+
+ fi
+
+
+
+ # Check to see if fopen accepts "b" mode.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fopen accepts \"b\" mode" >&5
+$as_echo_n "checking whether fopen accepts \"b\" mode... " >&6; }
+ if ${libopts_cv_run_fopen_binary+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test "$cross_compiling" = yes; then :
+ libopts_cv_run_fopen_binary=no
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int main (int argc, char** argv) {
+FILE* fp = fopen("conftest.$ac_ext", "rb");
+return (fp == NULL) ? 1 : fclose(fp); }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ libopts_cv_run_fopen_binary=yes
+else
+ libopts_cv_run_fopen_binary=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+ # end of RUN_IFELSE
+
+fi
+ # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_fopen_binary}" >&5
+$as_echo "${libopts_cv_run_fopen_binary}" >&6; }
+ if test "X${libopts_cv_run_fopen_binary}" != Xno
+ then
+
+$as_echo "#define FOPEN_BINARY_FLAG \"b\"" >>confdefs.h
+
+ else
+
+$as_echo "#define FOPEN_BINARY_FLAG \"\"" >>confdefs.h
+
+ fi
+
+
+
+ # Check to see if fopen accepts "t" mode.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fopen accepts \"t\" mode" >&5
+$as_echo_n "checking whether fopen accepts \"t\" mode... " >&6; }
+ if ${libopts_cv_run_fopen_text+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ if test "$cross_compiling" = yes; then :
+ libopts_cv_run_fopen_text=no
+
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int main (int argc, char** argv) {
+FILE* fp = fopen("conftest.$ac_ext", "rt");
+return (fp == NULL) ? 1 : fclose(fp); }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ libopts_cv_run_fopen_text=yes
+else
+ libopts_cv_run_fopen_text=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+ # end of RUN_IFELSE
+
+fi
+ # end of AC_CACHE_VAL for libopts_cv_run_fopen_text
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${libopts_cv_run_fopen_text}" >&5
+$as_echo "${libopts_cv_run_fopen_text}" >&6; }
+ if test "X${libopts_cv_run_fopen_text}" != Xno
+ then
+
+$as_echo "#define FOPEN_TEXT_FLAG \"t\"" >>confdefs.h
+
+ else
+
+$as_echo "#define FOPEN_TEXT_FLAG \"\"" >>confdefs.h
+
+ fi
+
+
+
+ # Check to see if not wanting optional option args.
+
+ # Check whether --enable-optional-args was given.
+if test "${enable_optional_args+set}" = set; then :
+ enableval=$enable_optional_args; libopts_cv_enable_optional_args=${enable_optional_args}
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether not wanting optional option args" >&5
+$as_echo_n "checking whether not wanting optional option args... " >&6; }
+if ${libopts_cv_enable_optional_args+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ libopts_cv_enable_optional_args=yes
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libopts_cv_enable_optional_args" >&5
+$as_echo "$libopts_cv_enable_optional_args" >&6; }
+
+fi
+ # end of AC_ARG_ENABLE
+ if test "X${libopts_cv_enable_optional_args}" = Xno
+ then
+
+$as_echo "#define NO_OPTIONAL_OPT_ARGS 1" >>confdefs.h
+
+ fi
+
+
+
+
+ ac_fn_c_check_decl "$LINENO" "sigsetjmp" "ac_cv_have_decl_sigsetjmp" "#include <setjmp.h>
+"
+if test "x$ac_cv_have_decl_sigsetjmp" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SIGSETJMP $ac_have_decl
+_ACEOF
+
+ ac_fn_c_check_decl "$LINENO" "sys_siglist" "ac_cv_have_decl_sys_siglist" "#include <signal.h>
+/* NetBSD declares sys_siglist in unistd.h. */
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+"
+if test "x$ac_cv_have_decl_sys_siglist" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SYS_SIGLIST $ac_have_decl
+_ACEOF
+
+
+ for ac_func in putenv getdate_r utimes futimes
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+ for ac_func in fopencookie funopen
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ break
+fi
+done
+
+ case "${ac_cv_func_fopencookie}${ac_cv_func_funopen}" in
+ *yes* )
+
+$as_echo "#define ENABLE_FMEMOPEN 1" >>confdefs.h
+
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5
+$as_echo_n "checking for long long int... " >&6; }
+if ${ac_cv_type_long_long_int+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_long_long_int=yes
+ if test "x${ac_cv_prog_cc_c99-no}" = xno; then
+ ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int
+ if test $ac_cv_type_long_long_int = yes; then
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+ #ifndef LLONG_MAX
+ # define HALF \
+ (1LL << (sizeof (long long int) * CHAR_BIT - 2))
+ # define LLONG_MAX (HALF - 1 + HALF)
+ #endif
+int
+main ()
+{
+long long int n = 1;
+ int i;
+ for (i = 0; ; i++)
+ {
+ long long int m = n << i;
+ if (m >> i != n)
+ return 1;
+ if (LLONG_MAX / 2 < m)
+ break;
+ }
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_type_long_long_int=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5
+$as_echo "$ac_cv_type_long_long_int" >&6; }
+ if test $ac_cv_type_long_long_int = yes; then
+
+$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h
+
+ fi
+
+
+ # Note that BSD does not typedef these in its headers, but instead
+ # calls for them to be identical in signature to read(2), write(2),
+ # lseek(2), and close(2). Newlib however does include typedefs
+ # in its stdio.h for these, and they do not match the signatures
+ # of the BSD implementation. So this test relies on the fact
+ # that any typedef will succeed for BSD, while only one that
+ # matches the existing definitions in stdio.h will succeed for
+ # a newlib system.
+
+ if test "X${ac_cv_func_funopen}" = Xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cookie_function_t type" >&5
+$as_echo_n "checking for cookie_function_t type... " >&6; }
+if ${ag_cv_cookie_function_t+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+ typedef int cookie_read_function_t (void *, char *, int);
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ag_cv_cookie_function_t="bsd"
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+ typedef ssize_t cookie_read_function_t (void *, char *, size_t);
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ag_cv_cookie_function_t="newlib"
+else
+ as_fn_error $? "Unknown flavor of cookie_XXX_t types" "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ag_cv_cookie_function_t" >&5
+$as_echo "$ag_cv_cookie_function_t" >&6; }
+ fi
+ if test "X${ag_cv_cookie_function_t}" = Xbsd; then
+
+$as_echo "#define NEED_COOKIE_FUNCTION_TYPEDEFS 1" >>confdefs.h
+
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for static inline" >&5
+$as_echo_n "checking for static inline... " >&6; }
+if ${snv_cv_static_inline+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+static inline foo(bar) int bar; { return bar; }
+int
+main ()
+{
+return foo(0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ snv_cv_static_inline='static inline'
+else
+ snv_cv_static_inline='static'
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $snv_cv_static_inline" >&5
+$as_echo "$snv_cv_static_inline" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define SNV_INLINE ${snv_cv_static_inline}
+_ACEOF
+
+ if test "X${libopts_cv_with_libregex}" = Xno
+ then
+ echo "A POSIX compliant regcomp/regexec routine is required.
+ These are required for AutoGen to work correctly. If you have
+ such a library present on your system, you must specify it by
+ setting the LIBS environment variable, e.g., \"LIBS='-lregex'\".
+ If you do not have such a library on your system, then you should
+ download and install, for example, the one from:
+ ftp://ftp.gnu.org/gnu/rx/" >&2
+ as_fn_error $? "Cannot find working POSIX regex library" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if ${ac_cv_path_FGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+ then ac_cv_path_FGREP="$GREP -F"
+ else
+ if test -z "$FGREP"; then
+ ac_path_FGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in fgrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_FGREP" || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+ # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'FGREP' >> "conftest.nl"
+ "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_FGREP="$ac_path_FGREP"
+ ac_path_FGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_FGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_FGREP"; then
+ as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_FGREP=$FGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+ INVOKE_AG_MACROS_LAST_done=yes
+fi
+
+
+if ! test x$ag_cv_sys_siglist = xyes
+then
+ if ! test x$ac_cv_func_strsignal = xyes
+ then
+ echo "WARNING: strsignal will use POSIX names and Linux signal numbers"
+ fi
+fi >&2
+if test "X${ag_cv_link_sigsetjmp}" = Xno
+then
+ as_fn_error $? "AutoGen requires sigsetjmp(3)" "$LINENO" 5
+fi
+
+# ----------------------------------------------------------------------
+# Do SNPRINTFV macros
+# ----------------------------------------------------------------------
+
+ case $enable_snprintfv_convenience in
+ no) as_fn_error $? "this package needs a convenience snprintfv" "$LINENO" 5 ;;
+ "") enable_snprintfv_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-snprintfv-convenience" ;;
+ esac
+ LIBSNPRINTFV='${top_builddir}/''snprintfv'/snprintfv/libsnprintfvc.la
+ INCSNPRINTFV='-I${top_builddir}/''snprintfv'' -I${top_srcdir}/''snprintfv'
+
+
+
+ # ----------------------------------------------------------------------
+ # Set up and process configure options
+ # ----------------------------------------------------------------------
+ # Check whether --enable-snprintfv-install was given.
+if test "${enable_snprintfv_install+set}" = set; then :
+ enableval=$enable_snprintfv_install;
+fi
+
+ if test x"${enable_snprintfv_install-no}" != xno; then
+ INSTALL_SNPRINTFV_TRUE=
+ INSTALL_SNPRINTFV_FALSE='#'
+else
+ INSTALL_SNPRINTFV_TRUE='#'
+ INSTALL_SNPRINTFV_FALSE=
+fi
+
+ if test x"${enable_snprintfv_convenience-no}" != xno; then
+ CONVENIENCE_SNPRINTFV_TRUE=
+ CONVENIENCE_SNPRINTFV_FALSE='#'
+else
+ CONVENIENCE_SNPRINTFV_TRUE='#'
+ CONVENIENCE_SNPRINTFV_FALSE=
+fi
+
+ if test x"${enable_subdir-no}" != xno; then
+ SUBDIR_SNPRINTFV_TRUE=
+ SUBDIR_SNPRINTFV_FALSE='#'
+else
+ SUBDIR_SNPRINTFV_TRUE='#'
+ SUBDIR_SNPRINTFV_FALSE=
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if malloc debugging is wanted" >&5
+$as_echo_n "checking if malloc debugging is wanted... " >&6; }
+
+# Check whether --with-dmalloc was given.
+if test "${with_dmalloc+set}" = set; then :
+ withval=$with_dmalloc; if test "$withval" = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define WITH_DMALLOC 1" >>confdefs.h
+
+ LIBS="$LIBS -ldmalloc"
+ LDFLAGS="$LDFLAGS -g"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+
+ # ----------------------------------------------------------------------
+ # check for various programs used during the build.
+ # On OS/X, "wchar.h" needs "runetype.h" to work properly.
+ # ----------------------------------------------------------------------
+ for ac_header in runetype.h wchar.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "
+ $ac_includes_default
+ #if HAVE_RUNETYPE_H
+ # include <runetype.h>
+ #endif
+
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ case x$am_cv_prog_cc_stdc in
+ xno)
+ # Non ansi C => won't work with stdarg.h
+ ac_fn_c_check_header_mongrel "$LINENO" "varargs.h" "ac_cv_header_varargs_h" "$ac_includes_default"
+if test "x$ac_cv_header_varargs_h" = xyes; then :
+
+fi
+
+
+ ;;
+ *)
+ case x$ac_cv_header_varargs_h in
+ xyes)
+ # Parent package is using varargs.h which is incompatible with
+ # stdarg.h, so we do the same.
+ ac_fn_c_check_header_mongrel "$LINENO" "varargs.h" "ac_cv_header_varargs_h" "$ac_includes_default"
+if test "x$ac_cv_header_varargs_h" = xyes; then :
+
+fi
+
+
+ ;;
+ *)
+ # If stdarg.h is present define HAVE_STDARG_H, otherwise if varargs.h
+ # is present define HAVE_VARARGS_H.
+ for ac_header in stdarg.h varargs.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ break
+fi
+
+done
+
+ ;;
+ esac
+ ;;
+ esac
+
+ case x$ac_cv_header_stdarg_h$ac_cv_header_varargs_h in
+ x*yes*) ;;
+ *) as_fn_error $? "Could not find either stdarg.h or varargs.h." "$LINENO" 5 ;;
+ esac
+
+ # ----------------------------------------------------------------------
+ # Checks for typedefs
+ # ----------------------------------------------------------------------
+ ac_fn_c_check_type "$LINENO" "wchar_t" "ac_cv_type_wchar_t" "$ac_includes_default"
+if test "x$ac_cv_type_wchar_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_WCHAR_T 1
+_ACEOF
+
+
+fi
+
+ ac_fn_c_check_type "$LINENO" "wint_t" "ac_cv_type_wint_t" "
+ $ac_includes_default
+ #if HAVE_RUNETYPE_H
+ # include <runetype.h>
+ #endif
+ #if HAVE_WCHAR_H
+ # include <wchar.h>
+ #endif
+
+"
+if test "x$ac_cv_type_wint_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_WINT_T 1
+_ACEOF
+
+
+fi
+
+ ac_fn_c_check_type "$LINENO" "long double" "ac_cv_type_long_double" "$ac_includes_default"
+if test "x$ac_cv_type_long_double" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LONG_DOUBLE 1
+_ACEOF
+
+
+fi
+
+
+ # ----------------------------------------------------------------------
+ # Checks for library calls
+ # ----------------------------------------------------------------------
+ ac_fn_c_check_func "$LINENO" "strtoul" "ac_cv_func_strtoul"
+if test "x$ac_cv_func_strtoul" = xyes; then :
+ $as_echo "#define HAVE_STRTOUL 1" >>confdefs.h
+
+else
+ case " $LIBOBJS " in
+ *" strtoul.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS strtoul.$ac_objext"
+ ;;
+esac
+
+fi
+
+ac_fn_c_check_func "$LINENO" "ldexpl" "ac_cv_func_ldexpl"
+if test "x$ac_cv_func_ldexpl" = xyes; then :
+ $as_echo "#define HAVE_LDEXPL 1" >>confdefs.h
+
+else
+ case " $LIBOBJS " in
+ *" ldexpl.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS ldexpl.$ac_objext"
+ ;;
+esac
+
+fi
+
+ac_fn_c_check_func "$LINENO" "frexpl" "ac_cv_func_frexpl"
+if test "x$ac_cv_func_frexpl" = xyes; then :
+ $as_echo "#define HAVE_FREXPL 1" >>confdefs.h
+
+else
+ case " $LIBOBJS " in
+ *" frexpl.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS frexpl.$ac_objext"
+ ;;
+esac
+
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for log in -lm" >&5
+$as_echo_n "checking for log in -lm... " >&6; }
+if ${ac_cv_lib_m_log+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char log ();
+int
+main ()
+{
+return log ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_log=yes
+else
+ ac_cv_lib_m_log=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_log" >&5
+$as_echo "$ac_cv_lib_m_log" >&6; }
+if test "x$ac_cv_lib_m_log" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+ LIBS="-lm $LIBS"
+
+fi
+
+ for ac_func in copysign copysignl
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+# ----------------------------------------------------------------------
+# Generate the make files.
+# ----------------------------------------------------------------------
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+
+test -f ./snprintfv/snprintfv/snprintfv.h \
+ && rm -f ./snprintfv/snprintfv.h \
+ && ${LN_S} `pwd`/snprintfv/snprintfv/snprintfv.h ./snprintfv/
+
+AGnam=autogen${ac_exeext}
+GDnam=getdefs${ac_exeext}
+CLnam=columns${ac_exeext}
+AGexe=${ag_top_builddir}/agen5/${AGnam}
+GDexe=${ag_top_builddir}/getdefs/${GDnam}
+CLexe=${ag_top_builddir}/columns/${CLnam}
+M4_SRC=`cd $srcdir/config ; echo [a-z]*.m4`
+ENABLE_STATIC=${enable_static}
+config_end_time=`date +%s 2>/dev/null`
+time_delta=`expr ${config_end_time} - ${config_start_time} 2>/dev/null`
+
+if test -z "${time_delta}"
+then time_delta=10
+elif test ${time_delta} -lt 5
+then time_delta=5 ; fi
+
+AG_TIMEOUT=${time_delta}
+
+
+cat >>confdefs.h <<_ACEOF
+#define AG_DEFAULT_TIMEOUT ${time_delta}
+_ACEOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test "$ag_top_srcdir" = "$ag_top_builddir"
+then
+ INCLIST='-I${top_builddir} -I${top_srcdir}/autoopts'
+else
+ INCLIST='-I${top_builddir} -I${top_srcdir}'
+ INCLIST="${INCLIST} -I\${top_builddir}/autoopts -I\${top_srcdir}/autoopts"
+fi
+
+
+
+test ${GUILE_VERSION} -ge 108000 \
+ -a "X${WERROR}" = Xyes \
+ -a "X${GCC}" = Xyes && \
+ CFLAGS=`echo $CFLAGS -Wall -Werror -Wcast-align -Wmissing-prototypes \
+ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
+ -Wno-format-contains-nul -fno-strict-aliasing -Wstrict-aliasing=2 `
+
+ac_config_headers="$ac_config_headers config.h:config-h.in"
+
+
+
+
+
+ac_config_files="$ac_config_files autoopts/mk-autoopts-pc"
+
+ac_config_files="$ac_config_files autoopts/autoopts-config"
+
+
+ac_config_files="$ac_config_files autoopts/tpl/tpl-config.tlib:autoopts/tpl/tpl-config-tlib.in"
+
+ac_config_files="$ac_config_files doc/auto_gen.tpl:doc/auto_gen-tpl.in"
+
+ac_config_files="$ac_config_files autoopts/test/defs config/mk-shdefs pkg/pkg-env Makefile agen5/Makefile agen5/test/Makefile autoopts/Makefile autoopts/test/Makefile columns/Makefile compat/Makefile doc/Makefile getdefs/Makefile getdefs/test/Makefile pkg/Makefile snprintfv/Makefile xml2ag/Makefile xml2ag/test/Makefile"
+
+
+ac_config_commands="$ac_config_commands stamp-h"
+
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+
+
+cat >>confdefs.h <<_ACEOF
+#define CONFIG_SHELL $CONFIG_SHELL
+_ACEOF
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${NEED_PATHFIND_TRUE}" && test -z "${NEED_PATHFIND_FALSE}"; then
+ as_fn_error $? "conditional \"NEED_PATHFIND\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DO_SHELL_CMDS_TRUE}" && test -z "${DO_SHELL_CMDS_FALSE}"; then
+ as_fn_error $? "conditional \"DO_SHELL_CMDS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${HAVE_XML_LIB_TRUE}" && test -z "${HAVE_XML_LIB_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_XML_LIB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${INSTALL_SNPRINTFV_TRUE}" && test -z "${INSTALL_SNPRINTFV_FALSE}"; then
+ as_fn_error $? "conditional \"INSTALL_SNPRINTFV\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${CONVENIENCE_SNPRINTFV_TRUE}" && test -z "${CONVENIENCE_SNPRINTFV_FALSE}"; then
+ as_fn_error $? "conditional \"CONVENIENCE_SNPRINTFV\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${SUBDIR_SNPRINTFV_TRUE}" && test -z "${SUBDIR_SNPRINTFV_FALSE}"; then
+ as_fn_error $? "conditional \"SUBDIR_SNPRINTFV\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by GNU AutoGen $as_me 5.16.2, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <autogen-users@lists.sourceforge.net>.
+GNU AutoGen home page: <http://www.gnu.org/software/autogen/>.
+General help using GNU software: <http://www.gnu.org/gethelp/>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+GNU AutoGen config.status 5.16.2
+configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+ eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in AS \
+DLLTOOL \
+OBJDUMP \
+SHELL \
+ECHO \
+PATH_SEPARATOR \
+SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+deplibs_check_method \
+file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+sharedlib_from_linklib_cmd \
+AR \
+AR_FLAGS \
+archiver_list_spec \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+nm_file_list_spec \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_pic \
+lt_prog_compiler_wl \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+MANIFEST_TOOL \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_separator \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postlink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec; do
+ case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'
+
+
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config-h.in" ;;
+ "autoopts/mk-autoopts-pc") CONFIG_FILES="$CONFIG_FILES autoopts/mk-autoopts-pc" ;;
+ "autoopts/autoopts-config") CONFIG_FILES="$CONFIG_FILES autoopts/autoopts-config" ;;
+ "autoopts/tpl/tpl-config.tlib") CONFIG_FILES="$CONFIG_FILES autoopts/tpl/tpl-config.tlib:autoopts/tpl/tpl-config-tlib.in" ;;
+ "doc/auto_gen.tpl") CONFIG_FILES="$CONFIG_FILES doc/auto_gen.tpl:doc/auto_gen-tpl.in" ;;
+ "autoopts/test/defs") CONFIG_FILES="$CONFIG_FILES autoopts/test/defs" ;;
+ "config/mk-shdefs") CONFIG_FILES="$CONFIG_FILES config/mk-shdefs" ;;
+ "pkg/pkg-env") CONFIG_FILES="$CONFIG_FILES pkg/pkg-env" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "agen5/Makefile") CONFIG_FILES="$CONFIG_FILES agen5/Makefile" ;;
+ "agen5/test/Makefile") CONFIG_FILES="$CONFIG_FILES agen5/test/Makefile" ;;
+ "autoopts/Makefile") CONFIG_FILES="$CONFIG_FILES autoopts/Makefile" ;;
+ "autoopts/test/Makefile") CONFIG_FILES="$CONFIG_FILES autoopts/test/Makefile" ;;
+ "columns/Makefile") CONFIG_FILES="$CONFIG_FILES columns/Makefile" ;;
+ "compat/Makefile") CONFIG_FILES="$CONFIG_FILES compat/Makefile" ;;
+ "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+ "getdefs/Makefile") CONFIG_FILES="$CONFIG_FILES getdefs/Makefile" ;;
+ "getdefs/test/Makefile") CONFIG_FILES="$CONFIG_FILES getdefs/test/Makefile" ;;
+ "pkg/Makefile") CONFIG_FILES="$CONFIG_FILES pkg/Makefile" ;;
+ "snprintfv/Makefile") CONFIG_FILES="$CONFIG_FILES snprintfv/Makefile" ;;
+ "xml2ag/Makefile") CONFIG_FILES="$CONFIG_FILES xml2ag/Makefile" ;;
+ "xml2ag/test/Makefile") CONFIG_FILES="$CONFIG_FILES xml2ag/test/Makefile" ;;
+ "stamp-h") CONFIG_COMMANDS="$CONFIG_COMMANDS stamp-h" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
+ fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$_am_arg" : 'X\(//\)[^/]' \| \
+ X"$_am_arg" : 'X\(//\)$' \| \
+ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named 'Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running 'make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir=$dirpart/$fdir; as_fn_mkdir_p
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+ ;;
+ "libtool":C)
+
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags=""
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Assembler program.
+AS=$lt_AS
+
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
+
+# Object dumper program.
+OBJDUMP=$lt_OBJDUMP
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The PATH separator for the build system.
+PATH_SEPARATOR=$lt_PATH_SEPARATOR
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method = "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
+
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
+
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
+
+# The archiver.
+AR=$lt_AR
+
+# Flags to create an archive.
+AR_FLAGS=$lt_AR_FLAGS
+
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
+
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ if test x"$xsi_shell" = xyes; then
+ sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\ case ${1} in\
+\ */*) func_dirname_result="${1%/*}${2}" ;;\
+\ * ) func_dirname_result="${3}" ;;\
+\ esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\ func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\ case ${1} in\
+\ */*) func_dirname_result="${1%/*}${2}" ;;\
+\ * ) func_dirname_result="${3}" ;;\
+\ esac\
+\ func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\ # positional parameters, so assign one to ordinary parameter first.\
+\ func_stripname_result=${3}\
+\ func_stripname_result=${func_stripname_result#"${1}"}\
+\ func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\ func_split_long_opt_name=${1%%=*}\
+\ func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\ func_split_short_opt_arg=${1#??}\
+\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\ case ${1} in\
+\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\ *) func_lo2o_result=${1} ;;\
+\ esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+ func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+ func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+ func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+ sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+ eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\ func_quote_for_eval "${2}"\
+\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+ # Save a `func_append' function call where possible by direct use of '+='
+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+else
+ # Save a `func_append' function call even when '+=' is not available
+ sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+ && mv -f "$cfgfile.tmp" "$cfgfile" \
+ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+ test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
+ ;;
+ "autoopts/mk-autoopts-pc":F) chmod +x autoopts/mk-autoopts-pc ;;
+ "autoopts/autoopts-config":F) chmod +x autoopts/autoopts-config ;;
+ "stamp-h":C) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+
+echo \
+"------------------------------------------------------------------------
+Configuration:
+
+ Source code location: ${srcdir}
+ Compiler: ${CC}
+ Compiler flags: ${CFLAGS}
+ Host System Type: ${host}
+ Install path: ${prefix}
+
+ See config.h for further configuration information.
+------------------------------------------------------------------------"
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..0f32f1e
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,255 @@
+dnl --------------------------------------------------------------------
+dnl configure.ac --- GNU autoconf source for toplevel directory.
+dnl
+dnl Time-stamp: "2012-05-13 13:43:24 bkorb"
+dnl Author: Bruce Korb <bkorb@gnu.org>
+dnl
+dnl This file is part of AutoGen.
+dnl AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+dnl
+dnl AutoGen is free software: you can redistribute it and/or modify it
+dnl under the terms of the GNU General Public License as published by the
+dnl Free Software Foundation, either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl AutoGen is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+dnl See the GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License along
+dnl with this program. If not, see <http://www.gnu.org/licenses/>.
+dnl
+AC_INIT([GNU AutoGen],[5.16.2],[autogen-users@lists.sourceforge.net])
+AC_CONFIG_SRCDIR(agen5/autogen.c)
+AC_CONFIG_AUX_DIR(config)
+AC_CANONICAL_TARGET
+[. $srcdir/VERSION
+d=`dirname $0`
+ag_top_srcdir=`cd $d && pwd`
+ag_top_builddir=`pwd`]
+AM_INIT_AUTOMAKE([gnu check-news 1.5 dist-xz])
+AC_USE_SYSTEM_EXTENSIONS
+AC_LIBTOOL_WIN32_DLL m4_define(AC_PROVIDE_AC_LIBTOOL_WIN32_DLL)
+AC_PROG_LIBTOOL
+ifdef([AC_REVISION],AC_REVISION($Revision: 4.34 $),)dnl
+[config_start_time=`date +%s 2>/dev/null`]
+# ----------------------------------------------------------------------
+# Substitute VERSION vars here, so that they can be used by the Makefile
+# ----------------------------------------------------------------------
+AC_SUBST(AG_VERSION)
+AC_SUBST(AG_MAJOR_VERSION)
+AC_SUBST(AG_MINOR_VERSION)
+AC_SUBST(AO_CURRENT)
+AC_SUBST(AO_REVISION)
+AC_SUBST(AO_AGE)
+[AO_TEMPLATE_VERSION=`expr '(' $AO_CURRENT '*' 4096 ')' + $AO_REVISION`
+]dnl
+AC_SUBST(AO_TEMPLATE_VERSION)
+AC_SUBST(GO_CURRENT)
+AC_SUBST(GO_REVISION)
+AC_SUBST(GO_AGE)
+AC_DEFINE_UNQUOTED(AO_CURRENT,$AO_CURRENT,
+ [Define this to the autoopts current interface number])
+AC_DEFINE_UNQUOTED(AO_REVISION,$AO_REVISION,
+ [Define this to the autoopts interface revision number])
+AC_DEFINE_UNQUOTED(AO_AGE,$AO_AGE,
+ [Define this to the autoopts interface age number])
+# ----------------------------------------------------------------------
+# Set up the environment to configure the snprintv subpackage using
+# this version of AutoGen (as opposed to any installed version).
+# ----------------------------------------------------------------------
+[ag_srcdir=`\cd $srcdir && pwd`
+if test x$ag_srcdir != x && test -d $ag_srcdir; then
+ :
+else
+ ag_srcdir=..
+fi
+
+# ----------------------------------------------------------------------
+# If `configure' is invoked (in)directly via `make', ensure that it
+# encounters no `make' conflicts. Ignore error if shell does not have
+# unset, but at least set these to empty values.
+# ----------------------------------------------------------------------
+MFLAGS=
+MAKEFLAGS=
+MAKELEVEL=
+unset MFLAGS MAKEFLAGS MAKELEVEL 2>/dev/null]
+
+AM_WITH_DMALLOC
+
+# ----------------------------------------------------------------------
+# check for various programs used during the build.
+# ----------------------------------------------------------------------
+AM_PROG_CC_C_O
+AC_PROG_CC_STDC
+gl_FUNC_GLIBC_UNLOCKED_IO
+AC_EXEEXT
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+AC_CHECK_PROG(TEXI2HTML, texi2html, texi2html, :)
+AC_C_CONST
+AC_C_INLINE
+# ----------------------------------------------------------------------
+AC_CHECK_LIB(dl, dlopen)
+# ----------------------------------------------------------------------
+AC_TYPE_MODE_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_TYPE_UID_T
+AC_C_LONG_DOUBLE
+[if test x$ac_cv_type_long_double = xno; then
+ snv_long_double=double
+else
+ snv_long_double='long double'
+fi]
+AC_DEFINE_UNQUOTED([SNV_LONG_DOUBLE],$snv_long_double,
+ [Define this to the long+double type])
+AC_CHECK_TYPES([long long, uintmax_t, size_t, wchar_t])
+AC_CHECK_SIZEOF(char*, 4)
+AC_CHECK_SIZEOF(int, 4)
+AC_CHECK_SIZEOF(long, 4)
+AC_CHECK_SIZEOF(short, 2)
+# ----------------------------------------------------------------------
+AC_CHECK_FUNCS(strchr strlcpy snprintf dlopen)
+AC_SEARCH_LIBS(copysign, [m],
+ [AC_DEFINE(HAVE_COPYSIGN, 1,
+ [Define to 1 if you have the `copysign' function.])])
+AC_SEARCH_LIBS(copysignl, [m],
+ [AC_DEFINE(HAVE_COPYSIGNL, 1,
+ [Define to 1 if you have the `copysignl' function.])])
+AC_SEARCH_LIBS(modfl, [m],
+ [AC_DEFINE(HAVE_MODFL, 1,
+ [Define to 1 if you have the `modfl' function.])])
+
+# ----------------------------------------------------------------------
+# Check for the functions needed from libgen and libdl
+# ----------------------------------------------------------------------
+
+AM_CONDITIONAL([NEED_PATHFIND], [test X$ac_cv_func_pathfind = Xyes])
+[if test X$ac_cv_func_dlopen = Xyes
+then DYNAMIC_AG=-export-dynamic
+else DYNAMIC_AG=""
+fi]
+AC_SUBST(DYNAMIC_AG)
+
+# ----------------------------------------------------------------------
+# Do all our own macros
+# ----------------------------------------------------------------------
+INVOKE_AG_MACROS
+[
+if ! test x$ag_cv_sys_siglist = xyes
+then
+ if ! test x$ac_cv_func_strsignal = xyes
+ then
+ echo "WARNING: strsignal will use POSIX names and Linux signal numbers"
+ fi
+fi >&2
+if test "X${ag_cv_link_sigsetjmp}" = Xno
+then]
+ AC_MSG_ERROR([AutoGen requires sigsetjmp(3)])[
+fi
+]
+# ----------------------------------------------------------------------
+# Do SNPRINTFV macros
+# ----------------------------------------------------------------------
+INVOKE_SNPRINTFV_MACROS
+# ----------------------------------------------------------------------
+# Generate the make files.
+# ----------------------------------------------------------------------
+AC_PROG_LN_S
+[
+test -f ./snprintfv/snprintfv/snprintfv.h \
+ && rm -f ./snprintfv/snprintfv.h \
+ && ${LN_S} `pwd`/snprintfv/snprintfv/snprintfv.h ./snprintfv/
+
+AGnam=autogen${ac_exeext}
+GDnam=getdefs${ac_exeext}
+CLnam=columns${ac_exeext}
+AGexe=${ag_top_builddir}/agen5/${AGnam}
+GDexe=${ag_top_builddir}/getdefs/${GDnam}
+CLexe=${ag_top_builddir}/columns/${CLnam}
+M4_SRC=`cd $srcdir/config ; echo [a-z]*.m4`
+ENABLE_STATIC=${enable_static}
+config_end_time=`date +%s 2>/dev/null`
+time_delta=`expr ${config_end_time} - ${config_start_time} 2>/dev/null`
+
+if test -z "${time_delta}"
+then time_delta=10
+elif test ${time_delta} -lt 5
+then time_delta=5 ; fi
+
+AG_TIMEOUT=${time_delta}
+]
+AC_DEFINE_UNQUOTED(AG_DEFAULT_TIMEOUT, ${time_delta},
+ [define to suitable timeout limit for shell command])
+AC_SUBST(M4_SRC)
+AC_SUBST(AGnam)
+AC_SUBST(GDnam)
+AC_SUBST(CLnam)
+AC_SUBST(AGexe)
+AC_SUBST(GDexe)
+AC_SUBST(CLexe)
+AC_SUBST(AG_TIMEOUT)
+AC_SUBST(ac_aux_dir)
+AC_SUBST(LIBS)
+AC_SUBST(DEBUG_ENABLED)
+AC_SUBST(ENABLE_STATIC)
+[
+if test "$ag_top_srcdir" = "$ag_top_builddir"
+then
+ INCLIST='-I${top_builddir} -I${top_srcdir}/autoopts'
+else
+ INCLIST='-I${top_builddir} -I${top_srcdir}'
+ INCLIST="${INCLIST} -I\${top_builddir}/autoopts -I\${top_srcdir}/autoopts"
+fi
+]
+AC_SUBST(INCLIST)
+[
+test ${GUILE_VERSION} -ge 108000 \
+ -a "X${WERROR}" = Xyes \
+ -a "X${GCC}" = Xyes && \
+ CFLAGS=`echo $CFLAGS -Wall -Werror -Wcast-align -Wmissing-prototypes \
+ -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
+ -Wno-format-contains-nul -fno-strict-aliasing -Wstrict-aliasing=2 `
+]
+AM_CONFIG_HEADER(config.h:config-h.in)
+
+AH_TOP([#ifndef AUTOGEN_CONFIG_H])
+AH_TOP([#define AUTOGEN_CONFIG_H 1])
+AH_BOTTOM([#endif /* AUTOGEN_CONFIG_H */])
+AC_CONFIG_FILES([autoopts/mk-autoopts-pc],
+ [chmod +x autoopts/mk-autoopts-pc])
+AC_CONFIG_FILES([autoopts/autoopts-config],
+ [chmod +x autoopts/autoopts-config])
+
+AC_CONFIG_FILES([autoopts/tpl/tpl-config.tlib:autoopts/tpl/tpl-config-tlib.in])
+AC_CONFIG_FILES([doc/auto_gen.tpl:doc/auto_gen-tpl.in])
+AC_CONFIG_FILES([
+ autoopts/test/defs config/mk-shdefs pkg/pkg-env
+ Makefile agen5/Makefile agen5/test/Makefile
+ autoopts/Makefile autoopts/test/Makefile columns/Makefile
+ compat/Makefile doc/Makefile getdefs/Makefile
+ getdefs/test/Makefile pkg/Makefile snprintfv/Makefile
+ xml2ag/Makefile xml2ag/test/Makefile])
+
+AC_CONFIG_COMMANDS([stamp-h],
+[test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h])
+[CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}]
+AC_SUBST(CONFIG_SHELL)
+AC_DEFINE_UNQUOTED(CONFIG_SHELL,$CONFIG_SHELL,
+ [Define this to a working Bourne shell])
+AC_OUTPUT
+
+echo \
+"------------------------------------------------------------------------
+Configuration:
+
+ Source code location: ${srcdir}
+ Compiler: ${CC}
+ Compiler flags: ${CFLAGS}
+ Host System Type: ${host}
+ Install path: ${prefix}
+
+ See config.h for further configuration information.
+------------------------------------------------------------------------"
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 0000000..db67cbe
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,68 @@
+## -*- Mode: Makefile -*-
+##
+## Makefile.am -- process this file with automake to produce Makefile.in
+##
+## Time-stamp: "2012-08-11 09:38:01 bkorb"
+## Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+## ---------------------------------------------------------------------
+
+# This variable is needed to subvert automake's info rules.
+# They don't work for generated texi files:
+#
+INFO_DEPS = autogen.info
+MIexe = $(MAKEINFO) --no-split
+MAKEINFOFLAGS = -I$(top_srcdir)/autoopts -I../autoopts
+passenv = MAKE=$(MAKE) srcdir="$(srcdir)" SHELL="$(POSIX_SHELL)" \
+ top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)"
+
+run_mktexi = $(passenv) $(POSIX_SHELL) mk-agen-texi.sh
+all : $(INFO_DEPS)
+
+BUILT_SOURCES = autogen.texi
+info_TEXINFOS = $(BUILT_SOURCES)
+EXTRA_DIST = \
+ agdoc.texi auto-opts.tpl autogen-intro.texi \
+ autogen-intro.texi autogen-texi.txt fdl.texi \
+ gendocs_template invoke-autogen.texi invoke-columns.texi \
+ invoke-getdefs.texi invoke-snprintfv.texi invoke-xml2ag.texi \
+ libopts.texi mk-agen-texi.sh snprintfv.texi
+
+# MAINTAINERCLEANFILES = MakeDep.inc
+TEXI2DVI_FLAGS = --texinfo='@pagesizes 9.5in,7.0in'
+
+agdoc.texi : # self-depends upon all executables
+ $(run_mktexi) $@
+
+autogen.dvi : agdoc.texi
+autogen.texi : agdoc.texi mk-agen-texi.sh
+
+# Special rule for generating all the GNU standard formats.
+#
+autogen.txt : autogen.texi
+ $(MIexe) --fill-column=70 --paragraph-indent=0 --no-headers \
+ --output=$@ autogen.texi
+
+clobber : maintainer-clean
+
+.NOTPARALLEL:
+
+gnudocs : $(srcdir)/gendocs_template agdoc.texi
+ $(run_mktexi) $@
+
+# doc/Makefile.am ends here
diff --git a/doc/Makefile.in b/doc/Makefile.in
new file mode 100644
index 0000000..70ba865
--- /dev/null
+++ b/doc/Makefile.in
@@ -0,0 +1,774 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = doc
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/auto_gen-tpl.in $(top_srcdir)/config/texinfo.tex
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = auto_gen.tpl
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+TEXINFO_TEX = $(top_srcdir)/config/texinfo.tex
+am__TEXINFO_TEX_DIR = $(top_srcdir)/config
+DVIS = autogen.dvi
+PDFS = autogen.pdf
+PSS = autogen.ps
+HTMLS = autogen.html
+TEXINFOS = $(BUILT_SOURCES)
+TEXI2DVI = texi2dvi
+TEXI2PDF = $(TEXI2DVI) --pdf --batch
+MAKEINFOHTML = $(MAKEINFO) --html
+AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
+DVIPS = dvips
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__installdirs = "$(DESTDIR)$(infodir)"
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = @AGexe@
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = @CLexe@
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+
+# This variable is needed to subvert automake's info rules.
+# They don't work for generated texi files:
+#
+INFO_DEPS = autogen.info
+MIexe = $(MAKEINFO) --no-split
+MAKEINFOFLAGS = -I$(top_srcdir)/autoopts -I../autoopts
+passenv = MAKE=$(MAKE) srcdir="$(srcdir)" SHELL="$(POSIX_SHELL)" \
+ top_builddir="$(top_builddir)" top_srcdir="$(top_srcdir)"
+
+run_mktexi = $(passenv) $(POSIX_SHELL) mk-agen-texi.sh
+BUILT_SOURCES = autogen.texi
+info_TEXINFOS = $(BUILT_SOURCES)
+EXTRA_DIST = \
+ agdoc.texi auto-opts.tpl autogen-intro.texi \
+ autogen-intro.texi autogen-texi.txt fdl.texi \
+ gendocs_template invoke-autogen.texi invoke-columns.texi \
+ invoke-getdefs.texi invoke-snprintfv.texi invoke-xml2ag.texi \
+ libopts.texi mk-agen-texi.sh snprintfv.texi
+
+
+# MAINTAINERCLEANFILES = MakeDep.inc
+TEXI2DVI_FLAGS = --texinfo='@pagesizes 9.5in,7.0in'
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .dvi .html .info .pdf .ps .texi
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+auto_gen.tpl: $(top_builddir)/config.status $(srcdir)/auto_gen-tpl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+.texi.info:
+ restore=: && backupdir="$(am__leading_dot)am$$$$" && \
+ am__cwd=`pwd` && $(am__cd) $(srcdir) && \
+ rm -rf $$backupdir && mkdir $$backupdir && \
+ if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
+ for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
+ if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
+ done; \
+ else :; fi && \
+ cd "$$am__cwd"; \
+ if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
+ -o $@ $<; \
+ then \
+ rc=0; \
+ $(am__cd) $(srcdir); \
+ else \
+ rc=$$?; \
+ $(am__cd) $(srcdir) && \
+ $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
+ fi; \
+ rm -rf $$backupdir; exit $$rc
+
+.texi.dvi:
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
+ $(TEXI2DVI) --clean $<
+
+.texi.pdf:
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
+ $(TEXI2PDF) --clean $<
+
+.texi.html:
+ rm -rf $(@:.html=.htp)
+ if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
+ -o $(@:.html=.htp) $<; \
+ then \
+ rm -rf $@; \
+ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
+ mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
+ else \
+ if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
+ rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
+ exit 1; \
+ fi
+$(srcdir)/autogen.info: autogen.texi
+autogen.pdf: autogen.texi
+autogen.html: autogen.texi
+.dvi.ps:
+ TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+ $(DVIPS) -o $@ $<
+
+uninstall-dvi-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \
+ rm -f "$(DESTDIR)$(dvidir)/$$f"; \
+ done
+
+uninstall-html-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \
+ rm -rf "$(DESTDIR)$(htmldir)/$$f"; \
+ done
+
+uninstall-info-am:
+ @$(PRE_UNINSTALL)
+ @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \
+ list='$(INFO_DEPS)'; \
+ for file in $$list; do \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
+ if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
+ then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \
+ done; \
+ else :; fi
+ @$(NORMAL_UNINSTALL)
+ @list='$(INFO_DEPS)'; \
+ for file in $$list; do \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
+ (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \
+ echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
+ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
+ else :; fi); \
+ done
+
+uninstall-pdf-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(pdfdir)/$$f"; \
+ done
+
+uninstall-ps-am:
+ @$(NORMAL_UNINSTALL)
+ @list='$(PSS)'; test -n "$(psdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(psdir)/$$f"; \
+ done
+
+dist-info: $(INFO_DEPS)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ list='$(INFO_DEPS)'; \
+ for base in $$list; do \
+ case $$base in \
+ $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
+ esac; \
+ if test -f $$base; then d=.; else d=$(srcdir); fi; \
+ base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \
+ for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \
+ if test -f $$file; then \
+ relfile=`expr "$$file" : "$$d/\(.*\)"`; \
+ test -f "$(distdir)/$$relfile" || \
+ cp -p $$file "$(distdir)/$$relfile"; \
+ else :; fi; \
+ done; \
+ done
+
+mostlyclean-aminfo:
+ -rm -rf autogen.aux autogen.cp autogen.cps autogen.fn autogen.fns \
+ autogen.ky autogen.kys autogen.log autogen.pg autogen.pgs \
+ autogen.tmp autogen.toc autogen.tp autogen.tps autogen.vr \
+ autogen.vrs
+
+clean-aminfo:
+ -test -z "autogen.dvi autogen.pdf autogen.ps autogen.html" \
+ || rm -rf autogen.dvi autogen.pdf autogen.ps autogen.html
+
+maintainer-clean-aminfo:
+ @list='$(INFO_DEPS)'; for i in $$list; do \
+ i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \
+ echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \
+ rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
+ done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-info
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(INFO_DEPS)
+installdirs:
+ for dir in "$(DESTDIR)$(infodir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-aminfo clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am: $(DVIS)
+
+html: html-am
+
+html-am: $(HTMLS)
+
+info: info-am
+
+info-am: $(INFO_DEPS)
+
+install-data-am: install-info-am
+
+install-dvi: install-dvi-am
+
+install-dvi-am: $(DVIS)
+ @$(NORMAL_INSTALL)
+ @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \
+ done
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am: $(HTMLS)
+ @$(NORMAL_INSTALL)
+ @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ $(am__strip_dir) \
+ d2=$$d$$p; \
+ if test -d "$$d2"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
+ echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
+ else \
+ list2="$$list2 $$d2"; \
+ fi; \
+ done; \
+ test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \
+ done; }
+install-info: install-info-am
+
+install-info-am: $(INFO_DEPS)
+ @$(NORMAL_INSTALL)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \
+ fi; \
+ for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ esac; \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
+ for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
+ $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
+ if test -f $$ifile; then \
+ echo "$$ifile"; \
+ else : ; fi; \
+ done; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done
+ @$(POST_INSTALL)
+ @if $(am__can_run_installinfo); then \
+ list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
+ for file in $$list; do \
+ relfile=`echo "$$file" | sed 's|^.*/||'`; \
+ echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
+ install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\
+ done; \
+ else : ; fi
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am: $(PDFS)
+ @$(NORMAL_INSTALL)
+ @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done
+install-ps: install-ps-am
+
+install-ps-am: $(PSS)
+ @$(NORMAL_INSTALL)
+ @list='$(PSS)'; test -n "$(psdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-aminfo \
+ maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-aminfo mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am: $(PDFS)
+
+ps: ps-am
+
+ps-am: $(PSS)
+
+uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
+ uninstall-pdf-am uninstall-ps-am
+
+.MAKE: all check install install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-aminfo clean-generic \
+ clean-libtool dist-info distclean distclean-generic \
+ distclean-libtool distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-aminfo \
+ maintainer-clean-generic mostlyclean mostlyclean-aminfo \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am uninstall-dvi-am uninstall-html-am \
+ uninstall-info-am uninstall-pdf-am uninstall-ps-am
+
+all : $(INFO_DEPS)
+
+agdoc.texi : # self-depends upon all executables
+ $(run_mktexi) $@
+
+autogen.dvi : agdoc.texi
+autogen.texi : agdoc.texi mk-agen-texi.sh
+
+# Special rule for generating all the GNU standard formats.
+#
+autogen.txt : autogen.texi
+ $(MIexe) --fill-column=70 --paragraph-indent=0 --no-headers \
+ --output=$@ autogen.texi
+
+clobber : maintainer-clean
+
+.NOTPARALLEL:
+
+gnudocs : $(srcdir)/gendocs_template agdoc.texi
+ $(run_mktexi) $@
+
+# doc/Makefile.am ends here
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/doc/agdoc.texi b/doc/agdoc.texi
new file mode 100644
index 0000000..2d66161
--- /dev/null
+++ b/doc/agdoc.texi
@@ -0,0 +1,13607 @@
+@settitle GNU AutoGen - The Automated Program Generator
+@setchapternewpage off
+@syncodeindex pg cp
+@c %**end of header
+@copying
+This manual is for GNU AutoGen version 5.16, updated August 2012.
+
+Copyright @copyright{} 1992-2012 by Bruce Korb.
+
+@quotation
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.2 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+@end quotation
+@end copying
+
+@ignore
+EDIT THIS FILE WITH CAUTION (agdoc.texi)
+
+It has been AutoGen-ed August 11, 2012 at 09:42:32 AM by AutoGen 5.16.2
+From the definitions /old-home/bkorb/ag/ag/doc/ag-texi-30133.d/agdoc.def
+and the template file auto_gen.tpl
+
+Plus bits and pieces gathered from all over the source/build
+directories:
+ /old-home/bkorb/ag/ag/doc/auto_gen.tpl
+ /old-home/bkorb/ag/ag/agen5/opts.def
+ /old-home/bkorb/ag/ag/columns/invoke-columns.texi
+ /old-home/bkorb/ag/ag/getdefs/invoke-getdefs.texi
+ /old-home/bkorb/ag/ag/xml2ag/invoke-xml2ag.texi
+ /old-home/bkorb/ag/ag/doc/snprintfv.texi
+ /old-home/bkorb/ag/ag/agen5/defParse-fsm.c
+ /old-home/bkorb/ag/ag/agen5/opts.h
+ /old-home/bkorb/ag/ag/autoopts/libopts.texi
+ /old-home/bkorb/ag/ag/doc/autogen-intro.texi
+ /old-home/bkorb/ag/ag/agen5/invoke-autogen.texi
+ /old-home/bkorb/ag/ag/agen5/agShell.c
+ /old-home/bkorb/ag/ag/agen5/defDirect.c
+ /old-home/bkorb/ag/ag/agen5/expExtract.c
+ /old-home/bkorb/ag/ag/agen5/expFormat.c
+ /old-home/bkorb/ag/ag/agen5/expGperf.c
+ /old-home/bkorb/ag/ag/agen5/expGuile.c
+ /old-home/bkorb/ag/ag/agen5/expMake.c
+ /old-home/bkorb/ag/ag/agen5/expOutput.c
+ /old-home/bkorb/ag/ag/agen5/expPrint.c
+ /old-home/bkorb/ag/ag/agen5/expState.c
+ /old-home/bkorb/ag/ag/agen5/expString.c
+ /old-home/bkorb/ag/ag/agen5/fmemopen.c
+ /old-home/bkorb/ag/ag/agen5/funcCase.c
+ /old-home/bkorb/ag/ag/agen5/funcDef.c
+ /old-home/bkorb/ag/ag/agen5/funcEval.c
+ /old-home/bkorb/ag/ag/agen5/funcFor.c
+ /old-home/bkorb/ag/ag/agen5/funcIf.c
+ /old-home/bkorb/ag/ag/agen5/functions.c
+ /old-home/bkorb/ag/ag/agen5/schemedef.scm
+ /old-home/bkorb/ag/ag/doc/autogen-texi.txt
+
+@end ignore
+
+@dircategory GNU programming tools
+@direntry
+* AutoGen: (autogen). The Automated Program Generator
+@end direntry
+
+@ifinfo
+@ifnothtml
+This file documents GNU AutoGen Version 5.16.
+
+AutoGen copyright @copyright{} 1992-2012 Bruce Korb
+AutoOpts copyright @copyright{} 1992-2012 Bruce Korb
+snprintfv copyright @copyright{} 1999-2000 Gary V. Vaughan
+
+AutoGen is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+AutoGen is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+
+@ignore
+Permission is granted to process this file through TeX and print the
+results, provided the printed document carries copying permission
+notice identical to this one except for the removal of this paragraph.
+@end ignore
+@end ifnothtml
+@end ifinfo
+
+@finalout
+@titlepage
+@title AutoGen - The Automated Program Generator
+@subtitle For version 5.16, August 2012
+@author Bruce Korb
+@author @email{bkorb@@gnu.org}
+
+@page
+@vskip 0pt plus 1filll
+AutoGen copyright @copyright{} 1992-2012 Bruce Korb
+@sp 2
+This is the second edition of the GNU AutoGen documentation,
+@sp 2
+Published by Bruce Korb, 910 Redwood Dr., Santa Cruz, CA 95060
+
+AutoGen is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+AutoGen is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <http://www.gnu.org/licenses/>.
+
+@insertcopying
+@end titlepage
+
+@node Top, Introduction, , (dir)
+@top The Automated Program Generator
+@comment node-name, next, previous, up
+
+This file documents AutoGen version 5.16. It is a tool designed
+for generating program files that contain repetitive text with varied
+substitutions. This document is very long because it is intended as a
+reference document. For a quick start example, @xref{Example Usage}.
+
+The AutoGen distribution includes the basic generator engine and
+several add-on libraries and programs. Of the most general interest
+would be Automated Option processing, @xref{AutoOpts}, which also
+includes stand-alone support for configuration file parsing, @xref{Features}.
+Please see the ``Add-on packages for AutoGen'' section for additional
+programs and libraries associated with AutoGen.
+
+This edition documents version 5.16, August 2012.
+
+
+@menu
+* Introduction:: AutoGen's Purpose
+* Definitions File:: AutoGen Definitions File
+* Template File:: AutoGen Template
+* Augmenting AutoGen:: Augmenting AutoGen Features
+* autogen Invocation:: Invoking AutoGen
+* Installation:: Configuring and Installing
+* AutoOpts:: Automated Option Processing
+* Add-Ons:: Add-on packages for AutoGen
+* Future:: Some ideas for the future.
+* Copying This Manual:: Copying This Manual
+* Concept Index:: General index
+* Function Index:: Function index
+@end menu
+
+@ignore
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+@end ignore
+@page
+@node Introduction
+@chapter Introduction
+@cindex Introduction
+
+AutoGen is a tool designed for generating program files that contain
+repetitive text with varied substitutions. Its goal is to simplify the
+maintenance of programs that contain large amounts of repetitious text.
+This is especially valuable if there are several blocks of such text
+that must be kept synchronized in parallel tables.
+
+An obvious example is the problem of maintaining the code required for
+processing program options and configuration settings. Processing options
+requires a minimum of four different constructs be kept in proper order in
+different places in your program. You need at least:
+
+@enumerate
+@item
+The flag character in the flag string,
+@item
+code to process the flag when it is encountered,
+@item
+a global state variable or two, and
+@item
+a line in the usage text.
+@end enumerate
+
+@noindent
+You will need more things besides this if you choose to implement long option
+names, configuration (rc/ini) file processing, environment variable settings
+and keep all the documentation for these up to date. This can be done
+mechanically; with the proper templates and this program. In fact, it has
+already been done and AutoGen itself uses it@: @xref{AutoOpts}. For a simple
+example of Automated Option processing, @xref{Quick Start}. For a full list
+of the Automated Option features, @xref{Features}. Be forewarned, though, the
+feature list is ridiculously extensive.
+
+@menu
+* Generalities:: The Purpose of AutoGen
+* Example Usage:: A Simple Example
+* csh/zsh caveat:: csh/zsh caveat
+* Testimonial:: A User's Perspective
+@end menu
+
+@c === SECTION MARKER
+
+@node Generalities
+@section The Purpose of AutoGen
+
+The idea of this program is to have a text file, a template if
+you will, that contains the general text of the desired output file.
+That file includes substitution expressions and sections of text that are
+replicated under the control of separate definition files.
+
+@cindex design goals
+
+AutoGen was designed with the following features:
+
+@enumerate
+@item
+The definitions are completely separate from the template. By completely
+isolating the definitions from the template it greatly increases the
+flexibility of the template implementation. A secondary goal is that a
+template user only needs to specify those data that are necessary to describe
+his application of a template.
+
+@item
+Each datum in the definitions is named. Thus, the definitions can be
+rearranged, augmented and become obsolete without it being necessary to
+go back and clean up older definition files. Reduce incompatibilities!
+
+@item
+Every definition name defines an array of values, even when there is
+only one entry. These arrays of values are used to control the
+replication of sections of the template.
+
+@item
+There are named collections of definitions. They form a nested hierarchy.
+Associated values are collected and associated with a group name.
+These associated data are used collectively in sets of substitutions.
+
+@item
+The template has special markers to indicate where substitutions are
+required, much like the @code{$@{VAR@}} construct in a shell @code{here doc}.
+These markers are not fixed strings. They are specified at the start of
+each template. Template designers know best what fits into their
+syntax and can avoid marker conflicts.
+
+We did this because it is burdensome and difficult to avoid conflicts
+using either M4 tokenization or C preprocessor substitution rules. It
+also makes it easier to specify expressions that transform the value.
+Of course, our expressions are less cryptic than the shell methods.
+
+@item
+These same markers are used, in conjunction with enclosed keywords, to
+indicate sections of text that are to be skipped and for sections of
+text that are to be repeated. This is a major improvement over using C
+preprocessing macros. With the C preprocessor, you have no way of
+selecting output text because it is an @i{un}varying, mechanical
+substitution process.
+
+@item
+Finally, we supply methods for carefully controlling the output.
+Sometimes, it is just simply easier and clearer to compute some text or
+a value in one context when its application needs to be later. So,
+functions are available for saving text or values for later use.
+@end enumerate
+
+@c === SECTION MARKER
+
+@node Example Usage
+@section A Simple Example
+@cindex example, simple AutoGen
+
+This is just one simple example that shows a few basic features.
+If you are interested, you also may run "make check" with the
+@code{VERBOSE} environment variable set and see a number of other
+examples in the @file{agen5/test/testdir} directory.
+
+Assume you have an enumeration of names and you wish to associate some
+string with each name. Assume also, for the sake of this example,
+that it is either too complex or too large to maintain easily by hand.
+We will start by writing an abbreviated version of what the result
+is supposed to be. We will use that to construct our output templates.
+
+@noindent
+In a header file, @file{list.h}, you define the enumeration
+and the global array containing the associated strings:
+
+@example
+typedef enum @{
+ IDX_ALPHA,
+ IDX_BETA,
+ IDX_OMEGA @} list_enum;
+
+extern char const* az_name_list[ 3 ];
+@end example
+
+@noindent
+Then you also have @file{list.c} that defines the actual strings:
+
+@example
+#include "list.h"
+char const* az_name_list[] = @{
+ "some alpha stuff",
+ "more beta stuff",
+ "final omega stuff" @};
+@end example
+
+@noindent
+First, we will define the information that is unique for each enumeration
+name/string pair. This would be placed in a file named, @file{list.def},
+for example.
+
+@example
+autogen definitions list;
+list = @{ list_element = alpha;
+ list_info = "some alpha stuff"; @};
+list = @{ list_info = "more beta stuff";
+ list_element = beta; @};
+list = @{ list_element = omega;
+ list_info = "final omega stuff"; @};
+@end example
+
+The @code{autogen definitions list;} entry defines the file as an AutoGen
+definition file that uses a template named @code{list}. That is followed by
+three @code{list} entries that define the associations between the
+enumeration names and the strings. The order of the differently named
+elements inside of list is unimportant. They are reversed inside of the
+@code{beta} entry and the output is unaffected.
+
+Now, to actually create the output, we need a template or two that can be
+expanded into the files you want. In this program, we use a single template
+that is capable of multiple output files. The definitions above refer to a
+@file{list} template, so it would normally be named, @file{list.tpl}.
+
+It looks something like this.
+(For a full description, @xref{Template File}.)
+
+@example
+[+ AutoGen5 template h c +]
+[+ CASE (suffix) +][+
+ == h +]
+typedef enum @{[+
+ FOR list "," +]
+ IDX_[+ (string-upcase! (get "list_element")) +][+
+ ENDFOR list +] @} list_enum;
+
+extern char const* az_name_list[ [+ (count "list") +] ];
+[+
+
+ == c +]
+#include "list.h"
+char const* az_name_list[] = @{[+
+ FOR list "," +]
+ "[+list_info+]"[+
+ ENDFOR list +] @};[+
+
+ESAC +]
+@end example
+
+The @code{[+ AutoGen5 template h c +]} text tells AutoGen that this is
+an AutoGen version 5 template file; that it is to be processed twice;
+that the start macro marker is @code{[+}; and the end marker is
+@code{+]}. The template will be processed first with a suffix value of
+@code{h} and then with @code{c}. Normally, the suffix values are
+appended to the @file{base-name} to create the output file name.
+
+The @code{[+ == h +]} and @code{[+ == c +]} @code{CASE} selection clauses
+select different text for the two different passes. In this example,
+the output is nearly disjoint and could have been put in two separate
+templates. However, sometimes there are common sections and this is
+just an example.
+
+The @code{[+FOR list "," +]} and @code{[+ ENDFOR list +]} clauses delimit
+a block of text that will be repeated for every definition of @code{list}.
+Inside of that block, the definition name-value pairs that
+are members of each @code{list} are available for substitutions.
+
+The remainder of the macros are expressions. Some of these contain
+special expression functions that are dependent on AutoGen named values;
+others are simply Scheme expressions, the result of which will be
+inserted into the output text. Other expressions are names of AutoGen
+values. These values will be inserted into the output text. For example,
+@code{[+list_info+]} will result in the value associated with
+the name @code{list_info} being inserted between the double quotes and
+@code{(string-upcase! (get "list_element"))} will first "get" the value
+associated with the name @code{list_element}, then change the case of
+all the letters to upper case. The result will be inserted into the
+output document.
+
+If you have compiled AutoGen, you can copy out the template and definitions
+as described above and run @code{autogen list.def}. This will produce
+exactly the hypothesized desired output.
+
+One more point, too. Lets say you decided it was too much trouble to figure
+out how to use AutoGen, so you created this enumeration and string list with
+thousands of entries. Now, requirements have changed and it has become
+necessary to map a string containing the enumeration name into the enumeration
+number. With AutoGen, you just alter the template to emit the table of names.
+It will be guaranteed to be in the correct order, missing none of the entries.
+If you want to do that by hand, well, good luck.
+
+@c === SECTION MARKER
+
+@node csh/zsh caveat
+@section csh/zsh caveat
+
+AutoGen tries to use your normal shell so that you can supply shell code
+in a manner you are accustomed to using. If, however, you use csh or
+zsh, you cannot do this. Csh is sufficiently difficult to program that
+it is unsupported. Zsh, though largely programmable, also has some
+anomalies that make it incompatible with AutoGen usage. Therefore, when
+invoking AutoGen from these environments, you must be certain to set the
+SHELL environment variable to a Bourne-derived shell, e.g., sh, ksh or
+bash.
+
+Any shell you choose for your own scripts need to follow these basic
+requirements:
+
+@enumerate
+@item
+It handles @code{trap ":" $sig} without output to standard out. This is done
+when the server shell is first started. If your shell does not handle this,
+then it may be able to by loading functions from its start up files.
+@item
+At the beginning of each scriptlet, the command @code{\\cd $PWD}
+is inserted. This ensures that @code{cd} is not aliased to something
+peculiar and each scriptlet starts life in the execution directory.
+@item
+At the end of each scriptlet, the command @code{echo mumble} is
+appended. The program you use as a shell must emit the single
+argument @code{mumble} on a line by itself.
+@end enumerate
+
+@c === SECTION MARKER
+
+@node Testimonial
+@section A User's Perspective
+
+@format
+Alexandre wrote:
+>
+> I'd appreciate opinions from others about advantages/disadvantages of
+> each of these macro packages.
+@end format
+
+I am using AutoGen in my pet project, and find one of its best points to
+be that it separates the operational data from the implementation.
+
+Indulge me for a few paragraphs, and all will be revealed:
+In the manual, Bruce cites the example of maintaining command line flags
+inside the source code; traditionally spreading usage information, flag
+names, letters and processing across several functions (if not files).
+Investing the time in writing a sort of boiler plate (a template in
+AutoGen terminology) pays by moving all of the option details (usage,
+flags names etc.) into a well structured table (a definition file if you
+will), so that adding a new command line option becomes a simple matter
+of adding a set of details to the table.
+
+So far so good! Of course, now that there is a template, writing all of
+that tedious optargs processing and usage functions is no longer an
+issue. Creating a table of the options needed for the new project and
+running AutoGen generates all of the option processing code in C
+automatically from just the tabular data. AutoGen in fact already ships
+with such a template... AutoOpts.
+
+One final consequence of the good separation in the design of AutoGen is
+that it is retargetable to a greater extent. The
+egcs/gcc/fixinc/inclhack.def can equally be used (with different
+templates) to create a shell script (inclhack.sh) or a c program
+(fixincl.c).
+
+This is just the tip of the iceberg. AutoGen is far more powerful than
+these examples might indicate, and has many other varied uses. I am
+certain Bruce or I could supply you with many and varied examples, and I
+would heartily recommend that you try it for your project and see for
+yourself how it compares to m4.
+@cindex m4
+
+As an aside, I would be interested to see whether someone might be
+persuaded to rationalise autoconf with AutoGen in place of m4... Ben,
+are you listening? autoconf-3.0! `kay? =)O|
+
+@format
+Sincerely,
+ Gary V. Vaughan
+@end format
+
+@ignore
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+@end ignore
+@page
+@node Definitions File
+@chapter Definitions File
+@cindex definitions file
+@cindex .def file
+
+This chapter describes the syntax and semantics of the AutoGen
+definition file. In order to instantiate a template, you normally must
+provide a definitions file that identifies itself and contains some
+value definitions. Consequently, we keep it very simple. For
+"advanced" users, there are preprocessing directives, sparse
+arrays, named indexes and comments that may be used as well.
+
+The definitions file is used to associate values with names. Every
+value is implicitly an array of values, even if there is only one value.
+Values may be either simple strings or compound collections of
+name-value pairs. An array may not contain both simple and compound
+members. Fundamentally, it is as simple as:
+
+@example
+prog-name = "autogen";
+flag = @{
+ name = templ_dirs;
+ value = L;
+ descrip = "Template search directory list";
+@};
+@end example
+
+For purposes of commenting and controlling the processing of the
+definitions, C-style comments and most C preprocessing directives are
+honored. The major exception is that the @code{#if} directive is
+ignored, along with all following text through the matching
+@code{#endif} directive. The C preprocessor is not actually invoked, so
+C macro substitution is @strong{not} performed.
+
+@menu
+* Identification:: The Identification Definition
+* Definitions:: Named Definitions
+* Index Assignments:: Assigning an Index to a Definition
+* Dynamic Text:: Dynamic Text
+* Directives:: Controlling What Gets Processed
+* Predefines:: Pre-defined Names
+* Comments:: Commenting Your Definitions
+* Example:: What it all looks like.
+* Full Syntax:: Finite State Machine Grammar
+* Alternate Definition:: Alternate Definition Forms
+@end menu
+
+@c === SECTION MARKER
+
+@node Identification
+@section The Identification Definition
+@cindex identification
+
+The first definition in this file is used to identify it as a
+AutoGen file. It consists of the two keywords,
+@samp{autogen} and @samp{definitions} followed by the default
+template name and a terminating semi-colon (@code{;}). That is:
+
+@example
+ AutoGen Definitions @var{template-name};
+@end example
+
+@noindent
+Note that, other than the name @var{template-name}, the words
+@samp{AutoGen} and @samp{Definitions} are searched for without case
+sensitivity. Most lookups in this program are case insensitive.
+
+@noindent
+Also, if the input contains more identification definitions,
+they will be ignored. This is done so that you may include
+(@pxref{Directives}) other definition files without an identification
+conflict.
+
+@cindex template file
+
+@noindent
+AutoGen uses the name of the template to find the corresponding template
+file. It searches for the file in the following way, stopping when
+it finds the file:
+
+@enumerate
+@item
+It tries to open @file{./@var{template-name}}. If it fails,
+@item
+it tries @file{./@var{template-name}.tpl}.
+@item
+It searches for either of these files in the directories listed in the
+templ-dirs command line option.
+@end enumerate
+
+If AutoGen fails to find the template file in one of these places,
+it prints an error message and exits.
+
+@c === SECTION MARKER
+
+@node Definitions
+@section Named Definitions
+@cindex definitions
+
+A name is a sequence of characters beginning with an alphabetic character
+(@code{a} through @code{z}) followed by zero or more alpha-numeric
+characters and/or separator characters: hyphen (@code{-}), underscore
+(@code{_}) or carat (@code{^}). Names are case insensitive.
+
+Any name may have multiple values associated with it. Every name may be
+considered a sparse array of one or more elements. If there is more than
+one value, the values my be accessed by indexing the value with
+@code{[index]} or by iterating over them using the FOR (@pxref{FOR}) AutoGen
+macro on it, as described in the next chapter. Sparse arrays are specified
+by specifying an index when defining an entry
+(@pxref{Index Assignments,, Assigning an Index to a Definition}).
+
+There are two kinds of definitions, @samp{simple} and @samp{compound}.
+They are defined thus (@pxref{Full Syntax}):
+
+@example
+compound_name '=' '@{' definition-list '@}' ';'
+
+simple-name[2] '=' string ';'
+
+no^text^name ';'
+@end example
+
+@noindent
+@code{simple-name} has the third index (index number 2) defined here.
+@code{No^text^name} is a simple definition with a shorthand empty string
+value. The string values for definitions may be specified in any of
+several formation rules.
+
+@menu
+* def-list:: Definition List
+* double-quote-string:: Double Quote String
+* single-quote-string:: Single Quote String
+* simple-string:: An Unquoted String
+* shell-generated:: Shell Output String
+* scheme-generated:: Scheme Result String
+* here-string:: A Here String
+* concat-string:: Concatenated Strings
+@end menu
+
+@cindex simple definitions
+@cindex compound definitions
+
+@node def-list
+@subsection Definition List
+
+@code{definition-list} is a list of definitions that may or may not
+contain nested compound definitions. Any such definitions may
+@strong{only} be expanded within a @code{FOR} block iterating over the
+containing compound definition. @xref{FOR}.
+
+Here is, again, the example definitions from the previous chapter,
+with three additional name value pairs. Two with an empty value
+assigned (@var{first} and @var{last}), and a "global" @var{group_name}.
+
+@example
+autogen definitions list;
+group_name = example;
+list = @{ list_element = alpha; first;
+ list_info = "some alpha stuff"; @};
+list = @{ list_info = "more beta stuff";
+ list_element = beta; @};
+list = @{ list_element = omega; last;
+ list_info = "final omega stuff"; @};
+@end example
+
+@node double-quote-string
+@subsection Double Quote String
+
+@cindex string, double quote
+The string follows the C-style escaping, using the backslash to quote
+(escape) the following character(s). Certain letters are translated to
+various control codes (e.g. @code{\n}, @code{\f}, @code{\t}, etc.).
+@code{x} introduces a two character hex code. @code{0} (the digit zero)
+introduces a one to three character octal code (note: an octal byte followed
+by a digit must be represented with three octal digits, thus: @code{"\0001"}
+yielding a NUL byte followed by the ASCII digit 1). Any other character
+following the backslash escape is simply inserted, without error, into the
+string being formed.
+
+Like ANSI "C", a series of these strings, possibly intermixed with
+single quote strings, will be concatenated together.
+
+@node single-quote-string
+@subsection Single Quote String
+
+@cindex string, single quote
+This is similar to the shell single-quote string. However, escapes
+@code{\} are honored before another escape, single quotes @code{'}
+and hash characters @code{#}. This latter is done specifically
+to disambiguate lines starting with a hash character inside
+of a quoted string. In other words,
+
+@example
+fumble = '
+#endif
+';
+@end example
+
+could be misinterpreted by the definitions scanner, whereas
+this would not:
+
+@example
+fumble = '
+\#endif
+';
+@end example
+
+@*
+As with the double quote string, a series of these, even intermixed
+with double quote strings, will be concatenated together.
+
+@node simple-string
+@subsection An Unquoted String
+
+A simple string that does not contain white space @i{may} be left
+unquoted. The string must not contain any of the characters special to
+the definition text (i.e., @code{"}, @code{#}, @code{'}, @code{(},
+@code{)}, @code{,}, @code{;}, @code{<}, @code{=}, @code{>}, @code{[},
+@code{]}, @code{`}, @code{@{}, or @code{@}}). This list is subject to
+change, but it will never contain underscore (@code{_}), period
+(@code{.}), slash (@code{/}), colon (@code{:}), hyphen (@code{-}) or
+backslash (@code{\\}). Basically, if the string looks like it is a
+normal DOS or UNIX file or variable name, and it is not one of two
+keywords (@samp{autogen} or @samp{definitions}) then it is OK to not
+quote it, otherwise you should.
+
+@node shell-generated
+@subsection Shell Output String
+@cindex shell-generated string
+
+@cindex string, shell output
+This is assembled according to the same rules as the double quote string,
+except that there is no concatenation of strings and the resulting string is
+written to a shell server process. The definition takes on the value of
+the output string.
+
+NB@: The text is interpreted by a server shell. There may be left over
+state from previous server shell processing. This scriptlet may also leave
+state for subsequent processing. However, a @code{cd} to the original
+directory is always issued before the new command is issued.
+
+@node scheme-generated
+@subsection Scheme Result String
+
+A scheme result string must begin with an open parenthesis @code{(}.
+The scheme expression will be evaluated by Guile and the
+value will be the result. The AutoGen expression functions
+are @strong{dis}abled at this stage, so do not use them.
+
+@node here-string
+@subsection A Here String
+@cindex here-string
+
+A @samp{here string} is formed in much the same way as a shell here doc. It
+is denoted with two less than characters(@code{<<}) and, optionally, a hyphen.
+This is followed by optional horizontal white space and an ending
+marker-identifier. This marker must follow the syntax rules for identifiers.
+Unlike the shell version, however, you must not quote this marker.
+
+The resulting string will start with the first character on the next line and
+continue up to but not including the newline that precedes the line that
+begins with the marker token. The characters are copied directly into the
+result string. Mostly.
+
+If a hyphen follows the less than characters, then leading tabs will be
+stripped and the terminating marker will be recognized even if preceded by
+tabs. Also, if the first character on the line (after removing tabs) is a
+backslash and the next character a tab, then the backslash will be removed as
+well. No other kind of processing is done on this string.
+
+Here are two examples:
+@example
+str1 = <<- STR_END
+ $quotes = " ' `
+ STR_END;
+
+str2 = << STR_END
+ $quotes = " ' `
+ STR_END;
+STR_END;
+@end example
+The first string contains no new line characters.
+The first character is the dollar sign, the last the back quote.
+
+The second string contains one new line character. The first character
+is the tab character preceding the dollar sign. The last character is
+the semicolon after the @code{STR_END}. That @code{STR_END} does not
+end the string because it is not at the beginning of the line. In the
+preceding case, the leading tab was stripped.
+
+@node concat-string
+@subsection Concatenated Strings
+@cindex concat-string
+
+If single or double quote characters are used,
+then you also have the option, a la ANSI-C syntax,
+of implicitly concatenating a series of them together,
+with intervening white space ignored.
+
+NB@: You @strong{cannot} use directives to alter the string
+content. That is,
+
+@example
+str = "fumble"
+#ifdef LATER
+ "stumble"
+#endif
+ ;
+@end example
+
+@noindent
+will result in a syntax error. The preprocessing directives are not
+carried out by the C preprocessor. However,
+
+@example
+str = '"fumble\n"
+#ifdef LATER
+" stumble\n"
+#endif
+';
+@end example
+
+@noindent
+@strong{Will} work. It will enclose the @samp{#ifdef LATER}
+and @samp{#endif} in the string. But it may also wreak
+havoc with the definition processing directives. The hash
+characters in the first column should be disambiguated with
+an escape @code{\} or join them with previous lines:
+@code{"fumble\n#ifdef LATER...}.
+
+@c === SECTION MARKER
+
+@node Index Assignments
+@section Assigning an Index to a Definition
+@cindex Definition Index
+
+In AutoGen, every name is implicitly an array of values.
+When assigning values, they are usually implicitly
+assigned to the next highest slot. They can also be
+specified explicitly:
+
+@example
+mumble[9] = stumble;
+mumble[0] = grumble;
+@end example
+
+@noindent
+If, subsequently, you assign a value to @code{mumble} without an
+index, its index will be @code{10}, not @code{1}.
+If indexes are specified, they must not cause conflicts.
+
+@code{#define}-d names may also be used for index values.
+This is equivalent to the above:
+
+@example
+#define FIRST 0
+#define LAST 9
+mumble[LAST] = stumble;
+mumble[FIRST] = grumble;
+@end example
+
+All values in a range do @strong{not} have to be filled in.
+If you leave gaps, then you will have a sparse array. This
+is fine (@pxref{FOR}). You have your choice of iterating
+over all the defined values, or iterating over a range
+of slots. This:
+
+@example
+[+ FOR mumble +][+ ENDFOR +]
+@end example
+
+@noindent
+iterates over all and only the defined entries, whereas this:
+
+@example
+[+ FOR mumble (for-by 1) +][+ ENDFOR +]
+@end example
+
+@noindent
+will iterate over all 10 "slots". Your template will
+likely have to contain something like this:
+
+@example
+[+ IF (exist? (sprintf "mumble[%d]" (for-index))) +]
+@end example
+
+@noindent
+or else "mumble" will have to be a compound value that,
+say, always contains a "grumble" value:
+
+@example
+[+ IF (exist? "grumble") +]
+@end example
+
+@c === SECTION MARKER
+
+@node Dynamic Text
+@section Dynamic Text
+@cindex Dynamic Definition Text
+
+There are several methods for including dynamic content inside a definitions
+file. Three of them are mentioned above (@ref{shell-generated} and
+@pxref{scheme-generated}) in the discussion of string formation rules.
+Another method uses the @code{#shell} processing directive.
+It will be discussed in the next section (@pxref{Directives}).
+Guile/Scheme may also be used to yield to create definitions.
+
+When the Scheme expression is preceded by a backslash and single
+quote, then the expression is expected to be an alist of
+names and values that will be used to create AutoGen definitions.
+
+@noindent
+This method can be be used as follows:
+
+@example
+\'( (name (value-expression))
+ (name2 (another-expr)) )
+@end example
+
+@noindent
+This is entirely equivalent to:
+
+@example
+name = (value-expression);
+name2 = (another-expr);
+@end example
+
+@noindent
+Under the covers, the expression gets handed off to a Guile function
+named @code{alist->autogen-def} in an expression that looks like this:
+
+@example
+(alist->autogen-def
+ ( (name (value-expression)) (name2 (another-expr)) ) )
+@end example
+
+@node Directives
+@section Controlling What Gets Processed
+@cindex directives
+
+Definition processing directives can @strong{only} be processed
+if the '#' character is the first character on a line. Also, if you
+want a '#' as the first character of a line in one of your string
+assignments, you should either escape it by preceding it with a
+backslash @samp{\}, or by embedding it in the string as in @code{"\n#"}.
+
+All of the normal C preprocessing directives are recognized, though
+several are ignored. There is also an additional @code{#shell} -
+@code{#endshell} pair. Another minor difference is that AutoGen
+directives must have the hash character (@code{#}) in column 1.
+
+The final tweak is that @code{#!} is treated as a comment line.
+Using this feature, you can use: @samp{#! /usr/local/bin/autogen}
+as the first line of a definitions file, set the mode to executable
+and "run" the definitions file as if it were a direct invocation of
+AutoGen. This was done for its hack value.
+
+The ignored directives are:
+@code{#ident}, @code{#let}, @code{#pragma}, and @code{#if}.
+Note that when ignoring the @code{#if} directive, all intervening
+text through its matching @code{#endif} is also ignored,
+including the @code{#else} clause.
+
+The AutoGen directives that affect the processing of
+definitions are:
+
+@table @code
+@item #assert `shell-script` | (scheme-expr) | <anything else>
+@cindex #assert
+@cindex assert directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 406.
+@end ignore
+
+If the @code{shell-script} or @code{scheme-expr} do not yield @code{true}
+valued results, autogen will be aborted. If @code{<anything else>} or
+nothing at all is provided, then this directive is ignored.
+
+When writing the shell script, remember this is on a preprocessing
+line. Multiple lines must be backslash continued and the result is a
+single long line. Separate multiple commands with semi-colons.
+
+The result is @code{false} (and fails) if the result is empty, the
+number zero, or a string that starts with the letters 'n' or 'f' ("no"
+or "false").
+
+@item #define name [ <text> ]
+@cindex #define
+@cindex define directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 469.
+@end ignore
+
+Will add the name to the define list as if it were a DEFINE program
+argument. Its value will be the first non-whitespace token following
+the name. Quotes are @strong{not} processed.
+
+After the definitions file has been processed, any remaining entries
+in the define list will be added to the environment.
+
+@item #elif
+@cindex #elif
+@cindex elif directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 542.
+@end ignore
+
+This must follow an @code{#if}
+otherwise it will generate an error.
+It will be ignored.
+
+@item #else
+@cindex #else
+@cindex else directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 560.
+@end ignore
+
+This must follow an @code{#if}, @code{#ifdef} or @code{#ifndef}.
+If it follows the @code{#if}, then it will be ignored. Otherwise,
+it will change the processing state to the reverse of what it was.
+
+@item #endif
+@cindex #endif
+@cindex endif directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 578.
+@end ignore
+
+This must follow an @code{#if}, @code{#ifdef} or @code{#ifndef}.
+In all cases, this will resume normal processing of text.
+
+@item #endmac
+@cindex #endmac
+@cindex endmac directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 595.
+@end ignore
+
+This terminates a "macdef", but must not ever be encountered directly.
+
+@item #endshell
+@cindex #endshell
+@cindex endshell directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 611.
+@end ignore
+
+Ends the text processed by a command shell into autogen definitions.
+
+@item #error [ <descriptive text> ]
+@cindex #error
+@cindex error directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 631.
+@end ignore
+
+This directive will cause AutoGen to stop processing
+and exit with a status of EXIT_FAILURE.
+
+
+@item #if [ <ignored conditional expression> ]
+@cindex #if
+@cindex if directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 656.
+@end ignore
+
+@code{#if} expressions are not analyzed. @strong{Everything} from here
+to the matching @code{#endif} is skipped.
+
+@item #ifdef name-to-test
+@cindex #ifdef
+@cindex ifdef directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 673.
+@end ignore
+
+The definitions that follow, up to the matching @code{#endif} will be
+processed only if there is a corresponding @code{-Dname} command line
+option or if a @code{#define} of that name has been previously encountered.
+
+@item #ifndef name-to-test
+@cindex #ifndef
+@cindex ifndef directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 692.
+@end ignore
+
+The definitions that follow, up to the matching @code{#endif} will be
+processed only if there is @strong{not} a corresponding @code{-Dname}
+command line option or there was a canceling @code{-Uname} option.
+
+@item #include unadorned-file-name
+@cindex #include
+@cindex include directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 711.
+@end ignore
+
+This directive will insert definitions from another file into
+the current collection. If the file name is adorned with
+double quotes or angle brackets (as in a C program), then the
+include is ignored.
+
+
+@item #line
+@cindex #line
+@cindex line directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 829.
+@end ignore
+
+Alters the current line number and/or file name. You may wish to
+use this directive if you extract definition source from other files.
+@command{getdefs} uses this mechanism so AutoGen will report the correct
+file and approximate line number of any errors found in extracted
+definitions.
+
+@item #macdef
+@cindex #macdef
+@cindex macdef directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 873.
+@end ignore
+
+This is a new AT&T research preprocessing directive. Basically, it is
+a multi-line #define that may include other preprocessing directives.
+
+@item #option opt-name [ <text> ]
+@cindex #option
+@cindex option directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 888.
+@end ignore
+
+This directive will pass the option name and associated text to the
+AutoOpts optionLoadLine routine (@pxref{libopts-optionLoadLine}). The
+option text may span multiple lines by continuing them with a backslash.
+The backslash/newline pair will be replaced with two space characters.
+This directive may be used to set a search path for locating template files
+For example, this:
+
+@example
+#option templ-dirs $ENVVAR/dirname
+@end example
+@noindent
+will direct autogen to use the @code{ENVVAR} environment variable to find
+a directory named @code{dirname} that (may) contain templates. Since these
+directories are searched in most recently supplied first order, search
+directories supplied in this way will be searched before any supplied on
+the command line.
+
+
+@item #shell
+@cindex #shell
+@cindex shell directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 925.
+@end ignore
+
+Invokes @code{$SHELL} or @file{/bin/sh} on a script that should
+generate AutoGen definitions. It does this using the same server
+process that handles the back-quoted @code{`} text.
+@strong{CAUTION}@: let not your @code{$SHELL} be @code{csh}.
+
+@item #undef name-to-undefine
+@cindex #undef
+@cindex undef directive
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/defDirect.c line 1025.
+@end ignore
+
+Will remove any entries from the define list
+that match the undef name pattern.
+@end table
+@ignore
+START == COMMENTS == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@ignore
+Resume input from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node Predefines
+@section Pre-defined Names
+@cindex predefines
+
+When AutoGen starts, it tries to determine several names from the
+operating environment and put them into environment variables for use in
+both @code{#ifdef} tests in the definitions files and in shell scripts
+with environment variable tests. @code{__autogen__} is always defined.
+For other names, AutoGen will first try to use the POSIX version of the
+@code{sysinfo(2)} system call. Failing that, it will try for the POSIX
+@code{uname(2)} call. If neither is available, then only
+"@code{__autogen__}" will be inserted into the environment.
+In all cases, the associated names are converted to lower case, surrounded
+by doubled underscores and non-symbol characters are replaced with
+underscores.
+
+With Solaris on a sparc platform, @code{sysinfo(2)} is available.
+The following strings are used:
+
+@itemize @bullet
+@item
+@code{SI_SYSNAME} (e.g., "__sunos__")
+@item
+@code{SI_HOSTNAME} (e.g., "__ellen__")
+@item
+@code{SI_ARCHITECTURE} (e.g., "__sparc__")
+@item
+@code{SI_HW_PROVIDER} (e.g., "__sun_microsystems__")
+@item
+@code{SI_PLATFORM} (e.g., "__sun_ultra_5_10__")
+@item
+@code{SI_MACHINE} (e.g., "__sun4u__")
+@end itemize
+
+For Linux and other operating systems that only support the
+@code{uname(2)} call, AutoGen will use these values:
+
+@itemize @bullet
+@item
+@code{sysname} (e.g., "__linux__")
+@item
+@code{machine} (e.g., "__i586__")
+@item
+@code{nodename} (e.g., "__bach__")
+@end itemize
+
+By testing these pre-defines in my definitions, you can select
+pieces of the definitions without resorting to writing shell
+scripts that parse the output of @code{uname(1)}. You can also
+segregate real C code from autogen definitions by testing for
+"@code{__autogen__}".
+
+@example
+#ifdef __bach__
+ location = home;
+#else
+ location = work;
+#endif
+@end example
+
+@c === SECTION MARKER
+
+@node Comments
+@section Commenting Your Definitions
+@cindex comments
+
+The definitions file may contain C and C++ style comments.
+
+@example
+/*
+ * This is a comment. It continues for several lines and closes
+ * when the characters '*' and '/' appear together.
+ */
+// this comment is a single line comment
+@end example
+
+@c === SECTION MARKER
+
+@node Example
+@section What it all looks like.
+
+@noindent
+This is an extended example:
+
+@example
+autogen definitions @samp{template-name};
+/*
+ * This is a comment that describes what these
+ * definitions are all about.
+ */
+global = "value for a global text definition.";
+
+/*
+ * Include a standard set of definitions
+ */
+#include standards.def
+
+a_block = @{
+ a_field;
+ a_subblock = @{
+ sub_name = first;
+ sub_field = "sub value.";
+ @};
+
+#ifdef FEATURE
+ a_subblock = @{
+ sub_name = second;
+ @};
+#endif
+
+@};
+@end example
+
+@ignore
+END == COMMENTS == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+@node Full Syntax
+@section Finite State Machine Grammar
+
+The preprocessing directives and comments are not part of the grammar. They
+are handled by the scanner/lexer. The following was extracted directly from
+the generated defParse-fsm.c source file. The "EVT:" is the token seen,
+the "STATE:" is the current state and the entries in this table describe
+the next state and the action to take. Invalid transitions were removed
+from the table.
+
+@ignore
+Extracted from $top_srcdir/agen5/defParse.y
+@end ignore
+@example
+dp_trans_table[ DP_STATE_CT ][ DP_EVENT_CT ] = @{
+
+ /* STATE 0: DP_ST_INIT */
+ @{ @{ DP_ST_NEED_DEF, NULL @}, /* EVT: AUTOGEN */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: DEFINITIONS */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: End-Of-File */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: VAR_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: OTHER_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: HERE_STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: NUMBER */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: ; */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: = */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: , */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @{ */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @} */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: [ */
+ @{ DP_ST_INVALID, dp_do_invalid @} /* EVT: ] */
+
+ /* STATE 1: DP_ST_NEED_DEF */
+ @{ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: AUTOGEN */
+ @{ DP_ST_NEED_TPL, NULL @}, /* EVT: DEFINITIONS */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: End-Of-File */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: VAR_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: OTHER_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: HERE_STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: NUMBER */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: ; */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: = */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: , */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @{ */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @} */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: [ */
+ @{ DP_ST_INVALID, dp_do_invalid @} /* EVT: ] */
+
+ /* STATE 2: DP_ST_NEED_TPL */
+ @{ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: AUTOGEN */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: DEFINITIONS */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: End-Of-File */
+ @{ DP_ST_NEED_SEMI, dp_do_tpl_name @}, /* EVT: VAR_NAME */
+ @{ DP_ST_NEED_SEMI, dp_do_tpl_name @}, /* EVT: OTHER_NAME */
+ @{ DP_ST_NEED_SEMI, dp_do_tpl_name @}, /* EVT: STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: HERE_STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: NUMBER */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: ; */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: = */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: , */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @{ */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @} */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: [ */
+ @{ DP_ST_INVALID, dp_do_invalid @} /* EVT: ] */
+
+ /* STATE 3: DP_ST_NEED_SEMI */
+ @{ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: AUTOGEN */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: DEFINITIONS */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: End-Of-File */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: VAR_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: OTHER_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: HERE_STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: NUMBER */
+ @{ DP_ST_NEED_NAME, NULL @}, /* EVT: ; */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: = */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: , */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @{ */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @} */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: [ */
+ @{ DP_ST_INVALID, dp_do_invalid @} /* EVT: ] */
+
+ /* STATE 4: DP_ST_NEED_NAME */
+ @{ @{ DP_ST_NEED_DEF, NULL @}, /* EVT: AUTOGEN */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: DEFINITIONS */
+ @{ DP_ST_DONE, dp_do_need_name_end @}, /* EVT: End-Of-File */
+ @{ DP_ST_HAVE_NAME, dp_do_need_name_var_name @}, /* EVT: VAR_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: OTHER_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: HERE_STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: NUMBER */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: ; */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: = */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: , */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @{ */
+ @{ DP_ST_HAVE_VALUE, dp_do_end_block @}, /* EVT: @} */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: [ */
+ @{ DP_ST_INVALID, dp_do_invalid @} /* EVT: ] */
+
+ /* STATE 5: DP_ST_HAVE_NAME */
+ @{ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: AUTOGEN */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: DEFINITIONS */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: End-Of-File */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: VAR_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: OTHER_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: HERE_STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: NUMBER */
+ @{ DP_ST_NEED_NAME, dp_do_empty_val @}, /* EVT: ; */
+ @{ DP_ST_NEED_VALUE, dp_do_have_name_lit_eq @}, /* EVT: = */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: , */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @{ */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @} */
+ @{ DP_ST_NEED_IDX, NULL @}, /* EVT: [ */
+ @{ DP_ST_INVALID, dp_do_invalid @} /* EVT: ] */
+
+ /* STATE 6: DP_ST_NEED_VALUE */
+ @{ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: AUTOGEN */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: DEFINITIONS */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: End-Of-File */
+ @{ DP_ST_HAVE_VALUE, dp_do_str_value @}, /* EVT: VAR_NAME */
+ @{ DP_ST_HAVE_VALUE, dp_do_str_value @}, /* EVT: OTHER_NAME */
+ @{ DP_ST_HAVE_VALUE, dp_do_str_value @}, /* EVT: STRING */
+ @{ DP_ST_HAVE_VALUE, dp_do_str_value @}, /* EVT: HERE_STRING */
+ @{ DP_ST_HAVE_VALUE, dp_do_str_value @}, /* EVT: NUMBER */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: ; */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: = */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: , */
+ @{ DP_ST_NEED_NAME, dp_do_start_block @}, /* EVT: @{ */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @} */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: [ */
+ @{ DP_ST_INVALID, dp_do_invalid @} /* EVT: ] */
+
+ /* STATE 7: DP_ST_NEED_IDX */
+ @{ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: AUTOGEN */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: DEFINITIONS */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: End-Of-File */
+ @{ DP_ST_NEED_CBKT, dp_do_indexed_name @}, /* EVT: VAR_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: OTHER_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: HERE_STRING */
+ @{ DP_ST_NEED_CBKT, dp_do_indexed_name @}, /* EVT: NUMBER */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: ; */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: = */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: , */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @{ */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @} */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: [ */
+ @{ DP_ST_INVALID, dp_do_invalid @} /* EVT: ] */
+
+ /* STATE 8: DP_ST_NEED_CBKT */
+ @{ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: AUTOGEN */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: DEFINITIONS */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: End-Of-File */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: VAR_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: OTHER_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: HERE_STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: NUMBER */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: ; */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: = */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: , */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @{ */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @} */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: [ */
+ @{ DP_ST_INDX_NAME, NULL @} /* EVT: ] */
+
+ /* STATE 9: DP_ST_INDX_NAME */
+ @{ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: AUTOGEN */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: DEFINITIONS */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: End-Of-File */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: VAR_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: OTHER_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: HERE_STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: NUMBER */
+ @{ DP_ST_NEED_NAME, dp_do_empty_val @}, /* EVT: ; */
+ @{ DP_ST_NEED_VALUE, NULL @}, /* EVT: = */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: , */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @{ */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @} */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: [ */
+ @{ DP_ST_INVALID, dp_do_invalid @} /* EVT: ] */
+
+ /* STATE 10: DP_ST_HAVE_VALUE */
+ @{ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: AUTOGEN */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: DEFINITIONS */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: End-Of-File */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: VAR_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: OTHER_NAME */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: HERE_STRING */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: NUMBER */
+ @{ DP_ST_NEED_NAME, NULL @}, /* EVT: ; */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: = */
+ @{ DP_ST_NEED_VALUE, dp_do_next_val @}, /* EVT: , */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @{ */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: @} */
+ @{ DP_ST_INVALID, dp_do_invalid @}, /* EVT: [ */
+ @{ DP_ST_INVALID, dp_do_invalid @} /* EVT: ] */
+@end example
+@ignore
+START == TEMPLATE == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node Alternate Definition
+@section Alternate Definition Forms
+@cindex Alternate Definition
+
+There are several methods for supplying data values for templates.
+
+@table @samp
+@item no definitions
+It is entirely possible to write a template that does not depend upon
+external definitions. Such a template would likely have an unvarying
+output, but be convenient nonetheless because of an external library
+of either AutoGen or Scheme functions, or both. This can be accommodated
+by providing the @code{--override-tpl} and @code{--no-definitions}
+options on the command line. @xref{autogen Invocation}.
+
+@item CGI
+AutoGen behaves as a CGI server if the definitions input is from stdin
+and the environment variable @code{REQUEST_METHOD} is defined
+and set to either "GET" or "POST", @xref{AutoGen CGI}. Obviously,
+all the values are constrained to strings because there is no way
+to represent nested values.
+
+@item XML
+AutoGen comes with a program named, @code{xml2ag}. Its output can
+either be redirected to a file for later use, or the program can
+be used as an AutoGen wrapper. @xref{xml2ag Invocation}.
+
+The introductory template example (@pxref{Example Usage}) can be rewritten
+in XML as follows:
+
+@example
+<EXAMPLE template="list.tpl">
+<LIST list_element="alpha"
+ list_info="some alpha stuff"/>
+<LIST list_info="more beta stuff"
+ list_element="beta"/>
+<LIST list_element="omega"
+ list_info="final omega stuff"/>
+</EXAMPLE>
+@end example
+
+A more XML-normal form might look like this:
+@example
+<EXAMPLE template="list.tpl">
+<LIST list_element="alpha">some alpha stuff</LIST>
+<LIST list_element="beta" >more beta stuff</LIST>
+<LIST list_element="omega">final omega stuff</LIST>
+</EXAMPLE>
+@end example
+@noindent
+but you would have to change the template @code{list_info} references
+into @code{text} references.
+
+@item standard AutoGen definitions
+Of course. :-)
+
+@end table
+
+@ignore
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+@end ignore
+@page
+@node Template File
+@chapter Template File
+@cindex template file
+@cindex .tpl file
+
+The AutoGen template file defines the content of the output text.
+It is composed of two parts. The first part consists of a pseudo
+macro invocation and commentary. It is followed by the template proper.
+
+@cindex pseudo macro
+@cindex macro, pseudo
+This pseudo macro is special. It is used to identify the file as a
+AutoGen template file, fixing the starting and ending marks for
+the macro invocations in the rest of the file, specifying the list
+of suffixes to be generated by the template and, optionally, the
+shell to use for processing shell commands embedded in the template.
+
+AutoGen-ing a file consists of copying text from the template to the
+output file until a start macro marker is found. The text from the
+start marker to the end marker constitutes the macro text. AutoGen
+macros may cause sections of the template to be skipped or processed
+several times. The process continues until the end of the template is
+reached. The process is repeated once for each suffix specified in the
+pseudo macro.
+
+This chapter describes the format of the AutoGen template macros
+and the usage of the AutoGen native macros. Users may augment
+these by defining their own macros, @xref{DEFINE}.
+
+@menu
+* pseudo macro:: Format of the Pseudo Macro
+* naming values:: Naming a value
+* expression syntax:: Macro Expression Syntax
+* AutoGen Functions:: AutoGen Scheme Functions
+* Common Functions:: Common Scheme Functions
+* native macros:: AutoGen Native Macros
+* output controls:: Redirecting Output
+@end menu
+
+@c === SECTION MARKER
+
+@node pseudo macro
+@section Format of the Pseudo Macro
+@cindex pseudo macro
+
+The pseudo macro is used to tell AutoGen how to process a template.
+It tells autogen:
+
+@enumerate
+@item
+The start macro marker. It consists of punctuation characters used to
+demarcate the start of a macro. It may be up to seven characters long and
+must be the first non-whitespace characters in the file.
+
+@noindent
+It is generally a good idea to use some sort of opening
+bracket in the starting macro and closing bracket in the ending
+macro (e.g. @code{@{}, @code{(}, @code{[}, or even @code{<}
+in the starting macro). It helps both visually and with editors
+capable of finding a balancing parenthesis.
+
+@item
+That start marker must be immediately followed by the identifier strings
+"AutoGen5" and then "template", though capitalization is not important.
+@end enumerate
+
+@noindent
+The next several components may be intermingled:
+
+@enumerate 3
+@item
+Zero, one or more suffix specifications tell AutoGen how many times to
+process the template file. No suffix specifications mean that it is to
+be processed once and that the generated text is to be written to
+@file{stdout}. The current suffix for each pass can be determined with the
+@code{(suffix)} scheme function (@pxref{SCM suffix}).
+
+The suffix specification consists of a sequence of POSIX compliant file name
+characters and, optionally, an equal sign and a file name formatting
+specification. That specification may be either an ordinary sequence of
+file name characters with zero, one or two "%s" formatting sequences in it,
+or else it may be a Scheme expression that, when evaluated, produces such a
+string. The Scheme result may not be empty. The two string arguments
+allowed for that string are the base name of the definition file, and the
+current suffix (that being the text to the left of the equal sign). (Note:
+"POSIX compliant file name characters" consist of alphanumerics plus the
+period (@code{.}), hyphen (@code{-}) and underscore (@code{_}) characters.)
+
+If the suffix begins with one of these three latter characters and
+a formatting string is not specified, then that character is presumed to
+be the suffix separator. Otherwise, without a specified format string,
+a single period will separate the suffix from the base name in constructing
+the output file name.
+
+@item
+Shell specification: to specify that the template was written expecting a
+particular shell to run the shell commands. By default, the shell used is the
+autoconf-ed @code{CONFIG_SHELL}. This will usually be @file{/bin/sh}. The
+shell is specified by a hash mark (@code{#}) followed by an exclamation mark
+(@code{!}) followed by a full-path file name (e.g. @file{/usr/xpg4/bin/sh} on
+Solaris):
+@example
+[= Autogen5 Template c
+#!/usr/xpg4/bin/sh
+=]
+@end example
+
+@item
+Comments: blank lines, lines starting with a hash mark (@code{#}) and not
+specifying a shell, and edit mode markers (text between pairs of @code{-*-}
+strings) are all treated as comments.
+
+@item
+Some scheme expressions may be inserted in order to make configuration
+changes before template processing begins. ``@i{before template
+processing begins}'' means that there is no current output file, no current
+suffix and, basically, none of the AutoGen specific functions
+(@pxref{AutoGen Functions}) may be invoked.
+
+The scheme expression can also be used, for example, to save a pre-existing
+output file for later text extraction (@pxref{SCM extract}).
+
+@example
+(shellf "mv -f %1$s.c %1$s.sav" (base-name))
+@end example
+@end enumerate
+
+@noindent
+After these must come the end macro marker:
+
+@enumerate 6
+@item
+The punctuation characters used to demarcate the end of a macro.
+Like the start marker, it must consist of seven or fewer punctuation
+characters.
+@end enumerate
+
+The ending macro marker has a few constraints on its content. Some of
+them are just advisory, though. There is no special check for advisory
+restrictions.
+
+@itemize @bullet
+@item
+It must not begin with a POSIX file name character (hyphen @code{-},
+underscore @code{_} or period @code{.}), the backslash (@code{\}) or
+open parenthesis (@code{(}). These are used to identify a suffix
+specification, indicate Scheme code and trim white space.
+
+@item
+If it begins with an equal sign, then it
+must be separated from any suffix specification by white space.
+
+@item
+The closing marker may not begin with an open parenthesis, as that is used
+to enclose a scheme expression.
+
+@item
+It cannot begin with a backslash, as that is used to indicate white
+space trimming after the end macro mark. If, in the body of the template,
+you put the backslash character (@code{\}) before the end macro mark, then
+any white space characters after the mark and through the newline character
+are trimmed.
+
+@item
+It is also helpful to avoid using the comment marker (@code{#}).
+It might be seen as a comment within the pseudo macro.
+
+@item
+You should avoid using any of the quote characters@: double,
+single or back-quote. It won't confuse AutoGen, but it might well
+confuse you and/or your editor.
+@end itemize
+
+As an example, assume we want to use @code{[+} and @code{+]} as the start
+and end macro markers, and we wish to produce a @file{.c} and a @file{.h}
+file, then the pseudo macro might look something like this:
+
+@example
+[+ AutoGen5 template -*- Mode: emacs-mode-of-choice -*-
+h=chk-%s.h
+c
+# make sure we don't use csh:
+(setenv "SHELL" "/bin/sh") +]
+@end example
+
+The template proper starts after the pseudo-macro. The starting
+character is either the first non-whitespace character or the first
+character after the newline that follows the end macro marker.
+
+@c === SECTION MARKER
+
+@node naming values
+@section Naming a value
+@cindex naming values
+
+When an AutoGen value is specified in a template, it is specified by name.
+The name may be a simple name, or a compound name of several components.
+Since each named value in AutoGen is implicitly an array of one or more
+values, each component may have an index associated with it.
+
+@noindent
+It looks like this:
+
+@example
+comp-name-1 . comp-name-2 [ 2 ]
+@end example
+
+Note that if there are multiple components to a name, each component
+name is separated by a dot (@code{.}). Indexes follow a component name,
+enclosed in square brackets (@code{[} and @code{]}). The index may be
+either an integer or an integer-valued define name. The first component
+of the name is searched for in the current definition level. If not
+found, higher levels will be searched until either a value is found,
+or there are no more definition levels. Subsequent components of the
+name must be found within the context of the newly-current definition
+level. Also, if the named value is prefixed by a dot (@code{.}),
+@cindex .
+then the value search is started in the current context only.
+Backtracking
+@cindex backtrack
+into other definition levels is prevented.
+
+If someone rewrites this, I'll incorporate it. :-)
+
+@c === SECTION MARKER
+
+@node expression syntax
+@section Macro Expression Syntax
+@cindex expression syntax
+
+AutoGen has two types of expressions: full expressions and basic ones.
+A full AutoGen expression can appear by itself, or as the argument
+to certain AutoGen built-in macros: CASE, IF, ELIF, INCLUDE,
+INVOKE (explicit invocation, @pxref{INVOKE}), and WHILE.
+If it appears by itself, the result is inserted into the output.
+If it is an argument to one of these macros, the macro code
+will act on it sensibly.
+
+You are constrained to basic expressions only when passing
+arguments to user defined macros, @xref{DEFINE}.
+
+The syntax of a full AutoGen expression is:
+
+@example
+[[ <apply-code> ] <value-name> ] [ <basic-expr-1> [ <basic-expr-2> ]]
+@end example
+
+How the expression is evaluated depends upon the presence or absence
+of the apply code and value name. The "value name" is the name of
+an AutoGen defined value, or not. If it does not name such a value,
+the expression result is generally the empty string. All expressions
+must contain either a @code{value-name} or a @code{basic-expr}.
+
+@menu
+* apply code:: Apply Code
+* basic expression:: Basic Expression
+@end menu
+
+@node apply code
+@subsection Apply Code
+
+The "apply code" selected determines the method of evaluating the
+expression. There are five apply codes, including the non-use
+of an apply code.
+
+@table @samp
+@item no apply code
+This is the most common expression type.
+Expressions of this sort come in three flavors:
+
+@table @samp
+@item <value-name>
+The result is the value of @code{value-name}, if defined.
+Otherwise it is the empty string.
+
+@item <basic-expr>
+The result of the basic expression is the result of the full expression,
+@xref{basic expression}.
+
+@item <value-name> <basic-expr>
+If there is a defined value for @code{value-name}, then the @code{basic-expr}
+is evaluated. Otherwise, the result is the empty string.
+@end table
+
+@item % <value-name> <basic-expr>
+If @code{value-name} is defined, use @code{basic-expr} as a format
+string for sprintf. Then, if the @code{basic-expr} is either a back-quoted
+string or a parenthesized expression, then hand the result to the
+appropriate interpreter for further evaluation. Otherwise, for single
+and double quote strings, the result is the result of the sprintf operation.
+Naturally, if @code{value-name} is not defined, the result is the empty
+string.
+
+For example, assume that @code{fumble} had the string value, @code{stumble}:
+@example
+[+ % fumble `printf '%%x\\n' $%s` +]
+@end example
+This would cause the shell to evaluate "@code{printf '%x\n' $stumble}".
+Assuming that the shell variable @code{stumble} had a numeric value,
+the expression result would be that number, in hex. Note the need
+for doubled percent characters and backslashes.
+
+@item ? <value-name> <basic-expr-1> <basic-expr-2>
+Two @code{basic-expr}-s are required. If the @code{value-name} is
+defined, then the first @code{basic-expr-1} is evaluated, otherwise
+@code{basic-expr-2} is.
+
+@item - <value-name> <basic-expr>
+Evaluate @code{basic-expr} only if @code{value-name} is @i{not} defined.
+
+@item ?% <value-name> <basic-expr-1> <basic-expr-2>
+This combines the functions of @samp{?} and @samp{%}. If @code{value-name} is
+defined, it behaves exactly like @samp{%}, above, using @code{basic-expr-1}.
+If not defined, then @code{basic-expr-2} is evaluated.
+
+For example, assume again that @code{fumble} had the string value, @code{stumble}:
+@example
+[+ ?% fumble `cat $%s` `pwd` +]
+@end example
+This would cause the shell to evaluate "@code{cat $stumble}".
+If @code{fumble} were not defined, then the result would be the name
+of our current directory.
+@end table
+
+@node basic expression
+@subsection Basic Expression
+
+A basic expression can have one of the following forms:
+
+@table @samp
+@item 'STRING'
+A single quoted string. Backslashes can be used to protect single
+quotes (@code{'}), hash characters (@code{#}), or backslashes (@code{\})
+in the string. All other characters of STRING are output as-is when the
+single quoted string is evaluated. Backslashes are processed before the hash
+character for consistency with the definition syntax. It is needed there
+to avoid preprocessing conflicts.
+
+@item "STRING"
+A double quoted string. This is a cooked text string as in C,
+except that they are not concatenated with adjacent strings.
+Evaluating "@code{STRING}" will output STRING with all
+backslash sequences interpreted.
+
+@item `STRING`
+A back quoted string. When this expression is evaluated, STRING
+is first interpreted as a cooked string (as in `"STRING"') and
+evaluated as a shell expression by the AutoGen server shell. This
+expression is replaced by the @file{stdout} output of
+the shell.
+
+@item (STRING)
+A parenthesized expression. It will be passed to the Guile
+interpreter for evaluation and replaced by the resulting value.
+If there is a Scheme error in this expression, Guile 1.4 and Guile 1.6
+will report the template line number where the error occurs. Guile 1.7
+has lost this capability.
+
+Guile has the capability of creating and manipulating variables that
+can be referenced later on in the template processing. If you define
+such a variable, it is invisible to AutoGen. To reference its value,
+you must use a Guile expression. For example,
+@example
+[+ (define my-var "some-string-value") +]
+@end example
+can have that string inserted later, but only as in:
+@example
+[+ (. my-var) +]
+@end example
+
+Additionally, other than in the @code{%} and @code{?%} expressions, the
+Guile expressions may be introduced with the Guile comment character
+(@code{;}) and you may put a series of Guile expressions within a single
+macro. They will be implicitly evaluated as if they were arguments
+to the @code{(begin ...)} expression. The result will be the
+result of the last Guile expression evaluated.
+@end table
+
+@ignore
+END == TEMPLATE == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+@ignore
+
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+@end ignore
+@page
+@node AutoGen Functions
+@section AutoGen Scheme Functions
+
+AutoGen uses Guile to interpret Scheme expressions within AutoGen
+macros. All of the normal Guile functions are available, plus several
+extensions (@pxref{Common Functions}) have been added to
+augment the repertoire of string manipulation functions and
+manage the state of AutoGen processing.
+
+This section describes those functions that are specific to AutoGen.
+Please take note that these AutoGen specific functions are not loaded
+and thus not made available until after the command line options have
+been processed and the AutoGen definitions have been loaded. They may,
+of course, be used in Scheme functions that get defined at those times,
+but they cannot be invoked.
+
+@menu
+* SCM ag-fprintf:: @file{ag-fprintf} - format to autogen stream
+* SCM ag-function?:: @file{ag-function?} - test for function
+* SCM base-name:: @file{base-name} - base output name
+* SCM chdir:: @file{chdir} - Change current directory
+* SCM count:: @file{count} - definition count
+* SCM def-file:: @file{def-file} - definitions file name
+* SCM def-file-line:: @file{def-file-line} - get a definition file+line number
+* SCM dne:: @file{dne} - "Do Not Edit" warning
+* SCM emit:: @file{emit} - emit the text for each argument
+* SCM emit-string-table:: @file{emit-string-table} - output a string table
+* SCM error:: @file{error} - display message and exit
+* SCM exist?:: @file{exist?} - test for value name
+* SCM find-file:: @file{find-file} - locate a file in the search path
+* SCM first-for?:: @file{first-for?} - detect first iteration
+* SCM for-by:: @file{for-by} - set iteration step
+* SCM for-from:: @file{for-from} - set initial index
+* SCM for-index:: @file{for-index} - get current loop index
+* SCM for-sep:: @file{for-sep} - set loop separation string
+* SCM for-to:: @file{for-to} - set ending index
+* SCM get:: @file{get} - get named value
+* SCM get-c-name:: @file{get-c-name} - get named value, mapped to C name syntax
+* SCM get-down-name:: @file{get-down-name} - get lower cased named value, mapped to C name syntax
+* SCM get-up-name:: @file{get-up-name} - get upper cased named value, mapped to C name syntax
+* SCM high-lim:: @file{high-lim} - get highest value index
+* SCM last-for?:: @file{last-for?} - detect last iteration
+* SCM len:: @file{len} - get count of values
+* SCM low-lim:: @file{low-lim} - get lowest value index
+* SCM make-header-guard:: @file{make-header-guard} - make self-inclusion guard
+* SCM make-tmp-dir:: @file{make-tmp-dir} - create a temporary directory
+* SCM match-value?:: @file{match-value?} - test for matching value
+* SCM out-delete:: @file{out-delete} - delete current output file
+* SCM out-depth:: @file{out-depth} - output file stack depth
+* SCM out-emit-suspended:: @file{out-emit-suspended} - emit the text of suspended output
+* SCM out-line:: @file{out-line} - output file line number
+* SCM out-move:: @file{out-move} - change name of output file
+* SCM out-name:: @file{out-name} - current output file name
+* SCM out-pop:: @file{out-pop} - close current output file
+* SCM out-push-add:: @file{out-push-add} - append output to file
+* SCM out-push-new:: @file{out-push-new} - purge and create output file
+* SCM out-resume:: @file{out-resume} - resume suspended output file
+* SCM out-suspend:: @file{out-suspend} - suspend current output file
+* SCM out-switch:: @file{out-switch} - close and create new output
+* SCM output-file-next-line:: @file{output-file-next-line} - print the file name and next line number
+* SCM set-option:: @file{set-option} - Set a command line option
+* SCM set-writable:: @file{set-writable} - Make the output file be writable
+* SCM stack:: @file{stack} - make list of AutoGen values
+* SCM stack-join:: @file{stack-join} - stack values then join them
+* SCM suffix:: @file{suffix} - get the current suffix
+* SCM tpl-file:: @file{tpl-file} - get the template file name
+* SCM tpl-file-line:: @file{tpl-file-line} - get the template file+line number
+* SCM tpl-file-next-line:: @file{tpl-file-next-line} - get the template file plus next line number
+* SCM autogen-version:: @file{autogen-version} - ``5.16.2''
+* SCM c-file-line-fmt:: format file info as, ``@code{#line nn "file"}''
+@end menu
+
+
+@node SCM ag-fprintf
+@subsection @file{ag-fprintf} - format to autogen stream
+@findex ag-fprintf
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 444.
+@end ignore
+
+Usage: (ag-fprintf ag-diversion format [ format-arg ... ])
+@*
+Format a string using arguments from the alist.
+Write to a specified AutoGen diversion.
+That may be either a specified suspended output stream
+(@pxref{SCM out-suspend}) or an index into the output stack
+(@pxref{SCM out-push-new}). @code{(ag-fprintf 0 ...)} is
+equivalent to @code{(emit (sprintf ...))}, and
+@code{(ag-fprintf 1 ...)} sends output to the most recently
+suspended output stream.
+
+Arguments:
+@*
+ag-diversion - AutoGen diversion name or number
+@*
+format - formatting string
+@*
+format-arg - Optional - list of arguments to formatting string
+
+@node SCM ag-function?
+@subsection @file{ag-function?} - test for function
+@findex ag-function?
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 379.
+@end ignore
+
+Usage: (ag-function? ag-name)
+@*
+return SCM_BOOL_T if a specified name is a user-defined AutoGen
+macro, otherwise return SCM_BOOL_F.
+
+Arguments:
+@*
+ag-name - name of AutoGen macro
+
+@node SCM base-name
+@subsection @file{base-name} - base output name
+@findex base-name
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 213.
+@end ignore
+
+Usage: (base-name)
+@*
+Returns a string containing the base name of the output file(s).
+Generally, this is also the base name of the definitions file.
+
+This Scheme function takes no arguments.
+
+@node SCM chdir
+@subsection @file{chdir} - Change current directory
+@findex chdir
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/agShell.c line 26.
+@end ignore
+
+Usage: (chdir dir)
+@*
+Sets the current directory for AutoGen. Shell commands will run
+from this directory as well. This is a wrapper around the Guile
+native function. It returns its directory name argument and
+fails the program on failure.
+
+Arguments:
+@*
+dir - new directory name
+
+@node SCM count
+@subsection @file{count} - definition count
+@findex count
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 308.
+@end ignore
+
+Usage: (count ag-name)
+@*
+Count the number of entries for a definition.
+The input argument must be a string containing the name
+of the AutoGen values to be counted. If there is no
+value associated with the name, the result is an SCM
+immediate integer value of zero.
+
+Arguments:
+@*
+ag-name - name of AutoGen value
+
+@node SCM def-file
+@subsection @file{def-file} - definitions file name
+@findex def-file
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 329.
+@end ignore
+
+Usage: (def-file)
+@*
+Get the name of the definitions file.
+Returns the name of the source file containing the AutoGen
+definitions.
+
+This Scheme function takes no arguments.
+
+@node SCM def-file-line
+@subsection @file{def-file-line} - get a definition file+line number
+@findex def-file-line
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 754.
+@end ignore
+
+Usage: (def-file-line ag-name [ msg-fmt ])
+@*
+Returns the file and line number of a AutoGen defined value, using
+either the default format, "from %s line %d", or else the format you
+supply. For example, if you want to insert a "C" language file-line
+directive, you would supply the format "# %2$d \"%1$s\"", but that
+is also already supplied with the scheme variable
+@xref{SCM c-file-line-fmt}. You may use it thus:
+
+@example
+(def-file-line "ag-def-name" c-file-line-fmt)
+@end example
+
+It is also safe to use the formatting string, "%2$d". AutoGen uses
+an argument vector version of printf: @xref{snprintfv}.
+
+Arguments:
+@*
+ag-name - name of AutoGen value
+@*
+msg-fmt - Optional - formatting for line message
+
+@node SCM dne
+@subsection @file{dne} - "Do Not Edit" warning
+@findex dne
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expFormat.c line 33.
+@end ignore
+
+Usage: (dne prefix [ first_prefix ] [ optpfx ])
+@*
+Generate a "DO NOT EDIT" or "EDIT WITH CARE" warning string.
+Which depends on whether or not the @code{--writable} command line
+option was set.
+
+The first argument may be an option: -d
+
+This will suppress the variable text (date and version information).
+If specified, then the "prefix" and "first" arguments are shifted
+to the next arguments.
+
+The first argument is a per-line string prefix. The optional second
+argument is a prefix for the first-line and, in read-only mode, activates
+the editor hints.
+@*
+@example
+-*- buffer-read-only: t -*- vi: set ro:
+@end example
+@noindent
+The warning string also includes information about the template used
+to construct the file and the definitions used in its instantiation.
+
+The optional third argument is used when the first argument is actually an
+invocation option and the prefix arguments get shifted. The first
+argument must be, specifically, "@code{-d}". That is used to signify that
+the date stamp should not be inserted into the output.
+
+Arguments:
+@*
+prefix - string for starting each output line
+@*
+first_prefix - Optional - for the first output line
+@*
+optpfx - Optional - shifted prefix
+
+@node SCM emit
+@subsection @file{emit} - emit the text for each argument
+@findex emit
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcEval.c line 323.
+@end ignore
+
+Usage: (emit alist ...)
+@*
+Walk the tree of arguments, displaying the values of displayable
+SCM types. EXCEPTION: if the first argument is a number, then
+that number is used to index the output stack. "0" is the default,
+the current output.
+
+Arguments:
+@*
+alist - list of arguments to stringify and emit
+
+@node SCM emit-string-table
+@subsection @file{emit-string-table} - output a string table
+@findex emit-string-table
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/schemedef.scm line 279.
+@end ignore
+
+Usage: (emit-string-table st-name)
+@*
+Emit into the current output stream a
+@code{static char const} array named @code{st-name}
+that will have @code{NUL} bytes between each inserted string.
+
+Arguments:
+@*
+st-name - the name of the array of characters
+
+@node SCM error
+@subsection @file{error} - display message and exit
+@findex error
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expFormat.c line 160.
+@end ignore
+
+Usage: (error message)
+@*
+The argument is a string that printed out as part of an error
+message. The message is formed from the formatting string:
+
+@example
+DEFINITIONS ERROR in %s line %d for %s: %s\n
+@end example
+
+The first three arguments to this format are provided by the
+routine and are: The name of the template file, the line within
+the template where the error was found, and the current output
+file name.
+
+After displaying the message, the current output file is removed
+and autogen exits with the EXIT_FAILURE error code. IF, however,
+the argument begins with the number 0 (zero), or the string is the
+empty string, then processing continues with the next suffix.
+
+Arguments:
+@*
+message - message to display before exiting
+
+@node SCM exist?
+@subsection @file{exist?} - test for value name
+@findex exist?
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 344.
+@end ignore
+
+Usage: (exist? ag-name)
+@*
+return SCM_BOOL_T iff a specified name has an AutoGen value.
+The name may include indexes and/or member names.
+All but the last member name must be an aggregate definition.
+For example:
+@example
+(exist? "foo[3].bar.baz")
+@end example
+will yield true if all of the following is true:
+@*
+There is a member value of either group or string type
+named @code{baz} for some group value @code{bar} that
+is a member of the @code{foo} group with index @code{3}.
+There may be multiple entries of @code{bar} within
+@code{foo}, only one needs to contain a value for @code{baz}.
+
+Arguments:
+@*
+ag-name - name of AutoGen value
+
+@node SCM find-file
+@subsection @file{find-file} - locate a file in the search path
+@findex find-file
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expExtract.c line 313.
+@end ignore
+
+Usage: (find-file file-name [ suffix ])
+@*
+AutoGen has a search path that it uses to locate template and definition
+files. This function will search the same list for @file{file-name}, both
+with and without the @file{.suffix}, if provided.
+
+Arguments:
+@*
+file-name - name of file with text
+@*
+suffix - Optional - file suffix to try, too
+
+@node SCM first-for?
+@subsection @file{first-for?} - detect first iteration
+@findex first-for?
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcFor.c line 79.
+@end ignore
+
+Usage: (first-for? [ for_var ])
+@*
+Returns @code{SCM_BOOL_T} if the named FOR loop (or, if not named, the
+current innermost loop) is on the first pass through the data. Outside
+of any @code{FOR} loop, it returns @code{SCM_UNDEFINED}, @pxref{FOR}.
+
+Arguments:
+@*
+for_var - Optional - which for loop
+
+@node SCM for-by
+@subsection @file{for-by} - set iteration step
+@findex for-by
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcFor.c line 189.
+@end ignore
+
+Usage: (for-by by)
+@*
+This function records the "step by" information
+for an AutoGen FOR function.
+Outside of the FOR macro itself, this function will emit an error.
+@xref{FOR}.
+
+Arguments:
+@*
+by - the iteration increment for the AutoGen FOR macro
+
+@node SCM for-from
+@subsection @file{for-from} - set initial index
+@findex for-from
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcFor.c line 147.
+@end ignore
+
+Usage: (for-from from)
+@*
+This function records the initial index information
+for an AutoGen FOR function.
+Outside of the FOR macro itself, this function will emit an error.
+@xref{FOR}.
+
+Arguments:
+@*
+from - the initial index for the AutoGen FOR macro
+
+@node SCM for-index
+@subsection @file{for-index} - get current loop index
+@findex for-index
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcFor.c line 125.
+@end ignore
+
+Usage: (for-index [ for_var ])
+@*
+Returns the current index for the named @code{FOR} loop.
+If not named, then the index for the innermost loop.
+Outside of any FOR loop, it returns @code{SCM_UNDEFINED}, @xref{FOR}.
+
+Arguments:
+@*
+for_var - Optional - which for loop
+
+@node SCM for-sep
+@subsection @file{for-sep} - set loop separation string
+@findex for-sep
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcFor.c line 209.
+@end ignore
+
+Usage: (for-sep separator)
+@*
+This function records the separation string that is to be inserted
+between each iteration of an AutoGen FOR function. This is often
+nothing more than a comma.
+Outside of the FOR macro itself, this function will emit an error.
+
+Arguments:
+@*
+separator - the text to insert between the output of
+each FOR iteration
+
+@node SCM for-to
+@subsection @file{for-to} - set ending index
+@findex for-to
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcFor.c line 168.
+@end ignore
+
+Usage: (for-to to)
+@*
+This function records the terminating value information
+for an AutoGen FOR function.
+Outside of the FOR macro itself, this function will emit an error.
+@xref{FOR}.
+
+Arguments:
+@*
+to - the final index for the AutoGen FOR macro
+
+@node SCM get
+@subsection @file{get} - get named value
+@findex get
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 434.
+@end ignore
+
+Usage: (get ag-name [ alt-val ])
+@*
+Get the first string value associated with the name.
+It will either return the associated string value (if
+the name resolves), the alternate value (if one is provided),
+or else the empty string.
+
+Arguments:
+@*
+ag-name - name of AutoGen value
+@*
+alt-val - Optional - value if not present
+
+@node SCM get-c-name
+@subsection @file{get-c-name} - get named value, mapped to C name syntax
+@findex get-c-name
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 466.
+@end ignore
+
+Usage: (get-c-name ag-name)
+@*
+Get the first string value associated with the name. It will either
+return the associated string value (if the name resolves), the alternate
+value (if one is provided), or else the empty string. The result is
+passed through "string->c-name!".
+
+Arguments:
+@*
+ag-name - name of AutoGen value
+
+@node SCM get-down-name
+@subsection @file{get-down-name} - get lower cased named value, mapped to C name syntax
+@findex get-down-name
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 507.
+@end ignore
+
+Usage: (get-down-name ag-name)
+@*
+Get the first string value associated with the name. It will either
+return the associated string value (if the name resolves), the alternate
+value (if one is provided), or else the empty string. The result is
+passed through "string->c-name!" and "string->down-case!".
+
+Arguments:
+@*
+ag-name - name of AutoGen value
+
+@node SCM get-up-name
+@subsection @file{get-up-name} - get upper cased named value, mapped to C name syntax
+@findex get-up-name
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 487.
+@end ignore
+
+Usage: (get-up-name ag-name)
+@*
+Get the first string value associated with the name. It will either
+return the associated string value (if the name resolves), the alternate
+value (if one is provided), or else the empty string. The result is
+passed through "string->c-name!" and "string->up-case!".
+
+Arguments:
+@*
+ag-name - name of AutoGen value
+
+@node SCM high-lim
+@subsection @file{high-lim} - get highest value index
+@findex high-lim
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 527.
+@end ignore
+
+Usage: (high-lim ag-name)
+@*
+Returns the highest index associated with an array of definitions.
+This is generally, but not necessarily, one less than the
+@code{count} value. (The indexes may be specified, rendering a
+non-zero based or sparse array of values.)
+
+This is very useful for specifying the size of a zero-based array
+of values where not all values are present. For example:
+
+@example
+tMyStruct myVals[ [+ (+ 1 (high-lim "my-val-list")) +] ];
+@end example
+
+Arguments:
+@*
+ag-name - name of AutoGen value
+
+@node SCM last-for?
+@subsection @file{last-for?} - detect last iteration
+@findex last-for?
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcFor.c line 104.
+@end ignore
+
+Usage: (last-for? [ for_var ])
+@*
+Returns SCM_BOOL_T if the named FOR loop (or, if not named, the
+current innermost loop) is on the last pass through the data.
+Outside of any FOR loop, it returns SCM_UNDEFINED.
+@xref{FOR}.
+
+Arguments:
+@*
+for_var - Optional - which for loop
+
+@node SCM len
+@subsection @file{len} - get count of values
+@findex len
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 573.
+@end ignore
+
+Usage: (len ag-name)
+@*
+If the named object is a group definition, then "len" is
+the same as "count". Otherwise, if it is one or more text
+definitions, then it is the sum of their string lengths.
+If it is a single text definition, then it is equivalent to
+@code{(string-length (get "ag-name"))}.
+
+Arguments:
+@*
+ag-name - name of AutoGen value
+
+@node SCM low-lim
+@subsection @file{low-lim} - get lowest value index
+@findex low-lim
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 594.
+@end ignore
+
+Usage: (low-lim ag-name)
+@*
+Returns the lowest index associated with an array of definitions.
+
+Arguments:
+@*
+ag-name - name of AutoGen value
+
+@node SCM make-header-guard
+@subsection @file{make-header-guard} - make self-inclusion guard
+@findex make-header-guard
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 785.
+@end ignore
+
+Usage: (make-header-guard name)
+@*
+This function will create a @code{#ifndef}/@code{#define}
+sequence for protecting a header from multiple evaluation.
+It will also set the Scheme variable @code{header-file}
+to the name of the file being protected and it will set
+@code{header-guard} to the name of the @code{#define} being
+used to protect it. It is expected that this will be used
+as follows:
+@example
+[+ (make-header-guard "group_name") +]
+...
+#endif /* [+ (. header-guard) +] */
+
+#include "[+ (. header-file) +]"
+@end example
+@noindent
+The @code{#define} name is composed as follows:
+
+@enumerate
+@item
+The first element is the string argument and a separating underscore.
+@item
+That is followed by the name of the header file with illegal
+characters mapped to underscores.
+@item
+The end of the name is always, "@code{_GUARD}".
+@item
+Finally, the entire string is mapped to upper case.
+@end enumerate
+
+The final @code{#define} name is stored in an SCM symbol named
+@code{header-guard}. Consequently, the concluding @code{#endif} for the
+file should read something like:
+
+@example
+#endif /* [+ (. header-guard) +] */
+@end example
+
+The name of the header file (the current output file) is also stored
+in an SCM symbol, @code{header-file}. Therefore, if you are also
+generating a C file that uses the previously generated header file,
+you can put this into that generated file:
+
+@example
+#include "[+ (. header-file) +]"
+@end example
+
+Obviously, if you are going to produce more than one header file from
+a particular template, you will need to be careful how these SCM symbols
+get handled.
+
+Arguments:
+@*
+name - header group name
+
+@node SCM make-tmp-dir
+@subsection @file{make-tmp-dir} - create a temporary directory
+@findex make-tmp-dir
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 544.
+@end ignore
+
+Usage: (make-tmp-dir)
+@*
+Create a directory that will be cleaned up upon exit.
+
+This Scheme function takes no arguments.
+
+@node SCM match-value?
+@subsection @file{match-value?} - test for matching value
+@findex match-value?
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 401.
+@end ignore
+
+Usage: (match-value? op ag-name test-str)
+@*
+This function answers the question, "Is there an AutoGen value named
+@code{ag-name} with a value that matches the pattern @code{test-str}
+using the match function @code{op}?" Return SCM_BOOL_T iff at least
+one occurrence of the specified name has such a value. The operator
+can be any function that takes two string arguments and yields a
+boolean. It is expected that you will use one of the string matching
+functions provided by AutoGen.
+@*
+The value name must follow the same rules as the
+@code{ag-name} argument for @code{exist?} (@pxref{SCM exist?}).
+
+Arguments:
+@*
+op - boolean result operator
+@*
+ag-name - name of AutoGen value
+@*
+test-str - string to test against
+
+@node SCM out-delete
+@subsection @file{out-delete} - delete current output file
+@findex out-delete
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 199.
+@end ignore
+
+Usage: (out-delete)
+@*
+Remove the current output file. Cease processing the template for
+the current suffix. It is an error if there are @code{push}-ed
+output files. Use the @code{(error "0")} scheme function instead.
+@xref{output controls}.
+
+This Scheme function takes no arguments.
+
+@node SCM out-depth
+@subsection @file{out-depth} - output file stack depth
+@findex out-depth
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 719.
+@end ignore
+
+Usage: (out-depth)
+@*
+Returns the depth of the output file stack.
+@xref{output controls}.
+
+This Scheme function takes no arguments.
+
+@node SCM out-emit-suspended
+@subsection @file{out-emit-suspended} - emit the text of suspended output
+@findex out-emit-suspended
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 428.
+@end ignore
+
+Usage: (out-emit-suspended susp_nm)
+@*
+This function is equivalent to
+@code{(begin (out-resume <name>) (out-pop #t))}
+
+Arguments:
+@*
+susp_nm - A name tag of suspended output
+
+@node SCM out-line
+@subsection @file{out-line} - output file line number
+@findex out-line
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 749.
+@end ignore
+
+Usage: (out-line)
+@*
+Returns the current line number of the output file.
+It rewinds and reads the file to count newlines.
+
+This Scheme function takes no arguments.
+
+@node SCM out-move
+@subsection @file{out-move} - change name of output file
+@findex out-move
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 224.
+@end ignore
+
+Usage: (out-move new-name)
+@*
+Rename current output file. @xref{output controls}.
+Please note: changing the name will not save a temporary file from
+being deleted. It @i{may}, however, be used on the root output file.
+
+Arguments:
+@*
+new-name - new name for the current output file
+
+@node SCM out-name
+@subsection @file{out-name} - current output file name
+@findex out-name
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 732.
+@end ignore
+
+Usage: (out-name)
+@*
+Returns the name of the current output file. If the current file
+is a temporary, unnamed file, then it will scan up the chain until
+a real output file name is found.
+@xref{output controls}.
+
+This Scheme function takes no arguments.
+
+@node SCM out-pop
+@subsection @file{out-pop} - close current output file
+@findex out-pop
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 265.
+@end ignore
+
+Usage: (out-pop [ disp ])
+@*
+If there has been a @code{push} on the output, then close that
+file and go back to the previously open file. It is an error
+if there has not been a @code{push}. @xref{output controls}.
+
+If there is no argument, no further action is taken. Otherwise,
+the argument should be @code{#t} and the contents of the file
+are returned by the function.
+
+Arguments:
+@*
+disp - Optional - return contents of the file
+
+@node SCM out-push-add
+@subsection @file{out-push-add} - append output to file
+@findex out-push-add
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 520.
+@end ignore
+
+Usage: (out-push-add file-name)
+@*
+Identical to @code{push-new}, except the contents are @strong{not}
+purged, but appended to. @xref{output controls}.
+
+Arguments:
+@*
+file-name - name of the file to append text to
+
+@node SCM out-push-new
+@subsection @file{out-push-new} - purge and create output file
+@findex out-push-new
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 573.
+@end ignore
+
+Usage: (out-push-new [ file-name ])
+@*
+Leave the current output file open, but purge and create
+a new file that will remain open until a @code{pop} @code{delete}
+or @code{switch} closes it. The file name is optional and, if omitted,
+the output will be sent to a temporary file that will be deleted when
+it is closed.
+@xref{output controls}.
+
+Arguments:
+@*
+file-name - Optional - name of the file to create
+
+@node SCM out-resume
+@subsection @file{out-resume} - resume suspended output file
+@findex out-resume
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 392.
+@end ignore
+
+Usage: (out-resume susp_nm)
+@*
+If there has been a suspended output, then make that output descriptor
+current again. That output must have been suspended with the same tag
+name given to this routine as its argument.
+
+Arguments:
+@*
+susp_nm - A name tag for reactivating
+
+@node SCM out-suspend
+@subsection @file{out-suspend} - suspend current output file
+@findex out-suspend
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 349.
+@end ignore
+
+Usage: (out-suspend suspName)
+@*
+If there has been a @code{push} on the output, then set aside the output
+descriptor for later reactiviation with @code{(out-resume "xxx")}. The
+tag name need not reflect the name of the output file. In fact, the
+output file may be an anonymous temporary file. You may also change the
+tag every time you suspend output to a file, because the tag names are
+forgotten as soon as the file has been "resumed".
+
+Arguments:
+@*
+suspName - A name tag for reactivating
+
+@node SCM out-switch
+@subsection @file{out-switch} - close and create new output
+@findex out-switch
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 657.
+@end ignore
+
+Usage: (out-switch file-name)
+@*
+Switch output files - close current file and make the current
+file pointer refer to the new file. This is equivalent to
+@code{out-pop} followed by @code{out-push-new}, except that
+you may not pop the base level output file, but you may
+@code{switch} it. @xref{output controls}.
+
+Arguments:
+@*
+file-name - name of the file to create
+
+@node SCM output-file-next-line
+@subsection @file{output-file-next-line} - print the file name and next line number
+@findex output-file-next-line
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expOutput.c line 313.
+@end ignore
+
+Usage: (output-file-next-line [ line_off ] [ alt_fmt ])
+@*
+Returns a string with the current output file name and line number.
+The default format is: # <line+1> "<output-file-name>" The argument may be
+either a number indicating an offset from the current output line number
+or an alternate formatting string. If both are provided, then the first
+must be a numeric offset.
+
+Be careful that you are directing output to the final output file.
+Otherwise, you will get the file name and line number of the temporary
+file. That won't be what you want.
+
+Arguments:
+@*
+line_off - Optional - offset to line number
+@*
+alt_fmt - Optional - alternate format string
+
+@node SCM set-option
+@subsection @file{set-option} - Set a command line option
+@findex set-option
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 622.
+@end ignore
+
+Usage: (set-option opt)
+@*
+The text argument must be an option name followed by any needed
+option argument. Returns SCM_UNDEFINED.
+
+Arguments:
+@*
+opt - AutoGen option name + its argument
+
+@node SCM set-writable
+@subsection @file{set-writable} - Make the output file be writable
+@findex set-writable
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcIf.c line 478.
+@end ignore
+
+Usage: (set-writable [ set? ])
+@*
+This function will set the current output file to be writable
+(or not). This is only effective if neither the @code{--writable}
+nor @code{--not-writable} have been specified. This state
+is reset when the current suffix's output is complete.
+
+Arguments:
+@*
+set? - Optional - boolean arg, false to make output non-writable
+
+@node SCM stack
+@subsection @file{stack} - make list of AutoGen values
+@findex stack
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expString.c line 872.
+@end ignore
+
+Usage: (stack ag-name)
+@*
+Create a scheme list of all the strings that are associated
+with a name. They must all be text values or we choke.
+
+Arguments:
+@*
+ag-name - AutoGen value name
+
+@node SCM stack-join
+@subsection @file{stack-join} - stack values then join them
+@findex stack-join
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/schemedef.scm line 372.
+@end ignore
+
+Usage: (stack-join join ag-name)
+@*
+This function will collect all the values named @code{ag-name}
+(see the @pxref{SCM stack, stack function}) and join them
+separated by the @code{join} string (see the
+@pxref{SCM join, join function}).
+
+Arguments:
+@*
+join - string between each element
+@*
+ag-name - name of autogen values to stack
+
+@node SCM suffix
+@subsection @file{suffix} - get the current suffix
+@findex suffix
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 639.
+@end ignore
+
+Usage: (suffix)
+@*
+Returns the current active suffix (@pxref{pseudo macro}).
+
+This Scheme function takes no arguments.
+
+@node SCM tpl-file
+@subsection @file{tpl-file} - get the template file name
+@findex tpl-file
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 653.
+@end ignore
+
+Usage: (tpl-file [ full_path ])
+@*
+Returns the name of the current template file.
+If @code{#t} is passed in as an argument, then the template
+file is hunted for in the template search path. Otherwise,
+just the unadorned name.
+
+Arguments:
+@*
+full_path - Optional - include full path to file
+
+@node SCM tpl-file-line
+@subsection @file{tpl-file-line} - get the template file+line number
+@findex tpl-file-line
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 701.
+@end ignore
+
+Usage: (tpl-file-line [ msg-fmt ])
+@*
+Returns the file and line number of the current template macro using
+either the default format, "from %s line %d", or else the format you
+supply. For example, if you want to insert a "C" language file-line
+directive, you would supply the format "# %2$d \"%1$s\"", but that
+is also already supplied with the scheme variable
+@xref{SCM c-file-line-fmt}. You may use it thus:
+@example
+(tpl-file-line c-file-line-fmt)
+@end example
+
+It is also safe to use the formatting string, "%2$d". AutoGen uses
+an argument vector version of printf: @xref{snprintfv},
+and it does not need to know the types of each argument in order to
+skip forward to the second argument.
+
+Arguments:
+@*
+msg-fmt - Optional - formatting for line message
+
+@node SCM tpl-file-next-line
+@subsection @file{tpl-file-next-line} - get the template file plus next line number
+@findex tpl-file-next-line
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 733.
+@end ignore
+
+Usage: (tpl-file-next-line [ msg-fmt ])
+@*
+This is almost the same as @xref{SCM tpl-file-line}, except that
+the line referenced is the next line, per C compiler conventions, and
+consequently defaults to the format: # <line-no+1> "<file-name>"
+
+Arguments:
+@*
+msg-fmt - Optional - formatting for line message
+
+@ignore
+Generated from auto_gen.tpl line 271.
+@end ignore
+
+@node SCM autogen-version
+@subsection @file{autogen-version} - autogen version number
+@findex autogen-version
+
+This is a symbol defining the current AutoGen version number string.
+It was first defined in AutoGen-5.2.14.
+It is currently ``5.16.2''.
+
+@node SCM c-file-line-fmt
+@subsection format file info as, ``@code{#line nn "file"}''
+@findex c-file-line-fmt
+
+This is a symbol that can easily be used with the functions
+@xref{SCM tpl-file-line}, and @xref{SCM def-file-line}.
+These will emit C program @code{#line} directives pointing to template
+and definitions text, respectively.
+@ignore
+
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+@end ignore
+@page
+@node Common Functions
+@section Common Scheme Functions
+
+This section describes a number of general purpose functions that make
+the kind of string processing that AutoGen does a little easier.
+Unlike the AutoGen specific functions (@pxref{AutoGen Functions}),
+these functions are available for direct use during definition load time.
+The equality test (@pxref{SCM =}) is ``overloaded'' to do string equivalence
+comparisons. If you are looking for inequality, the Scheme/Lisp way
+of spelling that is, ``(not (= ...))''.
+
+@menu
+* SCM agpl:: @file{agpl} - GNU Affero General Public License
+* SCM bsd:: @file{bsd} - BSD Public License
+* SCM c-string:: @file{c-string} - emit string for ANSI C
+* SCM error-source-line:: @file{error-source-line} - display of file & line
+* SCM extract:: @file{extract} - extract text from another file
+* SCM format-arg-count:: @file{format-arg-count} - count the args to a format
+* SCM fprintf:: @file{fprintf} - format to a file
+* SCM gperf:: @file{gperf} - perform a perfect hash function
+* SCM gperf-code:: @file{gperf-code} - emit the source of the generated gperf program
+* SCM gpl:: @file{gpl} - GNU General Public License
+* SCM hide-email:: @file{hide-email} - convert eaddr to javascript
+* SCM html-escape-encode:: @file{html-escape-encode} - encode html special characters
+* SCM in?:: @file{in?} - test for string in list
+* SCM join:: @file{join} - join string list with separator
+* SCM kr-string:: @file{kr-string} - emit string for K&R C
+* SCM lgpl:: @file{lgpl} - GNU Library General Public License
+* SCM license:: @file{license} - an arbitrary license
+* SCM license-description:: @file{license-description} - Emit a license description
+* SCM license-full:: @file{license-full} - Emit the licensing information and description
+* SCM license-info:: @file{license-info} - Emit the licensing information and copyright years
+* SCM license-name:: @file{license-name} - Emit the name of the license
+* SCM make-gperf:: @file{make-gperf} - build a perfect hash function program
+* SCM makefile-script:: @file{makefile-script} - create makefile script
+* SCM max:: @file{max} - maximum value in list
+* SCM min:: @file{min} - minimum value in list
+* SCM prefix:: @file{prefix} - prefix lines with a string
+* SCM printf:: @file{printf} - format to stdout
+* SCM raw-shell-str:: @file{raw-shell-str} - single quote shell string
+* SCM shell:: @file{shell} - invoke a shell script
+* SCM shell-str:: @file{shell-str} - double quote shell string
+* SCM shellf:: @file{shellf} - format a string, run shell
+* SCM sprintf:: @file{sprintf} - format a string
+* SCM string-capitalize:: @file{string-capitalize} - capitalize a new string
+* SCM string-capitalize!:: @file{string-capitalize!} - capitalize a string
+* SCM *=*:: @file{string-contains-eqv?} - caseless substring
+* SCM *==*:: @file{string-contains?} - substring match
+* SCM string-downcase:: @file{string-downcase} - lower case a new string
+* SCM string-downcase!:: @file{string-downcase!} - make a string be lower case
+* SCM *~:: @file{string-end-eqv-match?} - caseless regex ending
+* SCM *~~:: @file{string-end-match?} - regex match end
+* SCM *=:: @file{string-ends-eqv?} - caseless string ending
+* SCM *==:: @file{string-ends-with?} - string ending
+* SCM ==:: @file{string-equals?} - string matching
+* SCM ~:: @file{string-eqv-match?} - caseless regex match
+* SCM =:: @file{string-eqv?} - caseless match
+* SCM *~*:: @file{string-has-eqv-match?} - caseless regex contains
+* SCM *~~*:: @file{string-has-match?} - contained regex match
+* SCM ~~:: @file{string-match?} - regex match
+* SCM ~*:: @file{string-start-eqv-match?} - caseless regex start
+* SCM ~~*:: @file{string-start-match?} - regex match start
+* SCM =*:: @file{string-starts-eqv?} - caseless string start
+* SCM ==*:: @file{string-starts-with?} - string starting
+* SCM string-substitute:: @file{string-substitute} - multiple global replacements
+* SCM string-table-add:: @file{string-table-add} - Add an entry to a string table
+* SCM string-table-add-ref:: @file{string-table-add-ref} - Add an entry to a string table, get reference
+* SCM string-table-new:: @file{string-table-new} - create a string table
+* SCM string-table-size:: @file{string-table-size} - print the current size of a string table
+* SCM string->c-name!:: @file{string->c-name!} - map non-name chars to underscore
+* SCM string->camelcase:: @file{string->camelcase} - make a string be CamelCase
+* SCM string-tr:: @file{string-tr} - convert characters with new result
+* SCM string-tr!:: @file{string-tr!} - convert characters
+* SCM string-upcase:: @file{string-upcase} - upper case a new string
+* SCM string-upcase!:: @file{string-upcase!} - make a string be upper case
+* SCM sub-shell-str:: @file{sub-shell-str} - back quoted (sub-)shell string
+* SCM sum:: @file{sum} - sum of values in list
+* SCM time-string->number:: @file{time-string->number} - duration string to seconds
+* SCM version-compare:: @file{version-compare} - compare two version numbers
+@end menu
+
+
+@node SCM agpl
+@subsection @file{agpl} - GNU Affero General Public License
+@findex agpl
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expFormat.c line 649.
+@end ignore
+
+Usage: (agpl prog-name prefix)
+@*
+Emit a string that contains the GNU Affero General Public License.
+This function is now deprecated. Please @xref{SCM license-description}.
+
+Arguments:
+@*
+prog-name - name of the program under the GPL
+@*
+prefix - String for starting each output line
+
+@node SCM bsd
+@subsection @file{bsd} - BSD Public License
+@findex bsd
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expFormat.c line 696.
+@end ignore
+
+Usage: (bsd prog_name owner prefix)
+@*
+Emit a string that contains the Free BSD Public License.
+This function is now deprecated. Please @xref{SCM license-description}.
+
+Arguments:
+@*
+prog_name - name of the program under the BSD
+@*
+owner - Grantor of the BSD License
+@*
+prefix - String for starting each output line
+
+@node SCM c-string
+@subsection @file{c-string} - emit string for ANSI C
+@findex c-string
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expString.c line 936.
+@end ignore
+
+Usage: (c-string string)
+@*
+Reform a string so that, when printed, the C compiler will be able to
+compile the data and construct a string that contains exactly what the
+current string contains. Many non-printing characters are replaced with
+escape sequences. Newlines are replaced with a backslash, an @code{n}, a
+closing quote, a newline, seven spaces and another re-opening quote. The
+compiler will implicitly concatenate them. The reader will see line
+breaks.
+
+A K&R compiler will choke. Use @code{kr-string} for that compiler.
+
+Arguments:
+@*
+string - string to reformat
+
+@node SCM error-source-line
+@subsection @file{error-source-line} - display of file & line
+@findex error-source-line
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcEval.c line 303.
+@end ignore
+
+Usage: (error-source-line)
+@*
+This function is only invoked just before Guile displays
+an error message. It displays the file name and line number
+that triggered the evaluation error. You should not need to
+invoke this routine directly. Guile will do it automatically.
+
+This Scheme function takes no arguments.
+
+@node SCM extract
+@subsection @file{extract} - extract text from another file
+@findex extract
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expExtract.c line 186.
+@end ignore
+
+Usage: (extract file-name marker-fmt [ caveat ] [ default ])
+@*
+This function is used to help construct output files that may contain
+text that is carried from one version of the output to the next.
+
+The first two arguments are required, the second are optional:
+
+@itemize @bullet
+@item
+The @code{file-name} argument is used to name the file that
+contains the demarcated text.
+@item
+The @code{marker-fmt} is a formatting string that is used to construct
+the starting and ending demarcation strings. The sprintf function is
+given the @code{marker-fmt} with two arguments. The first is either
+"START" or "END". The second is either "DO NOT CHANGE THIS COMMENT"
+or the optional @code{caveat} argument.
+@item
+@code{caveat} is presumed to be absent if it is the empty string
+(@code{""}). If absent, ``DO NOT CHANGE THIS COMMENT'' is used
+as the second string argument to the @code{marker-fmt}.
+@item
+When a @code{default} argument is supplied and no pre-existing text
+is found, then this text will be inserted between the START and END
+markers.
+@end itemize
+
+@noindent
+The resulting strings are presumed to be unique within
+the subject file. As a simplified example:
+
+@example
+[+ (extract "fname" "// %s - SOMETHING - %s" ""
+"example default") +]
+@end example
+@noindent
+will result in the following text being inserted into the output:
+
+@example
+// START - SOMETHING - DO NOT CHANGE THIS COMMENT
+example default
+// END - SOMETHING - DO NOT CHANGE THIS COMMENT
+@end example
+
+@noindent
+The ``@code{example default}'' string can then be carried forward to
+the next generation of the output, @strong{@i{provided}} the output
+is not named "@code{fname}" @i{and} the old output is renamed to
+"@code{fname}" before AutoGen-eration begins.
+
+@table @strong
+@item NB:
+You can set aside previously generated source files inside the pseudo
+macro with a Guile/scheme function, extract the text you want to keep
+with this extract function. Just remember you should delete it at the
+end, too. Here is an example from my Finite State Machine generator:
+
+@example
+[+ AutoGen5 Template -*- Mode: text -*-
+h=%s-fsm.h c=%s-fsm.c
+(shellf
+"test -f %1$s-fsm.h && mv -f %1$s-fsm.h .fsm.head
+test -f %1$s-fsm.c && mv -f %1$s-fsm.c .fsm.code" (base-name))
++]
+@end example
+
+This code will move the two previously produced output files to files
+named ".fsm.head" and ".fsm.code". At the end of the 'c' output
+processing, I delete them.
+
+@item also NB:
+This function presumes that the output file ought to be editable so
+that the code between the @code{START} and @code{END} marks can be edited
+by the template user. Consequently, when the @code{(extract ...)} function
+is invoked, if the @code{writable} option has not been specified, then
+it will be set at that point. If this is not the desired behavior, the
+@code{--not-writable} command line option will override this.
+Also, you may use the guile function @code{(chmod "file" mode-value)}
+to override whatever AutoGen is using for the result mode.
+@end table
+
+Arguments:
+@*
+file-name - name of file with text
+@*
+marker-fmt - format for marker text
+@*
+caveat - Optional - warn about changing marker
+@*
+default - Optional - default initial text
+
+@node SCM format-arg-count
+@subsection @file{format-arg-count} - count the args to a format
+@findex format-arg-count
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expPrint.c line 294.
+@end ignore
+
+Usage: (format-arg-count format)
+@*
+Sometimes, it is useful to simply be able to figure out how many
+arguments are required by a format string. For example, if you
+are extracting a format string for the purpose of generating a
+macro to invoke a printf-like function, you can run the
+formatting string through this function to determine how many
+arguments to provide for in the macro. e.g. for this extraction
+text:
+@example
+
+ /*=fumble bumble
+ * fmt: 'stumble %s: %d\n'
+ =*/
+@end example
+
+@noindent
+You may wish to generate a macro:
+@example
+
+ #define BUMBLE(a1,a2) printf_like(something,(a1),(a2))
+@end example
+
+@noindent
+You can do this by knowing that the format needs two arguments.
+
+Arguments:
+@*
+format - formatting string
+
+@node SCM fprintf
+@subsection @file{fprintf} - format to a file
+@findex fprintf
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expPrint.c line 230.
+@end ignore
+
+Usage: (fprintf port format [ format-arg ... ])
+@*
+Format a string using arguments from the alist.
+Write to a specified port. The result will NOT appear in your
+output. Use this to print information messages to a template user.
+
+Arguments:
+@*
+port - Guile-scheme output port
+@*
+format - formatting string
+@*
+format-arg - Optional - list of arguments to formatting string
+
+@node SCM gperf
+@subsection @file{gperf} - perform a perfect hash function
+@findex gperf
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expGperf.c line 109.
+@end ignore
+
+Usage: (gperf name str)
+@*
+Perform the perfect hash on the input string. This is only useful if
+you have previously created a gperf program with the @code{make-gperf}
+function @xref{SCM make-gperf}. The @code{name} you supply here must
+match the name used to create the program and the string to hash must
+be one of the strings supplied in the @code{make-gperf} string list.
+The result will be a perfect hash index.
+
+See the documentation for @command{gperf(1GNU)} for more details.
+
+Arguments:
+@*
+name - name of hash list
+@*
+str - string to hash
+
+@node SCM gperf-code
+@subsection @file{gperf-code} - emit the source of the generated gperf program
+@findex gperf-code
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/schemedef.scm line 324.
+@end ignore
+
+Usage: (gperf-code st-name)
+@*
+Returns the contents of the emitted code, suitable
+for inclusion in another program. The interface contains
+the following elements:
+
+@table @samp
+@item struct @i{<st-name>}_index
+containg the fields: @code{@{char const * name, int const id; @};}
+
+@item @i{<st-name>}_hash()
+This is the hashing function with local only scope (static).
+
+@item @i{<st-name>}_find()
+This is the searching and validation function. The first argument
+is the string to look up, the second is its length.
+It returns a pointer to the corresponding @code{@i{<st-name>}_index}
+entry.
+@end table
+
+Use this in your template as follows where "@i{<st-name>}" was
+set to be "@code{lookup}":
+
+@example
+[+ (make-gperf "lookup" (join "\n" (stack "name_list")))
+(gperf-code "lookup") +]
+void my_fun(char * str) @{
+struct lookup_index * li = lookup_find(str, strlen(str));
+if (li != NULL) printf("%s yields %d\n", str, li->idx);
+@end example
+
+Arguments:
+@*
+st-name - the name of the gperf hash list
+
+@node SCM gpl
+@subsection @file{gpl} - GNU General Public License
+@findex gpl
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expFormat.c line 626.
+@end ignore
+
+Usage: (gpl prog-name prefix)
+@*
+Emit a string that contains the GNU General Public License.
+This function is now deprecated. Please @xref{SCM license-description}.
+
+Arguments:
+@*
+prog-name - name of the program under the GPL
+@*
+prefix - String for starting each output line
+
+@node SCM hide-email
+@subsection @file{hide-email} - convert eaddr to javascript
+@findex hide-email
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expPrint.c line 254.
+@end ignore
+
+Usage: (hide-email display eaddr)
+@*
+Hides an email address as a java scriptlett.
+The 'mailto:' tag and the email address are coded bytes
+rather than plain text. They are also broken up.
+
+Arguments:
+@*
+display - display text
+@*
+eaddr - email address
+
+@node SCM html-escape-encode
+@subsection @file{html-escape-encode} - encode html special characters
+@findex html-escape-encode
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/schemedef.scm line 108.
+@end ignore
+
+Usage: (html-escape-encode str)
+@*
+This function will replace replace the characters @code{'&'},
+@code{'<'} and @code{'>'} characters with the HTML/XML
+escape-encoded strings (@code{"&amp;"}, @code{"&lt;"}, and
+@code{"&gt;"}, respectively).
+
+Arguments:
+@*
+str - string to make substitutions in
+
+@node SCM in?
+@subsection @file{in?} - test for string in list
+@findex in?
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expString.c line 439.
+@end ignore
+
+Usage: (in? test-string string-list ...)
+@*
+Return SCM_BOOL_T if the first argument string is found
+in one of the entries in the second (list-of-strings) argument.
+
+Arguments:
+@*
+test-string - string to look for
+@*
+string-list - list of strings to check
+
+@node SCM join
+@subsection @file{join} - join string list with separator
+@findex join
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expString.c line 506.
+@end ignore
+
+Usage: (join separator list ...)
+@*
+With the first argument as the separator string,
+joins together an a-list of strings into one long string.
+The list may contain nested lists, partly because you
+cannot always control that.
+
+Arguments:
+@*
+separator - string to insert between entries
+@*
+list - list of strings to join
+
+@node SCM kr-string
+@subsection @file{kr-string} - emit string for K&R C
+@findex kr-string
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expString.c line 914.
+@end ignore
+
+Usage: (kr-string string)
+@*
+Reform a string so that, when printed, a K&R C compiler will be able
+to compile the data and construct a string that contains exactly
+what the current string contains. Many non-printing characters are
+replaced with escape sequences. New-lines are replaced with a
+backslash-n-backslash and newline sequence,
+
+Arguments:
+@*
+string - string to reformat
+
+@node SCM lgpl
+@subsection @file{lgpl} - GNU Library General Public License
+@findex lgpl
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expFormat.c line 672.
+@end ignore
+
+Usage: (lgpl prog_name owner prefix)
+@*
+Emit a string that contains the GNU Library General Public License.
+This function is now deprecated. Please @xref{SCM license-description}.
+
+Arguments:
+@*
+prog_name - name of the program under the LGPL
+@*
+owner - Grantor of the LGPL
+@*
+prefix - String for starting each output line
+
+@node SCM license
+@subsection @file{license} - an arbitrary license
+@findex license
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expFormat.c line 721.
+@end ignore
+
+Usage: (license lic_name prog_name owner prefix)
+@*
+Emit a string that contains the named license.
+This function is now deprecated. Please @xref{SCM license-description}.
+
+Arguments:
+@*
+lic_name - file name of the license
+@*
+prog_name - name of the licensed program or library
+@*
+owner - Grantor of the License
+@*
+prefix - String for starting each output line
+
+@node SCM license-description
+@subsection @file{license-description} - Emit a license description
+@findex license-description
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expFormat.c line 550.
+@end ignore
+
+Usage: (license-description license prog-name prefix [ owner ])
+@*
+Emit a string that contains a detailed license description, with
+substitutions for program name, copyright holder and a per-line prefix.
+This is the text typically used as part of a source file header.
+For more details, @xref{SCM license-full, the license-full command}.
+
+Arguments:
+@*
+license - name of license type
+@*
+prog-name - name of the program under the GPL
+@*
+prefix - String for starting each output line
+@*
+owner - Optional - owner of the program
+
+@node SCM license-full
+@subsection @file{license-full} - Emit the licensing information and description
+@findex license-full
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expFormat.c line 493.
+@end ignore
+
+Usage: (license-full license prog-name prefix [ owner ] [ years ])
+@*
+Emit all the text that @code{license-info} and @code{license-description}
+would emit (@pxref{SCM license-info, @code{license-info}},
+and @pxref{SCM license-description, @code{license-description}}),
+with all the same substitutions.
+
+All of these depend upon the existence of a license file named after the
+@code{license} argument with a @code{.lic} suffix. That file should
+contain three blocks of text, each separated by two or more newline
+characters.
+
+The first section describes copyright attribution and the name of the usage
+licence. For GNU software, this should be the text that is to be displayed
+with the program version. Four text markers can be replaced: <PFX>,
+<program>, <years> and <owner>.
+
+The second section is a short description of the terms of the license.
+This is typically the kind of text that gets displayed in the header of
+source files. The third section is strictly the name of the license
+without any substitution markers. Only the <PFX>, <owner> and <program>
+markers are substituted.
+
+The third section is strictly the name of the license.
+No marker substitutions are performed.
+
+@example
+<PFX>Copyright (C) <years> <owner>, all rights reserved.
+<PFX>This is free software. It is licensed for use,
+<PFX>modification and redistribution under the terms
+<PFX>of the GNU General Public License, version 3 or later
+<PFX> <http://gnu.org/licenses/gpl.html>
+
+<PFX><program> is free software: you can redistribute it
+<PFX>and/or modify it under the terms of the GNU General
+<PFX>Public License as published by the Free Software ...
+
+the GNU General Public License, version 3 or later
+@end example
+
+Arguments:
+@*
+license - name of license type
+@*
+prog-name - name of the program under the GPL
+@*
+prefix - String for starting each output line
+@*
+owner - Optional - owner of the program
+@*
+years - Optional - copyright years
+
+@node SCM license-info
+@subsection @file{license-info} - Emit the licensing information and copyright years
+@findex license-info
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expFormat.c line 574.
+@end ignore
+
+Usage: (license-info license prog-name prefix [ owner ] [ years ])
+@*
+Emit a string that contains the licensing description, with some
+substitutions for program name, copyright holder, a list of years when the
+source was modified, and a per-line prefix. This text typically includes a
+brief license description and is often printed out when a program starts
+running or as part of the @code{--version} output.
+For more details, @xref{SCM license-full, the license-full command}.
+
+Arguments:
+@*
+license - name of license type
+@*
+prog-name - name of the program under the GPL
+@*
+prefix - String for starting each output line
+@*
+owner - Optional - owner of the program
+@*
+years - Optional - copyright years
+
+@node SCM license-name
+@subsection @file{license-name} - Emit the name of the license
+@findex license-name
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expFormat.c line 601.
+@end ignore
+
+Usage: (license-name license)
+@*
+Emit a string that contains the full name of the license.
+
+Arguments:
+@*
+license - name of license type
+
+@node SCM make-gperf
+@subsection @file{make-gperf} - build a perfect hash function program
+@findex make-gperf
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expGperf.c line 39.
+@end ignore
+
+Usage: (make-gperf name strings ...)
+@*
+Build a program to perform perfect hashes of a known list of input
+strings. This function produces no output, but prepares a program
+named, @file{gperf_<name>} for use by the gperf function
+@xref{SCM gperf}.
+
+This program will be obliterated as AutoGen exits.
+However, you may incorporate the generated hashing function
+into your C program with commands something like the following:
+
+@example
+[+ (shellf "sed '/^int main(/,$d;/^#line/d' $@{gpdir@}/%s.c"
+name ) +]
+@end example
+
+where @code{name} matches the name provided to this @code{make-perf}
+function. @code{gpdir} is the variable used to store the name of the
+temporary directory used to stash all the files.
+
+Arguments:
+@*
+name - name of hash list
+@*
+strings - list of strings to hash
+
+@node SCM makefile-script
+@subsection @file{makefile-script} - create makefile script
+@findex makefile-script
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expMake.c line 253.
+@end ignore
+
+Usage: (makefile-script text)
+@*
+This function will take ordinary shell script text and reformat it
+so that it will work properly inside of a makefile shell script.
+Not every shell construct can be supported; the intent is to have
+most ordinary scripts work without much, if any, alteration.
+
+The following transformations are performed on the source text:
+
+@enumerate
+@item
+Trailing whitespace on each line is stripped.
+
+@item
+Except for the last line, the string, " ; \\" is appended to the end of
+every line that does not end with certain special characters or keywords.
+Note that this will mutilate multi-line quoted strings, but @command{make}
+renders it impossible to use multi-line constructs anyway.
+
+@item
+If the line ends with a backslash, it is left alone.
+
+@item
+If the line ends with a semi-colon, conjunction operator, pipe (vertical
+bar) or one of the keywords "then", "else" or "in", then a space and a
+backslash is added, but no semi-colon.
+
+@item
+The dollar sign character is doubled, unless it immediately precedes an
+opening parenthesis or the single character make macros '*', '<', '@@',
+'?' or '%'. Other single character make macros that do not have enclosing
+parentheses will fail. For shell usage of the "$@@", "$?" and "$*"
+macros, you must enclose them with curly braces, e.g., "$@{?@}".
+The ksh construct @code{$(<command>)} will not work. Though some
+@command{make}s accept @code{$@{var@}} constructs, this function will
+assume it is for shell interpretation and double the dollar character.
+You must use @code{$(var)} for all @command{make} substitutions.
+
+@item
+Double dollar signs are replaced by four before the next character
+is examined.
+
+@item
+Every line is prefixed with a tab, unless the first line
+already starts with a tab.
+
+@item
+The newline character on the last line, if present, is suppressed.
+
+@item
+Blank lines are stripped.
+
+@item
+Lines starting with "@@ifdef", "@@ifndef", "@@else" and "@@endif" are
+presumed to be autoconf "sed" expression tags. These lines will be
+emitted as-is, with no tab prefix and no line splicing backslash.
+These lines can then be processed at configure time with
+@code{AC_CONFIG_FILES} sed expressions, similar to:
+
+@example
+sed "/^@@ifdef foo/d;/^@@endif foo/d;/^@@ifndef foo/,/^@@endif foo/d"
+@end example
+@end enumerate
+
+@noindent
+This function is intended to be used approximately as follows:
+
+@example
+$(TARGET) : $(DEPENDENCIES)
+<+ (out-push-new) +>
+....mostly arbitrary shell script text....
+<+ (makefile-script (out-pop #t)) +>
+@end example
+
+Arguments:
+@*
+text - the text of the script
+
+@node SCM max
+@subsection @file{max} - maximum value in list
+@findex max
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expGuile.c line 88.
+@end ignore
+
+Usage: (max list ...)
+@*
+Return the maximum value in the list
+
+Arguments:
+@*
+list - list of values. Strings are converted to numbers
+
+@node SCM min
+@subsection @file{min} - minimum value in list
+@findex min
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expGuile.c line 147.
+@end ignore
+
+Usage: (min list ...)
+@*
+Return the minimum value in the list
+
+Arguments:
+@*
+list - list of values. Strings are converted to numbers
+
+@node SCM prefix
+@subsection @file{prefix} - prefix lines with a string
+@findex prefix
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expString.c line 604.
+@end ignore
+
+Usage: (prefix prefix text)
+@*
+Prefix every line in the second string with the first string.
+
+For example, if the first string is "# " and the second contains:
+@example
+two
+lines
+@end example
+@noindent
+The result string will contain:
+@example
+# two
+# lines
+@end example
+
+Arguments:
+@*
+prefix - string to insert at start of each line
+@*
+text - multi-line block of text
+
+@node SCM printf
+@subsection @file{printf} - format to stdout
+@findex printf
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expPrint.c line 206.
+@end ignore
+
+Usage: (printf format [ format-arg ... ])
+@*
+Format a string using arguments from the alist.
+Write to the standard out port. The result will NOT appear in your
+output. Use this to print information messages to a template user.
+Use ``(sprintf ...)'' to add text to your document.
+
+Arguments:
+@*
+format - formatting string
+@*
+format-arg - Optional - list of arguments to formatting string
+
+@node SCM raw-shell-str
+@subsection @file{raw-shell-str} - single quote shell string
+@findex raw-shell-str
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expString.c line 686.
+@end ignore
+
+Usage: (raw-shell-str string)
+@*
+Convert the text of the string into a singly quoted string
+that a normal shell will process into the original string.
+(It will not do macro expansion later, either.)
+Contained single quotes become tripled, with the middle quote
+escaped with a backslash. Normal shells will reconstitute the
+original string.
+
+@strong{Notice}: some shells will not correctly handle unusual
+non-printing characters. This routine works for most reasonably
+conventional ASCII strings.
+
+Arguments:
+@*
+string - string to transform
+
+@node SCM shell
+@subsection @file{shell} - invoke a shell script
+@findex shell
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/agShell.c line 57.
+@end ignore
+
+Usage: (shell command)
+@*
+Generate a string by writing the value to a server shell and reading the
+output back in. The template programmer is responsible for ensuring that
+it completes within 10 seconds. If it does not, the server will be
+killed, the output tossed and a new server started.
+
+Please note: This is the same server process used by the '#shell'
+definitions directive and backquoted @code{`} definitions. There may be
+left over state from previous shell expressions and the @code{`}
+processing in the declarations. However, a @code{cd} to the original
+directory is always issued before the new command is issued.
+
+Also note: When initializing, autogen will set the environment
+variable "AGexe" to the full path of the autogen executable.
+
+Arguments:
+@*
+command - shell command - the result value is the stdout output.
+
+@node SCM shell-str
+@subsection @file{shell-str} - double quote shell string
+@findex shell-str
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expString.c line 783.
+@end ignore
+
+Usage: (shell-str string)
+@*
+Convert the text of the string into a double quoted string that a normal
+shell will process into the original string, almost. It will add the
+escape character @code{\\} before two special characters to
+accomplish this: the backslash @code{\\} and double quote @code{"}.
+
+@strong{Notice}: some shells will not correctly handle unusual
+non-printing characters. This routine works for most reasonably
+conventional ASCII strings.
+
+@strong{WARNING}:
+@*
+This function omits the extra backslash in front of a backslash, however,
+if it is followed by either a backquote or a dollar sign. It must do this
+because otherwise it would be impossible to protect the dollar sign or
+backquote from shell evaluation. Consequently, it is not possible to
+render the strings "\\$" or "\\`". The lesser of two evils.
+
+All others characters are copied directly into the output.
+
+The @code{sub-shell-str} variation of this routine behaves identically,
+except that the extra backslash is omitted in front of @code{"} instead
+of @code{`}. You have to think about it. I'm open to suggestions.
+
+Meanwhile, the best way to document is with a detailed output example.
+If the backslashes make it through the text processing correctly,
+below you will see what happens with three example strings. The first
+example string contains a list of quoted @code{foo}s, the second is
+the same with a single backslash before the quote characters and the
+last is with two backslash escapes. Below each is the result of the
+@code{raw-shell-str}, @code{shell-str} and @code{sub-shell-str} functions.
+
+@example
+foo[0] ''foo'' 'foo' "foo" `foo` $foo
+raw-shell-str -> \'\''foo'\'\'' '\''foo'\'' "foo" `foo` $foo'
+shell-str -> "''foo'' 'foo' \"foo\" `foo` $foo"
+sub-shell-str -> `''foo'' 'foo' "foo" \`foo\` $foo`
+
+foo[1] \'bar\' \"bar\" \`bar\` \$bar
+raw-shell-str -> '\'\''bar\'\'' \"bar\" \`bar\` \$bar'
+shell-str -> "\\'bar\\' \\\"bar\\\" \`bar\` \$bar"
+sub-shell-str -> `\\'bar\\' \"bar\" \\\`bar\\\` \$bar`
+
+foo[2] \\'BAZ\\' \\"BAZ\\" \\`BAZ\\` \\$BAZ
+raw-shell-str -> '\\'\''BAZ\\'\'' \\"BAZ\\" \\`BAZ\\` \\$BAZ'
+shell-str -> "\\\\'BAZ\\\\' \\\\\"BAZ\\\\\" \\\`BAZ\\\` \\\$BAZ"
+sub-shell-str -> `\\\\'BAZ\\\\' \\\"BAZ\\\" \\\\\`BAZ\\\\\` \\\$BAZ`
+@end example
+
+There should be four, three, five and three backslashes for the four
+examples on the last line, respectively. The next to last line should
+have four, five, three and three backslashes. If this was not accurately
+reproduced, take a look at the agen5/test/shell.test test. Notice the
+backslashes in front of the dollar signs. It goes from zero to one to
+three for the "cooked" string examples.
+
+Arguments:
+@*
+string - string to transform
+
+@node SCM shellf
+@subsection @file{shellf} - format a string, run shell
+@findex shellf
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/agShell.c line 96.
+@end ignore
+
+Usage: (shellf format [ format-arg ... ])
+@*
+Format a string using arguments from the alist,
+then send the result to the shell for interpretation.
+
+Arguments:
+@*
+format - formatting string
+@*
+format-arg - Optional - list of arguments to formatting string
+
+@node SCM sprintf
+@subsection @file{sprintf} - format a string
+@findex sprintf
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expPrint.c line 183.
+@end ignore
+
+Usage: (sprintf format [ format-arg ... ])
+@*
+Format a string using arguments from the alist.
+
+Arguments:
+@*
+format - formatting string
+@*
+format-arg - Optional - list of arguments to formatting string
+
+@node SCM string-capitalize
+@subsection @file{string-capitalize} - capitalize a new string
+@findex string-capitalize
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expGuile.c line 385.
+@end ignore
+
+Usage: (string-capitalize str)
+@*
+Create a new SCM string containing the same text as the original,
+only all the first letter of each word is upper cased and all
+other letters are made lower case.
+
+Arguments:
+@*
+str - input string
+
+@node SCM string-capitalize!
+@subsection @file{string-capitalize!} - capitalize a string
+@findex string-capitalize!
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expGuile.c line 342.
+@end ignore
+
+Usage: (string-capitalize! str)
+@*
+capitalize all the words in an SCM string.
+
+Arguments:
+@*
+str - input/output string
+
+@node SCM *=*
+@subsection @file{string-contains-eqv?} - caseless substring
+@findex string-contains-eqv?
+@findex *=*
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 291.
+@end ignore
+
+Usage: (*=* text match)
+@*
+string-contains-eqv?: Test to see if a string contains an equivalent string.
+`equivalent' means the strings match, but without regard
+to character case and certain characters are considered `equivalent'.
+Viz., '-', '_' and '^' are equivalent.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM *==*
+@subsection @file{string-contains?} - substring match
+@findex string-contains?
+@findex *==*
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 158.
+@end ignore
+
+Usage: (*==* text match)
+@*
+string-contains?: Test to see if a string contains a substring. "strstr(3)"
+will find an address.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM string-downcase
+@subsection @file{string-downcase} - lower case a new string
+@findex string-downcase
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expGuile.c line 440.
+@end ignore
+
+Usage: (string-downcase str)
+@*
+Create a new SCM string containing the same text as the original,
+only all the upper case letters are changed to lower case.
+
+Arguments:
+@*
+str - input string
+
+@node SCM string-downcase!
+@subsection @file{string-downcase!} - make a string be lower case
+@findex string-downcase!
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expGuile.c line 409.
+@end ignore
+
+Usage: (string-downcase! str)
+@*
+Change to lower case all the characters in an SCM string.
+
+Arguments:
+@*
+str - input/output string
+
+@node SCM *~
+@subsection @file{string-end-eqv-match?} - caseless regex ending
+@findex string-end-eqv-match?
+@findex *~
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 563.
+@end ignore
+
+Usage: (*~ text match)
+@*
+string-end-eqv-match?: Test to see if a string ends with a pattern.
+Case is not significant.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM *~~
+@subsection @file{string-end-match?} - regex match end
+@findex string-end-match?
+@findex *~~
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 550.
+@end ignore
+
+Usage: (*~~ text match)
+@*
+string-end-match?: Test to see if a string ends with a pattern.
+Case is significant.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM *=
+@subsection @file{string-ends-eqv?} - caseless string ending
+@findex string-ends-eqv?
+@findex *=
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 339.
+@end ignore
+
+Usage: (*= text match)
+@*
+string-ends-eqv?: Test to see if a string ends with an equivalent string.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM *==
+@subsection @file{string-ends-with?} - string ending
+@findex string-ends-with?
+@findex *==
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 187.
+@end ignore
+
+Usage: (*== text match)
+@*
+string-ends-with?: Test to see if a string ends with a substring.
+strcmp(3) returns zero for comparing the string ends.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM ==
+@subsection @file{string-equals?} - string matching
+@findex string-equals?
+@findex ==
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 262.
+@end ignore
+
+Usage: (== text match)
+@*
+string-equals?: Test to see if two strings exactly match.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM ~
+@subsection @file{string-eqv-match?} - caseless regex match
+@findex string-eqv-match?
+@findex ~
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 751.
+@end ignore
+
+Usage: (~ text match)
+@*
+string-eqv-match?: Test to see if a string fully matches a pattern.
+Case is not significant, but any character equivalences
+must be expressed in your regular expression.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM =
+@subsection @file{string-eqv?} - caseless match
+@findex string-eqv?
+@findex =
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 409.
+@end ignore
+
+Usage: (= text match)
+@*
+string-eqv?: Test to see if two strings are equivalent. `equivalent' means the
+strings match, but without regard to character case and certain
+characters are considered `equivalent'. Viz., '-', '_' and '^' are
+equivalent. If the arguments are not strings, then the result of the
+numeric comparison is returned.
+
+This is an overloaded operation. If the arguments are both
+numbers, then the query is passed through to @code{scm_num_eq_p()},
+otherwise the result depends on the SCMs being strictly equal.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM *~*
+@subsection @file{string-has-eqv-match?} - caseless regex contains
+@findex string-has-eqv-match?
+@findex *~*
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 481.
+@end ignore
+
+Usage: (*~* text match)
+@*
+string-has-eqv-match?: Test to see if a string contains a pattern.
+Case is not significant.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM *~~*
+@subsection @file{string-has-match?} - contained regex match
+@findex string-has-match?
+@findex *~~*
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 468.
+@end ignore
+
+Usage: (*~~* text match)
+@*
+string-has-match?: Test to see if a string contains a pattern.
+Case is significant.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM ~~
+@subsection @file{string-match?} - regex match
+@findex string-match?
+@findex ~~
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 738.
+@end ignore
+
+Usage: (~~ text match)
+@*
+string-match?: Test to see if a string fully matches a pattern.
+Case is significant.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM ~*
+@subsection @file{string-start-eqv-match?} - caseless regex start
+@findex string-start-eqv-match?
+@findex ~*
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 657.
+@end ignore
+
+Usage: (~* text match)
+@*
+string-start-eqv-match?: Test to see if a string starts with a pattern.
+Case is not significant.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM ~~*
+@subsection @file{string-start-match?} - regex match start
+@findex string-start-match?
+@findex ~~*
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 644.
+@end ignore
+
+Usage: (~~* text match)
+@*
+string-start-match?: Test to see if a string starts with a pattern.
+Case is significant.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM =*
+@subsection @file{string-starts-eqv?} - caseless string start
+@findex string-starts-eqv?
+@findex =*
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 376.
+@end ignore
+
+Usage: (=* text match)
+@*
+string-starts-eqv?: Test to see if a string starts with an equivalent string.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM ==*
+@subsection @file{string-starts-with?} - string starting
+@findex string-starts-with?
+@findex ==*
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 226.
+@end ignore
+
+Usage: (==* text match)
+@*
+string-starts-with?: Test to see if a string starts with a substring.
+
+Arguments:
+@*
+text - text to test for pattern
+@*
+match - pattern/substring to search for
+
+@node SCM string-substitute
+@subsection @file{string-substitute} - multiple global replacements
+@findex string-substitute
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expString.c line 1054.
+@end ignore
+
+Usage: (string-substitute source match repl)
+@*
+@code{match} and @code{repl} may be either a single string or
+a list of strings. Either way, they must have the same structure
+and number of elements. For example, to replace all amphersands,
+less than and greater than characters, do something like this:
+
+@example
+(string-substitute source
+(list "&" "<" ">")
+(list "&amp;" "&lt;" "&gt;"))
+@end example
+
+Arguments:
+@*
+source - string to transform
+@*
+match - substring or substring list to be replaced
+@*
+repl - replacement strings or substrings
+
+@node SCM string-table-add
+@subsection @file{string-table-add} - Add an entry to a string table
+@findex string-table-add
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/schemedef.scm line 224.
+@end ignore
+
+Usage: (string-table-add st-name str-val)
+@*
+Check for a duplicate string and, if none, then insert a new
+string into the string table. In all cases, returns the
+character index of the beginning of the string in the table.
+
+The returned index can be used in expressions like:
+@example
+string_array + <returned-value>
+@end example
+@noindent
+that will yield the address of the first byte of the inserted
+string. See the @file{strtable.test} AutoGen test for a usage
+example.
+
+Arguments:
+@*
+st-name - the name of the array of characters
+@*
+str-val - the (possibly) new value to add
+
+@node SCM string-table-add-ref
+@subsection @file{string-table-add-ref} - Add an entry to a string table, get reference
+@findex string-table-add-ref
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/schemedef.scm line 262.
+@end ignore
+
+Usage: (string-table-add-ref st-name str-val)
+@*
+Identical to string-table-add, except the value returned
+is the string "st-name" '+' and the index returned by
+string-table-add.
+
+Arguments:
+@*
+st-name - the name of the array of characters
+@*
+str-val - the (possibly) new value to add
+
+@node SCM string-table-new
+@subsection @file{string-table-new} - create a string table
+@findex string-table-new
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/schemedef.scm line 131.
+@end ignore
+
+Usage: (string-table-new st-name)
+@*
+This function will create an array of characters. The companion
+functions, (@xref{SCM string-table-add},
+@xref{SCM string-table-add-ref}, and
+@pxref{SCM emit-string-table}) will insert text and emit the
+populated table.
+
+With these functions, it should be much easier to construct
+structures containing string offsets instead of string pointers.
+That can be very useful when transmitting, storing or sharing data
+with different address spaces.
+
+@noindent
+Here is a brief example copied from the strtable.test test:
+
+@example
+[+ (string-table-new "scribble")
+ (out-push-new) ;; redirect output to temporary
+ (define ct 1) +][+
+
+FOR str IN that was the week that was +][+
+ (set! ct (+ ct 1))
++]
+ [+ (string-table-add-ref "scribble" (get "str")) +],[+
+ENDFOR +]
+[+ (out-suspend "main")
+ (emit-string-table "scribble")
+ (ag-fprintf 0 "\nchar const *ap[%d] = @{" ct)
+ (out-resume "main")
+ (out-pop #t) ;; now dump out the redirected output +]
+ NULL @};
+@end example
+
+@noindent
+Some explanation:
+
+@noindent
+I added the @code{(out-push-new)} because the string table text is
+diverted into an output stream named, ``scribble'' and I want to
+have the string table emitted before the string table references.
+The string table references are also emitted inside the @code{FOR}
+loop. So, when the loop is done, the current output is suspended
+under the name, ``main'' and the ``scribble'' table is then emitted
+into the primary output. (@code{emit-string-table} inserts its
+output directly into the current output stream. It does not need to
+be the last function in an AutoGen macro block.) Next I
+@code{ag-fprintf} the array-of-pointer declaration directly into the
+current output. Finally I restore the ``main'' output stream and
+@code{(out-pop #t)}-it into the main output stream.
+
+Here is the result. Note that duplicate strings are not repeated
+in the string table:
+
+@example
+static char const scribble[18] =
+ "that\0" "was\0" "the\0" "week\0";
+
+char const *ap[7] = @{
+ scribble+0,
+ scribble+5,
+ scribble+9,
+ scribble+13,
+ scribble+0,
+ scribble+5,
+ NULL @};
+@end example
+
+These functions use the global name space @code{stt-*} in addition to
+the function names.
+
+If you utilize this in your programming, it is recommended that you
+prevent printf format usage warnings with the GCC option
+@code{-Wno-format-contains-nul}
+
+Arguments:
+@*
+st-name - the name of the array of characters
+
+@node SCM string-table-size
+@subsection @file{string-table-size} - print the current size of a string table
+@findex string-table-size
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/schemedef.scm line 311.
+@end ignore
+
+Usage: (string-table-size st-name)
+@*
+Returns the current byte count of the string table.
+
+Arguments:
+@*
+st-name - the name of the array of characters
+
+@node SCM string->c-name!
+@subsection @file{string->c-name!} - map non-name chars to underscore
+@findex string->c-name!
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expGuile.c line 248.
+@end ignore
+
+Usage: (string->c-name! str)
+@*
+Change all the graphic characters that are invalid in a C name token
+into underscores. Whitespace characters are ignored. Any other
+character type (i.e. non-graphic and non-white) will cause a failure.
+
+Arguments:
+@*
+str - input/output string
+
+@node SCM string->camelcase
+@subsection @file{string->camelcase} - make a string be CamelCase
+@findex string->camelcase
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expGuile.c line 463.
+@end ignore
+
+Usage: (string->camelcase str)
+@*
+Capitalize the first letter of each block of letters and numbers,
+and stripping out characters that are not alphanumerics.
+For example, "alpha-beta0gamma" becomes "AlphaBeta0gamma".
+
+Arguments:
+@*
+str - input/output string
+
+@node SCM string-tr
+@subsection @file{string-tr} - convert characters with new result
+@findex string-tr
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expString.c line 1034.
+@end ignore
+
+Usage: (string-tr source match translation)
+@*
+This is identical to @code{string-tr!}, except that it does not
+over-write the previous value.
+
+Arguments:
+@*
+source - string to transform
+@*
+match - characters to be converted
+@*
+translation - conversion list
+
+@node SCM string-tr!
+@subsection @file{string-tr!} - convert characters
+@findex string-tr!
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expString.c line 963.
+@end ignore
+
+Usage: (string-tr! source match translation)
+@*
+This is the same as the @code{tr(1)} program, except the
+string to transform is the first argument. The second and
+third arguments are used to construct mapping arrays for the
+transformation of the first argument.
+
+It is too bad this little program has so many different
+and incompatible implementations!
+
+Arguments:
+@*
+source - string to transform
+@*
+match - characters to be converted
+@*
+translation - conversion list
+
+@node SCM string-upcase
+@subsection @file{string-upcase} - upper case a new string
+@findex string-upcase
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expGuile.c line 319.
+@end ignore
+
+Usage: (string-upcase str)
+@*
+Create a new SCM string containing the same text as the original,
+only all the lower case letters are changed to upper case.
+
+Arguments:
+@*
+str - input string
+
+@node SCM string-upcase!
+@subsection @file{string-upcase!} - make a string be upper case
+@findex string-upcase!
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expGuile.c line 288.
+@end ignore
+
+Usage: (string-upcase! str)
+@*
+Change to upper case all the characters in an SCM string.
+
+Arguments:
+@*
+str - input/output string
+
+@node SCM sub-shell-str
+@subsection @file{sub-shell-str} - back quoted (sub-)shell string
+@findex sub-shell-str
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expString.c line 853.
+@end ignore
+
+Usage: (sub-shell-str string)
+@*
+This function is substantially identical to @code{shell-str}, except
+that the quoting character is @code{`} and the "leave the escape alone"
+character is @code{"}.
+
+Arguments:
+@*
+string - string to transform
+
+@node SCM sum
+@subsection @file{sum} - sum of values in list
+@findex sum
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expGuile.c line 206.
+@end ignore
+
+Usage: (sum list ...)
+@*
+Compute the sum of the list of expressions.
+
+Arguments:
+@*
+list - list of values. Strings are converted to numbers
+
+@node SCM time-string->number
+@subsection @file{time-string->number} - duration string to seconds
+@findex time-string->number
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expString.c line 1096.
+@end ignore
+
+Usage: (time-string->number time_spec)
+@*
+Convert the argument string to a time period in seconds.
+The string may use multiple parts consisting of days, hours
+minutes and seconds. These are indicated with a suffix of
+@code{d}, @code{h}, @code{m} and @code{s} respectively.
+Hours, minutes and seconds may also be represented with
+@code{HH:MM:SS} or, without hours, as @code{MM:SS}.
+
+Arguments:
+@*
+time_spec - string to parse
+
+@node SCM version-compare
+@subsection @file{version-compare} - compare two version numbers
+@findex version-compare
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/expState.c line 226.
+@end ignore
+
+Usage: (version-compare op v1 v2)
+@*
+Converts v1 and v2 strings into 64 bit values and returns the
+result of running 'op' on those values. It assumes that the version
+is a 1 to 4 part dot-separated series of numbers. Suffixes like,
+"5pre4" or "5-pre4" will be interpreted as two numbers. The first
+number ("5" in this case) will be decremented and the number after
+the "pre" will be added to 0xC000. (Unless your platform is unable
+to support 64 bit integer arithmetic. Then it will be added to 0xC0.)
+Consequently, these yield true:
+@example
+(version-compare > "5.8.5" "5.8.5-pre4")
+(version-compare > "5.8.5-pre10" "5.8.5-pre4")
+@end example
+
+Arguments:
+@*
+op - comparison operator
+@*
+v1 - first version
+@*
+v2 - compared-to version
+@ignore
+START == MACROS == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node native macros
+@section AutoGen Native Macros
+@cindex native macros
+
+This section describes the various AutoGen natively defined macros.
+Unlike the Scheme functions, some of these macros are "block macros"
+with a scope that extends through a terminating macro. Block macros
+must not overlap. That is to say, a block macro started within the
+scope of an encompassing block macro must have its matching end macro
+appear before the encompassing block macro is either ended or subdivided.
+
+The block macros are these:
+
+@table @code
+@item CASE
+This macro has scope through the @code{ESAC} macro.
+The scope is subdivided by @code{SELECT} macros.
+You must have at least one @code{SELECT} macro.
+
+@item DEFINE
+This macro has scope through the @code{ENDDEF} macro. The defined
+user macro can never be a block macro. This macro is extracted from
+the template @i{before} the template is processed. Consequently, you
+cannot select a definition based on context. You can, however, place
+them all at the end of the file.
+
+@item FOR
+This macro has scope through the @code{ENDFOR} macro.
+
+@item IF
+This macro has scope through the @code{ENDIF} macro.
+The scope may be subdivided by @code{ELIF} and @code{ELSE}
+macros. Obviously, there may be only one @code{ELSE} macro
+and it must be the last of these subdivisions.
+
+@item INCLUDE
+This macro has the scope of the included file.
+It is a block macro in the sense that the included
+file must not contain any incomplete block macros.
+
+@item WHILE
+This macro has scope through the @code{ENDWHILE} macro.
+@end table
+@ignore
+END == MACROS == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+@menu
+* AGMacro syntax:: AutoGen Macro Syntax
+* BREAK:: BREAK - Leave a FOR or WHILE macro
+* CASE:: CASE - Select one of several template blocks
+* COMMENT:: COMMENT - A block of comment to be ignored
+* CONTINUE:: CONTINUE - Skip to end of a FOR or WHILE macro.
+* DEBUG:: DEBUG - Print debug message to trace output
+* DEFINE:: DEFINE - Define a user AutoGen macro
+* ELIF:: ELIF - Alternate Conditional Template Block
+* ELSE:: ELSE - Alternate Template Block
+* ENDDEF:: ENDDEF - Ends a macro definition.
+* ENDFOR:: ENDFOR - Terminates the @code{FOR} function template block
+* ENDIF:: ENDIF - Terminate the @code{IF} Template Block
+* ENDWHILE:: ENDWHILE - Terminate the @code{WHILE} Template Block
+* ESAC:: ESAC - Terminate the @code{CASE} Template Block
+* EXPR:: EXPR - Evaluate and emit an Expression
+* FOR:: FOR - Emit a template block multiple times
+* IF:: IF - Conditionally Emit a Template Block
+* INCLUDE:: INCLUDE - Read in and emit a template block
+* INVOKE:: INVOKE - Invoke a User Defined Macro
+* RETURN:: RETURN - Leave an INVOKE-d (DEFINE) macro
+* SELECT:: SELECT - Selection block for CASE function
+* UNKNOWN:: UNKNOWN - Either a user macro or a value name.
+* WHILE:: WHILE - Conditionally loop over a Template Block
+@end menu
+@node AGMacro syntax
+@subsection AutoGen Macro Syntax
+@cindex macro syntax
+
+The general syntax is:
+
+@example
+[ @{ <native-macro-name> | <user-defined-name> @} ] [ <arg> ... ]
+@end example
+
+@noindent
+The syntax for @code{<arg>} depends on the particular macro,
+but is generally a full expression (@pxref{expression syntax}).
+Here are the exceptions to that general rule:
+
+@enumerate
+@item
+@code{INVOKE} macros, implicit or explicit, must be followed by
+a list of name/string value pairs. The string values are
+@i{simple expressions}, as described above.
+
+That is, the @code{INVOKE} syntax is one of these two:
+@example
+<user-macro-name> [ <name> [ = <expression> ] ... ]
+
+INVOKE <name-expression> [ <name> [ = <expression> ] ... ]
+@end example
+
+@item
+AutoGen FOR macros must be in one of three forms:
+
+@example
+FOR <name> [ <separator-string> ]
+
+FOR <name> (...Scheme expression list)
+
+FOR <name> IN <string-entry> [ ... ]
+@end example
+@noindent
+where:
+@table @samp
+@item <name>
+must be a simple name.
+@item <separator-string>
+is inserted between copies of the enclosed block. Do not try to use ``IN''
+as your separator string. It won't work.
+@item <string-entry>
+is an entry in a list of strings. ``@code{<name>}'' is assigned
+each value from the ``@code{IN}'' list before expanding the @code{FOR} block.
+@item (...Scheme expression list)
+is expected to contain one or more of the @code{for-from},
+@code{for-to}, @code{for-by}, and @code{for-sep} functions.
+(@xref{FOR}, and @ref{AutoGen Functions})
+@end table
+
+The first two forms iterate over the @code{FOR} block if @code{<name>}
+is found in the AutoGen values. The last form will create the AutoGen
+value named @code{<name>}.
+
+@item
+AutoGen @code{DEFINE} macros must be followed by a simple name.
+Anything after that is ignored. Consequently, that ``comment space''
+may be used to document any named values the macro expects to have
+set up as arguments. @xref{DEFINE}.
+
+@item
+The AutoGen @code{COMMENT}, @code{ELSE}, @code{ESAC} and the @code{END*}
+macros take no arguments and ignore everything after the macro name
+(e.g. see @ref{COMMENT})
+@end enumerate
+
+@node BREAK
+@subsection BREAK - Leave a FOR or WHILE macro
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/functions.c line 36.
+@end ignore
+
+@findex BREAK
+
+This will unwind the loop context and resume after ENDFOR/ENDWHILE.
+Note that unless this happens to be the last iteration anyway,
+the (last-for?) function will never yield "#t".
+
+@node CASE
+@subsection CASE - Select one of several template blocks
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 880.
+@end ignore
+
+@findex CASE
+
+The arguments are evaluated and converted to a string, if necessary. A
+simple name will be interpreted as an AutoGen value name and its value will
+be used by the @code{SELECT} macros (see the example below and the
+expression evaluation function, @pxref{EXPR}). The scope of the macro is
+up to the matching @code{ESAC} macro. Within the scope of a @code{CASE},
+this string is matched against case selection macros. There are sixteen
+match macros that are derived from four different ways matches may be
+performed, plus an "always true", "true if the AutoGen value was found",
+and "true if no AutoGen value was found" matches. The codes for the
+nineteen match macros are formed as follows:
+
+@enumerate
+@item
+Must the match start matching from the beginning of the string?
+If not, then the match macro code starts with an asterisk (@code{*}).
+@item
+Must the match finish matching at the end of the string?
+If not, then the match macro code ends with an asterisk (@code{*}).
+@item
+Is the match a pattern match or a string comparison?
+If a comparison, use an equal sign (@code{=}).
+If a pattern match, use a tilde (@code{~}).
+@item
+Is the match case sensitive?
+If alphabetic case is important, double the tilde or equal sign.
+@item
+Do you need a default match when none of the others match?
+Use a single asterisk (@code{*}).
+@item
+Do you need to distinguish between an empty string value and a value
+that was not found? Use the non-existence test (@code{!E}) before
+testing a full match against an empty string (@code{== ''}).
+There is also an existence test (@code{+E}), more for symmetry than
+for practical use.
+@end enumerate
+
+@noindent
+For example:
+
+@example
+[+ CASE <full-expression> +]
+[+ ~~* "[Tt]est" +]reg exp must match at start, not at end
+[+ == "TeSt" +]a full-string, case sensitive compare
+[+ = "TEST" +]a full-string, case insensitive compare
+[+ !E +]not exists - matches if no AutoGen value found
+[+ == "" +]expression yielded a zero-length string
+[+ +E +]exists - matches if there is any value result
+[+ * +]always match - no testing
+[+ ESAC +]
+@end example
+
+@code{<full-expression>} (@pxref{expression syntax}) may be any expression,
+including the use of apply-codes and value-names. If the expression yields
+a number, it is converted to a decimal string.
+
+These case selection codes have also been implemented as
+Scheme expression functions using the same codes. They are documented
+in this texi doc as ``string-*?'' predicates (@pxref{Common Functions}).
+
+@node COMMENT
+@subsection COMMENT - A block of comment to be ignored
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/functions.c line 348.
+@end ignore
+
+@findex COMMENT
+
+This function can be specified by the user, but there will
+never be a situation where it will be invoked at emit time.
+The macro is actually removed from the internal representation.
+
+If the native macro name code is @code{#}, then the
+entire macro function is treated as a comment and ignored.
+
+@example
+[+ # say what you want, but no '+' before any ']' chars +]
+@end example
+
+@node CONTINUE
+@subsection CONTINUE - Skip to end of a FOR or WHILE macro.
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/functions.c line 26.
+@end ignore
+
+@findex CONTINUE
+
+This will skip the remainder of the loop and start the next.
+
+@node DEBUG
+@subsection DEBUG - Print debug message to trace output
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcDef.c line 387.
+@end ignore
+
+@findex DEBUG
+
+If the tracing level is at "debug-message" or above
+(@pxref{autogen trace}), this macro prints a debug message to trace
+output. This message is not evaluated. This macro can also be used to
+set useful debugger breakpoints. By inserting [+DEBUG n+] into your
+template, you can set a debugger breakpoint on the #n case element
+below (in the AutoGen source) and step through the processing of
+interesting parts of your template.
+
+To be useful, you have to have access to the source tree where autogen
+was built and the template being processed. The definitions are also
+helpful, but not crucial. Please contact the author if you think you
+might actually want to use this.
+
+@node DEFINE
+@subsection DEFINE - Define a user AutoGen macro
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcDef.c line 531.
+@end ignore
+
+@findex DEFINE
+@cindex define macro
+
+This function will define a new macro. You must provide a name for the
+macro. You do not specify any arguments, though the invocation may
+specify a set of name/value pairs that are to be active during the
+processing of the macro.
+
+@example
+[+ define foo +]
+... macro body with macro functions ...
+[+ enddef +]
+... [+ foo bar='raw text' baz=<<text expression>> +]
+@end example
+
+Once the macro has been defined, this new macro can be invoked by
+specifying the macro name as the first token after the start macro marker.
+Alternatively, you may make the invocation explicitly invoke a defined
+macro by specifying @code{INVOKE} (@pxref{INVOKE}) in the macro
+invocation. If you do that, the macro name can be computed with an
+expression that gets evaluated every time the INVOKE macro is encountered.
+
+Any remaining text in the macro invocation will be used to create new
+name/value pairs that only persist for the duration of the processing of
+the macro. The expressions are evaluated the same way basic
+expressions are evaluated. @xref{expression syntax}.
+
+The resulting definitions are handled much like regular
+definitions, except:
+
+@enumerate
+@item
+The values may not be compound. That is, they may not contain
+nested name/value pairs.
+@item
+The bindings go away when the macro is complete.
+@item
+The name/value pairs are separated by whitespace instead of
+semi-colons.
+@item
+Sequences of strings are not concatenated.
+@end enumerate
+
+@quotation
+@strong{NB:} The macro is extracted from the template as the template is
+scanned. You cannot conditionally define a macro by enclosing it in an
+@code{IF}/@code{ENDIF} (@pxref{IF}) macro pair. If you need to dynamically
+select the format of a @code{DEFINE}d macro, then put the flavors into
+separate template files that simply define macros. @code{INCLUDE}
+(@pxref{INCLUDE}) the appropriate template when you have computed which
+you need.
+@end quotation
+
+Due to this, it is acceptable and even a good idea to place all the
+@code{DEFINE} macros at the end of the template. That puts the main
+body of the template at the beginning of the file.
+
+@node ELIF
+@subsection ELIF - Alternate Conditional Template Block
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcIf.c line 258.
+@end ignore
+
+@findex ELIF
+
+This macro must only appear after an @code{IF} function, and
+before any associated @code{ELSE} or @code{ENDIF} functions.
+It denotes the start of an alternate template block for the
+@code{IF} function. Its expression argument is evaluated as are
+the arguments to @code{IF}. For a complete description @xref{IF}.
+
+@node ELSE
+@subsection ELSE - Alternate Template Block
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcIf.c line 286.
+@end ignore
+
+@findex ELSE
+
+This macro must only appear after an @code{IF} function,
+and before the associated @code{ENDIF} function.
+It denotes the start of an alternate template block for
+the @code{IF} function. For a complete description @xref{IF}.
+
+@node ENDDEF
+@subsection ENDDEF - Ends a macro definition.
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcDef.c line 595.
+@end ignore
+
+@findex ENDDEF
+
+This macro ends the @code{DEFINE} function template block.
+For a complete description @xref{DEFINE}.
+
+@node ENDFOR
+@subsection ENDFOR - Terminates the @code{FOR} function template block
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcFor.c line 678.
+@end ignore
+
+@findex ENDFOR
+
+This macro ends the @code{FOR} function template block.
+For a complete description @xref{FOR}.
+
+@node ENDIF
+@subsection ENDIF - Terminate the @code{IF} Template Block
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcIf.c line 132.
+@end ignore
+
+@findex ENDIF
+
+This macro ends the @code{IF} function template block.
+For a complete description @xref{IF}.
+
+@node ENDWHILE
+@subsection ENDWHILE - Terminate the @code{WHILE} Template Block
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcIf.c line 215.
+@end ignore
+
+@findex ENDWHILE
+
+This macro ends the @code{WHILE} function template block.
+For a complete description @xref{WHILE}.
+
+@node ESAC
+@subsection ESAC - Terminate the @code{CASE} Template Block
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 947.
+@end ignore
+
+@findex ESAC
+
+This macro ends the @code{CASE} function template block.
+For a complete description, @xref{CASE}.
+
+@node EXPR
+@subsection EXPR - Evaluate and emit an Expression
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcEval.c line 453.
+@end ignore
+
+@findex EXPR
+
+This macro does not have a name to cause it to be invoked
+explicitly, though if a macro starts with one of the apply codes
+or one of the simple expression markers, then an expression
+macro is inferred. The result of the expression evaluation
+(@pxref{expression syntax}) is written to the current output.
+
+@node FOR
+@subsection FOR - Emit a template block multiple times
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcFor.c line 599.
+@end ignore
+
+@findex FOR
+@cindex looping, for
+@cindex for loop
+
+This macro has a slight variation on the standard syntax:
+@example
+FOR <value-name> [ <separator-string> ]
+
+FOR <value-name> (...Scheme expression list)
+
+FOR <value-name> IN "string" [ ... ]
+@end example
+
+Other than for the last form, the first macro argument must be the name of
+an AutoGen value. If there is no value associated with the name, the
+@code{FOR} template block is skipped entirely. The scope of the @code{FOR}
+macro extends to the corresponding @code{ENDFOR} macro. The last form will
+create an array of string values named @code{<value-name>} that only exists
+within the context of this @code{FOR} loop. With this form, in order to
+use a @code{separator-string}, you must code it into the end of the
+template block using the @code{(last-for?)} predicate function
+(@pxref{SCM last-for?}).
+
+If there are any arguments after the @code{value-name}, the initial
+characters are used to determine the form. If the first character is
+either a semi-colon (@code{;}) or an opening parenthesis (@code{(}), then
+it is presumed to be a Scheme expression containing the FOR macro specific
+functions @code{for-from}, @code{for-by}, @code{for-to}, and/or
+@code{for-sep}. @xref{AutoGen Functions}. If it consists of an '@code{i}'
+an '@code{n}' and separated by white space from more text, then the
+@code{FOR x IN} form is processed. Otherwise, the remaining text is
+presumed to be a string for inserting between each iteration of the loop.
+This string will be emitted one time less than the number of iterations of
+the loop. That is, it is emitted after each loop, excepting for the last
+iteration.
+
+If the from/by/to functions are invoked, they will specify which copies of
+the named value are to be processed. If there is no copy of the named
+value associated with a particular index, the @code{FOR} template block
+will be instantiated anyway. The template must use methods for detecting
+missing definitions and emitting default text. In this fashion, you can
+insert entries from a sparse or non-zero based array into a dense, zero
+based array.
+
+@strong{NB:} the @code{for-from}, @code{for-to}, @code{for-by} and
+@code{for-sep} functions are disabled outside of the context of the
+@code{FOR} macro. Likewise, the @code{first-for}, @code{last-for}
+and @code{for-index} functions are disabled outside of the range
+of a @code{FOR} block.
+
+@strong{Also:} the @code{<value-name>} must be a single level name,
+not a compound name (@pxref{naming values}).
+
+@example
+[+FOR var (for-from 0) (for-to <number>) (for-sep ",") +]
+... text with @code{var}ious substitutions ...[+
+ENDFOR var+]
+@end example
+
+@noindent
+this will repeat the @code{... text with @code{var}ious
+substitutions ...} <number>+1 times. Each repetition,
+except for the last, will have a comma @code{,} after it.
+
+@example
+[+FOR var ",\n" +]
+... text with @code{var}ious substitutions ...[+
+ENDFOR var +]
+@end example
+
+@noindent
+This will do the same thing, but only for the index
+values of @code{var} that have actually been defined.
+
+@node IF
+@subsection IF - Conditionally Emit a Template Block
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcIf.c line 96.
+@end ignore
+
+@findex IF
+@cindex conditional emit
+@cindex if test
+
+Conditional block. Its arguments are evaluated (@pxref{EXPR}) and
+if the result is non-zero or a string with one or more bytes,
+then the condition is true and the text from that point
+until a matched @code{ELIF}, @code{ELSE} or @code{ENDIF} is emitted.
+@code{ELIF} introduces a conditional alternative if the @code{IF}
+clause evaluated FALSE and @code{ELSE} introduces an unconditional
+alternative.
+
+@example
+[+IF <full-expression> +]
+emit things that are for the true condition[+
+
+ELIF <full-expression-2> +]
+emit things that are true maybe[+
+
+ELSE "This may be a comment" +]
+emit this if all but else fails[+
+
+ENDIF "This may *also* be a comment" +]
+@end example
+
+@noindent
+@code{<full-expression>} may be any expression described in the
+@code{EXPR} expression function, including the use of apply-codes
+and value-names. If the expression yields an empty string, it
+is interpreted as @i{false}.
+
+@node INCLUDE
+@subsection INCLUDE - Read in and emit a template block
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/functions.c line 177.
+@end ignore
+
+@findex INCLUDE
+
+The entire contents of the named file is inserted at this point.
+The contents of the file are processed for macro expansion. The
+arguments are eval-ed, so you may compute the name of the file to
+be included. The included file must not contain any incomplete
+function blocks. Function blocks are template text beginning with
+any of the macro functions @samp{CASE}, @samp{DEFINE}, @samp{FOR},
+@samp{IF} and @samp{WHILE}; extending through their respective
+terminating macro functions.
+
+@node INVOKE
+@subsection INVOKE - Invoke a User Defined Macro
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcDef.c line 667.
+@end ignore
+
+@findex INVOKE
+
+User defined macros may be invoked explicitly or implicitly.
+If you invoke one implicitly, the macro must begin with the
+name of the defined macro. Consequently, this may @strong{not}
+be a computed value. If you explicitly invoke a user defined macro,
+the macro begins with the macro name @code{INVOKE} followed by
+a @i{basic expression} that must yield a known user defined macro.
+A macro name _must_ be found, or AutoGen will issue a diagnostic
+and exit.
+
+Arguments are passed to the invoked macro by name.
+The text following the macro name must consist of a series of
+names each of which is followed by an equal sign (@code{=}) and
+a @i{basic expression} that yields a string.
+
+The string values may contain template macros that are parsed
+the first time the macro is processed and evaluated again every
+time the macro is evaluated.
+
+@node RETURN
+@subsection RETURN - Leave an INVOKE-d (DEFINE) macro
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/functions.c line 93.
+@end ignore
+
+@findex RETURN
+
+This will unwind looping constructs inside of a DEFINE-d macro and
+return to the invocation point. The output files and diversions
+@i{are left alone}. This means it is unwise to start diversions
+in a DEFINEd macro and RETURN from it before you have handled the
+diversion. Unless you are careful. Here is some rope for you.
+Please be careful using it.
+
+@node SELECT
+@subsection SELECT - Selection block for CASE function
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcCase.c line 1280.
+@end ignore
+
+@findex SELECT
+
+This macro selects a block of text by matching an expression
+against the sample text expression evaluated in the @code{CASE}
+macro. @xref{CASE}.
+
+You do not specify a @code{SELECT} macro with the word ``select''.
+Instead, you must use one of the 19 match operators described in
+the @code{CASE} macro description.
+
+@node UNKNOWN
+@subsection UNKNOWN - Either a user macro or a value name.
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/functions.c line 241.
+@end ignore
+
+@findex UNKNOWN
+
+The macro text has started with a name not known to AutoGen. If, at run
+time, it turns out to be the name of a defined macro, then that macro is
+invoked. If it is not, then it is a conditional expression that is
+evaluated only if the name is defined at the time the macro is invoked.
+
+You may not specify @code{UNKNOWN} explicitly.
+
+@node WHILE
+@subsection WHILE - Conditionally loop over a Template Block
+
+@ignore
+Generated from auto_gen.tpl line 538.
+Extracted from /old-home/bkorb/ag/ag/agen5/funcIf.c line 188.
+@end ignore
+
+@findex WHILE
+@cindex conditional emit
+@cindex while test
+
+Conditionally repeated block. Its arguments are evaluated (@pxref{EXPR})
+and as long as the result is non-zero or a string with one or more bytes,
+then the condition is true and the text from that point
+until a matched @code{ENDWHILE} is emitted.
+
+@example
+[+WHILE <full-expression> +]
+emit things that are for the true condition[+
+
+ENDWHILE +]
+@end example
+
+@noindent
+@code{<full-expression>} may be any expression described in the
+@code{EXPR} expression function, including the use of apply-codes
+and value-names. If the expression yields an empty string, it
+is interpreted as @i{false}.
+@ignore
+START == AUGMENTING == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node output controls
+@section Redirecting Output
+@cindex Redirecting Output
+@cindex diversion
+
+AutoGen provides a means for redirecting the template output to different
+files or, in @file{M4} parlance, to various diversions. It is accomplished
+by providing a set of Scheme functions named @code{out-*}
+(@pxref{AutoGen Functions}).
+
+@table @samp
+@item out-push-new (@pxref{SCM out-push-new})
+This allows you to logically "push" output files onto a stack.
+If you supply a string name, then a file by that name is created
+to hold the output. If you do not supply a name, then the text is
+written to a scratch pad and retrieved by passing a ``@code{#t}'' argument
+to the @code{out-pop} (@pxref{SCM out-pop}) function.
+
+@item out-pop (@pxref{SCM out-pop})
+This function closes the current output file and resumes output to the next
+one in the stack. At least one output must have been pushed onto the output
+stack with the @code{out-push-new} (@pxref{SCM out-push-new}) function. If
+``@code{#t}'' is passed in as an argument, then the entire contents of the
+diversion (or file) is returned.
+
+@item out-suspend (@pxref{SCM out-suspend})
+This function does not close the current output, but instead sets it aside
+for resumption by the given name with @code{out-resume}. The current output
+must have been pushed on the output queue with @code{out-push-new}
+(@pxref{SCM out-push-new}).
+
+@item out-resume (@pxref{SCM out-resume})
+This will put a named file descriptor back onto the top of
+stack so that it becomes the current output again.
+
+@item out-switch (@pxref{SCM out-switch})
+This closes the current output and creates a new file,
+purging any preexisting one. This is a shortcut for "pop"
+followed by "push", but this can also be done at the base level.
+
+@item out-move (@pxref{SCM out-move})
+Renames the current output file without closing it.
+@end table
+
+There are also several functions for determining the output
+status. @xref{AutoGen Functions}.
+
+@ignore
+
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+@end ignore
+
+@page
+@node Augmenting AutoGen
+@chapter Augmenting AutoGen Features
+@cindex Augmenting AutoGen
+
+AutoGen was designed to be simple to enhance. You can do it by
+providing shell commands, Guile/Scheme macros or callout functions
+that can be invoked as a Guile macro. Here is how you do these.
+
+@menu
+* shell commands:: Shell Output Commands
+* guile macros:: Guile Macros
+* guile callouts:: Guile Callout Functions
+* AutoGen macros:: AutoGen Macros
+@end menu
+
+@c === SECTION MARKER
+
+@node shell commands
+@section Shell Output Commands
+
+Shell commands are run inside of a server process. This means that,
+unlike @file{make}, context is kept from one command to the next.
+Consequently, you can define a shell function in one place inside of
+your template and invoke it in another. You may also store values
+in shell variables for later reference. If you load functions from
+a file containing shell functions, they will remain until AutoGen exits.
+
+If your shell script should determine that AutoGen should stop
+processing, the recommended method for stopping AutoGen is:
+@example
+die "some error text"
+@end example
+
+@noindent
+That is a shell function added by AutoGen. It will send a SIGTERM
+to autogen and exit from the "persistent" shell.
+
+@c === SECTION MARKER
+
+@node guile macros
+@section Guile Macros
+
+Guile also maintains context from one command to the next. This means you may
+define functions and variables in one place and reference them elsewhere.
+You also may load Guile macro definitions from a Scheme file by using the
+@code{--load-scheme} command line option (@pxref{autogen load-scheme}).
+Beware, however, that the AutoGen specific scheme functions have not been
+loaded at this time, so though you may define functions that reference them,
+do not invoke the AutoGen functions at this time.
+
+If your Scheme script should determine that AutoGen should stop
+processing, the recommended method for stopping AutoGen is:
+@example
+(error "some error text")
+@end example
+
+@c === SECTION MARKER
+
+@node guile callouts
+@section Guile Callout Functions
+
+Callout functions must be registered with Guile to work. This can
+be accomplished either by putting your routines into a shared library
+that contains a @code{void scm_init( void )} routine that registers
+these routines, or by building them into AutoGen.
+
+To build them into AutoGen, you must place your routines in the source
+directory and name the files @file{exp*.c}. You also must have a stylized
+comment that @file{getdefs} can find that conforms to the following:
+
+@example
+/*=gfunc <function-name>
+ *
+ * what: <short one-liner>
+ * general_use:
+ * string: <invocation-name-string>
+ * exparg: <name>, <description> [, ['optional'] [, 'list']]
+ * doc: A long description telling people how to use
+ * this function.
+=*/
+SCM
+ag_scm_<function-name>( SCM arg_name[, ...] )
+@{ <code> @}
+@end example
+
+@table @samp
+@item gfunc
+You must have this exactly thus.
+
+@item <function-name>
+This must follow C syntax for variable names
+
+@item <short one-liner>
+This should be about a half a line long.
+It is used as a subsection title in this document.
+
+@item general_use:
+You must supply this unless you are an AutoGen maintainer and are writing
+a function that queries or modifies the state of AutoGen.
+
+@item <invocation-name-string>
+Normally, the @code{function-name} string will be transformed into
+a reasonable invocation name. However, that is not always true.
+If the result does not suit your needs, then supply an alternate string.
+
+@item exparg:
+You must supply one for each argument to your function.
+All optional arguments must be last.
+The last of the optional arguments may be a list, if you choose.
+
+@item doc:
+Please say something meaningful.
+
+@item [, ...]
+Do not actually specify an ANSI ellipsis here. You must provide
+for all the arguments you specified with @code{exparg}.
+@end table
+
+See the Guile documentation for more details.
+More information is also available in a large comment at the
+beginning of the @file{agen5/snarf.tpl} template file.
+
+@c === SECTION MARKER
+
+@node AutoGen macros
+@section AutoGen Macros
+
+There are two kinds@: those you define yourself and AutoGen native.
+The user-defined macros may be defined in your templates or loaded
+with the @code{--lib-template} option
+(See @ref{DEFINE} and @ref{autogen lib-template}).
+
+As for AutoGen native macros, do not add any. It is easy to do, but I
+won't like it. The basic functions needed to accomplish looping over
+and selecting blocks of text have proved to be sufficient over a period
+of several years. New text transformations can be easily added via any
+of the AutoGen extension methods, as discussed above.
+
+@ignore
+END == AUGMENTING == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+@ignore
+
+Invocation section from invoke-autogen.texi
+
+@end ignore
+@page
+
+@include invoke-autogen.texi
+
+@ignore
+START == INSTALLATION == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@page
+@node Installation
+@chapter Configuring and Installing
+
+@menu
+* configuring:: Configuring AutoGen
+* AutoGen CGI:: AutoGen as a CGI server
+* signal names:: Signal Names
+* installing:: Installing AutoGen
+@end menu
+
+@c === SECTION MARKER
+
+@node configuring
+@section Configuring AutoGen
+@cindex configuring
+
+AutoGen is configured and built using Libtool, Automake and Autoconf.
+Consequently, you can install it wherever you wish using the various
+@samp{--prefix} options. To the various configuration options supplied
+by these tools, AutoGen adds a few of its own:
+
+@table @samp
+@item --disable-shell
+AutoGen is now capable of acting as a CGI forms server, @xref{AutoGen CGI}.
+As such, it will gather its definitions using either @samp{GET} or
+@samp{POST} methods. All you need to do is have a template named
+@file{cgi.tpl} handy or specify a different one with a command line
+option.
+
+However, doing this without disabling the server shell brings
+considerable risk. If you were to pass user input to a script
+that contained, say, the classic "@samp{`rm -rf /`}", you might have
+a problem. This configuration option will cause shell template
+commands to simply return the command string as the result.
+No mistakes. Much safer. Strongly recommended.
+The default is to have server shell scripting enabled.
+
+Disabling the shell will have some build side effects, too.
+
+@itemize @bullet
+@item
+Many of the make check tests will fail, since they assume
+a working server shell.
+@item
+The getdefs and columns programs are not built.
+The options are distributed as definition files and they
+cannot be expanded with a shell-disabled AutoGen.
+@item
+Similarly, the documentation cannot be regenerated because
+the documentation templates depend on subshell functionality.
+@end itemize
+
+@item --enable-debug
+Turning on AutoGen debugging enables very detailed inspection of
+the input definitions and monitoring shell script processing.
+These options are not particularly useful to anyone not directly
+involved in maintaining AutoGen. If you do choose to enable AutoGen
+debugging, be aware that the usage page was generated without these
+options, so when the build process reaches the documentation rebuild,
+there will be a failure. @samp{cd} into the @file{agen5} build
+directory, @samp{make} the @samp{autogen.texi} file and all will
+be well thereafter.
+
+@item --with-regex-header
+@itemx --with-header-path
+@itemx --with-regex-lib
+These three work together to specify how to compile with and link to
+a particular POSIX regular expression library. The value for
+@file{--with-regex-header=value} must be the name of the relevant header
+file. The AutoGen sources will attempt to include that source with
+a @code{#include <value>} C preprocessing statement. The @code{path} from the
+@file{--with-header-path=path} will be added to @code{CPPFLAGS} as @file{-Ipath}.
+The @code{lib-specs} from @file{--with-regex-lib=lib-specs} will be added
+to @code{LDFLAGS} without any adornment.
+@end table
+
+@c === SECTION MARKER
+
+@page
+@node AutoGen CGI
+@section AutoGen as a CGI server
+
+AutoGen is now capable of acting as a CGI forms server.
+It behaves as a CGI server if the definitions input is from stdin
+and the environment variable @code{REQUEST_METHOD} is defined
+and set to either "GET" or "POST". If set to anything else,
+AutoGen will exit with a failure message. When set to one of those
+values, the CGI data will be converted to AutoGen definitions
+(@pxref{Definitions File}) and the template named "@code{cgi.tpl}"
+will be processed.
+
+This works by including the name of the real template to process
+in the form data and having the "@code{cgi.tpl}" template include
+that template for processing. I do this for processing the form
+@url{http://autogen.sourceforge.net/conftest.html}. The "@code{cgi.tpl}"
+looks approximately like this:
+
+@example
+<? AutoGen5 Template ?>
+<?
+IF (not (exist? "template")) ?><?
+ form-error ?><?
+
+ELIF (=* (get "template") "/") ?><?
+ form-error ?><?
+
+ELIF (define tpl-file (string-append "cgi-tpl/"
+ (get "template")))
+ (access? tpl-file R_OK) ?><?
+ INCLUDE (. tpl-file) ?><?
+
+ELIF (set! tpl-file (string-append tpl-file ".tpl"))
+ (access? tpl-file R_OK) ?><?
+ INCLUDE (. tpl-file) ?><?
+
+ELSE ?><?
+ form-error ?><?
+ENDIF ?>
+@end example
+
+@noindent
+This forces the template to be found in the "@code{cgi-tpl/}"
+directory. Note also that there is no suffix specified in the
+pseudo macro (@pxref{pseudo macro}). That tells AutoGen to emit
+the output to @file{stdout}.
+
+The output is actually spooled until it is complete so that,
+in the case of an error, the output can be discarded and a proper
+error message can be written in its stead.
+
+@strong{Please also note} that it is advisable, @emph{especially} for network
+accessible machines, to configure AutoGen (@pxref{configuring}) with
+shell processing disabled (@code{--disable-shell}). That will make it
+impossible for any referenced template to hand data to a subshell for
+interpretation.
+
+@c === SECTION MARKER
+
+@node signal names
+@section Signal Names
+@cindex Signal Names
+
+When AutoGen is first built, it tries to use @code{psignal(3)},
+@code{sys_siglist}, @code{strsigno(3)} and @code{strsignal(3)} from the
+host operating system. If your system does not supply these, the
+AutoGen distribution will. However, it will use the distributed mapping
+and this mapping is unlikely to match what your system uses. This can
+be fixed. Once you have installed autogen, the mapping can be rebuilt
+on the host operating system. To do so, you must perform the
+following steps:
+
+@enumerate
+@item
+Build and install AutoGen in a place where it will be found in your
+search path.
+
+@item
+@code{cd $@{top_srcdir@}/compat}
+
+@item
+@code{autogen strsignal.def}
+
+@item
+Verify the results by examining the @file{strsignal.h} file produced.
+
+@item
+Re-build and re-install AutoGen.
+@end enumerate
+
+If you have any problems or peculiarities that cause this process to
+fail on your platform, please send me copies of the header files
+containing the signal names and numbers, along with the full path names
+of these files. I will endeavor to fix it. There is a shell script
+inside of @file{strsignal.def} that tries to hunt down the information.
+
+@c === SECTION MARKER
+
+@node installing
+@section Installing AutoGen
+@cindex Installing
+
+There are several files that get installed. The number depend
+whether or not both shared and archive libraries are to be
+installed. The following assumes that everything is installed
+relative to @code{$prefix}. You can, of course, use
+@code{configure} to place these files where you wish.
+
+@strong{NB}@: AutoGen does not contain any compiled-in path names.
+All support directories are located via option processing,
+the environment variable @code{HOME} or finding the directory where
+the executable came from.
+
+The installed files are:
+
+@enumerate
+@item
+The executables in @file{bin} (autogen, getdefs and columns).
+
+@item
+The AutoOpts link libraries as @file{lib/libopts.*}.
+
+@item
+An include file in @file{include/options.h}, needed for
+Automated Option Processing (see next chapter).
+
+@item
+Several template files and a scheme script in @file{share/autogen}, needed
+for Automated Option Processing (@pxref{AutoOpts}), parsing definitions
+written with scheme syntax (@pxref{Dynamic Text}), the templates for
+producing documentation for your program (@pxref{documentation attributes}),
+autoconf test macros, and AutoFSM.
+
+@item
+Info-style help files as @file{info/autogen.info*}.
+These files document AutoGen, the option processing
+library AutoOpts, and several add-on components.
+
+@item
+The three man pages for the three executables are installed in man/man1.
+@end enumerate
+
+This program, library and supporting files can be installed
+with three commands:
+
+@itemize @bullet
+@item
+<src-dir>/configure [ <configure-options> ]
+@item
+make
+@item
+make install
+@end itemize
+
+However, you may wish to insert @code{make check}
+before the @code{make install} command.
+
+If you do perform a @code{make check} and there are any failures, you
+will find the results in @code{<module>/test/FAILURES}. Needless to say, I
+would be interested in seeing the contents of those files and any
+associated messages. If you choose to go on and analyze one of these
+failures, you will need to invoke the test scripts individually. You
+may do so by specifying the test (or list of test) in the TESTS make
+variable, thus:
+
+@example
+gmake TESTS=test-name.test check
+@end example
+
+I specify @code{gmake} because most makes will not let you override
+internal definitions with command line arguments. @code{gmake} does.
+
+All of the AutoGen tests are written to honor the contents of the
+@t{VERBOSE} environment variable. Normally, any commentary generated
+during a test run is discarded unless the @t{VERBOSE} environment
+variable is set. So, to see what is happening during the test, you
+might invoke the following with @i{bash} or @i{ksh}:
+
+@example
+VERBOSE=1 gmake TESTS="for.test forcomma.test" check
+@end example
+
+@noindent
+Or equivalently with @i{csh}:
+
+@example
+env VERBOSE=1 gmake TESTS="for.test forcomma.test" check
+@end example
+
+@ignore
+END == INSTALLATION == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore@page
+@node AutoOpts
+@chapter Automated Option Processing
+@cindex autoopts
+
+AutoOpts 36.5 is bundled with AutoGen. It is a tool that virtually eliminates the
+hassle of processing options and keeping man pages, info docs and usage text
+up to date. This package allows you to specify several program attributes, up
+to a hundred option types and many option attributes. From this, it then
+produces all the code necessary to parse and handle the command line and
+configuration file options, and the documentation that should go with your
+program as well.
+@ignore
+START == AUTOOPTS == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+All the features notwithstanding, some applications simply have
+well-established command line interfaces. Even still, those programs
+may use the configuration file parsing portion of the library.
+See the ``AutoOpts Features'' and ``Configuration File Format'' sections.
+
+@menu
+* Features:: AutoOpts Features
+* Licensing:: AutoOpts Licensing
+* Caveats:: Developer and User Notes
+* Quick Start:: Quick Start
+* Option Definitions:: Option Definitions
+* AutoOpts API:: Programmatic Interface
+* Multi-Threading:: Multi-Threading
+* option descriptor:: Option Descriptor File
+* Using AutoOpts:: Using AutoOpts
+* Presetting Options:: Configuring your program
+* Config File Format:: Configuration File Format
+* shell options:: AutoOpts for Shell Scripts
+* AutoInfo:: Automated Info Docs
+* AutoMan pages:: Automated Man Pages
+* getopt_long:: Using getopt(3C)
+* i18n:: Internationalizing AutoOpts
+* Naming Conflicts:: Naming Conflicts
+* All Attribute Names:: All Attribute Names
+* Option Define Names:: Option Definition Name Index
+@end menu
+
+@c === SECTION MARKER
+
+@node Features
+@section AutoOpts Features
+@cindex features
+
+AutoOpts supports option processing; option state saving; and
+program documentation with innumerable features. Here, we list
+a few obvious ones and some important ones, but the full list is
+really defined by all the attributes defined in the @ref{Option Definitions}
+section.
+
+@enumerate
+@item
+POSIX-compliant short (flag) option processing.
+
+@item
+GNU-style long options processing. Long options
+are recognized without case sensitivity, and they may be abbreviated.
+
+@item
+Environment variable initializations, @xref{environrc}.
+
+@item
+Initialization from configuration files (aka RC or INI files), and
+saving the option state back into one, @xref{loading rcfile}.
+
+@item
+Config files may be partitioned. One config file may be used by several
+programs by partitioning it with lines containing,
+``@code{[PROGRAM_NAME]}'' or ``@code{<?program-name>}'', @xref{loading rcfile}.
+
+@item
+Config files may contain AutoOpts directives.
+``@code{<?auto-options [[option-text]]>}'' may be used to set @code{AutoOpts}
+option processing options. Viz., @code{GNU} usage layout versus @code{AutoOpts}
+conventional layout, and @code{misuse-usage} versus @code{no-misuse-usage},
+@xref{usage attributes}.
+
+@item
+Options may be marked as @code{@i{dis}-abled} with a disablement prefix.
+Such options may default to either an enabled or a disabled state. You
+may also provide an enablement prefix, too, e.g., @code{--allow-mumble}
+and @code{--prevent-mumble} (@pxref{Common Attributes}).
+
+@item
+Verify that required options are present between the minimum and maximum
+number of times on the command line. Verify that conflicting options do not
+appear together. Verify that options requiring the presence of other options
+are, in fact, used in the presence of other options.
+See @xref{Common Attributes}, and @xref{Option Conflict Attributes}.
+
+@item
+There are several @ref{automatic options, automatically supported options}.
+They will have short flags if any options have option flags and the flags
+are not suppressed. The associated flag may be altered or suppressed by
+specifying no value or an alternate character for ``@code{xxx-value;}'' in
+the option definition file. ``@code{xxx}'' is the name of the option below:
+
+@table @samp
+@item --help
+@itemx --more-help
+These are always available. @samp{--more-help} will pass the full usage
+text through a pager.
+@item --usage
+@vindex usage-opt
+This is added to the option list if @code{usage-opt} is specified.
+It yields the abbreviated usage to @file{stdout}.
+@item --version
+This is added to the option list if @code{version = xxx;} is specified.
+@item --load-opts
+@itemx --save-opts
+These are added to the option list if @code{homerc} is specified. Mostly.
+If, @code{disable-save} is specified, then @samp{--save-opts} is disabled.
+@end table
+
+@item
+Various forms of main procedures can be added to the output,
+@xref{Generated main}. There are four basic forms:
+
+@enumerate a
+@item
+A program that processes the arguments and writes to standard out
+portable shell commands containing the digested options.
+
+@item
+A program that will generate portable shell commands to parse the defined
+options. The expectation is that this result will be copied into a
+shell script and used there.
+
+@item
+A ``for-each'' main that will invoke a named function once for either
+each non-option argument on the command line or, if there are none,
+then once for each non-blank, non-comment input line read from stdin.
+
+@item
+A main procedure of your own design. Its code can be supplied in the
+option description template or by incorporating another template.
+@end enumerate
+
+@item
+There are several methods for handling option arguments.
+@itemize @bullet
+@item
+nothing (@pxref{OPT_ARG}) option argument strings are globally available.
+@item
+user supplied (@pxref{Option Argument Handling})
+@item
+stack option arguments (@pxref{Option Argument Handling})
+@item
+integer numbers (@pxref{arg-type number})
+@item
+true or false valued (@pxref{arg-type boolean})
+@item
+enumerated list of names (@pxref{arg-type keyword})
+@item
+an enumeration (membership) set (@pxref{arg-type set membership})
+@item
+a list of name/value pairs (option ``subopts'') (@pxref{arg-type hierarchy})
+@item
+a time duration or a specific time and date
+@item
+validated file name (@pxref{arg-type file name})
+@item
+optional option argument (@pxref{arg-optional})
+@end itemize
+
+@item
+The generated usage text can be emitted in either AutoOpts standard
+format (maximizing the information about each option), or GNU-ish
+normal form. The default form is selected by either specifying or not
+specifying the @code{gnu-usage} attribute (@pxref{information attributes}).
+This can be overridden by the user himself with the
+@code{AUTOOPTS_USAGE} environment variable. If it exists and is set
+to the string @code{gnu}, it will force GNU-ish style format; if it is
+set to the string @code{autoopts}, it will force AutoOpts standard
+format; otherwise, it will have no effect.
+
+@item
+The usage text and many other strings are stored in a single character array
+(@pxref{SCM string-table-new,string table functions}). This reduces fixup
+costs when loading the program or library. The downside is that if GCC
+detects that any of these strings are used in a printf format, you may get
+the warning, @code{embedded '\0' in format}. To eliminate the warning, you
+must provide GCC with the @code{-Wno-format-contains-nul} option.
+
+@item
+If you compile with @code{ENABLE_NLS} defined and @code{_()} defined to
+a localization function (e.g. @code{gettext(3GNU)}), then the option
+processing code will be localizable (@pxref{i18n}). Provided also that
+you do not define the @code{no-xlate} attribute to @emph{anything}
+(@pxref{presentation attributes}).
+
+@item
+Provides a callable routine to parse
+a text string as if it were from one of the rc/ini/config files,
+hereafter referred to as a configuration file.
+
+@item
+By adding a @samp{doc} and @samp{arg-name} attributes to each option,
+AutoGen will also be able to produce a man page and the @samp{invoking}
+section of a texinfo document.
+
+@item
+Intermingled option processing. AutoOpts options may be intermingled with
+command line operands and options processed with other parsing techniques.
+This is accomplished by setting the @code{allow-errors}
+(@pxref{program attributes}) attribute. When processing reaches a point
+where @code{optionProcess} (@pxref{libopts-optionProcess}) needs to be called
+again, the current option can be set with @code{RESTART_OPT(n)}
+(@pxref{RESTART_OPT}) before calling @code{optionProcess}.
+
+See: @xref{library attributes}.
+
+@item
+Library suppliers can specify command line options that their
+client programs will accept. They specify option definitions
+that get @code{#include}-d into the client option definitions
+and they specify an "anchor" option that has a callback and must be invoked.
+That will give the library access to the option state for their options.
+
+@item
+library options. An AutoOpt-ed library may export its options for use in
+an AutoOpt-ed program. This is done by providing an option definition file
+that client programs @code{#include} into their own option definitions.
+See ``AutoOpt-ed Library for AutoOpt-ed Program'' (@pxref{lib and program})
+for more details.
+@end enumerate
+
+@c === SECTION MARKER
+
+@node Licensing
+@section AutoOpts Licensing
+@cindex Licensing
+
+When AutoGen is installed, the AutoOpts project is installed with it.
+AutoOpts includes various AutoGen templates and a pair of shared
+libraries. These libraries may be used under the terms of version 3
+of the GNU Lesser General Public License (LGPL).
+
+One of these libraries (@code{libopts}) is needed by programs that are built
+using AutoOpts generated code. This library is available as a separate
+``tear-off'' source tarball. It is redistributable for use under either of
+two licenses: The above mentioned GNU Lesser General Public License, and
+the advertising-clause-free BSD license. Both of these license terms are
+incorporated into appropriate COPYING files included with the @code{libopts}
+source tarball. This source may be incorporated into your package with
+the following simple commands:
+
+@example
+rm -rf libopts libopts-*
+gunzip -c `autoopts-config libsrc` | \
+ tar -xvf -
+mv libopts-*.*.* libopts
+@end example
+
+View the @file{libopts/README} file for further integration information.
+
+@c === SECTION MARKER
+
+@page
+@node Caveats
+@section Developer and User Notes
+
+AutoOpts has its conventional way of displaying option information
+that includes somewhat more information that the standard GNU method.
+AutoOpts will also print out a line of usage text for each option type
+when options are misspecified. GNU programs typically do not do this.
+These defaults can be changed on a per-program basis by adding either
+or both of the following in the option definition file:
+
+@example
+gnu-usage;
+no-misuse-usage;
+@end example
+
+Users may also override these settings with the @code{AUTOOPTS_USAGE}
+environment variable. It may be set to a comma or white space separated
+list of the following strings:
+
+@table @samp
+@item gnu
+@cindex gnu
+The format of the extended usage text will be displayed in GNU-normal form.
+The default display for @code{--version} will be to include a note
+on licensing terms.
+
+@item autoopts
+@cindex autoopts
+The format of the extended usage will be in AutoOpts' native layout.
+
+@item no-misuse-usage
+@cindex no-misuse-usage
+When an option error is made on the command line, the abbreviated
+usage text will be suppressed.
+
+@item misuse-usage
+@cindex misuse-usage
+When an option error is made on the command line, the abbreviated
+usage text will be shown.
+@end table
+
+@noindent
+The setting used is the last one seen. The @code{autoopts} and
+@code{misuse-usage} serve no purpose, unless the definition file
+entries were specified as above.
+
+@b{Note for developers}:
+
+The templates used to implement AutoOpts depend heavily upon
+token pasting. That mens that if you name an option, ``debug'', for
+example, the generated header will expect to be able to emit
+@code{#define} macros such as this:
+@example
+#define DESC(n) (autogenOptions.pOptDesc[INDEX_OPT_## n])
+@end example
+and expect @code{DESC(DEBUG)} to expand correctly into
+@code{(autogenOptions.pOptDesc[INDEX_OPT_DEBUG])}.
+If @code{DEBUG} is @code{#defined} to something else, then
+that something else will be in the above expansion.
+
+If you discover you are having strange problems like this,
+you may wish to use some variation of the @code{guard-option-names}
+@xref{program attributes}.
+
+
+@c === SECTION MARKER
+
+@page
+@node Quick Start
+@section Quick Start
+@cindex example, simple AutoOpts
+
+Since it is generally easier to start with a simple example than it is
+to look at the options that AutoGen uses itself, here is a very simple
+AutoOpts example. You can copy this example out of the Info file and
+into a source file to try it. You can then embellish it into what you
+really need. For more extensive examples, you can also examine the help
+output and option definitions for the commands @code{columns},
+@code{getdefs} and @code{autogen} itself.
+
+For our simple example, assume you have a program named @code{check}
+that takes two options:
+
+@enumerate
+@item
+A list of directories to check over for whatever it is @code{check} does.
+You want this option available as a POSIX-style flag option
+and a GNU long option. You want to allow as many of these
+as the user wishes.
+@item
+An option to show or not show the definition tree being used.
+Only one occurrence is to be allowed, specifying one or the other.
+@end enumerate
+
+@ignore
+END == AUTOOPTS == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+@noindent
+First, specify your program attributes and its options to AutoOpts,
+as with the following example.
+
+@example
+AutoGen Definitions options;
+prog-name = check;
+prog-title = "Checkout Automated Options";
+long-opts;
+gnu-usage; /* GNU style preferred to default */
+
+main = @{ main-type = shell-process; @};
+
+flag = @{
+ name = check-dirs;
+ value = L; /* flag style option character */
+ arg-type = string; /* option argument indication */
+ max = NOLIMIT; /* occurrence limit (none) */
+ stack-arg; /* save opt args in a stack */
+ descrip = "Checkout directory list";
+ doc = 'name of each directory that is to be "checked out".';
+@};
+
+flag = @{
+ name = show_defs;
+ descrip = "Show the definition tree";
+ disable = dont; /* mark as enable/disable type */
+ /* option. Disable as `dont-' */
+ doc = 'disable, if you do not want to see the tree.';
+@};
+@end example
+
+@noindent
+This program will produce a program that digests its options and
+writes the values as shell script code to stdout.
+Run the following short script to produce this program:
+
+@example
+base=check
+BASE=`echo $base | tr a-z- A-Z_`
+cflags="-DTEST_$@{BASE@} `autoopts-config cflags`"
+ldflags="`autoopts-config ldflags`"
+autogen $@{base@}.def
+cc -o $@{base@} -g $@{cflags@} $@{base@}.c $@{ldflags@}
+./$@{base@} --help
+@end example
+
+@noindent
+Running those commands yields:
+
+@example
+check - Checkout Automated Options
+USAGE: check [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
+
+ -L, --check-dirs=str Checkout directory list
+ - may appear multiple times
+ --show-defs Show the definition tree
+ - disabled as --dont-show-defs
+ -?, --help Display extended usage information and exit
+ -!, --more-help Extended usage information passed thru pager
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+Packaged by Bruce (2012-08-11)
+Report check bugs to bkorb@@gnu.org
+@end example
+@ignore
+START == AUTOOPTS-MAIN == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@noindent
+Normally, however, you would not use the ``main'' clause. Instead,
+the file would be named something like @file{checkopt.def}, you would
+compile @file{checkopt.c} the usual way, and link the object with the rest
+of your program.
+
+The options are processed by calling @code{optionProcess}
+(@pxref{libopts-optionProcess}):
+
+@example
+main( int argc, char** argv )
+@{
+ @{
+ int optct = optionProcess( &checkOptions, argc, argv );
+ argc -= optct;
+ argv += optct;
+ @}
+@end example
+
+The options are tested and used as in the following fragment.
+``@code{ENABLED_OPT}'' is used instead of ``@code{HAVE_OPT}'' for the
+@code{show-defs} option because it is an enabled/disabled option type:
+
+@example
+ if ( ENABLED_OPT( SHOW_DEFS )
+ && HAVE_OPT( CHECK_DIRS )) @{
+ int dirct = STACKCT_OPT( CHECK_DIRS );
+ char** dirs = STACKLST_OPT( CHECK_DIRS );
+ while (dirct-- > 0) @{
+ char* dir = *dirs++;
+ ...
+@end example
+
+The ``doc'' clauses are used in the flag stanzas for man pages and
+texinfo invoking documentation. With the above definition file, the
+two following commands will produce the two documentation files
+@file{check.1} and @file{invoke-check.texi}. The latter file will
+be generated as a chapter, rather than a section or subsection.
+
+@example
+autogen -Tagman-cmd check.def
+autogen -DLEVEL=chapter -Tagtexi-cmd -binvoke-check.texi check.def
+@end example
+
+@noindent
+The result of which is left as an exercise for the reader.
+
+A lot of magic happens to make this happen.
+The rest of this chapter will describe the myriad of option attributes
+supported by AutoOpts. However, keep in mind that, in general, you won't
+need much more than what was described in this "quick start" section.
+
+@node Option Definitions
+@section Option Definitions
+@cindex Option Definitions
+
+AutoOpts uses an AutoGen definitions file for the definitions of the
+program options and overall configuration attributes.
+The complete list of program and option attributes is quite extensive,
+so if you are reading to understand how to use AutoOpts, I recommend
+reading the "Quick Start" section (@pxref{Quick Start}) and paying
+attention to the following:
+
+@enumerate
+@item
+@code{prog-name}, @code{prog-title}, and @code{argument}, program
+attributes, @xref{program attributes}.
+@item
+@code{name} and @code{descrip} option attributes, @xref{Required Attributes}.
+@item
+@code{value} (flag character) and @code{min} (occurrence counts)
+option attributes, @xref{Common Attributes}.
+@item
+@code{arg-type} from the option argument specification section,
+@xref{Option Arguments}.
+@item
+Read the overall how to, @xref{Using AutoOpts}.
+@item
+Highly recommended, but not required, are the several "man" and
+"info" documentation attributes, @xref{documentation attributes}.
+@end enumerate
+
+Keep in mind that the majority are rarely used and can be safely
+ignored. However, when you have special option processing requirements,
+the flexibility is there.
+
+@menu
+* program attributes:: Program Description Attributes
+* library attributes:: Options for Library Code
+* information attributes:: Program Information Attributes
+* Generated main:: Generating main procedures
+* option attributes:: Option Attributes
+* Option Arguments:: Option Argument Specification
+* Option Argument Handling:: Option Argument Handling
+* Internationalizing Options:: Internationalizing Options
+* documentation attributes:: Man and Info doc Attributes
+* automatic options:: Automatically Supported Options
+* standard options:: Library of Standard Options
+@end menu
+
+@node program attributes
+@subsection Program Description Attributes
+@cindex program attributes
+
+The following global definitions are used to define attributes of the entire
+program. These generally alter the configuration or global behavior of the
+AutoOpts option parser. The first two are required of every program. The
+third is required if there are to be any left over arguments (operands)
+after option processing. The rest have been grouped below. Except as noted,
+there may be only one copy of each of these definitions:
+
+@table @samp
+
+@item prog-name
+@vindex prog-name
+This attribute is required. Variable names derived from this name
+are derived using @code{string->c_name!} (@pxref{SCM string->c-name!}).
+
+@item prog-title
+@vindex prog-title
+This attribute is required and may be any descriptive text.
+
+@item argument
+@vindex argument
+This attribute is required if your program uses operand arguments.
+It specifies the syntax of the arguments that @strong{follow} the options.
+It may not be empty, but if it is not supplied, then option processing
+must consume all the arguments. If it is supplied and starts with an
+open bracket (@code{[}), then there is no requirement on the presence or
+absence of command line arguments following the options. Lastly, if it
+is supplied and does not start with an open bracket, then option
+processing must @strong{not} consume all of the command line arguments.
+
+@item config-header
+@vindex config-header
+If your build has a configuration header, it must be included before
+anything else. Specifying the configuration header file name with this
+attribute will cause that to happen.
+@end table
+
+@menu
+* usage attributes:: Usage and Version Info Display
+* config attributes:: Program Configuration
+* programming attributes:: Programming Details
+* presentation attributes:: User Presentation Attributes
+@end menu
+
+@c
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+@c
+@node usage attributes
+@subsubsection Usage and Version Info Display
+
+These will affect the way usage is seen and whether or not version
+information gets displayed.
+
+@table @samp
+@item full-usage
+@vindex full-usage
+If this attribute is provided, it may specify the full length
+usage text, or a variable name assignable to a ``char const *'' pointer,
+or it may be empty. The meanings are determined by the length.
+@itemize @bullet
+@item
+If not provided, the text will be computed as normal.
+@item
+If the length is zero, then the usage text will be derived from
+the current settings and inserted as text into the generated .c file.
+@item
+If the length is 1 to 32 bytes, then it is presumed to be a variable
+name that either points to or is an array of const chars.
+@item
+If it is longer than that, it is presumed to be the help text itself.
+This text will be inserted into the generated .c file.
+@end itemize
+
+This string should be readily translatable. Provision will be made
+to translate it if this is provided, if the source code is compiled with
+@code{ENABLE_NLS} defined, and @code{no-xlate} has not been set to the
+value @emph{anything}.
+
+@item short-usage
+@vindex short-usage
+If this attribute is provided, it is used to specify an abbreviated
+version of the usage text. This text is constructed in the same way
+as the ``full-usage'', described above.
+
+@item gnu-usage
+@vindex gnu-usage
+AutoOpts normaly displays usage text in a format that provides more
+information than the standard GNU layout, but that also means it is
+not the standard GNU layout. This attribute changes the default to
+GNU layout, with the @code{AUTOOPTS_USAGE} environment variable used
+to request @code{autoopts} layout.
+See @xref{Caveats, Developer and User Notes}.
+
+@item usage-opt
+@vindex usage-opt
+I apologize for too many confusing usages of usage.
+This attribute specifies that @code{--usage} and/or @code{-u} be
+supported. The help (usage) text displayed will be abbreviated
+when compared to the default help text.
+
+@item no-misuse-usage
+@vindex no-misuse-usage
+When there is a command line syntax error, by default AutoOpts will
+display the abbreviated usage text, rather than just a one line
+``you goofed it, ask for usage'' message. You can change the default
+behavior for your program by supplying this attribute. The user may
+override this choice, again, with the @code{AUTOOPTS_USAGE} environment
+variable. See @xref{Caveats, Developer and User Notes}.
+
+@item prog-group
+@vindex prog-group
+The version text in the @file{getopt.tpl} template will include this
+text in parentheses after the program name, when this attribute is specified.
+For example:
+@example
+mumble (stumble) 1.0
+@end example
+@noindent
+says that the ``@code{mumble}'' program is version 1.0 and is part of the
+``@code{stumble}'' group of programs.
+
+@item usage
+@vindex usage
+If your program has some cleanup work that must be done before exiting
+on usage mode issues, or if you have to customize the usage message in
+some way, specify this procedure and it will be called instead of the
+default @code{optionUsage()} function. For example, if a program is
+using the curses library and needs to invoke the usage display, then
+you must arrange to call @code{endwin()} before invoking the library
+function @code{optionUsage()}. This can be handled by specifying your
+own usage function, thus:
+@example
+void
+my_usage(tOptions * opts, int ex)
+@{
+ if (curses_window_active)
+ endwin();
+ optionUsage(opts, ex);
+@}
+@end example
+
+@item version
+@vindex version
+Specifies the program version and activates the VERSION option,
+@xref{automatic options}.
+@end table
+
+@c
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+@c
+@node config attributes
+@subsubsection Program Configuration
+
+Programs may be ``pre-configured'' before normal command line options
+are processed (See @pxref{Immediate Action, Immediate Action Attributes}).
+How configuration files and environment variables are handled get
+specified with these attributes.
+
+@table @samp
+@item disable-load
+@itemx disable-save
+@vindex disable-load
+@vindex disable-save
+Indicates that the command line usage of @code{--load-opts} and/or
+@code{--save-opts} are disallowed.
+
+@item environrc
+@vindex environrc
+Indicates looking in the environment for values of variables named,
+@code{PROGRAM_OPTNAME} or @code{PROGRAM}, where @code{PROGRAM} is the
+upper cased @code{C-name} of the program and @code{OPTNAME} is the
+upper cased @code{C-name} of a specific option. The contents of
+the @code{PROGRAM} variable, if found, are tokenized and processed.
+The contents of @code{PROGRAM_OPTNAME} environment variables are taken
+as the option argument to the option nameed @code{optname}.
+
+@item homerc
+@vindex homerc
+Specifies that option settings may be loaded from and stored into
+configuration files. Each instance of this attribute is either a directory or
+a file using a specific path, a path based on an environment variable or a
+path relative to installation directories. The method used depends on the name.
+If the one entry is empty, it enables the loading and storing of settings,
+but no specific files are searched for. Otherwise, a series of configuration
+files are hunted down and, if found, loaded.
+
+If the first character of the @samp{homerc} value is not the dollar
+character (@code{$}), then it is presumed to be a path name based on the
+current directory. Otherwise, the method depends on the second character:
+
+@table @code
+@item $
+The path is relative to the directory where the executable was found.
+@item @@
+The path is relative to the package data directory, e.g.
+@code{/usr/local/share/autogen}.
+@item [a-zA-Z]
+The path is derived from the named environment variable.
+@end table
+
+Use as many as you like. The presence of this attribute
+activates the @code{--save-opts} and @code{--load-opts} options.
+However, saving into a file may be disabled with the @samp{disable-save}.
+@xref{loading rcfile}.
+See the @code{optionMakePath(3AGEN)} man page for excruciating details.
+
+@item rcfile
+@vindex rcfile
+Specifies the configuration file name. This is only useful if you
+have provided at least one @code{homerc} attribute.
+@example
+default: .<prog-name>rc
+@end example
+
+@item vendor-opt
+@vindex vendor-opt
+This option implements the @code{-W} vendor option command line option.
+
+For POSIX specified utilities, the options are constrained to the options
+that are specified by POSIX. Extensions should be handled with @code{-W}
+command line options, the short flag form. Long option name processing
+must be disabled. In fact, the @code{long-opts} attribute must not be
+provided, and some options must be specified without flag values.
+
+The @code{-W long-name} is processed by looking up the long option
+name that follows it. It cannot be a short flag because that would
+conflict with the POSIX flag name space. It will be processed as if
+long options were accepted and @code{--long-name} were found on the
+command line.
+@end table
+
+@c
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+@c
+@node programming attributes
+@subsubsection Programming Details
+
+These attributes affect some of the ways that the option data are
+used and made available to the program.
+
+@table @samp
+@item config-header
+@vindex config-header
+The contents of this attribute should be just the name of the configuration
+file. A "#include" naming this file will be inserted at the top of the
+generated header.
+
+@item exit-name
+@itemx exit-desc
+@vindex exit-name
+@vindex exit-desc
+These values should be defined as indexed values, thus:
+@example
+exit-name[0] = success;
+exit-desc[0] = 'Successful program execution.';
+exit-name[1] = failure;
+exit-desc[1] = 'The operation failed or command syntax was not valid.';
+@end example
+By default, all programs have these effectively defined for them.
+They may be overridden by explicitly defining any or all of these values.
+Additional names and descriptions may be defined.
+They will cause an enumeration to be emitted, like this one
+for @code{getdefs}:
+@example
+typedef enum @{
+ GETDEFS_EXIT_SUCCESS = 0,
+ GETDEFS_EXIT_FAILURE = 1
+@} getdefs_exit_code_t;
+@end example
+@noindent
+which will be augmented by any @code{exit-name} definitions beyond ``1''.
+
+@item usage-message
+@vindex usage-message
+This attribute will cause two procedures to be added to the code file:
+@code{usage_message} and @code{vusage_message}, with any applicable prefix
+(see @code{prefix}, below). They are declared in the
+generated header, thus:
+@example
+extern void vusage_message(char const * fmt, va_list ap);
+extern void usage_message(char const * fmt, ...);
+@end example
+@noindent
+These functions print the message to @file{stderr} and invoke the usage
+function with the exit code set to @code{1} (@code{EXIT_FAILURE}).
+
+@item die-code
+@vindex die-code
+This tells AutoOpts templates to emit code for @code{vdie}, @code{die} and
+@code{fserr} functions. If the @code{die-code} is assigned a text value,
+then that code will be inserted in the @code{vdie} function immediately
+before it prints the death rattle message.
+
+The profiles for these functions are:
+@example
+extern void vdie( int exit_code, char const * fmt, va_list);
+extern void die( int exit_code, char const * fmt, ...);
+extern void fserr(int exit_code, char const * op, char const * fname);
+@end example
+
+@item export
+@vindex export
+This string is inserted into the .h interface file. Generally used for
+global variables or @code{#include} directives required by
+@code{flag-code} text and shared with other program text.
+Do not specify your configuration header (@file{config.h}) in this
+attribute or the @code{include} attribute, however. Instead, use
+@code{config-header}, above.
+
+@item guard-option-names
+@vindex guard-option-names
+AutoOpts generates macros that presume that there are no @code{cpp} macros
+with the same name as the option name. For example, if you have an option
+named, @code{debug}, then you must not use @code{#ifdef DEBUG} in your code.
+If you specify this attribute, every option name will be guarded. If the name
+is @code{#define}-d, then a warning will be issued and the name undefined.
+If you do not specify this and there is a conflict, you will get strange
+error messages.
+
+This attribute may be set to any of four recognized states:
+
+@itemize @bullet
+@item
+Not defined. AutoOpts will behave as described above.
+
+@item
+Defined, but set to the empty string. Text will be emitted into the header
+to undefine (@code{#undef}) any conflicting preprocessor macros. The code
+will include compiler warnings (via @code{#warning}). Some compilers are
+not ANSI-C-99 compliant yet and will error out on those warnings. You may
+compile with @code{-DNO_OPTION_NAME_WARNINGS} to silence or mostly silence
+them.
+
+@item
+Defined and set to the string, ``@code{no-warning}''. All of the needed
+@code{#undef}s will be emitted, without any conflict checking @code{#warning}
+directives emitted.
+
+@item
+Defined and set to the string, ``@code{full-enum}''. The option manipulation
+preprocessor macros will not token paste the option names to the index
+enumeration prefix. e.g. you will need to use @code{HAVE_OPT(INDEX_OPT_DEBUG)}
+instead of @code{HAVE_OPT(DEBUG)}.
+@end itemize
+
+@item include
+@vindex include
+This string is inserted into the .c file. Generally used for global
+variables required only by @code{flag-code} program text.
+
+@item no-libopts
+@vindex no-libopts
+If you are going to handle your option processing with the @code{getopt.tpl}
+template instead of using libopts, then specify this attribute. It will
+suppress mention of @code{--more-help} in the generated documentation.
+(@code{getopt_long} does not support @code{--more-help}.)
+
+@item prefix
+@vindex prefix
+This value is inserted into @strong{all} global names. This will
+disambiguate them if more than one set of options are to be compiled
+into a single program.
+@end table
+
+@c
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+@c
+@node presentation attributes
+@subsubsection User Presentation Attributes
+
+Attributes that affect the user's experience.
+
+@table @samp
+@item allow-errors
+@vindex allow-errors
+The presence of this attribute indicates ignoring any command line
+option errors. This may also be turned on and off by invoking the
+macros @code{ERRSKIP_OPTERR} and @code{ERRSTOP_OPTERR} from the
+generated interface file.
+
+@item long-opts
+@vindex long-opts
+@cindex named option mode
+Presence indicates GNU-standard long option processing. Partial name
+matches are accepted, if they are at least two characters long and the
+partial match is unique. The matching is not case sensitive, and the
+underscore, hyphen and carat characters are all equivalent (they match).
+
+If any options do not have an option value (flag character) specified,
+and least one does specify such a value, then you must specify
+@code{long-opts}. If none of your options specify an option value
+(flag character) and you do not specify @code{long-opts}, then command
+line arguments are processed in "named option mode". This means that:
+
+@itemize @bullet
+@item
+Every command line argument must be a long option.
+@item
+The flag markers @code{-} and @code{--} are completely optional.
+@item
+The @code{argument} program attribute is disallowed.
+@item
+One of the options may be specified as the default
+(as long as it has a required option argument).
+@end itemize
+
+@item no-xlate
+@vindex no-xlate
+Modifies when or whether option names get translated. If provided,
+it must be assigned one of these values:
+@table @samp
+@item opt-cfg
+to suppress option name translation for configuration file and and environment
+variable processing.
+@item opt
+to suppress option name translation completely. The usage text will
+always be translated if @code{ENABLE_NLS} is defined and you have
+translations for that text.
+@item anything
+Specifies disabling all internationalization support for option code, completely.
+@end table
+See also the various @code{XLAT} interface entries in the
+AutoOpts Programmatic Interface section (@pxref{AutoOpts API}).
+
+@item reorder-args
+@vindex reorder-args
+Normally, POSIX compliant commands do not allow for options to be interleaved
+with operands. If this is necessary for historical reasons, there are two
+approaches available:
+@itemize @bullet
+@item
+Allow @code{optionProcess} to return the index of the operand like it normally
+does and process the operand(s). When an operand is encountered that starts
+with a hyphen, then set the AutoOpts current index with the @code{RESTART_OPT}
+macro (see @pxref{RESTART_OPT}), and re-invoke @code{optionProcess}. This will
+also allow you to process the operands in context.
+
+@item
+Specify this attribute. AutoOpts will re-order the command arguments
+so that the operands appear (in the original order) at the end of
+the argument list. Differing configuration state is not possible
+to detect after all options have been processed.
+@end itemize
+
+@item resettable
+@vindex resettable
+Specifies that the @code{--reset-option} command line option is to be supported.
+This makes it possible to suppress any setting that might be found in
+a configuration file or environment variable.
+@end table
+
+@node library attributes
+@subsection Options for Library Code
+@cindex library attributes
+
+Some libraries provide their own code for processing command line
+options, and this may be used by programs that utilize AutoOpts.
+You may also wish to write a library that gets configured with AutoOpts
+options and config files. Such a library may either supply its own
+configury routine and process its own options, or it may export its
+option descriptions to programs that also use AutoOpts. This section
+will describe how to do all of these different things.
+
+@menu
+* lib and program:: AutoOpt-ed Library for AutoOpt-ed Program
+* lib called:: AutoOpt-ed Library for Regular Program
+* prog calls lib:: AutoOpt-ed Program Calls Regular Library
+@end menu
+
+@node lib and program
+@subsubsection AutoOpt-ed Library for AutoOpt-ed Program
+
+The library source code must provide an option definition file that consists
+of only the attribute @code{library}
+@vindex library
+and @code{flag} entries. The ``library'' attribute does not need any
+associated value, so it will generally appeary by itself on a line folowed
+by a semi-colon. The first @code{flag} entry must contain the following
+attributes:
+
+@table @samp
+@item name
+This name is used in the construction of a global pointer of type
+@code{tOptDesc const*}. It is always required.
+@item documentation
+@vindex documentation
+It tells @code{AutoOpts} that this option serves no normal purpose.
+It will be used to add usage clarity and to locate option descriptors
+in the library code.
+@item descrip
+This is a string that is inserted in the extended usage display
+before the options specific to the current library. It is always required.
+@item lib-name
+@vindex lib-name
+This should match the name of the library. This string is also used in
+the construction of the option descriptor pointer name. In the end, it
+looks like this:
+@example
+extern tOptDesc const* <<lib-name>>_<<name>>_optDesc_p;
+@end example
+@noindent
+and is used in the macros generated for the library's @code{.h} file.
+@end table
+
+In order to compile this @code{AutoOpts} using library, you must create a
+special header that is not used by the client program. This is accomplished
+by creating an option definition file that contains essentially exactly the
+following:
+
+@example
+AutoGen definitions options;
+prog-name = does-not-matter; // but is always required
+prog-title = 'also does not matter'; // also required
+config-header = 'config.h'; // optional, but common
+library;
+#include library-options-only.def
+@end example
+
+@noindent
+and nothing else. AutoGen will produce only the @code{.h} file.
+You may now compile your library, referencing just this @code{.h} file.
+The macros it creates will utilize a global variable that will be defined
+by the @code{AutoOpts}-using client program. That program will need to
+have the following @code{#include} in @i{its} option definition file:
+
+@example
+#include library-options-only.def
+@end example
+
+@noindent
+All the right things will magically happen so that the global variables
+named @code{<<lib-name>>_<<name>>_optDesc_p} are initialized correctly.
+For an example, please see the @code{AutoOpts} test script:
+@file{autoopts/test/library.test}.
+
+@node lib called
+@subsubsection AutoOpt-ed Library for Regular Program
+
+In this case, your library must provide an option processing function
+to a calling program. This is accomplished by setting the @code{allow-errors}
+global option attribute. Each time your option handling function is called,
+you must determine where your scan is to resume and tell the AutoOpts library
+by invoking:
+
+@example
+RESTART_OPT(next_arg_index);
+@end example
+
+@noindent
+and then invoke @code{not_opt_index = optionProcess(...)}.
+The @code{not_opt_index} value can be used to set @code{optind},
+if that is the global being used to scan the program argument array.
+
+In this method, do @strong{NOT} utilize the global @code{library} attribute.
+Your library must specify its options as if it were a complete program.
+You may choose to specify an alternate @code{usage()} function so that
+usage for other parts of the option interface may be displayed as well.
+See ``Program Information Attributes'' (@pxref{information attributes}).
+
+At the moment, there is no method for calling @code{optionUsage()} telling
+it to produce just the information about the options and not the program
+as a whole. Some later revision after somebody asks.
+
+@node prog calls lib
+@subsubsection AutoOpt-ed Program Calls Regular Library
+
+As with providing an @code{AutoOpt}-ed library to a non-@code{AutoOpt}-ed
+program, you must write the option description file as if you were writing
+all the options for the program, but you should specify the
+@code{allow-errors} global option attribute and you will likely want an
+alternate @code{usage()} function (see ``Program Information Attributes''
+@pxref{information attributes}). In this case, though, when
+@code{optionProcess()} returns, you need to test to see if there might be
+library options. If there might be, then call the library's exported
+routine for handling command line options, set the next-option-to-process
+with the @code{RESTART_OPT()} macro, and recall @code{optionProcess()}.
+Repeat until done.
+
+@node information attributes
+@subsection Program Information Attributes
+@cindex information attributes
+
+These attributes are used to define how and what information is displayed
+to the user of the program.
+
+@table @samp
+@item copyright
+@vindex copyright
+The @code{copyright} is a structured value containing three to five
+values. If @code{copyright} is used, then the first three are required.
+
+@enumerate
+@item
+@vindex date
+@file{date} - the list of applicable dates for the copyright.
+@item
+@vindex owner
+@file{owner} - the name of the copyright holder.
+@item
+@vindex type
+@file{type} - specifies the type of distribution license.
+AutoOpts/AutoGen supports the text of the GNU Public License (@file{gpl}),
+the GNU ``Lesser'' General Public License with Library extensions
+(@file{lgpl}), the Modified Free BSD license (@file{mbsd}) and a few others.
+Other licenses may be specified, but you must provide your own license file.
+The list of license files provided by AutoOpts may be seen by typing:
+@example
+ls $(autoopts-config pkgdatadir)/*.lic
+@end example
+@item
+@vindex text
+@file{text} - the text of the copyright notice. This must be provided
+if @file{type} is set to @file{NOTE}.
+@item
+@vindex author
+@file{author} - in case the author name is to appear in the documentation
+and is different from the copyright owner.
+@item
+@vindex eaddr
+@file{eaddr} - email address for receiving praises and complaints.
+Typically that of the author or copyright holder.
+@end enumerate
+@*
+An example of this might be:
+@example
+copyright = @{
+ date = "1992-2012";
+ owner = "Bruce Korb";
+ eaddr = 'bkorb@@gnu.org';
+ type = GPL;
+@};
+@end example
+
+@item detail
+@vindex detail
+This string is added to the usage output when the HELP option is
+selected.
+
+@item explain
+@vindex explain
+Gives additional information whenever the usage routine is invoked.
+
+@item package
+@vindex package
+The name of the package the program belongs to. This will appear
+parenthetically after the program name in the version and usage output,
+e.g.: @code{autogen @i{(GNU autogen)} - The Automated Program Generator}.
+
+@item preserve-case
+@vindex preserve-case
+This attribute will not change anything except appearance. Normally, the
+option names are all documented in lower case. However, if you specify this
+attribute, then they will display in the case used in their specification.
+Command line options will still be matched without case sensitivity.
+This is useful for specifying option names in camel-case.
+
+@item prog-desc @strong{and}
+@itemx opts-ptr
+@vindex prog-desc
+@vindex opts-ptr
+These define global pointer variables that point to the program
+descriptor and the first option descriptor for a library option. This
+is intended for use by certain libraries that need command line and/or
+initialization file option processing. These definitions have no effect
+on the option template output, but are used for creating a library
+interface file. Normally, the first "option" for a library will be a
+documentation option that cannot be specified on the command line, but
+is marked as @code{settable}. The library client program will invoke the
+@code{SET_OPTION} macro which will invoke a handler function that will
+finally set these global variables.
+
+@item usage
+@vindex usage
+Optionally names the usage procedure, if the library routine
+@code{optionUsage()} does not work for you. If you specify
+@code{my_usage} as the value of this attribute, for example, you will
+use a procedure by that name for displaying usage. Of course, you will
+need to provide that procedure and it must conform to this profile:
+@example
+void @i{my_usage}( tOptions* pOptions, int exitCode )
+@end example
+
+@item gnu-usage
+@vindex gnu-usage
+Normally, the default format produced by the @code{optionUsage} procedure
+is @i{AutoOpts Standard}. By specifying this attribute, the default format
+will be @i{GNU-ish style}. Either default may be overridden by the user with
+the @code{AUTOOPTS_USAGE} environment variable. If it is set to @code{gnu}
+or @code{autoopts}, it will alter the style appropriately. This attribute
+will conflict with the @code{usage} attribute.
+
+@item reorder-args
+@vindex reorder-args
+Some applications traditionally require that the command operands be
+intermixed with the command options. In order to handle that, the arguments
+must be reordered. If you are writing such an application, specify this
+global option. All of the options (and any associated option arguments)
+will be brought to the beginning of the argument list. New applications
+should not use this feature, if at all possible. This feature is
+@i{disabled} if @code{POSIXLY_CORRECT} is defined in the environment.
+@end table
+
+@node Generated main
+@subsection Generating main procedures
+@cindex main procedure
+
+When AutoOpts generates the code to parse the command line options, it has
+the ability to produce any of several types of @code{main()} procedures.
+This is done by specifying a global structured value for
+@vindex main
+@code{main}. The values that it contains are dependent on the value set for
+the one value it must have: @code{main-type}.
+
+@vindex main-type
+The recognized values for @code{main-type} are:
+@menu
+* main guile:: guile: main and inner_main procedures
+* main shell-process:: shell-process: emit Bourne shell results
+* main shell-parser:: shell-parser: emit Bourne shell script
+* main main:: main: user supplied main procedure
+* main include:: include: code emitted from included template
+* main invoke:: invoke: code emitted from AutoGen macro
+* main for-each:: for-each: perform function on each argument
+@end menu
+
+Here is an example of an @code{include} variation:
+
+@example
+main = @{
+ main-type = include;
+ tpl = "main-template.tpl";
+@};
+@end example
+
+@node main guile
+@subsubsection guile: main and inner_main procedures
+
+When the @code{main-type} is specified to be @code{guile},
+a @code{main()} procedure is generated that calls @code{gh_enter()}, providing
+it with a generated @code{inner_main()} to invoke. If you must perform
+certain tasks before calling @code{gh_enter()}, you may specify such code
+in the value for the
+@vindex before-guile-boot
+@code{before-guile-boot} attribute.
+
+The @code{inner_main()} procedure itself will process the command line
+arguments (by calling @code{optionProcess()},
+@pxref{libopts-optionProcess}), and then either invoke the code
+specified with the
+@vindex guile-main
+@code{guile-main} attribute, or else export the parsed options to Guile
+symbols and invoke the @code{scm_shell()} function from the Guile library.
+This latter will render the program nearly identical to the stock
+@code{guile(1)} program.
+
+@node main shell-process
+@subsubsection shell-process: emit Bourne shell results
+
+This will produce a @code{main()} procedure that parses the command line
+options and emits to @file{stdout} Bourne shell commands that puts the
+option state into environment variables. This can be used within a
+shell script as follows:
+
+@example
+unset OPTION_CT
+eval "`opt_parser \"$@@\"`"
+test -z "$@{OPTION_CT@}" && exit 1
+test $@{OPTION_CT@} -gt 0 && shift $@{OPTION_CT@}
+@end example
+
+If the option parsing code detects an error or a request for usage,
+it will not emit an assignment to OPTION_CT and the script should just
+exit. If the options are set consistently, then something along the
+lines of the following will be written to @file{stdout} and evaled:
+
+@example
+ OPTION_CT=4
+ export OPTION_CT
+ MYPROG_SECOND='first'
+ export MYPROG_SECOND
+ MYPROG_ANOTHER=1 # 0x1
+ export MYPROG_ANOTHER
+@end example
+
+@noindent
+If the arguments are to be reordered, however, then the resulting set
+of operands will be emitted and @code{OPTION_CT} gets set to zero.
+For example, the following would be appended to the above:
+
+@example
+ set -- 'operand1' 'operand2' 'operand3'
+ OPTION_CT=0
+@end example
+
+@noindent
+@code{OPTION_CT} is set to zero since it is not necessary to shift
+off any options.
+
+@node main shell-parser
+@subsubsection shell-parser: emit Bourne shell script
+
+This will produce a @code{main()} procedure that emits a shell script
+that will parse the command line options. That script can be emitted
+to @file{stdout} or inserted or substituted into a pre-existing shell
+script file. Improbable markers are used to identify previously inserted
+parsing text:
+
+@example
+# # # # # # # # # # -- do not modify this marker --
+@end example
+
+@noindent
+The program is also pretty insistent upon starting its parsing script
+on the second line.
+
+@node main main
+@subsubsection main: user supplied main procedure
+
+You must supply a value for the @code{main-text} attribute.
+You may also supply a value for
+@vindex option-code
+@code{option-code}. If you do, then the @code{optionProcess} invocation
+will not be emitted into the code. AutoOpts will wrap the @code{main-text}
+inside of:
+
+@example
+int
+main( int argc, char** argv )
+@{
+ @{ // replaced by option-code, if that exists
+ int ct = optionProcess( &<<prog-name>>Options, argc, argv );
+ argc -= ct;
+ argv += ct;
+ @}
+<<your main-text goes here>>
+@}
+@end example
+
+@noindent
+so you can most conveniently set the value with a ``@code{here string}''
+(@pxref{here-string}):
+
+@example
+code = <<- _EndOfMainProc_
+ <<your text goes here>>
+ _EndOfMainProc_;
+@end example
+
+@node main include
+@subsubsection include: code emitted from included template
+
+You must write a template to produce your main procedure.
+You specify the name of the template with the @code{tpl} attribute
+and it will be incorporated at the point where AutoOpts is ready
+to emit the @code{main()} procedure.
+
+This can be very useful if, in your working environment, you have
+many programs with highly similar @code{main()} procedures. All you need
+to do is parameterize the variations and specify which variant is needed
+within the @code{main} AutoOpts specification. Since you are coding
+the template for this, the attributes needed for this variation would
+be dictated by your template.
+
+@node main invoke
+@subsubsection invoke: code emitted from AutoGen macro
+
+You must write a template to produce your main procedure. That template
+must contain a definition for the function specified with the @code{func}
+attribute to this @code{main()} procedure specification. Typically, this
+template will be incorporated by using the @code{--lib-template} option
+(@pxref{autogen lib-template}) in the AutoGen invocation. Otherwise, this
+variation operates in much the same way as ``@code{include}''
+(@pxref{main include}) method.
+
+@node main for-each
+@subsubsection for-each: perform function on each argument
+
+This produces a main procedure that invokes a procedure once for each operand
+on the command line (non-option arguments), @strong{OR} once for each
+non-blank, non-comment @code{stdin} input line. Leading and trailing white
+space is trimmed from the input line and comment lines are lines that are
+empty or begin with a comment character, defaulting to a hash ('#') character.
+
+@strong{NB}:
+The @code{argument} program attribute (@pxref{program attributes})
+must begin with the @code{[} character, to indicate that there are
+command operands, but that they are optional.
+
+There are a number of attributes to @code{main} that may be used:
+
+@table @code
+@item handler-proc
+@vindex handler-proc
+This attribute is required. It is used to name the procedure to call.
+That procedure is presumed to be external, but if you provide the code
+for it, then the procedure is emitted as a static procedure in the
+generated code.
+
+This procedure should return 0 on success, a cumulative error code on warning
+and exit without returning on an unrecoverable error. As the cumulative
+warning codes are @i{or}-ed together, the codes should be some sort of bit
+mask in order to be ultimately decipherable (if you need to do that).
+
+If the called procedure needs to cause a fail-exit, it is expected to call
+@code{exit(3)} directly. If you want to cause a warning exit code, then this
+handler function should return a non-zero status. That value will be
+@strong{OR}-ed into a result integer for computing the final exit code. E.g.,
+here is part of the emitted code:
+
+@example
+ int res = 0;
+ if (argc > 0) @{
+ do @{
+ res |= @i{my_handler}( *(argv++) );
+ @} while (--argc > 0);
+ @} else @{ ...
+@end example
+
+@item handler-type
+@vindex handler-type
+If you do not supply this attribute, your handler procedure must be
+the default type. The profile of the procedure must be:
+
+@example
+int @i{my_handler}( char const *pz_entry );
+@end example
+
+@noindent
+However, if you do supply this attribute, you may set the value to any of
+four alternate flavors:
+
+@table @samp
+@item name-of-file
+This is essentially the same as the default handler type, except that before
+your procedure is invoked, the generated code has verified that the string
+names an existing file. The profile is unchanged.
+
+@item file-X
+Before calling your procedure, the file is f-opened according to the ``X'',
+where ``X'' may be any of the legal modes for @code{fopen(3C)}. In this case,
+the profile for your procedure must be:
+
+@example
+int @i{my_handler}( char const* pz_fname, FILE* entry_fp );
+@end example
+
+@item text-of-file
+@itemx some-text-of-file
+Before calling your procedure, the contents of the file are read or mapped into memory.
+(Excessively large files may cause problems.) The @samp{some-text-of-file}
+disallows empty files. Both require regular files. In this case, the profile
+for your procedure must be:
+
+@example
+program_exit_code_t
+@i{my_handler}(char const* pz_fname, char* file_text,
+ size_t text_size);
+@end example
+
+@noindent
+Note that though the @code{file_text} is not @code{const}, any changes made to
+it are not written back to the original file. It is merely a memory image of
+the file contents. Also, the memory allocated to hold the text is
+@code{text_size + 1} bytes long and the final byte is always @code{NUL}.
+The file contents need not be text, as the data are read with the @code{read(2)}
+system call.
+@end table
+
+If you select one of these file type handlers, then on access or usage errors
+the @code{PROGRAM_EXIT_FAILURE} exit code will, by default, be or-ed
+into the final exit code. This can be changed by specifying the
+global @code{file-fail-code} attribute and naming a different value.
+That is, something other than @code{failure}. You may choose @code{success},
+in which case file access issues will not affect the exit code and the error
+message will not be printed.
+
+@item @i{my_handler}-code
+@vindex MYHANDLER-code
+With this attribute, you provide the code for your handler procedure
+in the option definition file. In this case, your @code{main()}
+procedure specification might look something like this:
+
+@example
+main = @{
+ main-type = for-each;
+ handler-proc = @i{my_handler};
+ @i{my_handler}-code = <<- EndOfMyCode
+ /* whatever you want to do */
+ EndOfMyCode;
+@};
+@end example
+
+@noindent
+and instead of an emitted external reference, a procedure will be emitted
+that looks like this:
+
+@example
+static int
+@i{my_handler}( char const* pz_entry )
+@{
+ int res = 0;
+ <<@i{my_handler}-code goes here>>
+ return res;
+@}
+@end example
+
+@item main-init
+@vindex main-init
+This is code that gets inserted after the options have been processed, but
+before the handler procs get invoked.
+
+@item main-fini
+@vindex main-fini
+This is code that gets inserted after all the entries have been processed,
+just before returning from @code{main()}.
+
+@item comment-char
+@vindex comment-char
+If you wish comment lines to start with a character other than a hash
+(@code{#}) character, then specify one character with this attribute.
+If that character is the @code{NUL} byte, then only blank lines will be
+considered comments.
+@end table
+
+@node option attributes
+@subsection Option Attributes
+@cindex option attributes
+
+For each option you wish to specify, you must have a block macro named
+@code{flag} defined. There are two required attributes: @code{name} and
+@code{descrip}. If any options do not have a @code{value} (traditional flag
+character) attribute, then the @code{long-opts} program attribute must also
+be defined. As a special exception, if no options have a @code{value}
+@strong{and} @code{long-opts} is not defined @strong{and} @code{argument} is
+not defined, then all arguments to the program are named options. In this
+case, the @code{-} and @code{--} command line option markers are optional.
+
+@menu
+* Required Attributes:: Required Attributes
+* Common Attributes:: Common Option Attributes
+* Immediate Action:: Immediate Action Attributes
+* Option Conflict Attributes:: Option Conflict Attributes
+
+These option attributes do not fit well with the above categories.
+
+* opt-attr settable:: Program may set option
+* opt-attr no-preset:: Option cannot be pre-configured
+* opt-attr equivalence:: Option Equivalence Class
+* opt-attr aliases:: Option Aliasing
+* opt-attr default option:: Default Option
+* opt-attr documentation:: Option Sectioning Comment
+* opt-attr translators:: Translator Notes
+@end menu
+
+@node Required Attributes
+@subsubsection Required Attributes
+@cindex Required Attributes
+
+Every option must have exactly one copy of both of these attributes.
+
+@table @samp
+@item name
+@vindex name
+Long name for the option. Even if you are not accepting long options
+and are only accepting flags, it must be provided. AutoOpts generates
+private, named storage that requires this name. This name also causes
+a @code{#define}-d name to be emitted. It must not conflict with any
+other names you may be using in your program.
+
+For example, if your option name is, @code{debug} or @code{munged-up},
+you must not use the @code{#define} names @code{DEBUG} (or
+@code{MUNGED_UP}) in your program for non-AutoOpts related purposes.
+They are now used by AutoOpts.
+
+Sometimes (most especially under Windows), you may get a surprise.
+For example, @code{INTERFACE} is apparently a user space name that
+one should be free to use. Windows usurps this name. To solve this,
+you must do one of the following:
+
+@enumerate
+@item
+Change the name of your option
+@item
+add the program attribute (@pxref{program attributes}):
+
+@example
+export = '#undef INTERFACE';
+@end example
+@item
+add the program attribute:
+
+@example
+guard-option-names;
+@end example
+@end enumerate
+
+@item descrip
+@vindex descrip
+Except for documentation options, a @strong{very} brief description of the
+option. About 40 characters on one line, maximum, not counting any texinfo
+markups. Texinfo markups are stripped before printing in the usage text. It
+appears on the @code{usage()} output next to the option name.
+
+If, however, the option is a documentation option, it will appear on one or
+more lines by itself. It is thus used to visually separate and comment upon
+groups of options in the usage text.
+@end table
+
+@node Common Attributes
+@subsubsection Common Option Attributes
+@cindex Common Option Attributes
+
+These option attributes are optional. Any that do appear in the
+definition of a flag, may appear only once.
+
+@table @samp
+@item value
+@vindex value
+The flag character to specify for traditional option flags, e.g., @code{-L}.
+
+@item max
+@vindex max
+Maximum occurrence count (invalid if @var{disable} present).
+The default maximum is 1. @code{NOLIMIT} can be used for the value,
+otherwise it must be a number or a @code{#define} that evaluates to a number.
+
+@item min
+@vindex min
+Minimum occurrence count. If present, then the option @strong{must}
+appear on the command line. Do not define it with the value zero (0).
+
+@item must-set
+@vindex must-set
+If an option must be specified, but it need not be specified on
+the command line, then specify this attribute for the option.
+
+@item deprecated
+@vindex deprecated
+There are two effects to this attribute: the usage text will not
+show the option, and the generated documentation will mark it with:
+``@emph{NOTE: THIS OPTION IS DEPRECATED}''.
+
+@item disable
+@vindex disable
+Prefix for disabling (inverting sense of) the option. Only useful
+if long option names are being processed. When an option has this
+attribute, the test @code{ENABLED_OPT(OPTNAME)} is false when either
+of the following is true:
+@itemize @bullet
+@item
+The option has not been specified and the @code{enable} attribute has
+not been specified.
+@item
+The option has been specified with this disabling prefix.
+@end itemize
+To detect that the option has been specified with the disabling
+prefix, you must use:
+@example
+HAVE_OPT(OPTNAME) && ! ENABLED_OPT(OPTNAME)
+@end example
+
+@item enable
+@vindex enable
+Long-name prefix for enabling the option (invalid if @var{disable}
+@strong{not} present). Only useful if long option names are being
+processed.
+
+@item enabled
+@vindex enabled
+If default is for option being enabled. (Otherwise, the OPTST_DISABLED
+bit is set at compile time.) Only useful if the option can be disabled.
+
+@item ifdef
+@itemx ifndef
+@itemx omitted-usage
+@vindex ifdef
+@vindex ifndef
+@vindex omitted-usage
+If an option is relevant on certain platforms or when certain features
+are enabled or disabled, you can specify the compile time flag used
+to indicate when the option should be compiled in or out. For example,
+if you have a configurable feature, @code{mumble} that is indicated
+with the compile time define, @code{WITH_MUMBLING}, then add:
+
+@example
+ifdef = WITH_MUMBLING;
+@end example
+
+@noindent
+Take care when using these. There are several caveats:
+
+@itemize @bullet
+@item
+The case and spelling must match whatever is specified.
+@item
+Do not confuse these attributes with the AutoGen directives of the
+same names, @xref{Directives}. These cause C preprocessing directives
+to be inserted into the generated C text.
+@item
+Only one of @code{ifdef} and @code{ifndef} may apply to any one option.
+@item
+The @code{VALUE_OPT_} values are @code{#define}-d. If @code{WITH_MUMBLING}
+is not defined, then the associated @code{VALUE_OPT_} value will not be
+@code{#define}-d either. So, if you have an option named, @code{MUMBLING}
+that is active only if @code{WITH_MUMBLING} is @code{#define}-d, then
+@code{VALUE_OPT_MUMBLING} will be @code{#define}-d iff @code{WITH_MUMBLING}
+is @code{#define}-d. Watch those switch statements.
+@item
+If you specify @code{omitted-usage}, then the option will be recognized
+as disabled when it is configured out of the build, but will yield the
+message, ``This option has been disabled.'' You may specify an alternate
+message by giving @code{omitted-usage} a string value. e.g.:
+@example
+omitted-usage = 'you cannot do this';
+@end example
+@end itemize
+
+@item no-command
+@vindex no-command
+This option specifies that the option is not allowed on the command line.
+Such an option may not take a @code{value} (flag character) attribute.
+The program must have the @code{homerc} (@pxref{program attributes}) option set.
+@end table
+
+@node Immediate Action
+@subsubsection Immediate Action Attributes
+@cindex immediate action
+
+Certain options may need to be processed early. For example, in order to
+suppress the processing of configuration files, it is necessary to process the
+command line option @code{--no-load-opts} @strong{before} the config files are
+processed. To accommodate this, certain options may have their enabled or
+disabled forms marked for immediate processing. The consequence of this is
+that they are processed ahead of all other options in the reverse of normal
+order.
+
+Normally, the first options processed are the options specified in the first
+@code{homerc} file, followed by then next @code{homerc} file through to the
+end of config file processing. Next, environment variables are processed and
+finally, the command line options. The later options override settings
+processed earlier. That actually gives them higher priority. Command line
+immediate action options actually have the lowest priority of all. They would
+be used only if they are to have an effect on the processing of subsequent
+options.
+
+@table @samp
+@item immediate
+@vindex immediate
+Use this option attribute to specify that the enabled form of the option
+is to be processed immediately. The @code{help} and @code{more-help}
+options are so specified. They will also call @code{exit()} upon
+completion, so they @strong{do} have an effect on the processing
+of the remaining options :-).
+
+@item immed-disable
+@vindex immed-disable
+Use this option attribute to specify that the disabled form of the
+option is to be processed immediately. The @code{load-opts} option is
+so specified. The @code{--no-load-opts} command line option will
+suppress the processing of config files and environment variables.
+Contrariwise, the @code{--load-opts} command line option is
+processed normally. That means that the options specified in that file
+will be processed after all the @code{homerc} files and, in fact, after
+options that precede it on the command line.
+
+@item also
+If either the @code{immediate} or the @code{immed-disable} attributes
+are set to the string, ``@code{also}'', then the option will actually be
+processed twice: first at the immediate processing phase and again
+at the ``normal'' time.
+@end table
+
+@node Option Conflict Attributes
+@subsubsection Option Conflict Attributes
+@cindex Option Conflict Attributes
+
+These attributes may be used as many times as you need.
+They are used at the end of the option processing to verify
+that the context within which each option is found does not
+conflict with the presence or absence of other options.
+
+This is not a complete cover of all possible conflicts and
+requirements, but it simple to implement and covers the
+more common situations.
+
+@table @samp
+@cindex flags-must
+@item flags-must
+one entry for every option that @strong{must} be present
+when this option is present
+
+@cindex flags-cant
+@item flags-cant
+one entry for every option that @strong{cannot} be present
+when this option is present
+@end table
+
+@node opt-attr settable
+@subsubsection Program may set option
+@vindex settable
+If the option can be set outside of option processing, specify
+``@code{settable}''. If this attribute is defined, special macros for setting
+this particular option will be inserted into the interface file. For example,
+@code{TEMPL_DIRS} is a settable option for AutoGen, so a macro named
+@code{SET_OPT_TEMPL_DIRS(a)} appears in the interface file. This attribute
+interacts with the @var{documentation} attribute.
+
+@node opt-attr no-preset
+@subsubsection Option cannot be pre-configured
+@vindex no-preset
+@cindex configuration file
+If presetting this option is not allowed, specify ``@code{no-preset}''.
+(Thus, environment variables and values set in configuration files will be
+ignored.)
+
+@node opt-attr equivalence
+@subsubsection Option Equivalence Class
+@vindex equivalence
+Generally, when several options are mutually exclusive and basically serve the
+purpose of selecting one of several processing modes, specify the
+``@code{equivalence}'' attribute. These options will be considered an
+equivalence class. Sometimes, it is just easier to deal with them as such.
+All members of the equivalence class must contain the same equivalenced-to
+option, including the equivalenced-to option itself. Thus, it must be a class
+member.
+
+For an option equivalence class, there is a single occurrence counter for
+the class. It can be referenced with the interface macro,
+@code{COUNT_OPT(BASE_OPTION)}, where ``BASE_OPTION'' is the equivalenced-to
+option name.
+
+Also, please take careful note: since the options are mapped to the
+equivalenced-to option descriptor, any option argument values are mapped to
+that descriptor also. Be sure you know which ``equivalent option'' was
+selected before getting an option argument value!
+
+During the presetting phase of option processing (@pxref{Presetting
+Options}), equivalenced options may be specified. However, if different
+equivalenced members are specified, only the last instance will be
+recognized and the others will be discarded. A conflict error is indicated
+only when multiple different members appear on the command line itself.
+
+As an example of where equivalenced options might be useful, @code{cpio(1)}
+has three options @code{-o}, @code{-i}, and @code{-p} that define the
+operational mode of the program (@code{create}, @code{extract} and
+@code{pass-through}, respectively). They form an equivalence class from
+which one and only one member must appear on the command line. If
+@code{cpio} were an AutoOpt-ed program, then each of these option
+definitions would contain:
+
+@example
+equivalence = create;
+@end example
+
+and the program would be able to determine the operating mode
+with code that worked something like this:
+
+@example
+switch (WHICH_IDX_CREATE) @{
+case INDEX_OPT_CREATE: ...
+case INDEX_OPT_EXTRACT: ...
+case INDEX_OPT_PASS_THROUGH: ...
+default: /* cannot happen */
+@}
+@end example
+
+@node opt-attr aliases
+@subsubsection Option Aliasing
+
+Sometimes, for backwards compatibility or tradition or just plain convenience,
+it works better to define one option as a pure alias for another option.
+For such situations, provide the following pieces of information:
+@example
+flag = @{
+ name = @i{aliasing-option-name};
+ value = @i{aliasing-flag-char}; // optional !
+ aliases = @i{aliased-to-option};
+@};
+@end example
+Do not provide anything else. The usage text for such an option will be:
+@example
+ This is an alias for @i{aliased-to-option}
+@end example
+
+@node opt-attr default option
+@subsubsection Default Option
+@vindex default
+If your program processes its arguments in named option mode (See
+@code{long-opts} in @ref{program attributes}), then you may select
+@strong{one} of your options to be the default option. Do so by using
+attribute @code{default} with one of the options. The option so specified
+must have an @code{arg-type} (@pxref{Option Arguments}) specified, but not the
+@code{arg-optional} (@pxref{arg-optional}) attribute. That is to say, the
+option argument must be required.
+
+If you have done this, then any arguments that do not match an option name and
+do not contain an equal sign (@code{=}) will be interpreted as an option
+argument to the default option.
+
+@node opt-attr documentation
+@subsubsection Option Sectioning Comment
+This attribute means the option exists for the purpose of separating option
+description text in the usage output and texi documentation. Without this
+attribute, every option is a separate node in the texi docs. With this
+attribute, the documentation options become texi doc nodes and the options are
+collected under them. Choose the name attribute carefully because it will
+appear in the texi documentation.
+
+Libraries may also choose to make it settable so that the library can
+determine which command line option is the first one that pertains to the
+library.
+
+@vindex documentation
+If the @samp{documentation} attribute is present, then all other
+attributes are disabled except @code{settable}, @code{call-proc} and
+@code{flag-code}. @code{settable} must be and is only specified if
+@code{call-proc}, @code{extract-code} or @code{flag-code} has been specified.
+When present, the @code{descrip} attribute will be displayed only when the
+@code{--help} option has been specified. It will be displayed flush to the
+left hand margin and may consist of one or more lines of text, filled to 72
+columns.
+
+The name of the option will not be printed in the help text. It @i{will},
+however, be printed as section headers in the texi documentation. If the
+attribute is given a non-empty value, this text will be reproduced in the man
+page and texi doc immediately after the @code{descrip} text.
+
+@node opt-attr translators
+@subsubsection Translator Notes
+@vindex translators
+If you need to give the translators a special note about a particular option,
+please use the ``@code{translators}'' attribute. The attribute text will be
+emitted into the generated @code{.c} text where the option related strings get
+defined. To make a general comment about all of the option code, add comments
+to an @code{include} attribute (@pxref{program attributes}). Do @strong{not}
+use this attribute globally, or it will get emitted into every option
+definition block.
+
+@node Option Arguments
+@subsection Option Argument Specification
+@cindex Option Arguments
+
+Command line options come in three flavors: options that do not
+take arguments, those that do and those that may. Without an
+"arg-type" attribute, AutoOpts will not process an argument to an
+option. If "arg-type" is specified and "arg-optional" is also
+specified, then the next command line token will be taken to
+be an argument, unless it looks like the name of another option.
+
+If the argument type is specified to be anything other than "str[ing]", then
+AutoOpts will specify a callback procedure to handle the argument. Some of
+these procedures will be created and inserted into the generated @code{.c}
+file, and others are already built into the @file{libopts} library.
+Therefore, if you write your own callback procedure
+(@pxref{Option Argument Handling}), then you must either not specify an
+"arg-type" attribute, or else specify it to be of type "str[ing]". Your
+callback function will be able to place its own restrictions on what that
+string may contain or represent.
+
+Option argument handling attributes depend upon the value set for the
+@vindex arg-type
+@code{arg-type} attribute. It specifies the type of argument the option
+will take. If not present, the option cannot take an argument. If present,
+it must be an entry in the following table. The first three letters is
+sufficient.
+
+@menu
+* arg-type string:: Arg Type String
+* arg-type number:: Arg Type Number
+* arg-type boolean:: Arg Type Boolean
+* arg-type keyword:: Arg Type Keyword
+* arg-type set membership:: Arg Type Set Membership
+* arg-type hierarchy:: Arg Type Hierarchical
+* arg-type file name:: Arg Type File Name
+* arg-type time-duration:: Arg Type Time Duration
+* arg-type time-date:: Arg Type Time and Date
+
+Supporting attributes for particular argument types:
+
+* arg-keyword:: Keyword list
+* arg-optional:: Option Argument Optional
+* arg-default:: Default Option Argument Value
+@end menu
+
+@node arg-type string
+@subsubsection Arg Type String
+@code{arg-type = string;}
+
+The argument may be any arbitrary string, though your program or option
+callback procedure may place additional constraints upon it.
+
+
+@node arg-type number
+@subsubsection Arg Type Number
+@code{arg-type = number;}
+
+The argument must be a correctly formed integer, without any trailing U's or
+L's. AutoOpts contains a library procedure to convert the string to a number.
+If you specify range checking with @code{arg-range} (see below), then AutoOpts
+produces a special purpose procedure for this option.
+
+@table @samp
+@item scaled
+@vindex scaled
+@code{scaled} marks the option so that suffixes of @samp{k}, @samp{K},
+@samp{m}, @samp{M}, @samp{g}, @samp{G}, @samp{t}, and @samp{T} will multiply
+the given number by a power of 1000 or 1024. Lower case letters scale by a
+power of 1000 and upper case scale by a power of 1024.
+
+@item arg-range
+@vindex arg-range
+@code{arg-range} is used to create a callback procedure for validating the
+range of the option argument. It must match one of the range entries. Each
+@code{arg-range} should consist of either an integer by itself or an integer
+range. The integer range is specified by one or two integers separated by the
+two character sequence, @code{->}. Be sure to quote the entire range string.
+The definitions parser will not accept the range syntax as a single string
+token.
+
+The generated procedure imposes the range constraints as follows:
+@itemize @bullet
+@item
+A number by itself will match that one value.
+@item
+The high end of the range may not be @code{INT_MIN}, both for obvious
+reasons and because that value is used to indicate a single-valued match.
+@item
+An omitted lower value implies a lower bound of INT_MIN.
+@item
+An omitted upper value implies a upper bound of INT_MAX.
+@item
+The argument value is required. It may not be optional.
+@item
+The value must match one of the entries. If it can match more than one,
+then you have redundancies, but no harm will come of it.
+@end itemize
+@end table
+
+
+@node arg-type boolean
+@subsubsection Arg Type Boolean
+@code{arg-type = boolean;}
+
+The argument will be interpreted and always yield either AG_TRUE or
+AG_FALSE. False values are@: the empty string, the number zero, or a
+string that starts with @code{f}, @code{F}, @code{n} or @code{N}
+(representing False or No). Anything else will be interpreted as True.
+
+
+@node arg-type keyword
+@subsubsection Arg Type Keyword
+@code{arg-type = keyword;}
+
+The argument must match a specified list of strings (@pxref{arg-keyword}).
+Assuming you have named the option, @code{optn-name}, the strings will be
+converted into an enumeration of type @code{te_Optn_Name} with the values
+@code{OPTN_NAME_KEYWORD}.* If you have @strong{not} specified a default value,
+the value @code{OPTN_NAME_UNDEFINED} will be inserted with the value zero.
+The option will be initialized to that value. You may now use this in your
+code as follows:
+
+@example
+te_Optn_Name opt = OPT_VALUE_OPTN_NAME;
+switch (opt) @{
+case OPTN_NAME_UNDEFINED: /* undefined things */ break;
+case OPTN_NAME_KEYWORD: /* `keyword' things */ break;
+default: /* utterly impossible */ ;
+@}
+@end example
+
+AutoOpts produces a special purpose procedure for this option.
+You may not specify an alternate handling procedure.
+
+If you have need for the string name of the selected keyword, you
+may obtain this with the macro, @code{OPT_OPTN_NAME_VAL2STR(val)}.
+The value you pass would normally be @code{OPT_VALUE_OPTN_NAME},
+but anything with numeric value that is legal for @code{te_Optn_Name}
+may be passed. Anything out of range will result in the string,
+@code{"*INVALID*"} being returned. The strings are read only.
+It may be used as in:
+
+@example
+te_Optn_Name opt = OPT_VALUE_OPTN_NAME;
+printf( "you selected the %s keyword\n",
+ OPT_OPTN_NAME_VAL2STR(opt) );
+@end example
+
+* Note: you may replace the @code{OPTN_NAME} enumeration prefix with
+another prefix by specifying a
+@vindex prefix-enum
+@code{prefix-enum} attribute.
+
+Finally, users may specify the argument either by name or by number.
+Since the numeric equivalents change by having new entries inserted
+into the keyword list, this would not be a recommended practice.
+However, either @code{-1} or @code{~0} will always be equivalent to
+specifying the last keyword.
+
+@node arg-type set membership
+@subsubsection Arg Type Set Membership
+@code{arg-type = set;}
+
+The argument must be a list of names each of which must match the strings
+"@code{all}", "@code{none}" or one of the keywords (@pxref{arg-keyword})
+specified for this option. @code{all} will turn on all membership bits and
+@code{none} will turn them all off. Specifying one of the keywords will turn
+on the corresponding set membership bit. Literal numbers may also be used and
+may, thereby, set or clear more than one bit. Preceding a keyword or literal
+number with a bang (@code{!} - exclamation point) will turn the bit(s) off.
+The number of keywords allowed is constrained by the number of bits in a
+pointer, as the bit set is kept in a @code{void*}.
+
+If, for example, you specified @code{first} in your list of keywords,
+then you can use the following code to test to see if either @code{first}
+or @code{all} was specified:
+
+@example
+uintptr_t opt = OPT_VALUE_OPTN_NAME;
+if (opt & OPTN_NAME_FIRST)
+ /* OPTN_NAME_FIRST bit was set */ ;
+@end example
+
+AutoOpts produces a special purpose procedure for this option.
+To set multiple bits as the default (initial) value, you must
+specify an initial numeric value (which might become inaccurate over
+time), or else specify @code{arg-default} multiple times. Do not
+specify a series of names conjoined with @code{+} symbols as the
+value for any of the @code{arg-default} attributes. That works for
+option parsing, but not for the option code generation.
+
+@node arg-type hierarchy
+@subsubsection Arg Type Hierarchical
+@code{arg-type = hierarchy;}
+@*
+@code{arg-type = nested;}
+
+This denotes an option with a structure-valued argument, a.k.a.
+``subopts'' in @code{getopts} terminology. The argument is parsed
+and the values made available to the program via the find and
+find next calls (@xref{libopts-optionFindValue},
+@xref{libopts-optionGetValue}, and
+@pxref{libopts-optionFindNextValue}).
+
+@example
+tOptionValue * val = optionGetValue(VALUE_OPT_OPTN_NAME, "name");
+while (val != NULL) @{
+ process(val);
+ val = optionNextValue(VALUE_OPT_OPTN_NAME, val);
+ if (wrong_name(val, "name"))
+ break;
+@}
+@end example
+
+
+@node arg-type file name
+@subsubsection Arg Type File Name
+@code{arg-type = file;}
+
+This argument type will have some validations on the argument and,
+optionally, actually open the file. You must specify several additonal
+attributes for the option:
+
+@table @samp
+@item file-exists
+@vindex file-exists
+If not specified or empty, then the directory portion of the name is checked.
+The directory must exist or the argument is rejected and the usage procedure
+is invoked.
+
+Otherwise, both the directory as above and the full name is tested for
+existence. If the value begins with the two letters ``no'', then the file
+must not pre-exist. Otherwise, the file is expected to exist.
+
+@item open-file
+@vindex open-file
+If not specified or empty, the file is left alone.
+If the value begins with the four letters ``desc''[@i{riptor}], then
+@code{open(2)} is used and @code{optArg.argFd} is set. Otherwise, the
+file is opened with @code{fopen} and @code{optArg.argFp} is set.
+
+@item file-mode
+@vindex file-mode
+If ``open-file'' is set and not empty, then you must specify the open mode.
+Set the value to the flag bits or mode string as appropriate for the open
+type.
+@end table
+
+
+@node arg-type time-duration
+@subsubsection Arg Type Time Duration
+@code{arg-type = time-duration;}
+
+The argument will be converted into a number of seconds. It may be
+a multi-part number with different parts being multiplied into a seconds
+value and added into the final result. Valid forms are in the table
+below. Upper cased letters represent numbers that must be used in the
+expressions.
+
+@table @samp
+@item [[HH:]MM:]SS
+@code{HH} is multiplied by @code{3600} and @code{MM} multiplied by @code{60}
+before they are added to @code{SS}. This time specification may not be
+followed by any other time specs. @code{HH} and @code{MM} are both optional,
+though @code{HH} cannot be specified without @code{MM}.
+
+@item DAYS d
+@code{DAYS} is multiplied by the number of seconds in a day. This value may
+be followed by (and added to) values specified by @code{HH:MM:SS} or the
+suffixed values below. If present, it must always be first.
+
+@item HRS h
+@code{HRS} is multiplied by the number of seconds in an hour. This value may
+be followed by (and added to) values specified by @code{MM:SS} or the
+suffixed values below.
+
+@item MINS m
+@code{MINS} is multiplied by the number of seconds in a minute. This value may
+be followed by (and added to) a count of seconds.
+
+@item SECS s
+This value can only be the last value in a time specification. The @code{s}
+suffix is optional.
+@end table
+
+@example
+ 5 d 1:10:05 ==> 5 days + 1 hour 10 minutes and 5 seconds
+ 5 d 1 h 10 m 5 ==> yields: 436205 seconds
+ 5d1h10m5s ==> same result -- spaces are optional.
+@end example
+
+When saved into a config file, the value will be stored as a simple count
+of seconds. There are actually more (many) accepted time duration strings.
+The full documentation can be found with ISO-8601 documentation and the
+more extedded documentation when ``parse_duration()'' becomes more widely
+available.
+
+
+@node arg-type time-date
+@subsubsection Arg Type Time and Date
+@code{arg-type = time-date;}
+
+The argument will be converted into the number of seconds since the epoch.
+The conversion rules are very complicated, please see the @file{getdate_r(3GNU)}
+man page. There are some additional restrictions:
+
+@enumerate
+@item
+Your project must be compiled with @code{PKGDATADIR} defined and naming a
+valid directory.
+@item
+The @code{DATEMSK} environment variable will be set to the @file{datemsk} file
+within that directory.
+@end enumerate
+
+If that file is not accessible for any reason, the string will be
+parsed as a time duration (@pxref{arg-type time-duration}) instead of a
+specific date and time.
+
+@node arg-keyword
+@subsubsection Keyword list
+@vindex keyword
+If the @code{arg-type} is @code{keyword} (@pxref{arg-type keyword}) or
+@code{set-membership} (@pxref{arg-type set membership}), then you must specify
+the list of keywords by a series of @code{keyword} entries. The interface
+file will contain values for @code{@i{<OPTN_NAME>}_@i{<KEYWORD>}} for each
+keyword entry. @code{keyword} option types will have an enumeration and
+@code{set-membership} option types will have a set of unsigned bits
+@code{#define}-d.
+
+If the @code{arg-type} is specifically @code{keyword}, you may also add
+special handling code with a
+@vindex extra-code
+@code{extra-code} attribute. After @code{optionEnumerationVal} has
+converted the input string into an enumeration, you may insert code to
+process this enumeration value (@code{pOptDesc->optArg.argEnum}).
+
+@node arg-optional
+@subsubsection Option Argument Optional
+@vindex arg-optional
+This attribute indicates that the user does not have to supply an argument for
+the option. This is only valid if the @var{arg-type} is @code{string}
+(@pxref{arg-type string}) or @code{keyword} (@pxref{arg-type keyword}). If it
+is @code{keyword}, then this attribute may also specify the default keyword to
+assume when the argument is not supplied. If left empty, @var{arg-default}
+(@pxref{arg-default}) or the zero-valued keyword will be used.
+
+This is overridden and the options are required if the libopts library
+gets configured with @code{--disable-optional-args}.
+
+@node arg-default
+@subsubsection Default Option Argument Value
+@vindex arg-default
+This specifies the default option argument value to be used when the option is
+not specified or preset. You may specify multiple @code{arg-default} values if
+the argument type is @code{set membership}.
+
+@node Option Argument Handling
+@subsection Option Argument Handling
+@cindex Option Argument Handling
+
+AutoOpts will either specify or automatically generate callback procedures
+for options that take specialized arguments. The only option argument types
+that are not specialized are plain string arguments and no argument at all.
+For options that fall into one of those two categories, you may specify your
+own callback function, as specified below. If you do this and if you
+specify that options are resettable (@pxref{automatic options}), then your
+option handling code @strong{must} look for the @samp{OPTST_RESET} bit in
+the @code{fOptState} field of the option descriptor.
+
+If the option takes a string argument, then you may specify that the option
+is to be handled by the @code{libopts} library procedures
+@code{stackOptArg()} or @code{unstackOptArg()} (see below). In this case,
+you may not provide option handling code.
+
+Finally, @samp{documentation} options (@pxref{opt-attr documentation}) may
+also be marked as @option{settable} (@pxref{opt-attr settable}) and have
+special callback functions (either @samp{flag-code}, @samp{extract-code},
+or @samp{call-proc}).
+
+@table @samp
+@item flag-code
+@vindex flag-code
+statements to execute when the option is encountered. This may be used in
+conjunction with option argument types that cause AutoOpts to emit handler
+code. If you do this, the @samp{flag-code} with index zero (0) is emitted
+into the handler code @emph{before} the argument is handled, and the entry
+with index one (1) is handled afterward.
+
+The generated procedure will be laid out something like this:
+
+@example
+static void
+doOpt<name>(tOptions* pOptions, tOptDesc* pOptDesc)
+@{
+<flag-code[0]>
+<AutoOpts defined handler code>
+<flag-code[1]>
+@}
+@end example
+
+Only certain fields within the @code{tOptions} and @code{tOptDesc}
+structures may be accessed. @xref{Option Processing Data}. When writing
+this code, you must be very careful with the @code{pOptions} pointer. The
+handler code is called with this pointer set to special values for handling
+special situations. Your code must handle them. As an example,
+look at @code{optionEnumerationVal} in @file{enum.c}.
+
+@item extract-code
+@vindex extract-code
+This is effectively identical to @code{flag-code}, except that the
+source is kept in the output file instead of the definitions file
+and you cannot use this in conjunction with options with arguments,
+other than string arguments.
+
+A long comment is used to demarcate the code. You must not modify
+that marker. @i{Before} regenerating the option code file,
+the old file is renamed from MUMBLE.c to MUMBLE.c.save. The template
+will be looking there for the text to copy into the new output file.
+
+@item call-proc
+@vindex call-proc
+external procedure to call when option is encountered. The calling
+sequence must conform to the sequence defined above for the generated
+procedure, @code{doOpt<name>}. It has the same restrictions
+regarding the fields within the structures passed in as arguments.
+@xref{Option Processing Data}.
+
+@item flag-proc
+@vindex flag-proc
+Name of another option whose @code{flag-code} can be executed
+when this option is encountered.
+
+@item stack-arg
+@vindex stack-arg
+Call a special library routine to stack the option's arguments. Special
+macros in the interface file are provided for determining how many of the
+options were found (@code{STACKCT_OPT(NAME)}) and to obtain a pointer to a
+list of pointers to the argument values (@code{STACKLST_OPT(NAME)}).
+Obviously, for a stackable argument, the @code{max} attribute
+(@pxref{Common Attributes}) needs to be set higher than @code{1}.
+
+If this stacked argument option has a disablement prefix, then the entire
+stack of arguments will be cleared by specifying the option with that
+disablement prefix.
+
+@item unstack-arg
+@vindex unstack-arg
+Call a special library routine to remove (``unstack'') strings
+from a @code{stack-arg} option stack. This attribute must name
+the option that is to be ``unstacked''. Neither this option nor
+the stacked argument option it references may be equivalenced to
+another option.
+@end table
+
+@node Internationalizing Options
+@subsection Internationalizing Options
+@cindex Internationalizing Options
+
+Normally, AutoOpts produces usage text that is difficult to translate. It is
+pieced together on the fly using words and phrases scattered around here and
+there, piecing together toe document. This does not translate well.
+
+Incorporated into this package are some ways around the problem. First, you
+should specify the @code{full-usage} and @code{short-usage} program attributes
+(@pxref{program attributes}). This will enable your translators to translate
+the usage text as a whole.
+
+Your translators will also be able to translate long option names. The option
+name translations will then become the names searched for both on the command
+line and in configuration files. However, it will not affect the names of
+environment variable names used to configure your program.
+
+If it is considered desireable to keep configuration files in the ``C''
+locale, then several macros are available to suppress or delay the
+translations of option names at run time. These are all disabled if
+@code{ENABLE_NLS} is not defined at compile time or if @code{no-xlate} has
+been set to the value @emph{anything}. These macros @strong{must}
+be invoked before the first invocation of @code{optionProcess}.
+
+@table @samp
+@item OPT_NO_XLAT_CFG_NAMES;
+@itemx OPT_XLAT_CFG_NAMES;
+Disable (or enable) the translations of option names for configuration files.
+If you enable translation for config files, then they will be translated for
+command line options.
+
+@item OPT_NO_XLAT_OPT_NAMES;
+@itemx OPT_XLAT_OPT_NAMES;
+Disable (or enable) the translations of option names for command line
+processing. If you disable the translation for command line processing,
+you will also disable it for configuration file processing. Once translated,
+the option names will remain translated.
+@end table
+
+@node documentation attributes
+@subsection Man and Info doc Attributes
+@cindex documentation attributes
+
+AutoOpts includes AutoGen templates for producing abbreviated man pages
+and for producing the invoking section of an info document. To take
+advantage of these templates, you must add several attributes to your
+option definitions.
+
+@table @samp
+@item arg-name
+@vindex arg-name
+If an option has an argument, the argument should have a name for
+documentation purposes. It will default to @code{arg-type}, but
+it will likely be clearer with something else like, @code{file-name}
+instead of @code{string} (the type).
+
+@item doc
+@vindex doc
+First, every @code{flag} definition @emph{other than} ``documentation''
+definitions, must have a @code{doc} attribute defined. If the option takes
+an argument, then it will need an @code{arg-name} attribute as well. The
+@code{doc} text should be in plain sentences with minimal formatting. The
+Texinfo commands @code{@@code}, and @code{@@var} will have its enclosed text
+made into @strong{\fB} entries in the man page, and the @code{@@file} text
+will be made into @strong{\fI} entries. The @code{arg-name} attribute is
+used to display the option's argument in the man page.
+
+Options marked with the ``documentation'' attribute are for documenting
+the usage text. All other options should have the ``doc'' attribute in
+order to document the usage of the option in the generated man pages.
+
+@item option-info
+@vindex option-info
+This text will be inserted as a lead-in paragraph in the @code{OPTIONS}
+section of the generated man page.
+
+@item doc-section
+@vindex doc-section
+This is a compound attribute that requires three @i{sub}attributes:
+@table @i
+@item ds-type
+This describes the section type. Basically, the title of the section
+that will be added to all output documentation. There may be only one
+@code{doc-section} for any given @code{ds-type}. If there are duplicates,
+the results are undefined (it might work, it might not).
+
+There are five categories of @code{ds-type} sections.
+They are those that the documentation templates would otherwise:
+@enumerate
+@item
+always create itself, ignoring any @code{ds-type}s by this name.
+These are marked, below, as @code{ao-only}.
+@item
+create, if none have been provided.
+These are marked, @code{alternate}.
+@item
+create, but augment if the @code{doc-section} was provided.
+These are marked, @code{augments}.
+@item
+do nothing, but inserts them into the output in a prescribed order.
+These are marked, @code{known}
+@item
+knows nothing about them. They will be alphabetized and inserted
+after the list of leading sections and before the list of trailing
+sections. These are not marked because I don't know their names.
+@end enumerate
+
+Some of these are emitted by the documentation templates only if
+certain conditions are met. If there are conditions, they are
+explained below. If there are no conditions, then you will always
+see the named section in the output.
+
+The output sections will appear in this order:
+@table @samp
+@item NAME
+@code{ao-only}.
+@item SYNOPSIS
+@code{alternate}.
+@item DESCRIPTION
+@code{augments}.
+@item OPTIONS
+@code{ao-only}.
+@item OPTION PRESETS
+@code{ao-only}, if environment presets or configuration file processing
+has been specified.
+@item unknown
+At this point, the unknown, alphabetized sections are inserted.
+@item IMPLEMENTATION NOTES
+@code{known}
+@item ENVIRONMENT
+@code{augments}, if environment presets have been specified.
+@item FILES
+@code{augments}, if configuration file processing has been specified.
+@item EXAMPLES
+@code{known}
+@item EXIT STATUS
+@code{augments}.
+@item ERRORS
+@code{known}
+@item COMPATIBILITY
+@code{known}
+@item SEE ALSO
+@code{known}
+@item CONFORMING TO
+@code{known}
+@item HISTORY
+@code{known}
+@item AUTHORS
+@code{alternate}, if the @code{copyright} stanza has either
+an @code{author} or an @code{owner} attribute.
+@item COPYRIGHT
+@code{alternate}, if there is a @code{copyright} stanza.
+@item BUGS
+@code{augments}, if the @code{copyright} stanza has an
+@code{eaddr} attribute.
+@item NOTES
+@code{augments}.
+@end table
+
+@item ds-format
+This describes the format of the associated @code{ds-text} section.
+@code{man}, @code{mdoc} and @code{texi} formats are supported.
+Regardless of the chosen format, the formatting tags in the output
+text will be converted to @code{man} macros for @code{man} pages,
+@code{mdoc} macros for @code{mdoc} pages, and @code{texi} macros for
+@code{texinfo} pages.
+@item ds-text
+This is the descriptive text, written according to the rules for
+@code{ds-format} documents.
+@end table
+
+Here is an example of a ``doc-section'' for a ``SEE ALSO'' type.
+
+@example
+doc-section = @{
+ ds-type = 'SEE ALSO'; // or anything else
+ ds-format = 'man'; // or texi or mdoc format
+ ds-text = <<-_EOText_
+ text relevant to this section type,
+ in the chosen format
+ _EOText_;
+@};
+@end example
+
+@item prog-man-descrip
+@itemx prog-info-descrip
+@vindex prog-man-descrip
+@vindex prog-info-descrip
+These attributes are now deprecated.
+Please use a @code{doc-section} stanza with a @code{ds-type}
+attribute set to @code{DESCRIPTION} instead.
+
+@item detail
+@vindex detail
+This attribute is used to add a very short explanation about what
+a program is used for when the ``title'' attribute is insufficient.
+If there is no ``doc-section'' stanza of type ``DESCRIPTION'', then
+this text is used for the man page DESCRIPTION section, too.
+@end table
+
+@node automatic options
+@subsection Automatically Supported Options
+@cindex automatic options
+
+AutoOpts provides automated support for several options. @code{help} and
+@code{more-help} are always provided. The others are conditional upon
+various global program attributes being defined @xref{program attributes}.
+
+Below are the option names and default flag values. The flags are activated
+if and only if at least one user-defined option also uses a flag value. The
+long names are supported as option names if @code{long-opts} has been
+specified. These option flags may be deleted or changed to characters of your
+choosing by specifying
+@vindex more-help-value
+@vindex usage-value
+@vindex version-value
+@vindex load-opts-value
+@vindex reset-value
+@code{xxx-value = "y";}, where @code{xxx} is one of the
+option names below and @code{y} is either empty or the character of your choice.
+For example, to change the help flag from @code{?} to @code{h}, specify
+@vindex help-value
+@code{help-value = "h";}; and to require that @code{save-opts} be specified
+only with its long option name, specify
+@vindex save-opts-value
+@code{save-opts-value = "";}.
+
+Additionally, the procedure that prints out the program version may be
+replaced by specifying @code{version-proc}.
+@vindex version-proc
+This procedure must be defined to be of external scope (non-static).
+By default, the AutoOpts library provides @code{optionPrintVersion}
+and it will be the specified callback function in the option
+definition structure.
+
+With the exception of the @code{load-opts} option, none of these automatically
+supported options will be recognized in configuration files or environment
+variables.
+
+@table @samp
+@item help -?
+This option will immediately invoke the @code{USAGE()} procedure
+and display the usage line, a description of each option with
+its description and option usage information. This is followed
+by the contents of the definition of the @code{detail} text macro.
+
+@item more-help -!
+This option is identical to the @code{help} option, except that the
+output is passed through a pager program. (@code{more} by default, or
+the program identified by the @code{PAGER} environment variable.)
+
+@item usage -u
+This option must be requested by specifying, @code{usage-opt} in the option
+definition file. It will produce abbreviated help text to @file{stdout} and
+exit with zero status (@code{EXIT_SUCCESS}).
+
+@item version -v
+This will print the program name, title and version. If it is followed by
+the letter @code{c} and a value for @code{copyright} and @code{owner} have
+been provided, then the copyright will be printed, too. If it is followed
+by the letter @code{n}, then the full copyright notice (if available) will
+be printed. The @code{version} attribute must be specified in the option
+definition file.
+
+@item load-opts -<
+@cindex configuration file
+This option will load options from the named file. They will be treated
+exactly as if they were loaded from the normally found configuration files,
+but will not be loaded until the option is actually processed. This can also
+be used within another configuration file, causing them to nest. This is the
+@strong{only} automatically supported option that can be activated inside of
+config files or with environment variables.
+
+Specifying the negated form of the option (@code{--no-load-opts}) will
+suppress the processing of configuration files and environment variables.
+
+This option is activated by specifying one or more @code{homerc} attributes.
+
+@item save-opts ->
+@cindex configuration file
+This option will cause the option state to be printed in the configuration file
+format when option processing is done but not yet verified for consistency.
+The program will terminate successfully without running when this has
+completed. Note that for most shells you will have to quote or escape the
+flag character to restrict special meanings to the shell.
+
+The output file will be the configuration file name (default or provided by
+@code{rcfile}) in the last directory named in a @code{homerc} definition.
+
+This option may be set from within your program by invoking the
+"@code{SET_OPT_SAVE_OPTS(@i{filename})}" macro (@pxref{SET_OPT_name}).
+Invoking this macro will set the file name for saving the option processing
+state, but the state will @strong{not} actually be saved. You must call
+@code{optionSaveFile} to do that (@pxref{libopts-optionSaveFile}).
+@strong{CAVEAT:} if, after invoking this macro, you call
+@code{optionProcess}, the option processing state will be saved to this file
+and @code{optionProcess} will not return. You may wish to invoke
+@code{CLEAR_OPT( SAVE_OPTS )} (@pxref{CLEAR_OPT}) beforehand if you do need
+to reinvoke @code{optionProcess}.
+
+This option is activated by specifying one or more @code{homerc} attributes.
+
+@item reset-option -R
+This option takes the name of an option for the current program and resets its
+state such that it is set back to its original, compile-time initialized
+value. If the option state is subsequently stored (via @code{--save-opts}),
+the named option will not appear in that file.
+
+This option is activated by specifying the @code{resettable} attribute.
+
+@strong{BEWARE}: If the @code{resettable} attribute is specified, all
+option callbacks @strong{must} look for the @code{OPTST_RESET} bit in the
+@code{fOptState} field of the option descriptor. If set, the @code{optCookie}
+and @code{optArg} fields will be unchanged from their last setting. When the
+callback returns, these fields will be set to their original values. If you
+use this feature and you have allocated data hanging off of the cookie, you
+need to deallocate it.
+@end table
+
+@node standard options
+@subsection Library of Standard Options
+@cindex standard options
+
+AutoOpts has developed a set of standardized options.
+You may incorporate these options in your program simply by @emph{first}
+adding a @code{#define} for the options you want, and then the line,
+
+@example
+#include stdoptions.def
+@end example
+
+@noindent
+in your option definitions. The supported options are specified thus:
+
+@example
+#define DEBUG
+#define DIRECTORY
+#define DRY_RUN
+#define INPUT
+#define INTERACTIVE
+#define OUTPUT
+#define WARN
+
+#define SILENT
+#define QUIET
+#define BRIEF
+#define VERBOSE
+@end example
+
+By default, only the long form of the option will be available.
+To specify the short (flag) form, suffix these names with @code{_FLAG}.
+e.g.,
+
+@example
+#define DEBUG_FLAG
+@end example
+
+@code{--silent}, @code{--quiet}, @code{--brief} and @code{--verbose} are
+related in that they all indicate some level of diagnostic output.
+These options are all designed to conflict with each other.
+Instead of four different options, however, several levels can be
+incorporated by @code{#define}-ing @code{VERBOSE_ENUM}. In conjunction
+with @code{VERBOSE}, it incorporates the notion of @i{5} levels in an
+enumeration: @code{silent}, @code{quiet}, @code{brief},
+@code{informative} and @code{verbose}; with the default being
+@code{brief}.
+
+@ignore
+END == AUTOOPTS-MAIN == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+Here is an example program that uses the following set of definitions:
+
+@example
+AutoGen Definitions options;
+
+prog-name = default-test;
+prog-title = 'Default Option Example';
+homerc = '$$/../share/default-test', '$HOME', '.';
+environrc;
+long-opts;
+gnu-usage;
+usage-opt;
+version = '1.0';
+main = @{
+ main-type = shell-process;
+@};
+#define DEBUG_FLAG
+#define WARN_FLAG
+#define WARN_LEVEL
+#define VERBOSE_FLAG
+#define VERBOSE_ENUM
+#define DRY_RUN_FLAG
+#define OUTPUT_FLAG
+#define INPUT_FLAG
+#define DIRECTORY_FLAG
+#define INTERACTIVE_FLAG
+#include stdoptions.def
+@end example
+
+@noindent
+Running a few simple commands on that definition file:
+
+@example
+autogen default-test.def
+copts="-DTEST_DEFAULT_TEST_OPTS `autoopts-config cflags`"
+lopts="`autoopts-config ldflags`"
+cc -o default-test $@{copts@} default-test.c $@{lopts@}
+@end example
+
+@noindent
+Yields a program which, when run with @file{--help}, prints out:
+
+@example
+default-test - Default Option Example - Ver. 1.0
+USAGE: default-test [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
+
+
+The following options are commonly used and are provided and supported
+by AutoOpts:
+
+ -D, --debug run program with debugging info
+ -V, --verbose=KWd run program with progress info
+ -w, --warn=num specify a warning-level threshhold
+ - disabled as --no-warn
+ -R, --dry-run program will make no changes
+ -I, --interactive=str prompt for confirmation
+ -i, --input=str redirect input from file
+ -o, --output=str redirect output to file
+ -d, --directory=str use specified dir for I/O
+
+version, usage and configuration options:
+
+ -v, --version[=arg] Output version information and exit
+ -?, --help Display extended usage information and exit
+ -!, --more-help Extended usage information passed thru pager
+ -u, --usage Abbreviated usage to stdout
+ ->, --save-opts[=arg] Save the option state to a config file
+ -<, --load-opts=str Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+The following option preset mechanisms are supported:
+ - reading file $$/../share/default-test
+ - reading file $HOME/.default_testrc
+ - reading file ./.default_testrc
+ - examining environment variables named DEFAULT_TEST_*
+
+The valid "verbose" option keywords are:
+ silent quiet brief informative verbose
+ or an integer from 0 through 4
+Packaged by Bruce (2012-08-11)
+Report default_test bugs to bkorb@@gnu.org
+@end example
+@ignore
+START == AUTOOPTS-API == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node AutoOpts API
+@section Programmatic Interface
+@cindex AutoOpts API
+
+The user interface for access to the argument information is completely
+defined in the generated header file and in the portions of the
+distributed file "options.h" that are marked "public".
+
+In the following macros, text marked @code{<NAME>} or @code{name}
+is the name of the option @strong{in upper case} and @strong{segmented
+with underscores @code{_}}. The macros and enumerations defined in the
+options header (interface) file are used as follows:
+
+To see how these @code{#define} macros are used in a program,
+the reader is referred to the several @file{opts.h} files
+included with the AutoGen sources.
+
+@menu
+* Option Processing Data:: Data for Option Processing
+* CLEAR_OPT:: CLEAR_OPT( <NAME> ) - Clear Option Markings
+* COUNT_OPT:: COUNT_OPT( <NAME> ) - Definition Count
+* DESC:: DESC( <NAME> ) - Option Descriptor
+* DISABLE_OPT_name:: DISABLE_OPT_name - Disable an option
+* ENABLED_OPT:: ENABLED_OPT( <NAME> ) - Is Option Enabled?
+* ERRSKIP_OPTERR:: ERRSKIP_OPTERR - Ignore Option Errors
+* ERRSTOP_OPTERR:: ERRSTOP_OPTERR - Stop on Errors
+* HAVE_OPT:: HAVE_OPT( <NAME> ) - Have this option?
+* ISSEL_OPT:: ISSEL_OPT( <NAME> ) - Is Option Selected?
+* ISUNUSED_OPT:: ISUNUSED_OPT( <NAME> ) - Never Specified?
+* OPTION_CT:: OPTION_CT - Full Count of Options
+* OPT_ARG:: OPT_ARG( <NAME> ) - Option Argument String
+* OPT_NO_XLAT_CFG_NAMES:: OPT_NO_XLAT_CFG_NAMES - option name xlation
+* OPT_NO_XLAT_OPT_NAMES:: OPT_NO_XLAT_OPT_NAMES - option name xlation
+* OPT_VALUE_name:: OPT_VALUE_name - Option Argument Value
+* OPT_XLAT_CFG_NAMES:: OPT_XLAT_CFG_NAMES - option name xlation
+* OPT_XLAT_OPT_NAMES:: OPT_XLAT_OPT_NAMES - option name xlation
+* RESTART_OPT:: RESTART_OPT( n ) - Resume Option Processing
+* SET_OPT_name:: SET_OPT_name - Force an option to be set
+* STACKCT_OPT:: STACKCT_OPT( <NAME> ) - Stacked Arg Count
+* STACKLST_OPT:: STACKLST_OPT( <NAME> ) - Argument Stack
+* START_OPT:: START_OPT - Restart Option Processing
+* STATE_OPT:: STATE_OPT( <NAME> ) - Option State
+* USAGE:: USAGE( exit-code ) - Usage invocation macro
+* VALUE_OPT_name:: VALUE_OPT_name - Option Flag Value
+* VERSION:: VERSION - Version and Full Version
+* WHICH_IDX_name:: WHICH_IDX_name - Which Equivalenced Index
+* WHICH_OPT_name:: WHICH_OPT_name - Which Equivalenced Option
+* teOptIndex:: teOptIndex - Option Index and Enumeration
+* OPTIONS_STRUCT_VERSION:: OPTIONS_STRUCT_VERSION - active version
+* libopts procedures:: libopts External Procedures
+@end menu
+
+@node Option Processing Data
+@subsection Data for Option Processing
+@cindex Option Processing Data
+
+This section describes the data that may be accessed from within the
+option processing callback routines. The following fields may be used
+in the following ways and may be used for read only. The first set is
+addressed from the @code{tOptDesc*} pointer:
+
+@table @samp
+@cindex optIndex
+@item optIndex
+@cindex optValue
+@item optValue
+These may be used by option procedures to determine which option they
+are working on (in case they handle several options).
+
+@cindex optActualIndex
+@item optActualIndex
+@cindex optActualValue
+@item optActualValue
+These may be used by option procedures to determine which option was
+used to set the current option. This may be different from the above if
+the options are members of an equivalence class.
+
+@cindex optOccCt
+@item optOccCt
+If AutoOpts is processing command line arguments, then this value will
+contain the current occurrence count. During the option preset phase
+(reading configuration files and examining environment variables), the value is
+zero.
+
+@cindex fOptState
+@item fOptState
+The field may be tested for the following bit values
+(prefix each name with @code{OPTST_}, e.g. @code{OPTST_INIT}):
+
+@table @samp
+@item INIT
+Initial compiled value. As a bit test, it will always yield FALSE.
+
+@item SET
+The option was set via the @code{SET_OPT()} macro.
+
+@item PRESET
+@cindex configuration file
+The option was set via a configuration file.
+
+@item DEFINED
+The option was set via a command line option.
+
+@item SET_MASK
+This is a mask of flags that show the set state, one of the
+above four values.
+
+@item EQUIVALENCE
+This bit is set when the option was selected by an equivalenced option.
+
+@item DISABLED
+This bit is set if the option is to be disabled.
+(Meaning it was a long option prefixed by the disablement prefix, or
+the option has not been specified yet and initializes as @code{disabled}.)
+@end table
+
+As an example of how this might be used, in AutoGen I want to allow
+template writers to specify that the template output can be left
+in a writable or read-only state. To support this, there is a Guile
+function named @code{set-writable} (@pxref{SCM set-writable}).
+Also, I provide for command options @code{--writable} and
+@code{--not-writable}. I give precedence to command line and RC
+file options, thus:
+
+@example
+switch (STATE_OPT( WRITABLE )) @{
+case OPTST_DEFINED:
+case OPTST_PRESET:
+ fprintf(stderr, zOverrideWarn, pCurTemplate->pzFileName,
+ pCurMacro->lineNo);
+ break;
+
+default:
+ if (gh_boolean_p( set ) && (set == SCM_BOOL_F))
+ CLEAR_OPT( WRITABLE );
+ else
+ SET_OPT_WRITABLE;
+@}
+@end example
+
+@cindex pzLastArg
+@item pzLastArg
+Pointer to the latest argument string. BEWARE@: If the argument type
+is numeric, an enumeration or a bit mask, then this will be the
+argument @strong{value} and not a pointer to a string.
+@end table
+
+The following two fields are addressed from the @code{tOptions*} pointer:
+
+@table @samp
+@cindex pzProgName
+@item pzProgName
+Points to a NUL-terminated string containing the current program
+name, as retrieved from the argument vector.
+
+@cindex pzProgPath
+@item pzProgPath
+Points to a NUL-terminated string containing the full path of
+the current program, as retrieved from the argument vector.
+(If available on your system.)
+
+@end table
+
+Note@: these fields get filled in during the first call to
+@code{optionProcess()}. All other fields are private, for the exclusive
+use of AutoOpts code and are subject to change.
+
+@node CLEAR_OPT
+@subsection CLEAR_OPT( <NAME> ) - Clear Option Markings
+@findex CLEAR_OPT
+
+Make as if the option had never been specified.
+@code{HAVE_OPT(<NAME>)} will yield @code{FALSE}
+after invoking this macro.
+
+@node COUNT_OPT
+@subsection COUNT_OPT( <NAME> ) - Definition Count
+@findex COUNT_OPT
+
+This macro will tell you how many times the option was
+specified on the command line. It does not include counts
+of preset options.
+
+@example
+if (COUNT_OPT( NAME ) != desired-count) @{
+ make-an-undesirable-message.
+@}
+@end example
+
+@node DESC
+@subsection DESC( <NAME> ) - Option Descriptor
+@findex DESC
+
+This macro is used internally by other AutoOpt macros.
+It is not for general use. It is used to obtain the option description
+corresponding to its @strong{UPPER CASED} option name argument.
+This is primarily used in other macro definitions.
+
+@node DISABLE_OPT_name
+@subsection DISABLE_OPT_name - Disable an option
+@findex DISABLE_OPT_name
+
+This macro is emitted if it is both settable
+and it can be disabled. If it cannot be disabled, it may
+always be CLEAR-ed (see above).
+
+The form of the macro will actually depend on whether the
+option is equivalenced to another, and/or has an assigned
+handler procedure. Unlike the @code{SET_OPT} macro,
+this macro does not allow an option argument.
+
+@example
+DISABLE_OPT_NAME;
+@end example
+
+@node ENABLED_OPT
+@subsection ENABLED_OPT( <NAME> ) - Is Option Enabled?
+@findex ENABLED_OPT
+
+Yields true if the option defaults to disabled and
+@code{ISUNUSED_OPT()} would yield true. It also yields true if
+the option has been specified with a disablement prefix,
+disablement value or the @code{DISABLE_OPT_NAME} macro was invoked.
+
+@node ERRSKIP_OPTERR
+@subsection ERRSKIP_OPTERR - Ignore Option Errors
+@findex ERRSKIP_OPTERR
+
+When it is necessary to continue (return to caller)
+on option errors, invoke this option. It is reversible.
+@xref{ERRSTOP_OPTERR}.
+
+@node ERRSTOP_OPTERR
+@subsection ERRSTOP_OPTERR - Stop on Errors
+@findex ERRSTOP_OPTERR
+
+After invoking this macro, if @code{optionProcess()}
+encounters an error, it will call @code{exit(1)} rather than return.
+This is the default processing mode. It can be overridden by
+specifying @code{allow-errors} in the definitions file,
+or invoking the macro @xref{ERRSKIP_OPTERR}.
+
+@node HAVE_OPT
+@subsection HAVE_OPT( <NAME> ) - Have this option?
+@findex HAVE_OPT
+
+This macro yields true if the option has been specified
+in any fashion at all. It is used thus:
+
+@example
+if (HAVE_OPT( NAME )) @{
+ <do-things-associated-with-opt-name>;
+@}
+@end example
+
+@node ISSEL_OPT
+@subsection ISSEL_OPT( <NAME> ) - Is Option Selected?
+@findex ISSEL_OPT
+
+This macro yields true if the option has been
+specified either on the command line or via a SET/DISABLE macro.
+
+@node ISUNUSED_OPT
+@subsection ISUNUSED_OPT( <NAME> ) - Never Specified?
+@findex ISUNUSED_OPT
+
+This macro yields true if the option has
+never been specified, or has been cleared via the
+@code{CLEAR_OPT()} macro.
+
+@node OPTION_CT
+@subsection OPTION_CT - Full Count of Options
+@findex OPTION_CT
+
+The full count of all options, both those defined
+and those generated automatically by AutoOpts. This is primarily
+used to initialize the program option descriptor structure.
+
+@node OPT_ARG
+@subsection OPT_ARG( <NAME> ) - Option Argument String
+@findex OPT_ARG
+
+The option argument value as a pointer to string. Note that argument
+values that have been specified as numbers are stored as numbers or
+keywords. For such options, use instead the @code{OPT_VALUE_name}
+define. It is used thus:
+
+@example
+if (HAVE_OPT( NAME )) @{
+ char* p = OPT_ARG( NAME );
+ <do-things-with-opt-name-argument-string>;
+@}
+@end example
+
+@node OPT_NO_XLAT_CFG_NAMES
+@subsection OPT_NO_XLAT_CFG_NAMES - option name xlation
+@findex OPT_NO_XLAT_CFG_NAMES
+
+Invoking this macro will disable the translation of option names only while
+processing configuration files and environment variables. This must be
+invoked before the first call to @code{optionProcess}.. You need not invoke
+this if your option definition file contains the attribute assignment,
+``@code{no-xlate = opt-cfg;}''.
+
+@node OPT_NO_XLAT_OPT_NAMES
+@subsection OPT_NO_XLAT_OPT_NAMES - option name xlation
+@findex OPT_NO_XLAT_OPT_NAMES
+
+Invoking this macro will completely disable the translation of option names.
+This must be invoked before the first call to @code{optionProcess}. You need
+not invoke this if your option definition file contains the attribute
+assignment, ``@code{no-xlate = opt;}''.
+
+@node OPT_VALUE_name
+@subsection OPT_VALUE_name - Option Argument Value
+@findex OPT_VALUE_name
+
+This macro gets emitted only for options that take numeric, keyword or set
+membership arguments. The macro yields a word-sized integer containing the
+enumeration, bit set or numeric value for the option argument.
+
+@example
+int opt_val = OPT_VALUE_name;
+@end example
+
+@node OPT_XLAT_CFG_NAMES
+@subsection OPT_XLAT_CFG_NAMES - option name xlation
+@findex OPT_XLAT_CFG_NAMES
+
+If @code{ENABLE_NLS} is defined and @code{no-xlate} has been not set to the
+value @emph{anything}, this macro will cause the translation of option names
+to happen before starting the processing of configuration files and
+environment variables. This will change the recognition of options within the
+@code{$PROGRAMNAME} environment variable, but will not alter the names used
+for setting options via @code{$PROGRAMNAME_name} environment variables.
+
+This must be invoked before the first call to @code{optionProcess}. You might
+need to use this macro if your option definition file contains the attribute
+assignment, ``@code{no-xlate = opt;}'' or ``@code{no-xlate = opt-cfg;}'', and
+you have determined in some way that you wish to override that.
+
+@node OPT_XLAT_OPT_NAMES
+@subsection OPT_XLAT_OPT_NAMES - option name xlation
+@findex OPT_XLAT_OPT_NAMES
+
+If @code{ENABLE_NLS} is defined and @code{no-xlate} has been not set to the
+value @emph{anything}, translate the option names before processing the
+command line options. Long option names may thus be localized. (If the names
+were translated before configuration processing, they will not be
+re-translated.)
+
+This must be invoked before the first call to @code{optionProcess}. You might
+need to use this macro if your option definition file contains the attribute
+assignment, ``@code{no-xlate = opt;}'' and you have determined in some way that
+you wish to override that.
+
+@node RESTART_OPT
+@subsection RESTART_OPT( n ) - Resume Option Processing
+@findex RESTART_OPT
+
+If option processing has stopped (either because of an error
+or something was encountered that looked like a program argument),
+it can be resumed by providing this macro with the index @code{n}
+of the next option to process and calling @code{optionProcess()} again.
+
+@node SET_OPT_name
+@subsection SET_OPT_name - Force an option to be set
+@findex SET_OPT_name
+
+This macro gets emitted only when the given
+option has the @code{settable} attribute specified.
+
+The form of the macro will actually depend on whether the option is
+equivalenced to another, has an option argument and/or has an assigned
+handler procedure. If the option has an argument, then this macro will
+too. Beware that the argument is not reallocated, so the value must not
+be on the stack or deallocated in any other way for as long as the value
+might get referenced.
+
+If you have supplied at least one @file{homerc} file
+(@pxref{program attributes}), this macro will be emitted for the
+@code{--save-opts} option.
+
+@example
+SET_OPT_SAVE_OPTS( "filename" );
+@end example
+
+@noindent
+@xref{automatic options}, for a discussion of the implications of using
+this particular example.
+
+@node STACKCT_OPT
+@subsection STACKCT_OPT( <NAME> ) - Stacked Arg Count
+@findex STACKCT_OPT
+
+When the option handling attribute is specified
+as @code{stack_arg}, this macro may be used to determine how
+many of them actually got stacked.
+
+Do not use this on options that have not been stacked or has not been
+specified (the @code{stack_arg} attribute must have been specified,
+and @code{HAVE_OPT(<NAME>)} must yield TRUE).
+Otherwise, you will likely seg fault.
+
+@example
+if (HAVE_OPT( NAME )) @{
+ int ct = STACKCT_OPT( NAME );
+ char** pp = STACKLST_OPT( NAME );
+
+ do @{
+ char* p = *pp++;
+ do-things-with-p;
+ @} while (--ct > 0);
+@}
+@end example
+
+@node STACKLST_OPT
+@subsection STACKLST_OPT( <NAME> ) - Argument Stack
+@findex STACKLST_OPT
+
+The address of the list of pointers to the
+option arguments. The pointers are ordered by the order in
+which they were encountered in the option presets and
+command line processing.
+
+Do not use this on options that have not been stacked or has not been
+specified (the @code{stack_arg} attribute must have been specified,
+and @code{HAVE_OPT(<OPTION>)} must yield TRUE).
+Otherwise, you will likely seg fault.
+
+@example
+if (HAVE_OPT( NAME )) @{
+ int ct = STACKCT_OPT( NAME );
+ char** pp = STACKLST_OPT( NAME );
+
+ do @{
+ char* p = *pp++;
+ do-things-with-p;
+ @} while (--ct > 0);
+@}
+@end example
+
+@node START_OPT
+@subsection START_OPT - Restart Option Processing
+@findex START_OPT
+
+This is just a shortcut for RESTART_OPT(1) (@xref{RESTART_OPT}.)
+
+@node STATE_OPT
+@subsection STATE_OPT( <NAME> ) - Option State
+@findex STATE_OPT
+
+If you need to know if an option was set because of presetting actions
+(configuration file processing or environment variables), versus a command
+line entry versus one of the SET/DISABLE macros, then use this macro. It
+will yield one of four values: @code{OPTST_INIT}, @code{OPTST_SET},
+@code{OPTST_PRESET} or @code{OPTST_DEFINED}. It is used thus:
+
+@example
+switch (STATE_OPT( NAME )) @{
+ case OPTST_INIT:
+ not-preset, set or on the command line. (unless CLEAR-ed)
+
+ case OPTST_SET:
+ option set via the SET_OPT_NAME() macro.
+
+ case OPTST_PRESET:
+ option set via an configuration file or environment variable
+
+ case OPTST_DEFINED:
+ option set via a command line option.
+
+ default:
+ cannot happen :)
+@}
+@end example
+
+@node USAGE
+@subsection USAGE( exit-code ) - Usage invocation macro
+@findex USAGE
+
+This macro invokes the procedure registered to display
+the usage text. Normally, this will be @code{optionUsage} from the
+AutoOpts library, but you may select another procedure by specifying
+@code{usage = "proc_name"} program attribute. This procedure must
+take two arguments@: first, a pointer to the option descriptor, and
+second the exit code. The macro supplies the option descriptor
+automatically. This routine is expected to call @code{exit(3)} with
+the provided exit code.
+
+The @code{optionUsage} routine also behaves differently depending
+on the exit code:
+
+@table @code
+@item EXIT_SUCCESS (the value zero)
+It is assumed that full usage help has been requested. Consequently, more
+information is provided than when displaying usage and exiting with a
+non-zero exit code. Output will be sent to @file{stdout} and the program will
+exit with a zero status code.
+
+@item EX_USAGE (64)
+The abbreviated usage will be printed to @file{stdout} and the program will
+exit with a zero status code. ``EX_USAGE'' may or may not be 64. If your
+system provides ``/usr/include/sysexits.h'' that has a different value,
+then that value will be used.
+
+@item any other value
+The abbreviated usage will be printed to stderr and the program will
+exit with the provided status code.
+@end table
+
+@node VALUE_OPT_name
+@subsection VALUE_OPT_name - Option Flag Value
+@findex VALUE_OPT_name
+
+This is a #define for the flag character used to
+specify an option on the command line. If @code{value} was not
+specified for the option, then it is a unique number associated
+with the option. @code{option value} refers to this value,
+@code{option argument} refers to the (optional) argument to the
+option.
+
+@example
+switch (WHICH_OPT_OTHER_OPT) @{
+case VALUE_OPT_NAME:
+ this-option-was-really-opt-name;
+case VALUE_OPT_OTHER_OPT:
+ this-option-was-really-other-opt;
+@}
+@end example
+
+@node VERSION
+@subsection VERSION - Version and Full Version
+@findex VERSION
+
+If the @code{version} attribute is defined for the program,
+then a stringified version will be #defined as PROGRAM_VERSION and
+PROGRAM_FULL_VERSION. PROGRAM_FULL_VERSION is used for printing
+the program version in response to the version option. The version
+option is automatically supplied in response to this attribute, too.
+
+You may access PROGRAM_VERSION via @code{programOptions.pzFullVersion}.
+
+@node WHICH_IDX_name
+@subsection WHICH_IDX_name - Which Equivalenced Index
+@findex WHICH_IDX_name
+
+This macro gets emitted only for equivalenced-to options. It is used to
+obtain the index for the one of the several equivalence class members
+set the equivalenced-to option.
+
+@example
+switch (WHICH_IDX_OTHER_OPT) @{
+case INDEX_OPT_NAME:
+ this-option-was-really-opt-name;
+case INDEX_OPT_OTHER_OPT:
+ this-option-was-really-other-opt;
+@}
+@end example
+
+@node WHICH_OPT_name
+@subsection WHICH_OPT_name - Which Equivalenced Option
+@findex WHICH_OPT_name
+
+This macro gets emitted only for equivalenced-to options. It is used to
+obtain the value code for the one of the several equivalence class members
+set the equivalenced-to option.
+
+@example
+switch (WHICH_OPT_OTHER_OPT) @{
+case VALUE_OPT_NAME:
+ this-option-was-really-opt-name;
+case VALUE_OPT_OTHER_OPT:
+ this-option-was-really-other-opt;
+@}
+@end example
+
+@node teOptIndex
+@subsection teOptIndex - Option Index and Enumeration
+@findex teOptIndex
+
+This enum defines the complete set of options, both
+user specified and automatically provided. This can be used,
+for example, to distinguish which of the equivalenced options
+was actually used.
+
+@example
+switch (pOptDesc->optActualIndex) @{
+case INDEX_OPT_FIRST:
+ stuff;
+case INDEX_OPT_DIFFERENT:
+ different-stuff;
+default:
+ unknown-things;
+@}
+@end example
+
+@node OPTIONS_STRUCT_VERSION
+@subsection OPTIONS_STRUCT_VERSION - active version
+
+You will not actually need to reference this value, but you need to be
+aware that it is there. It is the first value in the option descriptor
+that you pass to @code{optionProcess}. It contains a magic number and
+version information. Normally, you should be able to work with a more
+recent option library than the one you compiled with. However, if the
+library is changed incompatibly, then the library will detect the out of
+date magic marker, explain the difficulty and exit. You will then need
+to rebuild and recompile your option definitions. This has rarely been
+necessary.
+
+@ignore
+END == AUTOOPTS-API == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+@node libopts procedures
+@subsection libopts External Procedures
+
+These are the routines that libopts users may call directly from their
+code. There are several other routines that can be called by code
+generated by the libopts option templates, but they are not to be
+called from any other user code. The @file{options.h} header is
+fairly clear about this, too.
+
+@menu
+* libopts-ao_string_tokenize:: ao_string_tokenize
+* libopts-configFileLoad:: configFileLoad
+* libopts-optionFileLoad:: optionFileLoad
+* libopts-optionFindNextValue:: optionFindNextValue
+* libopts-optionFindValue:: optionFindValue
+* libopts-optionFree:: optionFree
+* libopts-optionGetValue:: optionGetValue
+* libopts-optionLoadLine:: optionLoadLine
+* libopts-optionNextValue:: optionNextValue
+* libopts-optionOnlyUsage:: optionOnlyUsage
+* libopts-optionProcess:: optionProcess
+* libopts-optionRestore:: optionRestore
+* libopts-optionSaveFile:: optionSaveFile
+* libopts-optionSaveState:: optionSaveState
+* libopts-optionUnloadNested:: optionUnloadNested
+* libopts-optionVersion:: optionVersion
+* libopts-pathfind:: pathfind
+* libopts-strequate:: strequate
+* libopts-streqvcmp:: streqvcmp
+* libopts-streqvmap:: streqvmap
+* libopts-strneqvcmp:: strneqvcmp
+* libopts-strtransform:: strtransform
+@end menu
+
+This subsection was automatically generated by AutoGen
+using extracted information and the aginfo3.tpl template.
+
+@node libopts-ao_string_tokenize
+@subsubsection ao_string_tokenize
+@findex ao_string_tokenize
+
+tokenize an input string
+
+@noindent
+Usage:
+@example
+token_list_t* res = ao_string_tokenize( string );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab string @tab @code{char const*}
+@tab string to be tokenized
+@item @tab returns @tab token_list_t*
+@tab pointer to a structure that lists each token
+@end multitable
+
+This function will convert one input string into a list of strings.
+The list of strings is derived by separating the input based on
+white space separation. However, if the input contains either single
+or double quote characters, then the text after that character up to
+a matching quote will become the string in the list.
+
+The returned pointer should be deallocated with @code{free(3C)} when
+are done using the data. The data are placed in a single block of
+allocated memory. Do not deallocate individual token/strings.
+
+The structure pointed to will contain at least these two fields:
+@table @samp
+@item tkn_ct
+The number of tokens found in the input string.
+@item tok_list
+An array of @code{tkn_ct + 1} pointers to substring tokens, with
+the last pointer set to NULL.
+@end table
+
+There are two types of quoted strings: single quoted (@code{'}) and
+double quoted (@code{"}). Singly quoted strings are fairly raw in that
+escape characters (@code{\\}) are simply another character, except when
+preceding the following characters:
+@example
+@code{\\} double backslashes reduce to one
+@code{'} incorporates the single quote into the string
+@code{\n} suppresses both the backslash and newline character
+@end example
+
+Double quote strings are formed according to the rules of string
+constants in ANSI-C programs.
+
+NULL is returned and @code{errno} will be set to indicate the problem:
+@itemize @bullet
+@item
+@code{EINVAL} - There was an unterminated quoted string.
+@item
+@code{ENOENT} - The input string was empty.
+@item
+@code{ENOMEM} - There is not enough memory.
+@end itemize
+
+
+@node libopts-configFileLoad
+@subsubsection configFileLoad
+@findex configFileLoad
+
+parse a configuration file
+
+@noindent
+Usage:
+@example
+const tOptionValue* res = configFileLoad( pzFile );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pzFile @tab @code{char const*}
+@tab the file to load
+@item @tab returns @tab const tOptionValue*
+@tab An allocated, compound value structure
+@end multitable
+
+This routine will load a named configuration file and parse the
+text as a hierarchically valued option. The option descriptor
+created from an option definition file is not used via this interface.
+The returned value is "named" with the input file name and is of
+type "@code{OPARG_TYPE_HIERARCHY}". It may be used in calls to
+@code{optionGetValue()}, @code{optionNextValue()} and
+@code{optionUnloadNested()}.
+
+If the file cannot be loaded or processed, @code{NULL} is returned and
+@var{errno} is set. It may be set by a call to either @code{open(2)}
+@code{mmap(2)} or other file system calls, or it may be:
+@itemize @bullet
+@item
+@code{ENOENT} - the file was not found.
+@item
+@code{ENOMSG} - the file was empty.
+@item
+@code{EINVAL} - the file contents are invalid -- not properly formed.
+@item
+@code{ENOMEM} - not enough memory to allocate the needed structures.
+@end itemize
+
+
+@node libopts-optionFileLoad
+@subsubsection optionFileLoad
+@findex optionFileLoad
+
+Load the locatable config files, in order
+
+@noindent
+Usage:
+@example
+int res = optionFileLoad( pOpts, pzProg );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+
+@item @tab pzProg @tab @code{char const*}
+@tab program name
+@item @tab returns @tab int
+@tab 0 -> SUCCESS, -1 -> FAILURE
+@end multitable
+
+This function looks in all the specified directories for a configuration
+file ("rc" file or "ini" file) and processes any found twice. The first
+time through, they are processed in reverse order (last file first). At
+that time, only "immediate action" configurables are processed. For
+example, if the last named file specifies not processing any more
+configuration files, then no more configuration files will be processed.
+Such an option in the @strong{first} named directory will have no effect.
+
+Once the immediate action configurables have been handled, then the
+directories are handled in normal, forward order. In that way, later
+config files can override the settings of earlier config files.
+
+See the AutoOpts documentation for a thorough discussion of the
+config file format.
+
+Configuration files not found or not decipherable are simply ignored.
+
+Returns the value, "-1" if the program options descriptor
+is out of date or indecipherable. Otherwise, the value "0" will
+always be returned.
+
+
+@node libopts-optionFindNextValue
+@subsubsection optionFindNextValue
+@findex optionFindNextValue
+
+find a hierarcicaly valued option instance
+
+@noindent
+Usage:
+@example
+const tOptionValue* res = optionFindNextValue( pOptDesc, pPrevVal, name, value );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOptDesc @tab @code{const tOptDesc*}
+@tab an option with a nested arg type
+
+@item @tab pPrevVal @tab @code{const tOptionValue*}
+@tab the last entry
+
+@item @tab name @tab @code{char const*}
+@tab name of value to find
+
+@item @tab value @tab @code{char const*}
+@tab the matching value
+@item @tab returns @tab const tOptionValue*
+@tab a compound value structure
+@end multitable
+
+This routine will find the next entry in a nested value option or
+configurable. It will search through the list and return the next entry
+that matches the criteria.
+
+The returned result is NULL and errno is set:
+@itemize @bullet
+@item
+@code{EINVAL} - the @code{pOptValue} does not point to a valid
+hierarchical option value.
+@item
+@code{ENOENT} - no entry matched the given name.
+@end itemize
+
+
+@node libopts-optionFindValue
+@subsubsection optionFindValue
+@findex optionFindValue
+
+find a hierarcicaly valued option instance
+
+@noindent
+Usage:
+@example
+const tOptionValue* res = optionFindValue( pOptDesc, name, value );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOptDesc @tab @code{const tOptDesc*}
+@tab an option with a nested arg type
+
+@item @tab name @tab @code{char const*}
+@tab name of value to find
+
+@item @tab value @tab @code{char const*}
+@tab the matching value
+@item @tab returns @tab const tOptionValue*
+@tab a compound value structure
+@end multitable
+
+This routine will find an entry in a nested value option or configurable.
+It will search through the list and return a matching entry.
+
+The returned result is NULL and errno is set:
+@itemize @bullet
+@item
+@code{EINVAL} - the @code{pOptValue} does not point to a valid
+hierarchical option value.
+@item
+@code{ENOENT} - no entry matched the given name.
+@end itemize
+
+
+@node libopts-optionFree
+@subsubsection optionFree
+@findex optionFree
+
+free allocated option processing memory
+
+@noindent
+Usage:
+@example
+optionFree( pOpts );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+@end multitable
+
+AutoOpts sometimes allocates memory and puts pointers to it in the
+option state structures. This routine deallocates all such memory.
+
+As long as memory has not been corrupted,
+this routine is always successful.
+
+
+@node libopts-optionGetValue
+@subsubsection optionGetValue
+@findex optionGetValue
+
+get a specific value from a hierarcical list
+
+@noindent
+Usage:
+@example
+const tOptionValue* res = optionGetValue( pOptValue, valueName );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOptValue @tab @code{const tOptionValue*}
+@tab a hierarchcal value
+
+@item @tab valueName @tab @code{char const*}
+@tab name of value to get
+@item @tab returns @tab const tOptionValue*
+@tab a compound value structure
+@end multitable
+
+This routine will find an entry in a nested value option or configurable.
+If "valueName" is NULL, then the first entry is returned. Otherwise,
+the first entry with a name that exactly matches the argument will be
+returned. If there is no matching value, NULL is returned and errno is
+set to ENOENT. If the provided option value is not a hierarchical value,
+NULL is also returned and errno is set to EINVAL.
+
+The returned result is NULL and errno is set:
+@itemize @bullet
+@item
+@code{EINVAL} - the @code{pOptValue} does not point to a valid
+hierarchical option value.
+@item
+@code{ENOENT} - no entry matched the given name.
+@end itemize
+
+
+@node libopts-optionLoadLine
+@subsubsection optionLoadLine
+@findex optionLoadLine
+
+process a string for an option name and value
+
+@noindent
+Usage:
+@example
+optionLoadLine( opts, line );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab opts @tab @code{tOptions*}
+@tab program options descriptor
+
+@item @tab line @tab @code{char const*}
+@tab NUL-terminated text
+@end multitable
+
+This is a client program callable routine for setting options from, for
+example, the contents of a file that they read in. Only one option may
+appear in the text. It will be treated as a normal (non-preset) option.
+
+When passed a pointer to the option struct and a string, it will find
+the option named by the first token on the string and set the option
+argument to the remainder of the string. The caller must NUL terminate
+the string. The caller need not skip over any introductory hyphens.
+Any embedded new lines will be included in the option
+argument. If the input looks like one or more quoted strings, then the
+input will be "cooked". The "cooking" is identical to the string
+formation used in AutoGen definition files (@pxref{basic expression}),
+except that you may not use backquotes.
+
+Invalid options are silently ignored. Invalid option arguments
+will cause a warning to print, but the function should return.
+
+
+@node libopts-optionNextValue
+@subsubsection optionNextValue
+@findex optionNextValue
+
+get the next value from a hierarchical list
+
+@noindent
+Usage:
+@example
+const tOptionValue* res = optionNextValue( pOptValue, pOldValue );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOptValue @tab @code{const tOptionValue*}
+@tab a hierarchcal list value
+
+@item @tab pOldValue @tab @code{const tOptionValue*}
+@tab a value from this list
+@item @tab returns @tab const tOptionValue*
+@tab a compound value structure
+@end multitable
+
+This routine will return the next entry after the entry passed in. At the
+end of the list, NULL will be returned. If the entry is not found on the
+list, NULL will be returned and "@var{errno}" will be set to EINVAL.
+The "@var{pOldValue}" must have been gotten from a prior call to this
+routine or to "@code{opitonGetValue()}".
+
+The returned result is NULL and errno is set:
+@itemize @bullet
+@item
+@code{EINVAL} - the @code{pOptValue} does not point to a valid
+hierarchical option value or @code{pOldValue} does not point to a
+member of that option value.
+@item
+@code{ENOENT} - the supplied @code{pOldValue} pointed to the last entry.
+@end itemize
+
+
+@node libopts-optionOnlyUsage
+@subsubsection optionOnlyUsage
+@findex optionOnlyUsage
+
+Print usage text for just the options
+
+@noindent
+Usage:
+@example
+optionOnlyUsage( pOpts, ex_code );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+
+@item @tab ex_code @tab @code{int}
+@tab exit code for calling exit(3)
+@end multitable
+
+This routine will print only the usage for each option.
+This function may be used when the emitted usage must incorporate
+information not available to AutoOpts.
+
+
+@node libopts-optionProcess
+@subsubsection optionProcess
+@findex optionProcess
+
+this is the main option processing routine
+
+@noindent
+Usage:
+@example
+int res = optionProcess( pOpts, argc, argv );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+
+@item @tab argc @tab @code{int}
+@tab program arg count
+
+@item @tab argv @tab @code{char**}
+@tab program arg vector
+@item @tab returns @tab int
+@tab the count of the arguments processed
+@end multitable
+
+This is the main entry point for processing options. It is intended
+that this procedure be called once at the beginning of the execution of
+a program. Depending on options selected earlier, it is sometimes
+necessary to stop and restart option processing, or to select completely
+different sets of options. This can be done easily, but you generally
+do not want to do this.
+
+The number of arguments processed always includes the program name.
+If one of the arguments is "--", then it is counted and the processing
+stops. If an error was encountered and errors are to be tolerated, then
+the returned value is the index of the argument causing the error.
+A hyphen by itself ("-") will also cause processing to stop and will
+@emph{not} be counted among the processed arguments. A hyphen by itself
+is treated as an operand. Encountering an operand stops option
+processing.
+
+Errors will cause diagnostics to be printed. @code{exit(3)} may
+or may not be called. It depends upon whether or not the options
+were generated with the "allow-errors" attribute, or if the
+ERRSKIP_OPTERR or ERRSTOP_OPTERR macros were invoked.
+
+
+@node libopts-optionRestore
+@subsubsection optionRestore
+@findex optionRestore
+
+restore option state from memory copy
+
+@noindent
+Usage:
+@example
+optionRestore( pOpts );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+@end multitable
+
+Copy back the option state from saved memory.
+The allocated memory is left intact, so this routine can be
+called repeatedly without having to call optionSaveState again.
+If you are restoring a state that was saved before the first call
+to optionProcess(3AO), then you may change the contents of the
+argc/argv parameters to optionProcess.
+
+If you have not called @code{optionSaveState} before, a diagnostic is
+printed to @code{stderr} and exit is called.
+
+
+@node libopts-optionSaveFile
+@subsubsection optionSaveFile
+@findex optionSaveFile
+
+saves the option state to a file
+
+@noindent
+Usage:
+@example
+optionSaveFile( pOpts );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+@end multitable
+
+This routine will save the state of option processing to a file. The name
+of that file can be specified with the argument to the @code{--save-opts}
+option, or by appending the @code{rcfile} attribute to the last
+@code{homerc} attribute. If no @code{rcfile} attribute was specified, it
+will default to @code{.@i{programname}rc}. If you wish to specify another
+file, you should invoke the @code{SET_OPT_SAVE_OPTS(@i{filename})} macro.
+
+The recommend usage is as follows:
+@example
+optionProcess(&progOptions, argc, argv);
+if (i_want_a_non_standard_place_for_this)
+SET_OPT_SAVE_OPTS("myfilename");
+optionSaveFile(&progOptions);
+@end example
+
+If no @code{homerc} file was specified, this routine will silently return
+and do nothing. If the output file cannot be created or updated, a message
+will be printed to @code{stderr} and the routine will return.
+
+
+@node libopts-optionSaveState
+@subsubsection optionSaveState
+@findex optionSaveState
+
+saves the option state to memory
+
+@noindent
+Usage:
+@example
+optionSaveState( pOpts );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+@end multitable
+
+This routine will allocate enough memory to save the current option
+processing state. If this routine has been called before, that memory
+will be reused. You may only save one copy of the option state. This
+routine may be called before optionProcess(3AO). If you do call it
+before the first call to optionProcess, then you may also change the
+contents of argc/argv after you call optionRestore(3AO)
+
+In fact, more strongly put: it is safest to only use this function
+before having processed any options. In particular, the saving and
+restoring of stacked string arguments and hierarchical values is
+disabled. The values are not saved.
+
+If it fails to allocate the memory,
+it will print a message to stderr and exit.
+Otherwise, it will always succeed.
+
+
+@node libopts-optionUnloadNested
+@subsubsection optionUnloadNested
+@findex optionUnloadNested
+
+Deallocate the memory for a nested value
+
+@noindent
+Usage:
+@example
+optionUnloadNested( pOptVal );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOptVal @tab @code{tOptionValue const *}
+@tab the hierarchical value
+@end multitable
+
+A nested value needs to be deallocated. The pointer passed in should
+have been gotten from a call to @code{configFileLoad()} (See
+@pxref{libopts-configFileLoad}).
+
+
+@node libopts-optionVersion
+@subsubsection optionVersion
+@findex optionVersion
+
+return the compiled AutoOpts version number
+
+@noindent
+Usage:
+@example
+char const* res = optionVersion();
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab returns @tab char const*
+@tab the version string in constant memory
+@end multitable
+
+Returns the full version string compiled into the library.
+The returned string cannot be modified.
+
+
+@node libopts-pathfind
+@subsubsection pathfind
+@findex pathfind
+
+fild a file in a list of directories
+
+@noindent
+Usage:
+@example
+char* res = pathfind( path, file, mode );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab path @tab @code{char const*}
+@tab colon separated list of search directories
+
+@item @tab file @tab @code{char const*}
+@tab the name of the file to look for
+
+@item @tab mode @tab @code{char const*}
+@tab the mode bits that must be set to match
+@item @tab returns @tab char*
+@tab the path to the located file
+@end multitable
+
+pathfind looks for a a file with name "FILE" and "MODE" access
+along colon delimited "PATH", and returns the full pathname as a
+string, or NULL if not found. If "FILE" contains a slash, then
+it is treated as a relative or absolute path and "PATH" is ignored.
+
+@strong{NOTE}: this function is compiled into @file{libopts} only if
+it is not natively supplied.
+
+The "MODE" argument is a string of option letters chosen from the
+list below:
+@example
+Letter Meaning
+r readable
+w writable
+x executable
+f normal file (NOT IMPLEMENTED)
+b block special (NOT IMPLEMENTED)
+c character special (NOT IMPLEMENTED)
+d directory (NOT IMPLEMENTED)
+p FIFO (pipe) (NOT IMPLEMENTED)
+u set user ID bit (NOT IMPLEMENTED)
+g set group ID bit (NOT IMPLEMENTED)
+k sticky bit (NOT IMPLEMENTED)
+s size nonzero (NOT IMPLEMENTED)
+@end example
+
+returns NULL if the file is not found.
+
+
+@node libopts-strequate
+@subsubsection strequate
+@findex strequate
+
+map a list of characters to the same value
+
+@noindent
+Usage:
+@example
+strequate( ch_list );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab ch_list @tab @code{char const*}
+@tab characters to equivalence
+@end multitable
+
+Each character in the input string get mapped to the first character
+in the string.
+This function name is mapped to option_strequate so as to not conflict
+with the POSIX name space.
+
+none.
+
+
+@node libopts-streqvcmp
+@subsubsection streqvcmp
+@findex streqvcmp
+
+compare two strings with an equivalence mapping
+
+@noindent
+Usage:
+@example
+int res = streqvcmp( str1, str2 );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab str1 @tab @code{char const*}
+@tab first string
+
+@item @tab str2 @tab @code{char const*}
+@tab second string
+@item @tab returns @tab int
+@tab the difference between two differing characters
+@end multitable
+
+Using a character mapping, two strings are compared for "equivalence".
+Each input character is mapped to a comparison character and the
+mapped-to characters are compared for the two NUL terminated input strings.
+This function name is mapped to option_streqvcmp so as to not conflict
+with the POSIX name space.
+
+none checked. Caller responsible for seg faults.
+
+
+@node libopts-streqvmap
+@subsubsection streqvmap
+@findex streqvmap
+
+Set the character mappings for the streqv functions
+
+@noindent
+Usage:
+@example
+streqvmap( From, To, ct );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab From @tab @code{char}
+@tab Input character
+
+@item @tab To @tab @code{char}
+@tab Mapped-to character
+
+@item @tab ct @tab @code{int}
+@tab compare length
+@end multitable
+
+Set the character mapping. If the count (@code{ct}) is set to zero, then
+the map is cleared by setting all entries in the map to their index
+value. Otherwise, the "@code{From}" character is mapped to the "@code{To}"
+character. If @code{ct} is greater than 1, then @code{From} and @code{To}
+are incremented and the process repeated until @code{ct} entries have been
+set. For example,
+@example
+streqvmap('a', 'A', 26);
+@end example
+@noindent
+will alter the mapping so that all English lower case letters
+will map to upper case.
+
+This function name is mapped to option_streqvmap so as to not conflict
+with the POSIX name space.
+
+none.
+
+
+@node libopts-strneqvcmp
+@subsubsection strneqvcmp
+@findex strneqvcmp
+
+compare two strings with an equivalence mapping
+
+@noindent
+Usage:
+@example
+int res = strneqvcmp( str1, str2, ct );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab str1 @tab @code{char const*}
+@tab first string
+
+@item @tab str2 @tab @code{char const*}
+@tab second string
+
+@item @tab ct @tab @code{int}
+@tab compare length
+@item @tab returns @tab int
+@tab the difference between two differing characters
+@end multitable
+
+Using a character mapping, two strings are compared for "equivalence".
+Each input character is mapped to a comparison character and the
+mapped-to characters are compared for the two NUL terminated input strings.
+The comparison is limited to @code{ct} bytes.
+This function name is mapped to option_strneqvcmp so as to not conflict
+with the POSIX name space.
+
+none checked. Caller responsible for seg faults.
+
+
+@node libopts-strtransform
+@subsubsection strtransform
+@findex strtransform
+
+convert a string into its mapped-to value
+
+@noindent
+Usage:
+@example
+strtransform( dest, src );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab dest @tab @code{char*}
+@tab output string
+
+@item @tab src @tab @code{char const*}
+@tab input string
+@end multitable
+
+Each character in the input string is mapped and the mapped-to
+character is put into the output.
+This function name is mapped to option_strtransform so as to not conflict
+with the POSIX name space.
+
+The source and destination may be the same.
+
+none.
+@ignore
+START == AUTOOPTS-DATA == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node Multi-Threading
+@section Multi-Threading
+
+AutoOpts was designed to configure a program for running. This generally
+happens before much real work has been started. Consequently, it is
+expected to be run before multi-threaded applications have started multiple
+threads. However, this is not always the case. Some applications may
+need to reset and reload their running configuration, and some may use
+@code{SET_OPT_xxx()} macros during processing. If you need to dynamically
+change your option configuration in your multi-threaded application, it is
+your responsibility to prevent all threads from accessing the option
+configuration state, except the one altering the configuration.
+
+The various accessor macros (@code{HAVE_OPT()}, etc.) do not modify state
+and are safe to use in a multi-threaded application. It is safe as long
+as no other thread is concurrently modifying state, of course.
+
+@c === SECTION MARKER
+
+@node option descriptor
+@section Option Descriptor File
+@cindex option descriptor
+
+This is the module that is to be compiled and linked with your program.
+It contains internal data and procedures subject to change. Basically,
+it contains a single global data structure containing all the
+information provided in the option definitions, plus a number of static
+strings and any callout procedures that are specified or required. You
+should never have need for looking at this, except, perhaps, to examine
+the code generated for implementing the @code{flag-code} construct.
+
+@c === SECTION MARKER
+
+@node Using AutoOpts
+@section Using AutoOpts
+@cindex using AutoOpts
+
+There are actually several levels of ``using'' autoopts.
+Which you choose depends upon how you plan to distribute
+(or not) your application.
+
+@menu
+* local use:: local-only use
+* binary not installed:: binary distro, AutoOpts not installed
+* binary pre-installed:: binary distro, AutoOpts pre-installed
+* source pre-installed:: source distro, AutoOpts pre-installed
+* source not installed:: source distro, AutoOpts not installed
+@end menu
+
+@node local use
+@subsection local-only use
+
+To use AutoOpts in your application where you do not have to
+worry about distribution issues, your issues are simple and few.
+
+@itemize @bullet
+@item
+Create a file @samp{myopts.def}, according to the documentation above.
+It is probably easiest to start with the example in @ref{Quick Start}
+and edit it into the form you need.
+
+@item
+Run AutoGen to create the option interface file (@code{myopts.h})
+and the option descriptor code (@code{myopts.c}):
+
+@example
+autogen myopts.def
+@end example
+
+@item
+In all your source files where you need to refer to option state,
+@code{#include "myopts.h"}.
+@item
+In your main routine, code something along the lines of:
+
+@example
+#define ARGC_MIN some-lower-limit
+#define ARGC_MAX some-upper-limit
+main( int argc, char** argv )
+@{
+ @{
+ int arg_ct = optionProcess( &myprogOptions, argc, argv );
+ argc -= arg_ct;
+ if ((argc < ARGC_MIN) || (argc > ARGC_MAX)) @{
+ fprintf( stderr, "%s ERROR: remaining args (%d) "
+ "out of range\n", myprogOptions.pzProgName,
+ argc );
+
+ USAGE( EXIT_FAILURE );
+ @}
+ argv += arg_ct;
+ @}
+ if (HAVE_OPT(OPTN_NAME))
+ respond_to_optn_name();
+ ...
+@}
+@end example
+
+@item
+Compile @samp{myopts.c} and link your program
+with the following additional arguments:
+
+@example
+`autoopts-config cflags ldflags` myopts.c
+@end example
+@end itemize
+
+@node binary not installed
+@subsection binary distro, AutoOpts not installed
+
+If you will be distributing (or copying) your project to a system that
+does not have AutoOpts installed, you will need to statically link the
+AutoOpts library, ``libopts'' into your program. Get the link information
+with ``@code{static-libs}'' instead of ``@code{ldflags}'':
+
+@example
+`autoopts-config static-libs`
+@end example
+
+@node binary pre-installed
+@subsection binary distro, AutoOpts pre-installed
+
+If you will be distributing (or copying) your project to a system that does
+have AutoOpts (or only ``libopts'') installed, you will still need to ensure
+that the library is findable at program load time, or you will still have to
+statically link. The former can be accomplished by linking your project with
+@code{--rpath} or by setting the @code{LD_LIBRARY_PATH} appropriately.
+Otherwise, @xref{binary not installed}.
+
+@node source pre-installed
+@subsection source distro, AutoOpts pre-installed
+
+If you will be distributing your project to a system that will build
+your product but it may not be pre-installed with AutoOpts, you will
+need to do some configuration checking before you start the build.
+Assuming you are willing to fail the build if AutoOpts has not been
+installed, you will still need to do a little work.
+
+AutoOpts is distributed with a configuration check M4 script,
+@file{autoopts.m4}. It will add an @code{autoconf} macro named,
+@code{AG_PATH_AUTOOPTS}. Add this to your @file{configure.ac} script
+and use the following substitution values:
+
+@table @code
+@item AUTOGEN
+the name of the autogen executable
+@item AUTOGEN_TPLIB
+the directory where AutoGen template library is stored
+@item AUTOOPTS_CFLAGS
+the compile time options needed to find the AutoOpts headers
+@item AUTOOPTS_LIBS
+the link options required to access the @code{libopts} library
+@end table
+
+@node source not installed
+@subsection source distro, AutoOpts not installed
+
+If you will be distributing your project to a system that will build
+your product but it may not be pre-installed with AutoOpts, you may
+wish to incorporate the sources for @code{libopts} in your project.
+To do this, I recommend reading the tear-off libopts library
+@file{README} that you can find in the @file{pkg/libopts} directory.
+You can also examine an example package (blocksort) that incorporates
+this tear off library in the autogen distribution directory. There is
+also a web page that describes what you need to do:
+@example
+@url{http://autogen.sourceforge.net/blocksort.html}
+@end example
+
+Alternatively, you can pull the @code{libopts} library sources into
+a build directory and build it for installation along with your package.
+This can be done approximately as follows:
+@example
+tar -xzvf `autoopts-config libsrc`
+cd libopts-*
+./bootstrap
+configure
+make
+make install
+@end example
+That will install the library, but not the headers or anything else.
+
+@c === SECTION MARKER
+
+@node Presetting Options
+@section Configuring your program
+@cindex shell options
+
+AutoOpts supports the notion of ``presetting'' the value or state of an option.
+The values may be obtained either from environment variables or from
+configuration files (@file{rc} or @file{ini} files). In order to take
+advantage of this, the AutoOpts client program must specify these features
+in the option descriptor file (@pxref{program attributes}) with the
+@code{rcfile} or @code{environrc} attributes.
+
+@menu
+* loading rcfile:: configuration file presets
+* saving rcfile:: Saving the presets into a configuration file
+* sample rcfile:: Creating a sample configuration file
+* environrc:: environment variable presets
+* config example:: Config file only example
+@end menu
+
+It is also possible to configure your program @i{without} using
+the command line option parsing code. This is done by using
+only the following four functions from the @file{libopts} library:
+
+@table @samp
+@item configFileLoad
+(@pxref{libopts-configFileLoad}) will parse the contents of a config
+file and return a pointer to a structure representing the hierarchical
+value. The values are sorted alphabetically by the value name and all
+entries with the same name will retain their original order.
+Insertion sort is used.
+
+@item optionGetValue
+(@pxref{libopts-optionGetValue}) will find the first value within the
+hierarchy with a name that matches the name passed in.
+
+@item optionNextValue
+(@pxref{libopts-optionNextValue}) will return the next value that
+follows the value passed in as an argument. If you wish to get all
+the values for a particular name, you must take note when the name
+changes.
+
+@item optionUnloadNested
+(@pxref{libopts-optionUnloadNested}). The pointer passed in must be
+of type, @code{OPARG_TYPE_HIERARCHY} (see the autoopts/options.h
+header file). @code{configFileLoad} will return a @code{tOptionValue}
+pointer of that type. This function will release all the associated
+memory. @code{AutoOpts} generated code uses this function for its own
+needs. Client code should only call this function with pointers
+gotten from @code{configFileLoad}.
+@end table
+
+@node loading rcfile
+@subsection configuration file presets
+@cindex rcfile
+
+Configuration files are enabled by specifying the program attribute
+@code{homerc} (@pxref{program attributes}). Any option not marked
+with the ``no-preset'' attribute may appear in a configuration file.
+The files loaded are selected both by the @code{homerc} entries and,
+optionally, via a command line option. The first component of the
+@code{homerc} entry may be an environment variable such as @code{$HOME}, or
+it may also be @code{$$} (@strong{two} dollar sign characters) to specify
+the directory of the executable. For example:
+
+@example
+homerc = "$$/../share/autogen";
+@end example
+
+@noindent
+will cause the AutoOpts library to look in the normal autogen datadir
+relative to the current installation directory for autogen.
+
+The configuration files are processed in the order they are specified by
+the @code{homerc} attribute, so that each new file will normally override
+the settings of the previous files. This may be overridden by marking some
+options for @code{immediate action} (@pxref{Immediate Action}). Any such
+options are acted upon in @strong{reverse} order. The disabled
+@code{load-opts} (@code{--no-load-opts}) option, for example, is an
+immediate action option. Its presence in the last @code{homerc} file will
+prevent the processing of any prior @code{homerc} files because its effect
+is immediate.
+
+Configuration file processing can be completely suppressed by specifying
+@code{--no-load-opts} on the command line, or @code{PROGRAM_LOAD_OPTS=no} in
+the environment (if @code{environrc} has been specified).
+
+See the ``Configuration File Format'' section (@pxref{Config File Format})
+for details on the format of the file.
+
+@node saving rcfile
+@subsection Saving the presets into a configuration file
+
+When configuration files are enabled for an application, the user is
+also provided with an automatically supplied @code{--save-opts} option.
+All of the known option state will be written to either the specified
+output file or, if it is not specified, then to the last specified
+@code{homerc} file.
+
+@node sample rcfile
+@subsection Creating a sample configuration file
+@cindex sample rcfile
+
+AutoOpts is shipped with a template named, @file{rc-sample.tpl}.
+If your option definition file specifies the @code{homerc} attribute,
+then you may invoke @file{autogen} thus:
+
+@example
+autogen -Trc-sample <your-option-def-file>
+@end example
+
+This will, by default, produce a sample file named,
+@file{sample-<prog-name>rc}. It will be named differently if you specify your
+configuration (rc) file name with the @code{rcfile} attribute. In that case,
+the output file will be named, @file{sample-<rcfile-name>}. It will contain
+all of the program options not marked as @code{no-preset}. It will also
+include the text from the @code{doc} attribute.
+
+@ignore
+END == AUTOOPTS-DATA == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+@noindent
+Doing so with getdefs' option definitions yields this sample-getdefsrc file.
+I tend to be wordy in my @code{doc} attributes:
+
+@example
+# getdefs sample configuration file
+## This source file is copyrighted and licensed under the following terms:
+#
+# Copyright (C) 1999-2012 Bruce Korb, all rights reserved.
+# This is free software. It is licensed for use, modification and
+# redistribution under the terms of the
+# GNU General Public License, version 3 or later
+# <http://gnu.org/licenses/gpl.html>
+#
+# getdefs is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# getdefs is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# defs_to_get -- Regexp to look for after the "/*="
+#
+#
+#
+#
+# If you want definitions only from a particular category, or even
+# with names matching particular patterns, then specify this regular
+# expression for the text that must follow the @@code@{/*=@}.
+# Example:
+#
+#defs_to_get reg-ex
+
+# subblock -- subblock definition names
+#
+#
+#
+#
+# This option is used to create shorthand entries for nested definitions.
+# For example, with:
+# @@table @@r
+# @@item using subblock thus
+# @@code@{--subblock=arg=argname,type,null@}
+# @@item and defining an @@code@{arg@} thus
+# @@code@{arg: this, char *@}
+# @@item will then expand to:
+# @@code@{arg = @@@{ argname = this; type = "char *"; @@@};@}
+# @@end table
+# The "this, char *" string is separated at the commas, with the
+# white space removed. You may use characters other than commas by
+# starting the value string with a punctuation character other than
+# a single or double quote character. You may also omit intermediate
+# values by placing the commas next to each other with no intervening
+# white space. For example, "+mumble++yes+" will expand to:
+# @@*
+# @@code@{arg = @@@{ argname = mumble; null = "yes"; @@@};@}.
+# Example:
+#
+#subblock sub-def
+
+# listattr -- attribute with list of values
+#
+#
+#
+#
+# This option is used to create shorthand entries for definitions
+# that generally appear several times. That is, they tend to be
+# a list of values. For example, with:
+# @@*
+# @@code@{listattr=foo@} defined, the text:
+# @@*
+# @@code@{foo: this, is, a, multi-list@} will then expand to:
+# @@*
+# @@code@{foo = 'this', 'is', 'a', 'multi-list';@}
+# @@*
+# The texts are separated by the commas, with the
+# white space removed. You may use characters other than commas by
+# starting the value string with a punctuation character other than
+# a single or double quote character.
+# Example:
+#
+#listattr def
+
+# ordering -- Alphabetize or use named file
+#
+#
+#
+#
+# By default, ordering is alphabetical by the entry name. Use,
+# @@code@{no-ordering@} if order is unimportant. Use @@code@{ordering@}
+# with no argument to order without case sensitivity. Use
+# @@code@{ordering=<file-name>@} if chronological order is important.
+# getdefs will maintain the text content of @@code@{file-name@}.
+# @@code@{file-name@} need not exist.
+# Example:
+#
+#ordering file-name
+
+# first_index -- The first index to apply to groups
+#
+# This configuration value takes an integer number as its argument.
+#
+#
+# By default, the first occurrence of a named definition will have an
+# index of zero. Sometimes, that needs to be a reserved value. Provide
+# this option to specify a different starting point.
+# Example:
+#
+#first_index 0
+
+# filelist -- Insert source file names into defs
+#
+#
+#
+#
+# Inserts the name of each input file into the output definitions.
+# If no argument is supplied, the format will be:
+# @@example
+# infile = '%s';
+# @@end example
+# If an argument is supplied, that string will be used for the entry
+# name instead of @@var@{infile@}.
+# Example:
+#
+#filelist file
+
+# assign -- Global assignments
+#
+#
+#
+#
+# The argument to each copy of this option will be inserted into
+# the output definitions, with only a semicolon attached.
+# Example:
+#
+#assign ag-def
+
+# common_assign -- Assignments common to all blocks
+#
+#
+#
+#
+# The argument to each copy of this option will be inserted into
+# each output definition, with only a semicolon attached.
+# Example:
+#
+#common_assign ag-def
+
+# copy -- File(s) to copy into definitions
+#
+#
+#
+#
+# The content of each file named by these options will be inserted into
+# the output definitions.
+# Example:
+#
+#copy file
+
+# srcfile -- Insert source file name into each def
+#
+#
+#
+#
+# Inserts the name of the input file where a definition was found
+# into the output definition.
+# If no argument is supplied, the format will be:
+# @@example
+# srcfile = '%s';
+# @@end example
+# If an argument is supplied, that string will be used for the entry
+# name instead of @@var@{srcfile@}.
+# Example:
+#
+#srcfile file
+
+# linenum -- Insert source line number into each def
+#
+#
+#
+#
+# Inserts the line number in the input file where a definition
+# was found into the output definition.
+# If no argument is supplied, the format will be:
+# @@example
+# linenum = '%s';
+# @@end example
+# If an argument is supplied, that string will be used for the entry
+# name instead of @@var@{linenum@}.
+# Example:
+#
+#linenum def-name
+
+# input -- Input file to search for defs
+#
+#
+#
+#
+# All files that are to be searched for definitions must be named on
+# the command line or read from @@code@{stdin@}. If there is only one
+# @@code@{input@} option and it is the string, "-", then the input file
+# list is read from @@code@{stdin@}. If a command line argument is not
+# an option name and does not contain an assignment operator
+# (@@code@{=@}), then it defaults to being an input file name.
+# At least one input file must be specified.
+# Example:
+#
+#input src-file
+
+# output -- Output file to open
+#
+#
+#
+#
+# If you are not sending the output to an AutoGen process,
+# you may name an output file instead.
+# Example:
+#
+#output file
+
+# autogen -- Invoke AutoGen with defs
+#
+#
+#
+#
+# This is the default output mode. Specifying @@code@{no-autogen@} is
+# equivalent to @@code@{output=-@}. If you supply an argument to this
+# option, that program will be started as if it were AutoGen and
+# its standard in will be set to the output definitions of this program.
+# Example:
+#
+#autogen ag-cmd
+
+# template -- Template Name
+#
+#
+#
+#
+# Specifies the template name to be used for generating the final output.
+# Example:
+#
+#template file
+
+# agarg -- AutoGen Argument
+#
+#
+#
+#
+# This is a pass-through argument. It allows you to specify any
+# arbitrary argument to be passed to AutoGen.
+# Example:
+#
+#agarg ag-opt
+
+# base_name -- Base name for output file(s)
+#
+#
+#
+#
+# When output is going to AutoGen, a base name must either be supplied
+# or derived. If this option is not supplied, then it is taken from
+# the @@code@{template@} option. If that is not provided either, then
+# it is set to the base name of the current directory.
+# Example:
+#
+#base_name name
+@end example
+@ignore
+START == AO-DATA1 == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@node environrc
+@subsection environment variable presets
+@cindex environrc
+
+If the AutoOpts client program specifies @code{environrc} in its
+option descriptor file, then environment variables will be used for
+presetting option state. Variables will be looked for that are named,
+@code{PROGRAM_OPTNAME} and @code{PROGRAM}. @code{PROGRAM} is the
+upper cased @code{C-name} of the program, and @code{OPTNAME} is the
+upper cased @code{C-name} of a specific option. (The @code{C-name}s
+are the regular names with all special characters converted to
+underscores (@code{_}).)
+
+Option specific environment variables are processed after (and thus
+take precedence over) the contents of the @code{PROGRAM} environment
+variable. The option argument string for these options takes on the
+string value gotten from the environment. Consequently, you can only
+have one instance of the @code{OPTNAME}.
+
+If a particular option may be disabled, then its disabled state is
+indicated by setting the @code{PROGRAM_OPTNAME} value to the
+disablement prefix. So, for example, if the disablement prefix were
+@code{dont}, then you can disable the @code{optname} option by setting
+the @code{PROGRAM_OPTNAME}' environment variable to `@i{dont}'.
+@xref{Common Attributes}.
+
+The @code{PROGRAM} environment string is tokenized and parsed much
+like a command line. Doubly quoted strings have backslash escapes
+processed the same way they are processed in C program constant
+strings. Singly quoted strings are ``pretty raw'' in that backslashes are
+honored before other backslashes, apostrophes, newlines and cr/newline
+pairs. The options must be introduced with hyphens in the same way as
+the command line.
+
+Note that not all options may be preset. Options that are specified with the
+@code{no-preset} attribute and the @code{--help}, @code{--more-help},
+and @code{--save-opts} auto-supported options may not be preset.
+
+@node config example
+@subsection Config file only example
+@cindex rcfile
+@cindex Configuration File
+@cindex Configuration File example
+
+If for some reason it is difficult or unworkable to integrate configuration
+file processing with command line option parsing, the @code{libopts}
+(@pxref{libopts procedures}) library can still be used to process configuration
+files. Below is a ``@t{Hello, World!}'' greeting program that tries
+to load a configuration file @file{hello.conf} to see if it should use
+an alternate greeting or to personalize the salutation.
+@ignore
+END == AO-DATA1 == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+@example
+#include <config.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <pwd.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <autoopts/options.h>
+int main(int argc, char ** argv) @{
+ char const * greeting = "Hello";
+ char const * greeted = "World";
+ tOptionValue const * pOV = configFileLoad("hello.conf");
+
+ if (pOV != NULL) @{
+ const tOptionValue* pGetV = optionGetValue(pOV, "greeting");
+
+ if ( (pGetV != NULL)
+ && (pGetV->valType == OPARG_TYPE_STRING))
+ greeting = strdup(pGetV->v.strVal);
+
+ pGetV = optionGetValue(pOV, "personalize");
+ if (pGetV != NULL) @{
+ struct passwd * pwe = getpwuid(getuid());
+ if (pwe != NULL)
+ greeted = strdup(pwe->pw_gecos);
+ @}
+
+ optionUnloadNested(pOV); /* deallocate config data */
+ @}
+ printf("%s, %s!\n", greeting, greeted);
+ return 0;
+@}
+@end example
+
+@noindent
+With that text in a file named ``hello.c'', this short script:
+
+@example
+cc -o hello hello.c `autoopts-config cflags ldflags`
+./hello
+echo 'greeting Buzz off' > hello.conf
+./hello
+echo personalize > hello.conf
+./hello
+@end example
+
+@noindent
+will produce the following output:
+
+@example
+Hello, World!
+Buzz off, World!
+Hello, Bruce Korb!
+@end example
+@ignore
+START == AO-DATA2 == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node Config File Format
+@section Configuration File Format
+@cindex Configuration File
+
+The configuration file is designed to associate names and values, much like
+an AutoGen Definition File (@pxref{Definitions File}). Unfortunately, the
+file formats are different. Specifically, AutoGen Definitions provide for
+simpler methods for the precise control of a value string and provides for
+dynamically computed content. Configuration files have some established
+traditions in their layout. So, they are different, even though they do
+both allow for a single name to be associated with multiple values and they
+both allow for hierarchical values.
+
+@menu
+* config name/string-value:: assigning a string value to a configurable
+* config integer-values:: integer values
+* config nested-values:: hierarchical values
+* config directives:: configuration file directives
+* config comments:: comments in the configuration file
+@end menu
+
+@node config name/string-value
+@subsection assigning a string value to a configurable
+
+The basic syntax is a name followed by a value on a single line. They are
+separated from each other by either white space, a colon (@code{:}) or an
+equal sign (@code{=}). The colon or equal sign may optionally be surrounded
+by additional white space. If more than one value line is needed, a
+backslash (@code{\}) may be used to continue the value. The backslash (but
+not the newline) will be erased. Leading and trailing white space is always
+stripped from the value.
+
+Fundamentally, it looks like this:
+
+@example
+name value for that name
+name = another \
+ multi-line value \
+ for that name.
+name: a *third* value for ``name''
+@end example
+
+If you need more control over the content of the value, you may enclose the
+value in XML style brackets:
+@example
+<name>value </name>
+@end example
+@noindent
+Within these brackets you need not (must not) continue the value data with
+backslashes. You may also select the string formation rules to use, just
+add the attribute after the name, thus: @code{<name keep>}.
+
+@table @samp
+@item keep
+This mode will keep all text between the brackets and not strip any
+white space.
+@item uncooked
+This mode strips leading and trailing white space, but not do any
+quote processing. This is the default and need not be specified.
+@item cooked
+The text is trimmed of leading and trailing white space and XML encodings
+are processed. These encodings are slightly expanded over the XML
+specification. They are specified with an ampersand followed by a value
+name or numeric value and then a semicolon:
+
+@table @samp
+@item amp
+@itemx lt
+@itemx gt
+@itemx quot
+@itemx apos
+@itemx #dd
+@itemx #xHH
+
+These are all per fairly standad HTML and/or XML encodings.
+Additionally:
+
+@item bs
+The ASCII back space character.
+@item ff
+The ASCII form feed character.
+@item ht
+The ASCII horizontal (normal) tab character.
+@item cr
+The ASCII carriage return character.
+@item vt
+The ASCII vertical tab character.
+@item bel
+The ASCII alarm bell character.
+@item nl
+The ASCII new line character.
+@item space
+The ASCII space character. Normally not necessary, but if you want
+to preserve leading or trailing space characters, then use this.
+@end table
+@end table
+
+And here is an example of an XML-styled value:
+
+@example
+<name cooked>
+ This is&nl;&ht;another multi-line
+&ht;string example.
+</name>
+@end example
+
+The string value associated with ``name'' will be exactly the text enclosed
+in quotes with the encoded characters ``cooked'' as you would expect
+(three text lines with the last line not ending with a newline, but
+ending with a period).
+
+@node config integer-values
+@subsection integer values
+
+A name can be specified as having an integer value. To do this, you
+must use the XML-ish format and specify a ``type'' attribute for
+the name:
+
+@example
+<name type=integer> 1234 </name>
+@end example
+
+Boolean, enumeration and set membership types will be added as time
+allows. ``type=string'' is also supported, but also is the default.
+
+@node config nested-values
+@subsection hierarchical values
+
+In order to specify a hierarchical value, you *must* use XML-styled
+formatting, specifying a type that is shorter and easier to spell:
+
+@example
+<structured-name type=nested>
+ [[....]]
+</structured-name>
+@end example
+
+@noindent
+The ellipsis may be filled with any legal configuration file name/value
+assignments.
+
+@node config directives
+@subsection configuration file directives
+@cindex autoopts directives
+
+The @code{<?} marker indicates an XML directive.
+There is only one directive supported: program sectioning,
+though two syntaxes are supported.
+
+If, for example, you have a collection of programs that work closely
+together and, likely, have a common set of options, these programs may use a
+single, sectioned, configuration file. The file may be sectioned in either
+of two ways. The two ways may not be intermixed in a single configuration
+file. All text before the first segmentation line is processed, then only
+the segment that applies:
+
+@table @samp
+@item <?auto-options ...>
+The @code{...} ellipsis may contain AutoOpts option processing options.
+Currently, that consists of one or both of:
+
+@table @code
+@item gnu
+@itemx autoopts
+to indicate GNU-standard or AutoOpts-standard layout of usage and
+version information, and/or
+
+@item misuse-usage
+@itemx no-misuse-usage
+to indicate whether the available options should be listed when
+an invalid option appears on the command line.
+@end table
+@noindent
+Anything else will be silently ignored.
+
+@item <?program prog-name>
+The @code{<?} marker indicates an XML directive.
+The file is partitioned by these lines and the options are processed
+for the @code{prog-name} program only before the first @code{<?program}
+directive and the program section with a matching program name.
+
+@item [PROG_NAME]
+This is basically an alias for @code{<?program prog-name>}, except that
+the program name must be upper cased and segmented only with underscores.
+@end table
+
+@noindent
+Segmentation does not apply if the config file is being parsed with
+the @code{configFileLoad(3AutoOpts)} function.
+
+@node config comments
+@subsection comments in the configuration file
+
+Comments are lines beginning with a hash mark (@code{#}),
+XML-style comments (@code{<!-- arbitrary text -->}), and
+unrecognized XML directives.
+
+@example
+# this is a comment
+<!-- this is also
+ a comment -->
+<?this is
+ a bad comment ;->
+@end example
+
+@c === SECTION MARKER
+
+@node shell options
+@section AutoOpts for Shell Scripts
+@cindex shell options
+@cindex configuration file
+
+AutoOpts may be used with shell scripts either by automatically creating a
+complete program that will process command line options and pass back
+the results to the invoking shell by issuing shell variable assignment
+commands, or it may be used to generate portable shell code that can
+be inserted into your script.
+
+The functionality of these features, of course, is somewhat constrained
+compared with the normal program facilities. Specifically, you cannot
+invoke callout procedures with either of these methods. Additionally,
+if you generate a shell script to do the parsing:
+
+@enumerate
+@item
+You cannot obtain options from configuration files.
+@item
+You cannot obtain options from environment variables.
+@item
+You cannot save the option state to an option file.
+@item
+Option conflict/requirement verification is disabled.
+@end enumerate
+
+Both of these methods are enabled by running AutoGen on
+the definitions file with the additional main procedure attribute:
+
+@example
+main = @{ main-type = shell-process; @};
+@end example
+@noindent
+or:
+@example
+main = @{ main-type = shell-parser; @};
+@end example
+
+If you do not supply a @code{proc-to-call}, it will default to
+@code{optionPutShell}. That will produce a program that will process the
+options and generate shell text for the invoking shell to interpret
+(@pxref{binary-parser}). If you supply the name, @code{optionParseShell}, then
+you will have a program that will generate a shell script that can parse the
+options (@pxref{script-parser}). If you supply a different procedure name,
+you will have to provide that routine and it may do whatever you like.
+
+@menu
+* binary-parser:: Parsing with an Executable
+* script-parser:: Parsing with a Portable Script
+@end menu
+
+@node binary-parser
+@subsection Parsing with an Executable
+
+The following commands are approximately all that is needed
+to build a shell script command line option parser from
+an option definition file:
+
+@example
+autogen -L <opt-template-dir> test-errors.def
+cc -o test-errors -L <opt-lib-dir> -I <opt-include-dir> \
+ -DTEST_PROGRAM_OPTS test-errors.c -lopts
+@end example
+
+The resulting program can then be used within your shell script as follows:
+
+@example
+eval `./test-errors "$@@"`
+if [ -z "$@{OPTION_CT@}" ] ; then exit 1 ; fi
+test $@{OPTION_CT@} -gt 0 && shift $@{OPTION_CT@}
+@end example
+@ignore
+END == AO-DATA2 == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+Here is the usage output example from AutoOpts error handling
+tests. The option definition has argument reordering enabled:
+
+@example
+test_errors - Test AutoOpts for errors
+USAGE: errors [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... arg ...
+ Flg Arg Option-Name Description
+ -o no option The option option descrip
+ -s Str second The second option descrip
+ - may appear up to 10 times
+ -i --- ignored we have dumped this
+ -X no another Another option descrip
+ - may appear up to 5 times
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+Operands and options may be intermixed. They will be reordered.
+
+The following option preset mechanisms are supported:
+ - reading file errorsRC
+Packaged by Bruce (2012-08-11)
+Report test_errors bugs to bkorb@@gnu.org
+@end example
+
+Using the invocation,
+@example
+ test-errors operand1 -s first operand2 -X -- -s operand3
+@end example
+you get the following output for your shell script to evaluate:
+
+@example
+OPTION_CT=4
+export OPTION_CT
+TEST_ERRORS_SECOND='first'
+export TEST_ERRORS_SECOND
+TEST_ERRORS_ANOTHER=1 # 0x1
+export TEST_ERRORS_ANOTHER
+set -- 'operand1' 'operand2' '-s' 'operand3'
+OPTION_CT=0
+@end example
+@node script-parser
+@subsection Parsing with a Portable Script
+
+If you had used @code{test-main = optionParseShell} instead, then you can,
+at this point, merely run the program and it will write the parsing
+script to standard out. You may also provide this program with command
+line options to specify the shell script file to create or edit, and you
+may specify the shell program to use on the first shell script line.
+That program's usage text would look something like the following
+and the script parser itself would be very verbose:
+
+@example
+genshellopt - Generate Shell Option Processing Script - Ver. 1
+USAGE: genshellopt [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str script Output Script File
+ -s Str shell Shell name (follows "#!" magic)
+ - disabled as --no-shell
+ - enabled by default
+ -v opt version Output version information and exit
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+Note that ``shell'' is only useful if the output file does not already
+exist. If it does, then the shell name and optional first argument will be
+extracted from the script file.
+
+If the script file already exists and contains Automated Option Processing
+text, the second line of the file through the ending tag will be replaced
+by the newly generated text. The first ``#!'' line will be regenerated.
+Packaged by Bruce (2012-08-11)
+Report genshellopt bugs to bkorb@@gnu.org
+
+= = = = = = = =
+
+This incarnation of genshell will produce
+a shell script to parse the options for getdefs:
+
+getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
+USAGE: getdefs [ <option-name>[@{=| @}<val>] ]...
+ Arg Option-Name Description
+ Str defs-to-get Regexp to look for after the "/*="
+ Str subblock subblock definition names
+ Str listattr attribute with list of values
+ opt ordering Alphabetize or use named file
+ Num first-index The first index to apply to groups
+ opt filelist Insert source file names into defs
+ Str assign Global assignments
+ Str common-assign Assignments common to all blocks
+ Str copy File(s) to copy into definitions
+ opt srcfile Insert source file name into each def
+ opt linenum Insert source line number into each def
+ Str input Input file to search for defs
+ Str output Output file to open
+ opt autogen Invoke AutoGen with defs
+ Str template Template Name
+ Str agarg AutoGen Argument
+ Str base-name Base name for output file(s)
+ opt version Output version information and exit
+ no help Display extended usage information and exit
+ no more-help Extended usage information passed thru pager
+ opt save-opts Save the option state to a config file
+ Str load-opts Load options from a config file
+
+All arguments are named options.
+
+If no ``input'' argument is provided or is set to simply "-", and if
+``stdin'' is not a ``tty'', then the list of input files will be read from
+``stdin''.
+Packaged by Bruce (2012-08-11)
+Report getdefs bugs to bkorb@@gnu.org
+@end example
+
+@noindent
+Resulting in the following script:
+@example
+#! /bin/sh
+# # # # # # # # # # -- do not modify this marker --
+#
+# DO NOT EDIT THIS SECTION OF /old-home/bkorb/ag/ag/doc/ag-texi-30133.d/.ag-eFukQW/genshellopt.sh
+#
+# From here to the next `-- do not modify this marker --',
+# the text has been generated Saturday August 11, 2012 at 09:42:46 AM PDT
+# From the GETDEFS option definitions
+#
+GETDEFS_LONGUSAGE_TEXT='getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
+USAGE: getdefs [ <option-name>[@{=| @}<val>] ]...
+
+Specify which definitions are of interest and what to say about them:
+
+ Arg Option-Name Description
+ Str defs-to-get Regexp to look for after the "/*="
+ Str subblock subblock definition names
+ - may appear multiple times
+ Str listattr attribute with list of values
+ - may appear multiple times
+
+specify how to number the definitions:
+
+ Arg Option-Name Description
+ opt ordering Alphabetize or use named file
+ - disabled as --no-ordering
+ - enabled by default
+ Num first-index The first index to apply to groups
+
+Definition insertion options:
+
+ Arg Option-Name Description
+ opt filelist Insert source file names into defs
+ Str assign Global assignments
+ - may appear multiple times
+ Str common-assign Assignments common to all blocks
+ - may appear multiple times
+ Str copy File(s) to copy into definitions
+ - may appear multiple times
+ opt srcfile Insert source file name into each def
+ opt linenum Insert source line number into each def
+
+specify which files to search for markers:
+
+ Arg Option-Name Description
+ Str input Input file to search for defs
+ - may appear multiple times
+ - default option for unnamed options
+
+Definition output disposition options::
+
+ Arg Option-Name Description
+ Str output Output file to open
+ - an alternate for autogen
+ opt autogen Invoke AutoGen with defs
+ - disabled as --no-autogen
+ - enabled by default
+ Str template Template Name
+ Str agarg AutoGen Argument
+ - prohibits these options:
+ output
+ - may appear multiple times
+ Str base-name Base name for output file(s)
+ - prohibits these options:
+ output
+
+version, usage and configuration options:
+
+ Arg Option-Name Description
+ opt version Output version information and exit
+ no help Display extended usage information and exit
+ no more-help Extended usage information passed thru pager
+ opt save-opts Save the option state to a config file
+ Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+All arguments are named options.
+
+If no ``input'\'''\'' argument is provided or is set to simply "-", and if
+``stdin'\'''\'' is not a ``tty'\'''\'', then the list of input files will be read from
+``stdin'\'''\''.
+
+The following option preset mechanisms are supported:
+ - reading file /dev/null
+
+This program extracts AutoGen definitions from a list of source files.
+Definitions are delimited by ``/*=<entry-type> <entry-name>\n'\'''\'' and
+``=*/\n'\'''\''.
+Packaged by Bruce (2012-08-11)
+Report getdefs bugs to bkorb@@gnu.org'
+
+GETDEFS_USAGE_TEXT='getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
+USAGE: getdefs [ <option-name>[@{=| @}<val>] ]...
+ Arg Option-Name Description
+ Str defs-to-get Regexp to look for after the "/*="
+ Str subblock subblock definition names
+ Str listattr attribute with list of values
+ opt ordering Alphabetize or use named file
+ Num first-index The first index to apply to groups
+ opt filelist Insert source file names into defs
+ Str assign Global assignments
+ Str common-assign Assignments common to all blocks
+ Str copy File(s) to copy into definitions
+ opt srcfile Insert source file name into each def
+ opt linenum Insert source line number into each def
+ Str input Input file to search for defs
+ Str output Output file to open
+ opt autogen Invoke AutoGen with defs
+ Str template Template Name
+ Str agarg AutoGen Argument
+ Str base-name Base name for output file(s)
+ opt version Output version information and exit
+ no help Display extended usage information and exit
+ no more-help Extended usage information passed thru pager
+ opt save-opts Save the option state to a config file
+ Str load-opts Load options from a config file
+
+All arguments are named options.
+
+If no ``input'\'''\'' argument is provided or is set to simply "-", and if
+``stdin'\'''\'' is not a ``tty'\'''\'', then the list of input files will be read from
+``stdin'\'''\''.
+Packaged by Bruce (2012-08-11)
+Report getdefs bugs to bkorb@@gnu.org'
+
+
+GETDEFS_DEFS_TO_GET=$@{GETDEFS_DEFS_TO_GET@}
+GETDEFS_DEFS_TO_GET_set=false
+export GETDEFS_DEFS_TO_GET
+
+if test -z "$@{GETDEFS_SUBBLOCK@}"
+then
+ GETDEFS_SUBBLOCK_CT=0
+else
+ GETDEFS_SUBBLOCK_CT=1
+ GETDEFS_SUBBLOCK_1=$@{GETDEFS_SUBBLOCK@}
+fi
+export GETDEFS_SUBBLOCK_CT
+if test -z "$@{GETDEFS_LISTATTR@}"
+then
+ GETDEFS_LISTATTR_CT=0
+else
+ GETDEFS_LISTATTR_CT=1
+ GETDEFS_LISTATTR_1=$@{GETDEFS_LISTATTR@}
+fi
+export GETDEFS_LISTATTR_CT
+GETDEFS_ORDERING=$@{GETDEFS_ORDERING@}
+GETDEFS_ORDERING_set=false
+export GETDEFS_ORDERING
+
+GETDEFS_FIRST_INDEX=$@{GETDEFS_FIRST_INDEX-'0'@}
+GETDEFS_FIRST_INDEX_set=false
+export GETDEFS_FIRST_INDEX
+GETDEFS_FILELIST=$@{GETDEFS_FILELIST@}
+GETDEFS_FILELIST_set=false
+export GETDEFS_FILELIST
+
+if test -z "$@{GETDEFS_ASSIGN@}"
+then
+ GETDEFS_ASSIGN_CT=0
+else
+ GETDEFS_ASSIGN_CT=1
+ GETDEFS_ASSIGN_1=$@{GETDEFS_ASSIGN@}
+fi
+export GETDEFS_ASSIGN_CT
+if test -z "$@{GETDEFS_COMMON_ASSIGN@}"
+then
+ GETDEFS_COMMON_ASSIGN_CT=0
+else
+ GETDEFS_COMMON_ASSIGN_CT=1
+ GETDEFS_COMMON_ASSIGN_1=$@{GETDEFS_COMMON_ASSIGN@}
+fi
+export GETDEFS_COMMON_ASSIGN_CT
+if test -z "$@{GETDEFS_COPY@}"
+then
+ GETDEFS_COPY_CT=0
+else
+ GETDEFS_COPY_CT=1
+ GETDEFS_COPY_1=$@{GETDEFS_COPY@}
+fi
+export GETDEFS_COPY_CT
+GETDEFS_SRCFILE=$@{GETDEFS_SRCFILE@}
+GETDEFS_SRCFILE_set=false
+export GETDEFS_SRCFILE
+
+GETDEFS_LINENUM=$@{GETDEFS_LINENUM@}
+GETDEFS_LINENUM_set=false
+export GETDEFS_LINENUM
+
+if test -z "$@{GETDEFS_INPUT@}"
+then
+ GETDEFS_INPUT_CT=0
+else
+ GETDEFS_INPUT_CT=1
+ GETDEFS_INPUT_1=$@{GETDEFS_INPUT@}
+fi
+export GETDEFS_INPUT_CT
+GETDEFS_OUTPUT=$@{GETDEFS_OUTPUT@}
+GETDEFS_OUTPUT_set=false
+export GETDEFS_OUTPUT
+
+GETDEFS_AUTOGEN=$@{GETDEFS_AUTOGEN@}
+GETDEFS_AUTOGEN_set=false
+export GETDEFS_AUTOGEN
+
+GETDEFS_TEMPLATE=$@{GETDEFS_TEMPLATE@}
+GETDEFS_TEMPLATE_set=false
+export GETDEFS_TEMPLATE
+
+if test -z "$@{GETDEFS_AGARG@}"
+then
+ GETDEFS_AGARG_CT=0
+else
+ GETDEFS_AGARG_CT=1
+ GETDEFS_AGARG_1=$@{GETDEFS_AGARG@}
+fi
+export GETDEFS_AGARG_CT
+GETDEFS_BASE_NAME=$@{GETDEFS_BASE_NAME@}
+GETDEFS_BASE_NAME_set=false
+export GETDEFS_BASE_NAME
+
+OPT_ARG=$1
+while [ $# -gt 0 ]
+do
+ OPT_ELEMENT=''
+ OPT_ARG_VAL=''
+ OPT_ARG=$@{1@}
+ OPT_CODE=`echo "X$@{OPT_ARG@}"|sed 's/^X-*//'`
+ shift
+ OPT_ARG=$1
+ case "$@{OPT_CODE@}" in *=* )
+ OPT_ARG_VAL=`echo "$@{OPT_CODE@}"|sed 's/^[^=]*=//'`
+ OPT_CODE=`echo "$@{OPT_CODE@}"|sed 's/=.*$//'` ;; esac
+ case "$@{OPT_CODE@}" in
+ 'de' | \
+ 'def' | \
+ 'defs' | \
+ 'defs-' | \
+ 'defs-t' | \
+ 'defs-to' | \
+ 'defs-to-' | \
+ 'defs-to-g' | \
+ 'defs-to-ge' | \
+ 'defs-to-get' )
+ if [ -n "$@{GETDEFS_DEFS_TO_GET@}" ] && $@{GETDEFS_DEFS_TO_GET_set@} ; then
+ echo Error: duplicate DEFS_TO_GET option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_DEFS_TO_GET_set=true
+ OPT_NAME='DEFS_TO_GET'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'su' | \
+ 'sub' | \
+ 'subb' | \
+ 'subbl' | \
+ 'subblo' | \
+ 'subbloc' | \
+ 'subblock' )
+ GETDEFS_SUBBLOCK_CT=`expr $@{GETDEFS_SUBBLOCK_CT@} + 1`
+ OPT_ELEMENT="_$@{GETDEFS_SUBBLOCK_CT@}"
+ OPT_NAME='SUBBLOCK'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'lis' | \
+ 'list' | \
+ 'lista' | \
+ 'listat' | \
+ 'listatt' | \
+ 'listattr' )
+ GETDEFS_LISTATTR_CT=`expr $@{GETDEFS_LISTATTR_CT@} + 1`
+ OPT_ELEMENT="_$@{GETDEFS_LISTATTR_CT@}"
+ OPT_NAME='LISTATTR'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'or' | \
+ 'ord' | \
+ 'orde' | \
+ 'order' | \
+ 'orderi' | \
+ 'orderin' | \
+ 'ordering' )
+ if [ -n "$@{GETDEFS_ORDERING@}" ] && $@{GETDEFS_ORDERING_set@} ; then
+ echo Error: duplicate ORDERING option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_ORDERING_set=true
+ OPT_NAME='ORDERING'
+ eval GETDEFS_ORDERING$@{OPT_ELEMENT@}=true
+ export GETDEFS_ORDERING$@{OPT_ELEMENT@}
+ OPT_ARG_NEEDED=OK
+ ;;
+
+ 'no-o' | \
+ 'no-or' | \
+ 'no-ord' | \
+ 'no-orde' | \
+ 'no-order' | \
+ 'no-orderi' | \
+ 'no-orderin' | \
+ 'no-ordering' )
+ if [ -n "$@{GETDEFS_ORDERING@}" ] && $@{GETDEFS_ORDERING_set@} ; then
+ echo 'Error: duplicate ORDERING option' >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_ORDERING_set=true
+ GETDEFS_ORDERING='no'
+ export GETDEFS_ORDERING
+ OPT_NAME='ORDERING'
+ OPT_ARG_NEEDED=NO
+ ;;
+
+ 'fir' | \
+ 'firs' | \
+ 'first' | \
+ 'first-' | \
+ 'first-i' | \
+ 'first-in' | \
+ 'first-ind' | \
+ 'first-inde' | \
+ 'first-index' )
+ if [ -n "$@{GETDEFS_FIRST_INDEX@}" ] && $@{GETDEFS_FIRST_INDEX_set@} ; then
+ echo Error: duplicate FIRST_INDEX option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_FIRST_INDEX_set=true
+ OPT_NAME='FIRST_INDEX'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'fil' | \
+ 'file' | \
+ 'filel' | \
+ 'fileli' | \
+ 'filelis' | \
+ 'filelist' )
+ if [ -n "$@{GETDEFS_FILELIST@}" ] && $@{GETDEFS_FILELIST_set@} ; then
+ echo Error: duplicate FILELIST option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_FILELIST_set=true
+ OPT_NAME='FILELIST'
+ eval GETDEFS_FILELIST$@{OPT_ELEMENT@}=true
+ export GETDEFS_FILELIST$@{OPT_ELEMENT@}
+ OPT_ARG_NEEDED=OK
+ ;;
+
+ 'as' | \
+ 'ass' | \
+ 'assi' | \
+ 'assig' | \
+ 'assign' )
+ GETDEFS_ASSIGN_CT=`expr $@{GETDEFS_ASSIGN_CT@} + 1`
+ OPT_ELEMENT="_$@{GETDEFS_ASSIGN_CT@}"
+ OPT_NAME='ASSIGN'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'com' | \
+ 'comm' | \
+ 'commo' | \
+ 'common' | \
+ 'common-' | \
+ 'common-a' | \
+ 'common-as' | \
+ 'common-ass' | \
+ 'common-assi' | \
+ 'common-assig' | \
+ 'common-assign' )
+ GETDEFS_COMMON_ASSIGN_CT=`expr $@{GETDEFS_COMMON_ASSIGN_CT@} + 1`
+ OPT_ELEMENT="_$@{GETDEFS_COMMON_ASSIGN_CT@}"
+ OPT_NAME='COMMON_ASSIGN'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'cop' | \
+ 'copy' )
+ GETDEFS_COPY_CT=`expr $@{GETDEFS_COPY_CT@} + 1`
+ OPT_ELEMENT="_$@{GETDEFS_COPY_CT@}"
+ OPT_NAME='COPY'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'sr' | \
+ 'src' | \
+ 'srcf' | \
+ 'srcfi' | \
+ 'srcfil' | \
+ 'srcfile' )
+ if [ -n "$@{GETDEFS_SRCFILE@}" ] && $@{GETDEFS_SRCFILE_set@} ; then
+ echo Error: duplicate SRCFILE option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_SRCFILE_set=true
+ OPT_NAME='SRCFILE'
+ eval GETDEFS_SRCFILE$@{OPT_ELEMENT@}=true
+ export GETDEFS_SRCFILE$@{OPT_ELEMENT@}
+ OPT_ARG_NEEDED=OK
+ ;;
+
+ 'lin' | \
+ 'line' | \
+ 'linen' | \
+ 'linenu' | \
+ 'linenum' )
+ if [ -n "$@{GETDEFS_LINENUM@}" ] && $@{GETDEFS_LINENUM_set@} ; then
+ echo Error: duplicate LINENUM option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_LINENUM_set=true
+ OPT_NAME='LINENUM'
+ eval GETDEFS_LINENUM$@{OPT_ELEMENT@}=true
+ export GETDEFS_LINENUM$@{OPT_ELEMENT@}
+ OPT_ARG_NEEDED=OK
+ ;;
+
+ 'in' | \
+ 'inp' | \
+ 'inpu' | \
+ 'input' )
+ GETDEFS_INPUT_CT=`expr $@{GETDEFS_INPUT_CT@} + 1`
+ OPT_ELEMENT="_$@{GETDEFS_INPUT_CT@}"
+ OPT_NAME='INPUT'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'ou' | \
+ 'out' | \
+ 'outp' | \
+ 'outpu' | \
+ 'output' )
+ if [ -n "$@{GETDEFS_OUTPUT@}" ] && $@{GETDEFS_OUTPUT_set@} ; then
+ echo Error: duplicate OUTPUT option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_OUTPUT_set=true
+ OPT_NAME='OUTPUT'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'au' | \
+ 'aut' | \
+ 'auto' | \
+ 'autog' | \
+ 'autoge' | \
+ 'autogen' )
+ if [ -n "$@{GETDEFS_AUTOGEN@}" ] && $@{GETDEFS_AUTOGEN_set@} ; then
+ echo Error: duplicate AUTOGEN option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_AUTOGEN_set=true
+ OPT_NAME='AUTOGEN'
+ eval GETDEFS_AUTOGEN$@{OPT_ELEMENT@}=true
+ export GETDEFS_AUTOGEN$@{OPT_ELEMENT@}
+ OPT_ARG_NEEDED=OK
+ ;;
+
+ 'no-a' | \
+ 'no-au' | \
+ 'no-aut' | \
+ 'no-auto' | \
+ 'no-autog' | \
+ 'no-autoge' | \
+ 'no-autogen' )
+ if [ -n "$@{GETDEFS_AUTOGEN@}" ] && $@{GETDEFS_AUTOGEN_set@} ; then
+ echo 'Error: duplicate AUTOGEN option' >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_AUTOGEN_set=true
+ GETDEFS_AUTOGEN='no'
+ export GETDEFS_AUTOGEN
+ OPT_NAME='AUTOGEN'
+ OPT_ARG_NEEDED=NO
+ ;;
+
+ 'te' | \
+ 'tem' | \
+ 'temp' | \
+ 'templ' | \
+ 'templa' | \
+ 'templat' | \
+ 'template' )
+ if [ -n "$@{GETDEFS_TEMPLATE@}" ] && $@{GETDEFS_TEMPLATE_set@} ; then
+ echo Error: duplicate TEMPLATE option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_TEMPLATE_set=true
+ OPT_NAME='TEMPLATE'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'ag' | \
+ 'aga' | \
+ 'agar' | \
+ 'agarg' )
+ GETDEFS_AGARG_CT=`expr $@{GETDEFS_AGARG_CT@} + 1`
+ OPT_ELEMENT="_$@{GETDEFS_AGARG_CT@}"
+ OPT_NAME='AGARG'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'ba' | \
+ 'bas' | \
+ 'base' | \
+ 'base-' | \
+ 'base-n' | \
+ 'base-na' | \
+ 'base-nam' | \
+ 'base-name' )
+ if [ -n "$@{GETDEFS_BASE_NAME@}" ] && $@{GETDEFS_BASE_NAME_set@} ; then
+ echo Error: duplicate BASE_NAME option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_BASE_NAME_set=true
+ OPT_NAME='BASE_NAME'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 've' | \
+ 'ver' | \
+ 'vers' | \
+ 'versi' | \
+ 'versio' | \
+ 'version' )
+ echo "$GETDEFS_LONGUSAGE_TEXT"
+ exit 0
+ ;;
+
+ 'he' | \
+ 'hel' | \
+ 'help' )
+ echo "$GETDEFS_LONGUSAGE_TEXT"
+ exit 0
+ ;;
+
+ 'mo' | \
+ 'mor' | \
+ 'more' | \
+ 'more-' | \
+ 'more-h' | \
+ 'more-he' | \
+ 'more-hel' | \
+ 'more-help' )
+ echo "$GETDEFS_LONGUSAGE_TEXT" | $@{PAGER-more@}
+ exit 0
+ ;;
+
+ 'sa' | \
+ 'sav' | \
+ 'save' | \
+ 'save-' | \
+ 'save-o' | \
+ 'save-op' | \
+ 'save-opt' | \
+ 'save-opts' )
+ echo 'Warning: Cannot save options files' >&2
+ OPT_ARG_NEEDED=OK
+ ;;
+
+ 'lo' | \
+ 'loa' | \
+ 'load' | \
+ 'load-' | \
+ 'load-o' | \
+ 'load-op' | \
+ 'load-opt' | \
+ 'load-opts' )
+ echo 'Warning: Cannot load options files' >&2
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'no-l' | \
+ 'no-lo' | \
+ 'no-loa' | \
+ 'no-load' | \
+ 'no-load-' | \
+ 'no-load-o' | \
+ 'no-load-op' | \
+ 'no-load-opt' | \
+ 'no-load-opts' )
+ echo 'Warning: Cannot suppress the loading of options files' >&2
+ OPT_ARG_NEEDED=NO
+ ;;
+
+ * )
+ echo Unknown option: "$@{OPT_CODE@}" >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1
+ ;;
+ esac
+
+ case "$@{OPT_ARG_NEEDED@}" in
+ NO )
+ OPT_ARG_VAL=''
+ ;;
+ YES )
+ if [ -z "$@{OPT_ARG_VAL@}" ]
+ then
+ if [ $# -eq 0 ]
+ then
+ echo No argument provided for $@{OPT_NAME@} option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1
+ fi
+ OPT_ARG_VAL=$@{OPT_ARG@}
+ shift
+ OPT_ARG=$1
+ fi
+ ;;
+ OK )
+ if [ -z "$@{OPT_ARG_VAL@}" ] && [ $# -gt 0 ]
+ then
+ case "$@{OPT_ARG@}" in -* ) ;; * )
+ OPT_ARG_VAL=$@{OPT_ARG@}
+ shift
+ OPT_ARG=$1 ;; esac
+ fi
+ ;;
+ esac
+ if [ -n "$@{OPT_ARG_VAL@}" ]
+ then
+ eval GETDEFS_$@{OPT_NAME@}$@{OPT_ELEMENT@}="'$@{OPT_ARG_VAL@}'"
+ export GETDEFS_$@{OPT_NAME@}$@{OPT_ELEMENT@}
+ fi
+done
+unset OPT_PROCESS || :
+unset OPT_ELEMENT || :
+unset OPT_ARG || :
+unset OPT_ARG_NEEDED || :
+unset OPT_NAME || :
+unset OPT_CODE || :
+unset OPT_ARG_VAL || :
+
+# # # # # # # # # #
+#
+# END OF AUTOMATED OPTION PROCESSING
+#
+# # # # # # # # # # -- do not modify this marker --
+
+env | grep '^GETDEFS_'
+@end example
+@ignore
+START == AUTOINFO == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node AutoInfo
+@section Automated Info Docs
+@cindex AutoInfo
+
+AutoOpts provides two templates for producing @file{.texi} documentation.
+@file{agtexi-cmd.tpl} for the invoking section, and @file{aginfo3.tpl} for
+describing exported library functions and macros.
+
+For both types of documents, the documentation level is selected by
+passing a @samp{-DLEVEL=<level-name>} argument to AutoGen when you build
+the document. (See the example invocation below.)
+
+Two files will be produced, a @file{.texi} file and a @file{.menu} file.
+You should include the text in the @file{.menu} file in a @file{@@menu}
+list, either with @file{@@include}-ing it or just copying text.
+The @file{.texi} file should be @file{@@include}-ed where the invoking
+section belongs in your document.
+
+The @file{.texi} file will contain an introductory paragraph, a menu
+and a subordinate section for the invocation usage and for each
+documented option. The introductory paragraph is normally the boiler
+plate text, along the lines of:
+
+@example
+This chapter documents the @@file@{AutoOpts@} generated usage text
+and option meanings for the @@file@{your-program@} program.
+@end example
+
+@noindent
+or:
+
+@example
+These are the publicly exported procedures from the lib@i{name} library.
+Any other functions mentioned in the @i{header} file are for the private use
+of the library.
+@end example
+
+@menu
+* command-info:: ``invoking'' info docs
+* library-info:: library info docs
+@end menu
+
+@node command-info
+@subsection ``invoking'' info docs
+
+Using the option definitions for an AutoOpt client program, the
+@file{agtexi-cmd.tpl} template will produce texinfo text that documents the
+invocation of your program. The text emitted is designed to be included
+in the full texinfo document for your product. It is not a stand-alone
+document. The usage text for the @ref{autogen usage},
+@ref{getdefs usage} and @ref{columns usage} programs, are included in
+this document and are all generated using this template.
+
+If your program's option definitions include a
+@samp{prog-info-descrip} section, then that text will replace the
+boilerplate introductory paragraph.
+
+@noindent
+These files are produced by invoking the following command:
+
+@example
+autogen -L $@{prefix@}/share/autogen -Tagtexi-cmd.tpl \
+ -DLEVEL=section your-opts.def
+@end example
+
+@noindent
+Where @file{$@{prefix@}} is the AutoGen installation prefix
+and @file{your-opts.def} is the name of your product's option
+definition file.
+
+@node library-info
+@subsection library info docs
+
+The @file{texinfo} doc for libraries is derived from mostly the same
+information as is used for producing man pages @xref{man3}. The main
+difference is that there is only one output file and the individual
+functions are referenced from a @code{.texi} menu. There is also
+a small difference in the global attributes used:
+
+@multitable @columnfractions .02 .23 .65
+@item @tab lib_description
+@tab A description of the library. This text appears before the menu.
+If not provided, the standard boilerplate version will be inserted.
+@item
+@item @tab see_also
+@tab The @code{SEE ALSO} functionality is not supported for the
+@file{texinfo} documentation, so any @code{see_also} attribute will be ignored.
+@end multitable
+
+@noindent
+These files are produced by invoking the following commands:
+
+@example
+getdefs linenum srcfile template=aginfo3.tpl output=libexport.def \
+ <source-file-list>
+
+autogen -L $@{prefix@}/share/autogen -DLEVEL=section libexport.def
+@end example
+
+@noindent
+Where @file{$@{prefix@}} is the AutoGen installation prefix
+and @file{libexport.def} is some name that suits you.
+
+An example of this can be seen in this document, @xref{libopts procedures}.
+
+@c === SECTION MARKER
+
+@node AutoMan pages
+@section Automated Man Pages
+@cindex AutoMan pages
+
+AutoOpts provides two templates for producing man pages.
+The command (@file{man1}) pages are derived from the options definition
+file, and the library (@file{man3}) pages are derived from
+stylized comments (@pxref{getdefs Invocation}).
+
+@menu
+* man1:: command line man pages
+* man3:: library man pages
+@end menu
+
+@node man1
+@subsection command line man pages
+
+Using the option definitions for an AutoOpts client program,
+the @samp{agman-cmd.tpl} template will produce an nroff document
+suitable for use as a @samp{man(1)} page document for a command
+line command. The description section of the document is either
+the @samp{prog-man-descrip} text, if present, or the @samp{detail}
+text.
+
+Each option in the option definitions file is fully documented
+in its usage. This includes all the information documented
+above for each option (@pxref{option attributes}), plus
+the @samp{doc} attribute is appended. Since the @samp{doc}
+text is presumed to be designed for @code{texinfo} documentation,
+@code{sed} is used to convert some constructs from @code{texi}
+to @code{nroff}-for-@code{man}-pages. Specifically,
+
+@example
+convert @@code, @@var and @@samp into \fB...\fP phrases
+convert @@file into \fI...\fP phrases
+Remove the '@@' prefix from curly braces
+Indent example regions
+Delete the example commands
+Replace @samp{end example} command with ".br"
+Replace the @samp{@@*} command with ".br"
+@end example
+
+@noindent
+This document is produced by invoking the following command:
+
+@example
+autogen -L $@{prefix@}/share/autogen -Tagman-cmd.tpl options.def
+@end example
+
+@noindent
+Where @file{$@{prefix@}} is the AutoGen installation prefix and
+@file{options.def} is the name of your product's option definition file.
+I do not use this very much, so any feedback or improvements would be
+greatly appreciated.
+
+@node man3
+@subsection library man pages
+
+Two global definitions are required, and then
+one library man page is produced for each @code{export_func} definition
+that is found. It is generally convenient to place these definitions
+as @file{getdefs} comments (@pxref{getdefs Invocation}) near the procedure
+definition, but they may also be a separate AutoGen definitions file
+(@pxref{Definitions File}). Each function will be cross referenced
+with their sister functions in a @file{SEE ALSO} section. A global
+@code{see_also} definition will be appended to this cross referencing text.
+
+@noindent
+The two global definitions required are:
+
+@multitable @columnfractions .02 .15 .77
+@item @tab library
+@tab This is the name of your library, without the @file{lib} prefix.
+The AutoOpts library is named @file{libopts.so...}, so the @code{library}
+attribute would have the value @code{opts}.
+@item
+@item @tab header
+@tab Generally, using a library with a compiled program entails
+@code{#include}-ing a header file. Name that header with this attribute.
+In the case of AutoOpts, it is generated and will vary based on the
+name of the option definition file. Consequently, @file{your-opts.h} is
+specified.
+@end multitable
+
+@noindent
+The @code{export_func} definition should contain the following attributes:
+
+@multitable @columnfractions .02 .15 .77
+@item @tab name
+@tab The name of the procedure the library user may call.
+@item @tab what
+@tab A brief sentence describing what the procedure does.
+@item @tab doc
+@tab A detailed description of what the procedure does.
+It may ramble on for as long as necessary to properly describe it.
+@item @tab err
+@tab A short description of how errors are handled.
+@item @tab ret_type
+@tab The data type returned by the procedure.
+Omit this for @code{void} procedures.
+@item @tab ret_desc
+@tab Describe what the returned value is, if needed.
+@item @tab private
+@tab If specified, the function will @strong{not} be documented.
+This is used, for example, to produce external declarations for functions
+that are not available for public use, but are used in the generated text.
+@item
+@item @tab arg
+@tab This is a compound attribute that contains:
+@end multitable
+@multitable @columnfractions .02 .15 .15 .62
+@item @tab @tab arg_type
+@tab The data type of the argument.
+@item @tab @tab arg_name
+@tab A short name for it.
+@item @tab @tab arg_desc
+@tab A brief description.
+@end multitable
+
+@noindent
+As a @file{getdefs} comment, this would appear something like this:
+
+@example
+/*=--subblock=arg=arg_type,arg_name,arg_desc =*/
+/*=*
+ * library: opts
+ * header: your-opts.h
+=*/
+/*=export_func optionProcess
+ *
+ * what: this is the main option processing routine
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + int + argc + program arg count +
+ * arg: + char** + argv + program arg vector +
+ * ret_type: int
+ * ret_desc: the count of the arguments processed
+ *
+ * doc: This is what it does.
+ * err: When it can't, it does this.
+=*/
+@end example
+
+@noindent
+Note the @code{subblock} and @code{library} comments.
+@code{subblock} is an embedded @file{getdefs}
+option (@pxref{getdefs subblock}) that tells it how to parse the
+@code{arg} attribute. The @code{library} and @code{header} entries
+are global definitions that apply to all the documented functions.
+
+@c === SECTION MARKER
+
+@node getopt_long
+@section Using getopt(3C)
+@cindex getopt_long
+
+There is a template named, @code{getopt.tpl} that is distributed with
+AutoOpts. Using that template instead of @code{options.tpl} will produce
+completely independent source code that will parse command line options. It
+will utilize either the standard @code{getopt(3C)} or the GNU
+@code{getopt_long(3GNU)} function to drive the parsing. Which is used is
+selected by the presence or absence of the @code{long-opts} program attribute.
+It will save you from being dependent upon the @code{libopts} library @i{and}
+it produces code ready for internationalization. However, it also carries
+with it some limitations on the use of AutoOpts features and some requirements
+on the build environment.
+
+
+@menu
+* getopt limitations:: getopt feature limitations
+* getopt building:: getopt build requirements
+@end menu
+
+@node getopt limitations
+@subsection getopt feature limitations
+
+This list of limitations is relative to the full list of AutoOpts
+supported features, @xref{Features}.
+
+@enumerate
+@item
+You cannot automatically take advantage of environment variable options or
+automated parsing of configuration files (``rc'' or ``ini'' files).
+Consequently, the resulting code does not support @file{--load-opts} or
+@file{--save-opts} options automatically.
+
+@item
+You cannot use set membership, enumerated, range checked or stacked
+argument type options. In fact, you cannot use anything that depends
+upon the @code{libopts} library. You are constrained to options that
+take ``@code{string}'' arguments, though you may handle the option
+argument with a callback procedure.
+
+@item
+Special disablement and/or enablement prefixes are not recognized.
+
+@item
+Generated @code{main()} procedures will not work.
+
+@item
+Option coordination with external libraries will not work.
+
+@item
+Every option must be ``settable'' because the emitted code
+depends upon the @code{SET_OPT_XXX} macros having been defined.
+Specify this as a global (program) attribute.
+
+@item
+You must specify a main procedure of type ``main''. The
+@file{getopt.tpl} template depends upon being able to compile the
+traditional .c file into a program and get it to emit the usage text.
+
+@item
+For the same reason, the traditional option parsing table code must be
+emitted @b{before} the @file{getopt.tpl} template gets expanded.
+
+@item
+The usage text is, therefore, statically defined.
+@end enumerate
+
+@node getopt building
+@subsection getopt build requirements
+
+You must supply some compile and link options via environment variables.
+
+@table @samp
+@item srcdir
+In case the option definition file lives in a different directory.
+@item CFLAGS
+Any special flags required to compile. The flags from
+@code{autoopts-config cflags} will be included automatically. Since
+the creation of the option parsing code includes creating a program
+that prints out help text, if it is necessary to include files from
+various directories to compile that program, you will need to specify
+those directories with ``-Idirpath'' text in the @code{CFLAGS}.
+Some experimentation may be necessary in that case.
+
+@strong{NOTE}: the ``-Idirpath'' text is only needed if your option callback
+functions include code that require additional ``#include'' directives.
+@item LDFLAGS
+Any special flags required to link. The flags from
+@code{autoopts-config ldflags} will be included automatically. This
+is required only if additional link flags for the help text emission
+program might be needed.
+@item CC
+This is needed only if ``@code{cc}'' cannot be found in @code{$PATH}
+(or it is not the one you want).
+@end table
+
+To use this, set the exported environment variables and specify ``getopt'' as
+the default template in your option definitions file (@pxref{Identification}).
+You will have @i{four} new files. Assuming your definitions were in a file
+named @file{myprog-opts.def} and your program name was specified as
+@file{progname}, the resulting files would be created: @file{myprog-opts.h},
+@file{myprog-opts.c}, @file{getopt-progname.h} and @file{getopt-progname.c}.
+You must compile and link both @file{.c} files into your program. If there
+are link failures, then you are using AutoOpts features that require the
+@file{libopts} library. You must remove these features,
+@xref{getopt limitations}.
+
+These generated files depend upon configure defines to work correctly.
+Therefore, you must specify a @code{config-header} attribute
+(@pxref{programming attributes}) and ensure it has @code{#defines} for
+either @code{HAVE_STDINT_H} or @code{HAVE_INTTYPES_H}; either
+@code{HAVE_SYS_LIMITS_H} or @code{HAVE_LIMITS_H}; and
+@code{HAVE_SYSEXITS_H}, if the @file{sysexits.h} header is available.
+The required header files for these defines are, respectively,
+the @file{/usr/include} files named:
+@itemize @bullet
+@item stdint.h
+@item inttypes.h
+@item sys/limits.h
+@item limits.h
+@item sysexits.h
+@end itemize
+
+@noindent
+The following header files must also exist on the build platform:
+@itemize @bullet
+@item sys/types.h
+@item stdio.h
+@item string.h
+@item unistd.h -- or, for getopt_long:
+@item getopt.h
+@end itemize
+@c === SECTION MARKER
+
+@node i18n
+@section Internationalizing AutoOpts
+@cindex Internationalizing AutoOpts
+
+The generated code for AutoOpts will enable and disable the translation of
+AutoOpts run time messages. If @code{ENABLE_NLS} is defined at compile time
+and @code{no-xlate} has been not set to the value @emph{anything}, then the
+@code{_()} macro may be used to specify a translation function. If undefined,
+it will default to @code{gettext(3GNU)}. This define will also enable a
+callback function that @code{optionProcess} invokes at the beginning of option
+processing. The AutoOpts @code{libopts} library will always check for this
+@emph{compiled with NLS} flag, so @code{libopts} does not need to be specially
+compiled. The strings returned by the translation function will be
+@code{strdup(3)-ed} and kept. They will not be re-translated, even if the
+locale changes, but they will also not be dependent upon reused or unmappable
+memory.
+
+To internationalize option processing, you should first internationalize your
+program. Then, the option processing strings can be added to your translation
+text by processing the AutoOpts-generated @file{my-opts.c} file and adding the
+distributed @file{po/usage-txt.pot} file. (Also by extracting the strings
+yourself from the @file{usage-txt.h} file.) When you call
+@code{optionProcess}, all of the user visible AutoOpts strings will be passed
+through the localization procedure established with the @code{_()}
+preprocessing macro.
+
+All of this is @emph{dis}-abled if you specify the global attribute
+@code{no-xlate} to @emph{anything}.
+
+@c === SECTION MARKER
+
+@node Naming Conflicts
+@section Naming Conflicts
+@cindex Naming Conflicts
+
+AutoOpts generates a header file that contains many C preprocessing macros and
+several external names. For the most part, they begin with either @code{opt_}
+or @code{option}, or else they end with @code{_opt}. If this happens to
+conflict with other macros you are using, or if you are compiling multiple
+option sets in the same compilation unit, the conflicts can be avoided. You
+may specify an external name @code{prefix} (@pxref{program attributes}) for
+all of the names generated for each set of option definitions.
+
+Among these macros, several take an option name as a macro argument.
+Sometimes, this will inconveniently conflict. For example, if you specify an
+option named, @code{debug}, the emitted code will presume that @code{DEBUG} is
+not a preprocessing name. Or also, if you are building on a Windows platform,
+you may find that MicroSoft has usurped a number of user space names in its
+header files. Consequently, you will get a preprocessing error if you use,
+for example, @code{HAVE_OPT(DEBUG)} or @code{HAVE_OPT(INTERNAL)}
+(@pxref{HAVE_OPT}) in your code. You may trigger an obvious warning for such
+conflicts by specifying the @code{guard-option-names} attribute
+(@pxref{program attributes}). That emitted code will also @code{#undef}-ine
+the conflicting name.
+
+@node All Attribute Names
+@section All Attribute Names
+
+This is the list of all the option attributes used in the various
+option processing templates. There are several flavors of attributes,
+and these are not distinguished here.
+
+@itemize @bullet
+@item
+Valid, current attributes that you are encouraged to use.
+@item
+Internally generated attributes that you cannot use at all.
+I need to prefix these with a distinguished prefix. e.g. ``ao-''
+@item
+Valid attributes, but are deprecated. Alternates should be documented.
+@end itemize
+
+This list is derived by running many example option definitions through the
+option generation and man page templates and noting which attributes are
+actually used. There may be a few that are used but not exercised in my
+testing. If so, I need to ferret those out and test them, too.
+
+@example
+aliases allow-errors arg-default
+arg-optional arg-range arg-type
+argument call-proc code
+config-header copyright default
+deprecated descrip detail
+disable documentation eaddr
+enable enabled environrc
+equivalence exit-name explain
+export extract-code field
+file-fail-code flag flag-code
+flag-proc flags-cant flags-must
+full-usage gnu-usage guard-option-names
+help-value homerc ifdef
+ifndef immed-disable immediate
+include lib-name library
+long-opts main main-text
+main-type max min
+more-help-value must-set name
+no-command no-libopts no-misuse-usage
+no-preset no-xlate nomem-fail-code
+omitted-usage package prefix
+prefix-enum preserve-case prog-name
+prog-title reorder-args resettable
+scaled settable short-usage
+stack-arg std-value test-main
+translators unstack-arg usage
+usage-message usage-opt usage-type
+val-name val-upname value
+version
+@end example
+
+@node Option Define Names
+@section Option Definition Name Index
+@printindex vr
+
+@ignore
+END == AUTOINFO == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+@page
+@node Add-Ons
+@chapter Add-on packages for AutoGen
+
+This chapter includes several programs that either work closely
+with AutoGen (extracting definitions or providing special formatting
+functions), or leverage off of AutoGen technology. There is also
+a formatting library that helps make AutoGen possible.
+
+AutoOpts ought to appear in this list as well, but since it is
+the primary reason why many people would even look into AutoGen
+at all, I decided to leave it in the list of chapters.
+
+@menu
+* AutoFSM:: Automated Finite State Machine.
+* AutoXDR:: Combined RPC Marshalling.
+* AutoEvents:: Automated Event Management.
+* columns Invocation:: Invoking columns.
+* getdefs Invocation:: Invoking getdefs.
+* xml2ag Invocation:: Invoking xml2ag.
+* snprintfv:: The extensible format printing library.
+@end menu
+@ignore
+START == AUTOFSM == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node AutoFSM
+@section Automated Finite State Machine
+@cindex AutoFSM
+@cindex finite state machine
+
+The templates to generate a finite state machine in C or C++ is included
+with AutoGen. The documentation is not. The documentation is in HTML
+format for @uref{http://www.gnu.org/software/autogen/autofsm.html,viewing},
+or you can @uref{http://download.sourceforge.net/autogen/,download FSM}.
+
+@node AutoXDR
+@section Combined RPC Marshalling
+@cindex RPC
+@cindex rpcgen
+@cindex remote procedure call
+@cindex AutoXDR
+@cindex XDR
+
+The templates and NFSv4 definitions are not included with AutoGen in any way.
+The folks that designed NFSv4 noticed that much time and bandwidth was
+wasted sending queries and responses when many of them could be bundled.
+The protocol bundles the data, but there is no support for it in rpcgen.
+That means you have to write your own code to do that. Until now.
+Download this and you will have a large, complex example of how to use
+@code{AutoXDR} for generating the marshaling and unmarshaling of combined
+RPC calls. There is a brief example
+@uref{http://www.gnu.org/software/autogen/xdr/index.html,on the web}, but
+you should @uref{http://download.sourceforge.net/autogen/,download AutoXDR}.
+
+@c === SECTION MARKER
+
+@node AutoEvents
+@section Automated Event Management
+@cindex AutoEvents
+
+Large software development projects invariably have a need to manage
+the distribution and display of state information and state changes.
+In other words, they need to manage their software events. Generally,
+each such project invents its own way of accomplishing this and then
+struggles to get all of its components to play the same way. It is a
+difficult process and not always completely successful. This project
+helps with that.
+
+AutoEvents completely separates the tasks of supplying the data
+needed for a particular event from the methods used to manage the
+distribution and display of that event. Consequently, the programmer
+writing the code no longer has to worry about that part of the
+problem. Likewise the persons responsible for designing the event
+management and distribution no longer have to worry about getting
+programmers to write conforming code.
+
+This is a work in progress. See my
+@uref{http://www.gnu.org/software/autogen/autoevents.html,web page}
+on the subject, if you are interested.
+I have some useful things put together, but it is not ready
+to call a product.
+
+@ignore
+END == AUTOFSM == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+@page
+@ignore
+* * * * * * * * * * * * * * * * *
+@end ignore
+@include invoke-columns.texi
+
+@page
+@ignore
+* * * * * * * * * * * * * * * * *
+@end ignore
+@include invoke-getdefs.texi
+
+@page
+@ignore
+* * * * * * * * * * * * * * * * *
+@end ignore
+@include invoke-xml2ag.texi
+
+@page
+@ignore
+* * * * * * * * * * * * * * * * *
+@end ignore
+@include invoke-snprintfv.texi
+@ignore
+START == FUTURE == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+@ignore
+END == FUTURE == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+@page
+@node Future
+@chapter Some ideas for the future.
+@cindex futures
+
+Here are some things that might happen in the distant future.
+
+@itemize @bullet
+@item
+Fix up current tools that contain
+miserably complex perl, shell, sed, awk and m4 scripts
+to instead use this tool.
+@end itemize
+@node Copying This Manual
+@appendix Copying This Manual
+
+You may copy this manual under the terms of the FDL
+(@url{http://gnu.org/licenses/fdl.texi,the GNU Free Documentation License}).
+
+
+@cindex FDL, GNU Free Documentation License
+@center Version 1.2, November 2002
+
+@display
+Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+@end display
+
+@enumerate 0
+@item
+PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document @dfn{free} in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of ``copyleft'', which means that derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+
+@item
+APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein. The ``Document'', below,
+refers to any such manual or work. Any member of the public is a
+licensee, and is addressed as ``you''. You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A ``Modified Version'' of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A ``Secondary Section'' is a named appendix or a front-matter section
+of the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject. (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The ``Invariant Sections'' are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License. If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant. The Document may contain zero
+Invariant Sections. If the Document does not identify any Invariant
+Sections then there are none.
+
+The ``Cover Texts'' are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License. A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A ``Transparent'' copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text. A copy that is not ``Transparent'' is called ``Opaque''.
+
+Examples of suitable formats for Transparent copies include plain
+@sc{ascii} without markup, Texinfo input format, La@TeX{} input
+format, @acronym{SGML} or @acronym{XML} using a publicly available
+@acronym{DTD}, and standard-conforming simple @acronym{HTML},
+PostScript or @acronym{PDF} designed for human modification. Examples
+of transparent image formats include @acronym{PNG}, @acronym{XCF} and
+@acronym{JPG}. Opaque formats include proprietary formats that can be
+read and edited only by proprietary word processors, @acronym{SGML} or
+@acronym{XML} for which the @acronym{DTD} and/or processing tools are
+not generally available, and the machine-generated @acronym{HTML},
+PostScript or @acronym{PDF} produced by some word processors for
+output purposes only.
+
+The ``Title Page'' means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, ``Title Page'' means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+A section ``Entitled XYZ'' means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language. (Here XYZ stands for a
+specific section name mentioned below, such as ``Acknowledgements'',
+``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
+of such a section when you modify the Document means that it remains a
+section ``Entitled XYZ'' according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
+@item
+VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
+@item
+COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
+@item
+MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+
+@enumerate A
+@item
+Use in the Title Page (and on the covers, if any) a title distinct
+from that of the Document, and from those of previous versions
+(which should, if there were any, be listed in the History section
+of the Document). You may use the same title as a previous version
+if the original publisher of that version gives permission.
+
+@item
+List on the Title Page, as authors, one or more persons or entities
+responsible for authorship of the modifications in the Modified
+Version, together with at least five of the principal authors of the
+Document (all of its principal authors, if it has fewer than five),
+unless they release you from this requirement.
+
+@item
+State on the Title page the name of the publisher of the
+Modified Version, as the publisher.
+
+@item
+Preserve all the copyright notices of the Document.
+
+@item
+Add an appropriate copyright notice for your modifications
+adjacent to the other copyright notices.
+
+@item
+Include, immediately after the copyright notices, a license notice
+giving the public permission to use the Modified Version under the
+terms of this License, in the form shown in the Addendum below.
+
+@item
+Preserve in that license notice the full lists of Invariant Sections
+and required Cover Texts given in the Document's license notice.
+
+@item
+Include an unaltered copy of this License.
+
+@item
+Preserve the section Entitled ``History'', Preserve its Title, and add
+to it an item stating at least the title, year, new authors, and
+publisher of the Modified Version as given on the Title Page. If
+there is no section Entitled ``History'' in the Document, create one
+stating the title, year, authors, and publisher of the Document as
+given on its Title Page, then add an item describing the Modified
+Version as stated in the previous sentence.
+
+@item
+Preserve the network location, if any, given in the Document for
+public access to a Transparent copy of the Document, and likewise
+the network locations given in the Document for previous versions
+it was based on. These may be placed in the ``History'' section.
+You may omit a network location for a work that was published at
+least four years before the Document itself, or if the original
+publisher of the version it refers to gives permission.
+
+@item
+For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
+the Title of the section, and preserve in the section all the
+substance and tone of each of the contributor acknowledgements and/or
+dedications given therein.
+
+@item
+Preserve all the Invariant Sections of the Document,
+unaltered in their text and in their titles. Section numbers
+or the equivalent are not considered part of the section titles.
+
+@item
+Delete any section Entitled ``Endorsements''. Such a section
+may not be included in the Modified Version.
+
+@item
+Do not retitle any existing section to be Entitled ``Endorsements'' or
+to conflict in title with any Invariant Section.
+
+@item
+Preserve any Warranty Disclaimers.
+@end enumerate
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section Entitled ``Endorsements'', provided it contains
+nothing but endorsements of your Modified Version by various
+parties---for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
+@item
+COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled ``History''
+in the various original documents, forming one section Entitled
+``History''; likewise combine any sections Entitled ``Acknowledgements'',
+and any sections Entitled ``Dedications''. You must delete all
+sections Entitled ``Endorsements.''
+
+@item
+COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+
+@item
+AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an ``aggregate'' if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
+@item
+TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers. In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled ``Acknowledgements'',
+``Dedications'', or ``History'', the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
+@item
+TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except
+as expressly provided for under this License. Any other attempt to
+copy, modify, sublicense or distribute the Document is void, and will
+automatically terminate your rights under this License. However,
+parties who have received copies, or rights, from you under this
+License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+@item
+FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns. See
+@uref{http://www.gnu.org/copyleft/}.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License ``or any later version'' applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation.
+@end enumerate
+
+@page
+@heading ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+@smallexample
+@group
+ copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.2
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+@end group
+@end smallexample
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the ``with...Texts.'' line with this:
+
+@smallexample
+@group
+ with the Invariant Sections being @var{list their titles}, with
+ the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
+ being @var{list}.
+@end group
+@end smallexample
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
+
+@c Local Variables:
+@c ispell-local-pdict: "ispell-dict"
+@c End:
+
+@page
+@node Concept Index
+@unnumbered Concept Index
+
+@printindex cp
+@page
+@node Function Index
+@unnumbered Function Index
+
+@printindex fn
+@page
+@contents
+@bye
+
diff --git a/doc/auto-opts.tpl b/doc/auto-opts.tpl
new file mode 100644
index 0000000..79db885
--- /dev/null
+++ b/doc/auto-opts.tpl
@@ -0,0 +1,473 @@
+[= -*- Mode: texinfo -*-
+
+ AutoGen5 Template
+
+# This file is part of AutoGen.
+# AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+#
+# AutoGen is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# AutoGen is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+=]
+@page
+@node AutoOpts
+@chapter Automated Option Processing
+@cindex autoopts
+
+AutoOpts [=
+(make-tmp-dir)
+(out-push-new)
+=]
+test ${#AGexe} -eq 0 -o ${#top_srcdir} -eq 0 -o ${top_builddir} -eq 0 && \
+ die "AGexe, top_srcdir and top_builddir must be set"
+ag_cmd="${AGexe} -L${top_srcdir}/autoopts/tpl"
+test "X${top_srcdir}" = "X${top_builddir}" || \
+ ag_cmd="${ag_cmd} -L${top_builddir}/autoopts/tpl"
+readonly ag_cmd
+
+run_ag() {
+ echo ${ag_cmd} "$@" >&2
+ ${ag_cmd} "$@"
+}
+
+eval "`egrep '^AO_[A-Z]*=' ${top_srcdir}/VERSION`" 2> /dev/null
+echo ${AO_CURRENT}.${AO_REVISION}
+[=
+
+(shell (out-pop #t))
+
+=] is bundled with AutoGen. It is a tool that virtually eliminates the
+hassle of processing options and keeping man pages, info docs and usage text
+up to date. This package allows you to specify several program attributes, up
+to a hundred option types and many option attributes. From this, it then
+produces all the code necessary to parse and handle the command line and
+configuration file options, and the documentation that should go with your
+program as well.
+[=
+
+INVOKE get-text tag = autoopts
+
+=]
+@noindent
+First, specify your program attributes and its options to AutoOpts,
+as with the following example.
+
+@example
+[=
+
+(out-push-new (string-append tmp-dir "/check.def" ))
+
+=]AutoGen Definitions options;
+prog-name = check;
+prog-title = "Checkout Automated Options";
+long-opts;
+gnu-usage; /* GNU style preferred to default */
+
+main = { main-type = shell-process; };
+
+flag = {
+ name = check-dirs;
+ value = L; /* flag style option character */
+ arg-type = string; /* option argument indication */
+ max = NOLIMIT; /* occurrence limit (none) */
+ stack-arg; /* save opt args in a stack */
+ descrip = "Checkout directory list";
+ doc = 'name of each directory that is to be "checked out".';
+};
+
+flag = {
+ name = show_defs;
+ descrip = "Show the definition tree";
+ disable = dont; /* mark as enable/disable type */
+ /* option. Disable as `dont-' */
+ doc = 'disable, if you do not want to see the tree.';
+};
+[= (texi-escape-encode (out-pop #t)) \=]
+@end example
+
+@noindent
+This program will produce a program that digests its options and
+writes the values as shell script code to stdout.
+Run the following short script to produce this program:[= #
+
+Developer note: the following only works when AutoGen has been installed.
+Since this may be being built on a system where it has not been installed,
+the code below ensures we are running out tools out of the build directory =]
+
+@example
+[=
+
+(out-push-new (string-append tmp-dir "/mk-check.sh" ))
+
+\=]
+base=check
+BASE=`echo $base | tr a-z- A-Z_`
+cflags="-DTEST_${BASE} `autoopts-config cflags`"
+ldflags="`autoopts-config ldflags`"
+autogen ${base}.def
+cc -o ${base} -g ${cflags} ${base}.c ${ldflags}
+./${base} --help
+[= (texi-escape-encode (out-pop #t)) \=]
+@end example
+
+@noindent
+Running those commands yields:
+
+@example
+[= (out-push-new) \=]
+cd ${tmp_dir}
+base=check
+exec 4>&2 5>&1 1> ${base}.err 2>&1
+
+ case "$-" in
+ *x* ) clear_x=: ;;
+ * ) clear_x='set +x' ;;
+ esac
+ set -x
+
+ test -f ${base}.def || die "cannot locate ${base}.def"
+ test ! -f ${base} || rm -f ${base}
+ echo "include = '#include \"compat/compat.h\"';" >> ${base}.def
+ f='@="@="'`echo ${INCLUDES} ${CFLAGS}`' @'
+ {
+ echo set -x
+ sed -e "s@^cc @${CC:-cc} -include ${top_builddir}/config.h @" \
+ -e '/^cflags="/s'"${f}" \
+ -e 's@^autogen @run_ag @' \
+ mk-${base}.sh
+ } > mk-${base}
+
+ . ./mk-${base}
+
+ $clear_x
+
+exec 1>&5 5>&- 2>&4 4>&-
+
+test -x ./${base} || {
+ cat mk-${base}
+ printf '\n\nFAILURE LOG:\n\n'
+ cat ${base}.err
+ die cannot create ${base} program
+} >&2
+
+./${base} --help | sed 's/\t/ /g'
+[=
+
+(texi-escape-encode (shell (out-pop #t)))
+
+=]
+@end example
+[=
+
+INVOKE get-text tag = autoopts-main
+
+=]
+Here is an example program that uses the following set of definitions:
+
+@example
+[=
+
+ (out-push-new (string-append tmp-dir "/default-test.def" ))
+
+=]AutoGen Definitions options;
+
+prog-name = default-test;
+prog-title = 'Default Option Example';
+homerc = '$$/../share/default-test', '$HOME', '.';
+environrc;
+long-opts;
+gnu-usage;
+usage-opt;
+version = '1.0';
+main = {
+ main-type = shell-process;
+};
+#define DEBUG_FLAG
+#define WARN_FLAG
+#define WARN_LEVEL
+#define VERBOSE_FLAG
+#define VERBOSE_ENUM
+#define DRY_RUN_FLAG
+#define OUTPUT_FLAG
+#define INPUT_FLAG
+#define DIRECTORY_FLAG
+#define INTERACTIVE_FLAG
+#include stdoptions.def
+[=
+
+ (texi-escape-encode (out-pop #t))
+
+=]@end example
+
+@noindent
+Running a few simple commands on that definition file:
+
+@example
+autogen default-test.def
+copts="-DTEST_DEFAULT_TEST_OPTS `autoopts-config cflags`"
+lopts="`autoopts-config ldflags`"
+cc -o default-test $@{copts@} default-test.c $@{lopts@}
+@end example
+
+@noindent
+Yields a program which, when run with @file{--help}, prints out:
+
+@example
+[= (out-push-new) \=]
+set -x
+log_file=${tmp_dir}/ao-doc-log
+exec 7>&2 ; exec 2>> ${log_file}
+TOPDIR=`cd ${top_builddir} >/dev/null ; pwd`
+OPTDIR=${TOPDIR}/autoopts
+
+{
+ cd ${tmp_dir}
+ chmod 666 *.def
+ echo 'config-header = "config.h";' >> default-test.def
+ HOME=${tmp_dir} run_ag default-test.def
+ test -f default-test.c || die 'NO default-test.c PROGRAM'
+
+ opts="-o default-test -DTEST_DEFAULT_TEST_OPTS ${INCLUDES}"
+ ${CC:-cc} ${CFLAGS} ${opts} default-test.c ${LIBS} || \
+ rm -f ./default-test
+
+ test -x ./default-test || {
+ exec 2>&7
+ fail_text=`cat $log_file`$'\n\nprogram:\n'`cat default-test.c`
+ die 'NO default-test EXECUTABLE
+ '"$fail_text"'
+ === END FAIL TEXT'
+ }
+} >&2
+
+HOME=${tmp_dir} ${tmp_dir}/default-test --help | \
+ sed 's, , ,g;s,\([@{}]\),@\1,g'
+
+exec 2>&7 7>&-
+[=
+ (shell (out-pop #t))
+=]
+@end example
+[=
+
+INVOKE get-text tag = autoopts-api
+
+=]
+[=`
+
+f=../autoopts/libopts.texi
+test -f $f || {
+ f=${top_srcdir}/autoopts/libopts.texi
+ test -f $f || die "Cannot locate libopts.texi in $f"
+}
+cat $f
+
+`=]
+[=
+
+INVOKE get-text tag = "autoopts-data"
+
+=]
+@noindent
+Doing so with getdefs' option definitions yields this sample-getdefsrc file.
+I tend to be wordy in my @code{doc} attributes:
+
+@example
+[= (texi-escape-encode (shell "
+ cd ${tmp_dir}
+ run_ag -Trc-sample.tpl ${top_srcdir}/getdefs/opts.def >/dev/null
+ test -f sample-getdefsrc || die did not create sample-getdefsrc
+ cat sample-getdefsrc
+" )) =]
+@end example
+[=
+
+INVOKE get-text tag = "ao-data1"
+
+=]
+@example[=
+(out-push-new (string-append tmp-dir "/hello.c"))
+
+\=]
+
+#include <config.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <pwd.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <autoopts/options.h>
+int main(int argc, char ** argv) {
+ char const * greeting = "Hello";
+ char const * greeted = "World";
+ tOptionValue const * pOV = configFileLoad("hello.conf");
+
+ if (pOV != NULL) {
+ const tOptionValue* pGetV = optionGetValue(pOV, "greeting");
+
+ if ( (pGetV != NULL)
+ && (pGetV->valType == OPARG_TYPE_STRING))
+ greeting = strdup(pGetV->v.strVal);
+
+ pGetV = optionGetValue(pOV, "personalize");
+ if (pGetV != NULL) {
+ struct passwd * pwe = getpwuid(getuid());
+ if (pwe != NULL)
+ greeted = strdup(pwe->pw_gecos);
+ }
+
+ optionUnloadNested(pOV); /* deallocate config data */
+ }
+ printf("%s, %s!\n", greeting, greeted);
+ return 0;
+}
+[= (texi-escape-encode (out-pop #t)) \=]
+@end example
+
+@noindent
+With that text in a file named ``hello.c'', this short script:
+
+@example
+cc -o hello hello.c `autoopts-config cflags ldflags`
+./hello
+echo 'greeting Buzz off' > hello.conf
+./hello
+echo personalize > hello.conf
+./hello
+@end example
+
+@noindent
+will produce the following output:
+
+@example
+[= (texi-escape-encode (shell "
+cd ${tmp_dir}
+${CC:-cc} -o hello hello.c ${CFLAGS} ${LIBS} ${LDFLAGS} || \
+ die cannot compile hello
+./hello
+echo 'greeting Buzz off' > hello.conf
+./hello
+echo personalize > hello.conf
+./hello"
+)) =]
+@end example
+[=
+
+INVOKE get-text tag = "ao-data2"
+
+=]
+[=
+
+ (out-push-new)
+
+=]fn() {
+ cd ${top_builddir}/autoopts/test || return
+ VERBOSE=true
+ export VERBOSE
+ ${MAKE} check TESTS=errors.test > /dev/null 2>&1
+ if test ! -x testdir/errors
+ then
+ return
+ fi
+ cat <<-EOF
+
+ Here is the usage output example from AutoOpts error handling
+ tests. The option definition has argument reordering enabled:
+
+ @example
+EOF
+
+ ./testdir/errors -? | sed 's, , ,g;s,\([@{}]\),@\1,g'
+ cmd='errors operand1 -s first operand2 -X -- -s operand3'
+ cat <<-EOF
+ @end example
+
+ Using the invocation,
+ @example
+ test-${cmd}
+ @end example
+ you get the following output for your shell script to evaluate:
+
+ @example
+ `testdir/${cmd}`
+ @end example
+EOF
+}
+fn
+[=
+
+(shell (out-pop #t))
+
+=]
+@node script-parser
+@subsection Parsing with a Portable Script
+
+If you had used @code{test-main = optionParseShell} instead, then you can,
+at this point, merely run the program and it will write the parsing
+script to standard out. You may also provide this program with command
+line options to specify the shell script file to create or edit, and you
+may specify the shell program to use on the first shell script line.
+That program's usage text would look something like the following
+and the script parser itself would be very verbose:
+
+@example
+[= `
+
+log=${tmp_dir}/../genshellopt.log
+
+(
+ set -x
+ opts="-o genshellopt -DTEST_GETDEFS_OPTS ${INCLUDES}"
+ exec 3> ${tmp_dir}/genshellopt.def
+ cat ${top_srcdir}/getdefs/opts.def >&3
+ echo "test_main = 'optionParseShell';" >&3
+ echo 'config-header = "config.h";' >&3
+ exec 3>&-
+
+ cd ${tmp_dir}
+ HOME='' run_ag -t40 genshellopt.def
+ test $? -eq 0 || die "autogen failed to create genshellopt.c - See ${log}"
+
+ ${CC} ${CFLAGS} ${opts} genshellopt.c ${LIBS}
+ test $? -eq 0 || die "could not compile genshellopt.c - See ${log}"
+) > ${log} 2>&1
+
+test -x ${tmp_dir}/genshellopt || \
+ die "NO GENSHELLOPT PROGRAM - See ${log}"
+
+${tmp_dir}/genshellopt --help > ${tmp_dir}/genshellopt.hlp
+
+${tmp_dir}/genshellopt -o ${tmp_dir}/genshellopt.sh || \
+ die cannot create ${tmp_dir}/genshellopt.sh
+
+sedcmd='s,\t, ,g;s,\\([@{}]\\),@\\1,g'
+sed "${sedcmd}" ${tmp_dir}/genshellopt.hlp
+cat <<- \_EOF_
+ @end example
+
+ @noindent
+ Resulting in the following script:
+ @example
+ _EOF_
+
+sed "${sedcmd}" ${tmp_dir}/genshellopt.sh
+
+` =]
+@end example
+[=
+
+INVOKE get-text tag = autoinfo
+
+=]
diff --git a/doc/auto_gen-tpl.in b/doc/auto_gen-tpl.in
new file mode 100644
index 0000000..20ec1ac
--- /dev/null
+++ b/doc/auto_gen-tpl.in
@@ -0,0 +1,637 @@
+[= AutoGen5 template
+
+texi
+
+## Documentation template
+##
+## Author: Bruce Korb <bkorb@gnu.org>
+## Time-stamp: "2012-03-31 18:05:17 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+## ---------------------------------------------------------------------
+
+# Set up some global Scheme variables
+#
+(setenv "SHELL" "@CONFIG_SHELL@")
+
+(define texi-file-source (getenv "DOC_TEXT"))
+
+(define texi-escape-encode (lambda (in-str)
+ (string-substitute in-str
+ '("@" "{" "}")
+ '("@@" "@{" "@}")
+) ))
+
+(define temp-txt "")
+(define text-tag "")
+(define func-name "")
+(define func-str "")
+(define func-name "")
+(define func-str "")
+(make-tmp-dir)
+
+=][= # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+\=]
+@settitle [= package =] - [= prog-title =]
+@setchapternewpage off
+@syncodeindex pg cp
+@c %**end of header
+@copying
+This manual is for GNU AutoGen version [= `
+ UPDATED=\`date '+%B %Y'\`
+ echo ${AG_REVISION}, updated ${UPDATED}` =].
+
+Copyright @copyright{} [= copyright.date =] by Bruce Korb.
+
+@quotation
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.2 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+@end quotation
+@end copying
+
+@ignore
+[=(set-writable) (dne "")=]
+
+Plus bits and pieces gathered from all over the source/build
+directories:
+[= ` for f in ${DOC_DEPENDS} ; do echo " $f" ; done ` =]
+
+@end ignore
+
+@dircategory GNU programming tools
+@direntry
+* AutoGen: (autogen). [= prog-title =]
+@end direntry
+
+@ifinfo
+@ifnothtml
+This file documents [= package =] Version [=`echo ${AG_REVISION}`=].
+
+AutoGen copyright @copyright{} [= copyright.date =] Bruce Korb
+AutoOpts copyright @copyright{} [= copyright.date =] Bruce Korb
+snprintfv copyright @copyright{} 1999-2000 Gary V. Vaughan
+
+[=(gpl "AutoGen" "")=]
+
+@ignore
+Permission is granted to process this file through TeX and print the
+results, provided the printed document carries copying permission
+notice identical to this one except for the removal of this paragraph.
+@end ignore
+@end ifnothtml
+@end ifinfo
+
+@finalout
+@titlepage
+@title AutoGen - [= prog-title =]
+@subtitle For version [=`
+ echo ${AG_REVISION}, ${UPDATED} `=]
+@author Bruce Korb
+@author @email{[= (texi-escape-encode "bkorb@gnu.org") =]}
+
+@page
+@vskip 0pt plus 1filll
+AutoGen copyright @copyright{} [= copyright.date =] Bruce Korb
+@sp 2
+This is the second edition of the GNU AutoGen documentation,
+@sp 2
+Published by Bruce Korb, 910 Redwood Dr., Santa Cruz, CA 95060
+
+[=(gpl "AutoGen" "")=]
+
+@insertcopying
+@end titlepage
+
+@node Top, Introduction, , (dir)
+@top The Automated Program Generator
+@comment node-name, next, previous, up
+
+This file documents AutoGen version [=`
+ echo ${AG_REVISION}`=]. It is a tool designed
+for generating program files that contain repetitive text with varied
+substitutions. This document is very long because it is intended as a
+reference document. For a quick start example, @xref{Example Usage}.
+
+The AutoGen distribution includes the basic generator engine and
+several add-on libraries and programs. Of the most general interest
+would be Automated Option processing, @xref{AutoOpts}, which also
+includes stand-alone support for configuration file parsing, @xref{Features}.
+Please see the ``Add-on packages for AutoGen'' section for additional
+programs and libraries associated with AutoGen.
+
+This edition documents version [=`echo ${AG_REVISION}, ${UPDATED}.`=]
+
+[=`cat autogen-intro.texi`=]
+
+@node Directives
+@section Controlling What Gets Processed
+@cindex directives
+
+Definition processing directives can @strong{only} be processed
+if the '#' character is the first character on a line. Also, if you
+want a '#' as the first character of a line in one of your string
+assignments, you should either escape it by preceding it with a
+backslash @samp{\}, or by embedding it in the string as in @code{"\n#"}.
+
+All of the normal C preprocessing directives are recognized, though
+several are ignored. There is also an additional @code{#shell} -
+@code{#endshell} pair. Another minor difference is that AutoGen
+directives must have the hash character (@code{#}) in column 1.
+
+The final tweak is that @code{#!} is treated as a comment line.
+Using this feature, you can use: @samp{#! /usr/local/bin/autogen}
+as the first line of a definitions file, set the mode to executable
+and "run" the definitions file as if it were a direct invocation of
+AutoGen. This was done for its hack value.
+
+The ignored directives are:
+[=
+
+FOR directive =][=
+
+ (if (exist? "dummy")
+ (string-downcase! (sprintf "@code{#%s}, " (get "name")))) =][=
+
+ENDFOR directive =]and @code{#if}.
+Note that when ignoring the @code{#if} directive, all intervening
+text through its matching @code{#endif} is also ignored,
+including the @code{#else} clause.
+
+The AutoGen directives that affect the processing of
+definitions are:
+
+@table @code[=
+FOR directive "\n" =][=
+ IF (exist? "text") =]
+@item #[=% name (string-downcase! "%s") =][= % arg " %s" =]
+@cindex #[=% name (string-downcase! "%s") =]
+@cindex [=% name (string-downcase! "%s") =] directive
+[= id-file =]
+[=text =][=
+ ENDIF =][=
+ENDFOR directive=]
+@end table
+[=
+
+INVOKE get-text tag = COMMENTS
+
+=]
+@node Full Syntax
+@section Finite State Machine Grammar
+
+The preprocessing directives and comments are not part of the grammar. They
+are handled by the scanner/lexer. The following was extracted directly from
+the generated defParse-fsm.c source file. The "EVT:" is the token seen,
+the "STATE:" is the current state and the entries in this table describe
+the next state and the action to take. Invalid transitions were removed
+from the table.
+
+@ignore
+Extracted from $top_srcdir/agen5/defParse.y
+@end ignore
+@example
+[= `
+
+if test -z "$top_srcdir" || test ! -d "$top_srcdir"
+then top_srcdir=.. ; fi
+f=${top_srcdir}/agen5/defParse-fsm.c
+test -f ${f} || die missing generated file: $f
+sed -n -e '/^dp_trans_table/,/^};$/p' ${f} | \
+ sed '/ \&dp_do_invalid /d;/^ *}/d;s/@/@@/g;s/{/@{/g;s/}/@}/g'
+
+` =]
+@end example
+[=
+
+INVOKE get-text tag = TEMPLATE
+
+=]
+@ignore
+
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+@end ignore
+@page
+@node AutoGen Functions
+@section AutoGen Scheme Functions
+
+AutoGen uses Guile to interpret Scheme expressions within AutoGen
+macros. All of the normal Guile functions are available, plus several
+extensions (@pxref{Common Functions}) have been added to
+augment the repertoire of string manipulation functions and
+manage the state of AutoGen processing.
+
+This section describes those functions that are specific to AutoGen.
+Please take note that these AutoGen specific functions are not loaded
+and thus not made available until after the command line options have
+been processed and the AutoGen definitions have been loaded. They may,
+of course, be used in Scheme functions that get defined at those times,
+but they cannot be invoked.
+
+@menu[=
+
+FOR gfunc =][=
+ (if (not (exist? "name"))
+ (error "NO NAME")) =][=
+
+ IF (not (exist? "general_use")) =][=
+ INVOKE emit-menu-entry =][=
+ ENDIF =][=
+
+ENDFOR gfunc =]
+* SCM autogen-version:: @file{autogen-version} - ``[= version =]''
+* SCM c-file-line-fmt:: format file info as, ``@code{#line nn "file"}''
+@end menu
+
+[=
+FOR gfunc =][=
+ IF (not (exist? "general_use")) =][=
+ INVOKE emit-scm-func =][=
+ ENDIF general_use =][=
+ENDFOR gfunc
+=]
+@ignore
+Generated [= (tpl-file-line) =].
+@end ignore
+
+@node SCM autogen-version
+@subsection @file{autogen-version} - autogen version number
+@findex autogen-version
+
+This is a symbol defining the current AutoGen version number string.
+It was first defined in AutoGen-5.2.14.
+It is currently ``[= version =]''.
+
+@node SCM c-file-line-fmt
+@subsection format file info as, ``@code{#line nn "file"}''
+@findex c-file-line-fmt
+
+This is a symbol that can easily be used with the functions
+@xref{SCM tpl-file-line}, and @xref{SCM def-file-line}.
+These will emit C program @code{#line} directives pointing to template
+and definitions text, respectively.
+@ignore
+
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+@end ignore
+@page
+@node Common Functions
+@section Common Scheme Functions
+
+This section describes a number of general purpose functions that make
+the kind of string processing that AutoGen does a little easier.
+Unlike the AutoGen specific functions (@pxref{AutoGen Functions}),
+these functions are available for direct use during definition load time.
+The equality test (@pxref{SCM =}) is ``overloaded'' to do string equivalence
+comparisons. If you are looking for inequality, the Scheme/Lisp way
+of spelling that is, ``(not (= ...))''.
+
+@menu[=
+
+FOR gfunc =][=
+
+ IF (exist? "general_use") =][=
+ INVOKE emit-menu-entry =][=
+ ENDIF =][=
+
+ENDFOR gfunc
+
+=]
+@end menu
+
+[=
+
+FOR gfunc =][=
+ IF (exist? "general_use") =][=
+ INVOKE emit-scm-func =][=
+ ENDIF general_use =][=
+ENDFOR gfunc
+
+=][=
+
+INVOKE get-text tag = MACROS
+
+=]
+@menu
+* AGMacro syntax:: AutoGen Macro Syntax[=
+FOR macfunc =][=
+ IF (exist? "desc") =][=
+ (sprintf "\n* %-18s %s - %s"
+ (string-append (get "name") "::" )
+ (string-upcase! (get "name"))
+ (get "what") ) =][=
+ ENDIF =][=
+ENDFOR macfunc=]
+@end menu
+@node AGMacro syntax
+@subsection AutoGen Macro Syntax
+@cindex macro syntax
+
+The general syntax is:
+
+@example
+[ @{ <native-macro-name> | <user-defined-name> @} ] [ <arg> ... ]
+@end example
+
+@noindent
+The syntax for @code{<arg>} depends on the particular macro,
+but is generally a full expression (@pxref{expression syntax}).
+Here are the exceptions to that general rule:
+
+@enumerate
+@item
+@code{INVOKE} macros, implicit or explicit, must be followed by
+a list of name/string value pairs. The string values are
+@i{simple expressions}, as described above.
+
+That is, the @code{INVOKE} syntax is one of these two:
+@example
+<user-macro-name> [ <name> [ = <expression> ] ... ]
+
+INVOKE <name-expression> [ <name> [ = <expression> ] ... ]
+@end example
+
+@item
+AutoGen FOR macros must be in one of three forms:
+
+@example
+FOR <name> [ <separator-string> ]
+
+FOR <name> (...Scheme expression list)
+
+FOR <name> IN <string-entry> [ ... ]
+@end example
+@noindent
+where:
+@table @samp
+@item <name>
+must be a simple name.
+@item <separator-string>
+is inserted between copies of the enclosed block. Do not try to use ``IN''
+as your separator string. It won't work.
+@item <string-entry>
+is an entry in a list of strings. ``@code{<name>}'' is assigned
+each value from the ``@code{IN}'' list before expanding the @code{FOR} block.
+@item (...Scheme expression list)
+is expected to contain one or more of the @code{for-from},
+@code{for-to}, @code{for-by}, and @code{for-sep} functions.
+(@xref{FOR}, and @ref{AutoGen Functions})
+@end table
+
+The first two forms iterate over the @code{FOR} block if @code{<name>}
+is found in the AutoGen values. The last form will create the AutoGen
+value named @code{<name>}.
+
+@item
+AutoGen @code{DEFINE} macros must be followed by a simple name.
+Anything after that is ignored. Consequently, that ``comment space''
+may be used to document any named values the macro expects to have
+set up as arguments. @xref{DEFINE}.
+
+@item
+The AutoGen @code{COMMENT}, @code{ELSE}, @code{ESAC} and the @code{END*}
+macros take no arguments and ignore everything after the macro name
+(e.g. see @ref{COMMENT})
+@end enumerate[=
+
+
+# FOR each defined function,
+ this code will insert the extracted documentation =][=
+
+FOR macfunc =][=
+ IF (exist? "desc") =]
+
+@node [=name=]
+@subsection [=% name (string-upcase! "%s") =] - [=what=]
+[= id-file =]
+@findex [=% name (string-upcase! "%s") =][=
+ (if (exist? "cindex")
+ (string-append "\n@cindex "
+ (join "\n@cindex " (stack "cindex")) )) =]
+
+[=desc=][=
+ ENDIF desc exists =][=
+ENDFOR macfunc=]
+[=
+
+INVOKE get-text tag = augmenting
+
+=]
+@ignore
+
+Invocation section from [= ag-texi =]
+
+@end ignore
+@page
+
+@include [= ag-texi =]
+
+[=
+
+INVOKE get-text tag = installation =][=
+INCLUDE "auto-opts.tpl"
+
+=]
+@page
+@node Add-Ons
+@chapter Add-on packages for AutoGen
+
+This chapter includes several programs that either work closely
+with AutoGen (extracting definitions or providing special formatting
+functions), or leverage off of AutoGen technology. There is also
+a formatting library that helps make AutoGen possible.
+
+AutoOpts ought to appear in this list as well, but since it is
+the primary reason why many people would even look into AutoGen
+at all, I decided to leave it in the list of chapters.
+
+@menu
+* AutoFSM:: Automated Finite State Machine.
+* AutoXDR:: Combined RPC Marshalling.
+* AutoEvents:: Automated Event Management.
+* columns Invocation:: Invoking columns.
+* getdefs Invocation:: Invoking getdefs.
+* xml2ag Invocation:: Invoking xml2ag.
+* snprintfv:: The extensible format printing library.
+@end menu
+[=
+
+INVOKE get-text tag = autofsm
+
+=][=
+
+FOR addon-texi
+
+=]
+@page
+@ignore
+* * * * * * * * * * * * * * * * *
+@end ignore
+@include [= addon-texi =]
+[=
+
+ENDFOR =][=
+
+INVOKE get-text tag = Future
+
+=]
+@page
+@node Future
+@chapter Some ideas for the future.
+@cindex futures
+
+Here are some things that might happen in the distant future.
+
+@itemize @bullet
+@item
+Fix up current tools that contain
+miserably complex perl, shell, sed, awk and m4 scripts
+to instead use this tool.
+@end itemize
+@node Copying This Manual
+@appendix Copying This Manual
+
+You may copy this manual under the terms of the FDL
+(@url{http://gnu.org/licenses/fdl.texi,the GNU Free Documentation License}).
+
+[=`sed '1,/^@appendixsec/d' fdl.texi`=]
+
+@page
+@node Concept Index
+@unnumbered Concept Index
+
+@printindex cp
+@page
+@node Function Index
+@unnumbered Function Index
+
+@printindex fn
+@page
+@contents
+@bye
+[=
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+=][=
+
+DEFINE id-file =]
+@ignore
+Generated [= (tpl-file-line) =].
+Extracted from [=srcfile=] line [=linenum=].
+@end ignore
+[=
+
+ENDDEF id-file
+
+# # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE get-text =][=
+
+(set! text-tag
+ (string-append "@ignore\n%s == "
+ (string-upcase! (get "tag")) " == %s or the surrounding 'ignore's\n"
+ "Extraction from autogen.texi\n"
+ "@end ignore" ))
+
+(extract texi-file-source text-tag) =][=
+
+ENDDEF get-text
+
+# # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE set-func-name =][=
+
+ (set! func-name (shell (sprintf "echo '%s' |
+ sed -e 's/-p$/?/' -e 's/-x$/!/' -e 's/-to-/->/'"
+ (string-tr! (get "name") "A-Z_^" "a-z--") )) )
+
+ (set! func-str
+ (if (exist? "string") (get "string") func-name)) =][=
+
+ENDDEF
+
+# # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE emit-scm-func =][=
+
+ INVOKE set-func-name =]
+@node SCM [= (. func-str)=]
+@subsection [= (string-append "@file{" func-name "} - " (get "what")) =]
+@findex [= (. func-name) =][=
+% string "\n@findex %s" =]
+[= id-file =]
+Usage: ([= (. func-str) =][=
+
+ FOR exparg =] [=
+
+ arg_optional "[ " =][=arg_name=][= arg_list " ..." =][=
+ arg_optional " ]" =][=
+
+ ENDFOR exparg =])
+@*
+[= string (string-append func-name ": ") =][=
+ (shell (string-append
+ "(sed \"s/^\\`'//\" <<\\_EODoc_\n"
+ (if (exist? "doc") (get "doc") "This function is not documented.")
+ "\n_EODoc_\n)" ))=]
+[=
+ IF (exist? "exparg") =]
+Arguments:[=
+ FOR exparg =]
+@*
+[=arg_name=] - [=
+
+ arg_optional "Optional - " =][=
+ IF (exist? "arg_desc") =][=arg_desc=][=
+ ELSE =]Undocumented[=
+ ENDIF =][=
+
+ ENDFOR exparg =][=
+
+ ELSE
+ =]
+This Scheme function takes no arguments.[=
+ ENDIF =]
+[=
+
+ENDDEF
+
+# # # # # # # # # # # # # # # # # # # # =][=
+
+DEFINE emit-menu-entry =][=
+
+ INVOKE set-func-name =][=
+ (sprintf "\n* SCM %-20s @file{%s} - %s" (string-append func-str "::")
+ func-name (get "what"))
+ =][=
+ENDDEF emit-menu-entry
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+=][= #
+
+;; Local Variables:
+;; indent-tabs-mode: nil
+;; mode: texinfo
+;; End:
+
+auto_gen-tpl.in ends here =]
diff --git a/doc/autogen-intro.texi b/doc/autogen-intro.texi
new file mode 100644
index 0000000..24e47d0
--- /dev/null
+++ b/doc/autogen-intro.texi
@@ -0,0 +1,788 @@
+
+@menu
+* Introduction:: AutoGen's Purpose
+* Definitions File:: AutoGen Definitions File
+* Template File:: AutoGen Template
+* Augmenting AutoGen:: Augmenting AutoGen Features
+* autogen Invocation:: Invoking AutoGen
+* Installation:: Configuring and Installing
+* AutoOpts:: Automated Option Processing
+* Add-Ons:: Add-on packages for AutoGen
+* Future:: Some ideas for the future.
+* Copying This Manual:: Copying This Manual
+* Concept Index:: General index
+* Function Index:: Function index
+@end menu
+
+@ignore
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+@end ignore
+@page
+@node Introduction
+@chapter Introduction
+@cindex Introduction
+
+AutoGen is a tool designed for generating program files that contain
+repetitive text with varied substitutions. Its goal is to simplify the
+maintenance of programs that contain large amounts of repetitious text.
+This is especially valuable if there are several blocks of such text
+that must be kept synchronized in parallel tables.
+
+An obvious example is the problem of maintaining the code required for
+processing program options and configuration settings. Processing options
+requires a minimum of four different constructs be kept in proper order in
+different places in your program. You need at least:
+
+@enumerate
+@item
+The flag character in the flag string,
+@item
+code to process the flag when it is encountered,
+@item
+a global state variable or two, and
+@item
+a line in the usage text.
+@end enumerate
+
+@noindent
+You will need more things besides this if you choose to implement long option
+names, configuration (rc/ini) file processing, environment variable settings
+and keep all the documentation for these up to date. This can be done
+mechanically; with the proper templates and this program. In fact, it has
+already been done and AutoGen itself uses it@: @xref{AutoOpts}. For a simple
+example of Automated Option processing, @xref{Quick Start}. For a full list
+of the Automated Option features, @xref{Features}. Be forewarned, though, the
+feature list is ridiculously extensive.
+
+@menu
+* Generalities:: The Purpose of AutoGen
+* Example Usage:: A Simple Example
+* csh/zsh caveat:: csh/zsh caveat
+* Testimonial:: A User's Perspective
+@end menu
+
+@c === SECTION MARKER
+
+@node Generalities
+@section The Purpose of AutoGen
+
+The idea of this program is to have a text file, a template if
+you will, that contains the general text of the desired output file.
+That file includes substitution expressions and sections of text that are
+replicated under the control of separate definition files.
+
+@cindex design goals
+
+AutoGen was designed with the following features:
+
+@enumerate
+@item
+The definitions are completely separate from the template. By completely
+isolating the definitions from the template it greatly increases the
+flexibility of the template implementation. A secondary goal is that a
+template user only needs to specify those data that are necessary to describe
+his application of a template.
+
+@item
+Each datum in the definitions is named. Thus, the definitions can be
+rearranged, augmented and become obsolete without it being necessary to
+go back and clean up older definition files. Reduce incompatibilities!
+
+@item
+Every definition name defines an array of values, even when there is
+only one entry. These arrays of values are used to control the
+replication of sections of the template.
+
+@item
+There are named collections of definitions. They form a nested hierarchy.
+Associated values are collected and associated with a group name.
+These associated data are used collectively in sets of substitutions.
+
+@item
+The template has special markers to indicate where substitutions are
+required, much like the @code{$@{VAR@}} construct in a shell @code{here doc}.
+These markers are not fixed strings. They are specified at the start of
+each template. Template designers know best what fits into their
+syntax and can avoid marker conflicts.
+
+We did this because it is burdensome and difficult to avoid conflicts
+using either M4 tokenization or C preprocessor substitution rules. It
+also makes it easier to specify expressions that transform the value.
+Of course, our expressions are less cryptic than the shell methods.
+
+@item
+These same markers are used, in conjunction with enclosed keywords, to
+indicate sections of text that are to be skipped and for sections of
+text that are to be repeated. This is a major improvement over using C
+preprocessing macros. With the C preprocessor, you have no way of
+selecting output text because it is an @i{un}varying, mechanical
+substitution process.
+
+@item
+Finally, we supply methods for carefully controlling the output.
+Sometimes, it is just simply easier and clearer to compute some text or
+a value in one context when its application needs to be later. So,
+functions are available for saving text or values for later use.
+@end enumerate
+
+@c === SECTION MARKER
+
+@node Example Usage
+@section A Simple Example
+@cindex example, simple AutoGen
+
+This is just one simple example that shows a few basic features.
+If you are interested, you also may run "make check" with the
+@code{VERBOSE} environment variable set and see a number of other
+examples in the @file{agen5/test/testdir} directory.
+
+Assume you have an enumeration of names and you wish to associate some
+string with each name. Assume also, for the sake of this example,
+that it is either too complex or too large to maintain easily by hand.
+We will start by writing an abbreviated version of what the result
+is supposed to be. We will use that to construct our output templates.
+
+@noindent
+In a header file, @file{list.h}, you define the enumeration
+and the global array containing the associated strings:
+
+@example
+typedef enum @{
+ IDX_ALPHA,
+ IDX_BETA,
+ IDX_OMEGA @} list_enum;
+
+extern char const* az_name_list[ 3 ];
+@end example
+
+@noindent
+Then you also have @file{list.c} that defines the actual strings:
+
+@example
+#include "list.h"
+char const* az_name_list[] = @{
+ "some alpha stuff",
+ "more beta stuff",
+ "final omega stuff" @};
+@end example
+
+@noindent
+First, we will define the information that is unique for each enumeration
+name/string pair. This would be placed in a file named, @file{list.def},
+for example.
+
+@example
+autogen definitions list;
+list = @{ list_element = alpha;
+ list_info = "some alpha stuff"; @};
+list = @{ list_info = "more beta stuff";
+ list_element = beta; @};
+list = @{ list_element = omega;
+ list_info = "final omega stuff"; @};
+@end example
+
+The @code{autogen definitions list;} entry defines the file as an AutoGen
+definition file that uses a template named @code{list}. That is followed by
+three @code{list} entries that define the associations between the
+enumeration names and the strings. The order of the differently named
+elements inside of list is unimportant. They are reversed inside of the
+@code{beta} entry and the output is unaffected.
+
+Now, to actually create the output, we need a template or two that can be
+expanded into the files you want. In this program, we use a single template
+that is capable of multiple output files. The definitions above refer to a
+@file{list} template, so it would normally be named, @file{list.tpl}.
+
+It looks something like this.
+(For a full description, @xref{Template File}.)
+
+@example
+[+ AutoGen5 template h c +]
+[+ CASE (suffix) +][+
+ == h +]
+typedef enum @{[+
+ FOR list "," +]
+ IDX_[+ (string-upcase! (get "list_element")) +][+
+ ENDFOR list +] @} list_enum;
+
+extern char const* az_name_list[ [+ (count "list") +] ];
+[+
+
+ == c +]
+#include "list.h"
+char const* az_name_list[] = @{[+
+ FOR list "," +]
+ "[+list_info+]"[+
+ ENDFOR list +] @};[+
+
+ESAC +]
+@end example
+
+The @code{[+ AutoGen5 template h c +]} text tells AutoGen that this is
+an AutoGen version 5 template file; that it is to be processed twice;
+that the start macro marker is @code{[+}; and the end marker is
+@code{+]}. The template will be processed first with a suffix value of
+@code{h} and then with @code{c}. Normally, the suffix values are
+appended to the @file{base-name} to create the output file name.
+
+The @code{[+ == h +]} and @code{[+ == c +]} @code{CASE} selection clauses
+select different text for the two different passes. In this example,
+the output is nearly disjoint and could have been put in two separate
+templates. However, sometimes there are common sections and this is
+just an example.
+
+The @code{[+FOR list "," +]} and @code{[+ ENDFOR list +]} clauses delimit
+a block of text that will be repeated for every definition of @code{list}.
+Inside of that block, the definition name-value pairs that
+are members of each @code{list} are available for substitutions.
+
+The remainder of the macros are expressions. Some of these contain
+special expression functions that are dependent on AutoGen named values;
+others are simply Scheme expressions, the result of which will be
+inserted into the output text. Other expressions are names of AutoGen
+values. These values will be inserted into the output text. For example,
+@code{[+list_info+]} will result in the value associated with
+the name @code{list_info} being inserted between the double quotes and
+@code{(string-upcase! (get "list_element"))} will first "get" the value
+associated with the name @code{list_element}, then change the case of
+all the letters to upper case. The result will be inserted into the
+output document.
+
+If you have compiled AutoGen, you can copy out the template and definitions
+as described above and run @code{autogen list.def}. This will produce
+exactly the hypothesized desired output.
+
+One more point, too. Lets say you decided it was too much trouble to figure
+out how to use AutoGen, so you created this enumeration and string list with
+thousands of entries. Now, requirements have changed and it has become
+necessary to map a string containing the enumeration name into the enumeration
+number. With AutoGen, you just alter the template to emit the table of names.
+It will be guaranteed to be in the correct order, missing none of the entries.
+If you want to do that by hand, well, good luck.
+
+@c === SECTION MARKER
+
+@node csh/zsh caveat
+@section csh/zsh caveat
+
+AutoGen tries to use your normal shell so that you can supply shell code
+in a manner you are accustomed to using. If, however, you use csh or
+zsh, you cannot do this. Csh is sufficiently difficult to program that
+it is unsupported. Zsh, though largely programmable, also has some
+anomalies that make it incompatible with AutoGen usage. Therefore, when
+invoking AutoGen from these environments, you must be certain to set the
+SHELL environment variable to a Bourne-derived shell, e.g., sh, ksh or
+bash.
+
+Any shell you choose for your own scripts need to follow these basic
+requirements:
+
+@enumerate
+@item
+It handles @code{trap ":" $sig} without output to standard out. This is done
+when the server shell is first started. If your shell does not handle this,
+then it may be able to by loading functions from its start up files.
+@item
+At the beginning of each scriptlet, the command @code{\\cd $PWD}
+is inserted. This ensures that @code{cd} is not aliased to something
+peculiar and each scriptlet starts life in the execution directory.
+@item
+At the end of each scriptlet, the command @code{echo mumble} is
+appended. The program you use as a shell must emit the single
+argument @code{mumble} on a line by itself.
+@end enumerate
+
+@c === SECTION MARKER
+
+@node Testimonial
+@section A User's Perspective
+
+@format
+Alexandre wrote:
+>
+> I'd appreciate opinions from others about advantages/disadvantages of
+> each of these macro packages.
+@end format
+
+I am using AutoGen in my pet project, and find one of its best points to
+be that it separates the operational data from the implementation.
+
+Indulge me for a few paragraphs, and all will be revealed:
+In the manual, Bruce cites the example of maintaining command line flags
+inside the source code; traditionally spreading usage information, flag
+names, letters and processing across several functions (if not files).
+Investing the time in writing a sort of boiler plate (a template in
+AutoGen terminology) pays by moving all of the option details (usage,
+flags names etc.) into a well structured table (a definition file if you
+will), so that adding a new command line option becomes a simple matter
+of adding a set of details to the table.
+
+So far so good! Of course, now that there is a template, writing all of
+that tedious optargs processing and usage functions is no longer an
+issue. Creating a table of the options needed for the new project and
+running AutoGen generates all of the option processing code in C
+automatically from just the tabular data. AutoGen in fact already ships
+with such a template... AutoOpts.
+
+One final consequence of the good separation in the design of AutoGen is
+that it is retargetable to a greater extent. The
+egcs/gcc/fixinc/inclhack.def can equally be used (with different
+templates) to create a shell script (inclhack.sh) or a c program
+(fixincl.c).
+
+This is just the tip of the iceberg. AutoGen is far more powerful than
+these examples might indicate, and has many other varied uses. I am
+certain Bruce or I could supply you with many and varied examples, and I
+would heartily recommend that you try it for your project and see for
+yourself how it compares to m4.
+@cindex m4
+
+As an aside, I would be interested to see whether someone might be
+persuaded to rationalise autoconf with AutoGen in place of m4... Ben,
+are you listening? autoconf-3.0! `kay? =)O|
+
+@format
+Sincerely,
+ Gary V. Vaughan
+@end format
+
+@ignore
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+@end ignore
+@page
+@node Definitions File
+@chapter Definitions File
+@cindex definitions file
+@cindex .def file
+
+This chapter describes the syntax and semantics of the AutoGen
+definition file. In order to instantiate a template, you normally must
+provide a definitions file that identifies itself and contains some
+value definitions. Consequently, we keep it very simple. For
+"advanced" users, there are preprocessing directives, sparse
+arrays, named indexes and comments that may be used as well.
+
+The definitions file is used to associate values with names. Every
+value is implicitly an array of values, even if there is only one value.
+Values may be either simple strings or compound collections of
+name-value pairs. An array may not contain both simple and compound
+members. Fundamentally, it is as simple as:
+
+@example
+prog-name = "autogen";
+flag = @{
+ name = templ_dirs;
+ value = L;
+ descrip = "Template search directory list";
+@};
+@end example
+
+For purposes of commenting and controlling the processing of the
+definitions, C-style comments and most C preprocessing directives are
+honored. The major exception is that the @code{#if} directive is
+ignored, along with all following text through the matching
+@code{#endif} directive. The C preprocessor is not actually invoked, so
+C macro substitution is @strong{not} performed.
+
+@menu
+* Identification:: The Identification Definition
+* Definitions:: Named Definitions
+* Index Assignments:: Assigning an Index to a Definition
+* Dynamic Text:: Dynamic Text
+* Directives:: Controlling What Gets Processed
+* Predefines:: Pre-defined Names
+* Comments:: Commenting Your Definitions
+* Example:: What it all looks like.
+* Full Syntax:: Finite State Machine Grammar
+* Alternate Definition:: Alternate Definition Forms
+@end menu
+
+@c === SECTION MARKER
+
+@node Identification
+@section The Identification Definition
+@cindex identification
+
+The first definition in this file is used to identify it as a
+AutoGen file. It consists of the two keywords,
+@samp{autogen} and @samp{definitions} followed by the default
+template name and a terminating semi-colon (@code{;}). That is:
+
+@example
+ AutoGen Definitions @var{template-name};
+@end example
+
+@noindent
+Note that, other than the name @var{template-name}, the words
+@samp{AutoGen} and @samp{Definitions} are searched for without case
+sensitivity. Most lookups in this program are case insensitive.
+
+@noindent
+Also, if the input contains more identification definitions,
+they will be ignored. This is done so that you may include
+(@pxref{Directives}) other definition files without an identification
+conflict.
+
+@cindex template file
+
+@noindent
+AutoGen uses the name of the template to find the corresponding template
+file. It searches for the file in the following way, stopping when
+it finds the file:
+
+@enumerate
+@item
+It tries to open @file{./@var{template-name}}. If it fails,
+@item
+it tries @file{./@var{template-name}.tpl}.
+@item
+It searches for either of these files in the directories listed in the
+templ-dirs command line option.
+@end enumerate
+
+If AutoGen fails to find the template file in one of these places,
+it prints an error message and exits.
+
+@c === SECTION MARKER
+
+@node Definitions
+@section Named Definitions
+@cindex definitions
+
+A name is a sequence of characters beginning with an alphabetic character
+(@code{a} through @code{z}) followed by zero or more alpha-numeric
+characters and/or separator characters: hyphen (@code{-}), underscore
+(@code{_}) or carat (@code{^}). Names are case insensitive.
+
+Any name may have multiple values associated with it. Every name may be
+considered a sparse array of one or more elements. If there is more than
+one value, the values my be accessed by indexing the value with
+@code{[index]} or by iterating over them using the FOR (@pxref{FOR}) AutoGen
+macro on it, as described in the next chapter. Sparse arrays are specified
+by specifying an index when defining an entry
+(@pxref{Index Assignments,, Assigning an Index to a Definition}).
+
+There are two kinds of definitions, @samp{simple} and @samp{compound}.
+They are defined thus (@pxref{Full Syntax}):
+
+@example
+compound_name '=' '@{' definition-list '@}' ';'
+
+simple-name[2] '=' string ';'
+
+no^text^name ';'
+@end example
+
+@noindent
+@code{simple-name} has the third index (index number 2) defined here.
+@code{No^text^name} is a simple definition with a shorthand empty string
+value. The string values for definitions may be specified in any of
+several formation rules.
+
+@menu
+* def-list:: Definition List
+* double-quote-string:: Double Quote String
+* single-quote-string:: Single Quote String
+* simple-string:: An Unquoted String
+* shell-generated:: Shell Output String
+* scheme-generated:: Scheme Result String
+* here-string:: A Here String
+* concat-string:: Concatenated Strings
+@end menu
+
+@cindex simple definitions
+@cindex compound definitions
+
+@node def-list
+@subsection Definition List
+
+@code{definition-list} is a list of definitions that may or may not
+contain nested compound definitions. Any such definitions may
+@strong{only} be expanded within a @code{FOR} block iterating over the
+containing compound definition. @xref{FOR}.
+
+Here is, again, the example definitions from the previous chapter,
+with three additional name value pairs. Two with an empty value
+assigned (@var{first} and @var{last}), and a "global" @var{group_name}.
+
+@example
+autogen definitions list;
+group_name = example;
+list = @{ list_element = alpha; first;
+ list_info = "some alpha stuff"; @};
+list = @{ list_info = "more beta stuff";
+ list_element = beta; @};
+list = @{ list_element = omega; last;
+ list_info = "final omega stuff"; @};
+@end example
+
+@node double-quote-string
+@subsection Double Quote String
+
+@cindex string, double quote
+The string follows the C-style escaping, using the backslash to quote
+(escape) the following character(s). Certain letters are translated to
+various control codes (e.g. @code{\n}, @code{\f}, @code{\t}, etc.).
+@code{x} introduces a two character hex code. @code{0} (the digit zero)
+introduces a one to three character octal code (note: an octal byte followed
+by a digit must be represented with three octal digits, thus: @code{"\0001"}
+yielding a NUL byte followed by the ASCII digit 1). Any other character
+following the backslash escape is simply inserted, without error, into the
+string being formed.
+
+Like ANSI "C", a series of these strings, possibly intermixed with
+single quote strings, will be concatenated together.
+
+@node single-quote-string
+@subsection Single Quote String
+
+@cindex string, single quote
+This is similar to the shell single-quote string. However, escapes
+@code{\} are honored before another escape, single quotes @code{'}
+and hash characters @code{#}. This latter is done specifically
+to disambiguate lines starting with a hash character inside
+of a quoted string. In other words,
+
+@example
+fumble = '
+#endif
+';
+@end example
+
+could be misinterpreted by the definitions scanner, whereas
+this would not:
+
+@example
+fumble = '
+\#endif
+';
+@end example
+
+@*
+As with the double quote string, a series of these, even intermixed
+with double quote strings, will be concatenated together.
+
+@node simple-string
+@subsection An Unquoted String
+
+A simple string that does not contain white space @i{may} be left
+unquoted. The string must not contain any of the characters special to
+the definition text (i.e., @code{"}, @code{#}, @code{'}, @code{(},
+@code{)}, @code{,}, @code{;}, @code{<}, @code{=}, @code{>}, @code{[},
+@code{]}, @code{`}, @code{@{}, or @code{@}}). This list is subject to
+change, but it will never contain underscore (@code{_}), period
+(@code{.}), slash (@code{/}), colon (@code{:}), hyphen (@code{-}) or
+backslash (@code{\\}). Basically, if the string looks like it is a
+normal DOS or UNIX file or variable name, and it is not one of two
+keywords (@samp{autogen} or @samp{definitions}) then it is OK to not
+quote it, otherwise you should.
+
+@node shell-generated
+@subsection Shell Output String
+@cindex shell-generated string
+
+@cindex string, shell output
+This is assembled according to the same rules as the double quote string,
+except that there is no concatenation of strings and the resulting string is
+written to a shell server process. The definition takes on the value of
+the output string.
+
+NB@: The text is interpreted by a server shell. There may be left over
+state from previous server shell processing. This scriptlet may also leave
+state for subsequent processing. However, a @code{cd} to the original
+directory is always issued before the new command is issued.
+
+@node scheme-generated
+@subsection Scheme Result String
+
+A scheme result string must begin with an open parenthesis @code{(}.
+The scheme expression will be evaluated by Guile and the
+value will be the result. The AutoGen expression functions
+are @strong{dis}abled at this stage, so do not use them.
+
+@node here-string
+@subsection A Here String
+@cindex here-string
+
+A @samp{here string} is formed in much the same way as a shell here doc. It
+is denoted with two less than characters(@code{<<}) and, optionally, a hyphen.
+This is followed by optional horizontal white space and an ending
+marker-identifier. This marker must follow the syntax rules for identifiers.
+Unlike the shell version, however, you must not quote this marker.
+
+The resulting string will start with the first character on the next line and
+continue up to but not including the newline that precedes the line that
+begins with the marker token. The characters are copied directly into the
+result string. Mostly.
+
+If a hyphen follows the less than characters, then leading tabs will be
+stripped and the terminating marker will be recognized even if preceded by
+tabs. Also, if the first character on the line (after removing tabs) is a
+backslash and the next character a tab, then the backslash will be removed as
+well. No other kind of processing is done on this string.
+
+Here are two examples:
+@example
+str1 = <<- STR_END
+ $quotes = " ' `
+ STR_END;
+
+str2 = << STR_END
+ $quotes = " ' `
+ STR_END;
+STR_END;
+@end example
+The first string contains no new line characters.
+The first character is the dollar sign, the last the back quote.
+
+The second string contains one new line character. The first character
+is the tab character preceding the dollar sign. The last character is
+the semicolon after the @code{STR_END}. That @code{STR_END} does not
+end the string because it is not at the beginning of the line. In the
+preceding case, the leading tab was stripped.
+
+@node concat-string
+@subsection Concatenated Strings
+@cindex concat-string
+
+If single or double quote characters are used,
+then you also have the option, a la ANSI-C syntax,
+of implicitly concatenating a series of them together,
+with intervening white space ignored.
+
+NB@: You @strong{cannot} use directives to alter the string
+content. That is,
+
+@example
+str = "fumble"
+#ifdef LATER
+ "stumble"
+#endif
+ ;
+@end example
+
+@noindent
+will result in a syntax error. The preprocessing directives are not
+carried out by the C preprocessor. However,
+
+@example
+str = '"fumble\n"
+#ifdef LATER
+" stumble\n"
+#endif
+';
+@end example
+
+@noindent
+@strong{Will} work. It will enclose the @samp{#ifdef LATER}
+and @samp{#endif} in the string. But it may also wreak
+havoc with the definition processing directives. The hash
+characters in the first column should be disambiguated with
+an escape @code{\} or join them with previous lines:
+@code{"fumble\n#ifdef LATER...}.
+
+@c === SECTION MARKER
+
+@node Index Assignments
+@section Assigning an Index to a Definition
+@cindex Definition Index
+
+In AutoGen, every name is implicitly an array of values.
+When assigning values, they are usually implicitly
+assigned to the next highest slot. They can also be
+specified explicitly:
+
+@example
+mumble[9] = stumble;
+mumble[0] = grumble;
+@end example
+
+@noindent
+If, subsequently, you assign a value to @code{mumble} without an
+index, its index will be @code{10}, not @code{1}.
+If indexes are specified, they must not cause conflicts.
+
+@code{#define}-d names may also be used for index values.
+This is equivalent to the above:
+
+@example
+#define FIRST 0
+#define LAST 9
+mumble[LAST] = stumble;
+mumble[FIRST] = grumble;
+@end example
+
+All values in a range do @strong{not} have to be filled in.
+If you leave gaps, then you will have a sparse array. This
+is fine (@pxref{FOR}). You have your choice of iterating
+over all the defined values, or iterating over a range
+of slots. This:
+
+@example
+[+ FOR mumble +][+ ENDFOR +]
+@end example
+
+@noindent
+iterates over all and only the defined entries, whereas this:
+
+@example
+[+ FOR mumble (for-by 1) +][+ ENDFOR +]
+@end example
+
+@noindent
+will iterate over all 10 "slots". Your template will
+likely have to contain something like this:
+
+@example
+[+ IF (exist? (sprintf "mumble[%d]" (for-index))) +]
+@end example
+
+@noindent
+or else "mumble" will have to be a compound value that,
+say, always contains a "grumble" value:
+
+@example
+[+ IF (exist? "grumble") +]
+@end example
+
+@c === SECTION MARKER
+
+@node Dynamic Text
+@section Dynamic Text
+@cindex Dynamic Definition Text
+
+There are several methods for including dynamic content inside a definitions
+file. Three of them are mentioned above (@ref{shell-generated} and
+@pxref{scheme-generated}) in the discussion of string formation rules.
+Another method uses the @code{#shell} processing directive.
+It will be discussed in the next section (@pxref{Directives}).
+Guile/Scheme may also be used to yield to create definitions.
+
+When the Scheme expression is preceded by a backslash and single
+quote, then the expression is expected to be an alist of
+names and values that will be used to create AutoGen definitions.
+
+@noindent
+This method can be be used as follows:
+
+@example
+\'( (name (value-expression))
+ (name2 (another-expr)) )
+@end example
+
+@noindent
+This is entirely equivalent to:
+
+@example
+name = (value-expression);
+name2 = (another-expr);
+@end example
+
+@noindent
+Under the covers, the expression gets handed off to a Guile function
+named @code{alist->autogen-def} in an expression that looks like this:
+
+@example
+(alist->autogen-def
+ ( (name (value-expression)) (name2 (another-expr)) ) )
+@end example
diff --git a/doc/autogen-texi.txt b/doc/autogen-texi.txt
new file mode 100644
index 0000000..2df421c
--- /dev/null
+++ b/doc/autogen-texi.txt
@@ -0,0 +1,5768 @@
+@c -*- Mode: texinfo -*-
+@setfilename autogen.info
+@ignore
+This file serves two purposes:
+
+1) it provides that stupid (at)setfilename so that automake will
+ deign to produce the documentation
+
+2) a text repository for documentation that would make the doc
+ template more confusing.
+
+
+ This file is part of AutoGen.
+ AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+
+ AutoGen is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ AutoGen is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program. If not, see <http://www.gnu.org/licenses/>.
+@end ignore
+
+@ignore
+START == COMMENTS == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@ignore
+Resume input from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node Predefines
+@section Pre-defined Names
+@cindex predefines
+
+When AutoGen starts, it tries to determine several names from the
+operating environment and put them into environment variables for use in
+both @code{#ifdef} tests in the definitions files and in shell scripts
+with environment variable tests. @code{__autogen__} is always defined.
+For other names, AutoGen will first try to use the POSIX version of the
+@code{sysinfo(2)} system call. Failing that, it will try for the POSIX
+@code{uname(2)} call. If neither is available, then only
+"@code{__autogen__}" will be inserted into the environment.
+In all cases, the associated names are converted to lower case, surrounded
+by doubled underscores and non-symbol characters are replaced with
+underscores.
+
+With Solaris on a sparc platform, @code{sysinfo(2)} is available.
+The following strings are used:
+
+@itemize @bullet
+@item
+@code{SI_SYSNAME} (e.g., "__sunos__")
+@item
+@code{SI_HOSTNAME} (e.g., "__ellen__")
+@item
+@code{SI_ARCHITECTURE} (e.g., "__sparc__")
+@item
+@code{SI_HW_PROVIDER} (e.g., "__sun_microsystems__")
+@item
+@code{SI_PLATFORM} (e.g., "__sun_ultra_5_10__")
+@item
+@code{SI_MACHINE} (e.g., "__sun4u__")
+@end itemize
+
+For Linux and other operating systems that only support the
+@code{uname(2)} call, AutoGen will use these values:
+
+@itemize @bullet
+@item
+@code{sysname} (e.g., "__linux__")
+@item
+@code{machine} (e.g., "__i586__")
+@item
+@code{nodename} (e.g., "__bach__")
+@end itemize
+
+By testing these pre-defines in my definitions, you can select
+pieces of the definitions without resorting to writing shell
+scripts that parse the output of @code{uname(1)}. You can also
+segregate real C code from autogen definitions by testing for
+"@code{__autogen__}".
+
+@example
+#ifdef __bach__
+ location = home;
+#else
+ location = work;
+#endif
+@end example
+
+@c === SECTION MARKER
+
+@node Comments
+@section Commenting Your Definitions
+@cindex comments
+
+The definitions file may contain C and C++ style comments.
+
+@example
+/*
+ * This is a comment. It continues for several lines and closes
+ * when the characters '*' and '/' appear together.
+ */
+// this comment is a single line comment
+@end example
+
+@c === SECTION MARKER
+
+@node Example
+@section What it all looks like.
+
+@noindent
+This is an extended example:
+
+@example
+autogen definitions @samp{template-name};
+/*
+ * This is a comment that describes what these
+ * definitions are all about.
+ */
+global = "value for a global text definition.";
+
+/*
+ * Include a standard set of definitions
+ */
+#include standards.def
+
+a_block = @{
+ a_field;
+ a_subblock = @{
+ sub_name = first;
+ sub_field = "sub value.";
+ @};
+
+#ifdef FEATURE
+ a_subblock = @{
+ sub_name = second;
+ @};
+#endif
+
+@};
+@end example
+
+@ignore
+END == COMMENTS == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@ignore
+START == TEMPLATE == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node Alternate Definition
+@section Alternate Definition Forms
+@cindex Alternate Definition
+
+There are several methods for supplying data values for templates.
+
+@table @samp
+@item no definitions
+It is entirely possible to write a template that does not depend upon
+external definitions. Such a template would likely have an unvarying
+output, but be convenient nonetheless because of an external library
+of either AutoGen or Scheme functions, or both. This can be accommodated
+by providing the @code{--override-tpl} and @code{--no-definitions}
+options on the command line. @xref{autogen Invocation}.
+
+@item CGI
+AutoGen behaves as a CGI server if the definitions input is from stdin
+and the environment variable @code{REQUEST_METHOD} is defined
+and set to either "GET" or "POST", @xref{AutoGen CGI}. Obviously,
+all the values are constrained to strings because there is no way
+to represent nested values.
+
+@item XML
+AutoGen comes with a program named, @code{xml2ag}. Its output can
+either be redirected to a file for later use, or the program can
+be used as an AutoGen wrapper. @xref{xml2ag Invocation}.
+
+The introductory template example (@pxref{Example Usage}) can be rewritten
+in XML as follows:
+
+@example
+<EXAMPLE template="list.tpl">
+<LIST list_element="alpha"
+ list_info="some alpha stuff"/>
+<LIST list_info="more beta stuff"
+ list_element="beta"/>
+<LIST list_element="omega"
+ list_info="final omega stuff"/>
+</EXAMPLE>
+@end example
+
+A more XML-normal form might look like this:
+@example
+<EXAMPLE template="list.tpl">
+<LIST list_element="alpha">some alpha stuff</LIST>
+<LIST list_element="beta" >more beta stuff</LIST>
+<LIST list_element="omega">final omega stuff</LIST>
+</EXAMPLE>
+@end example
+@noindent
+but you would have to change the template @code{list_info} references
+into @code{text} references.
+
+@item standard AutoGen definitions
+Of course. :-)
+
+@end table
+
+@ignore
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+@end ignore
+@page
+@node Template File
+@chapter Template File
+@cindex template file
+@cindex .tpl file
+
+The AutoGen template file defines the content of the output text.
+It is composed of two parts. The first part consists of a pseudo
+macro invocation and commentary. It is followed by the template proper.
+
+@cindex pseudo macro
+@cindex macro, pseudo
+This pseudo macro is special. It is used to identify the file as a
+AutoGen template file, fixing the starting and ending marks for
+the macro invocations in the rest of the file, specifying the list
+of suffixes to be generated by the template and, optionally, the
+shell to use for processing shell commands embedded in the template.
+
+AutoGen-ing a file consists of copying text from the template to the
+output file until a start macro marker is found. The text from the
+start marker to the end marker constitutes the macro text. AutoGen
+macros may cause sections of the template to be skipped or processed
+several times. The process continues until the end of the template is
+reached. The process is repeated once for each suffix specified in the
+pseudo macro.
+
+This chapter describes the format of the AutoGen template macros
+and the usage of the AutoGen native macros. Users may augment
+these by defining their own macros, @xref{DEFINE}.
+
+@menu
+* pseudo macro:: Format of the Pseudo Macro
+* naming values:: Naming a value
+* expression syntax:: Macro Expression Syntax
+* AutoGen Functions:: AutoGen Scheme Functions
+* Common Functions:: Common Scheme Functions
+* native macros:: AutoGen Native Macros
+* output controls:: Redirecting Output
+@end menu
+
+@c === SECTION MARKER
+
+@node pseudo macro
+@section Format of the Pseudo Macro
+@cindex pseudo macro
+
+The pseudo macro is used to tell AutoGen how to process a template.
+It tells autogen:
+
+@enumerate
+@item
+The start macro marker. It consists of punctuation characters used to
+demarcate the start of a macro. It may be up to seven characters long and
+must be the first non-whitespace characters in the file.
+
+@noindent
+It is generally a good idea to use some sort of opening
+bracket in the starting macro and closing bracket in the ending
+macro (e.g. @code{@{}, @code{(}, @code{[}, or even @code{<}
+in the starting macro). It helps both visually and with editors
+capable of finding a balancing parenthesis.
+
+@item
+That start marker must be immediately followed by the identifier strings
+"AutoGen5" and then "template", though capitalization is not important.
+@end enumerate
+
+@noindent
+The next several components may be intermingled:
+
+@enumerate 3
+@item
+Zero, one or more suffix specifications tell AutoGen how many times to
+process the template file. No suffix specifications mean that it is to
+be processed once and that the generated text is to be written to
+@file{stdout}. The current suffix for each pass can be determined with the
+@code{(suffix)} scheme function (@pxref{SCM suffix}).
+
+The suffix specification consists of a sequence of POSIX compliant file name
+characters and, optionally, an equal sign and a file name formatting
+specification. That specification may be either an ordinary sequence of
+file name characters with zero, one or two "%s" formatting sequences in it,
+or else it may be a Scheme expression that, when evaluated, produces such a
+string. The Scheme result may not be empty. The two string arguments
+allowed for that string are the base name of the definition file, and the
+current suffix (that being the text to the left of the equal sign). (Note:
+"POSIX compliant file name characters" consist of alphanumerics plus the
+period (@code{.}), hyphen (@code{-}) and underscore (@code{_}) characters.)
+
+If the suffix begins with one of these three latter characters and
+a formatting string is not specified, then that character is presumed to
+be the suffix separator. Otherwise, without a specified format string,
+a single period will separate the suffix from the base name in constructing
+the output file name.
+
+@item
+Shell specification: to specify that the template was written expecting a
+particular shell to run the shell commands. By default, the shell used is the
+autoconf-ed @code{CONFIG_SHELL}. This will usually be @file{/bin/sh}. The
+shell is specified by a hash mark (@code{#}) followed by an exclamation mark
+(@code{!}) followed by a full-path file name (e.g. @file{/usr/xpg4/bin/sh} on
+Solaris):
+@example
+[= Autogen5 Template c
+#!/usr/xpg4/bin/sh
+=]
+@end example
+
+@item
+Comments: blank lines, lines starting with a hash mark (@code{#}) and not
+specifying a shell, and edit mode markers (text between pairs of @code{-*-}
+strings) are all treated as comments.
+
+@item
+Some scheme expressions may be inserted in order to make configuration
+changes before template processing begins. ``@i{before template
+processing begins}'' means that there is no current output file, no current
+suffix and, basically, none of the AutoGen specific functions
+(@pxref{AutoGen Functions}) may be invoked.
+
+The scheme expression can also be used, for example, to save a pre-existing
+output file for later text extraction (@pxref{SCM extract}).
+
+@example
+(shellf "mv -f %1$s.c %1$s.sav" (base-name))
+@end example
+@end enumerate
+
+@noindent
+After these must come the end macro marker:
+
+@enumerate 6
+@item
+The punctuation characters used to demarcate the end of a macro.
+Like the start marker, it must consist of seven or fewer punctuation
+characters.
+@end enumerate
+
+The ending macro marker has a few constraints on its content. Some of
+them are just advisory, though. There is no special check for advisory
+restrictions.
+
+@itemize @bullet
+@item
+It must not begin with a POSIX file name character (hyphen @code{-},
+underscore @code{_} or period @code{.}), the backslash (@code{\}) or
+open parenthesis (@code{(}). These are used to identify a suffix
+specification, indicate Scheme code and trim white space.
+
+@item
+If it begins with an equal sign, then it
+must be separated from any suffix specification by white space.
+
+@item
+The closing marker may not begin with an open parenthesis, as that is used
+to enclose a scheme expression.
+
+@item
+It cannot begin with a backslash, as that is used to indicate white
+space trimming after the end macro mark. If, in the body of the template,
+you put the backslash character (@code{\}) before the end macro mark, then
+any white space characters after the mark and through the newline character
+are trimmed.
+
+@item
+It is also helpful to avoid using the comment marker (@code{#}).
+It might be seen as a comment within the pseudo macro.
+
+@item
+You should avoid using any of the quote characters@: double,
+single or back-quote. It won't confuse AutoGen, but it might well
+confuse you and/or your editor.
+@end itemize
+
+As an example, assume we want to use @code{[+} and @code{+]} as the start
+and end macro markers, and we wish to produce a @file{.c} and a @file{.h}
+file, then the pseudo macro might look something like this:
+
+@example
+[+ AutoGen5 template -*- Mode: emacs-mode-of-choice -*-
+h=chk-%s.h
+c
+# make sure we don't use csh:
+(setenv "SHELL" "/bin/sh") +]
+@end example
+
+The template proper starts after the pseudo-macro. The starting
+character is either the first non-whitespace character or the first
+character after the newline that follows the end macro marker.
+
+@c === SECTION MARKER
+
+@node naming values
+@section Naming a value
+@cindex naming values
+
+When an AutoGen value is specified in a template, it is specified by name.
+The name may be a simple name, or a compound name of several components.
+Since each named value in AutoGen is implicitly an array of one or more
+values, each component may have an index associated with it.
+
+@noindent
+It looks like this:
+
+@example
+comp-name-1 . comp-name-2 [ 2 ]
+@end example
+
+Note that if there are multiple components to a name, each component
+name is separated by a dot (@code{.}). Indexes follow a component name,
+enclosed in square brackets (@code{[} and @code{]}). The index may be
+either an integer or an integer-valued define name. The first component
+of the name is searched for in the current definition level. If not
+found, higher levels will be searched until either a value is found,
+or there are no more definition levels. Subsequent components of the
+name must be found within the context of the newly-current definition
+level. Also, if the named value is prefixed by a dot (@code{.}),
+@cindex .
+then the value search is started in the current context only.
+Backtracking
+@cindex backtrack
+into other definition levels is prevented.
+
+If someone rewrites this, I'll incorporate it. :-)
+
+@c === SECTION MARKER
+
+@node expression syntax
+@section Macro Expression Syntax
+@cindex expression syntax
+
+AutoGen has two types of expressions: full expressions and basic ones.
+A full AutoGen expression can appear by itself, or as the argument
+to certain AutoGen built-in macros: CASE, IF, ELIF, INCLUDE,
+INVOKE (explicit invocation, @pxref{INVOKE}), and WHILE.
+If it appears by itself, the result is inserted into the output.
+If it is an argument to one of these macros, the macro code
+will act on it sensibly.
+
+You are constrained to basic expressions only when passing
+arguments to user defined macros, @xref{DEFINE}.
+
+The syntax of a full AutoGen expression is:
+
+@example
+[[ <apply-code> ] <value-name> ] [ <basic-expr-1> [ <basic-expr-2> ]]
+@end example
+
+How the expression is evaluated depends upon the presence or absence
+of the apply code and value name. The "value name" is the name of
+an AutoGen defined value, or not. If it does not name such a value,
+the expression result is generally the empty string. All expressions
+must contain either a @code{value-name} or a @code{basic-expr}.
+
+@menu
+* apply code:: Apply Code
+* basic expression:: Basic Expression
+@end menu
+
+@node apply code
+@subsection Apply Code
+
+The "apply code" selected determines the method of evaluating the
+expression. There are five apply codes, including the non-use
+of an apply code.
+
+@table @samp
+@item no apply code
+This is the most common expression type.
+Expressions of this sort come in three flavors:
+
+@table @samp
+@item <value-name>
+The result is the value of @code{value-name}, if defined.
+Otherwise it is the empty string.
+
+@item <basic-expr>
+The result of the basic expression is the result of the full expression,
+@xref{basic expression}.
+
+@item <value-name> <basic-expr>
+If there is a defined value for @code{value-name}, then the @code{basic-expr}
+is evaluated. Otherwise, the result is the empty string.
+@end table
+
+@item % <value-name> <basic-expr>
+If @code{value-name} is defined, use @code{basic-expr} as a format
+string for sprintf. Then, if the @code{basic-expr} is either a back-quoted
+string or a parenthesized expression, then hand the result to the
+appropriate interpreter for further evaluation. Otherwise, for single
+and double quote strings, the result is the result of the sprintf operation.
+Naturally, if @code{value-name} is not defined, the result is the empty
+string.
+
+For example, assume that @code{fumble} had the string value, @code{stumble}:
+@example
+[+ % fumble `printf '%%x\\n' $%s` +]
+@end example
+This would cause the shell to evaluate "@code{printf '%x\n' $stumble}".
+Assuming that the shell variable @code{stumble} had a numeric value,
+the expression result would be that number, in hex. Note the need
+for doubled percent characters and backslashes.
+
+@item ? <value-name> <basic-expr-1> <basic-expr-2>
+Two @code{basic-expr}-s are required. If the @code{value-name} is
+defined, then the first @code{basic-expr-1} is evaluated, otherwise
+@code{basic-expr-2} is.
+
+@item - <value-name> <basic-expr>
+Evaluate @code{basic-expr} only if @code{value-name} is @i{not} defined.
+
+@item ?% <value-name> <basic-expr-1> <basic-expr-2>
+This combines the functions of @samp{?} and @samp{%}. If @code{value-name} is
+defined, it behaves exactly like @samp{%}, above, using @code{basic-expr-1}.
+If not defined, then @code{basic-expr-2} is evaluated.
+
+For example, assume again that @code{fumble} had the string value, @code{stumble}:
+@example
+[+ ?% fumble `cat $%s` `pwd` +]
+@end example
+This would cause the shell to evaluate "@code{cat $stumble}".
+If @code{fumble} were not defined, then the result would be the name
+of our current directory.
+@end table
+
+@node basic expression
+@subsection Basic Expression
+
+A basic expression can have one of the following forms:
+
+@table @samp
+@item 'STRING'
+A single quoted string. Backslashes can be used to protect single
+quotes (@code{'}), hash characters (@code{#}), or backslashes (@code{\})
+in the string. All other characters of STRING are output as-is when the
+single quoted string is evaluated. Backslashes are processed before the hash
+character for consistency with the definition syntax. It is needed there
+to avoid preprocessing conflicts.
+
+@item "STRING"
+A double quoted string. This is a cooked text string as in C,
+except that they are not concatenated with adjacent strings.
+Evaluating "@code{STRING}" will output STRING with all
+backslash sequences interpreted.
+
+@item `STRING`
+A back quoted string. When this expression is evaluated, STRING
+is first interpreted as a cooked string (as in `"STRING"') and
+evaluated as a shell expression by the AutoGen server shell. This
+expression is replaced by the @file{stdout} output of
+the shell.
+
+@item (STRING)
+A parenthesized expression. It will be passed to the Guile
+interpreter for evaluation and replaced by the resulting value.
+If there is a Scheme error in this expression, Guile 1.4 and Guile 1.6
+will report the template line number where the error occurs. Guile 1.7
+has lost this capability.
+
+Guile has the capability of creating and manipulating variables that
+can be referenced later on in the template processing. If you define
+such a variable, it is invisible to AutoGen. To reference its value,
+you must use a Guile expression. For example,
+@example
+[+ (define my-var "some-string-value") +]
+@end example
+can have that string inserted later, but only as in:
+@example
+[+ (. my-var) +]
+@end example
+
+Additionally, other than in the @code{%} and @code{?%} expressions, the
+Guile expressions may be introduced with the Guile comment character
+(@code{;}) and you may put a series of Guile expressions within a single
+macro. They will be implicitly evaluated as if they were arguments
+to the @code{(begin ...)} expression. The result will be the
+result of the last Guile expression evaluated.
+@end table
+
+@ignore
+END == TEMPLATE == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@ignore
+START == MACROS == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node native macros
+@section AutoGen Native Macros
+@cindex native macros
+
+This section describes the various AutoGen natively defined macros.
+Unlike the Scheme functions, some of these macros are "block macros"
+with a scope that extends through a terminating macro. Block macros
+must not overlap. That is to say, a block macro started within the
+scope of an encompassing block macro must have its matching end macro
+appear before the encompassing block macro is either ended or subdivided.
+
+The block macros are these:
+
+@table @code
+@item CASE
+This macro has scope through the @code{ESAC} macro.
+The scope is subdivided by @code{SELECT} macros.
+You must have at least one @code{SELECT} macro.
+
+@item DEFINE
+This macro has scope through the @code{ENDDEF} macro. The defined
+user macro can never be a block macro. This macro is extracted from
+the template @i{before} the template is processed. Consequently, you
+cannot select a definition based on context. You can, however, place
+them all at the end of the file.
+
+@item FOR
+This macro has scope through the @code{ENDFOR} macro.
+
+@item IF
+This macro has scope through the @code{ENDIF} macro.
+The scope may be subdivided by @code{ELIF} and @code{ELSE}
+macros. Obviously, there may be only one @code{ELSE} macro
+and it must be the last of these subdivisions.
+
+@item INCLUDE
+This macro has the scope of the included file.
+It is a block macro in the sense that the included
+file must not contain any incomplete block macros.
+
+@item WHILE
+This macro has scope through the @code{ENDWHILE} macro.
+@end table
+@ignore
+END == MACROS == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@ignore
+START == AUGMENTING == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node output controls
+@section Redirecting Output
+@cindex Redirecting Output
+@cindex diversion
+
+AutoGen provides a means for redirecting the template output to different
+files or, in @file{M4} parlance, to various diversions. It is accomplished
+by providing a set of Scheme functions named @code{out-*}
+(@pxref{AutoGen Functions}).
+
+@table @samp
+@item out-push-new (@pxref{SCM out-push-new})
+This allows you to logically "push" output files onto a stack.
+If you supply a string name, then a file by that name is created
+to hold the output. If you do not supply a name, then the text is
+written to a scratch pad and retrieved by passing a ``@code{#t}'' argument
+to the @code{out-pop} (@pxref{SCM out-pop}) function.
+
+@item out-pop (@pxref{SCM out-pop})
+This function closes the current output file and resumes output to the next
+one in the stack. At least one output must have been pushed onto the output
+stack with the @code{out-push-new} (@pxref{SCM out-push-new}) function. If
+``@code{#t}'' is passed in as an argument, then the entire contents of the
+diversion (or file) is returned.
+
+@item out-suspend (@pxref{SCM out-suspend})
+This function does not close the current output, but instead sets it aside
+for resumption by the given name with @code{out-resume}. The current output
+must have been pushed on the output queue with @code{out-push-new}
+(@pxref{SCM out-push-new}).
+
+@item out-resume (@pxref{SCM out-resume})
+This will put a named file descriptor back onto the top of
+stack so that it becomes the current output again.
+
+@item out-switch (@pxref{SCM out-switch})
+This closes the current output and creates a new file,
+purging any preexisting one. This is a shortcut for "pop"
+followed by "push", but this can also be done at the base level.
+
+@item out-move (@pxref{SCM out-move})
+Renames the current output file without closing it.
+@end table
+
+There are also several functions for determining the output
+status. @xref{AutoGen Functions}.
+
+@ignore
+
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+
+@end ignore
+
+@page
+@node Augmenting AutoGen
+@chapter Augmenting AutoGen Features
+@cindex Augmenting AutoGen
+
+AutoGen was designed to be simple to enhance. You can do it by
+providing shell commands, Guile/Scheme macros or callout functions
+that can be invoked as a Guile macro. Here is how you do these.
+
+@menu
+* shell commands:: Shell Output Commands
+* guile macros:: Guile Macros
+* guile callouts:: Guile Callout Functions
+* AutoGen macros:: AutoGen Macros
+@end menu
+
+@c === SECTION MARKER
+
+@node shell commands
+@section Shell Output Commands
+
+Shell commands are run inside of a server process. This means that,
+unlike @file{make}, context is kept from one command to the next.
+Consequently, you can define a shell function in one place inside of
+your template and invoke it in another. You may also store values
+in shell variables for later reference. If you load functions from
+a file containing shell functions, they will remain until AutoGen exits.
+
+If your shell script should determine that AutoGen should stop
+processing, the recommended method for stopping AutoGen is:
+@example
+die "some error text"
+@end example
+
+@noindent
+That is a shell function added by AutoGen. It will send a SIGTERM
+to autogen and exit from the "persistent" shell.
+
+@c === SECTION MARKER
+
+@node guile macros
+@section Guile Macros
+
+Guile also maintains context from one command to the next. This means you may
+define functions and variables in one place and reference them elsewhere.
+You also may load Guile macro definitions from a Scheme file by using the
+@code{--load-scheme} command line option (@pxref{autogen load-scheme}).
+Beware, however, that the AutoGen specific scheme functions have not been
+loaded at this time, so though you may define functions that reference them,
+do not invoke the AutoGen functions at this time.
+
+If your Scheme script should determine that AutoGen should stop
+processing, the recommended method for stopping AutoGen is:
+@example
+(error "some error text")
+@end example
+
+@c === SECTION MARKER
+
+@node guile callouts
+@section Guile Callout Functions
+
+Callout functions must be registered with Guile to work. This can
+be accomplished either by putting your routines into a shared library
+that contains a @code{void scm_init( void )} routine that registers
+these routines, or by building them into AutoGen.
+
+To build them into AutoGen, you must place your routines in the source
+directory and name the files @file{exp*.c}. You also must have a stylized
+comment that @file{getdefs} can find that conforms to the following:
+
+@example
+/*=gfunc <function-name>
+ *
+ * what: <short one-liner>
+ * general_use:
+ * string: <invocation-name-string>
+ * exparg: <name>, <description> [, ['optional'] [, 'list']]
+ * doc: A long description telling people how to use
+ * this function.
+=*/
+SCM
+ag_scm_<function-name>( SCM arg_name[, ...] )
+@{ <code> @}
+@end example
+
+@table @samp
+@item gfunc
+You must have this exactly thus.
+
+@item <function-name>
+This must follow C syntax for variable names
+
+@item <short one-liner>
+This should be about a half a line long.
+It is used as a subsection title in this document.
+
+@item general_use:
+You must supply this unless you are an AutoGen maintainer and are writing
+a function that queries or modifies the state of AutoGen.
+
+@item <invocation-name-string>
+Normally, the @code{function-name} string will be transformed into
+a reasonable invocation name. However, that is not always true.
+If the result does not suit your needs, then supply an alternate string.
+
+@item exparg:
+You must supply one for each argument to your function.
+All optional arguments must be last.
+The last of the optional arguments may be a list, if you choose.
+
+@item doc:
+Please say something meaningful.
+
+@item [, ...]
+Do not actually specify an ANSI ellipsis here. You must provide
+for all the arguments you specified with @code{exparg}.
+@end table
+
+See the Guile documentation for more details.
+More information is also available in a large comment at the
+beginning of the @file{agen5/snarf.tpl} template file.
+
+@c === SECTION MARKER
+
+@node AutoGen macros
+@section AutoGen Macros
+
+There are two kinds@: those you define yourself and AutoGen native.
+The user-defined macros may be defined in your templates or loaded
+with the @code{--lib-template} option
+(See @ref{DEFINE} and @ref{autogen lib-template}).
+
+As for AutoGen native macros, do not add any. It is easy to do, but I
+won't like it. The basic functions needed to accomplish looping over
+and selecting blocks of text have proved to be sufficient over a period
+of several years. New text transformations can be easily added via any
+of the AutoGen extension methods, as discussed above.
+
+@ignore
+END == AUGMENTING == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@ignore
+START == INSTALLATION == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@page
+@node Installation
+@chapter Configuring and Installing
+
+@menu
+* configuring:: Configuring AutoGen
+* AutoGen CGI:: AutoGen as a CGI server
+* signal names:: Signal Names
+* installing:: Installing AutoGen
+@end menu
+
+@c === SECTION MARKER
+
+@node configuring
+@section Configuring AutoGen
+@cindex configuring
+
+AutoGen is configured and built using Libtool, Automake and Autoconf.
+Consequently, you can install it wherever you wish using the various
+@samp{--prefix} options. To the various configuration options supplied
+by these tools, AutoGen adds a few of its own:
+
+@table @samp
+@item --disable-shell
+AutoGen is now capable of acting as a CGI forms server, @xref{AutoGen CGI}.
+As such, it will gather its definitions using either @samp{GET} or
+@samp{POST} methods. All you need to do is have a template named
+@file{cgi.tpl} handy or specify a different one with a command line
+option.
+
+However, doing this without disabling the server shell brings
+considerable risk. If you were to pass user input to a script
+that contained, say, the classic "@samp{`rm -rf /`}", you might have
+a problem. This configuration option will cause shell template
+commands to simply return the command string as the result.
+No mistakes. Much safer. Strongly recommended.
+The default is to have server shell scripting enabled.
+
+Disabling the shell will have some build side effects, too.
+
+@itemize @bullet
+@item
+Many of the make check tests will fail, since they assume
+a working server shell.
+@item
+The getdefs and columns programs are not built.
+The options are distributed as definition files and they
+cannot be expanded with a shell-disabled AutoGen.
+@item
+Similarly, the documentation cannot be regenerated because
+the documentation templates depend on subshell functionality.
+@end itemize
+
+@item --enable-debug
+Turning on AutoGen debugging enables very detailed inspection of
+the input definitions and monitoring shell script processing.
+These options are not particularly useful to anyone not directly
+involved in maintaining AutoGen. If you do choose to enable AutoGen
+debugging, be aware that the usage page was generated without these
+options, so when the build process reaches the documentation rebuild,
+there will be a failure. @samp{cd} into the @file{agen5} build
+directory, @samp{make} the @samp{autogen.texi} file and all will
+be well thereafter.
+
+@item --with-regex-header
+@itemx --with-header-path
+@itemx --with-regex-lib
+These three work together to specify how to compile with and link to
+a particular POSIX regular expression library. The value for
+@file{--with-regex-header=value} must be the name of the relevant header
+file. The AutoGen sources will attempt to include that source with
+a @code{#include <value>} C preprocessing statement. The @code{path} from the
+@file{--with-header-path=path} will be added to @code{CPPFLAGS} as @file{-Ipath}.
+The @code{lib-specs} from @file{--with-regex-lib=lib-specs} will be added
+to @code{LDFLAGS} without any adornment.
+@end table
+
+@c === SECTION MARKER
+
+@page
+@node AutoGen CGI
+@section AutoGen as a CGI server
+
+AutoGen is now capable of acting as a CGI forms server.
+It behaves as a CGI server if the definitions input is from stdin
+and the environment variable @code{REQUEST_METHOD} is defined
+and set to either "GET" or "POST". If set to anything else,
+AutoGen will exit with a failure message. When set to one of those
+values, the CGI data will be converted to AutoGen definitions
+(@pxref{Definitions File}) and the template named "@code{cgi.tpl}"
+will be processed.
+
+This works by including the name of the real template to process
+in the form data and having the "@code{cgi.tpl}" template include
+that template for processing. I do this for processing the form
+@url{http://autogen.sourceforge.net/conftest.html}. The "@code{cgi.tpl}"
+looks approximately like this:
+
+@example
+<? AutoGen5 Template ?>
+<?
+IF (not (exist? "template")) ?><?
+ form-error ?><?
+
+ELIF (=* (get "template") "/") ?><?
+ form-error ?><?
+
+ELIF (define tpl-file (string-append "cgi-tpl/"
+ (get "template")))
+ (access? tpl-file R_OK) ?><?
+ INCLUDE (. tpl-file) ?><?
+
+ELIF (set! tpl-file (string-append tpl-file ".tpl"))
+ (access? tpl-file R_OK) ?><?
+ INCLUDE (. tpl-file) ?><?
+
+ELSE ?><?
+ form-error ?><?
+ENDIF ?>
+@end example
+
+@noindent
+This forces the template to be found in the "@code{cgi-tpl/}"
+directory. Note also that there is no suffix specified in the
+pseudo macro (@pxref{pseudo macro}). That tells AutoGen to emit
+the output to @file{stdout}.
+
+The output is actually spooled until it is complete so that,
+in the case of an error, the output can be discarded and a proper
+error message can be written in its stead.
+
+@strong{Please also note} that it is advisable, @emph{especially} for network
+accessible machines, to configure AutoGen (@pxref{configuring}) with
+shell processing disabled (@code{--disable-shell}). That will make it
+impossible for any referenced template to hand data to a subshell for
+interpretation.
+
+@c === SECTION MARKER
+
+@node signal names
+@section Signal Names
+@cindex Signal Names
+
+When AutoGen is first built, it tries to use @code{psignal(3)},
+@code{sys_siglist}, @code{strsigno(3)} and @code{strsignal(3)} from the
+host operating system. If your system does not supply these, the
+AutoGen distribution will. However, it will use the distributed mapping
+and this mapping is unlikely to match what your system uses. This can
+be fixed. Once you have installed autogen, the mapping can be rebuilt
+on the host operating system. To do so, you must perform the
+following steps:
+
+@enumerate
+@item
+Build and install AutoGen in a place where it will be found in your
+search path.
+
+@item
+@code{cd $@{top_srcdir@}/compat}
+
+@item
+@code{autogen strsignal.def}
+
+@item
+Verify the results by examining the @file{strsignal.h} file produced.
+
+@item
+Re-build and re-install AutoGen.
+@end enumerate
+
+If you have any problems or peculiarities that cause this process to
+fail on your platform, please send me copies of the header files
+containing the signal names and numbers, along with the full path names
+of these files. I will endeavor to fix it. There is a shell script
+inside of @file{strsignal.def} that tries to hunt down the information.
+
+@c === SECTION MARKER
+
+@node installing
+@section Installing AutoGen
+@cindex Installing
+
+There are several files that get installed. The number depend
+whether or not both shared and archive libraries are to be
+installed. The following assumes that everything is installed
+relative to @code{$prefix}. You can, of course, use
+@code{configure} to place these files where you wish.
+
+@strong{NB}@: AutoGen does not contain any compiled-in path names.
+All support directories are located via option processing,
+the environment variable @code{HOME} or finding the directory where
+the executable came from.
+
+The installed files are:
+
+@enumerate
+@item
+The executables in @file{bin} (autogen, getdefs and columns).
+
+@item
+The AutoOpts link libraries as @file{lib/libopts.*}.
+
+@item
+An include file in @file{include/options.h}, needed for
+Automated Option Processing (see next chapter).
+
+@item
+Several template files and a scheme script in @file{share/autogen}, needed
+for Automated Option Processing (@pxref{AutoOpts}), parsing definitions
+written with scheme syntax (@pxref{Dynamic Text}), the templates for
+producing documentation for your program (@pxref{documentation attributes}),
+autoconf test macros, and AutoFSM.
+
+@item
+Info-style help files as @file{info/autogen.info*}.
+These files document AutoGen, the option processing
+library AutoOpts, and several add-on components.
+
+@item
+The three man pages for the three executables are installed in man/man1.
+@end enumerate
+
+This program, library and supporting files can be installed
+with three commands:
+
+@itemize @bullet
+@item
+<src-dir>/configure [ <configure-options> ]
+@item
+make
+@item
+make install
+@end itemize
+
+However, you may wish to insert @code{make check}
+before the @code{make install} command.
+
+If you do perform a @code{make check} and there are any failures, you
+will find the results in @code{<module>/test/FAILURES}. Needless to say, I
+would be interested in seeing the contents of those files and any
+associated messages. If you choose to go on and analyze one of these
+failures, you will need to invoke the test scripts individually. You
+may do so by specifying the test (or list of test) in the TESTS make
+variable, thus:
+
+@example
+gmake TESTS=test-name.test check
+@end example
+
+I specify @code{gmake} because most makes will not let you override
+internal definitions with command line arguments. @code{gmake} does.
+
+All of the AutoGen tests are written to honor the contents of the
+@t{VERBOSE} environment variable. Normally, any commentary generated
+during a test run is discarded unless the @t{VERBOSE} environment
+variable is set. So, to see what is happening during the test, you
+might invoke the following with @i{bash} or @i{ksh}:
+
+@example
+VERBOSE=1 gmake TESTS="for.test forcomma.test" check
+@end example
+
+@noindent
+Or equivalently with @i{csh}:
+
+@example
+env VERBOSE=1 gmake TESTS="for.test forcomma.test" check
+@end example
+
+@ignore
+END == INSTALLATION == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@ignore
+START == AUTOFSM == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node AutoFSM
+@section Automated Finite State Machine
+@cindex AutoFSM
+@cindex finite state machine
+
+The templates to generate a finite state machine in C or C++ is included
+with AutoGen. The documentation is not. The documentation is in HTML
+format for @uref{http://www.gnu.org/software/autogen/autofsm.html,viewing},
+or you can @uref{http://download.sourceforge.net/autogen/,download FSM}.
+
+@node AutoXDR
+@section Combined RPC Marshalling
+@cindex RPC
+@cindex rpcgen
+@cindex remote procedure call
+@cindex AutoXDR
+@cindex XDR
+
+The templates and NFSv4 definitions are not included with AutoGen in any way.
+The folks that designed NFSv4 noticed that much time and bandwidth was
+wasted sending queries and responses when many of them could be bundled.
+The protocol bundles the data, but there is no support for it in rpcgen.
+That means you have to write your own code to do that. Until now.
+Download this and you will have a large, complex example of how to use
+@code{AutoXDR} for generating the marshaling and unmarshaling of combined
+RPC calls. There is a brief example
+@uref{http://www.gnu.org/software/autogen/xdr/index.html,on the web}, but
+you should @uref{http://download.sourceforge.net/autogen/,download AutoXDR}.
+
+@c === SECTION MARKER
+
+@node AutoEvents
+@section Automated Event Management
+@cindex AutoEvents
+
+Large software development projects invariably have a need to manage
+the distribution and display of state information and state changes.
+In other words, they need to manage their software events. Generally,
+each such project invents its own way of accomplishing this and then
+struggles to get all of its components to play the same way. It is a
+difficult process and not always completely successful. This project
+helps with that.
+
+AutoEvents completely separates the tasks of supplying the data
+needed for a particular event from the methods used to manage the
+distribution and display of that event. Consequently, the programmer
+writing the code no longer has to worry about that part of the
+problem. Likewise the persons responsible for designing the event
+management and distribution no longer have to worry about getting
+programmers to write conforming code.
+
+This is a work in progress. See my
+@uref{http://www.gnu.org/software/autogen/autoevents.html,web page}
+on the subject, if you are interested.
+I have some useful things put together, but it is not ready
+to call a product.
+
+@ignore
+END == AUTOFSM == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+@c
+@c AUTOOPTS SECTIONS
+@c
+@c
+@ignore
+START == AUTOOPTS == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+All the features notwithstanding, some applications simply have
+well-established command line interfaces. Even still, those programs
+may use the configuration file parsing portion of the library.
+See the ``AutoOpts Features'' and ``Configuration File Format'' sections.
+
+@menu
+* Features:: AutoOpts Features
+* Licensing:: AutoOpts Licensing
+* Caveats:: Developer and User Notes
+* Quick Start:: Quick Start
+* Option Definitions:: Option Definitions
+* AutoOpts API:: Programmatic Interface
+* Multi-Threading:: Multi-Threading
+* option descriptor:: Option Descriptor File
+* Using AutoOpts:: Using AutoOpts
+* Presetting Options:: Configuring your program
+* Config File Format:: Configuration File Format
+* shell options:: AutoOpts for Shell Scripts
+* AutoInfo:: Automated Info Docs
+* AutoMan pages:: Automated Man Pages
+* getopt_long:: Using getopt(3C)
+* i18n:: Internationalizing AutoOpts
+* Naming Conflicts:: Naming Conflicts
+* All Attribute Names:: All Attribute Names
+* Option Define Names:: Option Definition Name Index
+@end menu
+
+@c === SECTION MARKER
+
+@node Features
+@section AutoOpts Features
+@cindex features
+
+AutoOpts supports option processing; option state saving; and
+program documentation with innumerable features. Here, we list
+a few obvious ones and some important ones, but the full list is
+really defined by all the attributes defined in the @ref{Option Definitions}
+section.
+
+@enumerate
+@item
+POSIX-compliant short (flag) option processing.
+
+@item
+GNU-style long options processing. Long options
+are recognized without case sensitivity, and they may be abbreviated.
+
+@item
+Environment variable initializations, @xref{environrc}.
+
+@item
+Initialization from configuration files (aka RC or INI files), and
+saving the option state back into one, @xref{loading rcfile}.
+
+@item
+Config files may be partitioned. One config file may be used by several
+programs by partitioning it with lines containing,
+``@code{[PROGRAM_NAME]}'' or ``@code{<?program-name>}'', @xref{loading rcfile}.
+
+@item
+Config files may contain AutoOpts directives.
+``@code{<?auto-options [[option-text]]>}'' may be used to set @code{AutoOpts}
+option processing options. Viz., @code{GNU} usage layout versus @code{AutoOpts}
+conventional layout, and @code{misuse-usage} versus @code{no-misuse-usage},
+@xref{usage attributes}.
+
+@item
+Options may be marked as @code{@i{dis}-abled} with a disablement prefix.
+Such options may default to either an enabled or a disabled state. You
+may also provide an enablement prefix, too, e.g., @code{--allow-mumble}
+and @code{--prevent-mumble} (@pxref{Common Attributes}).
+
+@item
+Verify that required options are present between the minimum and maximum
+number of times on the command line. Verify that conflicting options do not
+appear together. Verify that options requiring the presence of other options
+are, in fact, used in the presence of other options.
+See @xref{Common Attributes}, and @xref{Option Conflict Attributes}.
+
+@item
+There are several @ref{automatic options, automatically supported options}.
+They will have short flags if any options have option flags and the flags
+are not suppressed. The associated flag may be altered or suppressed by
+specifying no value or an alternate character for ``@code{xxx-value;}'' in
+the option definition file. ``@code{xxx}'' is the name of the option below:
+
+@table @samp
+@item --help
+@itemx --more-help
+These are always available. @samp{--more-help} will pass the full usage
+text through a pager.
+@item --usage
+@vindex usage-opt
+This is added to the option list if @code{usage-opt} is specified.
+It yields the abbreviated usage to @file{stdout}.
+@item --version
+This is added to the option list if @code{version = xxx;} is specified.
+@item --load-opts
+@itemx --save-opts
+These are added to the option list if @code{homerc} is specified. Mostly.
+If, @code{disable-save} is specified, then @samp{--save-opts} is disabled.
+@end table
+
+@item
+Various forms of main procedures can be added to the output,
+@xref{Generated main}. There are four basic forms:
+
+@enumerate a
+@item
+A program that processes the arguments and writes to standard out
+portable shell commands containing the digested options.
+
+@item
+A program that will generate portable shell commands to parse the defined
+options. The expectation is that this result will be copied into a
+shell script and used there.
+
+@item
+A ``for-each'' main that will invoke a named function once for either
+each non-option argument on the command line or, if there are none,
+then once for each non-blank, non-comment input line read from stdin.
+
+@item
+A main procedure of your own design. Its code can be supplied in the
+option description template or by incorporating another template.
+@end enumerate
+
+@item
+There are several methods for handling option arguments.
+@itemize @bullet
+@item
+nothing (@pxref{OPT_ARG}) option argument strings are globally available.
+@item
+user supplied (@pxref{Option Argument Handling})
+@item
+stack option arguments (@pxref{Option Argument Handling})
+@item
+integer numbers (@pxref{arg-type number})
+@item
+true or false valued (@pxref{arg-type boolean})
+@item
+enumerated list of names (@pxref{arg-type keyword})
+@item
+an enumeration (membership) set (@pxref{arg-type set membership})
+@item
+a list of name/value pairs (option ``subopts'') (@pxref{arg-type hierarchy})
+@item
+a time duration or a specific time and date
+@item
+validated file name (@pxref{arg-type file name})
+@item
+optional option argument (@pxref{arg-optional})
+@end itemize
+
+@item
+The generated usage text can be emitted in either AutoOpts standard
+format (maximizing the information about each option), or GNU-ish
+normal form. The default form is selected by either specifying or not
+specifying the @code{gnu-usage} attribute (@pxref{information attributes}).
+This can be overridden by the user himself with the
+@code{AUTOOPTS_USAGE} environment variable. If it exists and is set
+to the string @code{gnu}, it will force GNU-ish style format; if it is
+set to the string @code{autoopts}, it will force AutoOpts standard
+format; otherwise, it will have no effect.
+
+@item
+The usage text and many other strings are stored in a single character array
+(@pxref{SCM string-table-new,string table functions}). This reduces fixup
+costs when loading the program or library. The downside is that if GCC
+detects that any of these strings are used in a printf format, you may get
+the warning, @code{embedded '\0' in format}. To eliminate the warning, you
+must provide GCC with the @code{-Wno-format-contains-nul} option.
+
+@item
+If you compile with @code{ENABLE_NLS} defined and @code{_()} defined to
+a localization function (e.g. @code{gettext(3GNU)}), then the option
+processing code will be localizable (@pxref{i18n}). Provided also that
+you do not define the @code{no-xlate} attribute to @emph{anything}
+(@pxref{presentation attributes}).
+
+@item
+Provides a callable routine to parse
+a text string as if it were from one of the rc/ini/config files,
+hereafter referred to as a configuration file.
+
+@item
+By adding a @samp{doc} and @samp{arg-name} attributes to each option,
+AutoGen will also be able to produce a man page and the @samp{invoking}
+section of a texinfo document.
+
+@item
+Intermingled option processing. AutoOpts options may be intermingled with
+command line operands and options processed with other parsing techniques.
+This is accomplished by setting the @code{allow-errors}
+(@pxref{program attributes}) attribute. When processing reaches a point
+where @code{optionProcess} (@pxref{libopts-optionProcess}) needs to be called
+again, the current option can be set with @code{RESTART_OPT(n)}
+(@pxref{RESTART_OPT}) before calling @code{optionProcess}.
+
+See: @xref{library attributes}.
+
+@item
+Library suppliers can specify command line options that their
+client programs will accept. They specify option definitions
+that get @code{#include}-d into the client option definitions
+and they specify an "anchor" option that has a callback and must be invoked.
+That will give the library access to the option state for their options.
+
+@item
+library options. An AutoOpt-ed library may export its options for use in
+an AutoOpt-ed program. This is done by providing an option definition file
+that client programs @code{#include} into their own option definitions.
+See ``AutoOpt-ed Library for AutoOpt-ed Program'' (@pxref{lib and program})
+for more details.
+@end enumerate
+
+@c === SECTION MARKER
+
+@node Licensing
+@section AutoOpts Licensing
+@cindex Licensing
+
+When AutoGen is installed, the AutoOpts project is installed with it.
+AutoOpts includes various AutoGen templates and a pair of shared
+libraries. These libraries may be used under the terms of version 3
+of the GNU Lesser General Public License (LGPL).
+
+One of these libraries (@code{libopts}) is needed by programs that are built
+using AutoOpts generated code. This library is available as a separate
+``tear-off'' source tarball. It is redistributable for use under either of
+two licenses: The above mentioned GNU Lesser General Public License, and
+the advertising-clause-free BSD license. Both of these license terms are
+incorporated into appropriate COPYING files included with the @code{libopts}
+source tarball. This source may be incorporated into your package with
+the following simple commands:
+
+@example
+rm -rf libopts libopts-*
+gunzip -c `autoopts-config libsrc` | \
+ tar -xvf -
+mv libopts-*.*.* libopts
+@end example
+
+View the @file{libopts/README} file for further integration information.
+
+@c === SECTION MARKER
+
+@page
+@node Caveats
+@section Developer and User Notes
+
+AutoOpts has its conventional way of displaying option information
+that includes somewhat more information that the standard GNU method.
+AutoOpts will also print out a line of usage text for each option type
+when options are misspecified. GNU programs typically do not do this.
+These defaults can be changed on a per-program basis by adding either
+or both of the following in the option definition file:
+
+@example
+gnu-usage;
+no-misuse-usage;
+@end example
+
+Users may also override these settings with the @code{AUTOOPTS_USAGE}
+environment variable. It may be set to a comma or white space separated
+list of the following strings:
+
+@table @samp
+@item gnu
+@cindex gnu
+The format of the extended usage text will be displayed in GNU-normal form.
+The default display for @code{--version} will be to include a note
+on licensing terms.
+
+@item autoopts
+@cindex autoopts
+The format of the extended usage will be in AutoOpts' native layout.
+
+@item no-misuse-usage
+@cindex no-misuse-usage
+When an option error is made on the command line, the abbreviated
+usage text will be suppressed.
+
+@item misuse-usage
+@cindex misuse-usage
+When an option error is made on the command line, the abbreviated
+usage text will be shown.
+@end table
+
+@noindent
+The setting used is the last one seen. The @code{autoopts} and
+@code{misuse-usage} serve no purpose, unless the definition file
+entries were specified as above.
+
+@b{Note for developers}:
+
+The templates used to implement AutoOpts depend heavily upon
+token pasting. That mens that if you name an option, ``debug'', for
+example, the generated header will expect to be able to emit
+@code{#define} macros such as this:
+@example
+#define DESC(n) (autogenOptions.pOptDesc[INDEX_OPT_## n])
+@end example
+and expect @code{DESC(DEBUG)} to expand correctly into
+@code{(autogenOptions.pOptDesc[INDEX_OPT_DEBUG])}.
+If @code{DEBUG} is @code{#defined} to something else, then
+that something else will be in the above expansion.
+
+If you discover you are having strange problems like this,
+you may wish to use some variation of the @code{guard-option-names}
+@xref{program attributes}.
+
+
+@c === SECTION MARKER
+
+@page
+@node Quick Start
+@section Quick Start
+@cindex example, simple AutoOpts
+
+Since it is generally easier to start with a simple example than it is
+to look at the options that AutoGen uses itself, here is a very simple
+AutoOpts example. You can copy this example out of the Info file and
+into a source file to try it. You can then embellish it into what you
+really need. For more extensive examples, you can also examine the help
+output and option definitions for the commands @code{columns},
+@code{getdefs} and @code{autogen} itself.
+
+For our simple example, assume you have a program named @code{check}
+that takes two options:
+
+@enumerate
+@item
+A list of directories to check over for whatever it is @code{check} does.
+You want this option available as a POSIX-style flag option
+and a GNU long option. You want to allow as many of these
+as the user wishes.
+@item
+An option to show or not show the definition tree being used.
+Only one occurrence is to be allowed, specifying one or the other.
+@end enumerate
+
+@ignore
+END == AUTOOPTS == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@ignore
+START == AUTOOPTS-MAIN == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@noindent
+Normally, however, you would not use the ``main'' clause. Instead,
+the file would be named something like @file{checkopt.def}, you would
+compile @file{checkopt.c} the usual way, and link the object with the rest
+of your program.
+
+The options are processed by calling @code{optionProcess}
+(@pxref{libopts-optionProcess}):
+
+@example
+main( int argc, char** argv )
+@{
+ @{
+ int optct = optionProcess( &checkOptions, argc, argv );
+ argc -= optct;
+ argv += optct;
+ @}
+@end example
+
+The options are tested and used as in the following fragment.
+``@code{ENABLED_OPT}'' is used instead of ``@code{HAVE_OPT}'' for the
+@code{show-defs} option because it is an enabled/disabled option type:
+
+@example
+ if ( ENABLED_OPT( SHOW_DEFS )
+ && HAVE_OPT( CHECK_DIRS )) @{
+ int dirct = STACKCT_OPT( CHECK_DIRS );
+ char** dirs = STACKLST_OPT( CHECK_DIRS );
+ while (dirct-- > 0) @{
+ char* dir = *dirs++;
+ ...
+@end example
+
+The ``doc'' clauses are used in the flag stanzas for man pages and
+texinfo invoking documentation. With the above definition file, the
+two following commands will produce the two documentation files
+@file{check.1} and @file{invoke-check.texi}. The latter file will
+be generated as a chapter, rather than a section or subsection.
+
+@example
+autogen -Tagman-cmd check.def
+autogen -DLEVEL=chapter -Tagtexi-cmd -binvoke-check.texi check.def
+@end example
+
+@noindent
+The result of which is left as an exercise for the reader.
+
+A lot of magic happens to make this happen.
+The rest of this chapter will describe the myriad of option attributes
+supported by AutoOpts. However, keep in mind that, in general, you won't
+need much more than what was described in this "quick start" section.
+
+@node Option Definitions
+@section Option Definitions
+@cindex Option Definitions
+
+AutoOpts uses an AutoGen definitions file for the definitions of the
+program options and overall configuration attributes.
+The complete list of program and option attributes is quite extensive,
+so if you are reading to understand how to use AutoOpts, I recommend
+reading the "Quick Start" section (@pxref{Quick Start}) and paying
+attention to the following:
+
+@enumerate
+@item
+@code{prog-name}, @code{prog-title}, and @code{argument}, program
+attributes, @xref{program attributes}.
+@item
+@code{name} and @code{descrip} option attributes, @xref{Required Attributes}.
+@item
+@code{value} (flag character) and @code{min} (occurrence counts)
+option attributes, @xref{Common Attributes}.
+@item
+@code{arg-type} from the option argument specification section,
+@xref{Option Arguments}.
+@item
+Read the overall how to, @xref{Using AutoOpts}.
+@item
+Highly recommended, but not required, are the several "man" and
+"info" documentation attributes, @xref{documentation attributes}.
+@end enumerate
+
+Keep in mind that the majority are rarely used and can be safely
+ignored. However, when you have special option processing requirements,
+the flexibility is there.
+
+@menu
+* program attributes:: Program Description Attributes
+* library attributes:: Options for Library Code
+* information attributes:: Program Information Attributes
+* Generated main:: Generating main procedures
+* option attributes:: Option Attributes
+* Option Arguments:: Option Argument Specification
+* Option Argument Handling:: Option Argument Handling
+* Internationalizing Options:: Internationalizing Options
+* documentation attributes:: Man and Info doc Attributes
+* automatic options:: Automatically Supported Options
+* standard options:: Library of Standard Options
+@end menu
+
+@node program attributes
+@subsection Program Description Attributes
+@cindex program attributes
+
+The following global definitions are used to define attributes of the entire
+program. These generally alter the configuration or global behavior of the
+AutoOpts option parser. The first two are required of every program. The
+third is required if there are to be any left over arguments (operands)
+after option processing. The rest have been grouped below. Except as noted,
+there may be only one copy of each of these definitions:
+
+@table @samp
+
+@item prog-name
+@vindex prog-name
+This attribute is required. Variable names derived from this name
+are derived using @code{string->c_name!} (@pxref{SCM string->c-name!}).
+
+@item prog-title
+@vindex prog-title
+This attribute is required and may be any descriptive text.
+
+@item argument
+@vindex argument
+This attribute is required if your program uses operand arguments.
+It specifies the syntax of the arguments that @strong{follow} the options.
+It may not be empty, but if it is not supplied, then option processing
+must consume all the arguments. If it is supplied and starts with an
+open bracket (@code{[}), then there is no requirement on the presence or
+absence of command line arguments following the options. Lastly, if it
+is supplied and does not start with an open bracket, then option
+processing must @strong{not} consume all of the command line arguments.
+
+@item config-header
+@vindex config-header
+If your build has a configuration header, it must be included before
+anything else. Specifying the configuration header file name with this
+attribute will cause that to happen.
+@end table
+
+@menu
+* usage attributes:: Usage and Version Info Display
+* config attributes:: Program Configuration
+* programming attributes:: Programming Details
+* presentation attributes:: User Presentation Attributes
+@end menu
+
+@c
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+@c
+@node usage attributes
+@subsubsection Usage and Version Info Display
+
+These will affect the way usage is seen and whether or not version
+information gets displayed.
+
+@table @samp
+@item full-usage
+@vindex full-usage
+If this attribute is provided, it may specify the full length
+usage text, or a variable name assignable to a ``char const *'' pointer,
+or it may be empty. The meanings are determined by the length.
+@itemize @bullet
+@item
+If not provided, the text will be computed as normal.
+@item
+If the length is zero, then the usage text will be derived from
+the current settings and inserted as text into the generated .c file.
+@item
+If the length is 1 to 32 bytes, then it is presumed to be a variable
+name that either points to or is an array of const chars.
+@item
+If it is longer than that, it is presumed to be the help text itself.
+This text will be inserted into the generated .c file.
+@end itemize
+
+This string should be readily translatable. Provision will be made
+to translate it if this is provided, if the source code is compiled with
+@code{ENABLE_NLS} defined, and @code{no-xlate} has not been set to the
+value @emph{anything}.
+
+@item short-usage
+@vindex short-usage
+If this attribute is provided, it is used to specify an abbreviated
+version of the usage text. This text is constructed in the same way
+as the ``full-usage'', described above.
+
+@item gnu-usage
+@vindex gnu-usage
+AutoOpts normaly displays usage text in a format that provides more
+information than the standard GNU layout, but that also means it is
+not the standard GNU layout. This attribute changes the default to
+GNU layout, with the @code{AUTOOPTS_USAGE} environment variable used
+to request @code{autoopts} layout.
+See @xref{Caveats, Developer and User Notes}.
+
+@item usage-opt
+@vindex usage-opt
+I apologize for too many confusing usages of usage.
+This attribute specifies that @code{--usage} and/or @code{-u} be
+supported. The help (usage) text displayed will be abbreviated
+when compared to the default help text.
+
+@item no-misuse-usage
+@vindex no-misuse-usage
+When there is a command line syntax error, by default AutoOpts will
+display the abbreviated usage text, rather than just a one line
+``you goofed it, ask for usage'' message. You can change the default
+behavior for your program by supplying this attribute. The user may
+override this choice, again, with the @code{AUTOOPTS_USAGE} environment
+variable. See @xref{Caveats, Developer and User Notes}.
+
+@item prog-group
+@vindex prog-group
+The version text in the @file{getopt.tpl} template will include this
+text in parentheses after the program name, when this attribute is specified.
+For example:
+@example
+mumble (stumble) 1.0
+@end example
+@noindent
+says that the ``@code{mumble}'' program is version 1.0 and is part of the
+``@code{stumble}'' group of programs.
+
+@item usage
+@vindex usage
+If your program has some cleanup work that must be done before exiting
+on usage mode issues, or if you have to customize the usage message in
+some way, specify this procedure and it will be called instead of the
+default @code{optionUsage()} function. For example, if a program is
+using the curses library and needs to invoke the usage display, then
+you must arrange to call @code{endwin()} before invoking the library
+function @code{optionUsage()}. This can be handled by specifying your
+own usage function, thus:
+@example
+void
+my_usage(tOptions * opts, int ex)
+@{
+ if (curses_window_active)
+ endwin();
+ optionUsage(opts, ex);
+@}
+@end example
+
+@item version
+@vindex version
+Specifies the program version and activates the VERSION option,
+@xref{automatic options}.
+@end table
+
+@c
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+@c
+@node config attributes
+@subsubsection Program Configuration
+
+Programs may be ``pre-configured'' before normal command line options
+are processed (See @pxref{Immediate Action, Immediate Action Attributes}).
+How configuration files and environment variables are handled get
+specified with these attributes.
+
+@table @samp
+@item disable-load
+@itemx disable-save
+@vindex disable-load
+@vindex disable-save
+Indicates that the command line usage of @code{--load-opts} and/or
+@code{--save-opts} are disallowed.
+
+@item environrc
+@vindex environrc
+Indicates looking in the environment for values of variables named,
+@code{PROGRAM_OPTNAME} or @code{PROGRAM}, where @code{PROGRAM} is the
+upper cased @code{C-name} of the program and @code{OPTNAME} is the
+upper cased @code{C-name} of a specific option. The contents of
+the @code{PROGRAM} variable, if found, are tokenized and processed.
+The contents of @code{PROGRAM_OPTNAME} environment variables are taken
+as the option argument to the option nameed @code{optname}.
+
+@item homerc
+@vindex homerc
+Specifies that option settings may be loaded from and stored into
+configuration files. Each instance of this attribute is either a directory or
+a file using a specific path, a path based on an environment variable or a
+path relative to installation directories. The method used depends on the name.
+If the one entry is empty, it enables the loading and storing of settings,
+but no specific files are searched for. Otherwise, a series of configuration
+files are hunted down and, if found, loaded.
+
+If the first character of the @samp{homerc} value is not the dollar
+character (@code{$}), then it is presumed to be a path name based on the
+current directory. Otherwise, the method depends on the second character:
+
+@table @code
+@item $
+The path is relative to the directory where the executable was found.
+@item @@
+The path is relative to the package data directory, e.g.
+@code{/usr/local/share/autogen}.
+@item [a-zA-Z]
+The path is derived from the named environment variable.
+@end table
+
+Use as many as you like. The presence of this attribute
+activates the @code{--save-opts} and @code{--load-opts} options.
+However, saving into a file may be disabled with the @samp{disable-save}.
+@xref{loading rcfile}.
+See the @code{optionMakePath(3AGEN)} man page for excruciating details.
+
+@item rcfile
+@vindex rcfile
+Specifies the configuration file name. This is only useful if you
+have provided at least one @code{homerc} attribute.
+@example
+default: .<prog-name>rc
+@end example
+
+@item vendor-opt
+@vindex vendor-opt
+This option implements the @code{-W} vendor option command line option.
+
+For POSIX specified utilities, the options are constrained to the options
+that are specified by POSIX. Extensions should be handled with @code{-W}
+command line options, the short flag form. Long option name processing
+must be disabled. In fact, the @code{long-opts} attribute must not be
+provided, and some options must be specified without flag values.
+
+The @code{-W long-name} is processed by looking up the long option
+name that follows it. It cannot be a short flag because that would
+conflict with the POSIX flag name space. It will be processed as if
+long options were accepted and @code{--long-name} were found on the
+command line.
+@end table
+
+@c
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+@c
+@node programming attributes
+@subsubsection Programming Details
+
+These attributes affect some of the ways that the option data are
+used and made available to the program.
+
+@table @samp
+@item config-header
+@vindex config-header
+The contents of this attribute should be just the name of the configuration
+file. A "#include" naming this file will be inserted at the top of the
+generated header.
+
+@item exit-name
+@itemx exit-desc
+@vindex exit-name
+@vindex exit-desc
+These values should be defined as indexed values, thus:
+@example
+exit-name[0] = success;
+exit-desc[0] = 'Successful program execution.';
+exit-name[1] = failure;
+exit-desc[1] = 'The operation failed or command syntax was not valid.';
+@end example
+By default, all programs have these effectively defined for them.
+They may be overridden by explicitly defining any or all of these values.
+Additional names and descriptions may be defined.
+They will cause an enumeration to be emitted, like this one
+for @code{getdefs}:
+@example
+typedef enum @{
+ GETDEFS_EXIT_SUCCESS = 0,
+ GETDEFS_EXIT_FAILURE = 1
+@} getdefs_exit_code_t;
+@end example
+@noindent
+which will be augmented by any @code{exit-name} definitions beyond ``1''.
+
+@item usage-message
+@vindex usage-message
+This attribute will cause two procedures to be added to the code file:
+@code{usage_message} and @code{vusage_message}, with any applicable prefix
+(see @code{prefix}, below). They are declared in the
+generated header, thus:
+@example
+extern void vusage_message(char const * fmt, va_list ap);
+extern void usage_message(char const * fmt, ...);
+@end example
+@noindent
+These functions print the message to @file{stderr} and invoke the usage
+function with the exit code set to @code{1} (@code{EXIT_FAILURE}).
+
+@item die-code
+@vindex die-code
+This tells AutoOpts templates to emit code for @code{vdie}, @code{die} and
+@code{fserr} functions. If the @code{die-code} is assigned a text value,
+then that code will be inserted in the @code{vdie} function immediately
+before it prints the death rattle message.
+
+The profiles for these functions are:
+@example
+extern void vdie( int exit_code, char const * fmt, va_list);
+extern void die( int exit_code, char const * fmt, ...);
+extern void fserr(int exit_code, char const * op, char const * fname);
+@end example
+
+@item export
+@vindex export
+This string is inserted into the .h interface file. Generally used for
+global variables or @code{#include} directives required by
+@code{flag-code} text and shared with other program text.
+Do not specify your configuration header (@file{config.h}) in this
+attribute or the @code{include} attribute, however. Instead, use
+@code{config-header}, above.
+
+@item guard-option-names
+@vindex guard-option-names
+AutoOpts generates macros that presume that there are no @code{cpp} macros
+with the same name as the option name. For example, if you have an option
+named, @code{debug}, then you must not use @code{#ifdef DEBUG} in your code.
+If you specify this attribute, every option name will be guarded. If the name
+is @code{#define}-d, then a warning will be issued and the name undefined.
+If you do not specify this and there is a conflict, you will get strange
+error messages.
+
+This attribute may be set to any of four recognized states:
+
+@itemize @bullet
+@item
+Not defined. AutoOpts will behave as described above.
+
+@item
+Defined, but set to the empty string. Text will be emitted into the header
+to undefine (@code{#undef}) any conflicting preprocessor macros. The code
+will include compiler warnings (via @code{#warning}). Some compilers are
+not ANSI-C-99 compliant yet and will error out on those warnings. You may
+compile with @code{-DNO_OPTION_NAME_WARNINGS} to silence or mostly silence
+them.
+
+@item
+Defined and set to the string, ``@code{no-warning}''. All of the needed
+@code{#undef}s will be emitted, without any conflict checking @code{#warning}
+directives emitted.
+
+@item
+Defined and set to the string, ``@code{full-enum}''. The option manipulation
+preprocessor macros will not token paste the option names to the index
+enumeration prefix. e.g. you will need to use @code{HAVE_OPT(INDEX_OPT_DEBUG)}
+instead of @code{HAVE_OPT(DEBUG)}.
+@end itemize
+
+@item include
+@vindex include
+This string is inserted into the .c file. Generally used for global
+variables required only by @code{flag-code} program text.
+
+@item no-libopts
+@vindex no-libopts
+If you are going to handle your option processing with the @code{getopt.tpl}
+template instead of using libopts, then specify this attribute. It will
+suppress mention of @code{--more-help} in the generated documentation.
+(@code{getopt_long} does not support @code{--more-help}.)
+
+@item prefix
+@vindex prefix
+This value is inserted into @strong{all} global names. This will
+disambiguate them if more than one set of options are to be compiled
+into a single program.
+@end table
+
+@c
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+@c
+@node presentation attributes
+@subsubsection User Presentation Attributes
+
+Attributes that affect the user's experience.
+
+@table @samp
+@item allow-errors
+@vindex allow-errors
+The presence of this attribute indicates ignoring any command line
+option errors. This may also be turned on and off by invoking the
+macros @code{ERRSKIP_OPTERR} and @code{ERRSTOP_OPTERR} from the
+generated interface file.
+
+@item long-opts
+@vindex long-opts
+@cindex named option mode
+Presence indicates GNU-standard long option processing. Partial name
+matches are accepted, if they are at least two characters long and the
+partial match is unique. The matching is not case sensitive, and the
+underscore, hyphen and carat characters are all equivalent (they match).
+
+If any options do not have an option value (flag character) specified,
+and least one does specify such a value, then you must specify
+@code{long-opts}. If none of your options specify an option value
+(flag character) and you do not specify @code{long-opts}, then command
+line arguments are processed in "named option mode". This means that:
+
+@itemize @bullet
+@item
+Every command line argument must be a long option.
+@item
+The flag markers @code{-} and @code{--} are completely optional.
+@item
+The @code{argument} program attribute is disallowed.
+@item
+One of the options may be specified as the default
+(as long as it has a required option argument).
+@end itemize
+
+@item no-xlate
+@vindex no-xlate
+Modifies when or whether option names get translated. If provided,
+it must be assigned one of these values:
+@table @samp
+@item opt-cfg
+to suppress option name translation for configuration file and and environment
+variable processing.
+@item opt
+to suppress option name translation completely. The usage text will
+always be translated if @code{ENABLE_NLS} is defined and you have
+translations for that text.
+@item anything
+Specifies disabling all internationalization support for option code, completely.
+@end table
+See also the various @code{XLAT} interface entries in the
+AutoOpts Programmatic Interface section (@pxref{AutoOpts API}).
+
+@item reorder-args
+@vindex reorder-args
+Normally, POSIX compliant commands do not allow for options to be interleaved
+with operands. If this is necessary for historical reasons, there are two
+approaches available:
+@itemize @bullet
+@item
+Allow @code{optionProcess} to return the index of the operand like it normally
+does and process the operand(s). When an operand is encountered that starts
+with a hyphen, then set the AutoOpts current index with the @code{RESTART_OPT}
+macro (see @pxref{RESTART_OPT}), and re-invoke @code{optionProcess}. This will
+also allow you to process the operands in context.
+
+@item
+Specify this attribute. AutoOpts will re-order the command arguments
+so that the operands appear (in the original order) at the end of
+the argument list. Differing configuration state is not possible
+to detect after all options have been processed.
+@end itemize
+
+@item resettable
+@vindex resettable
+Specifies that the @code{--reset-option} command line option is to be supported.
+This makes it possible to suppress any setting that might be found in
+a configuration file or environment variable.
+@end table
+
+@node library attributes
+@subsection Options for Library Code
+@cindex library attributes
+
+Some libraries provide their own code for processing command line
+options, and this may be used by programs that utilize AutoOpts.
+You may also wish to write a library that gets configured with AutoOpts
+options and config files. Such a library may either supply its own
+configury routine and process its own options, or it may export its
+option descriptions to programs that also use AutoOpts. This section
+will describe how to do all of these different things.
+
+@menu
+* lib and program:: AutoOpt-ed Library for AutoOpt-ed Program
+* lib called:: AutoOpt-ed Library for Regular Program
+* prog calls lib:: AutoOpt-ed Program Calls Regular Library
+@end menu
+
+@node lib and program
+@subsubsection AutoOpt-ed Library for AutoOpt-ed Program
+
+The library source code must provide an option definition file that consists
+of only the attribute @code{library}
+@vindex library
+and @code{flag} entries. The ``library'' attribute does not need any
+associated value, so it will generally appeary by itself on a line folowed
+by a semi-colon. The first @code{flag} entry must contain the following
+attributes:
+
+@table @samp
+@item name
+This name is used in the construction of a global pointer of type
+@code{tOptDesc const*}. It is always required.
+@item documentation
+@vindex documentation
+It tells @code{AutoOpts} that this option serves no normal purpose.
+It will be used to add usage clarity and to locate option descriptors
+in the library code.
+@item descrip
+This is a string that is inserted in the extended usage display
+before the options specific to the current library. It is always required.
+@item lib-name
+@vindex lib-name
+This should match the name of the library. This string is also used in
+the construction of the option descriptor pointer name. In the end, it
+looks like this:
+@example
+extern tOptDesc const* <<lib-name>>_<<name>>_optDesc_p;
+@end example
+@noindent
+and is used in the macros generated for the library's @code{.h} file.
+@end table
+
+In order to compile this @code{AutoOpts} using library, you must create a
+special header that is not used by the client program. This is accomplished
+by creating an option definition file that contains essentially exactly the
+following:
+
+@example
+AutoGen definitions options;
+prog-name = does-not-matter; // but is always required
+prog-title = 'also does not matter'; // also required
+config-header = 'config.h'; // optional, but common
+library;
+#include library-options-only.def
+@end example
+
+@noindent
+and nothing else. AutoGen will produce only the @code{.h} file.
+You may now compile your library, referencing just this @code{.h} file.
+The macros it creates will utilize a global variable that will be defined
+by the @code{AutoOpts}-using client program. That program will need to
+have the following @code{#include} in @i{its} option definition file:
+
+@example
+#include library-options-only.def
+@end example
+
+@noindent
+All the right things will magically happen so that the global variables
+named @code{<<lib-name>>_<<name>>_optDesc_p} are initialized correctly.
+For an example, please see the @code{AutoOpts} test script:
+@file{autoopts/test/library.test}.
+
+@node lib called
+@subsubsection AutoOpt-ed Library for Regular Program
+
+In this case, your library must provide an option processing function
+to a calling program. This is accomplished by setting the @code{allow-errors}
+global option attribute. Each time your option handling function is called,
+you must determine where your scan is to resume and tell the AutoOpts library
+by invoking:
+
+@example
+RESTART_OPT(next_arg_index);
+@end example
+
+@noindent
+and then invoke @code{not_opt_index = optionProcess(...)}.
+The @code{not_opt_index} value can be used to set @code{optind},
+if that is the global being used to scan the program argument array.
+
+In this method, do @strong{NOT} utilize the global @code{library} attribute.
+Your library must specify its options as if it were a complete program.
+You may choose to specify an alternate @code{usage()} function so that
+usage for other parts of the option interface may be displayed as well.
+See ``Program Information Attributes'' (@pxref{information attributes}).
+
+At the moment, there is no method for calling @code{optionUsage()} telling
+it to produce just the information about the options and not the program
+as a whole. Some later revision after somebody asks.
+
+@node prog calls lib
+@subsubsection AutoOpt-ed Program Calls Regular Library
+
+As with providing an @code{AutoOpt}-ed library to a non-@code{AutoOpt}-ed
+program, you must write the option description file as if you were writing
+all the options for the program, but you should specify the
+@code{allow-errors} global option attribute and you will likely want an
+alternate @code{usage()} function (see ``Program Information Attributes''
+@pxref{information attributes}). In this case, though, when
+@code{optionProcess()} returns, you need to test to see if there might be
+library options. If there might be, then call the library's exported
+routine for handling command line options, set the next-option-to-process
+with the @code{RESTART_OPT()} macro, and recall @code{optionProcess()}.
+Repeat until done.
+
+@node information attributes
+@subsection Program Information Attributes
+@cindex information attributes
+
+These attributes are used to define how and what information is displayed
+to the user of the program.
+
+@table @samp
+@item copyright
+@vindex copyright
+The @code{copyright} is a structured value containing three to five
+values. If @code{copyright} is used, then the first three are required.
+
+@enumerate
+@item
+@vindex date
+@file{date} - the list of applicable dates for the copyright.
+@item
+@vindex owner
+@file{owner} - the name of the copyright holder.
+@item
+@vindex type
+@file{type} - specifies the type of distribution license.
+AutoOpts/AutoGen supports the text of the GNU Public License (@file{gpl}),
+the GNU ``Lesser'' General Public License with Library extensions
+(@file{lgpl}), the Modified Free BSD license (@file{mbsd}) and a few others.
+Other licenses may be specified, but you must provide your own license file.
+The list of license files provided by AutoOpts may be seen by typing:
+@example
+ls $(autoopts-config pkgdatadir)/*.lic
+@end example
+@item
+@vindex text
+@file{text} - the text of the copyright notice. This must be provided
+if @file{type} is set to @file{NOTE}.
+@item
+@vindex author
+@file{author} - in case the author name is to appear in the documentation
+and is different from the copyright owner.
+@item
+@vindex eaddr
+@file{eaddr} - email address for receiving praises and complaints.
+Typically that of the author or copyright holder.
+@end enumerate
+@*
+An example of this might be:
+@example
+copyright = @{
+ date = "1992-2012";
+ owner = "Bruce Korb";
+ eaddr = 'bkorb@@gnu.org';
+ type = GPL;
+@};
+@end example
+
+@item detail
+@vindex detail
+This string is added to the usage output when the HELP option is
+selected.
+
+@item explain
+@vindex explain
+Gives additional information whenever the usage routine is invoked.
+
+@item package
+@vindex package
+The name of the package the program belongs to. This will appear
+parenthetically after the program name in the version and usage output,
+e.g.: @code{autogen @i{(GNU autogen)} - The Automated Program Generator}.
+
+@item preserve-case
+@vindex preserve-case
+This attribute will not change anything except appearance. Normally, the
+option names are all documented in lower case. However, if you specify this
+attribute, then they will display in the case used in their specification.
+Command line options will still be matched without case sensitivity.
+This is useful for specifying option names in camel-case.
+
+@item prog-desc @strong{and}
+@itemx opts-ptr
+@vindex prog-desc
+@vindex opts-ptr
+These define global pointer variables that point to the program
+descriptor and the first option descriptor for a library option. This
+is intended for use by certain libraries that need command line and/or
+initialization file option processing. These definitions have no effect
+on the option template output, but are used for creating a library
+interface file. Normally, the first "option" for a library will be a
+documentation option that cannot be specified on the command line, but
+is marked as @code{settable}. The library client program will invoke the
+@code{SET_OPTION} macro which will invoke a handler function that will
+finally set these global variables.
+
+@item usage
+@vindex usage
+Optionally names the usage procedure, if the library routine
+@code{optionUsage()} does not work for you. If you specify
+@code{my_usage} as the value of this attribute, for example, you will
+use a procedure by that name for displaying usage. Of course, you will
+need to provide that procedure and it must conform to this profile:
+@example
+void @i{my_usage}( tOptions* pOptions, int exitCode )
+@end example
+
+@item gnu-usage
+@vindex gnu-usage
+Normally, the default format produced by the @code{optionUsage} procedure
+is @i{AutoOpts Standard}. By specifying this attribute, the default format
+will be @i{GNU-ish style}. Either default may be overridden by the user with
+the @code{AUTOOPTS_USAGE} environment variable. If it is set to @code{gnu}
+or @code{autoopts}, it will alter the style appropriately. This attribute
+will conflict with the @code{usage} attribute.
+
+@item reorder-args
+@vindex reorder-args
+Some applications traditionally require that the command operands be
+intermixed with the command options. In order to handle that, the arguments
+must be reordered. If you are writing such an application, specify this
+global option. All of the options (and any associated option arguments)
+will be brought to the beginning of the argument list. New applications
+should not use this feature, if at all possible. This feature is
+@i{disabled} if @code{POSIXLY_CORRECT} is defined in the environment.
+@end table
+
+@node Generated main
+@subsection Generating main procedures
+@cindex main procedure
+
+When AutoOpts generates the code to parse the command line options, it has
+the ability to produce any of several types of @code{main()} procedures.
+This is done by specifying a global structured value for
+@vindex main
+@code{main}. The values that it contains are dependent on the value set for
+the one value it must have: @code{main-type}.
+
+@vindex main-type
+The recognized values for @code{main-type} are:
+@menu
+* main guile:: guile: main and inner_main procedures
+* main shell-process:: shell-process: emit Bourne shell results
+* main shell-parser:: shell-parser: emit Bourne shell script
+* main main:: main: user supplied main procedure
+* main include:: include: code emitted from included template
+* main invoke:: invoke: code emitted from AutoGen macro
+* main for-each:: for-each: perform function on each argument
+@end menu
+
+Here is an example of an @code{include} variation:
+
+@example
+main = @{
+ main-type = include;
+ tpl = "main-template.tpl";
+@};
+@end example
+
+@node main guile
+@subsubsection guile: main and inner_main procedures
+
+When the @code{main-type} is specified to be @code{guile},
+a @code{main()} procedure is generated that calls @code{gh_enter()}, providing
+it with a generated @code{inner_main()} to invoke. If you must perform
+certain tasks before calling @code{gh_enter()}, you may specify such code
+in the value for the
+@vindex before-guile-boot
+@code{before-guile-boot} attribute.
+
+The @code{inner_main()} procedure itself will process the command line
+arguments (by calling @code{optionProcess()},
+@pxref{libopts-optionProcess}), and then either invoke the code
+specified with the
+@vindex guile-main
+@code{guile-main} attribute, or else export the parsed options to Guile
+symbols and invoke the @code{scm_shell()} function from the Guile library.
+This latter will render the program nearly identical to the stock
+@code{guile(1)} program.
+
+@node main shell-process
+@subsubsection shell-process: emit Bourne shell results
+
+This will produce a @code{main()} procedure that parses the command line
+options and emits to @file{stdout} Bourne shell commands that puts the
+option state into environment variables. This can be used within a
+shell script as follows:
+
+@example
+unset OPTION_CT
+eval "`opt_parser \"$@@\"`"
+test -z "$@{OPTION_CT@}" && exit 1
+test $@{OPTION_CT@} -gt 0 && shift $@{OPTION_CT@}
+@end example
+
+If the option parsing code detects an error or a request for usage,
+it will not emit an assignment to OPTION_CT and the script should just
+exit. If the options are set consistently, then something along the
+lines of the following will be written to @file{stdout} and evaled:
+
+@example
+ OPTION_CT=4
+ export OPTION_CT
+ MYPROG_SECOND='first'
+ export MYPROG_SECOND
+ MYPROG_ANOTHER=1 # 0x1
+ export MYPROG_ANOTHER
+@end example
+
+@noindent
+If the arguments are to be reordered, however, then the resulting set
+of operands will be emitted and @code{OPTION_CT} gets set to zero.
+For example, the following would be appended to the above:
+
+@example
+ set -- 'operand1' 'operand2' 'operand3'
+ OPTION_CT=0
+@end example
+
+@noindent
+@code{OPTION_CT} is set to zero since it is not necessary to shift
+off any options.
+
+@node main shell-parser
+@subsubsection shell-parser: emit Bourne shell script
+
+This will produce a @code{main()} procedure that emits a shell script
+that will parse the command line options. That script can be emitted
+to @file{stdout} or inserted or substituted into a pre-existing shell
+script file. Improbable markers are used to identify previously inserted
+parsing text:
+
+@example
+# # # # # # # # # # -- do not modify this marker --
+@end example
+
+@noindent
+The program is also pretty insistent upon starting its parsing script
+on the second line.
+
+@node main main
+@subsubsection main: user supplied main procedure
+
+You must supply a value for the @code{main-text} attribute.
+You may also supply a value for
+@vindex option-code
+@code{option-code}. If you do, then the @code{optionProcess} invocation
+will not be emitted into the code. AutoOpts will wrap the @code{main-text}
+inside of:
+
+@example
+int
+main( int argc, char** argv )
+@{
+ @{ // replaced by option-code, if that exists
+ int ct = optionProcess( &<<prog-name>>Options, argc, argv );
+ argc -= ct;
+ argv += ct;
+ @}
+<<your main-text goes here>>
+@}
+@end example
+
+@noindent
+so you can most conveniently set the value with a ``@code{here string}''
+(@pxref{here-string}):
+
+@example
+code = <<- _EndOfMainProc_
+ <<your text goes here>>
+ _EndOfMainProc_;
+@end example
+
+@node main include
+@subsubsection include: code emitted from included template
+
+You must write a template to produce your main procedure.
+You specify the name of the template with the @code{tpl} attribute
+and it will be incorporated at the point where AutoOpts is ready
+to emit the @code{main()} procedure.
+
+This can be very useful if, in your working environment, you have
+many programs with highly similar @code{main()} procedures. All you need
+to do is parameterize the variations and specify which variant is needed
+within the @code{main} AutoOpts specification. Since you are coding
+the template for this, the attributes needed for this variation would
+be dictated by your template.
+
+@node main invoke
+@subsubsection invoke: code emitted from AutoGen macro
+
+You must write a template to produce your main procedure. That template
+must contain a definition for the function specified with the @code{func}
+attribute to this @code{main()} procedure specification. Typically, this
+template will be incorporated by using the @code{--lib-template} option
+(@pxref{autogen lib-template}) in the AutoGen invocation. Otherwise, this
+variation operates in much the same way as ``@code{include}''
+(@pxref{main include}) method.
+
+@node main for-each
+@subsubsection for-each: perform function on each argument
+
+This produces a main procedure that invokes a procedure once for each operand
+on the command line (non-option arguments), @strong{OR} once for each
+non-blank, non-comment @code{stdin} input line. Leading and trailing white
+space is trimmed from the input line and comment lines are lines that are
+empty or begin with a comment character, defaulting to a hash ('#') character.
+
+@strong{NB}:
+The @code{argument} program attribute (@pxref{program attributes})
+must begin with the @code{[} character, to indicate that there are
+command operands, but that they are optional.
+
+There are a number of attributes to @code{main} that may be used:
+
+@table @code
+@item handler-proc
+@vindex handler-proc
+This attribute is required. It is used to name the procedure to call.
+That procedure is presumed to be external, but if you provide the code
+for it, then the procedure is emitted as a static procedure in the
+generated code.
+
+This procedure should return 0 on success, a cumulative error code on warning
+and exit without returning on an unrecoverable error. As the cumulative
+warning codes are @i{or}-ed together, the codes should be some sort of bit
+mask in order to be ultimately decipherable (if you need to do that).
+
+If the called procedure needs to cause a fail-exit, it is expected to call
+@code{exit(3)} directly. If you want to cause a warning exit code, then this
+handler function should return a non-zero status. That value will be
+@strong{OR}-ed into a result integer for computing the final exit code. E.g.,
+here is part of the emitted code:
+
+@example
+ int res = 0;
+ if (argc > 0) @{
+ do @{
+ res |= @i{my_handler}( *(argv++) );
+ @} while (--argc > 0);
+ @} else @{ ...
+@end example
+
+@item handler-type
+@vindex handler-type
+If you do not supply this attribute, your handler procedure must be
+the default type. The profile of the procedure must be:
+
+@example
+int @i{my_handler}( char const *pz_entry );
+@end example
+
+@noindent
+However, if you do supply this attribute, you may set the value to any of
+four alternate flavors:
+
+@table @samp
+@item name-of-file
+This is essentially the same as the default handler type, except that before
+your procedure is invoked, the generated code has verified that the string
+names an existing file. The profile is unchanged.
+
+@item file-X
+Before calling your procedure, the file is f-opened according to the ``X'',
+where ``X'' may be any of the legal modes for @code{fopen(3C)}. In this case,
+the profile for your procedure must be:
+
+@example
+int @i{my_handler}( char const* pz_fname, FILE* entry_fp );
+@end example
+
+@item text-of-file
+@itemx some-text-of-file
+Before calling your procedure, the contents of the file are read or mapped into memory.
+(Excessively large files may cause problems.) The @samp{some-text-of-file}
+disallows empty files. Both require regular files. In this case, the profile
+for your procedure must be:
+
+@example
+program_exit_code_t
+@i{my_handler}(char const* pz_fname, char* file_text,
+ size_t text_size);
+@end example
+
+@noindent
+Note that though the @code{file_text} is not @code{const}, any changes made to
+it are not written back to the original file. It is merely a memory image of
+the file contents. Also, the memory allocated to hold the text is
+@code{text_size + 1} bytes long and the final byte is always @code{NUL}.
+The file contents need not be text, as the data are read with the @code{read(2)}
+system call.
+@end table
+
+If you select one of these file type handlers, then on access or usage errors
+the @code{PROGRAM_EXIT_FAILURE} exit code will, by default, be or-ed
+into the final exit code. This can be changed by specifying the
+global @code{file-fail-code} attribute and naming a different value.
+That is, something other than @code{failure}. You may choose @code{success},
+in which case file access issues will not affect the exit code and the error
+message will not be printed.
+
+@item @i{my_handler}-code
+@vindex MYHANDLER-code
+With this attribute, you provide the code for your handler procedure
+in the option definition file. In this case, your @code{main()}
+procedure specification might look something like this:
+
+@example
+main = @{
+ main-type = for-each;
+ handler-proc = @i{my_handler};
+ @i{my_handler}-code = <<- EndOfMyCode
+ /* whatever you want to do */
+ EndOfMyCode;
+@};
+@end example
+
+@noindent
+and instead of an emitted external reference, a procedure will be emitted
+that looks like this:
+
+@example
+static int
+@i{my_handler}( char const* pz_entry )
+@{
+ int res = 0;
+ <<@i{my_handler}-code goes here>>
+ return res;
+@}
+@end example
+
+@item main-init
+@vindex main-init
+This is code that gets inserted after the options have been processed, but
+before the handler procs get invoked.
+
+@item main-fini
+@vindex main-fini
+This is code that gets inserted after all the entries have been processed,
+just before returning from @code{main()}.
+
+@item comment-char
+@vindex comment-char
+If you wish comment lines to start with a character other than a hash
+(@code{#}) character, then specify one character with this attribute.
+If that character is the @code{NUL} byte, then only blank lines will be
+considered comments.
+@end table
+
+@node option attributes
+@subsection Option Attributes
+@cindex option attributes
+
+For each option you wish to specify, you must have a block macro named
+@code{flag} defined. There are two required attributes: @code{name} and
+@code{descrip}. If any options do not have a @code{value} (traditional flag
+character) attribute, then the @code{long-opts} program attribute must also
+be defined. As a special exception, if no options have a @code{value}
+@strong{and} @code{long-opts} is not defined @strong{and} @code{argument} is
+not defined, then all arguments to the program are named options. In this
+case, the @code{-} and @code{--} command line option markers are optional.
+
+@menu
+* Required Attributes:: Required Attributes
+* Common Attributes:: Common Option Attributes
+* Immediate Action:: Immediate Action Attributes
+* Option Conflict Attributes:: Option Conflict Attributes
+
+These option attributes do not fit well with the above categories.
+
+* opt-attr settable:: Program may set option
+* opt-attr no-preset:: Option cannot be pre-configured
+* opt-attr equivalence:: Option Equivalence Class
+* opt-attr aliases:: Option Aliasing
+* opt-attr default option:: Default Option
+* opt-attr documentation:: Option Sectioning Comment
+* opt-attr translators:: Translator Notes
+@end menu
+
+@node Required Attributes
+@subsubsection Required Attributes
+@cindex Required Attributes
+
+Every option must have exactly one copy of both of these attributes.
+
+@table @samp
+@item name
+@vindex name
+Long name for the option. Even if you are not accepting long options
+and are only accepting flags, it must be provided. AutoOpts generates
+private, named storage that requires this name. This name also causes
+a @code{#define}-d name to be emitted. It must not conflict with any
+other names you may be using in your program.
+
+For example, if your option name is, @code{debug} or @code{munged-up},
+you must not use the @code{#define} names @code{DEBUG} (or
+@code{MUNGED_UP}) in your program for non-AutoOpts related purposes.
+They are now used by AutoOpts.
+
+Sometimes (most especially under Windows), you may get a surprise.
+For example, @code{INTERFACE} is apparently a user space name that
+one should be free to use. Windows usurps this name. To solve this,
+you must do one of the following:
+
+@enumerate
+@item
+Change the name of your option
+@item
+add the program attribute (@pxref{program attributes}):
+
+@example
+export = '#undef INTERFACE';
+@end example
+@item
+add the program attribute:
+
+@example
+guard-option-names;
+@end example
+@end enumerate
+
+@item descrip
+@vindex descrip
+Except for documentation options, a @strong{very} brief description of the
+option. About 40 characters on one line, maximum, not counting any texinfo
+markups. Texinfo markups are stripped before printing in the usage text. It
+appears on the @code{usage()} output next to the option name.
+
+If, however, the option is a documentation option, it will appear on one or
+more lines by itself. It is thus used to visually separate and comment upon
+groups of options in the usage text.
+@end table
+
+@node Common Attributes
+@subsubsection Common Option Attributes
+@cindex Common Option Attributes
+
+These option attributes are optional. Any that do appear in the
+definition of a flag, may appear only once.
+
+@table @samp
+@item value
+@vindex value
+The flag character to specify for traditional option flags, e.g., @code{-L}.
+
+@item max
+@vindex max
+Maximum occurrence count (invalid if @var{disable} present).
+The default maximum is 1. @code{NOLIMIT} can be used for the value,
+otherwise it must be a number or a @code{#define} that evaluates to a number.
+
+@item min
+@vindex min
+Minimum occurrence count. If present, then the option @strong{must}
+appear on the command line. Do not define it with the value zero (0).
+
+@item must-set
+@vindex must-set
+If an option must be specified, but it need not be specified on
+the command line, then specify this attribute for the option.
+
+@item deprecated
+@vindex deprecated
+There are two effects to this attribute: the usage text will not
+show the option, and the generated documentation will mark it with:
+``@emph{NOTE: THIS OPTION IS DEPRECATED}''.
+
+@item disable
+@vindex disable
+Prefix for disabling (inverting sense of) the option. Only useful
+if long option names are being processed. When an option has this
+attribute, the test @code{ENABLED_OPT(OPTNAME)} is false when either
+of the following is true:
+@itemize @bullet
+@item
+The option has not been specified and the @code{enable} attribute has
+not been specified.
+@item
+The option has been specified with this disabling prefix.
+@end itemize
+To detect that the option has been specified with the disabling
+prefix, you must use:
+@example
+HAVE_OPT(OPTNAME) && ! ENABLED_OPT(OPTNAME)
+@end example
+
+@item enable
+@vindex enable
+Long-name prefix for enabling the option (invalid if @var{disable}
+@strong{not} present). Only useful if long option names are being
+processed.
+
+@item enabled
+@vindex enabled
+If default is for option being enabled. (Otherwise, the OPTST_DISABLED
+bit is set at compile time.) Only useful if the option can be disabled.
+
+@item ifdef
+@itemx ifndef
+@itemx omitted-usage
+@vindex ifdef
+@vindex ifndef
+@vindex omitted-usage
+If an option is relevant on certain platforms or when certain features
+are enabled or disabled, you can specify the compile time flag used
+to indicate when the option should be compiled in or out. For example,
+if you have a configurable feature, @code{mumble} that is indicated
+with the compile time define, @code{WITH_MUMBLING}, then add:
+
+@example
+ifdef = WITH_MUMBLING;
+@end example
+
+@noindent
+Take care when using these. There are several caveats:
+
+@itemize @bullet
+@item
+The case and spelling must match whatever is specified.
+@item
+Do not confuse these attributes with the AutoGen directives of the
+same names, @xref{Directives}. These cause C preprocessing directives
+to be inserted into the generated C text.
+@item
+Only one of @code{ifdef} and @code{ifndef} may apply to any one option.
+@item
+The @code{VALUE_OPT_} values are @code{#define}-d. If @code{WITH_MUMBLING}
+is not defined, then the associated @code{VALUE_OPT_} value will not be
+@code{#define}-d either. So, if you have an option named, @code{MUMBLING}
+that is active only if @code{WITH_MUMBLING} is @code{#define}-d, then
+@code{VALUE_OPT_MUMBLING} will be @code{#define}-d iff @code{WITH_MUMBLING}
+is @code{#define}-d. Watch those switch statements.
+@item
+If you specify @code{omitted-usage}, then the option will be recognized
+as disabled when it is configured out of the build, but will yield the
+message, ``This option has been disabled.'' You may specify an alternate
+message by giving @code{omitted-usage} a string value. e.g.:
+@example
+omitted-usage = 'you cannot do this';
+@end example
+@end itemize
+
+@item no-command
+@vindex no-command
+This option specifies that the option is not allowed on the command line.
+Such an option may not take a @code{value} (flag character) attribute.
+The program must have the @code{homerc} (@pxref{program attributes}) option set.
+@end table
+
+@node Immediate Action
+@subsubsection Immediate Action Attributes
+@cindex immediate action
+
+Certain options may need to be processed early. For example, in order to
+suppress the processing of configuration files, it is necessary to process the
+command line option @code{--no-load-opts} @strong{before} the config files are
+processed. To accommodate this, certain options may have their enabled or
+disabled forms marked for immediate processing. The consequence of this is
+that they are processed ahead of all other options in the reverse of normal
+order.
+
+Normally, the first options processed are the options specified in the first
+@code{homerc} file, followed by then next @code{homerc} file through to the
+end of config file processing. Next, environment variables are processed and
+finally, the command line options. The later options override settings
+processed earlier. That actually gives them higher priority. Command line
+immediate action options actually have the lowest priority of all. They would
+be used only if they are to have an effect on the processing of subsequent
+options.
+
+@table @samp
+@item immediate
+@vindex immediate
+Use this option attribute to specify that the enabled form of the option
+is to be processed immediately. The @code{help} and @code{more-help}
+options are so specified. They will also call @code{exit()} upon
+completion, so they @strong{do} have an effect on the processing
+of the remaining options :-).
+
+@item immed-disable
+@vindex immed-disable
+Use this option attribute to specify that the disabled form of the
+option is to be processed immediately. The @code{load-opts} option is
+so specified. The @code{--no-load-opts} command line option will
+suppress the processing of config files and environment variables.
+Contrariwise, the @code{--load-opts} command line option is
+processed normally. That means that the options specified in that file
+will be processed after all the @code{homerc} files and, in fact, after
+options that precede it on the command line.
+
+@item also
+If either the @code{immediate} or the @code{immed-disable} attributes
+are set to the string, ``@code{also}'', then the option will actually be
+processed twice: first at the immediate processing phase and again
+at the ``normal'' time.
+@end table
+
+@node Option Conflict Attributes
+@subsubsection Option Conflict Attributes
+@cindex Option Conflict Attributes
+
+These attributes may be used as many times as you need.
+They are used at the end of the option processing to verify
+that the context within which each option is found does not
+conflict with the presence or absence of other options.
+
+This is not a complete cover of all possible conflicts and
+requirements, but it simple to implement and covers the
+more common situations.
+
+@table @samp
+@cindex flags-must
+@item flags-must
+one entry for every option that @strong{must} be present
+when this option is present
+
+@cindex flags-cant
+@item flags-cant
+one entry for every option that @strong{cannot} be present
+when this option is present
+@end table
+
+@node opt-attr settable
+@subsubsection Program may set option
+@vindex settable
+If the option can be set outside of option processing, specify
+``@code{settable}''. If this attribute is defined, special macros for setting
+this particular option will be inserted into the interface file. For example,
+@code{TEMPL_DIRS} is a settable option for AutoGen, so a macro named
+@code{SET_OPT_TEMPL_DIRS(a)} appears in the interface file. This attribute
+interacts with the @var{documentation} attribute.
+
+@node opt-attr no-preset
+@subsubsection Option cannot be pre-configured
+@vindex no-preset
+@cindex configuration file
+If presetting this option is not allowed, specify ``@code{no-preset}''.
+(Thus, environment variables and values set in configuration files will be
+ignored.)
+
+@node opt-attr equivalence
+@subsubsection Option Equivalence Class
+@vindex equivalence
+Generally, when several options are mutually exclusive and basically serve the
+purpose of selecting one of several processing modes, specify the
+``@code{equivalence}'' attribute. These options will be considered an
+equivalence class. Sometimes, it is just easier to deal with them as such.
+All members of the equivalence class must contain the same equivalenced-to
+option, including the equivalenced-to option itself. Thus, it must be a class
+member.
+
+For an option equivalence class, there is a single occurrence counter for
+the class. It can be referenced with the interface macro,
+@code{COUNT_OPT(BASE_OPTION)}, where ``BASE_OPTION'' is the equivalenced-to
+option name.
+
+Also, please take careful note: since the options are mapped to the
+equivalenced-to option descriptor, any option argument values are mapped to
+that descriptor also. Be sure you know which ``equivalent option'' was
+selected before getting an option argument value!
+
+During the presetting phase of option processing (@pxref{Presetting
+Options}), equivalenced options may be specified. However, if different
+equivalenced members are specified, only the last instance will be
+recognized and the others will be discarded. A conflict error is indicated
+only when multiple different members appear on the command line itself.
+
+As an example of where equivalenced options might be useful, @code{cpio(1)}
+has three options @code{-o}, @code{-i}, and @code{-p} that define the
+operational mode of the program (@code{create}, @code{extract} and
+@code{pass-through}, respectively). They form an equivalence class from
+which one and only one member must appear on the command line. If
+@code{cpio} were an AutoOpt-ed program, then each of these option
+definitions would contain:
+
+@example
+equivalence = create;
+@end example
+
+and the program would be able to determine the operating mode
+with code that worked something like this:
+
+@example
+switch (WHICH_IDX_CREATE) @{
+case INDEX_OPT_CREATE: ...
+case INDEX_OPT_EXTRACT: ...
+case INDEX_OPT_PASS_THROUGH: ...
+default: /* cannot happen */
+@}
+@end example
+
+@node opt-attr aliases
+@subsubsection Option Aliasing
+
+Sometimes, for backwards compatibility or tradition or just plain convenience,
+it works better to define one option as a pure alias for another option.
+For such situations, provide the following pieces of information:
+@example
+flag = @{
+ name = @i{aliasing-option-name};
+ value = @i{aliasing-flag-char}; // optional !
+ aliases = @i{aliased-to-option};
+@};
+@end example
+Do not provide anything else. The usage text for such an option will be:
+@example
+ This is an alias for @i{aliased-to-option}
+@end example
+
+@node opt-attr default option
+@subsubsection Default Option
+@vindex default
+If your program processes its arguments in named option mode (See
+@code{long-opts} in @ref{program attributes}), then you may select
+@strong{one} of your options to be the default option. Do so by using
+attribute @code{default} with one of the options. The option so specified
+must have an @code{arg-type} (@pxref{Option Arguments}) specified, but not the
+@code{arg-optional} (@pxref{arg-optional}) attribute. That is to say, the
+option argument must be required.
+
+If you have done this, then any arguments that do not match an option name and
+do not contain an equal sign (@code{=}) will be interpreted as an option
+argument to the default option.
+
+@node opt-attr documentation
+@subsubsection Option Sectioning Comment
+This attribute means the option exists for the purpose of separating option
+description text in the usage output and texi documentation. Without this
+attribute, every option is a separate node in the texi docs. With this
+attribute, the documentation options become texi doc nodes and the options are
+collected under them. Choose the name attribute carefully because it will
+appear in the texi documentation.
+
+Libraries may also choose to make it settable so that the library can
+determine which command line option is the first one that pertains to the
+library.
+
+@vindex documentation
+If the @samp{documentation} attribute is present, then all other
+attributes are disabled except @code{settable}, @code{call-proc} and
+@code{flag-code}. @code{settable} must be and is only specified if
+@code{call-proc}, @code{extract-code} or @code{flag-code} has been specified.
+When present, the @code{descrip} attribute will be displayed only when the
+@code{--help} option has been specified. It will be displayed flush to the
+left hand margin and may consist of one or more lines of text, filled to 72
+columns.
+
+The name of the option will not be printed in the help text. It @i{will},
+however, be printed as section headers in the texi documentation. If the
+attribute is given a non-empty value, this text will be reproduced in the man
+page and texi doc immediately after the @code{descrip} text.
+
+@node opt-attr translators
+@subsubsection Translator Notes
+@vindex translators
+If you need to give the translators a special note about a particular option,
+please use the ``@code{translators}'' attribute. The attribute text will be
+emitted into the generated @code{.c} text where the option related strings get
+defined. To make a general comment about all of the option code, add comments
+to an @code{include} attribute (@pxref{program attributes}). Do @strong{not}
+use this attribute globally, or it will get emitted into every option
+definition block.
+
+@node Option Arguments
+@subsection Option Argument Specification
+@cindex Option Arguments
+
+Command line options come in three flavors: options that do not
+take arguments, those that do and those that may. Without an
+"arg-type" attribute, AutoOpts will not process an argument to an
+option. If "arg-type" is specified and "arg-optional" is also
+specified, then the next command line token will be taken to
+be an argument, unless it looks like the name of another option.
+
+If the argument type is specified to be anything other than "str[ing]", then
+AutoOpts will specify a callback procedure to handle the argument. Some of
+these procedures will be created and inserted into the generated @code{.c}
+file, and others are already built into the @file{libopts} library.
+Therefore, if you write your own callback procedure
+(@pxref{Option Argument Handling}), then you must either not specify an
+"arg-type" attribute, or else specify it to be of type "str[ing]". Your
+callback function will be able to place its own restrictions on what that
+string may contain or represent.
+
+Option argument handling attributes depend upon the value set for the
+@vindex arg-type
+@code{arg-type} attribute. It specifies the type of argument the option
+will take. If not present, the option cannot take an argument. If present,
+it must be an entry in the following table. The first three letters is
+sufficient.
+
+@menu
+* arg-type string:: Arg Type String
+* arg-type number:: Arg Type Number
+* arg-type boolean:: Arg Type Boolean
+* arg-type keyword:: Arg Type Keyword
+* arg-type set membership:: Arg Type Set Membership
+* arg-type hierarchy:: Arg Type Hierarchical
+* arg-type file name:: Arg Type File Name
+* arg-type time-duration:: Arg Type Time Duration
+* arg-type time-date:: Arg Type Time and Date
+
+Supporting attributes for particular argument types:
+
+* arg-keyword:: Keyword list
+* arg-optional:: Option Argument Optional
+* arg-default:: Default Option Argument Value
+@end menu
+
+@node arg-type string
+@subsubsection Arg Type String
+@code{arg-type = string;}
+
+The argument may be any arbitrary string, though your program or option
+callback procedure may place additional constraints upon it.
+
+
+@node arg-type number
+@subsubsection Arg Type Number
+@code{arg-type = number;}
+
+The argument must be a correctly formed integer, without any trailing U's or
+L's. AutoOpts contains a library procedure to convert the string to a number.
+If you specify range checking with @code{arg-range} (see below), then AutoOpts
+produces a special purpose procedure for this option.
+
+@table @samp
+@item scaled
+@vindex scaled
+@code{scaled} marks the option so that suffixes of @samp{k}, @samp{K},
+@samp{m}, @samp{M}, @samp{g}, @samp{G}, @samp{t}, and @samp{T} will multiply
+the given number by a power of 1000 or 1024. Lower case letters scale by a
+power of 1000 and upper case scale by a power of 1024.
+
+@item arg-range
+@vindex arg-range
+@code{arg-range} is used to create a callback procedure for validating the
+range of the option argument. It must match one of the range entries. Each
+@code{arg-range} should consist of either an integer by itself or an integer
+range. The integer range is specified by one or two integers separated by the
+two character sequence, @code{->}. Be sure to quote the entire range string.
+The definitions parser will not accept the range syntax as a single string
+token.
+
+The generated procedure imposes the range constraints as follows:
+@itemize @bullet
+@item
+A number by itself will match that one value.
+@item
+The high end of the range may not be @code{INT_MIN}, both for obvious
+reasons and because that value is used to indicate a single-valued match.
+@item
+An omitted lower value implies a lower bound of INT_MIN.
+@item
+An omitted upper value implies a upper bound of INT_MAX.
+@item
+The argument value is required. It may not be optional.
+@item
+The value must match one of the entries. If it can match more than one,
+then you have redundancies, but no harm will come of it.
+@end itemize
+@end table
+
+
+@node arg-type boolean
+@subsubsection Arg Type Boolean
+@code{arg-type = boolean;}
+
+The argument will be interpreted and always yield either AG_TRUE or
+AG_FALSE. False values are@: the empty string, the number zero, or a
+string that starts with @code{f}, @code{F}, @code{n} or @code{N}
+(representing False or No). Anything else will be interpreted as True.
+
+
+@node arg-type keyword
+@subsubsection Arg Type Keyword
+@code{arg-type = keyword;}
+
+The argument must match a specified list of strings (@pxref{arg-keyword}).
+Assuming you have named the option, @code{optn-name}, the strings will be
+converted into an enumeration of type @code{te_Optn_Name} with the values
+@code{OPTN_NAME_KEYWORD}.* If you have @strong{not} specified a default value,
+the value @code{OPTN_NAME_UNDEFINED} will be inserted with the value zero.
+The option will be initialized to that value. You may now use this in your
+code as follows:
+
+@example
+te_Optn_Name opt = OPT_VALUE_OPTN_NAME;
+switch (opt) @{
+case OPTN_NAME_UNDEFINED: /* undefined things */ break;
+case OPTN_NAME_KEYWORD: /* `keyword' things */ break;
+default: /* utterly impossible */ ;
+@}
+@end example
+
+AutoOpts produces a special purpose procedure for this option.
+You may not specify an alternate handling procedure.
+
+If you have need for the string name of the selected keyword, you
+may obtain this with the macro, @code{OPT_OPTN_NAME_VAL2STR(val)}.
+The value you pass would normally be @code{OPT_VALUE_OPTN_NAME},
+but anything with numeric value that is legal for @code{te_Optn_Name}
+may be passed. Anything out of range will result in the string,
+@code{"*INVALID*"} being returned. The strings are read only.
+It may be used as in:
+
+@example
+te_Optn_Name opt = OPT_VALUE_OPTN_NAME;
+printf( "you selected the %s keyword\n",
+ OPT_OPTN_NAME_VAL2STR(opt) );
+@end example
+
+* Note: you may replace the @code{OPTN_NAME} enumeration prefix with
+another prefix by specifying a
+@vindex prefix-enum
+@code{prefix-enum} attribute.
+
+Finally, users may specify the argument either by name or by number.
+Since the numeric equivalents change by having new entries inserted
+into the keyword list, this would not be a recommended practice.
+However, either @code{-1} or @code{~0} will always be equivalent to
+specifying the last keyword.
+
+@node arg-type set membership
+@subsubsection Arg Type Set Membership
+@code{arg-type = set;}
+
+The argument must be a list of names each of which must match the strings
+"@code{all}", "@code{none}" or one of the keywords (@pxref{arg-keyword})
+specified for this option. @code{all} will turn on all membership bits and
+@code{none} will turn them all off. Specifying one of the keywords will turn
+on the corresponding set membership bit. Literal numbers may also be used and
+may, thereby, set or clear more than one bit. Preceding a keyword or literal
+number with a bang (@code{!} - exclamation point) will turn the bit(s) off.
+The number of keywords allowed is constrained by the number of bits in a
+pointer, as the bit set is kept in a @code{void*}.
+
+If, for example, you specified @code{first} in your list of keywords,
+then you can use the following code to test to see if either @code{first}
+or @code{all} was specified:
+
+@example
+uintptr_t opt = OPT_VALUE_OPTN_NAME;
+if (opt & OPTN_NAME_FIRST)
+ /* OPTN_NAME_FIRST bit was set */ ;
+@end example
+
+AutoOpts produces a special purpose procedure for this option.
+To set multiple bits as the default (initial) value, you must
+specify an initial numeric value (which might become inaccurate over
+time), or else specify @code{arg-default} multiple times. Do not
+specify a series of names conjoined with @code{+} symbols as the
+value for any of the @code{arg-default} attributes. That works for
+option parsing, but not for the option code generation.
+
+@node arg-type hierarchy
+@subsubsection Arg Type Hierarchical
+@code{arg-type = hierarchy;}
+@*
+@code{arg-type = nested;}
+
+This denotes an option with a structure-valued argument, a.k.a.
+``subopts'' in @code{getopts} terminology. The argument is parsed
+and the values made available to the program via the find and
+find next calls (@xref{libopts-optionFindValue},
+@xref{libopts-optionGetValue}, and
+@pxref{libopts-optionFindNextValue}).
+
+@example
+tOptionValue * val = optionGetValue(VALUE_OPT_OPTN_NAME, "name");
+while (val != NULL) @{
+ process(val);
+ val = optionNextValue(VALUE_OPT_OPTN_NAME, val);
+ if (wrong_name(val, "name"))
+ break;
+@}
+@end example
+
+
+@node arg-type file name
+@subsubsection Arg Type File Name
+@code{arg-type = file;}
+
+This argument type will have some validations on the argument and,
+optionally, actually open the file. You must specify several additonal
+attributes for the option:
+
+@table @samp
+@item file-exists
+@vindex file-exists
+If not specified or empty, then the directory portion of the name is checked.
+The directory must exist or the argument is rejected and the usage procedure
+is invoked.
+
+Otherwise, both the directory as above and the full name is tested for
+existence. If the value begins with the two letters ``no'', then the file
+must not pre-exist. Otherwise, the file is expected to exist.
+
+@item open-file
+@vindex open-file
+If not specified or empty, the file is left alone.
+If the value begins with the four letters ``desc''[@i{riptor}], then
+@code{open(2)} is used and @code{optArg.argFd} is set. Otherwise, the
+file is opened with @code{fopen} and @code{optArg.argFp} is set.
+
+@item file-mode
+@vindex file-mode
+If ``open-file'' is set and not empty, then you must specify the open mode.
+Set the value to the flag bits or mode string as appropriate for the open
+type.
+@end table
+
+
+@node arg-type time-duration
+@subsubsection Arg Type Time Duration
+@code{arg-type = time-duration;}
+
+The argument will be converted into a number of seconds. It may be
+a multi-part number with different parts being multiplied into a seconds
+value and added into the final result. Valid forms are in the table
+below. Upper cased letters represent numbers that must be used in the
+expressions.
+
+@table @samp
+@item [[HH:]MM:]SS
+@code{HH} is multiplied by @code{3600} and @code{MM} multiplied by @code{60}
+before they are added to @code{SS}. This time specification may not be
+followed by any other time specs. @code{HH} and @code{MM} are both optional,
+though @code{HH} cannot be specified without @code{MM}.
+
+@item DAYS d
+@code{DAYS} is multiplied by the number of seconds in a day. This value may
+be followed by (and added to) values specified by @code{HH:MM:SS} or the
+suffixed values below. If present, it must always be first.
+
+@item HRS h
+@code{HRS} is multiplied by the number of seconds in an hour. This value may
+be followed by (and added to) values specified by @code{MM:SS} or the
+suffixed values below.
+
+@item MINS m
+@code{MINS} is multiplied by the number of seconds in a minute. This value may
+be followed by (and added to) a count of seconds.
+
+@item SECS s
+This value can only be the last value in a time specification. The @code{s}
+suffix is optional.
+@end table
+
+@example
+ 5 d 1:10:05 ==> 5 days + 1 hour 10 minutes and 5 seconds
+ 5 d 1 h 10 m 5 ==> yields: 436205 seconds
+ 5d1h10m5s ==> same result -- spaces are optional.
+@end example
+
+When saved into a config file, the value will be stored as a simple count
+of seconds. There are actually more (many) accepted time duration strings.
+The full documentation can be found with ISO-8601 documentation and the
+more extedded documentation when ``parse_duration()'' becomes more widely
+available.
+
+
+@node arg-type time-date
+@subsubsection Arg Type Time and Date
+@code{arg-type = time-date;}
+
+The argument will be converted into the number of seconds since the epoch.
+The conversion rules are very complicated, please see the @file{getdate_r(3GNU)}
+man page. There are some additional restrictions:
+
+@enumerate
+@item
+Your project must be compiled with @code{PKGDATADIR} defined and naming a
+valid directory.
+@item
+The @code{DATEMSK} environment variable will be set to the @file{datemsk} file
+within that directory.
+@end enumerate
+
+If that file is not accessible for any reason, the string will be
+parsed as a time duration (@pxref{arg-type time-duration}) instead of a
+specific date and time.
+
+@node arg-keyword
+@subsubsection Keyword list
+@vindex keyword
+If the @code{arg-type} is @code{keyword} (@pxref{arg-type keyword}) or
+@code{set-membership} (@pxref{arg-type set membership}), then you must specify
+the list of keywords by a series of @code{keyword} entries. The interface
+file will contain values for @code{@i{<OPTN_NAME>}_@i{<KEYWORD>}} for each
+keyword entry. @code{keyword} option types will have an enumeration and
+@code{set-membership} option types will have a set of unsigned bits
+@code{#define}-d.
+
+If the @code{arg-type} is specifically @code{keyword}, you may also add
+special handling code with a
+@vindex extra-code
+@code{extra-code} attribute. After @code{optionEnumerationVal} has
+converted the input string into an enumeration, you may insert code to
+process this enumeration value (@code{pOptDesc->optArg.argEnum}).
+
+@node arg-optional
+@subsubsection Option Argument Optional
+@vindex arg-optional
+This attribute indicates that the user does not have to supply an argument for
+the option. This is only valid if the @var{arg-type} is @code{string}
+(@pxref{arg-type string}) or @code{keyword} (@pxref{arg-type keyword}). If it
+is @code{keyword}, then this attribute may also specify the default keyword to
+assume when the argument is not supplied. If left empty, @var{arg-default}
+(@pxref{arg-default}) or the zero-valued keyword will be used.
+
+This is overridden and the options are required if the libopts library
+gets configured with @code{--disable-optional-args}.
+
+@node arg-default
+@subsubsection Default Option Argument Value
+@vindex arg-default
+This specifies the default option argument value to be used when the option is
+not specified or preset. You may specify multiple @code{arg-default} values if
+the argument type is @code{set membership}.
+
+@node Option Argument Handling
+@subsection Option Argument Handling
+@cindex Option Argument Handling
+
+AutoOpts will either specify or automatically generate callback procedures
+for options that take specialized arguments. The only option argument types
+that are not specialized are plain string arguments and no argument at all.
+For options that fall into one of those two categories, you may specify your
+own callback function, as specified below. If you do this and if you
+specify that options are resettable (@pxref{automatic options}), then your
+option handling code @strong{must} look for the @samp{OPTST_RESET} bit in
+the @code{fOptState} field of the option descriptor.
+
+If the option takes a string argument, then you may specify that the option
+is to be handled by the @code{libopts} library procedures
+@code{stackOptArg()} or @code{unstackOptArg()} (see below). In this case,
+you may not provide option handling code.
+
+Finally, @samp{documentation} options (@pxref{opt-attr documentation}) may
+also be marked as @option{settable} (@pxref{opt-attr settable}) and have
+special callback functions (either @samp{flag-code}, @samp{extract-code},
+or @samp{call-proc}).
+
+@table @samp
+@item flag-code
+@vindex flag-code
+statements to execute when the option is encountered. This may be used in
+conjunction with option argument types that cause AutoOpts to emit handler
+code. If you do this, the @samp{flag-code} with index zero (0) is emitted
+into the handler code @emph{before} the argument is handled, and the entry
+with index one (1) is handled afterward.
+
+The generated procedure will be laid out something like this:
+
+@example
+static void
+doOpt<name>(tOptions* pOptions, tOptDesc* pOptDesc)
+@{
+<flag-code[0]>
+<AutoOpts defined handler code>
+<flag-code[1]>
+@}
+@end example
+
+Only certain fields within the @code{tOptions} and @code{tOptDesc}
+structures may be accessed. @xref{Option Processing Data}. When writing
+this code, you must be very careful with the @code{pOptions} pointer. The
+handler code is called with this pointer set to special values for handling
+special situations. Your code must handle them. As an example,
+look at @code{optionEnumerationVal} in @file{enum.c}.
+
+@item extract-code
+@vindex extract-code
+This is effectively identical to @code{flag-code}, except that the
+source is kept in the output file instead of the definitions file
+and you cannot use this in conjunction with options with arguments,
+other than string arguments.
+
+A long comment is used to demarcate the code. You must not modify
+that marker. @i{Before} regenerating the option code file,
+the old file is renamed from MUMBLE.c to MUMBLE.c.save. The template
+will be looking there for the text to copy into the new output file.
+
+@item call-proc
+@vindex call-proc
+external procedure to call when option is encountered. The calling
+sequence must conform to the sequence defined above for the generated
+procedure, @code{doOpt<name>}. It has the same restrictions
+regarding the fields within the structures passed in as arguments.
+@xref{Option Processing Data}.
+
+@item flag-proc
+@vindex flag-proc
+Name of another option whose @code{flag-code} can be executed
+when this option is encountered.
+
+@item stack-arg
+@vindex stack-arg
+Call a special library routine to stack the option's arguments. Special
+macros in the interface file are provided for determining how many of the
+options were found (@code{STACKCT_OPT(NAME)}) and to obtain a pointer to a
+list of pointers to the argument values (@code{STACKLST_OPT(NAME)}).
+Obviously, for a stackable argument, the @code{max} attribute
+(@pxref{Common Attributes}) needs to be set higher than @code{1}.
+
+If this stacked argument option has a disablement prefix, then the entire
+stack of arguments will be cleared by specifying the option with that
+disablement prefix.
+
+@item unstack-arg
+@vindex unstack-arg
+Call a special library routine to remove (``unstack'') strings
+from a @code{stack-arg} option stack. This attribute must name
+the option that is to be ``unstacked''. Neither this option nor
+the stacked argument option it references may be equivalenced to
+another option.
+@end table
+
+@node Internationalizing Options
+@subsection Internationalizing Options
+@cindex Internationalizing Options
+
+Normally, AutoOpts produces usage text that is difficult to translate. It is
+pieced together on the fly using words and phrases scattered around here and
+there, piecing together toe document. This does not translate well.
+
+Incorporated into this package are some ways around the problem. First, you
+should specify the @code{full-usage} and @code{short-usage} program attributes
+(@pxref{program attributes}). This will enable your translators to translate
+the usage text as a whole.
+
+Your translators will also be able to translate long option names. The option
+name translations will then become the names searched for both on the command
+line and in configuration files. However, it will not affect the names of
+environment variable names used to configure your program.
+
+If it is considered desireable to keep configuration files in the ``C''
+locale, then several macros are available to suppress or delay the
+translations of option names at run time. These are all disabled if
+@code{ENABLE_NLS} is not defined at compile time or if @code{no-xlate} has
+been set to the value @emph{anything}. These macros @strong{must}
+be invoked before the first invocation of @code{optionProcess}.
+
+@table @samp
+@item OPT_NO_XLAT_CFG_NAMES;
+@itemx OPT_XLAT_CFG_NAMES;
+Disable (or enable) the translations of option names for configuration files.
+If you enable translation for config files, then they will be translated for
+command line options.
+
+@item OPT_NO_XLAT_OPT_NAMES;
+@itemx OPT_XLAT_OPT_NAMES;
+Disable (or enable) the translations of option names for command line
+processing. If you disable the translation for command line processing,
+you will also disable it for configuration file processing. Once translated,
+the option names will remain translated.
+@end table
+
+@node documentation attributes
+@subsection Man and Info doc Attributes
+@cindex documentation attributes
+
+AutoOpts includes AutoGen templates for producing abbreviated man pages
+and for producing the invoking section of an info document. To take
+advantage of these templates, you must add several attributes to your
+option definitions.
+
+@table @samp
+@item arg-name
+@vindex arg-name
+If an option has an argument, the argument should have a name for
+documentation purposes. It will default to @code{arg-type}, but
+it will likely be clearer with something else like, @code{file-name}
+instead of @code{string} (the type).
+
+@item doc
+@vindex doc
+First, every @code{flag} definition @emph{other than} ``documentation''
+definitions, must have a @code{doc} attribute defined. If the option takes
+an argument, then it will need an @code{arg-name} attribute as well. The
+@code{doc} text should be in plain sentences with minimal formatting. The
+Texinfo commands @code{@@code}, and @code{@@var} will have its enclosed text
+made into @strong{\fB} entries in the man page, and the @code{@@file} text
+will be made into @strong{\fI} entries. The @code{arg-name} attribute is
+used to display the option's argument in the man page.
+
+Options marked with the ``documentation'' attribute are for documenting
+the usage text. All other options should have the ``doc'' attribute in
+order to document the usage of the option in the generated man pages.
+
+@item option-info
+@vindex option-info
+This text will be inserted as a lead-in paragraph in the @code{OPTIONS}
+section of the generated man page.
+
+@item doc-section
+@vindex doc-section
+This is a compound attribute that requires three @i{sub}attributes:
+@table @i
+@item ds-type
+This describes the section type. Basically, the title of the section
+that will be added to all output documentation. There may be only one
+@code{doc-section} for any given @code{ds-type}. If there are duplicates,
+the results are undefined (it might work, it might not).
+
+There are five categories of @code{ds-type} sections.
+They are those that the documentation templates would otherwise:
+@enumerate
+@item
+always create itself, ignoring any @code{ds-type}s by this name.
+These are marked, below, as @code{ao-only}.
+@item
+create, if none have been provided.
+These are marked, @code{alternate}.
+@item
+create, but augment if the @code{doc-section} was provided.
+These are marked, @code{augments}.
+@item
+do nothing, but inserts them into the output in a prescribed order.
+These are marked, @code{known}
+@item
+knows nothing about them. They will be alphabetized and inserted
+after the list of leading sections and before the list of trailing
+sections. These are not marked because I don't know their names.
+@end enumerate
+
+Some of these are emitted by the documentation templates only if
+certain conditions are met. If there are conditions, they are
+explained below. If there are no conditions, then you will always
+see the named section in the output.
+
+The output sections will appear in this order:
+@table @samp
+@item NAME
+@code{ao-only}.
+@item SYNOPSIS
+@code{alternate}.
+@item DESCRIPTION
+@code{augments}.
+@item OPTIONS
+@code{ao-only}.
+@item OPTION PRESETS
+@code{ao-only}, if environment presets or configuration file processing
+has been specified.
+@item unknown
+At this point, the unknown, alphabetized sections are inserted.
+@item IMPLEMENTATION NOTES
+@code{known}
+@item ENVIRONMENT
+@code{augments}, if environment presets have been specified.
+@item FILES
+@code{augments}, if configuration file processing has been specified.
+@item EXAMPLES
+@code{known}
+@item EXIT STATUS
+@code{augments}.
+@item ERRORS
+@code{known}
+@item COMPATIBILITY
+@code{known}
+@item SEE ALSO
+@code{known}
+@item CONFORMING TO
+@code{known}
+@item HISTORY
+@code{known}
+@item AUTHORS
+@code{alternate}, if the @code{copyright} stanza has either
+an @code{author} or an @code{owner} attribute.
+@item COPYRIGHT
+@code{alternate}, if there is a @code{copyright} stanza.
+@item BUGS
+@code{augments}, if the @code{copyright} stanza has an
+@code{eaddr} attribute.
+@item NOTES
+@code{augments}.
+@end table
+
+@item ds-format
+This describes the format of the associated @code{ds-text} section.
+@code{man}, @code{mdoc} and @code{texi} formats are supported.
+Regardless of the chosen format, the formatting tags in the output
+text will be converted to @code{man} macros for @code{man} pages,
+@code{mdoc} macros for @code{mdoc} pages, and @code{texi} macros for
+@code{texinfo} pages.
+@item ds-text
+This is the descriptive text, written according to the rules for
+@code{ds-format} documents.
+@end table
+
+Here is an example of a ``doc-section'' for a ``SEE ALSO'' type.
+
+@example
+doc-section = @{
+ ds-type = 'SEE ALSO'; // or anything else
+ ds-format = 'man'; // or texi or mdoc format
+ ds-text = <<-_EOText_
+ text relevant to this section type,
+ in the chosen format
+ _EOText_;
+@};
+@end example
+
+@item prog-man-descrip
+@itemx prog-info-descrip
+@vindex prog-man-descrip
+@vindex prog-info-descrip
+These attributes are now deprecated.
+Please use a @code{doc-section} stanza with a @code{ds-type}
+attribute set to @code{DESCRIPTION} instead.
+
+@item detail
+@vindex detail
+This attribute is used to add a very short explanation about what
+a program is used for when the ``title'' attribute is insufficient.
+If there is no ``doc-section'' stanza of type ``DESCRIPTION'', then
+this text is used for the man page DESCRIPTION section, too.
+@end table
+
+@node automatic options
+@subsection Automatically Supported Options
+@cindex automatic options
+
+AutoOpts provides automated support for several options. @code{help} and
+@code{more-help} are always provided. The others are conditional upon
+various global program attributes being defined @xref{program attributes}.
+
+Below are the option names and default flag values. The flags are activated
+if and only if at least one user-defined option also uses a flag value. The
+long names are supported as option names if @code{long-opts} has been
+specified. These option flags may be deleted or changed to characters of your
+choosing by specifying
+@vindex more-help-value
+@vindex usage-value
+@vindex version-value
+@vindex load-opts-value
+@vindex reset-value
+@code{xxx-value = "y";}, where @code{xxx} is one of the
+option names below and @code{y} is either empty or the character of your choice.
+For example, to change the help flag from @code{?} to @code{h}, specify
+@vindex help-value
+@code{help-value = "h";}; and to require that @code{save-opts} be specified
+only with its long option name, specify
+@vindex save-opts-value
+@code{save-opts-value = "";}.
+
+Additionally, the procedure that prints out the program version may be
+replaced by specifying @code{version-proc}.
+@vindex version-proc
+This procedure must be defined to be of external scope (non-static).
+By default, the AutoOpts library provides @code{optionPrintVersion}
+and it will be the specified callback function in the option
+definition structure.
+
+With the exception of the @code{load-opts} option, none of these automatically
+supported options will be recognized in configuration files or environment
+variables.
+
+@table @samp
+@item help -?
+This option will immediately invoke the @code{USAGE()} procedure
+and display the usage line, a description of each option with
+its description and option usage information. This is followed
+by the contents of the definition of the @code{detail} text macro.
+
+@item more-help -!
+This option is identical to the @code{help} option, except that the
+output is passed through a pager program. (@code{more} by default, or
+the program identified by the @code{PAGER} environment variable.)
+
+@item usage -u
+This option must be requested by specifying, @code{usage-opt} in the option
+definition file. It will produce abbreviated help text to @file{stdout} and
+exit with zero status (@code{EXIT_SUCCESS}).
+
+@item version -v
+This will print the program name, title and version. If it is followed by
+the letter @code{c} and a value for @code{copyright} and @code{owner} have
+been provided, then the copyright will be printed, too. If it is followed
+by the letter @code{n}, then the full copyright notice (if available) will
+be printed. The @code{version} attribute must be specified in the option
+definition file.
+
+@item load-opts -<
+@cindex configuration file
+This option will load options from the named file. They will be treated
+exactly as if they were loaded from the normally found configuration files,
+but will not be loaded until the option is actually processed. This can also
+be used within another configuration file, causing them to nest. This is the
+@strong{only} automatically supported option that can be activated inside of
+config files or with environment variables.
+
+Specifying the negated form of the option (@code{--no-load-opts}) will
+suppress the processing of configuration files and environment variables.
+
+This option is activated by specifying one or more @code{homerc} attributes.
+
+@item save-opts ->
+@cindex configuration file
+This option will cause the option state to be printed in the configuration file
+format when option processing is done but not yet verified for consistency.
+The program will terminate successfully without running when this has
+completed. Note that for most shells you will have to quote or escape the
+flag character to restrict special meanings to the shell.
+
+The output file will be the configuration file name (default or provided by
+@code{rcfile}) in the last directory named in a @code{homerc} definition.
+
+This option may be set from within your program by invoking the
+"@code{SET_OPT_SAVE_OPTS(@i{filename})}" macro (@pxref{SET_OPT_name}).
+Invoking this macro will set the file name for saving the option processing
+state, but the state will @strong{not} actually be saved. You must call
+@code{optionSaveFile} to do that (@pxref{libopts-optionSaveFile}).
+@strong{CAVEAT:} if, after invoking this macro, you call
+@code{optionProcess}, the option processing state will be saved to this file
+and @code{optionProcess} will not return. You may wish to invoke
+@code{CLEAR_OPT( SAVE_OPTS )} (@pxref{CLEAR_OPT}) beforehand if you do need
+to reinvoke @code{optionProcess}.
+
+This option is activated by specifying one or more @code{homerc} attributes.
+
+@item reset-option -R
+This option takes the name of an option for the current program and resets its
+state such that it is set back to its original, compile-time initialized
+value. If the option state is subsequently stored (via @code{--save-opts}),
+the named option will not appear in that file.
+
+This option is activated by specifying the @code{resettable} attribute.
+
+@strong{BEWARE}: If the @code{resettable} attribute is specified, all
+option callbacks @strong{must} look for the @code{OPTST_RESET} bit in the
+@code{fOptState} field of the option descriptor. If set, the @code{optCookie}
+and @code{optArg} fields will be unchanged from their last setting. When the
+callback returns, these fields will be set to their original values. If you
+use this feature and you have allocated data hanging off of the cookie, you
+need to deallocate it.
+@end table
+
+@node standard options
+@subsection Library of Standard Options
+@cindex standard options
+
+AutoOpts has developed a set of standardized options.
+You may incorporate these options in your program simply by @emph{first}
+adding a @code{#define} for the options you want, and then the line,
+
+@example
+#include stdoptions.def
+@end example
+
+@noindent
+in your option definitions. The supported options are specified thus:
+
+@example
+#define DEBUG
+#define DIRECTORY
+#define DRY_RUN
+#define INPUT
+#define INTERACTIVE
+#define OUTPUT
+#define WARN
+
+#define SILENT
+#define QUIET
+#define BRIEF
+#define VERBOSE
+@end example
+
+By default, only the long form of the option will be available.
+To specify the short (flag) form, suffix these names with @code{_FLAG}.
+e.g.,
+
+@example
+#define DEBUG_FLAG
+@end example
+
+@code{--silent}, @code{--quiet}, @code{--brief} and @code{--verbose} are
+related in that they all indicate some level of diagnostic output.
+These options are all designed to conflict with each other.
+Instead of four different options, however, several levels can be
+incorporated by @code{#define}-ing @code{VERBOSE_ENUM}. In conjunction
+with @code{VERBOSE}, it incorporates the notion of @i{5} levels in an
+enumeration: @code{silent}, @code{quiet}, @code{brief},
+@code{informative} and @code{verbose}; with the default being
+@code{brief}.
+
+@ignore
+END == AUTOOPTS-MAIN == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@ignore
+START == AUTOOPTS-API == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node AutoOpts API
+@section Programmatic Interface
+@cindex AutoOpts API
+
+The user interface for access to the argument information is completely
+defined in the generated header file and in the portions of the
+distributed file "options.h" that are marked "public".
+
+In the following macros, text marked @code{<NAME>} or @code{name}
+is the name of the option @strong{in upper case} and @strong{segmented
+with underscores @code{_}}. The macros and enumerations defined in the
+options header (interface) file are used as follows:
+
+To see how these @code{#define} macros are used in a program,
+the reader is referred to the several @file{opts.h} files
+included with the AutoGen sources.
+
+@menu
+* Option Processing Data:: Data for Option Processing
+* CLEAR_OPT:: CLEAR_OPT( <NAME> ) - Clear Option Markings
+* COUNT_OPT:: COUNT_OPT( <NAME> ) - Definition Count
+* DESC:: DESC( <NAME> ) - Option Descriptor
+* DISABLE_OPT_name:: DISABLE_OPT_name - Disable an option
+* ENABLED_OPT:: ENABLED_OPT( <NAME> ) - Is Option Enabled?
+* ERRSKIP_OPTERR:: ERRSKIP_OPTERR - Ignore Option Errors
+* ERRSTOP_OPTERR:: ERRSTOP_OPTERR - Stop on Errors
+* HAVE_OPT:: HAVE_OPT( <NAME> ) - Have this option?
+* ISSEL_OPT:: ISSEL_OPT( <NAME> ) - Is Option Selected?
+* ISUNUSED_OPT:: ISUNUSED_OPT( <NAME> ) - Never Specified?
+* OPTION_CT:: OPTION_CT - Full Count of Options
+* OPT_ARG:: OPT_ARG( <NAME> ) - Option Argument String
+* OPT_NO_XLAT_CFG_NAMES:: OPT_NO_XLAT_CFG_NAMES - option name xlation
+* OPT_NO_XLAT_OPT_NAMES:: OPT_NO_XLAT_OPT_NAMES - option name xlation
+* OPT_VALUE_name:: OPT_VALUE_name - Option Argument Value
+* OPT_XLAT_CFG_NAMES:: OPT_XLAT_CFG_NAMES - option name xlation
+* OPT_XLAT_OPT_NAMES:: OPT_XLAT_OPT_NAMES - option name xlation
+* RESTART_OPT:: RESTART_OPT( n ) - Resume Option Processing
+* SET_OPT_name:: SET_OPT_name - Force an option to be set
+* STACKCT_OPT:: STACKCT_OPT( <NAME> ) - Stacked Arg Count
+* STACKLST_OPT:: STACKLST_OPT( <NAME> ) - Argument Stack
+* START_OPT:: START_OPT - Restart Option Processing
+* STATE_OPT:: STATE_OPT( <NAME> ) - Option State
+* USAGE:: USAGE( exit-code ) - Usage invocation macro
+* VALUE_OPT_name:: VALUE_OPT_name - Option Flag Value
+* VERSION:: VERSION - Version and Full Version
+* WHICH_IDX_name:: WHICH_IDX_name - Which Equivalenced Index
+* WHICH_OPT_name:: WHICH_OPT_name - Which Equivalenced Option
+* teOptIndex:: teOptIndex - Option Index and Enumeration
+* OPTIONS_STRUCT_VERSION:: OPTIONS_STRUCT_VERSION - active version
+* libopts procedures:: libopts External Procedures
+@end menu
+
+@node Option Processing Data
+@subsection Data for Option Processing
+@cindex Option Processing Data
+
+This section describes the data that may be accessed from within the
+option processing callback routines. The following fields may be used
+in the following ways and may be used for read only. The first set is
+addressed from the @code{tOptDesc*} pointer:
+
+@table @samp
+@cindex optIndex
+@item optIndex
+@cindex optValue
+@item optValue
+These may be used by option procedures to determine which option they
+are working on (in case they handle several options).
+
+@cindex optActualIndex
+@item optActualIndex
+@cindex optActualValue
+@item optActualValue
+These may be used by option procedures to determine which option was
+used to set the current option. This may be different from the above if
+the options are members of an equivalence class.
+
+@cindex optOccCt
+@item optOccCt
+If AutoOpts is processing command line arguments, then this value will
+contain the current occurrence count. During the option preset phase
+(reading configuration files and examining environment variables), the value is
+zero.
+
+@cindex fOptState
+@item fOptState
+The field may be tested for the following bit values
+(prefix each name with @code{OPTST_}, e.g. @code{OPTST_INIT}):
+
+@table @samp
+@item INIT
+Initial compiled value. As a bit test, it will always yield FALSE.
+
+@item SET
+The option was set via the @code{SET_OPT()} macro.
+
+@item PRESET
+@cindex configuration file
+The option was set via a configuration file.
+
+@item DEFINED
+The option was set via a command line option.
+
+@item SET_MASK
+This is a mask of flags that show the set state, one of the
+above four values.
+
+@item EQUIVALENCE
+This bit is set when the option was selected by an equivalenced option.
+
+@item DISABLED
+This bit is set if the option is to be disabled.
+(Meaning it was a long option prefixed by the disablement prefix, or
+the option has not been specified yet and initializes as @code{disabled}.)
+@end table
+
+As an example of how this might be used, in AutoGen I want to allow
+template writers to specify that the template output can be left
+in a writable or read-only state. To support this, there is a Guile
+function named @code{set-writable} (@pxref{SCM set-writable}).
+Also, I provide for command options @code{--writable} and
+@code{--not-writable}. I give precedence to command line and RC
+file options, thus:
+
+@example
+switch (STATE_OPT( WRITABLE )) @{
+case OPTST_DEFINED:
+case OPTST_PRESET:
+ fprintf(stderr, zOverrideWarn, pCurTemplate->pzFileName,
+ pCurMacro->lineNo);
+ break;
+
+default:
+ if (gh_boolean_p( set ) && (set == SCM_BOOL_F))
+ CLEAR_OPT( WRITABLE );
+ else
+ SET_OPT_WRITABLE;
+@}
+@end example
+
+@cindex pzLastArg
+@item pzLastArg
+Pointer to the latest argument string. BEWARE@: If the argument type
+is numeric, an enumeration or a bit mask, then this will be the
+argument @strong{value} and not a pointer to a string.
+@end table
+
+The following two fields are addressed from the @code{tOptions*} pointer:
+
+@table @samp
+@cindex pzProgName
+@item pzProgName
+Points to a NUL-terminated string containing the current program
+name, as retrieved from the argument vector.
+
+@cindex pzProgPath
+@item pzProgPath
+Points to a NUL-terminated string containing the full path of
+the current program, as retrieved from the argument vector.
+(If available on your system.)
+
+@end table
+
+Note@: these fields get filled in during the first call to
+@code{optionProcess()}. All other fields are private, for the exclusive
+use of AutoOpts code and are subject to change.
+
+@node CLEAR_OPT
+@subsection CLEAR_OPT( <NAME> ) - Clear Option Markings
+@findex CLEAR_OPT
+
+Make as if the option had never been specified.
+@code{HAVE_OPT(<NAME>)} will yield @code{FALSE}
+after invoking this macro.
+
+@node COUNT_OPT
+@subsection COUNT_OPT( <NAME> ) - Definition Count
+@findex COUNT_OPT
+
+This macro will tell you how many times the option was
+specified on the command line. It does not include counts
+of preset options.
+
+@example
+if (COUNT_OPT( NAME ) != desired-count) @{
+ make-an-undesirable-message.
+@}
+@end example
+
+@node DESC
+@subsection DESC( <NAME> ) - Option Descriptor
+@findex DESC
+
+This macro is used internally by other AutoOpt macros.
+It is not for general use. It is used to obtain the option description
+corresponding to its @strong{UPPER CASED} option name argument.
+This is primarily used in other macro definitions.
+
+@node DISABLE_OPT_name
+@subsection DISABLE_OPT_name - Disable an option
+@findex DISABLE_OPT_name
+
+This macro is emitted if it is both settable
+and it can be disabled. If it cannot be disabled, it may
+always be CLEAR-ed (see above).
+
+The form of the macro will actually depend on whether the
+option is equivalenced to another, and/or has an assigned
+handler procedure. Unlike the @code{SET_OPT} macro,
+this macro does not allow an option argument.
+
+@example
+DISABLE_OPT_NAME;
+@end example
+
+@node ENABLED_OPT
+@subsection ENABLED_OPT( <NAME> ) - Is Option Enabled?
+@findex ENABLED_OPT
+
+Yields true if the option defaults to disabled and
+@code{ISUNUSED_OPT()} would yield true. It also yields true if
+the option has been specified with a disablement prefix,
+disablement value or the @code{DISABLE_OPT_NAME} macro was invoked.
+
+@node ERRSKIP_OPTERR
+@subsection ERRSKIP_OPTERR - Ignore Option Errors
+@findex ERRSKIP_OPTERR
+
+When it is necessary to continue (return to caller)
+on option errors, invoke this option. It is reversible.
+@xref{ERRSTOP_OPTERR}.
+
+@node ERRSTOP_OPTERR
+@subsection ERRSTOP_OPTERR - Stop on Errors
+@findex ERRSTOP_OPTERR
+
+After invoking this macro, if @code{optionProcess()}
+encounters an error, it will call @code{exit(1)} rather than return.
+This is the default processing mode. It can be overridden by
+specifying @code{allow-errors} in the definitions file,
+or invoking the macro @xref{ERRSKIP_OPTERR}.
+
+@node HAVE_OPT
+@subsection HAVE_OPT( <NAME> ) - Have this option?
+@findex HAVE_OPT
+
+This macro yields true if the option has been specified
+in any fashion at all. It is used thus:
+
+@example
+if (HAVE_OPT( NAME )) @{
+ <do-things-associated-with-opt-name>;
+@}
+@end example
+
+@node ISSEL_OPT
+@subsection ISSEL_OPT( <NAME> ) - Is Option Selected?
+@findex ISSEL_OPT
+
+This macro yields true if the option has been
+specified either on the command line or via a SET/DISABLE macro.
+
+@node ISUNUSED_OPT
+@subsection ISUNUSED_OPT( <NAME> ) - Never Specified?
+@findex ISUNUSED_OPT
+
+This macro yields true if the option has
+never been specified, or has been cleared via the
+@code{CLEAR_OPT()} macro.
+
+@node OPTION_CT
+@subsection OPTION_CT - Full Count of Options
+@findex OPTION_CT
+
+The full count of all options, both those defined
+and those generated automatically by AutoOpts. This is primarily
+used to initialize the program option descriptor structure.
+
+@node OPT_ARG
+@subsection OPT_ARG( <NAME> ) - Option Argument String
+@findex OPT_ARG
+
+The option argument value as a pointer to string. Note that argument
+values that have been specified as numbers are stored as numbers or
+keywords. For such options, use instead the @code{OPT_VALUE_name}
+define. It is used thus:
+
+@example
+if (HAVE_OPT( NAME )) @{
+ char* p = OPT_ARG( NAME );
+ <do-things-with-opt-name-argument-string>;
+@}
+@end example
+
+@node OPT_NO_XLAT_CFG_NAMES
+@subsection OPT_NO_XLAT_CFG_NAMES - option name xlation
+@findex OPT_NO_XLAT_CFG_NAMES
+
+Invoking this macro will disable the translation of option names only while
+processing configuration files and environment variables. This must be
+invoked before the first call to @code{optionProcess}.. You need not invoke
+this if your option definition file contains the attribute assignment,
+``@code{no-xlate = opt-cfg;}''.
+
+@node OPT_NO_XLAT_OPT_NAMES
+@subsection OPT_NO_XLAT_OPT_NAMES - option name xlation
+@findex OPT_NO_XLAT_OPT_NAMES
+
+Invoking this macro will completely disable the translation of option names.
+This must be invoked before the first call to @code{optionProcess}. You need
+not invoke this if your option definition file contains the attribute
+assignment, ``@code{no-xlate = opt;}''.
+
+@node OPT_VALUE_name
+@subsection OPT_VALUE_name - Option Argument Value
+@findex OPT_VALUE_name
+
+This macro gets emitted only for options that take numeric, keyword or set
+membership arguments. The macro yields a word-sized integer containing the
+enumeration, bit set or numeric value for the option argument.
+
+@example
+int opt_val = OPT_VALUE_name;
+@end example
+
+@node OPT_XLAT_CFG_NAMES
+@subsection OPT_XLAT_CFG_NAMES - option name xlation
+@findex OPT_XLAT_CFG_NAMES
+
+If @code{ENABLE_NLS} is defined and @code{no-xlate} has been not set to the
+value @emph{anything}, this macro will cause the translation of option names
+to happen before starting the processing of configuration files and
+environment variables. This will change the recognition of options within the
+@code{$PROGRAMNAME} environment variable, but will not alter the names used
+for setting options via @code{$PROGRAMNAME_name} environment variables.
+
+This must be invoked before the first call to @code{optionProcess}. You might
+need to use this macro if your option definition file contains the attribute
+assignment, ``@code{no-xlate = opt;}'' or ``@code{no-xlate = opt-cfg;}'', and
+you have determined in some way that you wish to override that.
+
+@node OPT_XLAT_OPT_NAMES
+@subsection OPT_XLAT_OPT_NAMES - option name xlation
+@findex OPT_XLAT_OPT_NAMES
+
+If @code{ENABLE_NLS} is defined and @code{no-xlate} has been not set to the
+value @emph{anything}, translate the option names before processing the
+command line options. Long option names may thus be localized. (If the names
+were translated before configuration processing, they will not be
+re-translated.)
+
+This must be invoked before the first call to @code{optionProcess}. You might
+need to use this macro if your option definition file contains the attribute
+assignment, ``@code{no-xlate = opt;}'' and you have determined in some way that
+you wish to override that.
+
+@node RESTART_OPT
+@subsection RESTART_OPT( n ) - Resume Option Processing
+@findex RESTART_OPT
+
+If option processing has stopped (either because of an error
+or something was encountered that looked like a program argument),
+it can be resumed by providing this macro with the index @code{n}
+of the next option to process and calling @code{optionProcess()} again.
+
+@node SET_OPT_name
+@subsection SET_OPT_name - Force an option to be set
+@findex SET_OPT_name
+
+This macro gets emitted only when the given
+option has the @code{settable} attribute specified.
+
+The form of the macro will actually depend on whether the option is
+equivalenced to another, has an option argument and/or has an assigned
+handler procedure. If the option has an argument, then this macro will
+too. Beware that the argument is not reallocated, so the value must not
+be on the stack or deallocated in any other way for as long as the value
+might get referenced.
+
+If you have supplied at least one @file{homerc} file
+(@pxref{program attributes}), this macro will be emitted for the
+@code{--save-opts} option.
+
+@example
+SET_OPT_SAVE_OPTS( "filename" );
+@end example
+
+@noindent
+@xref{automatic options}, for a discussion of the implications of using
+this particular example.
+
+@node STACKCT_OPT
+@subsection STACKCT_OPT( <NAME> ) - Stacked Arg Count
+@findex STACKCT_OPT
+
+When the option handling attribute is specified
+as @code{stack_arg}, this macro may be used to determine how
+many of them actually got stacked.
+
+Do not use this on options that have not been stacked or has not been
+specified (the @code{stack_arg} attribute must have been specified,
+and @code{HAVE_OPT(<NAME>)} must yield TRUE).
+Otherwise, you will likely seg fault.
+
+@example
+if (HAVE_OPT( NAME )) @{
+ int ct = STACKCT_OPT( NAME );
+ char** pp = STACKLST_OPT( NAME );
+
+ do @{
+ char* p = *pp++;
+ do-things-with-p;
+ @} while (--ct > 0);
+@}
+@end example
+
+@node STACKLST_OPT
+@subsection STACKLST_OPT( <NAME> ) - Argument Stack
+@findex STACKLST_OPT
+
+The address of the list of pointers to the
+option arguments. The pointers are ordered by the order in
+which they were encountered in the option presets and
+command line processing.
+
+Do not use this on options that have not been stacked or has not been
+specified (the @code{stack_arg} attribute must have been specified,
+and @code{HAVE_OPT(<OPTION>)} must yield TRUE).
+Otherwise, you will likely seg fault.
+
+@example
+if (HAVE_OPT( NAME )) @{
+ int ct = STACKCT_OPT( NAME );
+ char** pp = STACKLST_OPT( NAME );
+
+ do @{
+ char* p = *pp++;
+ do-things-with-p;
+ @} while (--ct > 0);
+@}
+@end example
+
+@node START_OPT
+@subsection START_OPT - Restart Option Processing
+@findex START_OPT
+
+This is just a shortcut for RESTART_OPT(1) (@xref{RESTART_OPT}.)
+
+@node STATE_OPT
+@subsection STATE_OPT( <NAME> ) - Option State
+@findex STATE_OPT
+
+If you need to know if an option was set because of presetting actions
+(configuration file processing or environment variables), versus a command
+line entry versus one of the SET/DISABLE macros, then use this macro. It
+will yield one of four values: @code{OPTST_INIT}, @code{OPTST_SET},
+@code{OPTST_PRESET} or @code{OPTST_DEFINED}. It is used thus:
+
+@example
+switch (STATE_OPT( NAME )) @{
+ case OPTST_INIT:
+ not-preset, set or on the command line. (unless CLEAR-ed)
+
+ case OPTST_SET:
+ option set via the SET_OPT_NAME() macro.
+
+ case OPTST_PRESET:
+ option set via an configuration file or environment variable
+
+ case OPTST_DEFINED:
+ option set via a command line option.
+
+ default:
+ cannot happen :)
+@}
+@end example
+
+@node USAGE
+@subsection USAGE( exit-code ) - Usage invocation macro
+@findex USAGE
+
+This macro invokes the procedure registered to display
+the usage text. Normally, this will be @code{optionUsage} from the
+AutoOpts library, but you may select another procedure by specifying
+@code{usage = "proc_name"} program attribute. This procedure must
+take two arguments@: first, a pointer to the option descriptor, and
+second the exit code. The macro supplies the option descriptor
+automatically. This routine is expected to call @code{exit(3)} with
+the provided exit code.
+
+The @code{optionUsage} routine also behaves differently depending
+on the exit code:
+
+@table @code
+@item EXIT_SUCCESS (the value zero)
+It is assumed that full usage help has been requested. Consequently, more
+information is provided than when displaying usage and exiting with a
+non-zero exit code. Output will be sent to @file{stdout} and the program will
+exit with a zero status code.
+
+@item EX_USAGE (64)
+The abbreviated usage will be printed to @file{stdout} and the program will
+exit with a zero status code. ``EX_USAGE'' may or may not be 64. If your
+system provides ``/usr/include/sysexits.h'' that has a different value,
+then that value will be used.
+
+@item any other value
+The abbreviated usage will be printed to stderr and the program will
+exit with the provided status code.
+@end table
+
+@node VALUE_OPT_name
+@subsection VALUE_OPT_name - Option Flag Value
+@findex VALUE_OPT_name
+
+This is a #define for the flag character used to
+specify an option on the command line. If @code{value} was not
+specified for the option, then it is a unique number associated
+with the option. @code{option value} refers to this value,
+@code{option argument} refers to the (optional) argument to the
+option.
+
+@example
+switch (WHICH_OPT_OTHER_OPT) @{
+case VALUE_OPT_NAME:
+ this-option-was-really-opt-name;
+case VALUE_OPT_OTHER_OPT:
+ this-option-was-really-other-opt;
+@}
+@end example
+
+@node VERSION
+@subsection VERSION - Version and Full Version
+@findex VERSION
+
+If the @code{version} attribute is defined for the program,
+then a stringified version will be #defined as PROGRAM_VERSION and
+PROGRAM_FULL_VERSION. PROGRAM_FULL_VERSION is used for printing
+the program version in response to the version option. The version
+option is automatically supplied in response to this attribute, too.
+
+You may access PROGRAM_VERSION via @code{programOptions.pzFullVersion}.
+
+@node WHICH_IDX_name
+@subsection WHICH_IDX_name - Which Equivalenced Index
+@findex WHICH_IDX_name
+
+This macro gets emitted only for equivalenced-to options. It is used to
+obtain the index for the one of the several equivalence class members
+set the equivalenced-to option.
+
+@example
+switch (WHICH_IDX_OTHER_OPT) @{
+case INDEX_OPT_NAME:
+ this-option-was-really-opt-name;
+case INDEX_OPT_OTHER_OPT:
+ this-option-was-really-other-opt;
+@}
+@end example
+
+@node WHICH_OPT_name
+@subsection WHICH_OPT_name - Which Equivalenced Option
+@findex WHICH_OPT_name
+
+This macro gets emitted only for equivalenced-to options. It is used to
+obtain the value code for the one of the several equivalence class members
+set the equivalenced-to option.
+
+@example
+switch (WHICH_OPT_OTHER_OPT) @{
+case VALUE_OPT_NAME:
+ this-option-was-really-opt-name;
+case VALUE_OPT_OTHER_OPT:
+ this-option-was-really-other-opt;
+@}
+@end example
+
+@node teOptIndex
+@subsection teOptIndex - Option Index and Enumeration
+@findex teOptIndex
+
+This enum defines the complete set of options, both
+user specified and automatically provided. This can be used,
+for example, to distinguish which of the equivalenced options
+was actually used.
+
+@example
+switch (pOptDesc->optActualIndex) @{
+case INDEX_OPT_FIRST:
+ stuff;
+case INDEX_OPT_DIFFERENT:
+ different-stuff;
+default:
+ unknown-things;
+@}
+@end example
+
+@node OPTIONS_STRUCT_VERSION
+@subsection OPTIONS_STRUCT_VERSION - active version
+
+You will not actually need to reference this value, but you need to be
+aware that it is there. It is the first value in the option descriptor
+that you pass to @code{optionProcess}. It contains a magic number and
+version information. Normally, you should be able to work with a more
+recent option library than the one you compiled with. However, if the
+library is changed incompatibly, then the library will detect the out of
+date magic marker, explain the difficulty and exit. You will then need
+to rebuild and recompile your option definitions. This has rarely been
+necessary.
+
+@ignore
+END == AUTOOPTS-API == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@ignore
+START == AUTOOPTS-DATA == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node Multi-Threading
+@section Multi-Threading
+
+AutoOpts was designed to configure a program for running. This generally
+happens before much real work has been started. Consequently, it is
+expected to be run before multi-threaded applications have started multiple
+threads. However, this is not always the case. Some applications may
+need to reset and reload their running configuration, and some may use
+@code{SET_OPT_xxx()} macros during processing. If you need to dynamically
+change your option configuration in your multi-threaded application, it is
+your responsibility to prevent all threads from accessing the option
+configuration state, except the one altering the configuration.
+
+The various accessor macros (@code{HAVE_OPT()}, etc.) do not modify state
+and are safe to use in a multi-threaded application. It is safe as long
+as no other thread is concurrently modifying state, of course.
+
+@c === SECTION MARKER
+
+@node option descriptor
+@section Option Descriptor File
+@cindex option descriptor
+
+This is the module that is to be compiled and linked with your program.
+It contains internal data and procedures subject to change. Basically,
+it contains a single global data structure containing all the
+information provided in the option definitions, plus a number of static
+strings and any callout procedures that are specified or required. You
+should never have need for looking at this, except, perhaps, to examine
+the code generated for implementing the @code{flag-code} construct.
+
+@c === SECTION MARKER
+
+@node Using AutoOpts
+@section Using AutoOpts
+@cindex using AutoOpts
+
+There are actually several levels of ``using'' autoopts.
+Which you choose depends upon how you plan to distribute
+(or not) your application.
+
+@menu
+* local use:: local-only use
+* binary not installed:: binary distro, AutoOpts not installed
+* binary pre-installed:: binary distro, AutoOpts pre-installed
+* source pre-installed:: source distro, AutoOpts pre-installed
+* source not installed:: source distro, AutoOpts not installed
+@end menu
+
+@node local use
+@subsection local-only use
+
+To use AutoOpts in your application where you do not have to
+worry about distribution issues, your issues are simple and few.
+
+@itemize @bullet
+@item
+Create a file @samp{myopts.def}, according to the documentation above.
+It is probably easiest to start with the example in @ref{Quick Start}
+and edit it into the form you need.
+
+@item
+Run AutoGen to create the option interface file (@code{myopts.h})
+and the option descriptor code (@code{myopts.c}):
+
+@example
+autogen myopts.def
+@end example
+
+@item
+In all your source files where you need to refer to option state,
+@code{#include "myopts.h"}.
+@item
+In your main routine, code something along the lines of:
+
+@example
+#define ARGC_MIN some-lower-limit
+#define ARGC_MAX some-upper-limit
+main( int argc, char** argv )
+@{
+ @{
+ int arg_ct = optionProcess( &myprogOptions, argc, argv );
+ argc -= arg_ct;
+ if ((argc < ARGC_MIN) || (argc > ARGC_MAX)) @{
+ fprintf( stderr, "%s ERROR: remaining args (%d) "
+ "out of range\n", myprogOptions.pzProgName,
+ argc );
+
+ USAGE( EXIT_FAILURE );
+ @}
+ argv += arg_ct;
+ @}
+ if (HAVE_OPT(OPTN_NAME))
+ respond_to_optn_name();
+ ...
+@}
+@end example
+
+@item
+Compile @samp{myopts.c} and link your program
+with the following additional arguments:
+
+@example
+`autoopts-config cflags ldflags` myopts.c
+@end example
+@end itemize
+
+@node binary not installed
+@subsection binary distro, AutoOpts not installed
+
+If you will be distributing (or copying) your project to a system that
+does not have AutoOpts installed, you will need to statically link the
+AutoOpts library, ``libopts'' into your program. Get the link information
+with ``@code{static-libs}'' instead of ``@code{ldflags}'':
+
+@example
+`autoopts-config static-libs`
+@end example
+
+@node binary pre-installed
+@subsection binary distro, AutoOpts pre-installed
+
+If you will be distributing (or copying) your project to a system that does
+have AutoOpts (or only ``libopts'') installed, you will still need to ensure
+that the library is findable at program load time, or you will still have to
+statically link. The former can be accomplished by linking your project with
+@code{--rpath} or by setting the @code{LD_LIBRARY_PATH} appropriately.
+Otherwise, @xref{binary not installed}.
+
+@node source pre-installed
+@subsection source distro, AutoOpts pre-installed
+
+If you will be distributing your project to a system that will build
+your product but it may not be pre-installed with AutoOpts, you will
+need to do some configuration checking before you start the build.
+Assuming you are willing to fail the build if AutoOpts has not been
+installed, you will still need to do a little work.
+
+AutoOpts is distributed with a configuration check M4 script,
+@file{autoopts.m4}. It will add an @code{autoconf} macro named,
+@code{AG_PATH_AUTOOPTS}. Add this to your @file{configure.ac} script
+and use the following substitution values:
+
+@table @code
+@item AUTOGEN
+the name of the autogen executable
+@item AUTOGEN_TPLIB
+the directory where AutoGen template library is stored
+@item AUTOOPTS_CFLAGS
+the compile time options needed to find the AutoOpts headers
+@item AUTOOPTS_LIBS
+the link options required to access the @code{libopts} library
+@end table
+
+@node source not installed
+@subsection source distro, AutoOpts not installed
+
+If you will be distributing your project to a system that will build
+your product but it may not be pre-installed with AutoOpts, you may
+wish to incorporate the sources for @code{libopts} in your project.
+To do this, I recommend reading the tear-off libopts library
+@file{README} that you can find in the @file{pkg/libopts} directory.
+You can also examine an example package (blocksort) that incorporates
+this tear off library in the autogen distribution directory. There is
+also a web page that describes what you need to do:
+@example
+@url{http://autogen.sourceforge.net/blocksort.html}
+@end example
+
+Alternatively, you can pull the @code{libopts} library sources into
+a build directory and build it for installation along with your package.
+This can be done approximately as follows:
+@example
+tar -xzvf `autoopts-config libsrc`
+cd libopts-*
+./bootstrap
+configure
+make
+make install
+@end example
+That will install the library, but not the headers or anything else.
+
+@c === SECTION MARKER
+
+@node Presetting Options
+@section Configuring your program
+@cindex shell options
+
+AutoOpts supports the notion of ``presetting'' the value or state of an option.
+The values may be obtained either from environment variables or from
+configuration files (@file{rc} or @file{ini} files). In order to take
+advantage of this, the AutoOpts client program must specify these features
+in the option descriptor file (@pxref{program attributes}) with the
+@code{rcfile} or @code{environrc} attributes.
+
+@menu
+* loading rcfile:: configuration file presets
+* saving rcfile:: Saving the presets into a configuration file
+* sample rcfile:: Creating a sample configuration file
+* environrc:: environment variable presets
+* config example:: Config file only example
+@end menu
+
+It is also possible to configure your program @i{without} using
+the command line option parsing code. This is done by using
+only the following four functions from the @file{libopts} library:
+
+@table @samp
+@item configFileLoad
+(@pxref{libopts-configFileLoad}) will parse the contents of a config
+file and return a pointer to a structure representing the hierarchical
+value. The values are sorted alphabetically by the value name and all
+entries with the same name will retain their original order.
+Insertion sort is used.
+
+@item optionGetValue
+(@pxref{libopts-optionGetValue}) will find the first value within the
+hierarchy with a name that matches the name passed in.
+
+@item optionNextValue
+(@pxref{libopts-optionNextValue}) will return the next value that
+follows the value passed in as an argument. If you wish to get all
+the values for a particular name, you must take note when the name
+changes.
+
+@item optionUnloadNested
+(@pxref{libopts-optionUnloadNested}). The pointer passed in must be
+of type, @code{OPARG_TYPE_HIERARCHY} (see the autoopts/options.h
+header file). @code{configFileLoad} will return a @code{tOptionValue}
+pointer of that type. This function will release all the associated
+memory. @code{AutoOpts} generated code uses this function for its own
+needs. Client code should only call this function with pointers
+gotten from @code{configFileLoad}.
+@end table
+
+@node loading rcfile
+@subsection configuration file presets
+@cindex rcfile
+
+Configuration files are enabled by specifying the program attribute
+@code{homerc} (@pxref{program attributes}). Any option not marked
+with the ``no-preset'' attribute may appear in a configuration file.
+The files loaded are selected both by the @code{homerc} entries and,
+optionally, via a command line option. The first component of the
+@code{homerc} entry may be an environment variable such as @code{$HOME}, or
+it may also be @code{$$} (@strong{two} dollar sign characters) to specify
+the directory of the executable. For example:
+
+@example
+homerc = "$$/../share/autogen";
+@end example
+
+@noindent
+will cause the AutoOpts library to look in the normal autogen datadir
+relative to the current installation directory for autogen.
+
+The configuration files are processed in the order they are specified by
+the @code{homerc} attribute, so that each new file will normally override
+the settings of the previous files. This may be overridden by marking some
+options for @code{immediate action} (@pxref{Immediate Action}). Any such
+options are acted upon in @strong{reverse} order. The disabled
+@code{load-opts} (@code{--no-load-opts}) option, for example, is an
+immediate action option. Its presence in the last @code{homerc} file will
+prevent the processing of any prior @code{homerc} files because its effect
+is immediate.
+
+Configuration file processing can be completely suppressed by specifying
+@code{--no-load-opts} on the command line, or @code{PROGRAM_LOAD_OPTS=no} in
+the environment (if @code{environrc} has been specified).
+
+See the ``Configuration File Format'' section (@pxref{Config File Format})
+for details on the format of the file.
+
+@node saving rcfile
+@subsection Saving the presets into a configuration file
+
+When configuration files are enabled for an application, the user is
+also provided with an automatically supplied @code{--save-opts} option.
+All of the known option state will be written to either the specified
+output file or, if it is not specified, then to the last specified
+@code{homerc} file.
+
+@node sample rcfile
+@subsection Creating a sample configuration file
+@cindex sample rcfile
+
+AutoOpts is shipped with a template named, @file{rc-sample.tpl}.
+If your option definition file specifies the @code{homerc} attribute,
+then you may invoke @file{autogen} thus:
+
+@example
+autogen -Trc-sample <your-option-def-file>
+@end example
+
+This will, by default, produce a sample file named,
+@file{sample-<prog-name>rc}. It will be named differently if you specify your
+configuration (rc) file name with the @code{rcfile} attribute. In that case,
+the output file will be named, @file{sample-<rcfile-name>}. It will contain
+all of the program options not marked as @code{no-preset}. It will also
+include the text from the @code{doc} attribute.
+
+@ignore
+END == AUTOOPTS-DATA == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@ignore
+START == AO-DATA1 == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@node environrc
+@subsection environment variable presets
+@cindex environrc
+
+If the AutoOpts client program specifies @code{environrc} in its
+option descriptor file, then environment variables will be used for
+presetting option state. Variables will be looked for that are named,
+@code{PROGRAM_OPTNAME} and @code{PROGRAM}. @code{PROGRAM} is the
+upper cased @code{C-name} of the program, and @code{OPTNAME} is the
+upper cased @code{C-name} of a specific option. (The @code{C-name}s
+are the regular names with all special characters converted to
+underscores (@code{_}).)
+
+Option specific environment variables are processed after (and thus
+take precedence over) the contents of the @code{PROGRAM} environment
+variable. The option argument string for these options takes on the
+string value gotten from the environment. Consequently, you can only
+have one instance of the @code{OPTNAME}.
+
+If a particular option may be disabled, then its disabled state is
+indicated by setting the @code{PROGRAM_OPTNAME} value to the
+disablement prefix. So, for example, if the disablement prefix were
+@code{dont}, then you can disable the @code{optname} option by setting
+the @code{PROGRAM_OPTNAME}' environment variable to `@i{dont}'.
+@xref{Common Attributes}.
+
+The @code{PROGRAM} environment string is tokenized and parsed much
+like a command line. Doubly quoted strings have backslash escapes
+processed the same way they are processed in C program constant
+strings. Singly quoted strings are ``pretty raw'' in that backslashes are
+honored before other backslashes, apostrophes, newlines and cr/newline
+pairs. The options must be introduced with hyphens in the same way as
+the command line.
+
+Note that not all options may be preset. Options that are specified with the
+@code{no-preset} attribute and the @code{--help}, @code{--more-help},
+and @code{--save-opts} auto-supported options may not be preset.
+
+@node config example
+@subsection Config file only example
+@cindex rcfile
+@cindex Configuration File
+@cindex Configuration File example
+
+If for some reason it is difficult or unworkable to integrate configuration
+file processing with command line option parsing, the @code{libopts}
+(@pxref{libopts procedures}) library can still be used to process configuration
+files. Below is a ``@t{Hello, World!}'' greeting program that tries
+to load a configuration file @file{hello.conf} to see if it should use
+an alternate greeting or to personalize the salutation.
+@ignore
+END == AO-DATA1 == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@ignore
+START == AO-DATA2 == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node Config File Format
+@section Configuration File Format
+@cindex Configuration File
+
+The configuration file is designed to associate names and values, much like
+an AutoGen Definition File (@pxref{Definitions File}). Unfortunately, the
+file formats are different. Specifically, AutoGen Definitions provide for
+simpler methods for the precise control of a value string and provides for
+dynamically computed content. Configuration files have some established
+traditions in their layout. So, they are different, even though they do
+both allow for a single name to be associated with multiple values and they
+both allow for hierarchical values.
+
+@menu
+* config name/string-value:: assigning a string value to a configurable
+* config integer-values:: integer values
+* config nested-values:: hierarchical values
+* config directives:: configuration file directives
+* config comments:: comments in the configuration file
+@end menu
+
+@node config name/string-value
+@subsection assigning a string value to a configurable
+
+The basic syntax is a name followed by a value on a single line. They are
+separated from each other by either white space, a colon (@code{:}) or an
+equal sign (@code{=}). The colon or equal sign may optionally be surrounded
+by additional white space. If more than one value line is needed, a
+backslash (@code{\}) may be used to continue the value. The backslash (but
+not the newline) will be erased. Leading and trailing white space is always
+stripped from the value.
+
+Fundamentally, it looks like this:
+
+@example
+name value for that name
+name = another \
+ multi-line value \
+ for that name.
+name: a *third* value for ``name''
+@end example
+
+If you need more control over the content of the value, you may enclose the
+value in XML style brackets:
+@example
+<name>value </name>
+@end example
+@noindent
+Within these brackets you need not (must not) continue the value data with
+backslashes. You may also select the string formation rules to use, just
+add the attribute after the name, thus: @code{<name keep>}.
+
+@table @samp
+@item keep
+This mode will keep all text between the brackets and not strip any
+white space.
+@item uncooked
+This mode strips leading and trailing white space, but not do any
+quote processing. This is the default and need not be specified.
+@item cooked
+The text is trimmed of leading and trailing white space and XML encodings
+are processed. These encodings are slightly expanded over the XML
+specification. They are specified with an ampersand followed by a value
+name or numeric value and then a semicolon:
+
+@table @samp
+@item amp
+@itemx lt
+@itemx gt
+@itemx quot
+@itemx apos
+@itemx #dd
+@itemx #xHH
+
+These are all per fairly standad HTML and/or XML encodings.
+Additionally:
+
+@item bs
+The ASCII back space character.
+@item ff
+The ASCII form feed character.
+@item ht
+The ASCII horizontal (normal) tab character.
+@item cr
+The ASCII carriage return character.
+@item vt
+The ASCII vertical tab character.
+@item bel
+The ASCII alarm bell character.
+@item nl
+The ASCII new line character.
+@item space
+The ASCII space character. Normally not necessary, but if you want
+to preserve leading or trailing space characters, then use this.
+@end table
+@end table
+
+And here is an example of an XML-styled value:
+
+@example
+<name cooked>
+ This is&nl;&ht;another multi-line
+&ht;string example.
+</name>
+@end example
+
+The string value associated with ``name'' will be exactly the text enclosed
+in quotes with the encoded characters ``cooked'' as you would expect
+(three text lines with the last line not ending with a newline, but
+ending with a period).
+
+@node config integer-values
+@subsection integer values
+
+A name can be specified as having an integer value. To do this, you
+must use the XML-ish format and specify a ``type'' attribute for
+the name:
+
+@example
+<name type=integer> 1234 </name>
+@end example
+
+Boolean, enumeration and set membership types will be added as time
+allows. ``type=string'' is also supported, but also is the default.
+
+@node config nested-values
+@subsection hierarchical values
+
+In order to specify a hierarchical value, you *must* use XML-styled
+formatting, specifying a type that is shorter and easier to spell:
+
+@example
+<structured-name type=nested>
+ [[....]]
+</structured-name>
+@end example
+
+@noindent
+The ellipsis may be filled with any legal configuration file name/value
+assignments.
+
+@node config directives
+@subsection configuration file directives
+@cindex autoopts directives
+
+The @code{<?} marker indicates an XML directive.
+There is only one directive supported: program sectioning,
+though two syntaxes are supported.
+
+If, for example, you have a collection of programs that work closely
+together and, likely, have a common set of options, these programs may use a
+single, sectioned, configuration file. The file may be sectioned in either
+of two ways. The two ways may not be intermixed in a single configuration
+file. All text before the first segmentation line is processed, then only
+the segment that applies:
+
+@table @samp
+@item <?auto-options ...>
+The @code{...} ellipsis may contain AutoOpts option processing options.
+Currently, that consists of one or both of:
+
+@table @code
+@item gnu
+@itemx autoopts
+to indicate GNU-standard or AutoOpts-standard layout of usage and
+version information, and/or
+
+@item misuse-usage
+@itemx no-misuse-usage
+to indicate whether the available options should be listed when
+an invalid option appears on the command line.
+@end table
+@noindent
+Anything else will be silently ignored.
+
+@item <?program prog-name>
+The @code{<?} marker indicates an XML directive.
+The file is partitioned by these lines and the options are processed
+for the @code{prog-name} program only before the first @code{<?program}
+directive and the program section with a matching program name.
+
+@item [PROG_NAME]
+This is basically an alias for @code{<?program prog-name>}, except that
+the program name must be upper cased and segmented only with underscores.
+@end table
+
+@noindent
+Segmentation does not apply if the config file is being parsed with
+the @code{configFileLoad(3AutoOpts)} function.
+
+@node config comments
+@subsection comments in the configuration file
+
+Comments are lines beginning with a hash mark (@code{#}),
+XML-style comments (@code{<!-- arbitrary text -->}), and
+unrecognized XML directives.
+
+@example
+# this is a comment
+<!-- this is also
+ a comment -->
+<?this is
+ a bad comment ;->
+@end example
+
+@c === SECTION MARKER
+
+@node shell options
+@section AutoOpts for Shell Scripts
+@cindex shell options
+@cindex configuration file
+
+AutoOpts may be used with shell scripts either by automatically creating a
+complete program that will process command line options and pass back
+the results to the invoking shell by issuing shell variable assignment
+commands, or it may be used to generate portable shell code that can
+be inserted into your script.
+
+The functionality of these features, of course, is somewhat constrained
+compared with the normal program facilities. Specifically, you cannot
+invoke callout procedures with either of these methods. Additionally,
+if you generate a shell script to do the parsing:
+
+@enumerate
+@item
+You cannot obtain options from configuration files.
+@item
+You cannot obtain options from environment variables.
+@item
+You cannot save the option state to an option file.
+@item
+Option conflict/requirement verification is disabled.
+@end enumerate
+
+Both of these methods are enabled by running AutoGen on
+the definitions file with the additional main procedure attribute:
+
+@example
+main = @{ main-type = shell-process; @};
+@end example
+@noindent
+or:
+@example
+main = @{ main-type = shell-parser; @};
+@end example
+
+If you do not supply a @code{proc-to-call}, it will default to
+@code{optionPutShell}. That will produce a program that will process the
+options and generate shell text for the invoking shell to interpret
+(@pxref{binary-parser}). If you supply the name, @code{optionParseShell}, then
+you will have a program that will generate a shell script that can parse the
+options (@pxref{script-parser}). If you supply a different procedure name,
+you will have to provide that routine and it may do whatever you like.
+
+@menu
+* binary-parser:: Parsing with an Executable
+* script-parser:: Parsing with a Portable Script
+@end menu
+
+@node binary-parser
+@subsection Parsing with an Executable
+
+The following commands are approximately all that is needed
+to build a shell script command line option parser from
+an option definition file:
+
+@example
+autogen -L <opt-template-dir> test-errors.def
+cc -o test-errors -L <opt-lib-dir> -I <opt-include-dir> \
+ -DTEST_PROGRAM_OPTS test-errors.c -lopts
+@end example
+
+The resulting program can then be used within your shell script as follows:
+
+@example
+eval `./test-errors "$@@"`
+if [ -z "$@{OPTION_CT@}" ] ; then exit 1 ; fi
+test $@{OPTION_CT@} -gt 0 && shift $@{OPTION_CT@}
+@end example
+@ignore
+END == AO-DATA2 == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@ignore
+START == AUTOINFO == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c === SECTION MARKER
+
+@node AutoInfo
+@section Automated Info Docs
+@cindex AutoInfo
+
+AutoOpts provides two templates for producing @file{.texi} documentation.
+@file{agtexi-cmd.tpl} for the invoking section, and @file{aginfo3.tpl} for
+describing exported library functions and macros.
+
+For both types of documents, the documentation level is selected by
+passing a @samp{-DLEVEL=<level-name>} argument to AutoGen when you build
+the document. (See the example invocation below.)
+
+Two files will be produced, a @file{.texi} file and a @file{.menu} file.
+You should include the text in the @file{.menu} file in a @file{@@menu}
+list, either with @file{@@include}-ing it or just copying text.
+The @file{.texi} file should be @file{@@include}-ed where the invoking
+section belongs in your document.
+
+The @file{.texi} file will contain an introductory paragraph, a menu
+and a subordinate section for the invocation usage and for each
+documented option. The introductory paragraph is normally the boiler
+plate text, along the lines of:
+
+@example
+This chapter documents the @@file@{AutoOpts@} generated usage text
+and option meanings for the @@file@{your-program@} program.
+@end example
+
+@noindent
+or:
+
+@example
+These are the publicly exported procedures from the lib@i{name} library.
+Any other functions mentioned in the @i{header} file are for the private use
+of the library.
+@end example
+
+@menu
+* command-info:: ``invoking'' info docs
+* library-info:: library info docs
+@end menu
+
+@node command-info
+@subsection ``invoking'' info docs
+
+Using the option definitions for an AutoOpt client program, the
+@file{agtexi-cmd.tpl} template will produce texinfo text that documents the
+invocation of your program. The text emitted is designed to be included
+in the full texinfo document for your product. It is not a stand-alone
+document. The usage text for the @ref{autogen usage},
+@ref{getdefs usage} and @ref{columns usage} programs, are included in
+this document and are all generated using this template.
+
+If your program's option definitions include a
+@samp{prog-info-descrip} section, then that text will replace the
+boilerplate introductory paragraph.
+
+@noindent
+These files are produced by invoking the following command:
+
+@example
+autogen -L $@{prefix@}/share/autogen -Tagtexi-cmd.tpl \
+ -DLEVEL=section your-opts.def
+@end example
+
+@noindent
+Where @file{$@{prefix@}} is the AutoGen installation prefix
+and @file{your-opts.def} is the name of your product's option
+definition file.
+
+@node library-info
+@subsection library info docs
+
+The @file{texinfo} doc for libraries is derived from mostly the same
+information as is used for producing man pages @xref{man3}. The main
+difference is that there is only one output file and the individual
+functions are referenced from a @code{.texi} menu. There is also
+a small difference in the global attributes used:
+
+@multitable @columnfractions .02 .23 .65
+@item @tab lib_description
+@tab A description of the library. This text appears before the menu.
+If not provided, the standard boilerplate version will be inserted.
+@item
+@item @tab see_also
+@tab The @code{SEE ALSO} functionality is not supported for the
+@file{texinfo} documentation, so any @code{see_also} attribute will be ignored.
+@end multitable
+
+@noindent
+These files are produced by invoking the following commands:
+
+@example
+getdefs linenum srcfile template=aginfo3.tpl output=libexport.def \
+ <source-file-list>
+
+autogen -L $@{prefix@}/share/autogen -DLEVEL=section libexport.def
+@end example
+
+@noindent
+Where @file{$@{prefix@}} is the AutoGen installation prefix
+and @file{libexport.def} is some name that suits you.
+
+An example of this can be seen in this document, @xref{libopts procedures}.
+
+@c === SECTION MARKER
+
+@node AutoMan pages
+@section Automated Man Pages
+@cindex AutoMan pages
+
+AutoOpts provides two templates for producing man pages.
+The command (@file{man1}) pages are derived from the options definition
+file, and the library (@file{man3}) pages are derived from
+stylized comments (@pxref{getdefs Invocation}).
+
+@menu
+* man1:: command line man pages
+* man3:: library man pages
+@end menu
+
+@node man1
+@subsection command line man pages
+
+Using the option definitions for an AutoOpts client program,
+the @samp{agman-cmd.tpl} template will produce an nroff document
+suitable for use as a @samp{man(1)} page document for a command
+line command. The description section of the document is either
+the @samp{prog-man-descrip} text, if present, or the @samp{detail}
+text.
+
+Each option in the option definitions file is fully documented
+in its usage. This includes all the information documented
+above for each option (@pxref{option attributes}), plus
+the @samp{doc} attribute is appended. Since the @samp{doc}
+text is presumed to be designed for @code{texinfo} documentation,
+@code{sed} is used to convert some constructs from @code{texi}
+to @code{nroff}-for-@code{man}-pages. Specifically,
+
+@example
+convert @@code, @@var and @@samp into \fB...\fP phrases
+convert @@file into \fI...\fP phrases
+Remove the '@@' prefix from curly braces
+Indent example regions
+Delete the example commands
+Replace @samp{end example} command with ".br"
+Replace the @samp{@@*} command with ".br"
+@end example
+
+@noindent
+This document is produced by invoking the following command:
+
+@example
+autogen -L $@{prefix@}/share/autogen -Tagman-cmd.tpl options.def
+@end example
+
+@noindent
+Where @file{$@{prefix@}} is the AutoGen installation prefix and
+@file{options.def} is the name of your product's option definition file.
+I do not use this very much, so any feedback or improvements would be
+greatly appreciated.
+
+@node man3
+@subsection library man pages
+
+Two global definitions are required, and then
+one library man page is produced for each @code{export_func} definition
+that is found. It is generally convenient to place these definitions
+as @file{getdefs} comments (@pxref{getdefs Invocation}) near the procedure
+definition, but they may also be a separate AutoGen definitions file
+(@pxref{Definitions File}). Each function will be cross referenced
+with their sister functions in a @file{SEE ALSO} section. A global
+@code{see_also} definition will be appended to this cross referencing text.
+
+@noindent
+The two global definitions required are:
+
+@multitable @columnfractions .02 .15 .77
+@item @tab library
+@tab This is the name of your library, without the @file{lib} prefix.
+The AutoOpts library is named @file{libopts.so...}, so the @code{library}
+attribute would have the value @code{opts}.
+@item
+@item @tab header
+@tab Generally, using a library with a compiled program entails
+@code{#include}-ing a header file. Name that header with this attribute.
+In the case of AutoOpts, it is generated and will vary based on the
+name of the option definition file. Consequently, @file{your-opts.h} is
+specified.
+@end multitable
+
+@noindent
+The @code{export_func} definition should contain the following attributes:
+
+@multitable @columnfractions .02 .15 .77
+@item @tab name
+@tab The name of the procedure the library user may call.
+@item @tab what
+@tab A brief sentence describing what the procedure does.
+@item @tab doc
+@tab A detailed description of what the procedure does.
+It may ramble on for as long as necessary to properly describe it.
+@item @tab err
+@tab A short description of how errors are handled.
+@item @tab ret_type
+@tab The data type returned by the procedure.
+Omit this for @code{void} procedures.
+@item @tab ret_desc
+@tab Describe what the returned value is, if needed.
+@item @tab private
+@tab If specified, the function will @strong{not} be documented.
+This is used, for example, to produce external declarations for functions
+that are not available for public use, but are used in the generated text.
+@item
+@item @tab arg
+@tab This is a compound attribute that contains:
+@end multitable
+@multitable @columnfractions .02 .15 .15 .62
+@item @tab @tab arg_type
+@tab The data type of the argument.
+@item @tab @tab arg_name
+@tab A short name for it.
+@item @tab @tab arg_desc
+@tab A brief description.
+@end multitable
+
+@noindent
+As a @file{getdefs} comment, this would appear something like this:
+
+@example
+/*=--subblock=arg=arg_type,arg_name,arg_desc =*/
+/*=*
+ * library: opts
+ * header: your-opts.h
+=*/
+/*=export_func optionProcess
+ *
+ * what: this is the main option processing routine
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + int + argc + program arg count +
+ * arg: + char** + argv + program arg vector +
+ * ret_type: int
+ * ret_desc: the count of the arguments processed
+ *
+ * doc: This is what it does.
+ * err: When it can't, it does this.
+=*/
+@end example
+
+@noindent
+Note the @code{subblock} and @code{library} comments.
+@code{subblock} is an embedded @file{getdefs}
+option (@pxref{getdefs subblock}) that tells it how to parse the
+@code{arg} attribute. The @code{library} and @code{header} entries
+are global definitions that apply to all the documented functions.
+
+@c === SECTION MARKER
+
+@node getopt_long
+@section Using getopt(3C)
+@cindex getopt_long
+
+There is a template named, @code{getopt.tpl} that is distributed with
+AutoOpts. Using that template instead of @code{options.tpl} will produce
+completely independent source code that will parse command line options. It
+will utilize either the standard @code{getopt(3C)} or the GNU
+@code{getopt_long(3GNU)} function to drive the parsing. Which is used is
+selected by the presence or absence of the @code{long-opts} program attribute.
+It will save you from being dependent upon the @code{libopts} library @i{and}
+it produces code ready for internationalization. However, it also carries
+with it some limitations on the use of AutoOpts features and some requirements
+on the build environment.
+
+
+@menu
+* getopt limitations:: getopt feature limitations
+* getopt building:: getopt build requirements
+@end menu
+
+@node getopt limitations
+@subsection getopt feature limitations
+
+This list of limitations is relative to the full list of AutoOpts
+supported features, @xref{Features}.
+
+@enumerate
+@item
+You cannot automatically take advantage of environment variable options or
+automated parsing of configuration files (``rc'' or ``ini'' files).
+Consequently, the resulting code does not support @file{--load-opts} or
+@file{--save-opts} options automatically.
+
+@item
+You cannot use set membership, enumerated, range checked or stacked
+argument type options. In fact, you cannot use anything that depends
+upon the @code{libopts} library. You are constrained to options that
+take ``@code{string}'' arguments, though you may handle the option
+argument with a callback procedure.
+
+@item
+Special disablement and/or enablement prefixes are not recognized.
+
+@item
+Generated @code{main()} procedures will not work.
+
+@item
+Option coordination with external libraries will not work.
+
+@item
+Every option must be ``settable'' because the emitted code
+depends upon the @code{SET_OPT_XXX} macros having been defined.
+Specify this as a global (program) attribute.
+
+@item
+You must specify a main procedure of type ``main''. The
+@file{getopt.tpl} template depends upon being able to compile the
+traditional .c file into a program and get it to emit the usage text.
+
+@item
+For the same reason, the traditional option parsing table code must be
+emitted @b{before} the @file{getopt.tpl} template gets expanded.
+
+@item
+The usage text is, therefore, statically defined.
+@end enumerate
+
+@node getopt building
+@subsection getopt build requirements
+
+You must supply some compile and link options via environment variables.
+
+@table @samp
+@item srcdir
+In case the option definition file lives in a different directory.
+@item CFLAGS
+Any special flags required to compile. The flags from
+@code{autoopts-config cflags} will be included automatically. Since
+the creation of the option parsing code includes creating a program
+that prints out help text, if it is necessary to include files from
+various directories to compile that program, you will need to specify
+those directories with ``-Idirpath'' text in the @code{CFLAGS}.
+Some experimentation may be necessary in that case.
+
+@strong{NOTE}: the ``-Idirpath'' text is only needed if your option callback
+functions include code that require additional ``#include'' directives.
+@item LDFLAGS
+Any special flags required to link. The flags from
+@code{autoopts-config ldflags} will be included automatically. This
+is required only if additional link flags for the help text emission
+program might be needed.
+@item CC
+This is needed only if ``@code{cc}'' cannot be found in @code{$PATH}
+(or it is not the one you want).
+@end table
+
+To use this, set the exported environment variables and specify ``getopt'' as
+the default template in your option definitions file (@pxref{Identification}).
+You will have @i{four} new files. Assuming your definitions were in a file
+named @file{myprog-opts.def} and your program name was specified as
+@file{progname}, the resulting files would be created: @file{myprog-opts.h},
+@file{myprog-opts.c}, @file{getopt-progname.h} and @file{getopt-progname.c}.
+You must compile and link both @file{.c} files into your program. If there
+are link failures, then you are using AutoOpts features that require the
+@file{libopts} library. You must remove these features,
+@xref{getopt limitations}.
+
+These generated files depend upon configure defines to work correctly.
+Therefore, you must specify a @code{config-header} attribute
+(@pxref{programming attributes}) and ensure it has @code{#defines} for
+either @code{HAVE_STDINT_H} or @code{HAVE_INTTYPES_H}; either
+@code{HAVE_SYS_LIMITS_H} or @code{HAVE_LIMITS_H}; and
+@code{HAVE_SYSEXITS_H}, if the @file{sysexits.h} header is available.
+The required header files for these defines are, respectively,
+the @file{/usr/include} files named:
+@itemize @bullet
+@item stdint.h
+@item inttypes.h
+@item sys/limits.h
+@item limits.h
+@item sysexits.h
+@end itemize
+
+@noindent
+The following header files must also exist on the build platform:
+@itemize @bullet
+@item sys/types.h
+@item stdio.h
+@item string.h
+@item unistd.h -- or, for getopt_long:
+@item getopt.h
+@end itemize
+@c === SECTION MARKER
+
+@node i18n
+@section Internationalizing AutoOpts
+@cindex Internationalizing AutoOpts
+
+The generated code for AutoOpts will enable and disable the translation of
+AutoOpts run time messages. If @code{ENABLE_NLS} is defined at compile time
+and @code{no-xlate} has been not set to the value @emph{anything}, then the
+@code{_()} macro may be used to specify a translation function. If undefined,
+it will default to @code{gettext(3GNU)}. This define will also enable a
+callback function that @code{optionProcess} invokes at the beginning of option
+processing. The AutoOpts @code{libopts} library will always check for this
+@emph{compiled with NLS} flag, so @code{libopts} does not need to be specially
+compiled. The strings returned by the translation function will be
+@code{strdup(3)-ed} and kept. They will not be re-translated, even if the
+locale changes, but they will also not be dependent upon reused or unmappable
+memory.
+
+To internationalize option processing, you should first internationalize your
+program. Then, the option processing strings can be added to your translation
+text by processing the AutoOpts-generated @file{my-opts.c} file and adding the
+distributed @file{po/usage-txt.pot} file. (Also by extracting the strings
+yourself from the @file{usage-txt.h} file.) When you call
+@code{optionProcess}, all of the user visible AutoOpts strings will be passed
+through the localization procedure established with the @code{_()}
+preprocessing macro.
+
+All of this is @emph{dis}-abled if you specify the global attribute
+@code{no-xlate} to @emph{anything}.
+
+@c === SECTION MARKER
+
+@node Naming Conflicts
+@section Naming Conflicts
+@cindex Naming Conflicts
+
+AutoOpts generates a header file that contains many C preprocessing macros and
+several external names. For the most part, they begin with either @code{opt_}
+or @code{option}, or else they end with @code{_opt}. If this happens to
+conflict with other macros you are using, or if you are compiling multiple
+option sets in the same compilation unit, the conflicts can be avoided. You
+may specify an external name @code{prefix} (@pxref{program attributes}) for
+all of the names generated for each set of option definitions.
+
+Among these macros, several take an option name as a macro argument.
+Sometimes, this will inconveniently conflict. For example, if you specify an
+option named, @code{debug}, the emitted code will presume that @code{DEBUG} is
+not a preprocessing name. Or also, if you are building on a Windows platform,
+you may find that MicroSoft has usurped a number of user space names in its
+header files. Consequently, you will get a preprocessing error if you use,
+for example, @code{HAVE_OPT(DEBUG)} or @code{HAVE_OPT(INTERNAL)}
+(@pxref{HAVE_OPT}) in your code. You may trigger an obvious warning for such
+conflicts by specifying the @code{guard-option-names} attribute
+(@pxref{program attributes}). That emitted code will also @code{#undef}-ine
+the conflicting name.
+
+@node All Attribute Names
+@section All Attribute Names
+
+This is the list of all the option attributes used in the various
+option processing templates. There are several flavors of attributes,
+and these are not distinguished here.
+
+@itemize @bullet
+@item
+Valid, current attributes that you are encouraged to use.
+@item
+Internally generated attributes that you cannot use at all.
+I need to prefix these with a distinguished prefix. e.g. ``ao-''
+@item
+Valid attributes, but are deprecated. Alternates should be documented.
+@end itemize
+
+This list is derived by running many example option definitions through the
+option generation and man page templates and noting which attributes are
+actually used. There may be a few that are used but not exercised in my
+testing. If so, I need to ferret those out and test them, too.
+
+@example
+aliases allow-errors arg-default
+arg-optional arg-range arg-type
+argument call-proc code
+config-header copyright default
+deprecated descrip detail
+disable documentation eaddr
+enable enabled environrc
+equivalence exit-name explain
+export extract-code field
+file-fail-code flag flag-code
+flag-proc flags-cant flags-must
+full-usage gnu-usage guard-option-names
+help-value homerc ifdef
+ifndef immed-disable immediate
+include lib-name library
+long-opts main main-text
+main-type max min
+more-help-value must-set name
+no-command no-libopts no-misuse-usage
+no-preset no-xlate nomem-fail-code
+omitted-usage package prefix
+prefix-enum preserve-case prog-name
+prog-title reorder-args resettable
+scaled settable short-usage
+stack-arg std-value test-main
+translators unstack-arg usage
+usage-message usage-opt usage-type
+val-name val-upname value
+version
+@end example
+
+@node Option Define Names
+@section Option Definition Name Index
+@printindex vr
+
+@ignore
+END == AUTOINFO == DO NOT CHANGE THIS COMMENT or the surrounding 'ignore's
+Extraction from autogen.texi
+@end ignore
+
+@c = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
+@c
+@c TRAILER
+
+@c LocalWords: AutoGen texinfo Korb tpl bruce Exp texi autogen setfilename AG
+@c LocalWords: settitle setchapternewpage dne dircategory direntry ifinfo gpl
+@c LocalWords: AutoOpts snprintfv titlepage vskip pt filll sp dir xref cindex
+@c LocalWords: AutoGen's noindent rc ini enum IDX const az upcase ENDFOR ESAC
+@c LocalWords: optargs egcs inclhack sh fixincl autoconf endif var templ dirs
+@c LocalWords: def txt cd STR str ifdef alist downcase sprintf arg lexer
+@c LocalWords: srcfile linenum subblock defParse srcdir sed POSIX printf expr
+@c LocalWords: stdout expr func gfunc tr findex exparg desc desc sep macfunc
+@c LocalWords: ing getdefs libopts src ksh forcomma csh env Sourced autoopts
+@c LocalWords: mkmerge builddir ADDON AutoGetopts getopt glibc argp perl awk
+@c LocalWords: printindex cp fn
diff --git a/doc/autogen.info b/doc/autogen.info
new file mode 100644
index 0000000..de39afb
--- /dev/null
+++ b/doc/autogen.info
@@ -0,0 +1,502 @@
+This is autogen.info, produced by makeinfo version 4.13 from
+/old-home/bkorb/ag/ag/doc//agdoc.texi.
+
+This manual is for GNU AutoGen version 5.16, updated August 2012.
+
+ Copyright (C) 1992-2012 by Bruce Korb.
+
+ Permission is granted to copy, distribute and/or modify this
+ document under the terms of the GNU Free Documentation License,
+ Version 1.2 or any later version published by the Free Software
+ Foundation; with no Invariant Sections, no Front-Cover Texts, and
+ no Back-Cover Texts.
+
+INFO-DIR-SECTION GNU programming tools
+START-INFO-DIR-ENTRY
+* AutoGen: (autogen). The Automated Program Generator
+END-INFO-DIR-ENTRY
+
+ This file documents GNU AutoGen Version 5.16.
+
+ AutoGen copyright (C) 1992-2012 Bruce Korb AutoOpts copyright (C)
+1992-2012 Bruce Korb snprintfv copyright (C) 1999-2000 Gary V. Vaughan
+
+ AutoGen is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation, either version 3 of the License, or (at your
+option) any later version.
+
+ AutoGen is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+Indirect:
+autogen.info-1: 1458
+autogen.info-2: 300856
+
+Tag Table:
+(Indirect)
+Node: Top1458
+Node: Introduction2897
+Node: Generalities4567
+Node: Example Usage7371
+Node: csh/zsh caveat12618
+Node: Testimonial13983
+Node: Definitions File16194
+Node: Identification18099
+Node: Definitions19388
+Node: def-list21111
+Node: double-quote-string22000
+Node: single-quote-string22868
+Node: simple-string23603
+Node: shell-generated24362
+Node: scheme-generated25047
+Node: here-string25444
+Node: concat-string27206
+Node: Index Assignments28190
+Node: Dynamic Text29652
+Node: Directives30827
+Node: Predefines36448
+Node: Comments38211
+Node: Example38626
+Node: Full Syntax39360
+Node: Alternate Definition52813
+Node: Template File54888
+Node: pseudo macro56517
+Node: naming values62220
+Node: expression syntax63501
+Node: apply code64743
+Node: basic expression67289
+Node: AutoGen Functions69580
+Node: SCM ag-fprintf74073
+Node: SCM ag-function?74854
+Node: SCM base-name75232
+Node: SCM chdir75612
+Node: SCM count76081
+Node: SCM def-file76564
+Node: SCM def-file-line76934
+Node: SCM dne77855
+Node: SCM emit79196
+Node: SCM emit-string-table79705
+Node: SCM error80154
+Node: SCM exist?81077
+Node: SCM find-file81849
+Node: SCM first-for?82392
+Node: SCM for-by82876
+Node: SCM for-from83310
+Node: SCM for-index83749
+Node: SCM for-sep84204
+Node: SCM for-to84748
+Node: SCM get85170
+Node: SCM get-c-name85657
+Node: SCM get-down-name86217
+Node: SCM get-up-name86843
+Node: SCM high-lim87459
+Node: SCM last-for?88155
+Node: SCM len88623
+Node: SCM low-lim89137
+Node: SCM make-header-guard89474
+Node: SCM make-tmp-dir91234
+Node: SCM match-value?91590
+Node: SCM out-delete92490
+Node: SCM out-depth92985
+Node: SCM out-emit-suspended93334
+Node: SCM out-line93751
+Node: SCM out-move94126
+Node: SCM out-name94609
+Node: SCM out-pop95066
+Node: SCM out-push-add95692
+Node: SCM out-push-new96103
+Node: SCM out-resume96721
+Node: SCM out-suspend97211
+Node: SCM out-switch97914
+Node: SCM output-file-next-line98494
+Node: SCM set-option99424
+Node: SCM set-writable99836
+Node: SCM stack100408
+Node: SCM stack-join100796
+Node: SCM suffix101318
+Node: SCM tpl-file101631
+Node: SCM tpl-file-line102124
+Node: SCM tpl-file-next-line103114
+Node: SCM autogen-version103702
+Node: SCM c-file-line-fmt104073
+Node: Common Functions104494
+Node: SCM agpl109846
+Node: SCM bsd110304
+Node: SCM c-string110782
+Node: SCM error-source-line111549
+Node: SCM extract112083
+Node: SCM format-arg-count115432
+Node: SCM fprintf116341
+Node: SCM gperf116891
+Node: SCM gperf-code117621
+Node: SCM gpl118812
+Node: SCM hide-email119278
+Node: SCM html-escape-encode119742
+Node: SCM in?120243
+Node: SCM join120681
+Node: SCM kr-string121194
+Node: SCM lgpl121762
+Node: SCM license122286
+Node: SCM license-description122834
+Node: SCM license-full123588
+Node: SCM license-info125772
+Node: SCM license-name126729
+Node: SCM make-gperf127090
+Node: SCM makefile-script128086
+Node: SCM max130865
+Node: SCM min131178
+Node: SCM prefix131482
+Node: SCM printf132008
+Node: SCM raw-shell-str132573
+Node: SCM shell133324
+Node: SCM shell-str134339
+Node: SCM shellf137264
+Node: SCM sprintf137712
+Node: SCM string-capitalize138095
+Node: SCM string-capitalize!138558
+Node: SCM *=*138899
+Node: SCM *==*139469
+Node: SCM string-downcase139877
+Node: SCM string-downcase!140289
+Node: SCM *~140650
+Node: SCM *~~141072
+Node: SCM *=141454
+Node: SCM *==141836
+Node: SCM ==142248
+Node: SCM ~142594
+Node: SCM =143065
+Node: SCM *~*143847
+Node: SCM *~~*144260
+Node: SCM ~~144656
+Node: SCM ~*145022
+Node: SCM ~~*145436
+Node: SCM =*145829
+Node: SCM ==*146217
+Node: SCM string-substitute146602
+Node: SCM string-table-add147366
+Node: SCM string-table-add-ref148173
+Node: SCM string-table-new148746
+Node: SCM string-table-size151462
+Node: SCM string->c-name!151885
+Node: SCM string->camelcase152415
+Node: SCM string-tr152910
+Node: SCM string-tr!153388
+Node: SCM string-upcase154047
+Node: SCM string-upcase!154455
+Node: SCM sub-shell-str154817
+Node: SCM sum155269
+Node: SCM time-string->number155603
+Node: SCM version-compare156235
+Node: native macros157178
+Node: AGMacro syntax160265
+Node: BREAK162414
+Node: CASE162769
+Node: COMMENT165480
+Node: CONTINUE166027
+Node: DEBUG166287
+Node: DEFINE167154
+Node: ELIF169388
+Node: ELSE169864
+Node: ENDDEF170237
+Node: ENDFOR170504
+Node: ENDIF170806
+Node: ENDWHILE171084
+Node: ESAC171378
+Node: EXPR171660
+Node: FOR172139
+Node: IF175117
+Node: INCLUDE176154
+Node: INVOKE176802
+Node: RETURN177802
+Node: SELECT178341
+Node: UNKNOWN178832
+Node: WHILE179361
+Node: output controls180102
+Node: Augmenting AutoGen182110
+Node: shell commands182660
+Node: guile macros183483
+Node: guile callouts184289
+Node: AutoGen macros186487
+Node: autogen Invocation187186
+Node: autogen usage189075
+Node: autogen input-select194482
+Ref: autogen templ-dirs194791
+Ref: autogen override-tpl195282
+Ref: autogen lib-template195710
+Ref: autogen definitions196092
+Ref: autogen load-scheme196746
+Ref: autogen load-functions197233
+Ref: autogen shell197651
+Ref: autogen no-fmemopen198267
+Ref: autogen equate199059
+Node: autogen out-handling199377
+Ref: autogen base-name199659
+Ref: autogen source-time200688
+Ref: autogen writable201087
+Node: autogen debug-tpl201230
+Ref: autogen loop-limit201624
+Ref: autogen timeout202025
+Ref: autogen trace202555
+Ref: autogen trace-out204532
+Ref: autogen show-defs205060
+Ref: autogen used-defines205453
+Ref: autogen core206181
+Node: autogen processing206702
+Ref: autogen skip-suffix207090
+Ref: autogen select-suffix207757
+Ref: autogen define208278
+Ref: autogen undefine209601
+Node: autogen dep-track210053
+Ref: autogen make-dep210320
+Node: autogen config213631
+Node: autogen exit status216700
+Node: autogen Examples217870
+Node: Installation218593
+Node: configuring218911
+Node: AutoGen CGI221762
+Node: signal names224189
+Node: installing225412
+Node: AutoOpts228196
+Node: Features229959
+Node: Licensing237573
+Node: Caveats238698
+Node: Quick Start240799
+Node: Option Definitions245705
+Node: program attributes247636
+Node: usage attributes249537
+Node: config attributes253271
+Node: programming attributes256616
+Node: presentation attributes261484
+Node: library attributes264809
+Node: lib and program265686
+Node: lib called268102
+Node: prog calls lib269389
+Node: information attributes270267
+Node: Generated main274919
+Node: main guile276099
+Node: main shell-process277006
+Node: main shell-parser278370
+Node: main main279016
+Node: main include279890
+Node: main invoke280694
+Node: main for-each281337
+Node: option attributes286796
+Node: Required Attributes288183
+Node: Common Attributes289992
+Node: Immediate Action293915
+Node: Option Conflict Attributes296232
+Node: opt-attr settable297018
+Node: opt-attr no-preset297609
+Node: opt-attr equivalence297969
+Node: opt-attr aliases300190
+Node: opt-attr default option300856
+Node: opt-attr documentation301663
+Node: opt-attr translators303192
+Node: Option Arguments303807
+Node: arg-type string305938
+Node: arg-type number306239
+Node: arg-type boolean308146
+Node: arg-type keyword308597
+Node: arg-type set membership310553
+Node: arg-type hierarchy312118
+Node: arg-type file name312898
+Node: arg-type time-duration314146
+Node: arg-type time-date316101
+Node: arg-keyword316885
+Node: arg-optional317740
+Node: arg-default318459
+Node: Option Argument Handling318818
+Node: Internationalizing Options323017
+Node: documentation attributes324969
+Node: automatic options330919
+Node: standard options336479
+Node: AutoOpts API340700
+Node: Option Processing Data343600
+Node: CLEAR_OPT347196
+Node: COUNT_OPT347520
+Node: DESC347925
+Node: DISABLE_OPT_name348343
+Node: ENABLED_OPT348900
+Node: ERRSKIP_OPTERR349339
+Node: ERRSTOP_OPTERR349670
+Node: HAVE_OPT350124
+Node: ISSEL_OPT350493
+Node: ISUNUSED_OPT350801
+Node: OPTION_CT351111
+Node: OPT_ARG351467
+Node: OPT_NO_XLAT_CFG_NAMES352020
+Node: OPT_NO_XLAT_OPT_NAMES352557
+Node: OPT_VALUE_name353038
+Node: OPT_XLAT_CFG_NAMES353502
+Node: OPT_XLAT_OPT_NAMES354424
+Node: RESTART_OPT355186
+Node: SET_OPT_name355655
+Node: STACKCT_OPT356605
+Node: STACKLST_OPT357387
+Node: START_OPT358207
+Node: STATE_OPT358463
+Node: USAGE359412
+Node: VALUE_OPT_name360878
+Node: VERSION361532
+Node: WHICH_IDX_name362116
+Node: WHICH_OPT_name362674
+Node: teOptIndex363242
+Node: OPTIONS_STRUCT_VERSION363831
+Node: libopts procedures364624
+Node: libopts-ao_string_tokenize366193
+Node: libopts-configFileLoad368215
+Node: libopts-optionFileLoad369563
+Node: libopts-optionFindNextValue371150
+Node: libopts-optionFindValue372345
+Node: libopts-optionFree373404
+Node: libopts-optionGetValue374052
+Node: libopts-optionLoadLine375312
+Node: libopts-optionNextValue376758
+Node: libopts-optionOnlyUsage378055
+Node: libopts-optionProcess378739
+Node: libopts-optionRestore380495
+Node: libopts-optionSaveFile381386
+Node: libopts-optionSaveState382632
+Node: libopts-optionUnloadNested383846
+Node: libopts-optionVersion384502
+Node: libopts-pathfind385071
+Node: libopts-strequate386774
+Node: libopts-streqvcmp387389
+Node: libopts-streqvmap388341
+Node: libopts-strneqvcmp389449
+Node: libopts-strtransform390501
+Node: Multi-Threading391202
+Node: option descriptor392198
+Node: Using AutoOpts392849
+Node: local use393459
+Node: binary not installed395089
+Node: binary pre-installed395593
+Node: source pre-installed396222
+Node: source not installed397284
+Node: Presetting Options398409
+Node: loading rcfile400672
+Node: saving rcfile402378
+Node: sample rcfile402887
+Node: environrc411815
+Node: config example413727
+Node: Config File Format415592
+Node: config name/string-value416638
+Node: config integer-values419479
+Node: config nested-values419983
+Node: config directives420467
+Node: config comments422279
+Node: shell options422704
+Node: binary-parser424527
+Node: script-parser426961
+Node: AutoInfo452010
+Node: command-info453452
+Node: library-info454495
+Node: AutoMan pages455740
+Node: man1456194
+Node: man3457657
+Node: getopt_long460879
+Node: getopt limitations461789
+Node: getopt building463413
+Node: i18n466054
+Node: Naming Conflicts467616
+Node: All Attribute Names469004
+Node: Option Define Names471175
+Node: Add-Ons483121
+Node: AutoFSM484137
+Node: AutoXDR484560
+Node: AutoEvents485391
+Node: columns Invocation486647
+Node: columns usage488430
+Node: columns dimensions491808
+Ref: columns width492052
+Ref: columns columns492502
+Ref: columns col-width492819
+Ref: columns tab-width493132
+Node: columns treatment493326
+Ref: columns spread493565
+Ref: columns fill493931
+Ref: columns indent494393
+Ref: columns first-indent494696
+Ref: columns format495412
+Ref: columns separation495720
+Ref: columns line-separation495977
+Ref: columns ending496224
+Node: columns ordering496388
+Ref: columns by-columns496637
+Ref: columns sort496944
+Node: columns input-text497280
+Ref: columns input497533
+Node: columns config497780
+Node: columns exit status500525
+Node: columns See Also501109
+Node: getdefs Invocation501384
+Node: getdefs usage504258
+Node: getdefs def-selection508240
+Ref: getdefs defs-to-get508536
+Ref: getdefs subblock508862
+Ref: getdefs listattr509807
+Node: getdefs enumerating510508
+Ref: getdefs ordering510768
+Ref: getdefs first-index511319
+Node: getdefs doc-insert511620
+Ref: getdefs filelist511867
+Ref: getdefs assign512239
+Ref: getdefs common-assign512589
+Ref: getdefs copy512935
+Ref: getdefs srcfile513260
+Ref: getdefs linenum513665
+Node: getdefs input-files514051
+Ref: getdefs input514306
+Node: getdefs doc-output514913
+Ref: getdefs output515161
+Ref: getdefs autogen515477
+Ref: getdefs template516002
+Ref: getdefs agarg516187
+Ref: getdefs base-name516600
+Node: getdefs config517082
+Node: getdefs exit status519309
+Node: getdefs See Also519893
+Node: xml2ag Invocation520168
+Node: xml2ag usage522046
+Node: xml2ag the-xml2ag-option526250
+Ref: xml2ag output526532
+Node: xml2ag autogen-options526765
+Ref: xml2ag templ-dirs527246
+Ref: xml2ag override-tpl527524
+Ref: xml2ag lib-template527704
+Ref: xml2ag definitions527966
+Ref: xml2ag load-scheme528140
+Ref: xml2ag load-functions528322
+Ref: xml2ag shell528609
+Ref: xml2ag no-fmemopen528795
+Ref: xml2ag equate528906
+Ref: xml2ag base-name529091
+Ref: xml2ag source-time529261
+Ref: xml2ag writable529381
+Ref: xml2ag loop-limit529508
+Ref: xml2ag timeout529675
+Ref: xml2ag trace529836
+Ref: xml2ag trace-out530417
+Ref: xml2ag show-defs530584
+Ref: xml2ag used-defines530706
+Ref: xml2ag core530823
+Ref: xml2ag skip-suffix531395
+Ref: xml2ag select-suffix531770
+Ref: xml2ag define532035
+Ref: xml2ag undefine532307
+Ref: xml2ag make-dep532583
+Node: xml2ag exit status532813
+Node: snprintfv533747
+Node: Future536264
+Node: Copying This Manual536603
+Node: Concept Index559144
+Node: Function Index580933
+
+End Tag Table
diff --git a/doc/autogen.info-1 b/doc/autogen.info-1
new file mode 100644
index 0000000..306718c
--- /dev/null
+++ b/doc/autogen.info-1
@@ -0,0 +1,7460 @@
+This is autogen.info, produced by makeinfo version 4.13 from
+/old-home/bkorb/ag/ag/doc//agdoc.texi.
+
+This manual is for GNU AutoGen version 5.16, updated August 2012.
+
+ Copyright (C) 1992-2012 by Bruce Korb.
+
+ Permission is granted to copy, distribute and/or modify this
+ document under the terms of the GNU Free Documentation License,
+ Version 1.2 or any later version published by the Free Software
+ Foundation; with no Invariant Sections, no Front-Cover Texts, and
+ no Back-Cover Texts.
+
+INFO-DIR-SECTION GNU programming tools
+START-INFO-DIR-ENTRY
+* AutoGen: (autogen). The Automated Program Generator
+END-INFO-DIR-ENTRY
+
+ This file documents GNU AutoGen Version 5.16.
+
+ AutoGen copyright (C) 1992-2012 Bruce Korb AutoOpts copyright (C)
+1992-2012 Bruce Korb snprintfv copyright (C) 1999-2000 Gary V. Vaughan
+
+ AutoGen is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation, either version 3 of the License, or (at your
+option) any later version.
+
+ AutoGen is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+File: autogen.info, Node: Top, Next: Introduction, Up: (dir)
+
+The Automated Program Generator
+*******************************
+
+This file documents AutoGen version 5.16. It is a tool designed for
+generating program files that contain repetitive text with varied
+substitutions. This document is very long because it is intended as a
+reference document. For a quick start example, *Note Example Usage::.
+
+ The AutoGen distribution includes the basic generator engine and
+several add-on libraries and programs. Of the most general interest
+would be Automated Option processing, *Note AutoOpts::, which also
+includes stand-alone support for configuration file parsing, *Note
+Features::. Please see the "Add-on packages for AutoGen" section for
+additional programs and libraries associated with AutoGen.
+
+ This edition documents version 5.16, August 2012.
+
+* Menu:
+
+* Introduction:: AutoGen's Purpose
+* Definitions File:: AutoGen Definitions File
+* Template File:: AutoGen Template
+* Augmenting AutoGen:: Augmenting AutoGen Features
+* autogen Invocation:: Invoking AutoGen
+* Installation:: Configuring and Installing
+* AutoOpts:: Automated Option Processing
+* Add-Ons:: Add-on packages for AutoGen
+* Future:: Some ideas for the future.
+* Copying This Manual:: Copying This Manual
+* Concept Index:: General index
+* Function Index:: Function index
+
+
+File: autogen.info, Node: Introduction, Next: Definitions File, Prev: Top, Up: Top
+
+1 Introduction
+**************
+
+AutoGen is a tool designed for generating program files that contain
+repetitive text with varied substitutions. Its goal is to simplify the
+maintenance of programs that contain large amounts of repetitious text.
+This is especially valuable if there are several blocks of such text
+that must be kept synchronized in parallel tables.
+
+ An obvious example is the problem of maintaining the code required
+for processing program options and configuration settings. Processing
+options requires a minimum of four different constructs be kept in
+proper order in different places in your program. You need at least:
+
+ 1. The flag character in the flag string,
+
+ 2. code to process the flag when it is encountered,
+
+ 3. a global state variable or two, and
+
+ 4. a line in the usage text.
+
+You will need more things besides this if you choose to implement long
+option names, configuration (rc/ini) file processing, environment
+variable settings and keep all the documentation for these up to date.
+This can be done mechanically; with the proper templates and this
+program. In fact, it has already been done and AutoGen itself uses it
+*Note AutoOpts::. For a simple example of Automated Option processing,
+*Note Quick Start::. For a full list of the Automated Option features,
+*Note Features::. Be forewarned, though, the feature list is
+ridiculously extensive.
+
+* Menu:
+
+* Generalities:: The Purpose of AutoGen
+* Example Usage:: A Simple Example
+* csh/zsh caveat:: csh/zsh caveat
+* Testimonial:: A User's Perspective
+
+
+File: autogen.info, Node: Generalities, Next: Example Usage, Up: Introduction
+
+1.1 The Purpose of AutoGen
+==========================
+
+The idea of this program is to have a text file, a template if you
+will, that contains the general text of the desired output file. That
+file includes substitution expressions and sections of text that are
+replicated under the control of separate definition files.
+
+ AutoGen was designed with the following features:
+
+ 1. The definitions are completely separate from the template. By
+ completely isolating the definitions from the template it greatly
+ increases the flexibility of the template implementation. A
+ secondary goal is that a template user only needs to specify those
+ data that are necessary to describe his application of a template.
+
+ 2. Each datum in the definitions is named. Thus, the definitions can
+ be rearranged, augmented and become obsolete without it being
+ necessary to go back and clean up older definition files. Reduce
+ incompatibilities!
+
+ 3. Every definition name defines an array of values, even when there
+ is only one entry. These arrays of values are used to control the
+ replication of sections of the template.
+
+ 4. There are named collections of definitions. They form a nested
+ hierarchy. Associated values are collected and associated with a
+ group name. These associated data are used collectively in sets
+ of substitutions.
+
+ 5. The template has special markers to indicate where substitutions
+ are required, much like the `${VAR}' construct in a shell `here
+ doc'. These markers are not fixed strings. They are specified at
+ the start of each template. Template designers know best what
+ fits into their syntax and can avoid marker conflicts.
+
+ We did this because it is burdensome and difficult to avoid
+ conflicts using either M4 tokenization or C preprocessor
+ substitution rules. It also makes it easier to specify
+ expressions that transform the value. Of course, our expressions
+ are less cryptic than the shell methods.
+
+ 6. These same markers are used, in conjunction with enclosed
+ keywords, to indicate sections of text that are to be skipped and
+ for sections of text that are to be repeated. This is a major
+ improvement over using C preprocessing macros. With the C
+ preprocessor, you have no way of selecting output text because it
+ is an unvarying, mechanical substitution process.
+
+ 7. Finally, we supply methods for carefully controlling the output.
+ Sometimes, it is just simply easier and clearer to compute some
+ text or a value in one context when its application needs to be
+ later. So, functions are available for saving text or values for
+ later use.
+
+
+File: autogen.info, Node: Example Usage, Next: csh/zsh caveat, Prev: Generalities, Up: Introduction
+
+1.2 A Simple Example
+====================
+
+This is just one simple example that shows a few basic features. If
+you are interested, you also may run "make check" with the `VERBOSE'
+environment variable set and see a number of other examples in the
+`agen5/test/testdir' directory.
+
+ Assume you have an enumeration of names and you wish to associate
+some string with each name. Assume also, for the sake of this example,
+that it is either too complex or too large to maintain easily by hand.
+We will start by writing an abbreviated version of what the result is
+supposed to be. We will use that to construct our output templates.
+
+In a header file, `list.h', you define the enumeration and the global
+array containing the associated strings:
+
+ typedef enum {
+ IDX_ALPHA,
+ IDX_BETA,
+ IDX_OMEGA } list_enum;
+
+ extern char const* az_name_list[ 3 ];
+
+Then you also have `list.c' that defines the actual strings:
+
+ #include "list.h"
+ char const* az_name_list[] = {
+ "some alpha stuff",
+ "more beta stuff",
+ "final omega stuff" };
+
+First, we will define the information that is unique for each
+enumeration name/string pair. This would be placed in a file named,
+`list.def', for example.
+
+ autogen definitions list;
+ list = { list_element = alpha;
+ list_info = "some alpha stuff"; };
+ list = { list_info = "more beta stuff";
+ list_element = beta; };
+ list = { list_element = omega;
+ list_info = "final omega stuff"; };
+
+ The `autogen definitions list;' entry defines the file as an AutoGen
+definition file that uses a template named `list'. That is followed by
+three `list' entries that define the associations between the
+enumeration names and the strings. The order of the differently named
+elements inside of list is unimportant. They are reversed inside of the
+`beta' entry and the output is unaffected.
+
+ Now, to actually create the output, we need a template or two that
+can be expanded into the files you want. In this program, we use a
+single template that is capable of multiple output files. The
+definitions above refer to a `list' template, so it would normally be
+named, `list.tpl'.
+
+ It looks something like this. (For a full description, *Note
+Template File::.)
+
+ [+ AutoGen5 template h c +]
+ [+ CASE (suffix) +][+
+ == h +]
+ typedef enum {[+
+ FOR list "," +]
+ IDX_[+ (string-upcase! (get "list_element")) +][+
+ ENDFOR list +] } list_enum;
+
+ extern char const* az_name_list[ [+ (count "list") +] ];
+ [+
+
+ == c +]
+ #include "list.h"
+ char const* az_name_list[] = {[+
+ FOR list "," +]
+ "[+list_info+]"[+
+ ENDFOR list +] };[+
+
+ ESAC +]
+
+ The `[+ AutoGen5 template h c +]' text tells AutoGen that this is an
+AutoGen version 5 template file; that it is to be processed twice; that
+the start macro marker is `[+'; and the end marker is `+]'. The
+template will be processed first with a suffix value of `h' and then
+with `c'. Normally, the suffix values are appended to the `base-name'
+to create the output file name.
+
+ The `[+ == h +]' and `[+ == c +]' `CASE' selection clauses select
+different text for the two different passes. In this example, the
+output is nearly disjoint and could have been put in two separate
+templates. However, sometimes there are common sections and this is
+just an example.
+
+ The `[+FOR list "," +]' and `[+ ENDFOR list +]' clauses delimit a
+block of text that will be repeated for every definition of `list'.
+Inside of that block, the definition name-value pairs that are members
+of each `list' are available for substitutions.
+
+ The remainder of the macros are expressions. Some of these contain
+special expression functions that are dependent on AutoGen named values;
+others are simply Scheme expressions, the result of which will be
+inserted into the output text. Other expressions are names of AutoGen
+values. These values will be inserted into the output text. For
+example, `[+list_info+]' will result in the value associated with the
+name `list_info' being inserted between the double quotes and
+`(string-upcase! (get "list_element"))' will first "get" the value
+associated with the name `list_element', then change the case of all
+the letters to upper case. The result will be inserted into the output
+document.
+
+ If you have compiled AutoGen, you can copy out the template and
+definitions as described above and run `autogen list.def'. This will
+produce exactly the hypothesized desired output.
+
+ One more point, too. Lets say you decided it was too much trouble
+to figure out how to use AutoGen, so you created this enumeration and
+string list with thousands of entries. Now, requirements have changed
+and it has become necessary to map a string containing the enumeration
+name into the enumeration number. With AutoGen, you just alter the
+template to emit the table of names. It will be guaranteed to be in
+the correct order, missing none of the entries. If you want to do that
+by hand, well, good luck.
+
+
+File: autogen.info, Node: csh/zsh caveat, Next: Testimonial, Prev: Example Usage, Up: Introduction
+
+1.3 csh/zsh caveat
+==================
+
+AutoGen tries to use your normal shell so that you can supply shell code
+in a manner you are accustomed to using. If, however, you use csh or
+zsh, you cannot do this. Csh is sufficiently difficult to program that
+it is unsupported. Zsh, though largely programmable, also has some
+anomalies that make it incompatible with AutoGen usage. Therefore, when
+invoking AutoGen from these environments, you must be certain to set the
+SHELL environment variable to a Bourne-derived shell, e.g., sh, ksh or
+bash.
+
+ Any shell you choose for your own scripts need to follow these basic
+requirements:
+
+ 1. It handles `trap ":" $sig' without output to standard out. This
+ is done when the server shell is first started. If your shell
+ does not handle this, then it may be able to by loading functions
+ from its start up files.
+
+ 2. At the beginning of each scriptlet, the command `\\cd $PWD' is
+ inserted. This ensures that `cd' is not aliased to something
+ peculiar and each scriptlet starts life in the execution directory.
+
+ 3. At the end of each scriptlet, the command `echo mumble' is
+ appended. The program you use as a shell must emit the single
+ argument `mumble' on a line by itself.
+
+
+File: autogen.info, Node: Testimonial, Prev: csh/zsh caveat, Up: Introduction
+
+1.4 A User's Perspective
+========================
+
+Alexandre wrote:
+>
+> I'd appreciate opinions from others about advantages/disadvantages of
+> each of these macro packages.
+
+ I am using AutoGen in my pet project, and find one of its best
+points to be that it separates the operational data from the
+implementation.
+
+ Indulge me for a few paragraphs, and all will be revealed: In the
+manual, Bruce cites the example of maintaining command line flags
+inside the source code; traditionally spreading usage information, flag
+names, letters and processing across several functions (if not files).
+Investing the time in writing a sort of boiler plate (a template in
+AutoGen terminology) pays by moving all of the option details (usage,
+flags names etc.) into a well structured table (a definition file if you
+will), so that adding a new command line option becomes a simple matter
+of adding a set of details to the table.
+
+ So far so good! Of course, now that there is a template, writing
+all of that tedious optargs processing and usage functions is no longer
+an issue. Creating a table of the options needed for the new project
+and running AutoGen generates all of the option processing code in C
+automatically from just the tabular data. AutoGen in fact already ships
+with such a template... AutoOpts.
+
+ One final consequence of the good separation in the design of
+AutoGen is that it is retargetable to a greater extent. The
+egcs/gcc/fixinc/inclhack.def can equally be used (with different
+templates) to create a shell script (inclhack.sh) or a c program
+(fixincl.c).
+
+ This is just the tip of the iceberg. AutoGen is far more powerful
+than these examples might indicate, and has many other varied uses. I
+am certain Bruce or I could supply you with many and varied examples,
+and I would heartily recommend that you try it for your project and see
+for yourself how it compares to m4.
+
+ As an aside, I would be interested to see whether someone might be
+persuaded to rationalise autoconf with AutoGen in place of m4... Ben,
+are you listening? autoconf-3.0! `kay? =)O|
+
+Sincerely,
+ Gary V. Vaughan
+
+
+File: autogen.info, Node: Definitions File, Next: Template File, Prev: Introduction, Up: Top
+
+2 Definitions File
+******************
+
+This chapter describes the syntax and semantics of the AutoGen
+definition file. In order to instantiate a template, you normally must
+provide a definitions file that identifies itself and contains some
+value definitions. Consequently, we keep it very simple. For
+"advanced" users, there are preprocessing directives, sparse arrays,
+named indexes and comments that may be used as well.
+
+ The definitions file is used to associate values with names. Every
+value is implicitly an array of values, even if there is only one value.
+Values may be either simple strings or compound collections of
+name-value pairs. An array may not contain both simple and compound
+members. Fundamentally, it is as simple as:
+
+ prog-name = "autogen";
+ flag = {
+ name = templ_dirs;
+ value = L;
+ descrip = "Template search directory list";
+ };
+
+ For purposes of commenting and controlling the processing of the
+definitions, C-style comments and most C preprocessing directives are
+honored. The major exception is that the `#if' directive is ignored,
+along with all following text through the matching `#endif' directive.
+The C preprocessor is not actually invoked, so C macro substitution is
+*not* performed.
+
+* Menu:
+
+* Identification:: The Identification Definition
+* Definitions:: Named Definitions
+* Index Assignments:: Assigning an Index to a Definition
+* Dynamic Text:: Dynamic Text
+* Directives:: Controlling What Gets Processed
+* Predefines:: Pre-defined Names
+* Comments:: Commenting Your Definitions
+* Example:: What it all looks like.
+* Full Syntax:: Finite State Machine Grammar
+* Alternate Definition:: Alternate Definition Forms
+
+
+File: autogen.info, Node: Identification, Next: Definitions, Up: Definitions File
+
+2.1 The Identification Definition
+=================================
+
+The first definition in this file is used to identify it as a AutoGen
+file. It consists of the two keywords, `autogen' and `definitions'
+followed by the default template name and a terminating semi-colon
+(`;'). That is:
+
+ AutoGen Definitions TEMPLATE-NAME;
+
+Note that, other than the name TEMPLATE-NAME, the words `AutoGen' and
+`Definitions' are searched for without case sensitivity. Most lookups
+in this program are case insensitive.
+
+Also, if the input contains more identification definitions, they will
+be ignored. This is done so that you may include (*note Directives::)
+other definition files without an identification conflict.
+
+AutoGen uses the name of the template to find the corresponding template
+file. It searches for the file in the following way, stopping when it
+finds the file:
+
+ 1. It tries to open `./TEMPLATE-NAME'. If it fails,
+
+ 2. it tries `./TEMPLATE-NAME.tpl'.
+
+ 3. It searches for either of these files in the directories listed in
+ the templ-dirs command line option.
+
+ If AutoGen fails to find the template file in one of these places,
+it prints an error message and exits.
+
+
+File: autogen.info, Node: Definitions, Next: Index Assignments, Prev: Identification, Up: Definitions File
+
+2.2 Named Definitions
+=====================
+
+A name is a sequence of characters beginning with an alphabetic
+character (`a' through `z') followed by zero or more alpha-numeric
+characters and/or separator characters: hyphen (`-'), underscore (`_')
+or carat (`^'). Names are case insensitive.
+
+ Any name may have multiple values associated with it. Every name
+may be considered a sparse array of one or more elements. If there is
+more than one value, the values my be accessed by indexing the value
+with `[index]' or by iterating over them using the FOR (*note FOR::)
+AutoGen macro on it, as described in the next chapter. Sparse arrays
+are specified by specifying an index when defining an entry (*note
+Assigning an Index to a Definition: Index Assignments.).
+
+ There are two kinds of definitions, `simple' and `compound'. They
+are defined thus (*note Full Syntax::):
+
+ compound_name '=' '{' definition-list '}' ';'
+
+ simple-name[2] '=' string ';'
+
+ no^text^name ';'
+
+`simple-name' has the third index (index number 2) defined here.
+`No^text^name' is a simple definition with a shorthand empty string
+value. The string values for definitions may be specified in any of
+several formation rules.
+
+* Menu:
+
+* def-list:: Definition List
+* double-quote-string:: Double Quote String
+* single-quote-string:: Single Quote String
+* simple-string:: An Unquoted String
+* shell-generated:: Shell Output String
+* scheme-generated:: Scheme Result String
+* here-string:: A Here String
+* concat-string:: Concatenated Strings
+
+
+File: autogen.info, Node: def-list, Next: double-quote-string, Up: Definitions
+
+2.2.1 Definition List
+---------------------
+
+`definition-list' is a list of definitions that may or may not contain
+nested compound definitions. Any such definitions may *only* be
+expanded within a `FOR' block iterating over the containing compound
+definition. *Note FOR::.
+
+ Here is, again, the example definitions from the previous chapter,
+with three additional name value pairs. Two with an empty value
+assigned (FIRST and LAST), and a "global" GROUP_NAME.
+
+ autogen definitions list;
+ group_name = example;
+ list = { list_element = alpha; first;
+ list_info = "some alpha stuff"; };
+ list = { list_info = "more beta stuff";
+ list_element = beta; };
+ list = { list_element = omega; last;
+ list_info = "final omega stuff"; };
+
+
+File: autogen.info, Node: double-quote-string, Next: single-quote-string, Prev: def-list, Up: Definitions
+
+2.2.2 Double Quote String
+-------------------------
+
+The string follows the C-style escaping, using the backslash to quote
+(escape) the following character(s). Certain letters are translated to
+various control codes (e.g. `\n', `\f', `\t', etc.). `x' introduces a
+two character hex code. `0' (the digit zero) introduces a one to three
+character octal code (note: an octal byte followed by a digit must be
+represented with three octal digits, thus: `"\0001"' yielding a NUL
+byte followed by the ASCII digit 1). Any other character following the
+backslash escape is simply inserted, without error, into the string
+being formed.
+
+ Like ANSI "C", a series of these strings, possibly intermixed with
+single quote strings, will be concatenated together.
+
+
+File: autogen.info, Node: single-quote-string, Next: simple-string, Prev: double-quote-string, Up: Definitions
+
+2.2.3 Single Quote String
+-------------------------
+
+This is similar to the shell single-quote string. However, escapes `\'
+are honored before another escape, single quotes `'' and hash
+characters `#'. This latter is done specifically to disambiguate lines
+starting with a hash character inside of a quoted string. In other
+words,
+
+ fumble = '
+ #endif
+ ';
+
+ could be misinterpreted by the definitions scanner, whereas this
+would not:
+
+ fumble = '
+ \#endif
+ ';
+
+As with the double quote string, a series of these, even intermixed
+with double quote strings, will be concatenated together.
+
+
+File: autogen.info, Node: simple-string, Next: shell-generated, Prev: single-quote-string, Up: Definitions
+
+2.2.4 An Unquoted String
+------------------------
+
+A simple string that does not contain white space may be left unquoted.
+The string must not contain any of the characters special to the
+definition text (i.e., `"', `#', `'', `(', `)', `,', `;', `<', `=',
+`>', `[', `]', ``', `{', or `}'). This list is subject to change, but
+it will never contain underscore (`_'), period (`.'), slash (`/'),
+colon (`:'), hyphen (`-') or backslash (`\\'). Basically, if the
+string looks like it is a normal DOS or UNIX file or variable name, and
+it is not one of two keywords (`autogen' or `definitions') then it is
+OK to not quote it, otherwise you should.
+
+
+File: autogen.info, Node: shell-generated, Next: scheme-generated, Prev: simple-string, Up: Definitions
+
+2.2.5 Shell Output String
+-------------------------
+
+This is assembled according to the same rules as the double quote
+string, except that there is no concatenation of strings and the
+resulting string is written to a shell server process. The definition
+takes on the value of the output string.
+
+ NB The text is interpreted by a server shell. There may be left over
+state from previous server shell processing. This scriptlet may also
+leave state for subsequent processing. However, a `cd' to the original
+directory is always issued before the new command is issued.
+
+
+File: autogen.info, Node: scheme-generated, Next: here-string, Prev: shell-generated, Up: Definitions
+
+2.2.6 Scheme Result String
+--------------------------
+
+A scheme result string must begin with an open parenthesis `('. The
+scheme expression will be evaluated by Guile and the value will be the
+result. The AutoGen expression functions are *dis*abled at this stage,
+so do not use them.
+
+
+File: autogen.info, Node: here-string, Next: concat-string, Prev: scheme-generated, Up: Definitions
+
+2.2.7 A Here String
+-------------------
+
+A `here string' is formed in much the same way as a shell here doc. It
+is denoted with two less than characters(`<<') and, optionally, a
+hyphen. This is followed by optional horizontal white space and an
+ending marker-identifier. This marker must follow the syntax rules for
+identifiers. Unlike the shell version, however, you must not quote
+this marker.
+
+ The resulting string will start with the first character on the next
+line and continue up to but not including the newline that precedes the
+line that begins with the marker token. The characters are copied
+directly into the result string. Mostly.
+
+ If a hyphen follows the less than characters, then leading tabs will
+be stripped and the terminating marker will be recognized even if
+preceded by tabs. Also, if the first character on the line (after
+removing tabs) is a backslash and the next character a tab, then the
+backslash will be removed as well. No other kind of processing is done
+on this string.
+
+ Here are two examples:
+ str1 = <<- STR_END
+ $quotes = " ' `
+ STR_END;
+
+ str2 = << STR_END
+ $quotes = " ' `
+ STR_END;
+ STR_END;
+ The first string contains no new line characters. The first
+character is the dollar sign, the last the back quote.
+
+ The second string contains one new line character. The first
+character is the tab character preceding the dollar sign. The last
+character is the semicolon after the `STR_END'. That `STR_END' does not
+end the string because it is not at the beginning of the line. In the
+preceding case, the leading tab was stripped.
+
+
+File: autogen.info, Node: concat-string, Prev: here-string, Up: Definitions
+
+2.2.8 Concatenated Strings
+--------------------------
+
+If single or double quote characters are used, then you also have the
+option, a la ANSI-C syntax, of implicitly concatenating a series of
+them together, with intervening white space ignored.
+
+ NB You *cannot* use directives to alter the string content. That
+is,
+
+ str = "fumble"
+ #ifdef LATER
+ "stumble"
+ #endif
+ ;
+
+will result in a syntax error. The preprocessing directives are not
+carried out by the C preprocessor. However,
+
+ str = '"fumble\n"
+ #ifdef LATER
+ " stumble\n"
+ #endif
+ ';
+
+*Will* work. It will enclose the `#ifdef LATER' and `#endif' in the
+string. But it may also wreak havoc with the definition processing
+directives. The hash characters in the first column should be
+disambiguated with an escape `\' or join them with previous lines:
+`"fumble\n#ifdef LATER...'.
+
+
+File: autogen.info, Node: Index Assignments, Next: Dynamic Text, Prev: Definitions, Up: Definitions File
+
+2.3 Assigning an Index to a Definition
+======================================
+
+In AutoGen, every name is implicitly an array of values. When
+assigning values, they are usually implicitly assigned to the next
+highest slot. They can also be specified explicitly:
+
+ mumble[9] = stumble;
+ mumble[0] = grumble;
+
+If, subsequently, you assign a value to `mumble' without an index, its
+index will be `10', not `1'. If indexes are specified, they must not
+cause conflicts.
+
+ `#define'-d names may also be used for index values. This is
+equivalent to the above:
+
+ #define FIRST 0
+ #define LAST 9
+ mumble[LAST] = stumble;
+ mumble[FIRST] = grumble;
+
+ All values in a range do *not* have to be filled in. If you leave
+gaps, then you will have a sparse array. This is fine (*note FOR::).
+You have your choice of iterating over all the defined values, or
+iterating over a range of slots. This:
+
+ [+ FOR mumble +][+ ENDFOR +]
+
+iterates over all and only the defined entries, whereas this:
+
+ [+ FOR mumble (for-by 1) +][+ ENDFOR +]
+
+will iterate over all 10 "slots". Your template will likely have to
+contain something like this:
+
+ [+ IF (exist? (sprintf "mumble[%d]" (for-index))) +]
+
+or else "mumble" will have to be a compound value that, say, always
+contains a "grumble" value:
+
+ [+ IF (exist? "grumble") +]
+
+
+File: autogen.info, Node: Dynamic Text, Next: Directives, Prev: Index Assignments, Up: Definitions File
+
+2.4 Dynamic Text
+================
+
+There are several methods for including dynamic content inside a
+definitions file. Three of them are mentioned above (*note
+shell-generated:: and *note scheme-generated::) in the discussion of
+string formation rules. Another method uses the `#shell' processing
+directive. It will be discussed in the next section (*note
+Directives::). Guile/Scheme may also be used to yield to create
+definitions.
+
+ When the Scheme expression is preceded by a backslash and single
+quote, then the expression is expected to be an alist of names and
+values that will be used to create AutoGen definitions.
+
+This method can be be used as follows:
+
+ \'( (name (value-expression))
+ (name2 (another-expr)) )
+
+This is entirely equivalent to:
+
+ name = (value-expression);
+ name2 = (another-expr);
+
+Under the covers, the expression gets handed off to a Guile function
+named `alist->autogen-def' in an expression that looks like this:
+
+ (alist->autogen-def
+ ( (name (value-expression)) (name2 (another-expr)) ) )
+
+
+File: autogen.info, Node: Directives, Next: Predefines, Prev: Dynamic Text, Up: Definitions File
+
+2.5 Controlling What Gets Processed
+===================================
+
+Definition processing directives can *only* be processed if the '#'
+character is the first character on a line. Also, if you want a '#' as
+the first character of a line in one of your string assignments, you
+should either escape it by preceding it with a backslash `\', or by
+embedding it in the string as in `"\n#"'.
+
+ All of the normal C preprocessing directives are recognized, though
+several are ignored. There is also an additional `#shell' -
+`#endshell' pair. Another minor difference is that AutoGen directives
+must have the hash character (`#') in column 1.
+
+ The final tweak is that `#!' is treated as a comment line. Using
+this feature, you can use: `#! /usr/local/bin/autogen' as the first
+line of a definitions file, set the mode to executable and "run" the
+definitions file as if it were a direct invocation of AutoGen. This
+was done for its hack value.
+
+ The ignored directives are: `#ident', `#let', `#pragma', and `#if'.
+Note that when ignoring the `#if' directive, all intervening text
+through its matching `#endif' is also ignored, including the `#else'
+clause.
+
+ The AutoGen directives that affect the processing of definitions are:
+
+`#assert `shell-script` | (scheme-expr) | <anything else>'
+ If the `shell-script' or `scheme-expr' do not yield `true' valued
+ results, autogen will be aborted. If `<anything else>' or nothing
+ at all is provided, then this directive is ignored.
+
+ When writing the shell script, remember this is on a preprocessing
+ line. Multiple lines must be backslash continued and the result
+ is a single long line. Separate multiple commands with
+ semi-colons.
+
+ The result is `false' (and fails) if the result is empty, the
+ number zero, or a string that starts with the letters 'n' or 'f'
+ ("no" or "false").
+
+`#define name [ <text> ]'
+ Will add the name to the define list as if it were a DEFINE program
+ argument. Its value will be the first non-whitespace token
+ following the name. Quotes are *not* processed.
+
+ After the definitions file has been processed, any remaining
+ entries in the define list will be added to the environment.
+
+`#elif'
+ This must follow an `#if' otherwise it will generate an error. It
+ will be ignored.
+
+`#else'
+ This must follow an `#if', `#ifdef' or `#ifndef'. If it follows
+ the `#if', then it will be ignored. Otherwise, it will change the
+ processing state to the reverse of what it was.
+
+`#endif'
+ This must follow an `#if', `#ifdef' or `#ifndef'. In all cases,
+ this will resume normal processing of text.
+
+`#endmac'
+ This terminates a "macdef", but must not ever be encountered
+ directly.
+
+`#endshell'
+ Ends the text processed by a command shell into autogen
+ definitions.
+
+`#error [ <descriptive text> ]'
+ This directive will cause AutoGen to stop processing and exit with
+ a status of EXIT_FAILURE.
+
+`#if [ <ignored conditional expression> ]'
+ `#if' expressions are not analyzed. *Everything* from here to the
+ matching `#endif' is skipped.
+
+`#ifdef name-to-test'
+ The definitions that follow, up to the matching `#endif' will be
+ processed only if there is a corresponding `-Dname' command line
+ option or if a `#define' of that name has been previously
+ encountered.
+
+`#ifndef name-to-test'
+ The definitions that follow, up to the matching `#endif' will be
+ processed only if there is *not* a corresponding `-Dname' command
+ line option or there was a canceling `-Uname' option.
+
+`#include unadorned-file-name'
+ This directive will insert definitions from another file into the
+ current collection. If the file name is adorned with double
+ quotes or angle brackets (as in a C program), then the include is
+ ignored.
+
+`#line'
+ Alters the current line number and/or file name. You may wish to
+ use this directive if you extract definition source from other
+ files. `getdefs' uses this mechanism so AutoGen will report the
+ correct file and approximate line number of any errors found in
+ extracted definitions.
+
+`#macdef'
+ This is a new AT&T research preprocessing directive. Basically,
+ it is a multi-line #define that may include other preprocessing
+ directives.
+
+`#option opt-name [ <text> ]'
+ This directive will pass the option name and associated text to the
+ AutoOpts optionLoadLine routine (*note libopts-optionLoadLine::).
+ The option text may span multiple lines by continuing them with a
+ backslash. The backslash/newline pair will be replaced with two
+ space characters. This directive may be used to set a search path
+ for locating template files For example, this:
+
+ #option templ-dirs $ENVVAR/dirname
+ will direct autogen to use the `ENVVAR' environment variable to
+ find a directory named `dirname' that (may) contain templates.
+ Since these directories are searched in most recently supplied
+ first order, search directories supplied in this way will be
+ searched before any supplied on the command line.
+
+`#shell'
+ Invokes `$SHELL' or `/bin/sh' on a script that should generate
+ AutoGen definitions. It does this using the same server process
+ that handles the back-quoted ``' text. *CAUTION* let not your
+ `$SHELL' be `csh'.
+
+`#undef name-to-undefine'
+ Will remove any entries from the define list that match the undef
+ name pattern.
+
+
+File: autogen.info, Node: Predefines, Next: Comments, Prev: Directives, Up: Definitions File
+
+2.6 Pre-defined Names
+=====================
+
+When AutoGen starts, it tries to determine several names from the
+operating environment and put them into environment variables for use in
+both `#ifdef' tests in the definitions files and in shell scripts with
+environment variable tests. `__autogen__' is always defined. For
+other names, AutoGen will first try to use the POSIX version of the
+`sysinfo(2)' system call. Failing that, it will try for the POSIX
+`uname(2)' call. If neither is available, then only "`__autogen__'"
+will be inserted into the environment. In all cases, the associated
+names are converted to lower case, surrounded by doubled underscores
+and non-symbol characters are replaced with underscores.
+
+ With Solaris on a sparc platform, `sysinfo(2)' is available. The
+following strings are used:
+
+ * `SI_SYSNAME' (e.g., "__sunos__")
+
+ * `SI_HOSTNAME' (e.g., "__ellen__")
+
+ * `SI_ARCHITECTURE' (e.g., "__sparc__")
+
+ * `SI_HW_PROVIDER' (e.g., "__sun_microsystems__")
+
+ * `SI_PLATFORM' (e.g., "__sun_ultra_5_10__")
+
+ * `SI_MACHINE' (e.g., "__sun4u__")
+
+ For Linux and other operating systems that only support the
+`uname(2)' call, AutoGen will use these values:
+
+ * `sysname' (e.g., "__linux__")
+
+ * `machine' (e.g., "__i586__")
+
+ * `nodename' (e.g., "__bach__")
+
+ By testing these pre-defines in my definitions, you can select
+pieces of the definitions without resorting to writing shell scripts
+that parse the output of `uname(1)'. You can also segregate real C
+code from autogen definitions by testing for "`__autogen__'".
+
+ #ifdef __bach__
+ location = home;
+ #else
+ location = work;
+ #endif
+
+
+File: autogen.info, Node: Comments, Next: Example, Prev: Predefines, Up: Definitions File
+
+2.7 Commenting Your Definitions
+===============================
+
+The definitions file may contain C and C++ style comments.
+
+ /*
+ * This is a comment. It continues for several lines and closes
+ * when the characters '*' and '/' appear together.
+ */
+ // this comment is a single line comment
+
+
+File: autogen.info, Node: Example, Next: Full Syntax, Prev: Comments, Up: Definitions File
+
+2.8 What it all looks like.
+===========================
+
+This is an extended example:
+
+ autogen definitions `template-name';
+ /*
+ * This is a comment that describes what these
+ * definitions are all about.
+ */
+ global = "value for a global text definition.";
+
+ /*
+ * Include a standard set of definitions
+ */
+ #include standards.def
+
+ a_block = {
+ a_field;
+ a_subblock = {
+ sub_name = first;
+ sub_field = "sub value.";
+ };
+
+ #ifdef FEATURE
+ a_subblock = {
+ sub_name = second;
+ };
+ #endif
+
+ };
+
+
+File: autogen.info, Node: Full Syntax, Next: Alternate Definition, Prev: Example, Up: Definitions File
+
+2.9 Finite State Machine Grammar
+================================
+
+The preprocessing directives and comments are not part of the grammar.
+They are handled by the scanner/lexer. The following was extracted
+directly from the generated defParse-fsm.c source file. The "EVT:" is
+the token seen, the "STATE:" is the current state and the entries in
+this table describe the next state and the action to take. Invalid
+transitions were removed from the table.
+
+ dp_trans_table[ DP_STATE_CT ][ DP_EVENT_CT ] = {
+
+ /* STATE 0: DP_ST_INIT */
+ { { DP_ST_NEED_DEF, NULL }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+
+ /* STATE 1: DP_ST_NEED_DEF */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_NEED_TPL, NULL }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+
+ /* STATE 2: DP_ST_NEED_TPL */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_NEED_SEMI, dp_do_tpl_name }, /* EVT: VAR_NAME */
+ { DP_ST_NEED_SEMI, dp_do_tpl_name }, /* EVT: OTHER_NAME */
+ { DP_ST_NEED_SEMI, dp_do_tpl_name }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+
+ /* STATE 3: DP_ST_NEED_SEMI */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_NEED_NAME, NULL }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+
+ /* STATE 4: DP_ST_NEED_NAME */
+ { { DP_ST_NEED_DEF, NULL }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_DONE, dp_do_need_name_end }, /* EVT: End-Of-File */
+ { DP_ST_HAVE_NAME, dp_do_need_name_var_name }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_HAVE_VALUE, dp_do_end_block }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+
+ /* STATE 5: DP_ST_HAVE_NAME */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_NEED_NAME, dp_do_empty_val }, /* EVT: ; */
+ { DP_ST_NEED_VALUE, dp_do_have_name_lit_eq }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_NEED_IDX, NULL }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+
+ /* STATE 6: DP_ST_NEED_VALUE */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_HAVE_VALUE, dp_do_str_value }, /* EVT: VAR_NAME */
+ { DP_ST_HAVE_VALUE, dp_do_str_value }, /* EVT: OTHER_NAME */
+ { DP_ST_HAVE_VALUE, dp_do_str_value }, /* EVT: STRING */
+ { DP_ST_HAVE_VALUE, dp_do_str_value }, /* EVT: HERE_STRING */
+ { DP_ST_HAVE_VALUE, dp_do_str_value }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_NEED_NAME, dp_do_start_block }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+
+ /* STATE 7: DP_ST_NEED_IDX */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_NEED_CBKT, dp_do_indexed_name }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_NEED_CBKT, dp_do_indexed_name }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+
+ /* STATE 8: DP_ST_NEED_CBKT */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INDX_NAME, NULL } /* EVT: ] */
+
+ /* STATE 9: DP_ST_INDX_NAME */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_NEED_NAME, dp_do_empty_val }, /* EVT: ; */
+ { DP_ST_NEED_VALUE, NULL }, /* EVT: = */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+
+ /* STATE 10: DP_ST_HAVE_VALUE */
+ { { DP_ST_INVALID, dp_do_invalid }, /* EVT: AUTOGEN */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: DEFINITIONS */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: End-Of-File */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: VAR_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: OTHER_NAME */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: HERE_STRING */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: NUMBER */
+ { DP_ST_NEED_NAME, NULL }, /* EVT: ; */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: = */
+ { DP_ST_NEED_VALUE, dp_do_next_val }, /* EVT: , */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: { */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: } */
+ { DP_ST_INVALID, dp_do_invalid }, /* EVT: [ */
+ { DP_ST_INVALID, dp_do_invalid } /* EVT: ] */
+
+
+File: autogen.info, Node: Alternate Definition, Prev: Full Syntax, Up: Definitions File
+
+2.10 Alternate Definition Forms
+===============================
+
+There are several methods for supplying data values for templates.
+
+`no definitions'
+ It is entirely possible to write a template that does not depend
+ upon external definitions. Such a template would likely have an
+ unvarying output, but be convenient nonetheless because of an
+ external library of either AutoGen or Scheme functions, or both.
+ This can be accommodated by providing the `--override-tpl' and
+ `--no-definitions' options on the command line. *Note autogen
+ Invocation::.
+
+`CGI'
+ AutoGen behaves as a CGI server if the definitions input is from
+ stdin and the environment variable `REQUEST_METHOD' is defined and
+ set to either "GET" or "POST", *Note AutoGen CGI::. Obviously,
+ all the values are constrained to strings because there is no way
+ to represent nested values.
+
+`XML'
+ AutoGen comes with a program named, `xml2ag'. Its output can
+ either be redirected to a file for later use, or the program can
+ be used as an AutoGen wrapper. *Note xml2ag Invocation::.
+
+ The introductory template example (*note Example Usage::) can be
+ rewritten in XML as follows:
+
+ <EXAMPLE template="list.tpl">
+ <LIST list_element="alpha"
+ list_info="some alpha stuff"/>
+ <LIST list_info="more beta stuff"
+ list_element="beta"/>
+ <LIST list_element="omega"
+ list_info="final omega stuff"/>
+ </EXAMPLE>
+
+ A more XML-normal form might look like this:
+ <EXAMPLE template="list.tpl">
+ <LIST list_element="alpha">some alpha stuff</LIST>
+ <LIST list_element="beta" >more beta stuff</LIST>
+ <LIST list_element="omega">final omega stuff</LIST>
+ </EXAMPLE>
+ but you would have to change the template `list_info' references
+ into `text' references.
+
+`standard AutoGen definitions'
+ Of course. :-)
+
+
+
+File: autogen.info, Node: Template File, Next: Augmenting AutoGen, Prev: Definitions File, Up: Top
+
+3 Template File
+***************
+
+The AutoGen template file defines the content of the output text. It
+is composed of two parts. The first part consists of a pseudo macro
+invocation and commentary. It is followed by the template proper.
+
+ This pseudo macro is special. It is used to identify the file as a
+AutoGen template file, fixing the starting and ending marks for the
+macro invocations in the rest of the file, specifying the list of
+suffixes to be generated by the template and, optionally, the shell to
+use for processing shell commands embedded in the template.
+
+ AutoGen-ing a file consists of copying text from the template to the
+output file until a start macro marker is found. The text from the
+start marker to the end marker constitutes the macro text. AutoGen
+macros may cause sections of the template to be skipped or processed
+several times. The process continues until the end of the template is
+reached. The process is repeated once for each suffix specified in the
+pseudo macro.
+
+ This chapter describes the format of the AutoGen template macros and
+the usage of the AutoGen native macros. Users may augment these by
+defining their own macros, *Note DEFINE::.
+
+* Menu:
+
+* pseudo macro:: Format of the Pseudo Macro
+* naming values:: Naming a value
+* expression syntax:: Macro Expression Syntax
+* AutoGen Functions:: AutoGen Scheme Functions
+* Common Functions:: Common Scheme Functions
+* native macros:: AutoGen Native Macros
+* output controls:: Redirecting Output
+
+
+File: autogen.info, Node: pseudo macro, Next: naming values, Up: Template File
+
+3.1 Format of the Pseudo Macro
+==============================
+
+The pseudo macro is used to tell AutoGen how to process a template. It
+tells autogen:
+
+ 1. The start macro marker. It consists of punctuation characters
+ used to demarcate the start of a macro. It may be up to seven
+ characters long and must be the first non-whitespace characters in
+ the file.
+
+ It is generally a good idea to use some sort of opening bracket in
+ the starting macro and closing bracket in the ending macro (e.g.
+ `{', `(', `[', or even `<' in the starting macro). It helps both
+ visually and with editors capable of finding a balancing
+ parenthesis.
+
+ 2. That start marker must be immediately followed by the identifier
+ strings "AutoGen5" and then "template", though capitalization is
+ not important.
+
+The next several components may be intermingled:
+
+ 3. Zero, one or more suffix specifications tell AutoGen how many
+ times to process the template file. No suffix specifications mean
+ that it is to be processed once and that the generated text is to
+ be written to `stdout'. The current suffix for each pass can be
+ determined with the `(suffix)' scheme function (*note SCM
+ suffix::).
+
+ The suffix specification consists of a sequence of POSIX compliant
+ file name characters and, optionally, an equal sign and a file
+ name formatting specification. That specification may be either
+ an ordinary sequence of file name characters with zero, one or two
+ "%s" formatting sequences in it, or else it may be a Scheme
+ expression that, when evaluated, produces such a string. The
+ Scheme result may not be empty. The two string arguments allowed
+ for that string are the base name of the definition file, and the
+ current suffix (that being the text to the left of the equal
+ sign). (Note: "POSIX compliant file name characters" consist of
+ alphanumerics plus the period (`.'), hyphen (`-') and underscore
+ (`_') characters.)
+
+ If the suffix begins with one of these three latter characters and
+ a formatting string is not specified, then that character is
+ presumed to be the suffix separator. Otherwise, without a
+ specified format string, a single period will separate the suffix
+ from the base name in constructing the output file name.
+
+ 4. Shell specification: to specify that the template was written
+ expecting a particular shell to run the shell commands. By
+ default, the shell used is the autoconf-ed `CONFIG_SHELL'. This
+ will usually be `/bin/sh'. The shell is specified by a hash mark
+ (`#') followed by an exclamation mark (`!') followed by a
+ full-path file name (e.g. `/usr/xpg4/bin/sh' on Solaris):
+ [= Autogen5 Template c
+ #!/usr/xpg4/bin/sh
+ =]
+
+ 5. Comments: blank lines, lines starting with a hash mark (`#') and
+ not specifying a shell, and edit mode markers (text between pairs
+ of `-*-' strings) are all treated as comments.
+
+ 6. Some scheme expressions may be inserted in order to make
+ configuration changes before template processing begins. "before
+ template processing begins" means that there is no current output
+ file, no current suffix and, basically, none of the AutoGen
+ specific functions (*note AutoGen Functions::) may be invoked.
+
+ The scheme expression can also be used, for example, to save a
+ pre-existing output file for later text extraction (*note SCM
+ extract::).
+
+ (shellf "mv -f %1$s.c %1$s.sav" (base-name))
+
+After these must come the end macro marker:
+
+ 6. The punctuation characters used to demarcate the end of a macro.
+ Like the start marker, it must consist of seven or fewer
+ punctuation characters.
+
+ The ending macro marker has a few constraints on its content. Some
+of them are just advisory, though. There is no special check for
+advisory restrictions.
+
+ * It must not begin with a POSIX file name character (hyphen `-',
+ underscore `_' or period `.'), the backslash (`\') or open
+ parenthesis (`('). These are used to identify a suffix
+ specification, indicate Scheme code and trim white space.
+
+ * If it begins with an equal sign, then it must be separated from
+ any suffix specification by white space.
+
+ * The closing marker may not begin with an open parenthesis, as that
+ is used to enclose a scheme expression.
+
+ * It cannot begin with a backslash, as that is used to indicate white
+ space trimming after the end macro mark. If, in the body of the
+ template, you put the backslash character (`\') before the end
+ macro mark, then any white space characters after the mark and
+ through the newline character are trimmed.
+
+ * It is also helpful to avoid using the comment marker (`#'). It
+ might be seen as a comment within the pseudo macro.
+
+ * You should avoid using any of the quote characters double, single
+ or back-quote. It won't confuse AutoGen, but it might well
+ confuse you and/or your editor.
+
+ As an example, assume we want to use `[+' and `+]' as the start and
+end macro markers, and we wish to produce a `.c' and a `.h' file, then
+the pseudo macro might look something like this:
+
+ [+ AutoGen5 template -*- Mode: emacs-mode-of-choice -*-
+ h=chk-%s.h
+ c
+ # make sure we don't use csh:
+ (setenv "SHELL" "/bin/sh") +]
+
+ The template proper starts after the pseudo-macro. The starting
+character is either the first non-whitespace character or the first
+character after the newline that follows the end macro marker.
+
+
+File: autogen.info, Node: naming values, Next: expression syntax, Prev: pseudo macro, Up: Template File
+
+3.2 Naming a value
+==================
+
+When an AutoGen value is specified in a template, it is specified by
+name. The name may be a simple name, or a compound name of several
+components. Since each named value in AutoGen is implicitly an array
+of one or more values, each component may have an index associated with
+it.
+
+It looks like this:
+
+ comp-name-1 . comp-name-2 [ 2 ]
+
+ Note that if there are multiple components to a name, each component
+name is separated by a dot (`.'). Indexes follow a component name,
+enclosed in square brackets (`[' and `]'). The index may be either an
+integer or an integer-valued define name. The first component of the
+name is searched for in the current definition level. If not found,
+higher levels will be searched until either a value is found, or there
+are no more definition levels. Subsequent components of the name must
+be found within the context of the newly-current definition level.
+Also, if the named value is prefixed by a dot (`.'), then the value
+search is started in the current context only. Backtracking into other
+definition levels is prevented.
+
+ If someone rewrites this, I'll incorporate it. :-)
+
+
+File: autogen.info, Node: expression syntax, Next: AutoGen Functions, Prev: naming values, Up: Template File
+
+3.3 Macro Expression Syntax
+===========================
+
+AutoGen has two types of expressions: full expressions and basic ones.
+A full AutoGen expression can appear by itself, or as the argument to
+certain AutoGen built-in macros: CASE, IF, ELIF, INCLUDE, INVOKE
+(explicit invocation, *note INVOKE::), and WHILE. If it appears by
+itself, the result is inserted into the output. If it is an argument
+to one of these macros, the macro code will act on it sensibly.
+
+ You are constrained to basic expressions only when passing arguments
+to user defined macros, *Note DEFINE::.
+
+ The syntax of a full AutoGen expression is:
+
+ [[ <apply-code> ] <value-name> ] [ <basic-expr-1> [ <basic-expr-2> ]]
+
+ How the expression is evaluated depends upon the presence or absence
+of the apply code and value name. The "value name" is the name of an
+AutoGen defined value, or not. If it does not name such a value, the
+expression result is generally the empty string. All expressions must
+contain either a `value-name' or a `basic-expr'.
+
+* Menu:
+
+* apply code:: Apply Code
+* basic expression:: Basic Expression
+
+
+File: autogen.info, Node: apply code, Next: basic expression, Up: expression syntax
+
+3.3.1 Apply Code
+----------------
+
+The "apply code" selected determines the method of evaluating the
+expression. There are five apply codes, including the non-use of an
+apply code.
+
+`no apply code'
+ This is the most common expression type. Expressions of this sort
+ come in three flavors:
+
+ `<value-name>'
+ The result is the value of `value-name', if defined.
+ Otherwise it is the empty string.
+
+ `<basic-expr>'
+ The result of the basic expression is the result of the full
+ expression, *Note basic expression::.
+
+ `<value-name> <basic-expr>'
+ If there is a defined value for `value-name', then the
+ `basic-expr' is evaluated. Otherwise, the result is the
+ empty string.
+
+`% <value-name> <basic-expr>'
+ If `value-name' is defined, use `basic-expr' as a format string
+ for sprintf. Then, if the `basic-expr' is either a back-quoted
+ string or a parenthesized expression, then hand the result to the
+ appropriate interpreter for further evaluation. Otherwise, for
+ single and double quote strings, the result is the result of the
+ sprintf operation. Naturally, if `value-name' is not defined, the
+ result is the empty string.
+
+ For example, assume that `fumble' had the string value, `stumble':
+ [+ % fumble `printf '%%x\\n' $%s` +]
+ This would cause the shell to evaluate "`printf '%x\n' $stumble'".
+ Assuming that the shell variable `stumble' had a numeric value,
+ the expression result would be that number, in hex. Note the need
+ for doubled percent characters and backslashes.
+
+`? <value-name> <basic-expr-1> <basic-expr-2>'
+ Two `basic-expr'-s are required. If the `value-name' is defined,
+ then the first `basic-expr-1' is evaluated, otherwise
+ `basic-expr-2' is.
+
+`- <value-name> <basic-expr>'
+ Evaluate `basic-expr' only if `value-name' is not defined.
+
+`?% <value-name> <basic-expr-1> <basic-expr-2>'
+ This combines the functions of `?' and `%'. If `value-name' is
+ defined, it behaves exactly like `%', above, using `basic-expr-1'.
+ If not defined, then `basic-expr-2' is evaluated.
+
+ For example, assume again that `fumble' had the string value,
+ `stumble':
+ [+ ?% fumble `cat $%s` `pwd` +]
+ This would cause the shell to evaluate "`cat $stumble'". If
+ `fumble' were not defined, then the result would be the name of
+ our current directory.
+
+
+File: autogen.info, Node: basic expression, Prev: apply code, Up: expression syntax
+
+3.3.2 Basic Expression
+----------------------
+
+A basic expression can have one of the following forms:
+
+`'STRING''
+ A single quoted string. Backslashes can be used to protect single
+ quotes (`''), hash characters (`#'), or backslashes (`\') in the
+ string. All other characters of STRING are output as-is when the
+ single quoted string is evaluated. Backslashes are processed
+ before the hash character for consistency with the definition
+ syntax. It is needed there to avoid preprocessing conflicts.
+
+`"STRING"'
+ A double quoted string. This is a cooked text string as in C,
+ except that they are not concatenated with adjacent strings.
+ Evaluating "`STRING'" will output STRING with all backslash
+ sequences interpreted.
+
+``STRING`'
+ A back quoted string. When this expression is evaluated, STRING
+ is first interpreted as a cooked string (as in `"STRING"') and
+ evaluated as a shell expression by the AutoGen server shell. This
+ expression is replaced by the `stdout' output of the shell.
+
+`(STRING)'
+ A parenthesized expression. It will be passed to the Guile
+ interpreter for evaluation and replaced by the resulting value.
+ If there is a Scheme error in this expression, Guile 1.4 and Guile
+ 1.6 will report the template line number where the error occurs.
+ Guile 1.7 has lost this capability.
+
+ Guile has the capability of creating and manipulating variables
+ that can be referenced later on in the template processing. If
+ you define such a variable, it is invisible to AutoGen. To
+ reference its value, you must use a Guile expression. For example,
+ [+ (define my-var "some-string-value") +]
+ can have that string inserted later, but only as in:
+ [+ (. my-var) +]
+
+ Additionally, other than in the `%' and `?%' expressions, the
+ Guile expressions may be introduced with the Guile comment
+ character (`;') and you may put a series of Guile expressions
+ within a single macro. They will be implicitly evaluated as if
+ they were arguments to the `(begin ...)' expression. The result
+ will be the result of the last Guile expression evaluated.
+
+
+File: autogen.info, Node: AutoGen Functions, Next: Common Functions, Prev: expression syntax, Up: Template File
+
+3.4 AutoGen Scheme Functions
+============================
+
+AutoGen uses Guile to interpret Scheme expressions within AutoGen
+macros. All of the normal Guile functions are available, plus several
+extensions (*note Common Functions::) have been added to augment the
+repertoire of string manipulation functions and manage the state of
+AutoGen processing.
+
+ This section describes those functions that are specific to AutoGen.
+Please take note that these AutoGen specific functions are not loaded
+and thus not made available until after the command line options have
+been processed and the AutoGen definitions have been loaded. They may,
+of course, be used in Scheme functions that get defined at those times,
+but they cannot be invoked.
+
+* Menu:
+
+* SCM ag-fprintf:: `ag-fprintf' - format to autogen stream
+* SCM ag-function?:: `ag-function?' - test for function
+* SCM base-name:: `base-name' - base output name
+* SCM chdir:: `chdir' - Change current directory
+* SCM count:: `count' - definition count
+* SCM def-file:: `def-file' - definitions file name
+* SCM def-file-line:: `def-file-line' - get a definition file+line number
+* SCM dne:: `dne' - "Do Not Edit" warning
+* SCM emit:: `emit' - emit the text for each argument
+* SCM emit-string-table:: `emit-string-table' - output a string table
+* SCM error:: `error' - display message and exit
+* SCM exist?:: `exist?' - test for value name
+* SCM find-file:: `find-file' - locate a file in the search path
+* SCM first-for?:: `first-for?' - detect first iteration
+* SCM for-by:: `for-by' - set iteration step
+* SCM for-from:: `for-from' - set initial index
+* SCM for-index:: `for-index' - get current loop index
+* SCM for-sep:: `for-sep' - set loop separation string
+* SCM for-to:: `for-to' - set ending index
+* SCM get:: `get' - get named value
+* SCM get-c-name:: `get-c-name' - get named value, mapped to C name syntax
+* SCM get-down-name:: `get-down-name' - get lower cased named value, mapped to C name syntax
+* SCM get-up-name:: `get-up-name' - get upper cased named value, mapped to C name syntax
+* SCM high-lim:: `high-lim' - get highest value index
+* SCM last-for?:: `last-for?' - detect last iteration
+* SCM len:: `len' - get count of values
+* SCM low-lim:: `low-lim' - get lowest value index
+* SCM make-header-guard:: `make-header-guard' - make self-inclusion guard
+* SCM make-tmp-dir:: `make-tmp-dir' - create a temporary directory
+* SCM match-value?:: `match-value?' - test for matching value
+* SCM out-delete:: `out-delete' - delete current output file
+* SCM out-depth:: `out-depth' - output file stack depth
+* SCM out-emit-suspended:: `out-emit-suspended' - emit the text of suspended output
+* SCM out-line:: `out-line' - output file line number
+* SCM out-move:: `out-move' - change name of output file
+* SCM out-name:: `out-name' - current output file name
+* SCM out-pop:: `out-pop' - close current output file
+* SCM out-push-add:: `out-push-add' - append output to file
+* SCM out-push-new:: `out-push-new' - purge and create output file
+* SCM out-resume:: `out-resume' - resume suspended output file
+* SCM out-suspend:: `out-suspend' - suspend current output file
+* SCM out-switch:: `out-switch' - close and create new output
+* SCM output-file-next-line:: `output-file-next-line' - print the file name and next line number
+* SCM set-option:: `set-option' - Set a command line option
+* SCM set-writable:: `set-writable' - Make the output file be writable
+* SCM stack:: `stack' - make list of AutoGen values
+* SCM stack-join:: `stack-join' - stack values then join them
+* SCM suffix:: `suffix' - get the current suffix
+* SCM tpl-file:: `tpl-file' - get the template file name
+* SCM tpl-file-line:: `tpl-file-line' - get the template file+line number
+* SCM tpl-file-next-line:: `tpl-file-next-line' - get the template file plus next line number
+* SCM autogen-version:: `autogen-version' - ``5.16.2''
+* SCM c-file-line-fmt:: format file info as, ```#line nn "file"'''
+
+
+File: autogen.info, Node: SCM ag-fprintf, Next: SCM ag-function?, Up: AutoGen Functions
+
+3.4.1 `ag-fprintf' - format to autogen stream
+---------------------------------------------
+
+Usage: (ag-fprintf ag-diversion format [ format-arg ... ])
+Format a string using arguments from the alist. Write to a specified
+AutoGen diversion. That may be either a specified suspended output
+stream (*note SCM out-suspend::) or an index into the output stack
+(*note SCM out-push-new::). `(ag-fprintf 0 ...)' is equivalent to
+`(emit (sprintf ...))', and `(ag-fprintf 1 ...)' sends output to the
+most recently suspended output stream.
+
+ Arguments:
+ag-diversion - AutoGen diversion name or number
+format - formatting string
+format-arg - Optional - list of arguments to formatting string
+
+
+File: autogen.info, Node: SCM ag-function?, Next: SCM base-name, Prev: SCM ag-fprintf, Up: AutoGen Functions
+
+3.4.2 `ag-function?' - test for function
+----------------------------------------
+
+Usage: (ag-function? ag-name)
+return SCM_BOOL_T if a specified name is a user-defined AutoGen macro,
+otherwise return SCM_BOOL_F.
+
+ Arguments:
+ag-name - name of AutoGen macro
+
+
+File: autogen.info, Node: SCM base-name, Next: SCM chdir, Prev: SCM ag-function?, Up: AutoGen Functions
+
+3.4.3 `base-name' - base output name
+------------------------------------
+
+Usage: (base-name)
+Returns a string containing the base name of the output file(s).
+Generally, this is also the base name of the definitions file.
+
+ This Scheme function takes no arguments.
+
+
+File: autogen.info, Node: SCM chdir, Next: SCM count, Prev: SCM base-name, Up: AutoGen Functions
+
+3.4.4 `chdir' - Change current directory
+----------------------------------------
+
+Usage: (chdir dir)
+Sets the current directory for AutoGen. Shell commands will run from
+this directory as well. This is a wrapper around the Guile native
+function. It returns its directory name argument and fails the program
+on failure.
+
+ Arguments:
+dir - new directory name
+
+
+File: autogen.info, Node: SCM count, Next: SCM def-file, Prev: SCM chdir, Up: AutoGen Functions
+
+3.4.5 `count' - definition count
+--------------------------------
+
+Usage: (count ag-name)
+Count the number of entries for a definition. The input argument must
+be a string containing the name of the AutoGen values to be counted.
+If there is no value associated with the name, the result is an SCM
+immediate integer value of zero.
+
+ Arguments:
+ag-name - name of AutoGen value
+
+
+File: autogen.info, Node: SCM def-file, Next: SCM def-file-line, Prev: SCM count, Up: AutoGen Functions
+
+3.4.6 `def-file' - definitions file name
+----------------------------------------
+
+Usage: (def-file)
+Get the name of the definitions file. Returns the name of the source
+file containing the AutoGen definitions.
+
+ This Scheme function takes no arguments.
+
+
+File: autogen.info, Node: SCM def-file-line, Next: SCM dne, Prev: SCM def-file, Up: AutoGen Functions
+
+3.4.7 `def-file-line' - get a definition file+line number
+---------------------------------------------------------
+
+Usage: (def-file-line ag-name [ msg-fmt ])
+Returns the file and line number of a AutoGen defined value, using
+either the default format, "from %s line %d", or else the format you
+supply. For example, if you want to insert a "C" language file-line
+directive, you would supply the format "# %2$d \"%1$s\"", but that is
+also already supplied with the scheme variable *Note SCM
+c-file-line-fmt::. You may use it thus:
+
+ (def-file-line "ag-def-name" c-file-line-fmt)
+
+ It is also safe to use the formatting string, "%2$d". AutoGen uses
+an argument vector version of printf: *Note snprintfv::.
+
+ Arguments:
+ag-name - name of AutoGen value
+msg-fmt - Optional - formatting for line message
+
+
+File: autogen.info, Node: SCM dne, Next: SCM emit, Prev: SCM def-file-line, Up: AutoGen Functions
+
+3.4.8 `dne' - "Do Not Edit" warning
+-----------------------------------
+
+Usage: (dne prefix [ first_prefix ] [ optpfx ])
+Generate a "DO NOT EDIT" or "EDIT WITH CARE" warning string. Which
+depends on whether or not the `--writable' command line option was set.
+
+ The first argument may be an option: -d
+
+ This will suppress the variable text (date and version information).
+If specified, then the "prefix" and "first" arguments are shifted to
+the next arguments.
+
+ The first argument is a per-line string prefix. The optional second
+argument is a prefix for the first-line and, in read-only mode,
+activates the editor hints.
+ -*- buffer-read-only: t -*- vi: set ro:
+The warning string also includes information about the template used to
+construct the file and the definitions used in its instantiation.
+
+ The optional third argument is used when the first argument is
+actually an invocation option and the prefix arguments get shifted.
+The first argument must be, specifically, "`-d'". That is used to
+signify that the date stamp should not be inserted into the output.
+
+ Arguments:
+prefix - string for starting each output line
+first_prefix - Optional - for the first output line
+optpfx - Optional - shifted prefix
+
+
+File: autogen.info, Node: SCM emit, Next: SCM emit-string-table, Prev: SCM dne, Up: AutoGen Functions
+
+3.4.9 `emit' - emit the text for each argument
+----------------------------------------------
+
+Usage: (emit alist ...)
+Walk the tree of arguments, displaying the values of displayable SCM
+types. EXCEPTION: if the first argument is a number, then that number
+is used to index the output stack. "0" is the default, the current
+output.
+
+ Arguments:
+alist - list of arguments to stringify and emit
+
+
+File: autogen.info, Node: SCM emit-string-table, Next: SCM error, Prev: SCM emit, Up: AutoGen Functions
+
+3.4.10 `emit-string-table' - output a string table
+--------------------------------------------------
+
+Usage: (emit-string-table st-name)
+Emit into the current output stream a `static char const' array named
+`st-name' that will have `NUL' bytes between each inserted string.
+
+ Arguments:
+st-name - the name of the array of characters
+
+
+File: autogen.info, Node: SCM error, Next: SCM exist?, Prev: SCM emit-string-table, Up: AutoGen Functions
+
+3.4.11 `error' - display message and exit
+-----------------------------------------
+
+Usage: (error message)
+The argument is a string that printed out as part of an error message.
+The message is formed from the formatting string:
+
+ DEFINITIONS ERROR in %s line %d for %s: %s\n
+
+ The first three arguments to this format are provided by the routine
+and are: The name of the template file, the line within the template
+where the error was found, and the current output file name.
+
+ After displaying the message, the current output file is removed and
+autogen exits with the EXIT_FAILURE error code. IF, however, the
+argument begins with the number 0 (zero), or the string is the empty
+string, then processing continues with the next suffix.
+
+ Arguments:
+message - message to display before exiting
+
+
+File: autogen.info, Node: SCM exist?, Next: SCM find-file, Prev: SCM error, Up: AutoGen Functions
+
+3.4.12 `exist?' - test for value name
+-------------------------------------
+
+Usage: (exist? ag-name)
+return SCM_BOOL_T iff a specified name has an AutoGen value. The name
+may include indexes and/or member names. All but the last member name
+must be an aggregate definition. For example:
+ (exist? "foo[3].bar.baz")
+ will yield true if all of the following is true:
+There is a member value of either group or string type named `baz' for
+some group value `bar' that is a member of the `foo' group with index
+`3'. There may be multiple entries of `bar' within `foo', only one
+needs to contain a value for `baz'.
+
+ Arguments:
+ag-name - name of AutoGen value
+
+
+File: autogen.info, Node: SCM find-file, Next: SCM first-for?, Prev: SCM exist?, Up: AutoGen Functions
+
+3.4.13 `find-file' - locate a file in the search path
+-----------------------------------------------------
+
+Usage: (find-file file-name [ suffix ])
+AutoGen has a search path that it uses to locate template and definition
+files. This function will search the same list for `file-name', both
+with and without the `.suffix', if provided.
+
+ Arguments:
+file-name - name of file with text
+suffix - Optional - file suffix to try, too
+
+
+File: autogen.info, Node: SCM first-for?, Next: SCM for-by, Prev: SCM find-file, Up: AutoGen Functions
+
+3.4.14 `first-for?' - detect first iteration
+--------------------------------------------
+
+Usage: (first-for? [ for_var ])
+Returns `SCM_BOOL_T' if the named FOR loop (or, if not named, the
+current innermost loop) is on the first pass through the data. Outside
+of any `FOR' loop, it returns `SCM_UNDEFINED', *note FOR::.
+
+ Arguments:
+for_var - Optional - which for loop
+
+
+File: autogen.info, Node: SCM for-by, Next: SCM for-from, Prev: SCM first-for?, Up: AutoGen Functions
+
+3.4.15 `for-by' - set iteration step
+------------------------------------
+
+Usage: (for-by by)
+This function records the "step by" information for an AutoGen FOR
+function. Outside of the FOR macro itself, this function will emit an
+error. *Note FOR::.
+
+ Arguments:
+by - the iteration increment for the AutoGen FOR macro
+
+
+File: autogen.info, Node: SCM for-from, Next: SCM for-index, Prev: SCM for-by, Up: AutoGen Functions
+
+3.4.16 `for-from' - set initial index
+-------------------------------------
+
+Usage: (for-from from)
+This function records the initial index information for an AutoGen FOR
+function. Outside of the FOR macro itself, this function will emit an
+error. *Note FOR::.
+
+ Arguments:
+from - the initial index for the AutoGen FOR macro
+
+
+File: autogen.info, Node: SCM for-index, Next: SCM for-sep, Prev: SCM for-from, Up: AutoGen Functions
+
+3.4.17 `for-index' - get current loop index
+-------------------------------------------
+
+Usage: (for-index [ for_var ])
+Returns the current index for the named `FOR' loop. If not named, then
+the index for the innermost loop. Outside of any FOR loop, it returns
+`SCM_UNDEFINED', *Note FOR::.
+
+ Arguments:
+for_var - Optional - which for loop
+
+
+File: autogen.info, Node: SCM for-sep, Next: SCM for-to, Prev: SCM for-index, Up: AutoGen Functions
+
+3.4.18 `for-sep' - set loop separation string
+---------------------------------------------
+
+Usage: (for-sep separator)
+This function records the separation string that is to be inserted
+between each iteration of an AutoGen FOR function. This is often
+nothing more than a comma. Outside of the FOR macro itself, this
+function will emit an error.
+
+ Arguments:
+separator - the text to insert between the output of each FOR iteration
+
+
+File: autogen.info, Node: SCM for-to, Next: SCM get, Prev: SCM for-sep, Up: AutoGen Functions
+
+3.4.19 `for-to' - set ending index
+----------------------------------
+
+Usage: (for-to to)
+This function records the terminating value information for an AutoGen
+FOR function. Outside of the FOR macro itself, this function will emit
+an error. *Note FOR::.
+
+ Arguments:
+to - the final index for the AutoGen FOR macro
+
+
+File: autogen.info, Node: SCM get, Next: SCM get-c-name, Prev: SCM for-to, Up: AutoGen Functions
+
+3.4.20 `get' - get named value
+------------------------------
+
+Usage: (get ag-name [ alt-val ])
+Get the first string value associated with the name. It will either
+return the associated string value (if the name resolves), the
+alternate value (if one is provided), or else the empty string.
+
+ Arguments:
+ag-name - name of AutoGen value
+alt-val - Optional - value if not present
+
+
+File: autogen.info, Node: SCM get-c-name, Next: SCM get-down-name, Prev: SCM get, Up: AutoGen Functions
+
+3.4.21 `get-c-name' - get named value, mapped to C name syntax
+--------------------------------------------------------------
+
+Usage: (get-c-name ag-name)
+Get the first string value associated with the name. It will either
+return the associated string value (if the name resolves), the alternate
+value (if one is provided), or else the empty string. The result is
+passed through "string->c-name!".
+
+ Arguments:
+ag-name - name of AutoGen value
+
+
+File: autogen.info, Node: SCM get-down-name, Next: SCM get-up-name, Prev: SCM get-c-name, Up: AutoGen Functions
+
+3.4.22 `get-down-name' - get lower cased named value, mapped to C name syntax
+-----------------------------------------------------------------------------
+
+Usage: (get-down-name ag-name)
+Get the first string value associated with the name. It will either
+return the associated string value (if the name resolves), the alternate
+value (if one is provided), or else the empty string. The result is
+passed through "string->c-name!" and "string->down-case!".
+
+ Arguments:
+ag-name - name of AutoGen value
+
+
+File: autogen.info, Node: SCM get-up-name, Next: SCM high-lim, Prev: SCM get-down-name, Up: AutoGen Functions
+
+3.4.23 `get-up-name' - get upper cased named value, mapped to C name syntax
+---------------------------------------------------------------------------
+
+Usage: (get-up-name ag-name)
+Get the first string value associated with the name. It will either
+return the associated string value (if the name resolves), the alternate
+value (if one is provided), or else the empty string. The result is
+passed through "string->c-name!" and "string->up-case!".
+
+ Arguments:
+ag-name - name of AutoGen value
+
+
+File: autogen.info, Node: SCM high-lim, Next: SCM last-for?, Prev: SCM get-up-name, Up: AutoGen Functions
+
+3.4.24 `high-lim' - get highest value index
+-------------------------------------------
+
+Usage: (high-lim ag-name)
+Returns the highest index associated with an array of definitions.
+This is generally, but not necessarily, one less than the `count'
+value. (The indexes may be specified, rendering a non-zero based or
+sparse array of values.)
+
+ This is very useful for specifying the size of a zero-based array of
+values where not all values are present. For example:
+
+ tMyStruct myVals[ [+ (+ 1 (high-lim "my-val-list")) +] ];
+
+ Arguments:
+ag-name - name of AutoGen value
+
+
+File: autogen.info, Node: SCM last-for?, Next: SCM len, Prev: SCM high-lim, Up: AutoGen Functions
+
+3.4.25 `last-for?' - detect last iteration
+------------------------------------------
+
+Usage: (last-for? [ for_var ])
+Returns SCM_BOOL_T if the named FOR loop (or, if not named, the current
+innermost loop) is on the last pass through the data. Outside of any
+FOR loop, it returns SCM_UNDEFINED. *Note FOR::.
+
+ Arguments:
+for_var - Optional - which for loop
+
+
+File: autogen.info, Node: SCM len, Next: SCM low-lim, Prev: SCM last-for?, Up: AutoGen Functions
+
+3.4.26 `len' - get count of values
+----------------------------------
+
+Usage: (len ag-name)
+If the named object is a group definition, then "len" is the same as
+"count". Otherwise, if it is one or more text definitions, then it is
+the sum of their string lengths. If it is a single text definition,
+then it is equivalent to `(string-length (get "ag-name"))'.
+
+ Arguments:
+ag-name - name of AutoGen value
+
+
+File: autogen.info, Node: SCM low-lim, Next: SCM make-header-guard, Prev: SCM len, Up: AutoGen Functions
+
+3.4.27 `low-lim' - get lowest value index
+-----------------------------------------
+
+Usage: (low-lim ag-name)
+Returns the lowest index associated with an array of definitions.
+
+ Arguments:
+ag-name - name of AutoGen value
+
+
+File: autogen.info, Node: SCM make-header-guard, Next: SCM make-tmp-dir, Prev: SCM low-lim, Up: AutoGen Functions
+
+3.4.28 `make-header-guard' - make self-inclusion guard
+------------------------------------------------------
+
+Usage: (make-header-guard name)
+This function will create a `#ifndef'/`#define' sequence for protecting
+a header from multiple evaluation. It will also set the Scheme
+variable `header-file' to the name of the file being protected and it
+will set `header-guard' to the name of the `#define' being used to
+protect it. It is expected that this will be used as follows:
+ [+ (make-header-guard "group_name") +]
+ ...
+ #endif /* [+ (. header-guard) +] */
+
+ #include "[+ (. header-file) +]"
+ The `#define' name is composed as follows:
+
+ 1. The first element is the string argument and a separating
+ underscore.
+
+ 2. That is followed by the name of the header file with illegal
+ characters mapped to underscores.
+
+ 3. The end of the name is always, "`_GUARD'".
+
+ 4. Finally, the entire string is mapped to upper case.
+
+ The final `#define' name is stored in an SCM symbol named
+`header-guard'. Consequently, the concluding `#endif' for the file
+should read something like:
+
+ #endif /* [+ (. header-guard) +] */
+
+ The name of the header file (the current output file) is also stored
+in an SCM symbol, `header-file'. Therefore, if you are also generating
+a C file that uses the previously generated header file, you can put
+this into that generated file:
+
+ #include "[+ (. header-file) +]"
+
+ Obviously, if you are going to produce more than one header file from
+a particular template, you will need to be careful how these SCM symbols
+get handled.
+
+ Arguments:
+name - header group name
+
+
+File: autogen.info, Node: SCM make-tmp-dir, Next: SCM match-value?, Prev: SCM make-header-guard, Up: AutoGen Functions
+
+3.4.29 `make-tmp-dir' - create a temporary directory
+----------------------------------------------------
+
+Usage: (make-tmp-dir)
+Create a directory that will be cleaned up upon exit.
+
+ This Scheme function takes no arguments.
+
+
+File: autogen.info, Node: SCM match-value?, Next: SCM out-delete, Prev: SCM make-tmp-dir, Up: AutoGen Functions
+
+3.4.30 `match-value?' - test for matching value
+-----------------------------------------------
+
+Usage: (match-value? op ag-name test-str)
+This function answers the question, "Is there an AutoGen value named
+`ag-name' with a value that matches the pattern `test-str' using the
+match function `op'?" Return SCM_BOOL_T iff at least one occurrence of
+the specified name has such a value. The operator can be any function
+that takes two string arguments and yields a boolean. It is expected
+that you will use one of the string matching functions provided by
+AutoGen.
+The value name must follow the same rules as the `ag-name' argument for
+`exist?' (*note SCM exist?::).
+
+ Arguments:
+op - boolean result operator
+ag-name - name of AutoGen value
+test-str - string to test against
+
+
+File: autogen.info, Node: SCM out-delete, Next: SCM out-depth, Prev: SCM match-value?, Up: AutoGen Functions
+
+3.4.31 `out-delete' - delete current output file
+------------------------------------------------
+
+Usage: (out-delete)
+Remove the current output file. Cease processing the template for the
+current suffix. It is an error if there are `push'-ed output files.
+Use the `(error "0")' scheme function instead. *Note output controls::.
+
+ This Scheme function takes no arguments.
+
+
+File: autogen.info, Node: SCM out-depth, Next: SCM out-emit-suspended, Prev: SCM out-delete, Up: AutoGen Functions
+
+3.4.32 `out-depth' - output file stack depth
+--------------------------------------------
+
+Usage: (out-depth)
+Returns the depth of the output file stack. *Note output controls::.
+
+ This Scheme function takes no arguments.
+
+
+File: autogen.info, Node: SCM out-emit-suspended, Next: SCM out-line, Prev: SCM out-depth, Up: AutoGen Functions
+
+3.4.33 `out-emit-suspended' - emit the text of suspended output
+---------------------------------------------------------------
+
+Usage: (out-emit-suspended susp_nm)
+This function is equivalent to `(begin (out-resume <name>) (out-pop
+#t))'
+
+ Arguments:
+susp_nm - A name tag of suspended output
+
+
+File: autogen.info, Node: SCM out-line, Next: SCM out-move, Prev: SCM out-emit-suspended, Up: AutoGen Functions
+
+3.4.34 `out-line' - output file line number
+-------------------------------------------
+
+Usage: (out-line)
+Returns the current line number of the output file. It rewinds and
+reads the file to count newlines.
+
+ This Scheme function takes no arguments.
+
+
+File: autogen.info, Node: SCM out-move, Next: SCM out-name, Prev: SCM out-line, Up: AutoGen Functions
+
+3.4.35 `out-move' - change name of output file
+----------------------------------------------
+
+Usage: (out-move new-name)
+Rename current output file. *Note output controls::. Please note:
+changing the name will not save a temporary file from being deleted.
+It may, however, be used on the root output file.
+
+ Arguments:
+new-name - new name for the current output file
+
+
+File: autogen.info, Node: SCM out-name, Next: SCM out-pop, Prev: SCM out-move, Up: AutoGen Functions
+
+3.4.36 `out-name' - current output file name
+--------------------------------------------
+
+Usage: (out-name)
+Returns the name of the current output file. If the current file is a
+temporary, unnamed file, then it will scan up the chain until a real
+output file name is found. *Note output controls::.
+
+ This Scheme function takes no arguments.
+
+
+File: autogen.info, Node: SCM out-pop, Next: SCM out-push-add, Prev: SCM out-name, Up: AutoGen Functions
+
+3.4.37 `out-pop' - close current output file
+--------------------------------------------
+
+Usage: (out-pop [ disp ])
+If there has been a `push' on the output, then close that file and go
+back to the previously open file. It is an error if there has not been
+a `push'. *Note output controls::.
+
+ If there is no argument, no further action is taken. Otherwise, the
+argument should be `#t' and the contents of the file are returned by
+the function.
+
+ Arguments:
+disp - Optional - return contents of the file
+
+
+File: autogen.info, Node: SCM out-push-add, Next: SCM out-push-new, Prev: SCM out-pop, Up: AutoGen Functions
+
+3.4.38 `out-push-add' - append output to file
+---------------------------------------------
+
+Usage: (out-push-add file-name)
+Identical to `push-new', except the contents are *not* purged, but
+appended to. *Note output controls::.
+
+ Arguments:
+file-name - name of the file to append text to
+
+
+File: autogen.info, Node: SCM out-push-new, Next: SCM out-resume, Prev: SCM out-push-add, Up: AutoGen Functions
+
+3.4.39 `out-push-new' - purge and create output file
+----------------------------------------------------
+
+Usage: (out-push-new [ file-name ])
+Leave the current output file open, but purge and create a new file
+that will remain open until a `pop' `delete' or `switch' closes it.
+The file name is optional and, if omitted, the output will be sent to a
+temporary file that will be deleted when it is closed. *Note output
+controls::.
+
+ Arguments:
+file-name - Optional - name of the file to create
+
+
+File: autogen.info, Node: SCM out-resume, Next: SCM out-suspend, Prev: SCM out-push-new, Up: AutoGen Functions
+
+3.4.40 `out-resume' - resume suspended output file
+--------------------------------------------------
+
+Usage: (out-resume susp_nm)
+If there has been a suspended output, then make that output descriptor
+current again. That output must have been suspended with the same tag
+name given to this routine as its argument.
+
+ Arguments:
+susp_nm - A name tag for reactivating
+
+
+File: autogen.info, Node: SCM out-suspend, Next: SCM out-switch, Prev: SCM out-resume, Up: AutoGen Functions
+
+3.4.41 `out-suspend' - suspend current output file
+--------------------------------------------------
+
+Usage: (out-suspend suspName)
+If there has been a `push' on the output, then set aside the output
+descriptor for later reactiviation with `(out-resume "xxx")'. The tag
+name need not reflect the name of the output file. In fact, the output
+file may be an anonymous temporary file. You may also change the tag
+every time you suspend output to a file, because the tag names are
+forgotten as soon as the file has been "resumed".
+
+ Arguments:
+suspName - A name tag for reactivating
+
+
+File: autogen.info, Node: SCM out-switch, Next: SCM output-file-next-line, Prev: SCM out-suspend, Up: AutoGen Functions
+
+3.4.42 `out-switch' - close and create new output
+-------------------------------------------------
+
+Usage: (out-switch file-name)
+Switch output files - close current file and make the current file
+pointer refer to the new file. This is equivalent to `out-pop'
+followed by `out-push-new', except that you may not pop the base level
+output file, but you may `switch' it. *Note output controls::.
+
+ Arguments:
+file-name - name of the file to create
+
+
+File: autogen.info, Node: SCM output-file-next-line, Next: SCM set-option, Prev: SCM out-switch, Up: AutoGen Functions
+
+3.4.43 `output-file-next-line' - print the file name and next line number
+-------------------------------------------------------------------------
+
+Usage: (output-file-next-line [ line_off ] [ alt_fmt ])
+Returns a string with the current output file name and line number.
+The default format is: # <line+1> "<output-file-name>" The argument may
+be either a number indicating an offset from the current output line
+number or an alternate formatting string. If both are provided, then
+the first must be a numeric offset.
+
+ Be careful that you are directing output to the final output file.
+Otherwise, you will get the file name and line number of the temporary
+file. That won't be what you want.
+
+ Arguments:
+line_off - Optional - offset to line number
+alt_fmt - Optional - alternate format string
+
+
+File: autogen.info, Node: SCM set-option, Next: SCM set-writable, Prev: SCM output-file-next-line, Up: AutoGen Functions
+
+3.4.44 `set-option' - Set a command line option
+-----------------------------------------------
+
+Usage: (set-option opt)
+The text argument must be an option name followed by any needed option
+argument. Returns SCM_UNDEFINED.
+
+ Arguments:
+opt - AutoGen option name + its argument
+
+
+File: autogen.info, Node: SCM set-writable, Next: SCM stack, Prev: SCM set-option, Up: AutoGen Functions
+
+3.4.45 `set-writable' - Make the output file be writable
+--------------------------------------------------------
+
+Usage: (set-writable [ set? ])
+This function will set the current output file to be writable (or not).
+This is only effective if neither the `--writable' nor `--not-writable'
+have been specified. This state is reset when the current suffix's
+output is complete.
+
+ Arguments:
+set? - Optional - boolean arg, false to make output non-writable
+
+
+File: autogen.info, Node: SCM stack, Next: SCM stack-join, Prev: SCM set-writable, Up: AutoGen Functions
+
+3.4.46 `stack' - make list of AutoGen values
+--------------------------------------------
+
+Usage: (stack ag-name)
+Create a scheme list of all the strings that are associated with a
+name. They must all be text values or we choke.
+
+ Arguments:
+ag-name - AutoGen value name
+
+
+File: autogen.info, Node: SCM stack-join, Next: SCM suffix, Prev: SCM stack, Up: AutoGen Functions
+
+3.4.47 `stack-join' - stack values then join them
+-------------------------------------------------
+
+Usage: (stack-join join ag-name)
+This function will collect all the values named `ag-name' (see the
+*note stack function: SCM stack.) and join them separated by the `join'
+string (see the *note join function: SCM join.).
+
+ Arguments:
+join - string between each element
+ag-name - name of autogen values to stack
+
+
+File: autogen.info, Node: SCM suffix, Next: SCM tpl-file, Prev: SCM stack-join, Up: AutoGen Functions
+
+3.4.48 `suffix' - get the current suffix
+----------------------------------------
+
+Usage: (suffix)
+Returns the current active suffix (*note pseudo macro::).
+
+ This Scheme function takes no arguments.
+
+
+File: autogen.info, Node: SCM tpl-file, Next: SCM tpl-file-line, Prev: SCM suffix, Up: AutoGen Functions
+
+3.4.49 `tpl-file' - get the template file name
+----------------------------------------------
+
+Usage: (tpl-file [ full_path ])
+Returns the name of the current template file. If `#t' is passed in as
+an argument, then the template file is hunted for in the template
+search path. Otherwise, just the unadorned name.
+
+ Arguments:
+full_path - Optional - include full path to file
+
+
+File: autogen.info, Node: SCM tpl-file-line, Next: SCM tpl-file-next-line, Prev: SCM tpl-file, Up: AutoGen Functions
+
+3.4.50 `tpl-file-line' - get the template file+line number
+----------------------------------------------------------
+
+Usage: (tpl-file-line [ msg-fmt ])
+Returns the file and line number of the current template macro using
+either the default format, "from %s line %d", or else the format you
+supply. For example, if you want to insert a "C" language file-line
+directive, you would supply the format "# %2$d \"%1$s\"", but that is
+also already supplied with the scheme variable *Note SCM
+c-file-line-fmt::. You may use it thus:
+ (tpl-file-line c-file-line-fmt)
+
+ It is also safe to use the formatting string, "%2$d". AutoGen uses
+an argument vector version of printf: *Note snprintfv::, and it does
+not need to know the types of each argument in order to skip forward to
+the second argument.
+
+ Arguments:
+msg-fmt - Optional - formatting for line message
+
+
+File: autogen.info, Node: SCM tpl-file-next-line, Next: SCM autogen-version, Prev: SCM tpl-file-line, Up: AutoGen Functions
+
+3.4.51 `tpl-file-next-line' - get the template file plus next line number
+-------------------------------------------------------------------------
+
+Usage: (tpl-file-next-line [ msg-fmt ])
+This is almost the same as *Note SCM tpl-file-line::, except that the
+line referenced is the next line, per C compiler conventions, and
+consequently defaults to the format: # <line-no+1> "<file-name>"
+
+ Arguments:
+msg-fmt - Optional - formatting for line message
+
+
+File: autogen.info, Node: SCM autogen-version, Next: SCM c-file-line-fmt, Prev: SCM tpl-file-next-line, Up: AutoGen Functions
+
+3.4.52 `autogen-version' - autogen version number
+-------------------------------------------------
+
+This is a symbol defining the current AutoGen version number string.
+It was first defined in AutoGen-5.2.14. It is currently "5.16.2".
+
+
+File: autogen.info, Node: SCM c-file-line-fmt, Prev: SCM autogen-version, Up: AutoGen Functions
+
+3.4.53 format file info as, "`#line nn "file"'"
+-----------------------------------------------
+
+This is a symbol that can easily be used with the functions *Note SCM
+tpl-file-line::, and *Note SCM def-file-line::. These will emit C
+program `#line' directives pointing to template and definitions text,
+respectively.
+
+
+File: autogen.info, Node: Common Functions, Next: native macros, Prev: AutoGen Functions, Up: Template File
+
+3.5 Common Scheme Functions
+===========================
+
+This section describes a number of general purpose functions that make
+the kind of string processing that AutoGen does a little easier.
+Unlike the AutoGen specific functions (*note AutoGen Functions::),
+these functions are available for direct use during definition load
+time. The equality test (*note SCM =::) is "overloaded" to do string
+equivalence comparisons. If you are looking for inequality, the
+Scheme/Lisp way of spelling that is, "(not (= ...))".
+
+* Menu:
+
+* SCM agpl:: `agpl' - GNU Affero General Public License
+* SCM bsd:: `bsd' - BSD Public License
+* SCM c-string:: `c-string' - emit string for ANSI C
+* SCM error-source-line:: `error-source-line' - display of file & line
+* SCM extract:: `extract' - extract text from another file
+* SCM format-arg-count:: `format-arg-count' - count the args to a format
+* SCM fprintf:: `fprintf' - format to a file
+* SCM gperf:: `gperf' - perform a perfect hash function
+* SCM gperf-code:: `gperf-code' - emit the source of the generated gperf program
+* SCM gpl:: `gpl' - GNU General Public License
+* SCM hide-email:: `hide-email' - convert eaddr to javascript
+* SCM html-escape-encode:: `html-escape-encode' - encode html special characters
+* SCM in?:: `in?' - test for string in list
+* SCM join:: `join' - join string list with separator
+* SCM kr-string:: `kr-string' - emit string for K&R C
+* SCM lgpl:: `lgpl' - GNU Library General Public License
+* SCM license:: `license' - an arbitrary license
+* SCM license-description:: `license-description' - Emit a license description
+* SCM license-full:: `license-full' - Emit the licensing information and description
+* SCM license-info:: `license-info' - Emit the licensing information and copyright years
+* SCM license-name:: `license-name' - Emit the name of the license
+* SCM make-gperf:: `make-gperf' - build a perfect hash function program
+* SCM makefile-script:: `makefile-script' - create makefile script
+* SCM max:: `max' - maximum value in list
+* SCM min:: `min' - minimum value in list
+* SCM prefix:: `prefix' - prefix lines with a string
+* SCM printf:: `printf' - format to stdout
+* SCM raw-shell-str:: `raw-shell-str' - single quote shell string
+* SCM shell:: `shell' - invoke a shell script
+* SCM shell-str:: `shell-str' - double quote shell string
+* SCM shellf:: `shellf' - format a string, run shell
+* SCM sprintf:: `sprintf' - format a string
+* SCM string-capitalize:: `string-capitalize' - capitalize a new string
+* SCM string-capitalize!:: `string-capitalize!' - capitalize a string
+* SCM *=*:: `string-contains-eqv?' - caseless substring
+* SCM *==*:: `string-contains?' - substring match
+* SCM string-downcase:: `string-downcase' - lower case a new string
+* SCM string-downcase!:: `string-downcase!' - make a string be lower case
+* SCM *~:: `string-end-eqv-match?' - caseless regex ending
+* SCM *~~:: `string-end-match?' - regex match end
+* SCM *=:: `string-ends-eqv?' - caseless string ending
+* SCM *==:: `string-ends-with?' - string ending
+* SCM ==:: `string-equals?' - string matching
+* SCM ~:: `string-eqv-match?' - caseless regex match
+* SCM =:: `string-eqv?' - caseless match
+* SCM *~*:: `string-has-eqv-match?' - caseless regex contains
+* SCM *~~*:: `string-has-match?' - contained regex match
+* SCM ~~:: `string-match?' - regex match
+* SCM ~*:: `string-start-eqv-match?' - caseless regex start
+* SCM ~~*:: `string-start-match?' - regex match start
+* SCM =*:: `string-starts-eqv?' - caseless string start
+* SCM ==*:: `string-starts-with?' - string starting
+* SCM string-substitute:: `string-substitute' - multiple global replacements
+* SCM string-table-add:: `string-table-add' - Add an entry to a string table
+* SCM string-table-add-ref:: `string-table-add-ref' - Add an entry to a string table, get reference
+* SCM string-table-new:: `string-table-new' - create a string table
+* SCM string-table-size:: `string-table-size' - print the current size of a string table
+* SCM string->c-name!:: `string->c-name!' - map non-name chars to underscore
+* SCM string->camelcase:: `string->camelcase' - make a string be CamelCase
+* SCM string-tr:: `string-tr' - convert characters with new result
+* SCM string-tr!:: `string-tr!' - convert characters
+* SCM string-upcase:: `string-upcase' - upper case a new string
+* SCM string-upcase!:: `string-upcase!' - make a string be upper case
+* SCM sub-shell-str:: `sub-shell-str' - back quoted (sub-)shell string
+* SCM sum:: `sum' - sum of values in list
+* SCM time-string->number:: `time-string->number' - duration string to seconds
+* SCM version-compare:: `version-compare' - compare two version numbers
+
+
+File: autogen.info, Node: SCM agpl, Next: SCM bsd, Up: Common Functions
+
+3.5.1 `agpl' - GNU Affero General Public License
+------------------------------------------------
+
+Usage: (agpl prog-name prefix)
+Emit a string that contains the GNU Affero General Public License.
+This function is now deprecated. Please *Note SCM
+license-description::.
+
+ Arguments:
+prog-name - name of the program under the GPL
+prefix - String for starting each output line
+
+
+File: autogen.info, Node: SCM bsd, Next: SCM c-string, Prev: SCM agpl, Up: Common Functions
+
+3.5.2 `bsd' - BSD Public License
+--------------------------------
+
+Usage: (bsd prog_name owner prefix)
+Emit a string that contains the Free BSD Public License. This function
+is now deprecated. Please *Note SCM license-description::.
+
+ Arguments:
+prog_name - name of the program under the BSD
+owner - Grantor of the BSD License
+prefix - String for starting each output line
+
+
+File: autogen.info, Node: SCM c-string, Next: SCM error-source-line, Prev: SCM bsd, Up: Common Functions
+
+3.5.3 `c-string' - emit string for ANSI C
+-----------------------------------------
+
+Usage: (c-string string)
+Reform a string so that, when printed, the C compiler will be able to
+compile the data and construct a string that contains exactly what the
+current string contains. Many non-printing characters are replaced with
+escape sequences. Newlines are replaced with a backslash, an `n', a
+closing quote, a newline, seven spaces and another re-opening quote.
+The compiler will implicitly concatenate them. The reader will see line
+breaks.
+
+ A K&R compiler will choke. Use `kr-string' for that compiler.
+
+ Arguments:
+string - string to reformat
+
+
+File: autogen.info, Node: SCM error-source-line, Next: SCM extract, Prev: SCM c-string, Up: Common Functions
+
+3.5.4 `error-source-line' - display of file & line
+--------------------------------------------------
+
+Usage: (error-source-line)
+This function is only invoked just before Guile displays an error
+message. It displays the file name and line number that triggered the
+evaluation error. You should not need to invoke this routine directly.
+Guile will do it automatically.
+
+ This Scheme function takes no arguments.
+
+
+File: autogen.info, Node: SCM extract, Next: SCM format-arg-count, Prev: SCM error-source-line, Up: Common Functions
+
+3.5.5 `extract' - extract text from another file
+------------------------------------------------
+
+Usage: (extract file-name marker-fmt [ caveat ] [ default ])
+This function is used to help construct output files that may contain
+text that is carried from one version of the output to the next.
+
+ The first two arguments are required, the second are optional:
+
+ * The `file-name' argument is used to name the file that contains
+ the demarcated text.
+
+ * The `marker-fmt' is a formatting string that is used to construct
+ the starting and ending demarcation strings. The sprintf function
+ is given the `marker-fmt' with two arguments. The first is either
+ "START" or "END". The second is either "DO NOT CHANGE THIS
+ COMMENT" or the optional `caveat' argument.
+
+ * `caveat' is presumed to be absent if it is the empty string
+ (`""'). If absent, "DO NOT CHANGE THIS COMMENT" is used as the
+ second string argument to the `marker-fmt'.
+
+ * When a `default' argument is supplied and no pre-existing text is
+ found, then this text will be inserted between the START and END
+ markers.
+
+The resulting strings are presumed to be unique within the subject
+file. As a simplified example:
+
+ [+ (extract "fname" "// %s - SOMETHING - %s" ""
+ "example default") +]
+ will result in the following text being inserted into the output:
+
+ // START - SOMETHING - DO NOT CHANGE THIS COMMENT
+ example default
+ // END - SOMETHING - DO NOT CHANGE THIS COMMENT
+
+The "`example default'" string can then be carried forward to the next
+generation of the output, *provided* the output is not named "`fname'"
+and the old output is renamed to "`fname'" before AutoGen-eration
+begins.
+
+*NB:*
+ You can set aside previously generated source files inside the
+ pseudo macro with a Guile/scheme function, extract the text you
+ want to keep with this extract function. Just remember you should
+ delete it at the end, too. Here is an example from my Finite
+ State Machine generator:
+
+ [+ AutoGen5 Template -*- Mode: text -*-
+ h=%s-fsm.h c=%s-fsm.c
+ (shellf
+ "test -f %1$s-fsm.h && mv -f %1$s-fsm.h .fsm.head
+ test -f %1$s-fsm.c && mv -f %1$s-fsm.c .fsm.code" (base-name))
+ +]
+
+ This code will move the two previously produced output files to
+ files named ".fsm.head" and ".fsm.code". At the end of the 'c'
+ output processing, I delete them.
+
+*also NB:*
+ This function presumes that the output file ought to be editable so
+ that the code between the `START' and `END' marks can be edited by
+ the template user. Consequently, when the `(extract ...)' function
+ is invoked, if the `writable' option has not been specified, then
+ it will be set at that point. If this is not the desired
+ behavior, the `--not-writable' command line option will override
+ this. Also, you may use the guile function `(chmod "file"
+ mode-value)' to override whatever AutoGen is using for the result
+ mode.
+
+ Arguments:
+file-name - name of file with text
+marker-fmt - format for marker text
+caveat - Optional - warn about changing marker
+default - Optional - default initial text
+
+
+File: autogen.info, Node: SCM format-arg-count, Next: SCM fprintf, Prev: SCM extract, Up: Common Functions
+
+3.5.6 `format-arg-count' - count the args to a format
+-----------------------------------------------------
+
+Usage: (format-arg-count format)
+Sometimes, it is useful to simply be able to figure out how many
+arguments are required by a format string. For example, if you are
+extracting a format string for the purpose of generating a macro to
+invoke a printf-like function, you can run the formatting string
+through this function to determine how many arguments to provide for in
+the macro. e.g. for this extraction text:
+
+ /*=fumble bumble
+ * fmt: 'stumble %s: %d\n'
+ =*/
+
+You may wish to generate a macro:
+
+ #define BUMBLE(a1,a2) printf_like(something,(a1),(a2))
+
+You can do this by knowing that the format needs two arguments.
+
+ Arguments:
+format - formatting string
+
+
+File: autogen.info, Node: SCM fprintf, Next: SCM gperf, Prev: SCM format-arg-count, Up: Common Functions
+
+3.5.7 `fprintf' - format to a file
+----------------------------------
+
+Usage: (fprintf port format [ format-arg ... ])
+Format a string using arguments from the alist. Write to a specified
+port. The result will NOT appear in your output. Use this to print
+information messages to a template user.
+
+ Arguments:
+port - Guile-scheme output port
+format - formatting string
+format-arg - Optional - list of arguments to formatting string
+
+
+File: autogen.info, Node: SCM gperf, Next: SCM gperf-code, Prev: SCM fprintf, Up: Common Functions
+
+3.5.8 `gperf' - perform a perfect hash function
+-----------------------------------------------
+
+Usage: (gperf name str)
+Perform the perfect hash on the input string. This is only useful if
+you have previously created a gperf program with the `make-gperf'
+function *Note SCM make-gperf::. The `name' you supply here must match
+the name used to create the program and the string to hash must be one
+of the strings supplied in the `make-gperf' string list. The result
+will be a perfect hash index.
+
+ See the documentation for `gperf(1GNU)' for more details.
+
+ Arguments:
+name - name of hash list
+str - string to hash
+
+
+File: autogen.info, Node: SCM gperf-code, Next: SCM gpl, Prev: SCM gperf, Up: Common Functions
+
+3.5.9 `gperf-code' - emit the source of the generated gperf program
+-------------------------------------------------------------------
+
+Usage: (gperf-code st-name)
+Returns the contents of the emitted code, suitable for inclusion in
+another program. The interface contains the following elements:
+
+`struct <st-name>_index'
+ containg the fields: `{char const * name, int const id; };'
+
+`<st-name>_hash()'
+ This is the hashing function with local only scope (static).
+
+`<st-name>_find()'
+ This is the searching and validation function. The first argument
+ is the string to look up, the second is its length. It returns a
+ pointer to the corresponding `<st-name>_index' entry.
+
+ Use this in your template as follows where "<st-name>" was set to be
+"`lookup'":
+
+ [+ (make-gperf "lookup" (join "\n" (stack "name_list")))
+ (gperf-code "lookup") +]
+ void my_fun(char * str) {
+ struct lookup_index * li = lookup_find(str, strlen(str));
+ if (li != NULL) printf("%s yields %d\n", str, li->idx);
+
+ Arguments:
+st-name - the name of the gperf hash list
+
+
+File: autogen.info, Node: SCM gpl, Next: SCM hide-email, Prev: SCM gperf-code, Up: Common Functions
+
+3.5.10 `gpl' - GNU General Public License
+-----------------------------------------
+
+Usage: (gpl prog-name prefix)
+Emit a string that contains the GNU General Public License. This
+function is now deprecated. Please *Note SCM license-description::.
+
+ Arguments:
+prog-name - name of the program under the GPL
+prefix - String for starting each output line
+
+
+File: autogen.info, Node: SCM hide-email, Next: SCM html-escape-encode, Prev: SCM gpl, Up: Common Functions
+
+3.5.11 `hide-email' - convert eaddr to javascript
+-------------------------------------------------
+
+Usage: (hide-email display eaddr)
+Hides an email address as a java scriptlett. The 'mailto:' tag and the
+email address are coded bytes rather than plain text. They are also
+broken up.
+
+ Arguments:
+display - display text
+eaddr - email address
+
+
+File: autogen.info, Node: SCM html-escape-encode, Next: SCM in?, Prev: SCM hide-email, Up: Common Functions
+
+3.5.12 `html-escape-encode' - encode html special characters
+------------------------------------------------------------
+
+Usage: (html-escape-encode str)
+This function will replace replace the characters `'&'', `'<'' and
+`'>'' characters with the HTML/XML escape-encoded strings (`"&amp;"',
+`"&lt;"', and `"&gt;"', respectively).
+
+ Arguments:
+str - string to make substitutions in
+
+
+File: autogen.info, Node: SCM in?, Next: SCM join, Prev: SCM html-escape-encode, Up: Common Functions
+
+3.5.13 `in?' - test for string in list
+--------------------------------------
+
+Usage: (in? test-string string-list ...)
+Return SCM_BOOL_T if the first argument string is found in one of the
+entries in the second (list-of-strings) argument.
+
+ Arguments:
+test-string - string to look for
+string-list - list of strings to check
+
+
+File: autogen.info, Node: SCM join, Next: SCM kr-string, Prev: SCM in?, Up: Common Functions
+
+3.5.14 `join' - join string list with separator
+-----------------------------------------------
+
+Usage: (join separator list ...)
+With the first argument as the separator string, joins together an
+a-list of strings into one long string. The list may contain nested
+lists, partly because you cannot always control that.
+
+ Arguments:
+separator - string to insert between entries
+list - list of strings to join
+
+
+File: autogen.info, Node: SCM kr-string, Next: SCM lgpl, Prev: SCM join, Up: Common Functions
+
+3.5.15 `kr-string' - emit string for K&R C
+------------------------------------------
+
+Usage: (kr-string string)
+Reform a string so that, when printed, a K&R C compiler will be able to
+compile the data and construct a string that contains exactly what the
+current string contains. Many non-printing characters are replaced
+with escape sequences. New-lines are replaced with a
+backslash-n-backslash and newline sequence,
+
+ Arguments:
+string - string to reformat
+
+
+File: autogen.info, Node: SCM lgpl, Next: SCM license, Prev: SCM kr-string, Up: Common Functions
+
+3.5.16 `lgpl' - GNU Library General Public License
+--------------------------------------------------
+
+Usage: (lgpl prog_name owner prefix)
+Emit a string that contains the GNU Library General Public License.
+This function is now deprecated. Please *Note SCM
+license-description::.
+
+ Arguments:
+prog_name - name of the program under the LGPL
+owner - Grantor of the LGPL
+prefix - String for starting each output line
+
+
+File: autogen.info, Node: SCM license, Next: SCM license-description, Prev: SCM lgpl, Up: Common Functions
+
+3.5.17 `license' - an arbitrary license
+---------------------------------------
+
+Usage: (license lic_name prog_name owner prefix)
+Emit a string that contains the named license. This function is now
+deprecated. Please *Note SCM license-description::.
+
+ Arguments:
+lic_name - file name of the license
+prog_name - name of the licensed program or library
+owner - Grantor of the License
+prefix - String for starting each output line
+
+
+File: autogen.info, Node: SCM license-description, Next: SCM license-full, Prev: SCM license, Up: Common Functions
+
+3.5.18 `license-description' - Emit a license description
+---------------------------------------------------------
+
+Usage: (license-description license prog-name prefix [ owner ])
+Emit a string that contains a detailed license description, with
+substitutions for program name, copyright holder and a per-line prefix.
+This is the text typically used as part of a source file header. For
+more details, *Note the license-full command: SCM license-full.
+
+ Arguments:
+license - name of license type
+prog-name - name of the program under the GPL
+prefix - String for starting each output line
+owner - Optional - owner of the program
+
+
+File: autogen.info, Node: SCM license-full, Next: SCM license-info, Prev: SCM license-description, Up: Common Functions
+
+3.5.19 `license-full' - Emit the licensing information and description
+----------------------------------------------------------------------
+
+Usage: (license-full license prog-name prefix [ owner ] [ years ])
+Emit all the text that `license-info' and `license-description' would
+emit (*note `license-info': SCM license-info, and *note
+`license-description': SCM license-description.), with all the same
+substitutions.
+
+ All of these depend upon the existence of a license file named after
+the `license' argument with a `.lic' suffix. That file should contain
+three blocks of text, each separated by two or more newline characters.
+
+ The first section describes copyright attribution and the name of
+the usage licence. For GNU software, this should be the text that is
+to be displayed with the program version. Four text markers can be
+replaced: <PFX>, <program>, <years> and <owner>.
+
+ The second section is a short description of the terms of the
+license. This is typically the kind of text that gets displayed in the
+header of source files. The third section is strictly the name of the
+license without any substitution markers. Only the <PFX>, <owner> and
+<program> markers are substituted.
+
+ The third section is strictly the name of the license. No marker
+substitutions are performed.
+
+ <PFX>Copyright (C) <years> <owner>, all rights reserved.
+ <PFX>This is free software. It is licensed for use,
+ <PFX>modification and redistribution under the terms
+ <PFX>of the GNU General Public License, version 3 or later
+ <PFX> <http://gnu.org/licenses/gpl.html>
+
+ <PFX><program> is free software: you can redistribute it
+ <PFX>and/or modify it under the terms of the GNU General
+ <PFX>Public License as published by the Free Software ...
+
+ the GNU General Public License, version 3 or later
+
+ Arguments:
+license - name of license type
+prog-name - name of the program under the GPL
+prefix - String for starting each output line
+owner - Optional - owner of the program
+years - Optional - copyright years
+
+
+File: autogen.info, Node: SCM license-info, Next: SCM license-name, Prev: SCM license-full, Up: Common Functions
+
+3.5.20 `license-info' - Emit the licensing information and copyright years
+--------------------------------------------------------------------------
+
+Usage: (license-info license prog-name prefix [ owner ] [ years ])
+Emit a string that contains the licensing description, with some
+substitutions for program name, copyright holder, a list of years when
+the source was modified, and a per-line prefix. This text typically
+includes a brief license description and is often printed out when a
+program starts running or as part of the `--version' output. For more
+details, *Note the license-full command: SCM license-full.
+
+ Arguments:
+license - name of license type
+prog-name - name of the program under the GPL
+prefix - String for starting each output line
+owner - Optional - owner of the program
+years - Optional - copyright years
+
+
+File: autogen.info, Node: SCM license-name, Next: SCM make-gperf, Prev: SCM license-info, Up: Common Functions
+
+3.5.21 `license-name' - Emit the name of the license
+----------------------------------------------------
+
+Usage: (license-name license)
+Emit a string that contains the full name of the license.
+
+ Arguments:
+license - name of license type
+
+
+File: autogen.info, Node: SCM make-gperf, Next: SCM makefile-script, Prev: SCM license-name, Up: Common Functions
+
+3.5.22 `make-gperf' - build a perfect hash function program
+-----------------------------------------------------------
+
+Usage: (make-gperf name strings ...)
+Build a program to perform perfect hashes of a known list of input
+strings. This function produces no output, but prepares a program
+named, `gperf_<name>' for use by the gperf function *Note SCM gperf::.
+
+ This program will be obliterated as AutoGen exits. However, you may
+incorporate the generated hashing function into your C program with
+commands something like the following:
+
+ [+ (shellf "sed '/^int main(/,$d;/^#line/d' ${gpdir}/%s.c"
+ name ) +]
+
+ where `name' matches the name provided to this `make-perf' function.
+`gpdir' is the variable used to store the name of the temporary
+directory used to stash all the files.
+
+ Arguments:
+name - name of hash list
+strings - list of strings to hash
+
+
+File: autogen.info, Node: SCM makefile-script, Next: SCM max, Prev: SCM make-gperf, Up: Common Functions
+
+3.5.23 `makefile-script' - create makefile script
+-------------------------------------------------
+
+Usage: (makefile-script text)
+This function will take ordinary shell script text and reformat it so
+that it will work properly inside of a makefile shell script. Not
+every shell construct can be supported; the intent is to have most
+ordinary scripts work without much, if any, alteration.
+
+ The following transformations are performed on the source text:
+
+ 1. Trailing whitespace on each line is stripped.
+
+ 2. Except for the last line, the string, " ; \\" is appended to the
+ end of every line that does not end with certain special
+ characters or keywords. Note that this will mutilate multi-line
+ quoted strings, but `make' renders it impossible to use multi-line
+ constructs anyway.
+
+ 3. If the line ends with a backslash, it is left alone.
+
+ 4. If the line ends with a semi-colon, conjunction operator, pipe
+ (vertical bar) or one of the keywords "then", "else" or "in", then
+ a space and a backslash is added, but no semi-colon.
+
+ 5. The dollar sign character is doubled, unless it immediately
+ precedes an opening parenthesis or the single character make
+ macros '*', '<', '@', '?' or '%'. Other single character make
+ macros that do not have enclosing parentheses will fail. For
+ shell usage of the "$@", "$?" and "$*" macros, you must enclose
+ them with curly braces, e.g., "${?}". The ksh construct
+ `$(<command>)' will not work. Though some `make's accept `${var}'
+ constructs, this function will assume it is for shell
+ interpretation and double the dollar character. You must use
+ `$(var)' for all `make' substitutions.
+
+ 6. Double dollar signs are replaced by four before the next character
+ is examined.
+
+ 7. Every line is prefixed with a tab, unless the first line already
+ starts with a tab.
+
+ 8. The newline character on the last line, if present, is suppressed.
+
+ 9. Blank lines are stripped.
+
+ 10. Lines starting with "@ifdef", "@ifndef", "@else" and "@endif" are
+ presumed to be autoconf "sed" expression tags. These lines will be
+ emitted as-is, with no tab prefix and no line splicing backslash.
+ These lines can then be processed at configure time with
+ `AC_CONFIG_FILES' sed expressions, similar to:
+
+ sed "/^@ifdef foo/d;/^@endif foo/d;/^@ifndef foo/,/^@endif foo/d"
+
+This function is intended to be used approximately as follows:
+
+ $(TARGET) : $(DEPENDENCIES)
+ <+ (out-push-new) +>
+ ....mostly arbitrary shell script text....
+ <+ (makefile-script (out-pop #t)) +>
+
+ Arguments:
+text - the text of the script
+
+
+File: autogen.info, Node: SCM max, Next: SCM min, Prev: SCM makefile-script, Up: Common Functions
+
+3.5.24 `max' - maximum value in list
+------------------------------------
+
+Usage: (max list ...)
+Return the maximum value in the list
+
+ Arguments:
+list - list of values. Strings are converted to numbers
+
+
+File: autogen.info, Node: SCM min, Next: SCM prefix, Prev: SCM max, Up: Common Functions
+
+3.5.25 `min' - minimum value in list
+------------------------------------
+
+Usage: (min list ...)
+Return the minimum value in the list
+
+ Arguments:
+list - list of values. Strings are converted to numbers
+
+
+File: autogen.info, Node: SCM prefix, Next: SCM printf, Prev: SCM min, Up: Common Functions
+
+3.5.26 `prefix' - prefix lines with a string
+--------------------------------------------
+
+Usage: (prefix prefix text)
+Prefix every line in the second string with the first string.
+
+ For example, if the first string is "# " and the second contains:
+ two
+ lines
+ The result string will contain:
+ # two
+ # lines
+
+ Arguments:
+prefix - string to insert at start of each line
+text - multi-line block of text
+
+
+File: autogen.info, Node: SCM printf, Next: SCM raw-shell-str, Prev: SCM prefix, Up: Common Functions
+
+3.5.27 `printf' - format to stdout
+----------------------------------
+
+Usage: (printf format [ format-arg ... ])
+Format a string using arguments from the alist. Write to the standard
+out port. The result will NOT appear in your output. Use this to
+print information messages to a template user. Use "(sprintf ...)" to
+add text to your document.
+
+ Arguments:
+format - formatting string
+format-arg - Optional - list of arguments to formatting string
+
+
+File: autogen.info, Node: SCM raw-shell-str, Next: SCM shell, Prev: SCM printf, Up: Common Functions
+
+3.5.28 `raw-shell-str' - single quote shell string
+--------------------------------------------------
+
+Usage: (raw-shell-str string)
+Convert the text of the string into a singly quoted string that a
+normal shell will process into the original string. (It will not do
+macro expansion later, either.) Contained single quotes become
+tripled, with the middle quote escaped with a backslash. Normal shells
+will reconstitute the original string.
+
+ *Notice*: some shells will not correctly handle unusual
+non-printing characters. This routine works for most reasonably
+conventional ASCII strings.
+
+ Arguments:
+string - string to transform
+
+
+File: autogen.info, Node: SCM shell, Next: SCM shell-str, Prev: SCM raw-shell-str, Up: Common Functions
+
+3.5.29 `shell' - invoke a shell script
+--------------------------------------
+
+Usage: (shell command)
+Generate a string by writing the value to a server shell and reading the
+output back in. The template programmer is responsible for ensuring
+that it completes within 10 seconds. If it does not, the server will be
+killed, the output tossed and a new server started.
+
+ Please note: This is the same server process used by the '#shell'
+definitions directive and backquoted ``' definitions. There may be
+left over state from previous shell expressions and the ``' processing
+in the declarations. However, a `cd' to the original directory is
+always issued before the new command is issued.
+
+ Also note: When initializing, autogen will set the environment
+variable "AGexe" to the full path of the autogen executable.
+
+ Arguments:
+command - shell command - the result value is the stdout output.
+
+
+File: autogen.info, Node: SCM shell-str, Next: SCM shellf, Prev: SCM shell, Up: Common Functions
+
+3.5.30 `shell-str' - double quote shell string
+----------------------------------------------
+
+Usage: (shell-str string)
+Convert the text of the string into a double quoted string that a normal
+shell will process into the original string, almost. It will add the
+escape character `\\' before two special characters to accomplish this:
+the backslash `\\' and double quote `"'.
+
+ *Notice*: some shells will not correctly handle unusual non-printing
+characters. This routine works for most reasonably conventional ASCII
+strings.
+
+ *WARNING*:
+This function omits the extra backslash in front of a backslash,
+however, if it is followed by either a backquote or a dollar sign. It
+must do this because otherwise it would be impossible to protect the
+dollar sign or backquote from shell evaluation. Consequently, it is
+not possible to render the strings "\\$" or "\\`". The lesser of two
+evils.
+
+ All others characters are copied directly into the output.
+
+ The `sub-shell-str' variation of this routine behaves identically,
+except that the extra backslash is omitted in front of `"' instead of
+``'. You have to think about it. I'm open to suggestions.
+
+ Meanwhile, the best way to document is with a detailed output
+example. If the backslashes make it through the text processing
+correctly, below you will see what happens with three example strings.
+The first example string contains a list of quoted `foo's, the second is
+the same with a single backslash before the quote characters and the
+last is with two backslash escapes. Below each is the result of the
+`raw-shell-str', `shell-str' and `sub-shell-str' functions.
+
+ foo[0] ''foo'' 'foo' "foo" `foo` $foo
+ raw-shell-str -> \'\''foo'\'\'' '\''foo'\'' "foo" `foo` $foo'
+ shell-str -> "''foo'' 'foo' \"foo\" `foo` $foo"
+ sub-shell-str -> `''foo'' 'foo' "foo" \`foo\` $foo`
+
+ foo[1] \'bar\' \"bar\" \`bar\` \$bar
+ raw-shell-str -> '\'\''bar\'\'' \"bar\" \`bar\` \$bar'
+ shell-str -> "\\'bar\\' \\\"bar\\\" \`bar\` \$bar"
+ sub-shell-str -> `\\'bar\\' \"bar\" \\\`bar\\\` \$bar`
+
+ foo[2] \\'BAZ\\' \\"BAZ\\" \\`BAZ\\` \\$BAZ
+ raw-shell-str -> '\\'\''BAZ\\'\'' \\"BAZ\\" \\`BAZ\\` \\$BAZ'
+ shell-str -> "\\\\'BAZ\\\\' \\\\\"BAZ\\\\\" \\\`BAZ\\\` \\\$BAZ"
+ sub-shell-str -> `\\\\'BAZ\\\\' \\\"BAZ\\\" \\\\\`BAZ\\\\\` \\\$BAZ`
+
+ There should be four, three, five and three backslashes for the four
+examples on the last line, respectively. The next to last line should
+have four, five, three and three backslashes. If this was not
+accurately reproduced, take a look at the agen5/test/shell.test test.
+Notice the backslashes in front of the dollar signs. It goes from zero
+to one to three for the "cooked" string examples.
+
+ Arguments:
+string - string to transform
+
+
+File: autogen.info, Node: SCM shellf, Next: SCM sprintf, Prev: SCM shell-str, Up: Common Functions
+
+3.5.31 `shellf' - format a string, run shell
+--------------------------------------------
+
+Usage: (shellf format [ format-arg ... ])
+Format a string using arguments from the alist, then send the result to
+the shell for interpretation.
+
+ Arguments:
+format - formatting string
+format-arg - Optional - list of arguments to formatting string
+
+
+File: autogen.info, Node: SCM sprintf, Next: SCM string-capitalize, Prev: SCM shellf, Up: Common Functions
+
+3.5.32 `sprintf' - format a string
+----------------------------------
+
+Usage: (sprintf format [ format-arg ... ])
+Format a string using arguments from the alist.
+
+ Arguments:
+format - formatting string
+format-arg - Optional - list of arguments to formatting string
+
+
+File: autogen.info, Node: SCM string-capitalize, Next: SCM string-capitalize!, Prev: SCM sprintf, Up: Common Functions
+
+3.5.33 `string-capitalize' - capitalize a new string
+----------------------------------------------------
+
+Usage: (string-capitalize str)
+Create a new SCM string containing the same text as the original, only
+all the first letter of each word is upper cased and all other letters
+are made lower case.
+
+ Arguments:
+str - input string
+
+
+File: autogen.info, Node: SCM string-capitalize!, Next: SCM *=*, Prev: SCM string-capitalize, Up: Common Functions
+
+3.5.34 `string-capitalize!' - capitalize a string
+-------------------------------------------------
+
+Usage: (string-capitalize! str)
+capitalize all the words in an SCM string.
+
+ Arguments:
+str - input/output string
+
+
+File: autogen.info, Node: SCM *=*, Next: SCM *==*, Prev: SCM string-capitalize!, Up: Common Functions
+
+3.5.35 `string-contains-eqv?' - caseless substring
+--------------------------------------------------
+
+Usage: (*=* text match)
+string-contains-eqv?: Test to see if a string contains an equivalent
+string. `equivalent' means the strings match, but without regard to
+character case and certain characters are considered `equivalent'.
+Viz., '-', '_' and '^' are equivalent.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM *==*, Next: SCM string-downcase, Prev: SCM *=*, Up: Common Functions
+
+3.5.36 `string-contains?' - substring match
+-------------------------------------------
+
+Usage: (*==* text match)
+string-contains?: Test to see if a string contains a substring.
+"strstr(3)" will find an address.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM string-downcase, Next: SCM string-downcase!, Prev: SCM *==*, Up: Common Functions
+
+3.5.37 `string-downcase' - lower case a new string
+--------------------------------------------------
+
+Usage: (string-downcase str)
+Create a new SCM string containing the same text as the original, only
+all the upper case letters are changed to lower case.
+
+ Arguments:
+str - input string
+
+
+File: autogen.info, Node: SCM string-downcase!, Next: SCM *~, Prev: SCM string-downcase, Up: Common Functions
+
+3.5.38 `string-downcase!' - make a string be lower case
+-------------------------------------------------------
+
+Usage: (string-downcase! str)
+Change to lower case all the characters in an SCM string.
+
+ Arguments:
+str - input/output string
+
+
+File: autogen.info, Node: SCM *~, Next: SCM *~~, Prev: SCM string-downcase!, Up: Common Functions
+
+3.5.39 `string-end-eqv-match?' - caseless regex ending
+------------------------------------------------------
+
+Usage: (*~ text match)
+string-end-eqv-match?: Test to see if a string ends with a pattern.
+Case is not significant.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM *~~, Next: SCM *=, Prev: SCM *~, Up: Common Functions
+
+3.5.40 `string-end-match?' - regex match end
+--------------------------------------------
+
+Usage: (*~~ text match)
+string-end-match?: Test to see if a string ends with a pattern. Case
+is significant.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM *=, Next: SCM *==, Prev: SCM *~~, Up: Common Functions
+
+3.5.41 `string-ends-eqv?' - caseless string ending
+--------------------------------------------------
+
+Usage: (*= text match)
+string-ends-eqv?: Test to see if a string ends with an equivalent
+string.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM *==, Next: SCM ==, Prev: SCM *=, Up: Common Functions
+
+3.5.42 `string-ends-with?' - string ending
+------------------------------------------
+
+Usage: (*== text match)
+string-ends-with?: Test to see if a string ends with a substring.
+strcmp(3) returns zero for comparing the string ends.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM ==, Next: SCM ~, Prev: SCM *==, Up: Common Functions
+
+3.5.43 `string-equals?' - string matching
+-----------------------------------------
+
+Usage: (== text match)
+string-equals?: Test to see if two strings exactly match.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM ~, Next: SCM =, Prev: SCM ==, Up: Common Functions
+
+3.5.44 `string-eqv-match?' - caseless regex match
+-------------------------------------------------
+
+Usage: (~ text match)
+string-eqv-match?: Test to see if a string fully matches a pattern.
+Case is not significant, but any character equivalences must be
+expressed in your regular expression.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM =, Next: SCM *~*, Prev: SCM ~, Up: Common Functions
+
+3.5.45 `string-eqv?' - caseless match
+-------------------------------------
+
+Usage: (= text match)
+string-eqv?: Test to see if two strings are equivalent. `equivalent'
+means the strings match, but without regard to character case and
+certain characters are considered `equivalent'. Viz., '-', '_' and '^'
+are equivalent. If the arguments are not strings, then the result of
+the numeric comparison is returned.
+
+ This is an overloaded operation. If the arguments are both numbers,
+then the query is passed through to `scm_num_eq_p()', otherwise the
+result depends on the SCMs being strictly equal.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM *~*, Next: SCM *~~*, Prev: SCM =, Up: Common Functions
+
+3.5.46 `string-has-eqv-match?' - caseless regex contains
+--------------------------------------------------------
+
+Usage: (*~* text match)
+string-has-eqv-match?: Test to see if a string contains a pattern.
+Case is not significant.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM *~~*, Next: SCM ~~, Prev: SCM *~*, Up: Common Functions
+
+3.5.47 `string-has-match?' - contained regex match
+--------------------------------------------------
+
+Usage: (*~~* text match)
+string-has-match?: Test to see if a string contains a pattern. Case
+is significant.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM ~~, Next: SCM ~*, Prev: SCM *~~*, Up: Common Functions
+
+3.5.48 `string-match?' - regex match
+------------------------------------
+
+Usage: (~~ text match)
+string-match?: Test to see if a string fully matches a pattern. Case
+is significant.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM ~*, Next: SCM ~~*, Prev: SCM ~~, Up: Common Functions
+
+3.5.49 `string-start-eqv-match?' - caseless regex start
+-------------------------------------------------------
+
+Usage: (~* text match)
+string-start-eqv-match?: Test to see if a string starts with a pattern.
+Case is not significant.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM ~~*, Next: SCM =*, Prev: SCM ~*, Up: Common Functions
+
+3.5.50 `string-start-match?' - regex match start
+------------------------------------------------
+
+Usage: (~~* text match)
+string-start-match?: Test to see if a string starts with a pattern.
+Case is significant.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM =*, Next: SCM ==*, Prev: SCM ~~*, Up: Common Functions
+
+3.5.51 `string-starts-eqv?' - caseless string start
+---------------------------------------------------
+
+Usage: (=* text match)
+string-starts-eqv?: Test to see if a string starts with an equivalent
+string.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM ==*, Next: SCM string-substitute, Prev: SCM =*, Up: Common Functions
+
+3.5.52 `string-starts-with?' - string starting
+----------------------------------------------
+
+Usage: (==* text match)
+string-starts-with?: Test to see if a string starts with a substring.
+
+ Arguments:
+text - text to test for pattern
+match - pattern/substring to search for
+
+
+File: autogen.info, Node: SCM string-substitute, Next: SCM string-table-add, Prev: SCM ==*, Up: Common Functions
+
+3.5.53 `string-substitute' - multiple global replacements
+---------------------------------------------------------
+
+Usage: (string-substitute source match repl)
+`match' and `repl' may be either a single string or a list of strings.
+Either way, they must have the same structure and number of elements.
+For example, to replace all amphersands, less than and greater than
+characters, do something like this:
+
+ (string-substitute source
+ (list "&" "<" ">")
+ (list "&amp;" "&lt;" "&gt;"))
+
+ Arguments:
+source - string to transform
+match - substring or substring list to be replaced
+repl - replacement strings or substrings
+
+
+File: autogen.info, Node: SCM string-table-add, Next: SCM string-table-add-ref, Prev: SCM string-substitute, Up: Common Functions
+
+3.5.54 `string-table-add' - Add an entry to a string table
+----------------------------------------------------------
+
+Usage: (string-table-add st-name str-val)
+Check for a duplicate string and, if none, then insert a new string
+into the string table. In all cases, returns the character index of
+the beginning of the string in the table.
+
+ The returned index can be used in expressions like:
+ string_array + <returned-value>
+ that will yield the address of the first byte of the inserted
+string. See the `strtable.test' AutoGen test for a usage example.
+
+ Arguments:
+st-name - the name of the array of characters
+str-val - the (possibly) new value to add
+
+
+File: autogen.info, Node: SCM string-table-add-ref, Next: SCM string-table-new, Prev: SCM string-table-add, Up: Common Functions
+
+3.5.55 `string-table-add-ref' - Add an entry to a string table, get reference
+-----------------------------------------------------------------------------
+
+Usage: (string-table-add-ref st-name str-val)
+Identical to string-table-add, except the value returned is the string
+"st-name" '+' and the index returned by string-table-add.
+
+ Arguments:
+st-name - the name of the array of characters
+str-val - the (possibly) new value to add
+
+
+File: autogen.info, Node: SCM string-table-new, Next: SCM string-table-size, Prev: SCM string-table-add-ref, Up: Common Functions
+
+3.5.56 `string-table-new' - create a string table
+-------------------------------------------------
+
+Usage: (string-table-new st-name)
+This function will create an array of characters. The companion
+functions, (*Note SCM string-table-add::, *Note SCM
+string-table-add-ref::, and *note SCM emit-string-table::) will insert
+text and emit the populated table.
+
+ With these functions, it should be much easier to construct
+structures containing string offsets instead of string pointers. That
+can be very useful when transmitting, storing or sharing data with
+different address spaces.
+
+Here is a brief example copied from the strtable.test test:
+
+ [+ (string-table-new "scribble")
+ (out-push-new) ;; redirect output to temporary
+ (define ct 1) +][+
+
+ FOR str IN that was the week that was +][+
+ (set! ct (+ ct 1))
+ +]
+ [+ (string-table-add-ref "scribble" (get "str")) +],[+
+ ENDFOR +]
+ [+ (out-suspend "main")
+ (emit-string-table "scribble")
+ (ag-fprintf 0 "\nchar const *ap[%d] = {" ct)
+ (out-resume "main")
+ (out-pop #t) ;; now dump out the redirected output +]
+ NULL };
+
+Some explanation:
+
+I added the `(out-push-new)' because the string table text is diverted
+into an output stream named, "scribble" and I want to have the string
+table emitted before the string table references. The string table
+references are also emitted inside the `FOR' loop. So, when the loop
+is done, the current output is suspended under the name, "main" and the
+"scribble" table is then emitted into the primary output.
+(`emit-string-table' inserts its output directly into the current
+output stream. It does not need to be the last function in an AutoGen
+macro block.) Next I `ag-fprintf' the array-of-pointer declaration
+directly into the current output. Finally I restore the "main" output
+stream and `(out-pop #t)'-it into the main output stream.
+
+ Here is the result. Note that duplicate strings are not repeated in
+the string table:
+
+ static char const scribble[18] =
+ "that\0" "was\0" "the\0" "week\0";
+
+ char const *ap[7] = {
+ scribble+0,
+ scribble+5,
+ scribble+9,
+ scribble+13,
+ scribble+0,
+ scribble+5,
+ NULL };
+
+ These functions use the global name space `stt-*' in addition to the
+function names.
+
+ If you utilize this in your programming, it is recommended that you
+prevent printf format usage warnings with the GCC option
+`-Wno-format-contains-nul'
+
+ Arguments:
+st-name - the name of the array of characters
+
+
+File: autogen.info, Node: SCM string-table-size, Next: SCM string->c-name!, Prev: SCM string-table-new, Up: Common Functions
+
+3.5.57 `string-table-size' - print the current size of a string table
+---------------------------------------------------------------------
+
+Usage: (string-table-size st-name)
+Returns the current byte count of the string table.
+
+ Arguments:
+st-name - the name of the array of characters
+
+
+File: autogen.info, Node: SCM string->c-name!, Next: SCM string->camelcase, Prev: SCM string-table-size, Up: Common Functions
+
+3.5.58 `string->c-name!' - map non-name chars to underscore
+-----------------------------------------------------------
+
+Usage: (string->c-name! str)
+Change all the graphic characters that are invalid in a C name token
+into underscores. Whitespace characters are ignored. Any other
+character type (i.e. non-graphic and non-white) will cause a failure.
+
+ Arguments:
+str - input/output string
+
+
+File: autogen.info, Node: SCM string->camelcase, Next: SCM string-tr, Prev: SCM string->c-name!, Up: Common Functions
+
+3.5.59 `string->camelcase' - make a string be CamelCase
+-------------------------------------------------------
+
+Usage: (string->camelcase str)
+Capitalize the first letter of each block of letters and numbers, and
+stripping out characters that are not alphanumerics. For example,
+"alpha-beta0gamma" becomes "AlphaBeta0gamma".
+
+ Arguments:
+str - input/output string
+
+
+File: autogen.info, Node: SCM string-tr, Next: SCM string-tr!, Prev: SCM string->camelcase, Up: Common Functions
+
+3.5.60 `string-tr' - convert characters with new result
+-------------------------------------------------------
+
+Usage: (string-tr source match translation)
+This is identical to `string-tr!', except that it does not over-write
+the previous value.
+
+ Arguments:
+source - string to transform
+match - characters to be converted
+translation - conversion list
+
+
+File: autogen.info, Node: SCM string-tr!, Next: SCM string-upcase, Prev: SCM string-tr, Up: Common Functions
+
+3.5.61 `string-tr!' - convert characters
+----------------------------------------
+
+Usage: (string-tr! source match translation)
+This is the same as the `tr(1)' program, except the string to transform
+is the first argument. The second and third arguments are used to
+construct mapping arrays for the transformation of the first argument.
+
+ It is too bad this little program has so many different and
+incompatible implementations!
+
+ Arguments:
+source - string to transform
+match - characters to be converted
+translation - conversion list
+
+
+File: autogen.info, Node: SCM string-upcase, Next: SCM string-upcase!, Prev: SCM string-tr!, Up: Common Functions
+
+3.5.62 `string-upcase' - upper case a new string
+------------------------------------------------
+
+Usage: (string-upcase str)
+Create a new SCM string containing the same text as the original, only
+all the lower case letters are changed to upper case.
+
+ Arguments:
+str - input string
+
+
+File: autogen.info, Node: SCM string-upcase!, Next: SCM sub-shell-str, Prev: SCM string-upcase, Up: Common Functions
+
+3.5.63 `string-upcase!' - make a string be upper case
+-----------------------------------------------------
+
+Usage: (string-upcase! str)
+Change to upper case all the characters in an SCM string.
+
+ Arguments:
+str - input/output string
+
+
+File: autogen.info, Node: SCM sub-shell-str, Next: SCM sum, Prev: SCM string-upcase!, Up: Common Functions
+
+3.5.64 `sub-shell-str' - back quoted (sub-)shell string
+-------------------------------------------------------
+
+Usage: (sub-shell-str string)
+This function is substantially identical to `shell-str', except that
+the quoting character is ``' and the "leave the escape alone" character
+is `"'.
+
+ Arguments:
+string - string to transform
+
+
+File: autogen.info, Node: SCM sum, Next: SCM time-string->number, Prev: SCM sub-shell-str, Up: Common Functions
+
+3.5.65 `sum' - sum of values in list
+------------------------------------
+
+Usage: (sum list ...)
+Compute the sum of the list of expressions.
+
+ Arguments:
+list - list of values. Strings are converted to numbers
+
+
+File: autogen.info, Node: SCM time-string->number, Next: SCM version-compare, Prev: SCM sum, Up: Common Functions
+
+3.5.66 `time-string->number' - duration string to seconds
+---------------------------------------------------------
+
+Usage: (time-string->number time_spec)
+Convert the argument string to a time period in seconds. The string
+may use multiple parts consisting of days, hours minutes and seconds.
+These are indicated with a suffix of `d', `h', `m' and `s' respectively.
+Hours, minutes and seconds may also be represented with `HH:MM:SS' or,
+without hours, as `MM:SS'.
+
+ Arguments:
+time_spec - string to parse
+
+
+File: autogen.info, Node: SCM version-compare, Prev: SCM time-string->number, Up: Common Functions
+
+3.5.67 `version-compare' - compare two version numbers
+------------------------------------------------------
+
+Usage: (version-compare op v1 v2)
+Converts v1 and v2 strings into 64 bit values and returns the result of
+running 'op' on those values. It assumes that the version is a 1 to 4
+part dot-separated series of numbers. Suffixes like, "5pre4" or
+"5-pre4" will be interpreted as two numbers. The first number ("5" in
+this case) will be decremented and the number after the "pre" will be
+added to 0xC000. (Unless your platform is unable to support 64 bit
+integer arithmetic. Then it will be added to 0xC0.) Consequently,
+these yield true:
+ (version-compare > "5.8.5" "5.8.5-pre4")
+ (version-compare > "5.8.5-pre10" "5.8.5-pre4")
+
+ Arguments:
+op - comparison operator
+v1 - first version
+v2 - compared-to version
+
+
+File: autogen.info, Node: native macros, Next: output controls, Prev: Common Functions, Up: Template File
+
+3.6 AutoGen Native Macros
+=========================
+
+This section describes the various AutoGen natively defined macros.
+Unlike the Scheme functions, some of these macros are "block macros"
+with a scope that extends through a terminating macro. Block macros
+must not overlap. That is to say, a block macro started within the
+scope of an encompassing block macro must have its matching end macro
+appear before the encompassing block macro is either ended or
+subdivided.
+
+ The block macros are these:
+
+`CASE'
+ This macro has scope through the `ESAC' macro. The scope is
+ subdivided by `SELECT' macros. You must have at least one
+ `SELECT' macro.
+
+`DEFINE'
+ This macro has scope through the `ENDDEF' macro. The defined user
+ macro can never be a block macro. This macro is extracted from
+ the template before the template is processed. Consequently, you
+ cannot select a definition based on context. You can, however,
+ place them all at the end of the file.
+
+`FOR'
+ This macro has scope through the `ENDFOR' macro.
+
+`IF'
+ This macro has scope through the `ENDIF' macro. The scope may be
+ subdivided by `ELIF' and `ELSE' macros. Obviously, there may be
+ only one `ELSE' macro and it must be the last of these
+ subdivisions.
+
+`INCLUDE'
+ This macro has the scope of the included file. It is a block
+ macro in the sense that the included file must not contain any
+ incomplete block macros.
+
+`WHILE'
+ This macro has scope through the `ENDWHILE' macro.
+
+* Menu:
+
+* AGMacro syntax:: AutoGen Macro Syntax
+* BREAK:: BREAK - Leave a FOR or WHILE macro
+* CASE:: CASE - Select one of several template blocks
+* COMMENT:: COMMENT - A block of comment to be ignored
+* CONTINUE:: CONTINUE - Skip to end of a FOR or WHILE macro.
+* DEBUG:: DEBUG - Print debug message to trace output
+* DEFINE:: DEFINE - Define a user AutoGen macro
+* ELIF:: ELIF - Alternate Conditional Template Block
+* ELSE:: ELSE - Alternate Template Block
+* ENDDEF:: ENDDEF - Ends a macro definition.
+* ENDFOR:: ENDFOR - Terminates the `FOR' function template block
+* ENDIF:: ENDIF - Terminate the `IF' Template Block
+* ENDWHILE:: ENDWHILE - Terminate the `WHILE' Template Block
+* ESAC:: ESAC - Terminate the `CASE' Template Block
+* EXPR:: EXPR - Evaluate and emit an Expression
+* FOR:: FOR - Emit a template block multiple times
+* IF:: IF - Conditionally Emit a Template Block
+* INCLUDE:: INCLUDE - Read in and emit a template block
+* INVOKE:: INVOKE - Invoke a User Defined Macro
+* RETURN:: RETURN - Leave an INVOKE-d (DEFINE) macro
+* SELECT:: SELECT - Selection block for CASE function
+* UNKNOWN:: UNKNOWN - Either a user macro or a value name.
+* WHILE:: WHILE - Conditionally loop over a Template Block
+
+
+File: autogen.info, Node: AGMacro syntax, Next: BREAK, Up: native macros
+
+3.6.1 AutoGen Macro Syntax
+--------------------------
+
+The general syntax is:
+
+ [ { <native-macro-name> | <user-defined-name> } ] [ <arg> ... ]
+
+The syntax for `<arg>' depends on the particular macro, but is
+generally a full expression (*note expression syntax::). Here are the
+exceptions to that general rule:
+
+ 1. `INVOKE' macros, implicit or explicit, must be followed by a list
+ of name/string value pairs. The string values are simple
+ expressions, as described above.
+
+ That is, the `INVOKE' syntax is one of these two:
+ <user-macro-name> [ <name> [ = <expression> ] ... ]
+
+ INVOKE <name-expression> [ <name> [ = <expression> ] ... ]
+
+ 2. AutoGen FOR macros must be in one of three forms:
+
+ FOR <name> [ <separator-string> ]
+
+ FOR <name> (...Scheme expression list)
+
+ FOR <name> IN <string-entry> [ ... ]
+ where:
+ `<name>'
+ must be a simple name.
+
+ `<separator-string>'
+ is inserted between copies of the enclosed block. Do not try
+ to use "IN" as your separator string. It won't work.
+
+ `<string-entry>'
+ is an entry in a list of strings. "`<name>'" is assigned
+ each value from the "`IN'" list before expanding the `FOR'
+ block.
+
+ `(...Scheme expression list)'
+ is expected to contain one or more of the `for-from',
+ `for-to', `for-by', and `for-sep' functions. (*Note FOR::,
+ and *note AutoGen Functions::)
+
+ The first two forms iterate over the `FOR' block if `<name>' is
+ found in the AutoGen values. The last form will create the AutoGen
+ value named `<name>'.
+
+ 3. AutoGen `DEFINE' macros must be followed by a simple name.
+ Anything after that is ignored. Consequently, that "comment space"
+ may be used to document any named values the macro expects to have
+ set up as arguments. *Note DEFINE::.
+
+ 4. The AutoGen `COMMENT', `ELSE', `ESAC' and the `END*' macros take
+ no arguments and ignore everything after the macro name (e.g. see
+ *note COMMENT::)
+
+
+File: autogen.info, Node: BREAK, Next: CASE, Prev: AGMacro syntax, Up: native macros
+
+3.6.2 BREAK - Leave a FOR or WHILE macro
+----------------------------------------
+
+This will unwind the loop context and resume after ENDFOR/ENDWHILE.
+Note that unless this happens to be the last iteration anyway, the
+(last-for?) function will never yield "#t".
+
+
+File: autogen.info, Node: CASE, Next: COMMENT, Prev: BREAK, Up: native macros
+
+3.6.3 CASE - Select one of several template blocks
+--------------------------------------------------
+
+The arguments are evaluated and converted to a string, if necessary. A
+simple name will be interpreted as an AutoGen value name and its value
+will be used by the `SELECT' macros (see the example below and the
+expression evaluation function, *note EXPR::). The scope of the macro
+is up to the matching `ESAC' macro. Within the scope of a `CASE', this
+string is matched against case selection macros. There are sixteen
+match macros that are derived from four different ways matches may be
+performed, plus an "always true", "true if the AutoGen value was found",
+and "true if no AutoGen value was found" matches. The codes for the
+nineteen match macros are formed as follows:
+
+ 1. Must the match start matching from the beginning of the string?
+ If not, then the match macro code starts with an asterisk (`*').
+
+ 2. Must the match finish matching at the end of the string? If not,
+ then the match macro code ends with an asterisk (`*').
+
+ 3. Is the match a pattern match or a string comparison? If a
+ comparison, use an equal sign (`='). If a pattern match, use a
+ tilde (`~').
+
+ 4. Is the match case sensitive? If alphabetic case is important,
+ double the tilde or equal sign.
+
+ 5. Do you need a default match when none of the others match? Use a
+ single asterisk (`*').
+
+ 6. Do you need to distinguish between an empty string value and a
+ value that was not found? Use the non-existence test (`!E') before
+ testing a full match against an empty string (`== '''). There is
+ also an existence test (`+E'), more for symmetry than for
+ practical use.
+
+For example:
+
+ [+ CASE <full-expression> +]
+ [+ ~~* "[Tt]est" +]reg exp must match at start, not at end
+ [+ == "TeSt" +]a full-string, case sensitive compare
+ [+ = "TEST" +]a full-string, case insensitive compare
+ [+ !E +]not exists - matches if no AutoGen value found
+ [+ == "" +]expression yielded a zero-length string
+ [+ +E +]exists - matches if there is any value result
+ [+ * +]always match - no testing
+ [+ ESAC +]
+
+ `<full-expression>' (*note expression syntax::) may be any
+expression, including the use of apply-codes and value-names. If the
+expression yields a number, it is converted to a decimal string.
+
+ These case selection codes have also been implemented as Scheme
+expression functions using the same codes. They are documented in this
+texi doc as "string-*?" predicates (*note Common Functions::).
+
+
+File: autogen.info, Node: COMMENT, Next: CONTINUE, Prev: CASE, Up: native macros
+
+3.6.4 COMMENT - A block of comment to be ignored
+------------------------------------------------
+
+This function can be specified by the user, but there will never be a
+situation where it will be invoked at emit time. The macro is actually
+removed from the internal representation.
+
+ If the native macro name code is `#', then the entire macro function
+is treated as a comment and ignored.
+
+ [+ # say what you want, but no '+' before any ']' chars +]
+
+
+File: autogen.info, Node: CONTINUE, Next: DEBUG, Prev: COMMENT, Up: native macros
+
+3.6.5 CONTINUE - Skip to end of a FOR or WHILE macro.
+-----------------------------------------------------
+
+This will skip the remainder of the loop and start the next.
+
+
+File: autogen.info, Node: DEBUG, Next: DEFINE, Prev: CONTINUE, Up: native macros
+
+3.6.6 DEBUG - Print debug message to trace output
+-------------------------------------------------
+
+If the tracing level is at "debug-message" or above (*note autogen
+trace::), this macro prints a debug message to trace output. This
+message is not evaluated. This macro can also be used to set useful
+debugger breakpoints. By inserting [+DEBUG n+] into your template, you
+can set a debugger breakpoint on the #n case element below (in the
+AutoGen source) and step through the processing of interesting parts of
+your template.
+
+ To be useful, you have to have access to the source tree where
+autogen was built and the template being processed. The definitions
+are also helpful, but not crucial. Please contact the author if you
+think you might actually want to use this.
+
+
+File: autogen.info, Node: DEFINE, Next: ELIF, Prev: DEBUG, Up: native macros
+
+3.6.7 DEFINE - Define a user AutoGen macro
+------------------------------------------
+
+This function will define a new macro. You must provide a name for the
+macro. You do not specify any arguments, though the invocation may
+specify a set of name/value pairs that are to be active during the
+processing of the macro.
+
+ [+ define foo +]
+ ... macro body with macro functions ...
+ [+ enddef +]
+ ... [+ foo bar='raw text' baz=<<text expression>> +]
+
+ Once the macro has been defined, this new macro can be invoked by
+specifying the macro name as the first token after the start macro
+marker. Alternatively, you may make the invocation explicitly invoke a
+defined macro by specifying `INVOKE' (*note INVOKE::) in the macro
+invocation. If you do that, the macro name can be computed with an
+expression that gets evaluated every time the INVOKE macro is
+encountered.
+
+ Any remaining text in the macro invocation will be used to create new
+name/value pairs that only persist for the duration of the processing of
+the macro. The expressions are evaluated the same way basic
+expressions are evaluated. *Note expression syntax::.
+
+ The resulting definitions are handled much like regular definitions,
+except:
+
+ 1. The values may not be compound. That is, they may not contain
+ nested name/value pairs.
+
+ 2. The bindings go away when the macro is complete.
+
+ 3. The name/value pairs are separated by whitespace instead of
+ semi-colons.
+
+ 4. Sequences of strings are not concatenated.
+
+ *NB:* The macro is extracted from the template as the template is
+ scanned. You cannot conditionally define a macro by enclosing it
+ in an `IF'/`ENDIF' (*note IF::) macro pair. If you need to
+ dynamically select the format of a `DEFINE'd macro, then put the
+ flavors into separate template files that simply define macros.
+ `INCLUDE' (*note INCLUDE::) the appropriate template when you have
+ computed which you need.
+
+ Due to this, it is acceptable and even a good idea to place all the
+`DEFINE' macros at the end of the template. That puts the main body of
+the template at the beginning of the file.
+
+
+File: autogen.info, Node: ELIF, Next: ELSE, Prev: DEFINE, Up: native macros
+
+3.6.8 ELIF - Alternate Conditional Template Block
+-------------------------------------------------
+
+This macro must only appear after an `IF' function, and before any
+associated `ELSE' or `ENDIF' functions. It denotes the start of an
+alternate template block for the `IF' function. Its expression
+argument is evaluated as are the arguments to `IF'. For a complete
+description *Note IF::.
+
+
+File: autogen.info, Node: ELSE, Next: ENDDEF, Prev: ELIF, Up: native macros
+
+3.6.9 ELSE - Alternate Template Block
+-------------------------------------
+
+This macro must only appear after an `IF' function, and before the
+associated `ENDIF' function. It denotes the start of an alternate
+template block for the `IF' function. For a complete description *Note
+IF::.
+
+
+File: autogen.info, Node: ENDDEF, Next: ENDFOR, Prev: ELSE, Up: native macros
+
+3.6.10 ENDDEF - Ends a macro definition.
+----------------------------------------
+
+This macro ends the `DEFINE' function template block. For a complete
+description *Note DEFINE::.
+
+
+File: autogen.info, Node: ENDFOR, Next: ENDIF, Prev: ENDDEF, Up: native macros
+
+3.6.11 ENDFOR - Terminates the `FOR' function template block
+------------------------------------------------------------
+
+This macro ends the `FOR' function template block. For a complete
+description *Note FOR::.
+
+
+File: autogen.info, Node: ENDIF, Next: ENDWHILE, Prev: ENDFOR, Up: native macros
+
+3.6.12 ENDIF - Terminate the `IF' Template Block
+------------------------------------------------
+
+This macro ends the `IF' function template block. For a complete
+description *Note IF::.
+
+
+File: autogen.info, Node: ENDWHILE, Next: ESAC, Prev: ENDIF, Up: native macros
+
+3.6.13 ENDWHILE - Terminate the `WHILE' Template Block
+------------------------------------------------------
+
+This macro ends the `WHILE' function template block. For a complete
+description *Note WHILE::.
+
+
+File: autogen.info, Node: ESAC, Next: EXPR, Prev: ENDWHILE, Up: native macros
+
+3.6.14 ESAC - Terminate the `CASE' Template Block
+-------------------------------------------------
+
+This macro ends the `CASE' function template block. For a complete
+description, *Note CASE::.
+
+
+File: autogen.info, Node: EXPR, Next: FOR, Prev: ESAC, Up: native macros
+
+3.6.15 EXPR - Evaluate and emit an Expression
+---------------------------------------------
+
+This macro does not have a name to cause it to be invoked explicitly,
+though if a macro starts with one of the apply codes or one of the
+simple expression markers, then an expression macro is inferred. The
+result of the expression evaluation (*note expression syntax::) is
+written to the current output.
+
+
+File: autogen.info, Node: FOR, Next: IF, Prev: EXPR, Up: native macros
+
+3.6.16 FOR - Emit a template block multiple times
+-------------------------------------------------
+
+This macro has a slight variation on the standard syntax:
+ FOR <value-name> [ <separator-string> ]
+
+ FOR <value-name> (...Scheme expression list)
+
+ FOR <value-name> IN "string" [ ... ]
+
+ Other than for the last form, the first macro argument must be the
+name of an AutoGen value. If there is no value associated with the
+name, the `FOR' template block is skipped entirely. The scope of the
+`FOR' macro extends to the corresponding `ENDFOR' macro. The last form
+will create an array of string values named `<value-name>' that only
+exists within the context of this `FOR' loop. With this form, in order
+to use a `separator-string', you must code it into the end of the
+template block using the `(last-for?)' predicate function (*note SCM
+last-for?::).
+
+ If there are any arguments after the `value-name', the initial
+characters are used to determine the form. If the first character is
+either a semi-colon (`;') or an opening parenthesis (`('), then it is
+presumed to be a Scheme expression containing the FOR macro specific
+functions `for-from', `for-by', `for-to', and/or `for-sep'. *Note
+AutoGen Functions::. If it consists of an '`i'' an '`n'' and separated
+by white space from more text, then the `FOR x IN' form is processed.
+Otherwise, the remaining text is presumed to be a string for inserting
+between each iteration of the loop. This string will be emitted one
+time less than the number of iterations of the loop. That is, it is
+emitted after each loop, excepting for the last iteration.
+
+ If the from/by/to functions are invoked, they will specify which
+copies of the named value are to be processed. If there is no copy of
+the named value associated with a particular index, the `FOR' template
+block will be instantiated anyway. The template must use methods for
+detecting missing definitions and emitting default text. In this
+fashion, you can insert entries from a sparse or non-zero based array
+into a dense, zero based array.
+
+ *NB:* the `for-from', `for-to', `for-by' and `for-sep' functions are
+disabled outside of the context of the `FOR' macro. Likewise, the
+`first-for', `last-for' and `for-index' functions are disabled outside
+of the range of a `FOR' block.
+
+ *Also:* the `<value-name>' must be a single level name, not a
+compound name (*note naming values::).
+
+ [+FOR var (for-from 0) (for-to <number>) (for-sep ",") +]
+ ... text with `var'ious substitutions ...[+
+ ENDFOR var+]
+
+this will repeat the `... text with `var'ious substitutions ...'
+<number>+1 times. Each repetition, except for the last, will have a
+comma `,' after it.
+
+ [+FOR var ",\n" +]
+ ... text with `var'ious substitutions ...[+
+ ENDFOR var +]
+
+This will do the same thing, but only for the index values of `var'
+that have actually been defined.
+
+
+File: autogen.info, Node: IF, Next: INCLUDE, Prev: FOR, Up: native macros
+
+3.6.17 IF - Conditionally Emit a Template Block
+-----------------------------------------------
+
+Conditional block. Its arguments are evaluated (*note EXPR::) and if
+the result is non-zero or a string with one or more bytes, then the
+condition is true and the text from that point until a matched `ELIF',
+`ELSE' or `ENDIF' is emitted. `ELIF' introduces a conditional
+alternative if the `IF' clause evaluated FALSE and `ELSE' introduces an
+unconditional alternative.
+
+ [+IF <full-expression> +]
+ emit things that are for the true condition[+
+
+ ELIF <full-expression-2> +]
+ emit things that are true maybe[+
+
+ ELSE "This may be a comment" +]
+ emit this if all but else fails[+
+
+ ENDIF "This may *also* be a comment" +]
+
+`<full-expression>' may be any expression described in the `EXPR'
+expression function, including the use of apply-codes and value-names.
+If the expression yields an empty string, it is interpreted as false.
+
+
+File: autogen.info, Node: INCLUDE, Next: INVOKE, Prev: IF, Up: native macros
+
+3.6.18 INCLUDE - Read in and emit a template block
+--------------------------------------------------
+
+The entire contents of the named file is inserted at this point. The
+contents of the file are processed for macro expansion. The arguments
+are eval-ed, so you may compute the name of the file to be included.
+The included file must not contain any incomplete function blocks.
+Function blocks are template text beginning with any of the macro
+functions `CASE', `DEFINE', `FOR', `IF' and `WHILE'; extending through
+their respective terminating macro functions.
+
+
+File: autogen.info, Node: INVOKE, Next: RETURN, Prev: INCLUDE, Up: native macros
+
+3.6.19 INVOKE - Invoke a User Defined Macro
+-------------------------------------------
+
+User defined macros may be invoked explicitly or implicitly. If you
+invoke one implicitly, the macro must begin with the name of the
+defined macro. Consequently, this may *not* be a computed value. If
+you explicitly invoke a user defined macro, the macro begins with the
+macro name `INVOKE' followed by a basic expression that must yield a
+known user defined macro. A macro name _must_ be found, or AutoGen
+will issue a diagnostic and exit.
+
+ Arguments are passed to the invoked macro by name. The text
+following the macro name must consist of a series of names each of
+which is followed by an equal sign (`=') and a basic expression that
+yields a string.
+
+ The string values may contain template macros that are parsed the
+first time the macro is processed and evaluated again every time the
+macro is evaluated.
+
+
+File: autogen.info, Node: RETURN, Next: SELECT, Prev: INVOKE, Up: native macros
+
+3.6.20 RETURN - Leave an INVOKE-d (DEFINE) macro
+------------------------------------------------
+
+This will unwind looping constructs inside of a DEFINE-d macro and
+return to the invocation point. The output files and diversions are
+left alone. This means it is unwise to start diversions in a DEFINEd
+macro and RETURN from it before you have handled the diversion. Unless
+you are careful. Here is some rope for you. Please be careful using
+it.
+
+
+File: autogen.info, Node: SELECT, Next: UNKNOWN, Prev: RETURN, Up: native macros
+
+3.6.21 SELECT - Selection block for CASE function
+-------------------------------------------------
+
+This macro selects a block of text by matching an expression against
+the sample text expression evaluated in the `CASE' macro. *Note CASE::.
+
+ You do not specify a `SELECT' macro with the word "select".
+Instead, you must use one of the 19 match operators described in the
+`CASE' macro description.
+
+
+File: autogen.info, Node: UNKNOWN, Next: WHILE, Prev: SELECT, Up: native macros
+
+3.6.22 UNKNOWN - Either a user macro or a value name.
+-----------------------------------------------------
+
+The macro text has started with a name not known to AutoGen. If, at run
+time, it turns out to be the name of a defined macro, then that macro is
+invoked. If it is not, then it is a conditional expression that is
+evaluated only if the name is defined at the time the macro is invoked.
+
+ You may not specify `UNKNOWN' explicitly.
+
+
+File: autogen.info, Node: WHILE, Prev: UNKNOWN, Up: native macros
+
+3.6.23 WHILE - Conditionally loop over a Template Block
+-------------------------------------------------------
+
+Conditionally repeated block. Its arguments are evaluated (*note
+EXPR::) and as long as the result is non-zero or a string with one or
+more bytes, then the condition is true and the text from that point
+until a matched `ENDWHILE' is emitted.
+
+ [+WHILE <full-expression> +]
+ emit things that are for the true condition[+
+
+ ENDWHILE +]
+
+`<full-expression>' may be any expression described in the `EXPR'
+expression function, including the use of apply-codes and value-names.
+If the expression yields an empty string, it is interpreted as false.
+
+
+File: autogen.info, Node: output controls, Prev: native macros, Up: Template File
+
+3.7 Redirecting Output
+======================
+
+AutoGen provides a means for redirecting the template output to
+different files or, in `M4' parlance, to various diversions. It is
+accomplished by providing a set of Scheme functions named `out-*'
+(*note AutoGen Functions::).
+
+`out-push-new (*note SCM out-push-new::)'
+ This allows you to logically "push" output files onto a stack. If
+ you supply a string name, then a file by that name is created to
+ hold the output. If you do not supply a name, then the text is
+ written to a scratch pad and retrieved by passing a "`#t'" argument
+ to the `out-pop' (*note SCM out-pop::) function.
+
+`out-pop (*note SCM out-pop::)'
+ This function closes the current output file and resumes output to
+ the next one in the stack. At least one output must have been
+ pushed onto the output stack with the `out-push-new' (*note SCM
+ out-push-new::) function. If "`#t'" is passed in as an argument,
+ then the entire contents of the diversion (or file) is returned.
+
+`out-suspend (*note SCM out-suspend::)'
+ This function does not close the current output, but instead sets
+ it aside for resumption by the given name with `out-resume'. The
+ current output must have been pushed on the output queue with
+ `out-push-new' (*note SCM out-push-new::).
+
+`out-resume (*note SCM out-resume::)'
+ This will put a named file descriptor back onto the top of stack
+ so that it becomes the current output again.
+
+`out-switch (*note SCM out-switch::)'
+ This closes the current output and creates a new file, purging any
+ preexisting one. This is a shortcut for "pop" followed by "push",
+ but this can also be done at the base level.
+
+`out-move (*note SCM out-move::)'
+ Renames the current output file without closing it.
+
+ There are also several functions for determining the output status.
+*Note AutoGen Functions::.
+
+
+File: autogen.info, Node: Augmenting AutoGen, Next: autogen Invocation, Prev: Template File, Up: Top
+
+4 Augmenting AutoGen Features
+*****************************
+
+AutoGen was designed to be simple to enhance. You can do it by
+providing shell commands, Guile/Scheme macros or callout functions that
+can be invoked as a Guile macro. Here is how you do these.
+
+* Menu:
+
+* shell commands:: Shell Output Commands
+* guile macros:: Guile Macros
+* guile callouts:: Guile Callout Functions
+* AutoGen macros:: AutoGen Macros
+
+
+File: autogen.info, Node: shell commands, Next: guile macros, Up: Augmenting AutoGen
+
+4.1 Shell Output Commands
+=========================
+
+Shell commands are run inside of a server process. This means that,
+unlike `make', context is kept from one command to the next.
+Consequently, you can define a shell function in one place inside of
+your template and invoke it in another. You may also store values in
+shell variables for later reference. If you load functions from a file
+containing shell functions, they will remain until AutoGen exits.
+
+ If your shell script should determine that AutoGen should stop
+processing, the recommended method for stopping AutoGen is:
+ die "some error text"
+
+That is a shell function added by AutoGen. It will send a SIGTERM to
+autogen and exit from the "persistent" shell.
+
+
+File: autogen.info, Node: guile macros, Next: guile callouts, Prev: shell commands, Up: Augmenting AutoGen
+
+4.2 Guile Macros
+================
+
+Guile also maintains context from one command to the next. This means
+you may define functions and variables in one place and reference them
+elsewhere. You also may load Guile macro definitions from a Scheme
+file by using the `--load-scheme' command line option (*note autogen
+load-scheme::). Beware, however, that the AutoGen specific scheme
+functions have not been loaded at this time, so though you may define
+functions that reference them, do not invoke the AutoGen functions at
+this time.
+
+ If your Scheme script should determine that AutoGen should stop
+processing, the recommended method for stopping AutoGen is:
+ (error "some error text")
+
+
+File: autogen.info, Node: guile callouts, Next: AutoGen macros, Prev: guile macros, Up: Augmenting AutoGen
+
+4.3 Guile Callout Functions
+===========================
+
+Callout functions must be registered with Guile to work. This can be
+accomplished either by putting your routines into a shared library that
+contains a `void scm_init( void )' routine that registers these
+routines, or by building them into AutoGen.
+
+ To build them into AutoGen, you must place your routines in the
+source directory and name the files `exp*.c'. You also must have a
+stylized comment that `getdefs' can find that conforms to the following:
+
+ /*=gfunc <function-name>
+ *
+ * what: <short one-liner>
+ * general_use:
+ * string: <invocation-name-string>
+ * exparg: <name>, <description> [, ['optional'] [, 'list']]
+ * doc: A long description telling people how to use
+ * this function.
+ =*/
+ SCM
+ ag_scm_<function-name>( SCM arg_name[, ...] )
+ { <code> }
+
+`gfunc'
+ You must have this exactly thus.
+
+`<function-name>'
+ This must follow C syntax for variable names
+
+`<short one-liner>'
+ This should be about a half a line long. It is used as a
+ subsection title in this document.
+
+`general_use:'
+ You must supply this unless you are an AutoGen maintainer and are
+ writing a function that queries or modifies the state of AutoGen.
+
+`<invocation-name-string>'
+ Normally, the `function-name' string will be transformed into a
+ reasonable invocation name. However, that is not always true. If
+ the result does not suit your needs, then supply an alternate
+ string.
+
+`exparg:'
+ You must supply one for each argument to your function. All
+ optional arguments must be last. The last of the optional
+ arguments may be a list, if you choose.
+
+`doc:'
+ Please say something meaningful.
+
+`[, ...]'
+ Do not actually specify an ANSI ellipsis here. You must provide
+ for all the arguments you specified with `exparg'.
+
+ See the Guile documentation for more details. More information is
+also available in a large comment at the beginning of the
+`agen5/snarf.tpl' template file.
+
+
+File: autogen.info, Node: AutoGen macros, Prev: guile callouts, Up: Augmenting AutoGen
+
+4.4 AutoGen Macros
+==================
+
+There are two kinds those you define yourself and AutoGen native. The
+user-defined macros may be defined in your templates or loaded with the
+`--lib-template' option (See *note DEFINE:: and *note autogen
+lib-template::).
+
+ As for AutoGen native macros, do not add any. It is easy to do, but I
+won't like it. The basic functions needed to accomplish looping over
+and selecting blocks of text have proved to be sufficient over a period
+of several years. New text transformations can be easily added via any
+of the AutoGen extension methods, as discussed above.
+
+
+File: autogen.info, Node: autogen Invocation, Next: Installation, Prev: Augmenting AutoGen, Up: Top
+
+5 Invoking autogen
+******************
+
+AutoGen creates text files from templates using external definitions.
+
+ `AutoGen' is designed for generating program files that contain
+repetitive text with varied substitutions. The goal is to simplify the
+maintenance of programs that contain large amounts of repetitious text.
+This is especially valuable if there are several blocks of such text
+that must be kept synchronized.
+
+ One common example is the problem of maintaining the code required
+for processing program options. Processing options requires a minimum
+of four different constructs be kept in proper order in different places
+in your program. You need at least: The flag character in the flag
+string, code to process the flag when it is encountered, a global state
+variable or two, and a line in the usage text. You will need more
+things besides this if you choose to implement long option names,
+configuration file processing, environment variables and so on.
+
+ All of this can be done mechanically; with the proper templates and
+this program.
+
+ This chapter was generated by *AutoGen*, using the `agtexi-cmd'
+template and the option descriptions for the `autogen' program. This
+software is released under the GNU General Public License, version 3 or
+later.
+
+* Menu:
+
+* autogen usage:: autogen help/usage (`--help')
+* autogen input-select:: input-select options
+* autogen out-handling:: out-handling options
+* autogen debug-tpl:: debug-tpl options
+* autogen processing:: processing options
+* autogen dep-track:: dep-track options
+* autogen config:: presetting/configuring autogen
+* autogen exit status:: exit status
+* autogen Examples:: Examples
+
+
+File: autogen.info, Node: autogen usage, Next: autogen input-select, Up: autogen Invocation
+
+5.1 autogen help/usage (`--help')
+=================================
+
+This is the automatically generated usage text for autogen.
+
+ The text printed is the same whether selected with the `help' option
+(`--help') or the `more-help' option (`--more-help'). `more-help' will
+print the usage text by passing it through a pager program.
+`more-help' is disabled on platforms without a working `fork(2)'
+function. The `PAGER' environment variable is used to select the
+program, defaulting to `more'. Both will exit with a status code of 0.
+
+autogen (GNU AutoGen) - The Automated Program Generator - Ver. 5.16.2pre7
+USAGE: autogen [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ <def-file> ]
+
+The following options select definitions, templates and scheme functions
+to use:
+
+ Flg Arg Option-Name Description
+ -L Str templ-dirs Template search directory list
+ - may appear multiple times
+ -T Str override-tpl Override template file
+ - may not be preset
+ -l Str lib-template Library template file
+ - may appear multiple times
+ Str definitions Definitions input file
+ - disabled as --no-definitions
+ - enabled by default
+ - may not be preset
+ -S Str load-scheme Scheme code file to load
+ -F Str load-functions Load scheme function library
+ Str shell name or path name of shell to use
+ -m no no-fmemopen Do not use in-mem streams
+ Str equate characters considered equivalent
+
+The following options modify how output is handled:
+
+ Flg Arg Option-Name Description
+ -b Str base-name Base name for output file(s)
+ - may not be preset
+ no source-time set mod times to latest source
+ - disabled as --no-source-time
+ no writable Allow output files to be writable
+ - disabled as --not-writable
+
+The following options are often useful while debugging new templates:
+
+ Flg Arg Option-Name Description
+ Num loop-limit Limit on increment loops
+ - is scalable with a suffix: k/K/m/M/g/G/t/T
+ - It must lie in one of the ranges:
+ -1 exactly, or
+ 1 to 16777216
+ -t Num timeout Time limit for server shell
+ - It must be in the range:
+ 0 to 3600
+ KWd trace tracing level of detail
+ Str trace-out tracing output file or filter
+ --- show-defs This option has been disabled
+ no used-defines Show the definitions used
+ - may not be preset
+ -C no core Leave a core dump on a failure exit
+
+These options can be used to control what gets processed in the
+definitions files and template files:
+
+ Flg Arg Option-Name Description
+ -s Str skip-suffix Omit the file with this suffix
+ - prohibits these options:
+ select-suffix
+ - may not be preset
+ - may appear multiple times
+ -o Str select-suffix specify this output suffix
+ - may not be preset
+ - may appear multiple times
+ -D Str define name to add to definition list
+ - may appear multiple times
+ -U Str undefine definition list removal pattern
+ - an alternate for define
+
+This option is used to automate dependency tracking:
+
+ Flg Arg Option-Name Description
+ -M opt make-dep emit make dependency file
+ - may not be preset
+ - may appear multiple times
+
+version, usage and configuration options:
+
+ Flg Arg Option-Name Description
+ -R Str reset-option Reset an option's state
+ -v opt version Output version information and exit
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -u no usage Abbreviated usage to stdout
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+AutoGen creates text files from templates using external definitions.
+
+The following option preset mechanisms are supported:
+ - reading file $HOME
+ - reading file ./.autogenrc
+ - examining environment variables named AUTOGEN_*
+
+The valid "trace" option keywords are:
+ nothing debug-message server-shell templates block-macros
+ expressions everything
+ or an integer from 0 through 6
+
+AutoGen is a tool designed for generating program files that contain
+repetitive text with varied substitutions.
+Packaged by Bruce (2012-08-10)
+Report autogen bugs to bkorb@gnu.org
+
+
+File: autogen.info, Node: autogen input-select, Next: autogen out-handling, Prev: autogen usage, Up: autogen Invocation
+
+5.2 input-select options
+========================
+
+The following options select definitions, templates and scheme
+functions to use.
+
+templ-dirs option (-L).
+-----------------------
+
+This is the "template search directory list" option. This option takes
+an argument string `dir'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ Add a directory to the list of directories to search when opening a
+template, either as the primary template or an included one. The last
+entry has the highest priority in the search list. That is to say,
+they are searched in reverse order.
+
+override-tpl option (-T).
+-------------------------
+
+This is the "override template file" option. This option takes an
+argument string `tpl-file'.
+
+This option has some usage constraints. It:
+ * may not be preset with environment variables or configuration
+ (rc/ini) files.
+
+ Definition files specify the standard template that is to be
+expanded. This option will override that name and expand a different
+template.
+
+lib-template option (-l).
+-------------------------
+
+This is the "library template file" option. This option takes an
+argument string `tpl-file'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ DEFINE macros are saved from this template file for use in processing
+the main macro file. Template text aside from the DEFINE macros is is
+ignored.
+
+definitions option.
+-------------------
+
+This is the "definitions input file" option. This option takes an
+argument string `file'.
+
+This option has some usage constraints. It:
+ * is enabled by default.
+
+ * may not be preset with environment variables or configuration
+ (rc/ini) files.
+
+ Use this argument to specify the input definitions file with a
+command line option. If you do not specify this option, then there
+must be a command line argument that specifies the file, even if only
+to specify stdin with a hyphen (`-'). Specify, `--no-definitions' when
+you wish to process a template without any active AutoGen definitions.
+
+load-scheme option (-S).
+------------------------
+
+This is the "scheme code file to load" option. This option takes an
+argument string `file'. Use this option to pre-load Scheme scripts
+into the Guile interpreter before template processing begins. Please
+note that the AutoGen specific functions are not loaded until after
+argument processing. So, though they may be specified in lambda
+functions you define, they may not be invoked until after option
+processing is complete.
+
+load-functions option (-F).
+---------------------------
+
+This is the "load scheme function library" option. This option takes
+an argument string `file'.
+
+This option has some usage constraints. It:
+ * must be compiled in by defining `HAVE_DLOPEN' during the
+ compilation.
+
+ This option is used to load Guile-scheme functions. The
+automatically called initialization routine `scm_init' must be used to
+register these routines or data.
+
+shell option.
+-------------
+
+This is the "name or path name of shell to use" option. This option
+takes an argument string `shell'.
+
+This option has some usage constraints. It:
+ * must be compiled in by defining `SHELL_ENABLED' during the
+ compilation.
+
+ By default, when AutoGen is built, the configuration is probed for a
+reasonable Bourne-like shell to use for shell script processing. If a
+particular template needs an alternate shell, it must be specified with
+this option on the command line, with an environment variable (`SHELL')
+or in the configuration/initialization file.
+
+no-fmemopen option (-m).
+------------------------
+
+This is the "do not use in-mem streams" option. If the local C library
+supports "`fopencookie(3GNU)'", or "`funopen(3BSD)'" then AutoGen
+prefers to use in-memory stream buffer opens instead of anonymous
+files. This may lead to problems if there is a shortage of virtual
+memory. If, for a particular application, you run out of memory, then
+specify this option. This is unlikely in a modern 64-bit virtual
+memory environment.
+
+ On platforms without these functions, the option is accepted but
+ignored. `fmemopen(POSIX)' is not adequate because its string buffer
+is not reallocatable. `open_memstream(POSIX)' is also not adequate
+because the stream is only opened for output. AutoGen needs a
+reallocatable buffer available for both reading and writing.
+
+equate option.
+--------------
+
+This is the "characters considered equivalent" option. This option
+takes an argument string `char-list'. This option will alter the list
+of characters considered equivalent. The default are the three
+characters, "_-^". (The last is conventional on a Tandem/HP-NonStop,
+and I used to do a lot of work on Tandems.)
+
+
+File: autogen.info, Node: autogen out-handling, Next: autogen debug-tpl, Prev: autogen input-select, Up: autogen Invocation
+
+5.3 out-handling options
+========================
+
+The following options modify how output is handled.
+
+base-name option (-b).
+----------------------
+
+This is the "base name for output file(s)" option. This option takes
+an argument string `name'.
+
+This option has some usage constraints. It:
+ * may not be preset with environment variables or configuration
+ (rc/ini) files.
+
+ A template may specify the exact name of the output file. Normally,
+it does not. Instead, the name is composed of the base name of the
+definitions file with suffixes appended. This option will override the
+base name derived from the definitions file name. This is required if
+there is no definitions file and advisable if definitions are being
+read from stdin. If the definitions are being read from standard in,
+the base name defaults to `stdin'. Any leading directory components in
+the name will be silently removed. If you wish the output file to
+appear in a particular directory, it is recommended that you "cd" into
+that directory first, or use directory names in the format specification
+for the output suffix lists, *Note pseudo macro::.
+
+source-time option.
+-------------------
+
+This is the "set mod times to latest source" option. If you stamp your
+output files with the `DNE' macro output, then your output files will
+always be different, even if the content has not really changed. If
+you use this option, then the modification time of the output files
+will change only if the input files change. This will help reduce
+unneeded builds.
+
+writable option.
+----------------
+
+This is the "allow output files to be writable" option. This option
+will leave output files writable. Normally, output files are read-only.
+
+
+File: autogen.info, Node: autogen debug-tpl, Next: autogen processing, Prev: autogen out-handling, Up: autogen Invocation
+
+5.4 debug-tpl options
+=====================
+
+The following options are often useful while debugging new templates.
+They specify limits that prevent the template from taking overly long
+or producing more output than expected.
+
+loop-limit option.
+------------------
+
+This is the "limit on increment loops" option. This option takes an
+argument number `lim'. This option prevents runaway loops. For
+example, if you accidentally specify, "FOR x (for-from 1) (for-to -1)
+(for-by 1)", it will take a long time to finish. If you do have more
+than 256 entries in tables, you will need to specify a new limit with
+this option.
+
+timeout option (-t).
+--------------------
+
+This is the "time limit for server shell" option. This option takes an
+argument number `time-lim'.
+
+This option has some usage constraints. It:
+ * must be compiled in by defining `SHELL_ENABLED' during the
+ compilation.
+
+ AutoGen works with a shell server process. Most normal commands will
+complete in less than 10 seconds. If, however, your commands need more
+time than this, use this option.
+
+ The valid range is 0 to 3600 seconds (1 hour). Zero will disable
+the server time limit.
+
+trace option.
+-------------
+
+This is the "tracing level of detail" option. This option takes an
+argument keyword `level'.
+
+This option has some usage constraints. It:
+ * This option takes a keyword as its argument. The argument sets an
+ enumeration value that can be tested by comparing the option value
+ macro (OPT_VALUE_TRACE). The available keywords are:
+ nothing debug-message server-shell
+ templates block-macros expressions
+ everything
+
+ or their numeric equivalent.
+
+ This option will cause AutoGen to display a trace of its template
+processing. There are six levels, each level including messages from
+the previous levels:
+
+`nothing'
+ Does no tracing at all (default)
+
+`debug-message'
+ Print messages from the "DEBUG" AutoGen macro (*note DEBUG::).
+
+`server-shell'
+ Traces all input and output to the server shell. This includes a
+ shell "independent" initialization script about 30 lines long.
+ Its output is discarded and not inserted into any template.
+
+`templates'
+ Traces the invocation of `DEFINE'd macros and `INCLUDE's
+
+`block-macros'
+ Traces all block macros. The above, plus `IF', `FOR', `CASE' and
+ `WHILE'.
+
+`expressions'
+ Displays the results of expression evaluations.
+
+`everything'
+ Displays the invocation of every AutoGen macro, even `TEXT' macros
+ (i.e. the text outside of macro quotes). Additionally, if you
+ rebuild the "expr.ini" file with debugging enabled, then all calls
+ to AutoGen defined scheme functions will also get logged:
+ cd ${top_builddir}/agen5
+ DEBUG_ENABLED=true bash bootstrap.dir expr.ini
+ make CFLAGS='-g -DDEBUG_ENABLED=1'
+
+ Be aware that you cannot rebuild this source in this way without
+ first having installed the `autogen' executable in your search
+ path. Because of this, "expr.ini" is in the distributed source
+ list, and not in the dependencies.
+
+trace-out option.
+-----------------
+
+This is the "tracing output file or filter" option. This option takes
+an argument string `file'. The output specified may be a file name, a
+file that is appended to, or, if the option argument begins with the
+`pipe' operator (`|'), a command that will receive the tracing output
+as standard in. For example, `--traceout='| less'' will run the trace
+output through the `less' program. Appending to a file is specified by
+preceeding the file name with two greater-than characters (`>>').
+
+show-defs option.
+-----------------
+
+This is the "show the definition tree" option.
+
+This option has some usage constraints. It:
+ * must be compiled in by defining `DEBUG_ENABLED' during the
+ compilation.
+
+ * may not be preset with environment variables or configuration
+ (rc/ini) files.
+
+ This will print out the complete definition tree before processing
+the template.
+
+used-defines option.
+--------------------
+
+This is the "show the definitions used" option.
+
+This option has some usage constraints. It:
+ * may not be preset with environment variables or configuration
+ (rc/ini) files.
+
+ This will print out the names of definition values searched for
+during the processing of the template, whether actually found or not.
+There may be other referenced definitions in a template in portions of
+the template not evaluated. Some of the names listed may be computed
+names and others AutoGen macro arguments. This is not a means for
+producing a definitive, all-encompassing list of all and only the
+values used from a definition file. This is intended as an aid to
+template documentation only.
+
+core option (-C).
+-----------------
+
+This is the "leave a core dump on a failure exit" option.
+
+This option has some usage constraints. It:
+ * must be compiled in by defining `HAVE_SYS_RESOURCE_H' during the
+ compilation.
+
+ Many systems default to a zero sized core limit. If the system has
+the sys/resource.h header and if this option is supplied, then in the
+failure exit path, autogen will attempt to set the soft core limit to
+whatever the hard core limit is. If that does not work, then an
+administrator must raise the hard core size limit.
+
+
+File: autogen.info, Node: autogen processing, Next: autogen dep-track, Prev: autogen debug-tpl, Up: autogen Invocation
+
+5.5 processing options
+======================
+
+These options can be used to control what gets processed in the
+definitions files and template files. They specify which outputs and
+parts of outputs to produce.
+
+skip-suffix option (-s).
+------------------------
+
+This is the "omit the file with this suffix" option. This option takes
+an argument string `suffix'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ * may not be preset with environment variables or configuration
+ (rc/ini) files.
+
+ * must not appear in combination with any of the following options:
+ select-suffix.
+
+ Occasionally, it may not be desirable to produce all of the output
+files specified in the template. (For example, only the `.h' header
+file, but not the `.c' program text.) To do this specify
+`--skip-suffix=c' on the command line.
+
+select-suffix option (-o).
+--------------------------
+
+This is the "specify this output suffix" option. This option takes an
+argument string `suffix'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ * may not be preset with environment variables or configuration
+ (rc/ini) files.
+
+ If you wish to override the suffix specifications in the template,
+you can use one or more copies of this option. See the suffix
+specification in the *note pseudo macro:: section of the info doc.
+
+define option (-D).
+-------------------
+
+This is the "name to add to definition list" option. This option takes
+an argument string `value'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ The AutoGen define names are used for the following purposes:
+
+ 1. Sections of the AutoGen definitions may be enabled or disabled by
+ using C-style #ifdef and #ifndef directives.
+
+ 2. When defining a value for a name, you may specify the index for a
+ particular value. That index may be a literal value, a define
+ option or a value #define-d in the definitions themselves.
+
+ 3. The name of a file may be prefixed with `$NAME/'. The `$NAME'
+ part of the name string will be replaced with the define-d value
+ for `NAME'.
+
+ 4. When AutoGen is finished loading the definitions, the defined
+ values are exported to the environment with, `putenv(3)'. These
+ values can then be used in shell scripts with `${NAME}' references
+ and in templates with `(getenv "NAME")'.
+
+ 5. While processing a template, you may specify an index to retrieve
+ a specific value. That index may also be a define-d value.
+
+ It is entirely equivalent to place this name in the exported
+environment. Internally, that is what AutoGen actually does with this
+option.
+
+undefine option (-U).
+---------------------
+
+This is the "definition list removal pattern" option. This option
+takes an argument string `name-pat'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ * may not be preset with environment variables or configuration
+ (rc/ini) files.
+
+ Similar to 'C', AutoGen uses `#ifdef/#ifndef' preprocessing
+directives. This option will cause the matching names to be removed
+from the list of defined values.
+
+
+File: autogen.info, Node: autogen dep-track, Next: autogen config, Prev: autogen processing, Up: autogen Invocation
+
+5.6 dep-track options
+=====================
+
+This option is used to automate dependency tracking.
+
+make-dep option (-M).
+---------------------
+
+This is the "emit make dependency file" option. This option takes an
+optional argument string `type'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ * may not be preset with environment variables or configuration
+ (rc/ini) files.
+
+ This option behaves fairly closely to the way the `-M' series of
+options work with the gcc compiler, except that instead of just
+emitting the predecessor dependencies, this also emits the successor
+dependencies (output target files). By default, the output dependency
+information will be placed in `<base-name>.d', but may also be
+specified with `-MF<file>'. The time stamp on this file will be
+manipulated so that it will be one second older than the oldest primary
+output file.
+
+ The target in this dependency file will normally be the dependency
+file name, but may also be overridden with `-MT<targ-name>'. AutoGen
+will not alter the contents of that file, but it may create it and it
+will adjust the modification time to match the start time.
+
+ *NB:* these second letters are part of the option argument, so `-MF
+<file>' must have the space character quoted or omitted, and `-M "F
+<file>"' is acceptable because the `F' is part of the option argument.
+
+ `-M' may be followed by any of the letters M, F, P, T, Q, D, or G.
+However, only F, Q, T and P are meaningful. All but F have somewhat
+different meanings. `-MT<name>' is interpreted as meaning `<name>' is
+a sentinel file that will depend on all inputs (templates and
+definition files) and all the output files will depend on this sentinel
+file. It is suitable for use as a real make target. Q is treated
+identically to T, except dollar characters ('$') are doubled. P causes
+a special clean (clobber) phoney rule to be inserted into the make file
+fragment. An empty rule is always created for building the list of
+targets.
+
+ This is the recommended usage:
+ -MFwhatever-you-like.dep -MTyour-sentinel-file -MP
+ and then in your `Makefile', make the `autogen' rule:
+ -include whatever-you-like.dep
+ clean_targets += clean-your-sentinel-file
+
+ your-sentinel-file:
+ autogen -MT$@ -MF$*.d .....
+
+ local-clean :
+ rm -f $(clean_targets)
+
+ The modification time on the dependency file is adjusted to be one
+second before the earliest time stamp of any other output file.
+Consequently, it is suitable for use as the sentinel file testifying to
+the fact the program was successfully run. (`-include' is the GNU make
+way of specifying "include it if it exists". Your make must support
+that feature or your bootstrap process must create the file.)
+
+ All of this may also be specified using the `DEPENDENCIES_OUTPUT' or
+`AUTOGEN_MAKE_DEP' environment variables. If defined, dependency
+information will be output. If defined with white space free text that
+is something other than `true', `false', `yes', `no', `0' or `1', then
+the string is taken to be an output file name. If it contains a string
+of white space characters, the first token is as above and the second
+token is taken to be the target (sentinel) file as `-MT' in the
+paragraphs above. `DEPENDENCIES_OUTPUT' will be ignored if there are
+multiple sequences of white space characters or if its contents are,
+specifically, `false', `no' or `0'.
+
+
+File: autogen.info, Node: autogen config, Next: autogen exit status, Prev: autogen dep-track, Up: autogen Invocation
+
+5.7 presetting/configuring autogen
+==================================
+
+Any option that is not marked as not presettable may be preset by
+loading values from configuration ("rc" or "ini") files, and values
+from environment variables named `AUTOGEN' and `AUTOGEN_<OPTION_NAME>'.
+`<OPTION_NAME>' must be one of the options listed above in upper case
+and segmented with underscores. The `AUTOGEN' variable will be
+tokenized and parsed like the command line. The remaining variables
+are tested for existence and their values are treated like option
+arguments.
+
+`libopts' will search in 2 places for configuration files:
+ * $HOME
+
+ * $PWD
+ The environment variables `HOME', and `PWD' are expanded and
+replaced when `autogen' runs. For any of these that are plain files,
+they are simply processed. For any that are directories, then a file
+named `.autogenrc' is searched for within that directory and processed.
+
+ Configuration files may be in a wide variety of formats. The basic
+format is an option name followed by a value (argument) on the same
+line. Values may be separated from the option name with a colon, equal
+sign or simply white space. Values may be continued across multiple
+lines by escaping the newline with a backslash.
+
+ Multiple programs may also share the same initialization file.
+Common options are collected at the top, followed by program specific
+segments. The segments are separated by lines like:
+ [AUTOGEN]
+ or by
+ <?program autogen>
+ Do not mix these styles within one configuration file.
+
+ Compound values and carefully constructed string values may also be
+specified using XML syntax:
+ <option-name>
+ <sub-opt>...&lt;...&gt;...</sub-opt>
+ </option-name>
+ yielding an `option-name.sub-opt' string value of
+ "...<...>..."
+ `AutoOpts' does not track suboptions. You simply note that it is a
+hierarchicly valued option. `AutoOpts' does provide a means for
+searching the associated name/value pair list (see: optionFindValue).
+
+ The command line options relating to configuration and/or usage help
+are:
+
+version (-v)
+------------
+
+Print the program version to standard out, optionally with licensing
+information, then exit 0. The optional argument specifies how much
+licensing detail to provide. The default is to print just the version.
+The licensing infomation may be selected with an option argument. Only
+the first letter of the argument is examined:
+
+`version'
+ Only print the version. This is the default.
+
+`copyright'
+ Name the copyright usage licensing terms.
+
+`verbose'
+ Print the full copyright usage licensing terms.
+
+usage (-u)
+----------
+
+Print abbreviated usage to standard out, then exit 0.
+
+reset-option (-R)
+-----------------
+
+Resets the specified option to the compiled-in initial state. This
+will undo anything that may have been set by configuration files. The
+option argument may be either the option flag character or its long
+name.
+
+
+File: autogen.info, Node: autogen exit status, Next: autogen Examples, Prev: autogen config, Up: autogen Invocation
+
+5.8 autogen exit status
+=======================
+
+One of the following exit values will be returned:
+`0 (EXIT_SUCCESS)'
+ Successful program execution.
+
+`1 (EXIT_OPTION_ERROR)'
+ The command options were misconfigured.
+
+`2 (EXIT_BAD_TEMPLATE)'
+ An error was encountered processing the template.
+
+`3 (EXIT_BAD_DEFINITIONS)'
+ The definitions could not be deciphered.
+
+`4 (EXIT_LOAD_ERROR)'
+ An error was encountered during the load phase.
+
+`5 (EXIT_SIGNAL)'
+ Program exited due to catching a signal. If your template includes
+ string formatting, a number argument to a "%s" formatting element
+ will trigger a segmentation fault. Autogen will catch the seg
+ fault signal and exit with `AUTOGEN_EXIT_SIGNAL(5)'.
+ Alternatively, AutoGen may have been interrupted with a `kill(2)'
+ signal.
+
+`66 (EX_NOINPUT)'
+ A specified configuration file could not be loaded.
+
+`70 (EX_SOFTWARE)'
+ libopts had an internal operational error. Please report it to
+ autogen-users@lists.sourceforge.net. Thank you.
+
+
+File: autogen.info, Node: autogen Examples, Prev: autogen exit status, Up: autogen Invocation
+
+5.9 autogen Examples
+====================
+
+Here is how the man page is produced:
+ autogen -Tagman-cmd.tpl -MFman-dep -MTstamp-man opts.def
+
+ This command produced this man page from the AutoGen option
+definition file. It overrides the template specified in `opts.def'
+(normally `options.tpl') and uses `agman-cmd.tpl'. It also sets the
+make file dependency output to `man-dep' and the sentinel file (time
+stamp file) to `man-stamp'. The base of the file name is derived from
+the defined `prog-name'.
+
+ The texi invocation document is produced via:
+ autogen -Tagtexi-cmd.tpl -MFtexi-dep -MTtexi-stamp opts.def
+
+
+File: autogen.info, Node: Installation, Next: AutoOpts, Prev: autogen Invocation, Up: Top
+
+6 Configuring and Installing
+****************************
+
+* Menu:
+
+* configuring:: Configuring AutoGen
+* AutoGen CGI:: AutoGen as a CGI server
+* signal names:: Signal Names
+* installing:: Installing AutoGen
+
+
+File: autogen.info, Node: configuring, Next: AutoGen CGI, Up: Installation
+
+6.1 Configuring AutoGen
+=======================
+
+AutoGen is configured and built using Libtool, Automake and Autoconf.
+Consequently, you can install it wherever you wish using the various
+`--prefix' options. To the various configuration options supplied by
+these tools, AutoGen adds a few of its own:
+
+`--disable-shell'
+ AutoGen is now capable of acting as a CGI forms server, *Note
+ AutoGen CGI::. As such, it will gather its definitions using
+ either `GET' or `POST' methods. All you need to do is have a
+ template named `cgi.tpl' handy or specify a different one with a
+ command line option.
+
+ However, doing this without disabling the server shell brings
+ considerable risk. If you were to pass user input to a script
+ that contained, say, the classic "``rm -rf /`'", you might have a
+ problem. This configuration option will cause shell template
+ commands to simply return the command string as the result. No
+ mistakes. Much safer. Strongly recommended. The default is to
+ have server shell scripting enabled.
+
+ Disabling the shell will have some build side effects, too.
+
+ * Many of the make check tests will fail, since they assume a
+ working server shell.
+
+ * The getdefs and columns programs are not built. The options
+ are distributed as definition files and they cannot be
+ expanded with a shell-disabled AutoGen.
+
+ * Similarly, the documentation cannot be regenerated because
+ the documentation templates depend on subshell functionality.
+
+`--enable-debug'
+ Turning on AutoGen debugging enables very detailed inspection of
+ the input definitions and monitoring shell script processing.
+ These options are not particularly useful to anyone not directly
+ involved in maintaining AutoGen. If you do choose to enable
+ AutoGen debugging, be aware that the usage page was generated
+ without these options, so when the build process reaches the
+ documentation rebuild, there will be a failure. `cd' into the
+ `agen5' build directory, `make' the `autogen.texi' file and all
+ will be well thereafter.
+
+`--with-regex-header'
+`--with-header-path'
+`--with-regex-lib'
+ These three work together to specify how to compile with and link
+ to a particular POSIX regular expression library. The value for
+ `--with-regex-header=value' must be the name of the relevant header
+ file. The AutoGen sources will attempt to include that source with
+ a `#include <value>' C preprocessing statement. The `path' from
+ the `--with-header-path=path' will be added to `CPPFLAGS' as
+ `-Ipath'. The `lib-specs' from `--with-regex-lib=lib-specs' will
+ be added to `LDFLAGS' without any adornment.
+
+
+File: autogen.info, Node: AutoGen CGI, Next: signal names, Prev: configuring, Up: Installation
+
+6.2 AutoGen as a CGI server
+===========================
+
+AutoGen is now capable of acting as a CGI forms server. It behaves as
+a CGI server if the definitions input is from stdin and the environment
+variable `REQUEST_METHOD' is defined and set to either "GET" or "POST".
+If set to anything else, AutoGen will exit with a failure message.
+When set to one of those values, the CGI data will be converted to
+AutoGen definitions (*note Definitions File::) and the template named
+"`cgi.tpl'" will be processed.
+
+ This works by including the name of the real template to process in
+the form data and having the "`cgi.tpl'" template include that template
+for processing. I do this for processing the form
+`http://autogen.sourceforge.net/conftest.html'. The "`cgi.tpl'" looks
+approximately like this:
+
+ <? AutoGen5 Template ?>
+ <?
+ IF (not (exist? "template")) ?><?
+ form-error ?><?
+
+ ELIF (=* (get "template") "/") ?><?
+ form-error ?><?
+
+ ELIF (define tpl-file (string-append "cgi-tpl/"
+ (get "template")))
+ (access? tpl-file R_OK) ?><?
+ INCLUDE (. tpl-file) ?><?
+
+ ELIF (set! tpl-file (string-append tpl-file ".tpl"))
+ (access? tpl-file R_OK) ?><?
+ INCLUDE (. tpl-file) ?><?
+
+ ELSE ?><?
+ form-error ?><?
+ ENDIF ?>
+
+This forces the template to be found in the "`cgi-tpl/'" directory.
+Note also that there is no suffix specified in the pseudo macro (*note
+pseudo macro::). That tells AutoGen to emit the output to `stdout'.
+
+ The output is actually spooled until it is complete so that, in the
+case of an error, the output can be discarded and a proper error
+message can be written in its stead.
+
+ *Please also note* that it is advisable, _especially_ for network
+accessible machines, to configure AutoGen (*note configuring::) with
+shell processing disabled (`--disable-shell'). That will make it
+impossible for any referenced template to hand data to a subshell for
+interpretation.
+
+
+File: autogen.info, Node: signal names, Next: installing, Prev: AutoGen CGI, Up: Installation
+
+6.3 Signal Names
+================
+
+When AutoGen is first built, it tries to use `psignal(3)',
+`sys_siglist', `strsigno(3)' and `strsignal(3)' from the host operating
+system. If your system does not supply these, the AutoGen distribution
+will. However, it will use the distributed mapping and this mapping is
+unlikely to match what your system uses. This can be fixed. Once you
+have installed autogen, the mapping can be rebuilt on the host
+operating system. To do so, you must perform the following steps:
+
+ 1. Build and install AutoGen in a place where it will be found in your
+ search path.
+
+ 2. `cd ${top_srcdir}/compat'
+
+ 3. `autogen strsignal.def'
+
+ 4. Verify the results by examining the `strsignal.h' file produced.
+
+ 5. Re-build and re-install AutoGen.
+
+ If you have any problems or peculiarities that cause this process to
+fail on your platform, please send me copies of the header files
+containing the signal names and numbers, along with the full path names
+of these files. I will endeavor to fix it. There is a shell script
+inside of `strsignal.def' that tries to hunt down the information.
+
+
+File: autogen.info, Node: installing, Prev: signal names, Up: Installation
+
+6.4 Installing AutoGen
+======================
+
+There are several files that get installed. The number depend whether
+or not both shared and archive libraries are to be installed. The
+following assumes that everything is installed relative to `$prefix'.
+You can, of course, use `configure' to place these files where you wish.
+
+ *NB* AutoGen does not contain any compiled-in path names. All
+support directories are located via option processing, the environment
+variable `HOME' or finding the directory where the executable came from.
+
+ The installed files are:
+
+ 1. The executables in `bin' (autogen, getdefs and columns).
+
+ 2. The AutoOpts link libraries as `lib/libopts.*'.
+
+ 3. An include file in `include/options.h', needed for Automated
+ Option Processing (see next chapter).
+
+ 4. Several template files and a scheme script in `share/autogen',
+ needed for Automated Option Processing (*note AutoOpts::), parsing
+ definitions written with scheme syntax (*note Dynamic Text::), the
+ templates for producing documentation for your program (*note
+ documentation attributes::), autoconf test macros, and AutoFSM.
+
+ 5. Info-style help files as `info/autogen.info*'. These files
+ document AutoGen, the option processing library AutoOpts, and
+ several add-on components.
+
+ 6. The three man pages for the three executables are installed in
+ man/man1.
+
+ This program, library and supporting files can be installed with
+three commands:
+
+ * <src-dir>/configure [ <configure-options> ]
+
+ * make
+
+ * make install
+
+ However, you may wish to insert `make check' before the `make
+install' command.
+
+ If you do perform a `make check' and there are any failures, you
+will find the results in `<module>/test/FAILURES'. Needless to say, I
+would be interested in seeing the contents of those files and any
+associated messages. If you choose to go on and analyze one of these
+failures, you will need to invoke the test scripts individually. You
+may do so by specifying the test (or list of test) in the TESTS make
+variable, thus:
+
+ gmake TESTS=test-name.test check
+
+ I specify `gmake' because most makes will not let you override
+internal definitions with command line arguments. `gmake' does.
+
+ All of the AutoGen tests are written to honor the contents of the
+VERBOSE environment variable. Normally, any commentary generated
+during a test run is discarded unless the VERBOSE environment variable
+is set. So, to see what is happening during the test, you might invoke
+the following with bash or ksh:
+
+ VERBOSE=1 gmake TESTS="for.test forcomma.test" check
+
+Or equivalently with csh:
+
+ env VERBOSE=1 gmake TESTS="for.test forcomma.test" check
+
+
+File: autogen.info, Node: AutoOpts, Next: Add-Ons, Prev: Installation, Up: Top
+
+7 Automated Option Processing
+*****************************
+
+AutoOpts 36.5 is bundled with AutoGen. It is a tool that virtually
+eliminates the hassle of processing options and keeping man pages, info
+docs and usage text up to date. This package allows you to specify
+several program attributes, up to a hundred option types and many
+option attributes. From this, it then produces all the code necessary
+to parse and handle the command line and configuration file options,
+and the documentation that should go with your program as well.
+
+ All the features notwithstanding, some applications simply have
+well-established command line interfaces. Even still, those programs
+may use the configuration file parsing portion of the library. See the
+"AutoOpts Features" and "Configuration File Format" sections.
+
+* Menu:
+
+* Features:: AutoOpts Features
+* Licensing:: AutoOpts Licensing
+* Caveats:: Developer and User Notes
+* Quick Start:: Quick Start
+* Option Definitions:: Option Definitions
+* AutoOpts API:: Programmatic Interface
+* Multi-Threading:: Multi-Threading
+* option descriptor:: Option Descriptor File
+* Using AutoOpts:: Using AutoOpts
+* Presetting Options:: Configuring your program
+* Config File Format:: Configuration File Format
+* shell options:: AutoOpts for Shell Scripts
+* AutoInfo:: Automated Info Docs
+* AutoMan pages:: Automated Man Pages
+* getopt_long:: Using getopt(3C)
+* i18n:: Internationalizing AutoOpts
+* Naming Conflicts:: Naming Conflicts
+* All Attribute Names:: All Attribute Names
+* Option Define Names:: Option Definition Name Index
+
+
+File: autogen.info, Node: Features, Next: Licensing, Up: AutoOpts
+
+7.1 AutoOpts Features
+=====================
+
+AutoOpts supports option processing; option state saving; and program
+documentation with innumerable features. Here, we list a few obvious
+ones and some important ones, but the full list is really defined by
+all the attributes defined in the *note Option Definitions:: section.
+
+ 1. POSIX-compliant short (flag) option processing.
+
+ 2. GNU-style long options processing. Long options are recognized
+ without case sensitivity, and they may be abbreviated.
+
+ 3. Environment variable initializations, *Note environrc::.
+
+ 4. Initialization from configuration files (aka RC or INI files), and
+ saving the option state back into one, *Note loading rcfile::.
+
+ 5. Config files may be partitioned. One config file may be used by
+ several programs by partitioning it with lines containing,
+ "`[PROGRAM_NAME]'" or "`<?program-name>'", *Note loading rcfile::.
+
+ 6. Config files may contain AutoOpts directives. "`<?auto-options
+ [[option-text]]>'" may be used to set `AutoOpts' option processing
+ options. Viz., `GNU' usage layout versus `AutoOpts' conventional
+ layout, and `misuse-usage' versus `no-misuse-usage', *Note usage
+ attributes::.
+
+ 7. Options may be marked as `dis-abled' with a disablement prefix.
+ Such options may default to either an enabled or a disabled state.
+ You may also provide an enablement prefix, too, e.g.,
+ `--allow-mumble' and `--prevent-mumble' (*note Common
+ Attributes::).
+
+ 8. Verify that required options are present between the minimum and
+ maximum number of times on the command line. Verify that
+ conflicting options do not appear together. Verify that options
+ requiring the presence of other options are, in fact, used in the
+ presence of other options. See *Note Common Attributes::, and
+ *Note Option Conflict Attributes::.
+
+ 9. There are several *note automatically supported options: automatic
+ options. They will have short flags if any options have option
+ flags and the flags are not suppressed. The associated flag may
+ be altered or suppressed by specifying no value or an alternate
+ character for "`xxx-value;'" in the option definition file.
+ "`xxx'" is the name of the option below:
+
+ `--help'
+ `--more-help'
+ These are always available. `--more-help' will pass the full
+ usage text through a pager.
+
+ `--usage'
+ This is added to the option list if `usage-opt' is specified.
+ It yields the abbreviated usage to `stdout'.
+
+ `--version'
+ This is added to the option list if `version = xxx;' is
+ specified.
+
+ `--load-opts'
+ `--save-opts'
+ These are added to the option list if `homerc' is specified.
+ Mostly. If, `disable-save' is specified, then `--save-opts'
+ is disabled.
+
+ 10. Various forms of main procedures can be added to the output, *Note
+ Generated main::. There are four basic forms:
+
+ a. A program that processes the arguments and writes to standard
+ out portable shell commands containing the digested options.
+
+ b. A program that will generate portable shell commands to parse
+ the defined options. The expectation is that this result
+ will be copied into a shell script and used there.
+
+ c. A "for-each" main that will invoke a named function once for
+ either each non-option argument on the command line or, if
+ there are none, then once for each non-blank, non-comment
+ input line read from stdin.
+
+ d. A main procedure of your own design. Its code can be
+ supplied in the option description template or by
+ incorporating another template.
+
+ 11. There are several methods for handling option arguments.
+ * nothing (*note OPT_ARG::) option argument strings are
+ globally available.
+
+ * user supplied (*note Option Argument Handling::)
+
+ * stack option arguments (*note Option Argument Handling::)
+
+ * integer numbers (*note arg-type number::)
+
+ * true or false valued (*note arg-type boolean::)
+
+ * enumerated list of names (*note arg-type keyword::)
+
+ * an enumeration (membership) set (*note arg-type set
+ membership::)
+
+ * a list of name/value pairs (option "subopts") (*note arg-type
+ hierarchy::)
+
+ * a time duration or a specific time and date
+
+ * validated file name (*note arg-type file name::)
+
+ * optional option argument (*note arg-optional::)
+
+ 12. The generated usage text can be emitted in either AutoOpts standard
+ format (maximizing the information about each option), or GNU-ish
+ normal form. The default form is selected by either specifying or
+ not specifying the `gnu-usage' attribute (*note information
+ attributes::). This can be overridden by the user himself with the
+ `AUTOOPTS_USAGE' environment variable. If it exists and is set to
+ the string `gnu', it will force GNU-ish style format; if it is set
+ to the string `autoopts', it will force AutoOpts standard format;
+ otherwise, it will have no effect.
+
+ 13. The usage text and many other strings are stored in a single
+ character array (*note string table functions: SCM
+ string-table-new.). This reduces fixup costs when loading the
+ program or library. The downside is that if GCC detects that any
+ of these strings are used in a printf format, you may get the
+ warning, `embedded '\0' in format'. To eliminate the warning, you
+ must provide GCC with the `-Wno-format-contains-nul' option.
+
+ 14. If you compile with `ENABLE_NLS' defined and `_()' defined to a
+ localization function (e.g. `gettext(3GNU)'), then the option
+ processing code will be localizable (*note i18n::). Provided also
+ that you do not define the `no-xlate' attribute to _anything_
+ (*note presentation attributes::).
+
+ 15. Provides a callable routine to parse a text string as if it were
+ from one of the rc/ini/config files, hereafter referred to as a
+ configuration file.
+
+ 16. By adding a `doc' and `arg-name' attributes to each option,
+ AutoGen will also be able to produce a man page and the `invoking'
+ section of a texinfo document.
+
+ 17. Intermingled option processing. AutoOpts options may be
+ intermingled with command line operands and options processed with
+ other parsing techniques. This is accomplished by setting the
+ `allow-errors' (*note program attributes::) attribute. When
+ processing reaches a point where `optionProcess' (*note
+ libopts-optionProcess::) needs to be called again, the current
+ option can be set with `RESTART_OPT(n)' (*note RESTART_OPT::)
+ before calling `optionProcess'.
+
+ See: *Note library attributes::.
+
+ 18. Library suppliers can specify command line options that their
+ client programs will accept. They specify option definitions that
+ get `#include'-d into the client option definitions and they
+ specify an "anchor" option that has a callback and must be invoked.
+ That will give the library access to the option state for their
+ options.
+
+ 19. library options. An AutoOpt-ed library may export its options for
+ use in an AutoOpt-ed program. This is done by providing an option
+ definition file that client programs `#include' into their own
+ option definitions. See "AutoOpt-ed Library for AutoOpt-ed
+ Program" (*note lib and program::) for more details.
+
+
+File: autogen.info, Node: Licensing, Next: Caveats, Prev: Features, Up: AutoOpts
+
+7.2 AutoOpts Licensing
+======================
+
+When AutoGen is installed, the AutoOpts project is installed with it.
+AutoOpts includes various AutoGen templates and a pair of shared
+libraries. These libraries may be used under the terms of version 3 of
+the GNU Lesser General Public License (LGPL).
+
+ One of these libraries (`libopts') is needed by programs that are
+built using AutoOpts generated code. This library is available as a
+separate "tear-off" source tarball. It is redistributable for use
+under either of two licenses: The above mentioned GNU Lesser General
+Public License, and the advertising-clause-free BSD license. Both of
+these license terms are incorporated into appropriate COPYING files
+included with the `libopts' source tarball. This source may be
+incorporated into your package with the following simple commands:
+
+ rm -rf libopts libopts-*
+ gunzip -c `autoopts-config libsrc` | \
+ tar -xvf -
+ mv libopts-*.*.* libopts
+
+ View the `libopts/README' file for further integration information.
+
+
+File: autogen.info, Node: Caveats, Next: Quick Start, Prev: Licensing, Up: AutoOpts
+
+7.3 Developer and User Notes
+============================
+
+AutoOpts has its conventional way of displaying option information that
+includes somewhat more information that the standard GNU method.
+AutoOpts will also print out a line of usage text for each option type
+when options are misspecified. GNU programs typically do not do this.
+These defaults can be changed on a per-program basis by adding either
+or both of the following in the option definition file:
+
+ gnu-usage;
+ no-misuse-usage;
+
+ Users may also override these settings with the `AUTOOPTS_USAGE'
+environment variable. It may be set to a comma or white space separated
+list of the following strings:
+
+`gnu'
+ The format of the extended usage text will be displayed in
+ GNU-normal form. The default display for `--version' will be to
+ include a note on licensing terms.
+
+`autoopts'
+ The format of the extended usage will be in AutoOpts' native
+ layout.
+
+`no-misuse-usage'
+ When an option error is made on the command line, the abbreviated
+ usage text will be suppressed.
+
+`misuse-usage'
+ When an option error is made on the command line, the abbreviated
+ usage text will be shown.
+
+The setting used is the last one seen. The `autoopts' and
+`misuse-usage' serve no purpose, unless the definition file entries
+were specified as above.
+
+ Note for developers:
+
+ The templates used to implement AutoOpts depend heavily upon token
+pasting. That mens that if you name an option, "debug", for example,
+the generated header will expect to be able to emit `#define' macros
+such as this:
+ #define DESC(n) (autogenOptions.pOptDesc[INDEX_OPT_## n])
+ and expect `DESC(DEBUG)' to expand correctly into
+`(autogenOptions.pOptDesc[INDEX_OPT_DEBUG])'. If `DEBUG' is `#defined'
+to something else, then that something else will be in the above
+expansion.
+
+ If you discover you are having strange problems like this, you may
+wish to use some variation of the `guard-option-names' *Note program
+attributes::.
+
+
+File: autogen.info, Node: Quick Start, Next: Option Definitions, Prev: Caveats, Up: AutoOpts
+
+7.4 Quick Start
+===============
+
+Since it is generally easier to start with a simple example than it is
+to look at the options that AutoGen uses itself, here is a very simple
+AutoOpts example. You can copy this example out of the Info file and
+into a source file to try it. You can then embellish it into what you
+really need. For more extensive examples, you can also examine the help
+output and option definitions for the commands `columns', `getdefs' and
+`autogen' itself.
+
+ For our simple example, assume you have a program named `check' that
+takes two options:
+
+ 1. A list of directories to check over for whatever it is `check'
+ does. You want this option available as a POSIX-style flag option
+ and a GNU long option. You want to allow as many of these as the
+ user wishes.
+
+ 2. An option to show or not show the definition tree being used.
+ Only one occurrence is to be allowed, specifying one or the other.
+
+First, specify your program attributes and its options to AutoOpts, as
+with the following example.
+
+ AutoGen Definitions options;
+ prog-name = check;
+ prog-title = "Checkout Automated Options";
+ long-opts;
+ gnu-usage; /* GNU style preferred to default */
+
+ main = { main-type = shell-process; };
+
+ flag = {
+ name = check-dirs;
+ value = L; /* flag style option character */
+ arg-type = string; /* option argument indication */
+ max = NOLIMIT; /* occurrence limit (none) */
+ stack-arg; /* save opt args in a stack */
+ descrip = "Checkout directory list";
+ doc = 'name of each directory that is to be "checked out".';
+ };
+
+ flag = {
+ name = show_defs;
+ descrip = "Show the definition tree";
+ disable = dont; /* mark as enable/disable type */
+ /* option. Disable as `dont-' */
+ doc = 'disable, if you do not want to see the tree.';
+ };
+
+This program will produce a program that digests its options and writes
+the values as shell script code to stdout. Run the following short
+script to produce this program:
+
+ base=check
+ BASE=`echo $base | tr a-z- A-Z_`
+ cflags="-DTEST_${BASE} `autoopts-config cflags`"
+ ldflags="`autoopts-config ldflags`"
+ autogen ${base}.def
+ cc -o ${base} -g ${cflags} ${base}.c ${ldflags}
+ ./${base} --help
+
+Running those commands yields:
+
+ check - Checkout Automated Options
+ USAGE: check [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
+
+ -L, --check-dirs=str Checkout directory list
+ - may appear multiple times
+ --show-defs Show the definition tree
+ - disabled as --dont-show-defs
+ -?, --help Display extended usage information and exit
+ -!, --more-help Extended usage information passed thru pager
+
+ Options are specified by doubled hyphens and their name or by a single
+ hyphen and the flag character.
+ Packaged by Bruce (2012-08-11)
+ Report check bugs to bkorb@gnu.org
+
+Normally, however, you would not use the "main" clause. Instead, the
+file would be named something like `checkopt.def', you would compile
+`checkopt.c' the usual way, and link the object with the rest of your
+program.
+
+ The options are processed by calling `optionProcess' (*note
+libopts-optionProcess::):
+
+ main( int argc, char** argv )
+ {
+ {
+ int optct = optionProcess( &checkOptions, argc, argv );
+ argc -= optct;
+ argv += optct;
+ }
+
+ The options are tested and used as in the following fragment.
+"`ENABLED_OPT'" is used instead of "`HAVE_OPT'" for the `show-defs'
+option because it is an enabled/disabled option type:
+
+ if ( ENABLED_OPT( SHOW_DEFS )
+ && HAVE_OPT( CHECK_DIRS )) {
+ int dirct = STACKCT_OPT( CHECK_DIRS );
+ char** dirs = STACKLST_OPT( CHECK_DIRS );
+ while (dirct-- > 0) {
+ char* dir = *dirs++;
+ ...
+
+ The "doc" clauses are used in the flag stanzas for man pages and
+texinfo invoking documentation. With the above definition file, the
+two following commands will produce the two documentation files
+`check.1' and `invoke-check.texi'. The latter file will be generated
+as a chapter, rather than a section or subsection.
+
+ autogen -Tagman-cmd check.def
+ autogen -DLEVEL=chapter -Tagtexi-cmd -binvoke-check.texi check.def
+
+The result of which is left as an exercise for the reader.
+
+ A lot of magic happens to make this happen. The rest of this
+chapter will describe the myriad of option attributes supported by
+AutoOpts. However, keep in mind that, in general, you won't need much
+more than what was described in this "quick start" section.
+
+
+File: autogen.info, Node: Option Definitions, Next: AutoOpts API, Prev: Quick Start, Up: AutoOpts
+
+7.5 Option Definitions
+======================
+
+AutoOpts uses an AutoGen definitions file for the definitions of the
+program options and overall configuration attributes. The complete
+list of program and option attributes is quite extensive, so if you are
+reading to understand how to use AutoOpts, I recommend reading the
+"Quick Start" section (*note Quick Start::) and paying attention to the
+following:
+
+ 1. `prog-name', `prog-title', and `argument', program attributes,
+ *Note program attributes::.
+
+ 2. `name' and `descrip' option attributes, *Note Required
+ Attributes::.
+
+ 3. `value' (flag character) and `min' (occurrence counts) option
+ attributes, *Note Common Attributes::.
+
+ 4. `arg-type' from the option argument specification section, *Note
+ Option Arguments::.
+
+ 5. Read the overall how to, *Note Using AutoOpts::.
+
+ 6. Highly recommended, but not required, are the several "man" and
+ "info" documentation attributes, *Note documentation attributes::.
+
+ Keep in mind that the majority are rarely used and can be safely
+ignored. However, when you have special option processing requirements,
+the flexibility is there.
+
+* Menu:
+
+* program attributes:: Program Description Attributes
+* library attributes:: Options for Library Code
+* information attributes:: Program Information Attributes
+* Generated main:: Generating main procedures
+* option attributes:: Option Attributes
+* Option Arguments:: Option Argument Specification
+* Option Argument Handling:: Option Argument Handling
+* Internationalizing Options:: Internationalizing Options
+* documentation attributes:: Man and Info doc Attributes
+* automatic options:: Automatically Supported Options
+* standard options:: Library of Standard Options
+
+
+File: autogen.info, Node: program attributes, Next: library attributes, Up: Option Definitions
+
+7.5.1 Program Description Attributes
+------------------------------------
+
+The following global definitions are used to define attributes of the
+entire program. These generally alter the configuration or global
+behavior of the AutoOpts option parser. The first two are required of
+every program. The third is required if there are to be any left over
+arguments (operands) after option processing. The rest have been
+grouped below. Except as noted, there may be only one copy of each of
+these definitions:
+
+`prog-name'
+ This attribute is required. Variable names derived from this name
+ are derived using `string->c_name!' (*note SCM string->c-name!::).
+
+`prog-title'
+ This attribute is required and may be any descriptive text.
+
+`argument'
+ This attribute is required if your program uses operand arguments.
+ It specifies the syntax of the arguments that *follow* the options.
+ It may not be empty, but if it is not supplied, then option
+ processing must consume all the arguments. If it is supplied and
+ starts with an open bracket (`['), then there is no requirement on
+ the presence or absence of command line arguments following the
+ options. Lastly, if it is supplied and does not start with an
+ open bracket, then option processing must *not* consume all of the
+ command line arguments.
+
+`config-header'
+ If your build has a configuration header, it must be included
+ before anything else. Specifying the configuration header file
+ name with this attribute will cause that to happen.
+
+* Menu:
+
+* usage attributes:: Usage and Version Info Display
+* config attributes:: Program Configuration
+* programming attributes:: Programming Details
+* presentation attributes:: User Presentation Attributes
+
+
+File: autogen.info, Node: usage attributes, Next: config attributes, Up: program attributes
+
+7.5.1.1 Usage and Version Info Display
+......................................
+
+These will affect the way usage is seen and whether or not version
+information gets displayed.
+
+`full-usage'
+ If this attribute is provided, it may specify the full length
+ usage text, or a variable name assignable to a "char const *"
+ pointer, or it may be empty. The meanings are determined by the
+ length.
+ * If not provided, the text will be computed as normal.
+
+ * If the length is zero, then the usage text will be derived
+ from the current settings and inserted as text into the
+ generated .c file.
+
+ * If the length is 1 to 32 bytes, then it is presumed to be a
+ variable name that either points to or is an array of const
+ chars.
+
+ * If it is longer than that, it is presumed to be the help text
+ itself. This text will be inserted into the generated .c
+ file.
+
+ This string should be readily translatable. Provision will be made
+ to translate it if this is provided, if the source code is
+ compiled with `ENABLE_NLS' defined, and `no-xlate' has not been
+ set to the value _anything_.
+
+`short-usage'
+ If this attribute is provided, it is used to specify an abbreviated
+ version of the usage text. This text is constructed in the same
+ way as the "full-usage", described above.
+
+`gnu-usage'
+ AutoOpts normaly displays usage text in a format that provides more
+ information than the standard GNU layout, but that also means it is
+ not the standard GNU layout. This attribute changes the default to
+ GNU layout, with the `AUTOOPTS_USAGE' environment variable used to
+ request `autoopts' layout. See *Note Developer and User Notes:
+ Caveats.
+
+`usage-opt'
+ I apologize for too many confusing usages of usage. This
+ attribute specifies that `--usage' and/or `-u' be supported. The
+ help (usage) text displayed will be abbreviated when compared to
+ the default help text.
+
+`no-misuse-usage'
+ When there is a command line syntax error, by default AutoOpts will
+ display the abbreviated usage text, rather than just a one line
+ "you goofed it, ask for usage" message. You can change the default
+ behavior for your program by supplying this attribute. The user
+ may override this choice, again, with the `AUTOOPTS_USAGE'
+ environment variable. See *Note Developer and User Notes: Caveats.
+
+`prog-group'
+ The version text in the `getopt.tpl' template will include this
+ text in parentheses after the program name, when this attribute is
+ specified. For example:
+ mumble (stumble) 1.0
+ says that the "`mumble'" program is version 1.0 and is part of the
+ "`stumble'" group of programs.
+
+`usage'
+ If your program has some cleanup work that must be done before
+ exiting on usage mode issues, or if you have to customize the
+ usage message in some way, specify this procedure and it will be
+ called instead of the default `optionUsage()' function. For
+ example, if a program is using the curses library and needs to
+ invoke the usage display, then you must arrange to call `endwin()'
+ before invoking the library function `optionUsage()'. This can be
+ handled by specifying your own usage function, thus:
+ void
+ my_usage(tOptions * opts, int ex)
+ {
+ if (curses_window_active)
+ endwin();
+ optionUsage(opts, ex);
+ }
+
+`version'
+ Specifies the program version and activates the VERSION option,
+ *Note automatic options::.
+
+
+File: autogen.info, Node: config attributes, Next: programming attributes, Prev: usage attributes, Up: program attributes
+
+7.5.1.2 Program Configuration
+.............................
+
+Programs may be "pre-configured" before normal command line options are
+processed (See *note Immediate Action Attributes: Immediate Action.).
+How configuration files and environment variables are handled get
+specified with these attributes.
+
+`disable-load'
+`disable-save'
+ Indicates that the command line usage of `--load-opts' and/or
+ `--save-opts' are disallowed.
+
+`environrc'
+ Indicates looking in the environment for values of variables named,
+ `PROGRAM_OPTNAME' or `PROGRAM', where `PROGRAM' is the upper cased
+ `C-name' of the program and `OPTNAME' is the upper cased `C-name'
+ of a specific option. The contents of the `PROGRAM' variable, if
+ found, are tokenized and processed. The contents of
+ `PROGRAM_OPTNAME' environment variables are taken as the option
+ argument to the option nameed `optname'.
+
+`homerc'
+ Specifies that option settings may be loaded from and stored into
+ configuration files. Each instance of this attribute is either a
+ directory or a file using a specific path, a path based on an
+ environment variable or a path relative to installation
+ directories. The method used depends on the name. If the one
+ entry is empty, it enables the loading and storing of settings,
+ but no specific files are searched for. Otherwise, a series of
+ configuration files are hunted down and, if found, loaded.
+
+ If the first character of the `homerc' value is not the dollar
+ character (`$'), then it is presumed to be a path name based on the
+ current directory. Otherwise, the method depends on the second
+ character:
+
+ `$'
+ The path is relative to the directory where the executable
+ was found.
+
+ `@'
+ The path is relative to the package data directory, e.g.
+ `/usr/local/share/autogen'.
+
+ `[a-zA-Z]'
+ The path is derived from the named environment variable.
+
+ Use as many as you like. The presence of this attribute activates
+ the `--save-opts' and `--load-opts' options. However, saving into
+ a file may be disabled with the `disable-save'. *Note loading
+ rcfile::. See the `optionMakePath(3AGEN)' man page for
+ excruciating details.
+
+`rcfile'
+ Specifies the configuration file name. This is only useful if you
+ have provided at least one `homerc' attribute.
+ default: .<prog-name>rc
+
+`vendor-opt'
+ This option implements the `-W' vendor option command line option.
+
+ For POSIX specified utilities, the options are constrained to the
+ options that are specified by POSIX. Extensions should be handled
+ with `-W' command line options, the short flag form. Long option
+ name processing must be disabled. In fact, the `long-opts'
+ attribute must not be provided, and some options must be specified
+ without flag values.
+
+ The `-W long-name' is processed by looking up the long option name
+ that follows it. It cannot be a short flag because that would
+ conflict with the POSIX flag name space. It will be processed as
+ if long options were accepted and `--long-name' were found on the
+ command line.
+
+
+File: autogen.info, Node: programming attributes, Next: presentation attributes, Prev: config attributes, Up: program attributes
+
+7.5.1.3 Programming Details
+...........................
+
+These attributes affect some of the ways that the option data are used
+and made available to the program.
+
+`config-header'
+ The contents of this attribute should be just the name of the
+ configuration file. A "#include" naming this file will be
+ inserted at the top of the generated header.
+
+`exit-name'
+`exit-desc'
+ These values should be defined as indexed values, thus:
+ exit-name[0] = success;
+ exit-desc[0] = 'Successful program execution.';
+ exit-name[1] = failure;
+ exit-desc[1] = 'The operation failed or command syntax was not valid.';
+ By default, all programs have these effectively defined for them.
+ They may be overridden by explicitly defining any or all of these
+ values. Additional names and descriptions may be defined. They
+ will cause an enumeration to be emitted, like this one for
+ `getdefs':
+ typedef enum {
+ GETDEFS_EXIT_SUCCESS = 0,
+ GETDEFS_EXIT_FAILURE = 1
+ } getdefs_exit_code_t;
+ which will be augmented by any `exit-name' definitions beyond "1".
+
+`usage-message'
+ This attribute will cause two procedures to be added to the code
+ file: `usage_message' and `vusage_message', with any applicable
+ prefix (see `prefix', below). They are declared in the generated
+ header, thus:
+ extern void vusage_message(char const * fmt, va_list ap);
+ extern void usage_message(char const * fmt, ...);
+ These functions print the message to `stderr' and invoke the usage
+ function with the exit code set to `1' (`EXIT_FAILURE').
+
+`die-code'
+ This tells AutoOpts templates to emit code for `vdie', `die' and
+ `fserr' functions. If the `die-code' is assigned a text value,
+ then that code will be inserted in the `vdie' function immediately
+ before it prints the death rattle message.
+
+ The profiles for these functions are:
+ extern void vdie( int exit_code, char const * fmt, va_list);
+ extern void die( int exit_code, char const * fmt, ...);
+ extern void fserr(int exit_code, char const * op, char const * fname);
+
+`export'
+ This string is inserted into the .h interface file. Generally
+ used for global variables or `#include' directives required by
+ `flag-code' text and shared with other program text. Do not
+ specify your configuration header (`config.h') in this attribute
+ or the `include' attribute, however. Instead, use
+ `config-header', above.
+
+`guard-option-names'
+ AutoOpts generates macros that presume that there are no `cpp'
+ macros with the same name as the option name. For example, if you
+ have an option named, `debug', then you must not use `#ifdef
+ DEBUG' in your code. If you specify this attribute, every option
+ name will be guarded. If the name is `#define'-d, then a warning
+ will be issued and the name undefined. If you do not specify this
+ and there is a conflict, you will get strange error messages.
+
+ This attribute may be set to any of four recognized states:
+
+ * Not defined. AutoOpts will behave as described above.
+
+ * Defined, but set to the empty string. Text will be emitted
+ into the header to undefine (`#undef') any conflicting
+ preprocessor macros. The code will include compiler warnings
+ (via `#warning'). Some compilers are not ANSI-C-99 compliant
+ yet and will error out on those warnings. You may compile
+ with `-DNO_OPTION_NAME_WARNINGS' to silence or mostly silence
+ them.
+
+ * Defined and set to the string, "`no-warning'". All of the
+ needed `#undef's will be emitted, without any conflict
+ checking `#warning' directives emitted.
+
+ * Defined and set to the string, "`full-enum'". The option
+ manipulation preprocessor macros will not token paste the
+ option names to the index enumeration prefix. e.g. you will
+ need to use `HAVE_OPT(INDEX_OPT_DEBUG)' instead of
+ `HAVE_OPT(DEBUG)'.
+
+`include'
+ This string is inserted into the .c file. Generally used for
+ global variables required only by `flag-code' program text.
+
+`no-libopts'
+ If you are going to handle your option processing with the
+ `getopt.tpl' template instead of using libopts, then specify this
+ attribute. It will suppress mention of `--more-help' in the
+ generated documentation. (`getopt_long' does not support
+ `--more-help'.)
+
+`prefix'
+ This value is inserted into *all* global names. This will
+ disambiguate them if more than one set of options are to be
+ compiled into a single program.
+
+
+File: autogen.info, Node: presentation attributes, Prev: programming attributes, Up: program attributes
+
+7.5.1.4 User Presentation Attributes
+....................................
+
+Attributes that affect the user's experience.
+
+`allow-errors'
+ The presence of this attribute indicates ignoring any command line
+ option errors. This may also be turned on and off by invoking the
+ macros `ERRSKIP_OPTERR' and `ERRSTOP_OPTERR' from the generated
+ interface file.
+
+`long-opts'
+ Presence indicates GNU-standard long option processing. Partial
+ name matches are accepted, if they are at least two characters
+ long and the partial match is unique. The matching is not case
+ sensitive, and the underscore, hyphen and carat characters are all
+ equivalent (they match).
+
+ If any options do not have an option value (flag character)
+ specified, and least one does specify such a value, then you must
+ specify `long-opts'. If none of your options specify an option
+ value (flag character) and you do not specify `long-opts', then
+ command line arguments are processed in "named option mode". This
+ means that:
+
+ * Every command line argument must be a long option.
+
+ * The flag markers `-' and `--' are completely optional.
+
+ * The `argument' program attribute is disallowed.
+
+ * One of the options may be specified as the default (as long
+ as it has a required option argument).
+
+`no-xlate'
+ Modifies when or whether option names get translated. If provided,
+ it must be assigned one of these values:
+ `opt-cfg'
+ to suppress option name translation for configuration file
+ and and environment variable processing.
+
+ `opt'
+ to suppress option name translation completely. The usage
+ text will always be translated if `ENABLE_NLS' is defined and
+ you have translations for that text.
+
+ `anything'
+ Specifies disabling all internationalization support for
+ option code, completely.
+ See also the various `XLAT' interface entries in the AutoOpts
+ Programmatic Interface section (*note AutoOpts API::).
+
+`reorder-args'
+ Normally, POSIX compliant commands do not allow for options to be
+ interleaved with operands. If this is necessary for historical
+ reasons, there are two approaches available:
+ * Allow `optionProcess' to return the index of the operand like
+ it normally does and process the operand(s). When an operand
+ is encountered that starts with a hyphen, then set the
+ AutoOpts current index with the `RESTART_OPT' macro (see
+ *note RESTART_OPT::), and re-invoke `optionProcess'. This
+ will also allow you to process the operands in context.
+
+ * Specify this attribute. AutoOpts will re-order the command
+ arguments so that the operands appear (in the original order)
+ at the end of the argument list. Differing configuration
+ state is not possible to detect after all options have been
+ processed.
+
+`resettable'
+ Specifies that the `--reset-option' command line option is to be
+ supported. This makes it possible to suppress any setting that
+ might be found in a configuration file or environment variable.
+
+
+File: autogen.info, Node: library attributes, Next: information attributes, Prev: program attributes, Up: Option Definitions
+
+7.5.2 Options for Library Code
+------------------------------
+
+Some libraries provide their own code for processing command line
+options, and this may be used by programs that utilize AutoOpts. You
+may also wish to write a library that gets configured with AutoOpts
+options and config files. Such a library may either supply its own
+configury routine and process its own options, or it may export its
+option descriptions to programs that also use AutoOpts. This section
+will describe how to do all of these different things.
+
+* Menu:
+
+* lib and program:: AutoOpt-ed Library for AutoOpt-ed Program
+* lib called:: AutoOpt-ed Library for Regular Program
+* prog calls lib:: AutoOpt-ed Program Calls Regular Library
+
+
+File: autogen.info, Node: lib and program, Next: lib called, Up: library attributes
+
+7.5.2.1 AutoOpt-ed Library for AutoOpt-ed Program
+.................................................
+
+The library source code must provide an option definition file that
+consists of only the attribute `library' and `flag' entries. The
+"library" attribute does not need any associated value, so it will
+generally appeary by itself on a line folowed by a semi-colon. The
+first `flag' entry must contain the following attributes:
+
+`name'
+ This name is used in the construction of a global pointer of type
+ `tOptDesc const*'. It is always required.
+
+`documentation'
+ It tells `AutoOpts' that this option serves no normal purpose. It
+ will be used to add usage clarity and to locate option descriptors
+ in the library code.
+
+`descrip'
+ This is a string that is inserted in the extended usage display
+ before the options specific to the current library. It is always
+ required.
+
+`lib-name'
+ This should match the name of the library. This string is also
+ used in the construction of the option descriptor pointer name.
+ In the end, it looks like this:
+ extern tOptDesc const* <<lib-name>>_<<name>>_optDesc_p;
+ and is used in the macros generated for the library's `.h' file.
+
+ In order to compile this `AutoOpts' using library, you must create a
+special header that is not used by the client program. This is
+accomplished by creating an option definition file that contains
+essentially exactly the following:
+
+ AutoGen definitions options;
+ prog-name = does-not-matter; // but is always required
+ prog-title = 'also does not matter'; // also required
+ config-header = 'config.h'; // optional, but common
+ library;
+ #include library-options-only.def
+
+and nothing else. AutoGen will produce only the `.h' file. You may
+now compile your library, referencing just this `.h' file. The macros
+it creates will utilize a global variable that will be defined by the
+`AutoOpts'-using client program. That program will need to have the
+following `#include' in its option definition file:
+
+ #include library-options-only.def
+
+All the right things will magically happen so that the global variables
+named `<<lib-name>>_<<name>>_optDesc_p' are initialized correctly. For
+an example, please see the `AutoOpts' test script:
+`autoopts/test/library.test'.
+
+
+File: autogen.info, Node: lib called, Next: prog calls lib, Prev: lib and program, Up: library attributes
+
+7.5.2.2 AutoOpt-ed Library for Regular Program
+..............................................
+
+In this case, your library must provide an option processing function
+to a calling program. This is accomplished by setting the
+`allow-errors' global option attribute. Each time your option handling
+function is called, you must determine where your scan is to resume and
+tell the AutoOpts library by invoking:
+
+ RESTART_OPT(next_arg_index);
+
+and then invoke `not_opt_index = optionProcess(...)'. The
+`not_opt_index' value can be used to set `optind', if that is the
+global being used to scan the program argument array.
+
+ In this method, do *NOT* utilize the global `library' attribute.
+Your library must specify its options as if it were a complete program.
+You may choose to specify an alternate `usage()' function so that usage
+for other parts of the option interface may be displayed as well. See
+"Program Information Attributes" (*note information attributes::).
+
+ At the moment, there is no method for calling `optionUsage()' telling
+it to produce just the information about the options and not the program
+as a whole. Some later revision after somebody asks.
+
+
+File: autogen.info, Node: prog calls lib, Prev: lib called, Up: library attributes
+
+7.5.2.3 AutoOpt-ed Program Calls Regular Library
+................................................
+
+As with providing an `AutoOpt'-ed library to a non-`AutoOpt'-ed
+program, you must write the option description file as if you were
+writing all the options for the program, but you should specify the
+`allow-errors' global option attribute and you will likely want an
+alternate `usage()' function (see "Program Information Attributes"
+*note information attributes::). In this case, though, when
+`optionProcess()' returns, you need to test to see if there might be
+library options. If there might be, then call the library's exported
+routine for handling command line options, set the
+next-option-to-process with the `RESTART_OPT()' macro, and recall
+`optionProcess()'. Repeat until done.
+
+
+File: autogen.info, Node: information attributes, Next: Generated main, Prev: library attributes, Up: Option Definitions
+
+7.5.3 Program Information Attributes
+------------------------------------
+
+These attributes are used to define how and what information is
+displayed to the user of the program.
+
+`copyright'
+ The `copyright' is a structured value containing three to five
+ values. If `copyright' is used, then the first three are required.
+
+ 1. `date' - the list of applicable dates for the copyright.
+
+ 2. `owner' - the name of the copyright holder.
+
+ 3. `type' - specifies the type of distribution license.
+ AutoOpts/AutoGen supports the text of the GNU Public License
+ (`gpl'), the GNU "Lesser" General Public License with Library
+ extensions (`lgpl'), the Modified Free BSD license (`mbsd')
+ and a few others. Other licenses may be specified, but you
+ must provide your own license file. The list of license
+ files provided by AutoOpts may be seen by typing:
+ ls $(autoopts-config pkgdatadir)/*.lic
+
+ 4. `text' - the text of the copyright notice. This must be
+ provided if `type' is set to `NOTE'.
+
+ 5. `author' - in case the author name is to appear in the
+ documentation and is different from the copyright owner.
+
+ 6. `eaddr' - email address for receiving praises and complaints.
+ Typically that of the author or copyright holder.
+
+ An example of this might be:
+ copyright = {
+ date = "1992-2012";
+ owner = "Bruce Korb";
+ eaddr = 'bkorb@gnu.org';
+ type = GPL;
+ };
+
+`detail'
+ This string is added to the usage output when the HELP option is
+ selected.
+
+`explain'
+ Gives additional information whenever the usage routine is invoked.
+
+`package'
+ The name of the package the program belongs to. This will appear
+ parenthetically after the program name in the version and usage
+ output, e.g.: `autogen (GNU autogen) - The Automated Program
+ Generator'.
+
+`preserve-case'
+ This attribute will not change anything except appearance.
+ Normally, the option names are all documented in lower case.
+ However, if you specify this attribute, then they will display in
+ the case used in their specification. Command line options will
+ still be matched without case sensitivity. This is useful for
+ specifying option names in camel-case.
+
+`prog-desc *and*'
+`opts-ptr'
+ These define global pointer variables that point to the program
+ descriptor and the first option descriptor for a library option.
+ This is intended for use by certain libraries that need command
+ line and/or initialization file option processing. These
+ definitions have no effect on the option template output, but are
+ used for creating a library interface file. Normally, the first
+ "option" for a library will be a documentation option that cannot
+ be specified on the command line, but is marked as `settable'.
+ The library client program will invoke the `SET_OPTION' macro
+ which will invoke a handler function that will finally set these
+ global variables.
+
+`usage'
+ Optionally names the usage procedure, if the library routine
+ `optionUsage()' does not work for you. If you specify `my_usage'
+ as the value of this attribute, for example, you will use a
+ procedure by that name for displaying usage. Of course, you will
+ need to provide that procedure and it must conform to this profile:
+ void my_usage( tOptions* pOptions, int exitCode )
+
+`gnu-usage'
+ Normally, the default format produced by the `optionUsage'
+ procedure is AutoOpts Standard. By specifying this attribute, the
+ default format will be GNU-ish style. Either default may be
+ overridden by the user with the `AUTOOPTS_USAGE' environment
+ variable. If it is set to `gnu' or `autoopts', it will alter the
+ style appropriately. This attribute will conflict with the
+ `usage' attribute.
+
+`reorder-args'
+ Some applications traditionally require that the command operands
+ be intermixed with the command options. In order to handle that,
+ the arguments must be reordered. If you are writing such an
+ application, specify this global option. All of the options (and
+ any associated option arguments) will be brought to the beginning
+ of the argument list. New applications should not use this
+ feature, if at all possible. This feature is disabled if
+ `POSIXLY_CORRECT' is defined in the environment.
+
+
+File: autogen.info, Node: Generated main, Next: option attributes, Prev: information attributes, Up: Option Definitions
+
+7.5.4 Generating main procedures
+--------------------------------
+
+When AutoOpts generates the code to parse the command line options, it
+has the ability to produce any of several types of `main()' procedures.
+This is done by specifying a global structured value for `main'. The
+values that it contains are dependent on the value set for the one
+value it must have: `main-type'.
+
+ The recognized values for `main-type' are:
+
+* Menu:
+
+* main guile:: guile: main and inner_main procedures
+* main shell-process:: shell-process: emit Bourne shell results
+* main shell-parser:: shell-parser: emit Bourne shell script
+* main main:: main: user supplied main procedure
+* main include:: include: code emitted from included template
+* main invoke:: invoke: code emitted from AutoGen macro
+* main for-each:: for-each: perform function on each argument
+
+ Here is an example of an `include' variation:
+
+ main = {
+ main-type = include;
+ tpl = "main-template.tpl";
+ };
+
+
+File: autogen.info, Node: main guile, Next: main shell-process, Up: Generated main
+
+7.5.4.1 guile: main and inner_main procedures
+.............................................
+
+When the `main-type' is specified to be `guile', a `main()' procedure
+is generated that calls `gh_enter()', providing it with a generated
+`inner_main()' to invoke. If you must perform certain tasks before
+calling `gh_enter()', you may specify such code in the value for the `before-guile-boot'
+attribute.
+
+ The `inner_main()' procedure itself will process the command line
+arguments (by calling `optionProcess()', *note
+libopts-optionProcess::), and then either invoke the code specified
+with the `guile-main' attribute, or else export the parsed options to
+Guile symbols and invoke the `scm_shell()' function from the Guile
+library. This latter will render the program nearly identical to the
+stock `guile(1)' program.
+
+
+File: autogen.info, Node: main shell-process, Next: main shell-parser, Prev: main guile, Up: Generated main
+
+7.5.4.2 shell-process: emit Bourne shell results
+................................................
+
+This will produce a `main()' procedure that parses the command line
+options and emits to `stdout' Bourne shell commands that puts the
+option state into environment variables. This can be used within a
+shell script as follows:
+
+ unset OPTION_CT
+ eval "`opt_parser \"$@\"`"
+ test -z "${OPTION_CT}" && exit 1
+ test ${OPTION_CT} -gt 0 && shift ${OPTION_CT}
+
+ If the option parsing code detects an error or a request for usage,
+it will not emit an assignment to OPTION_CT and the script should just
+exit. If the options are set consistently, then something along the
+lines of the following will be written to `stdout' and evaled:
+
+ OPTION_CT=4
+ export OPTION_CT
+ MYPROG_SECOND='first'
+ export MYPROG_SECOND
+ MYPROG_ANOTHER=1 # 0x1
+ export MYPROG_ANOTHER
+
+If the arguments are to be reordered, however, then the resulting set
+of operands will be emitted and `OPTION_CT' gets set to zero. For
+example, the following would be appended to the above:
+
+ set -- 'operand1' 'operand2' 'operand3'
+ OPTION_CT=0
+
+`OPTION_CT' is set to zero since it is not necessary to shift off any
+options.
+
+
+File: autogen.info, Node: main shell-parser, Next: main main, Prev: main shell-process, Up: Generated main
+
+7.5.4.3 shell-parser: emit Bourne shell script
+..............................................
+
+This will produce a `main()' procedure that emits a shell script that
+will parse the command line options. That script can be emitted to
+`stdout' or inserted or substituted into a pre-existing shell script
+file. Improbable markers are used to identify previously inserted
+parsing text:
+
+ # # # # # # # # # # -- do not modify this marker --
+
+The program is also pretty insistent upon starting its parsing script
+on the second line.
+
+
+File: autogen.info, Node: main main, Next: main include, Prev: main shell-parser, Up: Generated main
+
+7.5.4.4 main: user supplied main procedure
+..........................................
+
+You must supply a value for the `main-text' attribute. You may also
+supply a value for `option-code'. If you do, then the `optionProcess'
+invocation will not be emitted into the code. AutoOpts will wrap the
+`main-text' inside of:
+
+ int
+ main( int argc, char** argv )
+ {
+ { // replaced by option-code, if that exists
+ int ct = optionProcess( &<<prog-name>>Options, argc, argv );
+ argc -= ct;
+ argv += ct;
+ }
+ <<your main-text goes here>>
+ }
+
+so you can most conveniently set the value with a "`here string'"
+(*note here-string::):
+
+ code = <<- _EndOfMainProc_
+ <<your text goes here>>
+ _EndOfMainProc_;
+
+
+File: autogen.info, Node: main include, Next: main invoke, Prev: main main, Up: Generated main
+
+7.5.4.5 include: code emitted from included template
+....................................................
+
+You must write a template to produce your main procedure. You specify
+the name of the template with the `tpl' attribute and it will be
+incorporated at the point where AutoOpts is ready to emit the `main()'
+procedure.
+
+ This can be very useful if, in your working environment, you have
+many programs with highly similar `main()' procedures. All you need to
+do is parameterize the variations and specify which variant is needed
+within the `main' AutoOpts specification. Since you are coding the
+template for this, the attributes needed for this variation would be
+dictated by your template.
+
+
+File: autogen.info, Node: main invoke, Next: main for-each, Prev: main include, Up: Generated main
+
+7.5.4.6 invoke: code emitted from AutoGen macro
+...............................................
+
+You must write a template to produce your main procedure. That template
+must contain a definition for the function specified with the `func'
+attribute to this `main()' procedure specification. Typically, this
+template will be incorporated by using the `--lib-template' option
+(*note autogen lib-template::) in the AutoGen invocation. Otherwise,
+this variation operates in much the same way as "`include'" (*note main
+include::) method.
+
+
+File: autogen.info, Node: main for-each, Prev: main invoke, Up: Generated main
+
+7.5.4.7 for-each: perform function on each argument
+...................................................
+
+This produces a main procedure that invokes a procedure once for each
+operand on the command line (non-option arguments), *OR* once for each
+non-blank, non-comment `stdin' input line. Leading and trailing white
+space is trimmed from the input line and comment lines are lines that
+are empty or begin with a comment character, defaulting to a hash ('#')
+character.
+
+ *NB*: The `argument' program attribute (*note program attributes::)
+must begin with the `[' character, to indicate that there are command
+operands, but that they are optional.
+
+ There are a number of attributes to `main' that may be used:
+
+`handler-proc'
+ This attribute is required. It is used to name the procedure to
+ call. That procedure is presumed to be external, but if you
+ provide the code for it, then the procedure is emitted as a static
+ procedure in the generated code.
+
+ This procedure should return 0 on success, a cumulative error code
+ on warning and exit without returning on an unrecoverable error.
+ As the cumulative warning codes are or-ed together, the codes
+ should be some sort of bit mask in order to be ultimately
+ decipherable (if you need to do that).
+
+ If the called procedure needs to cause a fail-exit, it is expected
+ to call `exit(3)' directly. If you want to cause a warning exit
+ code, then this handler function should return a non-zero status.
+ That value will be *OR*-ed into a result integer for computing the
+ final exit code. E.g., here is part of the emitted code:
+
+ int res = 0;
+ if (argc > 0) {
+ do {
+ res |= my_handler( *(argv++) );
+ } while (--argc > 0);
+ } else { ...
+
+`handler-type'
+ If you do not supply this attribute, your handler procedure must be
+ the default type. The profile of the procedure must be:
+
+ int my_handler( char const *pz_entry );
+
+ However, if you do supply this attribute, you may set the value to
+ any of four alternate flavors:
+
+ `name-of-file'
+ This is essentially the same as the default handler type,
+ except that before your procedure is invoked, the generated
+ code has verified that the string names an existing file.
+ The profile is unchanged.
+
+ `file-X'
+ Before calling your procedure, the file is f-opened according
+ to the "X", where "X" may be any of the legal modes for
+ `fopen(3C)'. In this case, the profile for your procedure
+ must be:
+
+ int my_handler( char const* pz_fname, FILE* entry_fp );
+
+ `text-of-file'
+ `some-text-of-file'
+ Before calling your procedure, the contents of the file are
+ read or mapped into memory. (Excessively large files may
+ cause problems.) The `some-text-of-file' disallows empty
+ files. Both require regular files. In this case, the profile
+ for your procedure must be:
+
+ program_exit_code_t
+ my_handler(char const* pz_fname, char* file_text,
+ size_t text_size);
+
+ Note that though the `file_text' is not `const', any changes
+ made to it are not written back to the original file. It is
+ merely a memory image of the file contents. Also, the memory
+ allocated to hold the text is `text_size + 1' bytes long and
+ the final byte is always `NUL'. The file contents need not
+ be text, as the data are read with the `read(2)' system call.
+
+ If you select one of these file type handlers, then on access or
+ usage errors the `PROGRAM_EXIT_FAILURE' exit code will, by
+ default, be or-ed into the final exit code. This can be changed
+ by specifying the global `file-fail-code' attribute and naming a
+ different value. That is, something other than `failure'. You
+ may choose `success', in which case file access issues will not
+ affect the exit code and the error message will not be printed.
+
+`my_handler-code'
+ With this attribute, you provide the code for your handler
+ procedure in the option definition file. In this case, your
+ `main()' procedure specification might look something like this:
+
+ main = {
+ main-type = for-each;
+ handler-proc = my_handler;
+ my_handler-code = <<- EndOfMyCode
+ /* whatever you want to do */
+ EndOfMyCode;
+ };
+
+ and instead of an emitted external reference, a procedure will be
+ emitted that looks like this:
+
+ static int
+ my_handler( char const* pz_entry )
+ {
+ int res = 0;
+ <<my_handler-code goes here>>
+ return res;
+ }
+
+`main-init'
+ This is code that gets inserted after the options have been
+ processed, but before the handler procs get invoked.
+
+`main-fini'
+ This is code that gets inserted after all the entries have been
+ processed, just before returning from `main()'.
+
+`comment-char'
+ If you wish comment lines to start with a character other than a
+ hash (`#') character, then specify one character with this
+ attribute. If that character is the `NUL' byte, then only blank
+ lines will be considered comments.
+
+
+File: autogen.info, Node: option attributes, Next: Option Arguments, Prev: Generated main, Up: Option Definitions
+
+7.5.5 Option Attributes
+-----------------------
+
+For each option you wish to specify, you must have a block macro named
+`flag' defined. There are two required attributes: `name' and
+`descrip'. If any options do not have a `value' (traditional flag
+character) attribute, then the `long-opts' program attribute must also
+be defined. As a special exception, if no options have a `value' *and*
+`long-opts' is not defined *and* `argument' is not defined, then all
+arguments to the program are named options. In this case, the `-' and
+`--' command line option markers are optional.
+
+* Menu:
+
+* Required Attributes:: Required Attributes
+* Common Attributes:: Common Option Attributes
+* Immediate Action:: Immediate Action Attributes
+* Option Conflict Attributes:: Option Conflict Attributes
+
+These option attributes do not fit well with the above categories.
+
+* opt-attr settable:: Program may set option
+* opt-attr no-preset:: Option cannot be pre-configured
+* opt-attr equivalence:: Option Equivalence Class
+* opt-attr aliases:: Option Aliasing
+* opt-attr default option:: Default Option
+* opt-attr documentation:: Option Sectioning Comment
+* opt-attr translators:: Translator Notes
+
+
+File: autogen.info, Node: Required Attributes, Next: Common Attributes, Up: option attributes
+
+7.5.5.1 Required Attributes
+...........................
+
+Every option must have exactly one copy of both of these attributes.
+
+`name'
+ Long name for the option. Even if you are not accepting long
+ options and are only accepting flags, it must be provided.
+ AutoOpts generates private, named storage that requires this name.
+ This name also causes a `#define'-d name to be emitted. It must
+ not conflict with any other names you may be using in your program.
+
+ For example, if your option name is, `debug' or `munged-up', you
+ must not use the `#define' names `DEBUG' (or `MUNGED_UP') in your
+ program for non-AutoOpts related purposes. They are now used by
+ AutoOpts.
+
+ Sometimes (most especially under Windows), you may get a surprise.
+ For example, `INTERFACE' is apparently a user space name that one
+ should be free to use. Windows usurps this name. To solve this,
+ you must do one of the following:
+
+ 1. Change the name of your option
+
+ 2. add the program attribute (*note program attributes::):
+
+ export = '#undef INTERFACE';
+
+ 3. add the program attribute:
+
+ guard-option-names;
+
+`descrip'
+ Except for documentation options, a *very* brief description of the
+ option. About 40 characters on one line, maximum, not counting
+ any texinfo markups. Texinfo markups are stripped before printing
+ in the usage text. It appears on the `usage()' output next to the
+ option name.
+
+ If, however, the option is a documentation option, it will appear
+ on one or more lines by itself. It is thus used to visually
+ separate and comment upon groups of options in the usage text.
+
+
+File: autogen.info, Node: Common Attributes, Next: Immediate Action, Prev: Required Attributes, Up: option attributes
+
+7.5.5.2 Common Option Attributes
+................................
+
+These option attributes are optional. Any that do appear in the
+definition of a flag, may appear only once.
+
+`value'
+ The flag character to specify for traditional option flags, e.g.,
+ `-L'.
+
+`max'
+ Maximum occurrence count (invalid if DISABLE present). The
+ default maximum is 1. `NOLIMIT' can be used for the value,
+ otherwise it must be a number or a `#define' that evaluates to a
+ number.
+
+`min'
+ Minimum occurrence count. If present, then the option *must*
+ appear on the command line. Do not define it with the value zero
+ (0).
+
+`must-set'
+ If an option must be specified, but it need not be specified on
+ the command line, then specify this attribute for the option.
+
+`deprecated'
+ There are two effects to this attribute: the usage text will not
+ show the option, and the generated documentation will mark it with:
+ "_NOTE: THIS OPTION IS DEPRECATED_".
+
+`disable'
+ Prefix for disabling (inverting sense of) the option. Only useful
+ if long option names are being processed. When an option has this
+ attribute, the test `ENABLED_OPT(OPTNAME)' is false when either of
+ the following is true:
+ * The option has not been specified and the `enable' attribute
+ has not been specified.
+
+ * The option has been specified with this disabling prefix.
+ To detect that the option has been specified with the disabling
+ prefix, you must use:
+ HAVE_OPT(OPTNAME) && ! ENABLED_OPT(OPTNAME)
+
+`enable'
+ Long-name prefix for enabling the option (invalid if DISABLE *not*
+ present). Only useful if long option names are being processed.
+
+`enabled'
+ If default is for option being enabled. (Otherwise, the
+ OPTST_DISABLED bit is set at compile time.) Only useful if the
+ option can be disabled.
+
+`ifdef'
+`ifndef'
+`omitted-usage'
+ If an option is relevant on certain platforms or when certain
+ features are enabled or disabled, you can specify the compile time
+ flag used to indicate when the option should be compiled in or
+ out. For example, if you have a configurable feature, `mumble'
+ that is indicated with the compile time define, `WITH_MUMBLING',
+ then add:
+
+ ifdef = WITH_MUMBLING;
+
+ Take care when using these. There are several caveats:
+
+ * The case and spelling must match whatever is specified.
+
+ * Do not confuse these attributes with the AutoGen directives
+ of the same names, *Note Directives::. These cause C
+ preprocessing directives to be inserted into the generated C
+ text.
+
+ * Only one of `ifdef' and `ifndef' may apply to any one option.
+
+ * The `VALUE_OPT_' values are `#define'-d. If `WITH_MUMBLING'
+ is not defined, then the associated `VALUE_OPT_' value will
+ not be `#define'-d either. So, if you have an option named,
+ `MUMBLING' that is active only if `WITH_MUMBLING' is
+ `#define'-d, then `VALUE_OPT_MUMBLING' will be `#define'-d
+ iff `WITH_MUMBLING' is `#define'-d. Watch those switch
+ statements.
+
+ * If you specify `omitted-usage', then the option will be
+ recognized as disabled when it is configured out of the
+ build, but will yield the message, "This option has been
+ disabled." You may specify an alternate message by giving
+ `omitted-usage' a string value. e.g.:
+ omitted-usage = 'you cannot do this';
+
+`no-command'
+ This option specifies that the option is not allowed on the
+ command line. Such an option may not take a `value' (flag
+ character) attribute. The program must have the `homerc' (*note
+ program attributes::) option set.
+
+
+File: autogen.info, Node: Immediate Action, Next: Option Conflict Attributes, Prev: Common Attributes, Up: option attributes
+
+7.5.5.3 Immediate Action Attributes
+...................................
+
+Certain options may need to be processed early. For example, in order
+to suppress the processing of configuration files, it is necessary to
+process the command line option `--no-load-opts' *before* the config
+files are processed. To accommodate this, certain options may have
+their enabled or disabled forms marked for immediate processing. The
+consequence of this is that they are processed ahead of all other
+options in the reverse of normal order.
+
+ Normally, the first options processed are the options specified in
+the first `homerc' file, followed by then next `homerc' file through to
+the end of config file processing. Next, environment variables are
+processed and finally, the command line options. The later options
+override settings processed earlier. That actually gives them higher
+priority. Command line immediate action options actually have the
+lowest priority of all. They would be used only if they are to have an
+effect on the processing of subsequent options.
+
+`immediate'
+ Use this option attribute to specify that the enabled form of the
+ option is to be processed immediately. The `help' and `more-help'
+ options are so specified. They will also call `exit()' upon
+ completion, so they *do* have an effect on the processing of the
+ remaining options :-).
+
+`immed-disable'
+ Use this option attribute to specify that the disabled form of the
+ option is to be processed immediately. The `load-opts' option is
+ so specified. The `--no-load-opts' command line option will
+ suppress the processing of config files and environment variables.
+ Contrariwise, the `--load-opts' command line option is processed
+ normally. That means that the options specified in that file will
+ be processed after all the `homerc' files and, in fact, after
+ options that precede it on the command line.
+
+`also'
+ If either the `immediate' or the `immed-disable' attributes are
+ set to the string, "`also'", then the option will actually be
+ processed twice: first at the immediate processing phase and again
+ at the "normal" time.
+
+
+File: autogen.info, Node: Option Conflict Attributes, Next: opt-attr settable, Prev: Immediate Action, Up: option attributes
+
+7.5.5.4 Option Conflict Attributes
+..................................
+
+These attributes may be used as many times as you need. They are used
+at the end of the option processing to verify that the context within
+which each option is found does not conflict with the presence or
+absence of other options.
+
+ This is not a complete cover of all possible conflicts and
+requirements, but it simple to implement and covers the more common
+situations.
+
+`flags-must'
+ one entry for every option that *must* be present when this option
+ is present
+
+`flags-cant'
+ one entry for every option that *cannot* be present when this
+ option is present
+
+
+File: autogen.info, Node: opt-attr settable, Next: opt-attr no-preset, Prev: Option Conflict Attributes, Up: option attributes
+
+7.5.5.5 Program may set option
+..............................
+
+If the option can be set outside of option processing, specify
+"`settable'". If this attribute is defined, special macros for setting
+this particular option will be inserted into the interface file. For
+example, `TEMPL_DIRS' is a settable option for AutoGen, so a macro named
+`SET_OPT_TEMPL_DIRS(a)' appears in the interface file. This attribute
+interacts with the DOCUMENTATION attribute.
+
+
+File: autogen.info, Node: opt-attr no-preset, Next: opt-attr equivalence, Prev: opt-attr settable, Up: option attributes
+
+7.5.5.6 Option cannot be pre-configured
+.......................................
+
+If presetting this option is not allowed, specify "`no-preset'".
+(Thus, environment variables and values set in configuration files will
+be ignored.)
+
+
+File: autogen.info, Node: opt-attr equivalence, Next: opt-attr aliases, Prev: opt-attr no-preset, Up: option attributes
+
+7.5.5.7 Option Equivalence Class
+................................
+
+Generally, when several options are mutually exclusive and basically
+serve the purpose of selecting one of several processing modes, specify
+the "`equivalence'" attribute. These options will be considered an
+equivalence class. Sometimes, it is just easier to deal with them as
+such. All members of the equivalence class must contain the same
+equivalenced-to option, including the equivalenced-to option itself.
+Thus, it must be a class member.
+
+ For an option equivalence class, there is a single occurrence
+counter for the class. It can be referenced with the interface macro,
+`COUNT_OPT(BASE_OPTION)', where "BASE_OPTION" is the equivalenced-to
+option name.
+
+ Also, please take careful note: since the options are mapped to the
+equivalenced-to option descriptor, any option argument values are
+mapped to that descriptor also. Be sure you know which "equivalent
+option" was selected before getting an option argument value!
+
+ During the presetting phase of option processing (*note Presetting
+Options::), equivalenced options may be specified. However, if
+different equivalenced members are specified, only the last instance
+will be recognized and the others will be discarded. A conflict error
+is indicated only when multiple different members appear on the command
+line itself.
+
+ As an example of where equivalenced options might be useful,
+`cpio(1)' has three options `-o', `-i', and `-p' that define the
+operational mode of the program (`create', `extract' and
+`pass-through', respectively). They form an equivalence class from
+which one and only one member must appear on the command line. If
+`cpio' were an AutoOpt-ed program, then each of these option
+definitions would contain:
+
+ equivalence = create;
+
+ and the program would be able to determine the operating mode with
+code that worked something like this:
+
+ switch (WHICH_IDX_CREATE) {
+ case INDEX_OPT_CREATE: ...
+ case INDEX_OPT_EXTRACT: ...
+ case INDEX_OPT_PASS_THROUGH: ...
+ default: /* cannot happen */
+ }
+
+
+File: autogen.info, Node: opt-attr aliases, Next: opt-attr default option, Prev: opt-attr equivalence, Up: option attributes
+
+7.5.5.8 Option Aliasing
+.......................
+
+Sometimes, for backwards compatibility or tradition or just plain
+convenience, it works better to define one option as a pure alias for
+another option. For such situations, provide the following pieces of
+information:
+ flag = {
+ name = aliasing-option-name;
+ value = aliasing-flag-char; // optional !
+ aliases = aliased-to-option;
+ };
+ Do not provide anything else. The usage text for such an option
+will be:
+ This is an alias for aliased-to-option
+
diff --git a/doc/autogen.info-2 b/doc/autogen.info-2
new file mode 100644
index 0000000..ae59b42
--- /dev/null
+++ b/doc/autogen.info-2
@@ -0,0 +1,7195 @@
+This is autogen.info, produced by makeinfo version 4.13 from
+/old-home/bkorb/ag/ag/doc//agdoc.texi.
+
+This manual is for GNU AutoGen version 5.16, updated August 2012.
+
+ Copyright (C) 1992-2012 by Bruce Korb.
+
+ Permission is granted to copy, distribute and/or modify this
+ document under the terms of the GNU Free Documentation License,
+ Version 1.2 or any later version published by the Free Software
+ Foundation; with no Invariant Sections, no Front-Cover Texts, and
+ no Back-Cover Texts.
+
+INFO-DIR-SECTION GNU programming tools
+START-INFO-DIR-ENTRY
+* AutoGen: (autogen). The Automated Program Generator
+END-INFO-DIR-ENTRY
+
+ This file documents GNU AutoGen Version 5.16.
+
+ AutoGen copyright (C) 1992-2012 Bruce Korb AutoOpts copyright (C)
+1992-2012 Bruce Korb snprintfv copyright (C) 1999-2000 Gary V. Vaughan
+
+ AutoGen is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation, either version 3 of the License, or (at your
+option) any later version.
+
+ AutoGen is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+File: autogen.info, Node: opt-attr default option, Next: opt-attr documentation, Prev: opt-attr aliases, Up: option attributes
+
+7.5.5.9 Default Option
+......................
+
+If your program processes its arguments in named option mode (See
+`long-opts' in *note program attributes::), then you may select *one*
+of your options to be the default option. Do so by using attribute
+`default' with one of the options. The option so specified must have
+an `arg-type' (*note Option Arguments::) specified, but not the
+`arg-optional' (*note arg-optional::) attribute. That is to say, the
+option argument must be required.
+
+ If you have done this, then any arguments that do not match an
+option name and do not contain an equal sign (`=') will be interpreted
+as an option argument to the default option.
+
+
+File: autogen.info, Node: opt-attr documentation, Next: opt-attr translators, Prev: opt-attr default option, Up: option attributes
+
+7.5.5.10 Option Sectioning Comment
+..................................
+
+This attribute means the option exists for the purpose of separating
+option description text in the usage output and texi documentation.
+Without this attribute, every option is a separate node in the texi
+docs. With this attribute, the documentation options become texi doc
+nodes and the options are collected under them. Choose the name
+attribute carefully because it will appear in the texi documentation.
+
+ Libraries may also choose to make it settable so that the library can
+determine which command line option is the first one that pertains to
+the library.
+
+ If the `documentation' attribute is present, then all other
+attributes are disabled except `settable', `call-proc' and `flag-code'.
+`settable' must be and is only specified if `call-proc', `extract-code'
+or `flag-code' has been specified. When present, the `descrip'
+attribute will be displayed only when the `--help' option has been
+specified. It will be displayed flush to the left hand margin and may
+consist of one or more lines of text, filled to 72 columns.
+
+ The name of the option will not be printed in the help text. It
+will, however, be printed as section headers in the texi documentation.
+If the attribute is given a non-empty value, this text will be
+reproduced in the man page and texi doc immediately after the `descrip'
+text.
+
+
+File: autogen.info, Node: opt-attr translators, Prev: opt-attr documentation, Up: option attributes
+
+7.5.5.11 Translator Notes
+.........................
+
+If you need to give the translators a special note about a particular
+option, please use the "`translators'" attribute. The attribute text
+will be emitted into the generated `.c' text where the option related
+strings get defined. To make a general comment about all of the option
+code, add comments to an `include' attribute (*note program
+attributes::). Do *not* use this attribute globally, or it will get
+emitted into every option definition block.
+
+
+File: autogen.info, Node: Option Arguments, Next: Option Argument Handling, Prev: option attributes, Up: Option Definitions
+
+7.5.6 Option Argument Specification
+-----------------------------------
+
+Command line options come in three flavors: options that do not take
+arguments, those that do and those that may. Without an "arg-type"
+attribute, AutoOpts will not process an argument to an option. If
+"arg-type" is specified and "arg-optional" is also specified, then the
+next command line token will be taken to be an argument, unless it
+looks like the name of another option.
+
+ If the argument type is specified to be anything other than
+"str[ing]", then AutoOpts will specify a callback procedure to handle
+the argument. Some of these procedures will be created and inserted
+into the generated `.c' file, and others are already built into the
+`libopts' library. Therefore, if you write your own callback procedure
+(*note Option Argument Handling::), then you must either not specify an
+"arg-type" attribute, or else specify it to be of type "str[ing]". Your
+callback function will be able to place its own restrictions on what
+that string may contain or represent.
+
+ Option argument handling attributes depend upon the value set for the `arg-type'
+attribute. It specifies the type of argument the option will take. If
+not present, the option cannot take an argument. If present, it must
+be an entry in the following table. The first three letters is
+sufficient.
+
+* Menu:
+
+* arg-type string:: Arg Type String
+* arg-type number:: Arg Type Number
+* arg-type boolean:: Arg Type Boolean
+* arg-type keyword:: Arg Type Keyword
+* arg-type set membership:: Arg Type Set Membership
+* arg-type hierarchy:: Arg Type Hierarchical
+* arg-type file name:: Arg Type File Name
+* arg-type time-duration:: Arg Type Time Duration
+* arg-type time-date:: Arg Type Time and Date
+
+Supporting attributes for particular argument types:
+
+* arg-keyword:: Keyword list
+* arg-optional:: Option Argument Optional
+* arg-default:: Default Option Argument Value
+
+
+File: autogen.info, Node: arg-type string, Next: arg-type number, Up: Option Arguments
+
+7.5.6.1 Arg Type String
+.......................
+
+`arg-type = string;'
+
+ The argument may be any arbitrary string, though your program or
+option callback procedure may place additional constraints upon it.
+
+
+File: autogen.info, Node: arg-type number, Next: arg-type boolean, Prev: arg-type string, Up: Option Arguments
+
+7.5.6.2 Arg Type Number
+.......................
+
+`arg-type = number;'
+
+ The argument must be a correctly formed integer, without any
+trailing U's or L's. AutoOpts contains a library procedure to convert
+the string to a number. If you specify range checking with `arg-range'
+(see below), then AutoOpts produces a special purpose procedure for
+this option.
+
+`scaled'
+ `scaled' marks the option so that suffixes of `k', `K', `m', `M',
+ `g', `G', `t', and `T' will multiply the given number by a power
+ of 1000 or 1024. Lower case letters scale by a power of 1000 and
+ upper case scale by a power of 1024.
+
+`arg-range'
+ `arg-range' is used to create a callback procedure for validating
+ the range of the option argument. It must match one of the range
+ entries. Each `arg-range' should consist of either an integer by
+ itself or an integer range. The integer range is specified by one
+ or two integers separated by the two character sequence, `->'. Be
+ sure to quote the entire range string. The definitions parser
+ will not accept the range syntax as a single string token.
+
+ The generated procedure imposes the range constraints as follows:
+ * A number by itself will match that one value.
+
+ * The high end of the range may not be `INT_MIN', both for
+ obvious reasons and because that value is used to indicate a
+ single-valued match.
+
+ * An omitted lower value implies a lower bound of INT_MIN.
+
+ * An omitted upper value implies a upper bound of INT_MAX.
+
+ * The argument value is required. It may not be optional.
+
+ * The value must match one of the entries. If it can match
+ more than one, then you have redundancies, but no harm will
+ come of it.
+
+
+File: autogen.info, Node: arg-type boolean, Next: arg-type keyword, Prev: arg-type number, Up: Option Arguments
+
+7.5.6.3 Arg Type Boolean
+........................
+
+`arg-type = boolean;'
+
+ The argument will be interpreted and always yield either AG_TRUE or
+AG_FALSE. False values are the empty string, the number zero, or a
+string that starts with `f', `F', `n' or `N' (representing False or
+No). Anything else will be interpreted as True.
+
+
+File: autogen.info, Node: arg-type keyword, Next: arg-type set membership, Prev: arg-type boolean, Up: Option Arguments
+
+7.5.6.4 Arg Type Keyword
+........................
+
+`arg-type = keyword;'
+
+ The argument must match a specified list of strings (*note
+arg-keyword::). Assuming you have named the option, `optn-name', the
+strings will be converted into an enumeration of type `te_Optn_Name'
+with the values `OPTN_NAME_KEYWORD'.* If you have *not* specified a
+default value, the value `OPTN_NAME_UNDEFINED' will be inserted with
+the value zero. The option will be initialized to that value. You may
+now use this in your code as follows:
+
+ te_Optn_Name opt = OPT_VALUE_OPTN_NAME;
+ switch (opt) {
+ case OPTN_NAME_UNDEFINED: /* undefined things */ break;
+ case OPTN_NAME_KEYWORD: /* `keyword' things */ break;
+ default: /* utterly impossible */ ;
+ }
+
+ AutoOpts produces a special purpose procedure for this option. You
+may not specify an alternate handling procedure.
+
+ If you have need for the string name of the selected keyword, you
+may obtain this with the macro, `OPT_OPTN_NAME_VAL2STR(val)'. The
+value you pass would normally be `OPT_VALUE_OPTN_NAME', but anything
+with numeric value that is legal for `te_Optn_Name' may be passed.
+Anything out of range will result in the string, `"*INVALID*"' being
+returned. The strings are read only. It may be used as in:
+
+ te_Optn_Name opt = OPT_VALUE_OPTN_NAME;
+ printf( "you selected the %s keyword\n",
+ OPT_OPTN_NAME_VAL2STR(opt) );
+
+ * Note: you may replace the `OPTN_NAME' enumeration prefix with
+another prefix by specifying a `prefix-enum' attribute.
+
+ Finally, users may specify the argument either by name or by number.
+Since the numeric equivalents change by having new entries inserted
+into the keyword list, this would not be a recommended practice.
+However, either `-1' or `~0' will always be equivalent to specifying
+the last keyword.
+
+
+File: autogen.info, Node: arg-type set membership, Next: arg-type hierarchy, Prev: arg-type keyword, Up: Option Arguments
+
+7.5.6.5 Arg Type Set Membership
+...............................
+
+`arg-type = set;'
+
+ The argument must be a list of names each of which must match the
+strings "`all'", "`none'" or one of the keywords (*note arg-keyword::)
+specified for this option. `all' will turn on all membership bits and
+`none' will turn them all off. Specifying one of the keywords will turn
+on the corresponding set membership bit. Literal numbers may also be
+used and may, thereby, set or clear more than one bit. Preceding a
+keyword or literal number with a bang (`!' - exclamation point) will
+turn the bit(s) off. The number of keywords allowed is constrained by
+the number of bits in a pointer, as the bit set is kept in a `void*'.
+
+ If, for example, you specified `first' in your list of keywords,
+then you can use the following code to test to see if either `first' or
+`all' was specified:
+
+ uintptr_t opt = OPT_VALUE_OPTN_NAME;
+ if (opt & OPTN_NAME_FIRST)
+ /* OPTN_NAME_FIRST bit was set */ ;
+
+ AutoOpts produces a special purpose procedure for this option. To
+set multiple bits as the default (initial) value, you must specify an
+initial numeric value (which might become inaccurate over time), or
+else specify `arg-default' multiple times. Do not specify a series of
+names conjoined with `+' symbols as the value for any of the
+`arg-default' attributes. That works for option parsing, but not for
+the option code generation.
+
+
+File: autogen.info, Node: arg-type hierarchy, Next: arg-type file name, Prev: arg-type set membership, Up: Option Arguments
+
+7.5.6.6 Arg Type Hierarchical
+.............................
+
+`arg-type = hierarchy;'
+`arg-type = nested;'
+
+ This denotes an option with a structure-valued argument, a.k.a.
+"subopts" in `getopts' terminology. The argument is parsed and the
+values made available to the program via the find and find next calls
+(*Note libopts-optionFindValue::, *Note libopts-optionGetValue::, and
+*note libopts-optionFindNextValue::).
+
+ tOptionValue * val = optionGetValue(VALUE_OPT_OPTN_NAME, "name");
+ while (val != NULL) {
+ process(val);
+ val = optionNextValue(VALUE_OPT_OPTN_NAME, val);
+ if (wrong_name(val, "name"))
+ break;
+ }
+
+
+File: autogen.info, Node: arg-type file name, Next: arg-type time-duration, Prev: arg-type hierarchy, Up: Option Arguments
+
+7.5.6.7 Arg Type File Name
+..........................
+
+`arg-type = file;'
+
+ This argument type will have some validations on the argument and,
+optionally, actually open the file. You must specify several additonal
+attributes for the option:
+
+`file-exists'
+ If not specified or empty, then the directory portion of the name
+ is checked. The directory must exist or the argument is rejected
+ and the usage procedure is invoked.
+
+ Otherwise, both the directory as above and the full name is tested
+ for existence. If the value begins with the two letters "no",
+ then the file must not pre-exist. Otherwise, the file is expected
+ to exist.
+
+`open-file'
+ If not specified or empty, the file is left alone. If the value
+ begins with the four letters "desc"[riptor], then `open(2)' is
+ used and `optArg.argFd' is set. Otherwise, the file is opened
+ with `fopen' and `optArg.argFp' is set.
+
+`file-mode'
+ If "open-file" is set and not empty, then you must specify the
+ open mode. Set the value to the flag bits or mode string as
+ appropriate for the open type.
+
+
+File: autogen.info, Node: arg-type time-duration, Next: arg-type time-date, Prev: arg-type file name, Up: Option Arguments
+
+7.5.6.8 Arg Type Time Duration
+..............................
+
+`arg-type = time-duration;'
+
+ The argument will be converted into a number of seconds. It may be
+a multi-part number with different parts being multiplied into a seconds
+value and added into the final result. Valid forms are in the table
+below. Upper cased letters represent numbers that must be used in the
+expressions.
+
+`[[HH:]MM:]SS'
+ `HH' is multiplied by `3600' and `MM' multiplied by `60' before
+ they are added to `SS'. This time specification may not be
+ followed by any other time specs. `HH' and `MM' are both optional,
+ though `HH' cannot be specified without `MM'.
+
+`DAYS d'
+ `DAYS' is multiplied by the number of seconds in a day. This
+ value may be followed by (and added to) values specified by
+ `HH:MM:SS' or the suffixed values below. If present, it must
+ always be first.
+
+`HRS h'
+ `HRS' is multiplied by the number of seconds in an hour. This
+ value may be followed by (and added to) values specified by
+ `MM:SS' or the suffixed values below.
+
+`MINS m'
+ `MINS' is multiplied by the number of seconds in a minute. This
+ value may be followed by (and added to) a count of seconds.
+
+`SECS s'
+ This value can only be the last value in a time specification.
+ The `s' suffix is optional.
+
+ 5 d 1:10:05 ==> 5 days + 1 hour 10 minutes and 5 seconds
+ 5 d 1 h 10 m 5 ==> yields: 436205 seconds
+ 5d1h10m5s ==> same result -- spaces are optional.
+
+ When saved into a config file, the value will be stored as a simple
+count of seconds. There are actually more (many) accepted time
+duration strings. The full documentation can be found with ISO-8601
+documentation and the more extedded documentation when
+"parse_duration()" becomes more widely available.
+
+
+File: autogen.info, Node: arg-type time-date, Next: arg-keyword, Prev: arg-type time-duration, Up: Option Arguments
+
+7.5.6.9 Arg Type Time and Date
+..............................
+
+`arg-type = time-date;'
+
+ The argument will be converted into the number of seconds since the
+epoch. The conversion rules are very complicated, please see the
+`getdate_r(3GNU)' man page. There are some additional restrictions:
+
+ 1. Your project must be compiled with `PKGDATADIR' defined and naming
+ a valid directory.
+
+ 2. The `DATEMSK' environment variable will be set to the `datemsk'
+ file within that directory.
+
+ If that file is not accessible for any reason, the string will be
+parsed as a time duration (*note arg-type time-duration::) instead of a
+specific date and time.
+
+
+File: autogen.info, Node: arg-keyword, Next: arg-optional, Prev: arg-type time-date, Up: Option Arguments
+
+7.5.6.10 Keyword list
+.....................
+
+If the `arg-type' is `keyword' (*note arg-type keyword::) or
+`set-membership' (*note arg-type set membership::), then you must
+specify the list of keywords by a series of `keyword' entries. The
+interface file will contain values for `<OPTN_NAME>_<KEYWORD>' for each
+keyword entry. `keyword' option types will have an enumeration and
+`set-membership' option types will have a set of unsigned bits
+`#define'-d.
+
+ If the `arg-type' is specifically `keyword', you may also add
+special handling code with a `extra-code' attribute. After
+`optionEnumerationVal' has converted the input string into an
+enumeration, you may insert code to process this enumeration value
+(`pOptDesc->optArg.argEnum').
+
+
+File: autogen.info, Node: arg-optional, Next: arg-default, Prev: arg-keyword, Up: Option Arguments
+
+7.5.6.11 Option Argument Optional
+.................................
+
+This attribute indicates that the user does not have to supply an
+argument for the option. This is only valid if the ARG-TYPE is `string'
+(*note arg-type string::) or `keyword' (*note arg-type keyword::). If
+it is `keyword', then this attribute may also specify the default
+keyword to assume when the argument is not supplied. If left empty,
+ARG-DEFAULT (*note arg-default::) or the zero-valued keyword will be
+used.
+
+ This is overridden and the options are required if the libopts
+library gets configured with `--disable-optional-args'.
+
+
+File: autogen.info, Node: arg-default, Prev: arg-optional, Up: Option Arguments
+
+7.5.6.12 Default Option Argument Value
+......................................
+
+This specifies the default option argument value to be used when the
+option is not specified or preset. You may specify multiple
+`arg-default' values if the argument type is `set membership'.
+
+
+File: autogen.info, Node: Option Argument Handling, Next: Internationalizing Options, Prev: Option Arguments, Up: Option Definitions
+
+7.5.7 Option Argument Handling
+------------------------------
+
+AutoOpts will either specify or automatically generate callback
+procedures for options that take specialized arguments. The only
+option argument types that are not specialized are plain string
+arguments and no argument at all. For options that fall into one of
+those two categories, you may specify your own callback function, as
+specified below. If you do this and if you specify that options are
+resettable (*note automatic options::), then your option handling code
+*must* look for the `OPTST_RESET' bit in the `fOptState' field of the
+option descriptor.
+
+ If the option takes a string argument, then you may specify that the
+option is to be handled by the `libopts' library procedures
+`stackOptArg()' or `unstackOptArg()' (see below). In this case, you
+may not provide option handling code.
+
+ Finally, `documentation' options (*note opt-attr documentation::) may
+also be marked as `settable' (*note opt-attr settable::) and have
+special callback functions (either `flag-code', `extract-code', or
+`call-proc').
+
+`flag-code'
+ statements to execute when the option is encountered. This may be
+ used in conjunction with option argument types that cause AutoOpts
+ to emit handler code. If you do this, the `flag-code' with index
+ zero (0) is emitted into the handler code _before_ the argument is
+ handled, and the entry with index one (1) is handled afterward.
+
+ The generated procedure will be laid out something like this:
+
+ static void
+ doOpt<name>(tOptions* pOptions, tOptDesc* pOptDesc)
+ {
+ <flag-code[0]>
+ <AutoOpts defined handler code>
+ <flag-code[1]>
+ }
+
+ Only certain fields within the `tOptions' and `tOptDesc'
+ structures may be accessed. *Note Option Processing Data::. When
+ writing this code, you must be very careful with the `pOptions'
+ pointer. The handler code is called with this pointer set to
+ special values for handling special situations. Your code must
+ handle them. As an example, look at `optionEnumerationVal' in
+ `enum.c'.
+
+`extract-code'
+ This is effectively identical to `flag-code', except that the
+ source is kept in the output file instead of the definitions file
+ and you cannot use this in conjunction with options with arguments,
+ other than string arguments.
+
+ A long comment is used to demarcate the code. You must not modify
+ that marker. Before regenerating the option code file, the old
+ file is renamed from MUMBLE.c to MUMBLE.c.save. The template will
+ be looking there for the text to copy into the new output file.
+
+`call-proc'
+ external procedure to call when option is encountered. The calling
+ sequence must conform to the sequence defined above for the
+ generated procedure, `doOpt<name>'. It has the same restrictions
+ regarding the fields within the structures passed in as arguments.
+ *Note Option Processing Data::.
+
+`flag-proc'
+ Name of another option whose `flag-code' can be executed when this
+ option is encountered.
+
+`stack-arg'
+ Call a special library routine to stack the option's arguments.
+ Special macros in the interface file are provided for determining
+ how many of the options were found (`STACKCT_OPT(NAME)') and to
+ obtain a pointer to a list of pointers to the argument values
+ (`STACKLST_OPT(NAME)'). Obviously, for a stackable argument, the
+ `max' attribute (*note Common Attributes::) needs to be set higher
+ than `1'.
+
+ If this stacked argument option has a disablement prefix, then the
+ entire stack of arguments will be cleared by specifying the option
+ with that disablement prefix.
+
+`unstack-arg'
+ Call a special library routine to remove ("unstack") strings from
+ a `stack-arg' option stack. This attribute must name the option
+ that is to be "unstacked". Neither this option nor the stacked
+ argument option it references may be equivalenced to another
+ option.
+
+
+File: autogen.info, Node: Internationalizing Options, Next: documentation attributes, Prev: Option Argument Handling, Up: Option Definitions
+
+7.5.8 Internationalizing Options
+--------------------------------
+
+Normally, AutoOpts produces usage text that is difficult to translate.
+It is pieced together on the fly using words and phrases scattered
+around here and there, piecing together toe document. This does not
+translate well.
+
+ Incorporated into this package are some ways around the problem.
+First, you should specify the `full-usage' and `short-usage' program
+attributes (*note program attributes::). This will enable your
+translators to translate the usage text as a whole.
+
+ Your translators will also be able to translate long option names.
+The option name translations will then become the names searched for
+both on the command line and in configuration files. However, it will
+not affect the names of environment variable names used to configure
+your program.
+
+ If it is considered desireable to keep configuration files in the "C"
+locale, then several macros are available to suppress or delay the
+translations of option names at run time. These are all disabled if
+`ENABLE_NLS' is not defined at compile time or if `no-xlate' has been
+set to the value _anything_. These macros *must* be invoked before the
+first invocation of `optionProcess'.
+
+`OPT_NO_XLAT_CFG_NAMES;'
+`OPT_XLAT_CFG_NAMES;'
+ Disable (or enable) the translations of option names for
+ configuration files. If you enable translation for config files,
+ then they will be translated for command line options.
+
+`OPT_NO_XLAT_OPT_NAMES;'
+`OPT_XLAT_OPT_NAMES;'
+ Disable (or enable) the translations of option names for command
+ line processing. If you disable the translation for command line
+ processing, you will also disable it for configuration file
+ processing. Once translated, the option names will remain
+ translated.
+
+
+File: autogen.info, Node: documentation attributes, Next: automatic options, Prev: Internationalizing Options, Up: Option Definitions
+
+7.5.9 Man and Info doc Attributes
+---------------------------------
+
+AutoOpts includes AutoGen templates for producing abbreviated man pages
+and for producing the invoking section of an info document. To take
+advantage of these templates, you must add several attributes to your
+option definitions.
+
+`arg-name'
+ If an option has an argument, the argument should have a name for
+ documentation purposes. It will default to `arg-type', but it
+ will likely be clearer with something else like, `file-name'
+ instead of `string' (the type).
+
+`doc'
+ First, every `flag' definition _other than_ "documentation"
+ definitions, must have a `doc' attribute defined. If the option
+ takes an argument, then it will need an `arg-name' attribute as
+ well. The `doc' text should be in plain sentences with minimal
+ formatting. The Texinfo commands `@code', and `@var' will have
+ its enclosed text made into *\fB* entries in the man page, and the
+ `@file' text will be made into *\fI* entries. The `arg-name'
+ attribute is used to display the option's argument in the man page.
+
+ Options marked with the "documentation" attribute are for
+ documenting the usage text. All other options should have the
+ "doc" attribute in order to document the usage of the option in
+ the generated man pages.
+
+`option-info'
+ This text will be inserted as a lead-in paragraph in the `OPTIONS'
+ section of the generated man page.
+
+`doc-section'
+ This is a compound attribute that requires three subattributes:
+ ds-type
+ This describes the section type. Basically, the title of the
+ section that will be added to all output documentation.
+ There may be only one `doc-section' for any given `ds-type'.
+ If there are duplicates, the results are undefined (it might
+ work, it might not).
+
+ There are five categories of `ds-type' sections. They are
+ those that the documentation templates would otherwise:
+ 1. always create itself, ignoring any `ds-type's by this
+ name. These are marked, below, as `ao-only'.
+
+ 2. create, if none have been provided. These are marked,
+ `alternate'.
+
+ 3. create, but augment if the `doc-section' was provided.
+ These are marked, `augments'.
+
+ 4. do nothing, but inserts them into the output in a
+ prescribed order. These are marked, `known'
+
+ 5. knows nothing about them. They will be alphabetized and
+ inserted after the list of leading sections and before
+ the list of trailing sections. These are not marked
+ because I don't know their names.
+
+ Some of these are emitted by the documentation templates only
+ if certain conditions are met. If there are conditions, they
+ are explained below. If there are no conditions, then you
+ will always see the named section in the output.
+
+ The output sections will appear in this order:
+ `NAME'
+ `ao-only'.
+
+ `SYNOPSIS'
+ `alternate'.
+
+ `DESCRIPTION'
+ `augments'.
+
+ `OPTIONS'
+ `ao-only'.
+
+ `OPTION PRESETS'
+ `ao-only', if environment presets or configuration file
+ processing has been specified.
+
+ `unknown'
+ At this point, the unknown, alphabetized sections are
+ inserted.
+
+ `IMPLEMENTATION NOTES'
+ `known'
+
+ `ENVIRONMENT'
+ `augments', if environment presets have been specified.
+
+ `FILES'
+ `augments', if configuration file processing has been
+ specified.
+
+ `EXAMPLES'
+ `known'
+
+ `EXIT STATUS'
+ `augments'.
+
+ `ERRORS'
+ `known'
+
+ `COMPATIBILITY'
+ `known'
+
+ `SEE ALSO'
+ `known'
+
+ `CONFORMING TO'
+ `known'
+
+ `HISTORY'
+ `known'
+
+ `AUTHORS'
+ `alternate', if the `copyright' stanza has either an
+ `author' or an `owner' attribute.
+
+ `COPYRIGHT'
+ `alternate', if there is a `copyright' stanza.
+
+ `BUGS'
+ `augments', if the `copyright' stanza has an `eaddr'
+ attribute.
+
+ `NOTES'
+ `augments'.
+
+ ds-format
+ This describes the format of the associated `ds-text' section.
+ `man', `mdoc' and `texi' formats are supported. Regardless
+ of the chosen format, the formatting tags in the output text
+ will be converted to `man' macros for `man' pages, `mdoc'
+ macros for `mdoc' pages, and `texi' macros for `texinfo'
+ pages.
+
+ ds-text
+ This is the descriptive text, written according to the rules
+ for `ds-format' documents.
+
+ Here is an example of a "doc-section" for a "SEE ALSO" type.
+
+ doc-section = {
+ ds-type = 'SEE ALSO'; // or anything else
+ ds-format = 'man'; // or texi or mdoc format
+ ds-text = <<-_EOText_
+ text relevant to this section type,
+ in the chosen format
+ _EOText_;
+ };
+
+`prog-man-descrip'
+`prog-info-descrip'
+ These attributes are now deprecated. Please use a `doc-section'
+ stanza with a `ds-type' attribute set to `DESCRIPTION' instead.
+
+`detail'
+ This attribute is used to add a very short explanation about what
+ a program is used for when the "title" attribute is insufficient.
+ If there is no "doc-section" stanza of type "DESCRIPTION", then
+ this text is used for the man page DESCRIPTION section, too.
+
+
+File: autogen.info, Node: automatic options, Next: standard options, Prev: documentation attributes, Up: Option Definitions
+
+7.5.10 Automatically Supported Options
+--------------------------------------
+
+AutoOpts provides automated support for several options. `help' and
+`more-help' are always provided. The others are conditional upon
+various global program attributes being defined *Note program
+attributes::.
+
+ Below are the option names and default flag values. The flags are
+activated if and only if at least one user-defined option also uses a
+flag value. The long names are supported as option names if
+`long-opts' has been specified. These option flags may be deleted or
+changed to characters of your choosing by specifying `xxx-value =
+"y";', where `xxx' is one of the option names below and `y' is either
+empty or the character of your choice. For example, to change the help
+flag from `?' to `h', specify `help-value = "h";'; and to require that
+`save-opts' be specified only with its long option name, specify `save-opts-value
+= "";'.
+
+ Additionally, the procedure that prints out the program version may
+be replaced by specifying `version-proc'. This procedure must be
+defined to be of external scope (non-static). By default, the AutoOpts
+library provides `optionPrintVersion' and it will be the specified
+callback function in the option definition structure.
+
+ With the exception of the `load-opts' option, none of these
+automatically supported options will be recognized in configuration
+files or environment variables.
+
+`help -?'
+ This option will immediately invoke the `USAGE()' procedure and
+ display the usage line, a description of each option with its
+ description and option usage information. This is followed by the
+ contents of the definition of the `detail' text macro.
+
+`more-help -!'
+ This option is identical to the `help' option, except that the
+ output is passed through a pager program. (`more' by default, or
+ the program identified by the `PAGER' environment variable.)
+
+`usage -u'
+ This option must be requested by specifying, `usage-opt' in the
+ option definition file. It will produce abbreviated help text to
+ `stdout' and exit with zero status (`EXIT_SUCCESS').
+
+`version -v'
+ This will print the program name, title and version. If it is
+ followed by the letter `c' and a value for `copyright' and `owner'
+ have been provided, then the copyright will be printed, too. If
+ it is followed by the letter `n', then the full copyright notice
+ (if available) will be printed. The `version' attribute must be
+ specified in the option definition file.
+
+`load-opts -<'
+ This option will load options from the named file. They will be
+ treated exactly as if they were loaded from the normally found
+ configuration files, but will not be loaded until the option is
+ actually processed. This can also be used within another
+ configuration file, causing them to nest. This is the *only*
+ automatically supported option that can be activated inside of
+ config files or with environment variables.
+
+ Specifying the negated form of the option (`--no-load-opts') will
+ suppress the processing of configuration files and environment
+ variables.
+
+ This option is activated by specifying one or more `homerc'
+ attributes.
+
+`save-opts ->'
+ This option will cause the option state to be printed in the
+ configuration file format when option processing is done but not
+ yet verified for consistency. The program will terminate
+ successfully without running when this has completed. Note that
+ for most shells you will have to quote or escape the flag
+ character to restrict special meanings to the shell.
+
+ The output file will be the configuration file name (default or
+ provided by `rcfile') in the last directory named in a `homerc'
+ definition.
+
+ This option may be set from within your program by invoking the
+ "`SET_OPT_SAVE_OPTS(filename)'" macro (*note SET_OPT_name::).
+ Invoking this macro will set the file name for saving the option
+ processing state, but the state will *not* actually be saved. You
+ must call `optionSaveFile' to do that (*note
+ libopts-optionSaveFile::). *CAVEAT:* if, after invoking this
+ macro, you call `optionProcess', the option processing state will
+ be saved to this file and `optionProcess' will not return. You
+ may wish to invoke `CLEAR_OPT( SAVE_OPTS )' (*note CLEAR_OPT::)
+ beforehand if you do need to reinvoke `optionProcess'.
+
+ This option is activated by specifying one or more `homerc'
+ attributes.
+
+`reset-option -R'
+ This option takes the name of an option for the current program
+ and resets its state such that it is set back to its original,
+ compile-time initialized value. If the option state is
+ subsequently stored (via `--save-opts'), the named option will not
+ appear in that file.
+
+ This option is activated by specifying the `resettable' attribute.
+
+ *BEWARE*: If the `resettable' attribute is specified, all option
+ callbacks *must* look for the `OPTST_RESET' bit in the `fOptState'
+ field of the option descriptor. If set, the `optCookie' and
+ `optArg' fields will be unchanged from their last setting. When
+ the callback returns, these fields will be set to their original
+ values. If you use this feature and you have allocated data
+ hanging off of the cookie, you need to deallocate it.
+
+
+File: autogen.info, Node: standard options, Prev: automatic options, Up: Option Definitions
+
+7.5.11 Library of Standard Options
+----------------------------------
+
+AutoOpts has developed a set of standardized options. You may
+incorporate these options in your program simply by _first_ adding a
+`#define' for the options you want, and then the line,
+
+ #include stdoptions.def
+
+in your option definitions. The supported options are specified thus:
+
+ #define DEBUG
+ #define DIRECTORY
+ #define DRY_RUN
+ #define INPUT
+ #define INTERACTIVE
+ #define OUTPUT
+ #define WARN
+
+ #define SILENT
+ #define QUIET
+ #define BRIEF
+ #define VERBOSE
+
+ By default, only the long form of the option will be available. To
+specify the short (flag) form, suffix these names with `_FLAG'. e.g.,
+
+ #define DEBUG_FLAG
+
+ `--silent', `--quiet', `--brief' and `--verbose' are related in that
+they all indicate some level of diagnostic output. These options are
+all designed to conflict with each other. Instead of four different
+options, however, several levels can be incorporated by `#define'-ing
+`VERBOSE_ENUM'. In conjunction with `VERBOSE', it incorporates the
+notion of 5 levels in an enumeration: `silent', `quiet', `brief',
+`informative' and `verbose'; with the default being `brief'.
+
+ Here is an example program that uses the following set of
+definitions:
+
+ AutoGen Definitions options;
+
+ prog-name = default-test;
+ prog-title = 'Default Option Example';
+ homerc = '$$/../share/default-test', '$HOME', '.';
+ environrc;
+ long-opts;
+ gnu-usage;
+ usage-opt;
+ version = '1.0';
+ main = {
+ main-type = shell-process;
+ };
+ #define DEBUG_FLAG
+ #define WARN_FLAG
+ #define WARN_LEVEL
+ #define VERBOSE_FLAG
+ #define VERBOSE_ENUM
+ #define DRY_RUN_FLAG
+ #define OUTPUT_FLAG
+ #define INPUT_FLAG
+ #define DIRECTORY_FLAG
+ #define INTERACTIVE_FLAG
+ #include stdoptions.def
+
+Running a few simple commands on that definition file:
+
+ autogen default-test.def
+ copts="-DTEST_DEFAULT_TEST_OPTS `autoopts-config cflags`"
+ lopts="`autoopts-config ldflags`"
+ cc -o default-test ${copts} default-test.c ${lopts}
+
+Yields a program which, when run with `--help', prints out:
+
+ default-test - Default Option Example - Ver. 1.0
+ USAGE: default-test [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
+
+
+ The following options are commonly used and are provided and supported
+ by AutoOpts:
+
+ -D, --debug run program with debugging info
+ -V, --verbose=KWd run program with progress info
+ -w, --warn=num specify a warning-level threshhold
+ - disabled as --no-warn
+ -R, --dry-run program will make no changes
+ -I, --interactive=str prompt for confirmation
+ -i, --input=str redirect input from file
+ -o, --output=str redirect output to file
+ -d, --directory=str use specified dir for I/O
+
+ version, usage and configuration options:
+
+ -v, --version[=arg] Output version information and exit
+ -?, --help Display extended usage information and exit
+ -!, --more-help Extended usage information passed thru pager
+ -u, --usage Abbreviated usage to stdout
+ ->, --save-opts[=arg] Save the option state to a config file
+ -<, --load-opts=str Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+ Options are specified by doubled hyphens and their name or by a single
+ hyphen and the flag character.
+
+ The following option preset mechanisms are supported:
+ - reading file $$/../share/default-test
+ - reading file $HOME/.default_testrc
+ - reading file ./.default_testrc
+ - examining environment variables named DEFAULT_TEST_*
+
+ The valid "verbose" option keywords are:
+ silent quiet brief informative verbose
+ or an integer from 0 through 4
+ Packaged by Bruce (2012-08-11)
+ Report default_test bugs to bkorb@gnu.org
+
+
+File: autogen.info, Node: AutoOpts API, Next: Multi-Threading, Prev: Option Definitions, Up: AutoOpts
+
+7.6 Programmatic Interface
+==========================
+
+The user interface for access to the argument information is completely
+defined in the generated header file and in the portions of the
+distributed file "options.h" that are marked "public".
+
+ In the following macros, text marked `<NAME>' or `name' is the name
+of the option *in upper case* and *segmented with underscores `_'*.
+The macros and enumerations defined in the options header (interface)
+file are used as follows:
+
+ To see how these `#define' macros are used in a program, the reader
+is referred to the several `opts.h' files included with the AutoGen
+sources.
+
+* Menu:
+
+* Option Processing Data:: Data for Option Processing
+* CLEAR_OPT:: CLEAR_OPT( <NAME> ) - Clear Option Markings
+* COUNT_OPT:: COUNT_OPT( <NAME> ) - Definition Count
+* DESC:: DESC( <NAME> ) - Option Descriptor
+* DISABLE_OPT_name:: DISABLE_OPT_name - Disable an option
+* ENABLED_OPT:: ENABLED_OPT( <NAME> ) - Is Option Enabled?
+* ERRSKIP_OPTERR:: ERRSKIP_OPTERR - Ignore Option Errors
+* ERRSTOP_OPTERR:: ERRSTOP_OPTERR - Stop on Errors
+* HAVE_OPT:: HAVE_OPT( <NAME> ) - Have this option?
+* ISSEL_OPT:: ISSEL_OPT( <NAME> ) - Is Option Selected?
+* ISUNUSED_OPT:: ISUNUSED_OPT( <NAME> ) - Never Specified?
+* OPTION_CT:: OPTION_CT - Full Count of Options
+* OPT_ARG:: OPT_ARG( <NAME> ) - Option Argument String
+* OPT_NO_XLAT_CFG_NAMES:: OPT_NO_XLAT_CFG_NAMES - option name xlation
+* OPT_NO_XLAT_OPT_NAMES:: OPT_NO_XLAT_OPT_NAMES - option name xlation
+* OPT_VALUE_name:: OPT_VALUE_name - Option Argument Value
+* OPT_XLAT_CFG_NAMES:: OPT_XLAT_CFG_NAMES - option name xlation
+* OPT_XLAT_OPT_NAMES:: OPT_XLAT_OPT_NAMES - option name xlation
+* RESTART_OPT:: RESTART_OPT( n ) - Resume Option Processing
+* SET_OPT_name:: SET_OPT_name - Force an option to be set
+* STACKCT_OPT:: STACKCT_OPT( <NAME> ) - Stacked Arg Count
+* STACKLST_OPT:: STACKLST_OPT( <NAME> ) - Argument Stack
+* START_OPT:: START_OPT - Restart Option Processing
+* STATE_OPT:: STATE_OPT( <NAME> ) - Option State
+* USAGE:: USAGE( exit-code ) - Usage invocation macro
+* VALUE_OPT_name:: VALUE_OPT_name - Option Flag Value
+* VERSION:: VERSION - Version and Full Version
+* WHICH_IDX_name:: WHICH_IDX_name - Which Equivalenced Index
+* WHICH_OPT_name:: WHICH_OPT_name - Which Equivalenced Option
+* teOptIndex:: teOptIndex - Option Index and Enumeration
+* OPTIONS_STRUCT_VERSION:: OPTIONS_STRUCT_VERSION - active version
+* libopts procedures:: libopts External Procedures
+
+
+File: autogen.info, Node: Option Processing Data, Next: CLEAR_OPT, Up: AutoOpts API
+
+7.6.1 Data for Option Processing
+--------------------------------
+
+This section describes the data that may be accessed from within the
+option processing callback routines. The following fields may be used
+in the following ways and may be used for read only. The first set is
+addressed from the `tOptDesc*' pointer:
+
+`optIndex'
+
+`optValue'
+ These may be used by option procedures to determine which option
+ they are working on (in case they handle several options).
+
+`optActualIndex'
+
+`optActualValue'
+ These may be used by option procedures to determine which option
+ was used to set the current option. This may be different from
+ the above if the options are members of an equivalence class.
+
+`optOccCt'
+ If AutoOpts is processing command line arguments, then this value
+ will contain the current occurrence count. During the option
+ preset phase (reading configuration files and examining
+ environment variables), the value is zero.
+
+`fOptState'
+ The field may be tested for the following bit values (prefix each
+ name with `OPTST_', e.g. `OPTST_INIT'):
+
+ `INIT'
+ Initial compiled value. As a bit test, it will always yield
+ FALSE.
+
+ `SET'
+ The option was set via the `SET_OPT()' macro.
+
+ `PRESET'
+ The option was set via a configuration file.
+
+ `DEFINED'
+ The option was set via a command line option.
+
+ `SET_MASK'
+ This is a mask of flags that show the set state, one of the
+ above four values.
+
+ `EQUIVALENCE'
+ This bit is set when the option was selected by an
+ equivalenced option.
+
+ `DISABLED'
+ This bit is set if the option is to be disabled. (Meaning it
+ was a long option prefixed by the disablement prefix, or the
+ option has not been specified yet and initializes as
+ `disabled'.)
+
+ As an example of how this might be used, in AutoGen I want to allow
+ template writers to specify that the template output can be left
+ in a writable or read-only state. To support this, there is a
+ Guile function named `set-writable' (*note SCM set-writable::).
+ Also, I provide for command options `--writable' and
+ `--not-writable'. I give precedence to command line and RC file
+ options, thus:
+
+ switch (STATE_OPT( WRITABLE )) {
+ case OPTST_DEFINED:
+ case OPTST_PRESET:
+ fprintf(stderr, zOverrideWarn, pCurTemplate->pzFileName,
+ pCurMacro->lineNo);
+ break;
+
+ default:
+ if (gh_boolean_p( set ) && (set == SCM_BOOL_F))
+ CLEAR_OPT( WRITABLE );
+ else
+ SET_OPT_WRITABLE;
+ }
+
+`pzLastArg'
+ Pointer to the latest argument string. BEWARE If the argument type
+ is numeric, an enumeration or a bit mask, then this will be the
+ argument *value* and not a pointer to a string.
+
+ The following two fields are addressed from the `tOptions*' pointer:
+
+`pzProgName'
+ Points to a NUL-terminated string containing the current program
+ name, as retrieved from the argument vector.
+
+`pzProgPath'
+ Points to a NUL-terminated string containing the full path of the
+ current program, as retrieved from the argument vector. (If
+ available on your system.)
+
+
+ Note these fields get filled in during the first call to
+`optionProcess()'. All other fields are private, for the exclusive use
+of AutoOpts code and are subject to change.
+
+
+File: autogen.info, Node: CLEAR_OPT, Next: COUNT_OPT, Prev: Option Processing Data, Up: AutoOpts API
+
+7.6.2 CLEAR_OPT( <NAME> ) - Clear Option Markings
+-------------------------------------------------
+
+Make as if the option had never been specified. `HAVE_OPT(<NAME>)'
+will yield `FALSE' after invoking this macro.
+
+
+File: autogen.info, Node: COUNT_OPT, Next: DESC, Prev: CLEAR_OPT, Up: AutoOpts API
+
+7.6.3 COUNT_OPT( <NAME> ) - Definition Count
+--------------------------------------------
+
+This macro will tell you how many times the option was specified on the
+command line. It does not include counts of preset options.
+
+ if (COUNT_OPT( NAME ) != desired-count) {
+ make-an-undesirable-message.
+ }
+
+
+File: autogen.info, Node: DESC, Next: DISABLE_OPT_name, Prev: COUNT_OPT, Up: AutoOpts API
+
+7.6.4 DESC( <NAME> ) - Option Descriptor
+----------------------------------------
+
+This macro is used internally by other AutoOpt macros. It is not for
+general use. It is used to obtain the option description corresponding
+to its *UPPER CASED* option name argument. This is primarily used in
+other macro definitions.
+
+
+File: autogen.info, Node: DISABLE_OPT_name, Next: ENABLED_OPT, Prev: DESC, Up: AutoOpts API
+
+7.6.5 DISABLE_OPT_name - Disable an option
+------------------------------------------
+
+This macro is emitted if it is both settable and it can be disabled.
+If it cannot be disabled, it may always be CLEAR-ed (see above).
+
+ The form of the macro will actually depend on whether the option is
+equivalenced to another, and/or has an assigned handler procedure.
+Unlike the `SET_OPT' macro, this macro does not allow an option
+argument.
+
+ DISABLE_OPT_NAME;
+
+
+File: autogen.info, Node: ENABLED_OPT, Next: ERRSKIP_OPTERR, Prev: DISABLE_OPT_name, Up: AutoOpts API
+
+7.6.6 ENABLED_OPT( <NAME> ) - Is Option Enabled?
+------------------------------------------------
+
+Yields true if the option defaults to disabled and `ISUNUSED_OPT()'
+would yield true. It also yields true if the option has been specified
+with a disablement prefix, disablement value or the `DISABLE_OPT_NAME'
+macro was invoked.
+
+
+File: autogen.info, Node: ERRSKIP_OPTERR, Next: ERRSTOP_OPTERR, Prev: ENABLED_OPT, Up: AutoOpts API
+
+7.6.7 ERRSKIP_OPTERR - Ignore Option Errors
+-------------------------------------------
+
+When it is necessary to continue (return to caller) on option errors,
+invoke this option. It is reversible. *Note ERRSTOP_OPTERR::.
+
+
+File: autogen.info, Node: ERRSTOP_OPTERR, Next: HAVE_OPT, Prev: ERRSKIP_OPTERR, Up: AutoOpts API
+
+7.6.8 ERRSTOP_OPTERR - Stop on Errors
+-------------------------------------
+
+After invoking this macro, if `optionProcess()' encounters an error, it
+will call `exit(1)' rather than return. This is the default processing
+mode. It can be overridden by specifying `allow-errors' in the
+definitions file, or invoking the macro *Note ERRSKIP_OPTERR::.
+
+
+File: autogen.info, Node: HAVE_OPT, Next: ISSEL_OPT, Prev: ERRSTOP_OPTERR, Up: AutoOpts API
+
+7.6.9 HAVE_OPT( <NAME> ) - Have this option?
+--------------------------------------------
+
+This macro yields true if the option has been specified in any fashion
+at all. It is used thus:
+
+ if (HAVE_OPT( NAME )) {
+ <do-things-associated-with-opt-name>;
+ }
+
+
+File: autogen.info, Node: ISSEL_OPT, Next: ISUNUSED_OPT, Prev: HAVE_OPT, Up: AutoOpts API
+
+7.6.10 ISSEL_OPT( <NAME> ) - Is Option Selected?
+------------------------------------------------
+
+This macro yields true if the option has been specified either on the
+command line or via a SET/DISABLE macro.
+
+
+File: autogen.info, Node: ISUNUSED_OPT, Next: OPTION_CT, Prev: ISSEL_OPT, Up: AutoOpts API
+
+7.6.11 ISUNUSED_OPT( <NAME> ) - Never Specified?
+------------------------------------------------
+
+This macro yields true if the option has never been specified, or has
+been cleared via the `CLEAR_OPT()' macro.
+
+
+File: autogen.info, Node: OPTION_CT, Next: OPT_ARG, Prev: ISUNUSED_OPT, Up: AutoOpts API
+
+7.6.12 OPTION_CT - Full Count of Options
+----------------------------------------
+
+The full count of all options, both those defined and those generated
+automatically by AutoOpts. This is primarily used to initialize the
+program option descriptor structure.
+
+
+File: autogen.info, Node: OPT_ARG, Next: OPT_NO_XLAT_CFG_NAMES, Prev: OPTION_CT, Up: AutoOpts API
+
+7.6.13 OPT_ARG( <NAME> ) - Option Argument String
+-------------------------------------------------
+
+The option argument value as a pointer to string. Note that argument
+values that have been specified as numbers are stored as numbers or
+keywords. For such options, use instead the `OPT_VALUE_name' define.
+It is used thus:
+
+ if (HAVE_OPT( NAME )) {
+ char* p = OPT_ARG( NAME );
+ <do-things-with-opt-name-argument-string>;
+ }
+
+
+File: autogen.info, Node: OPT_NO_XLAT_CFG_NAMES, Next: OPT_NO_XLAT_OPT_NAMES, Prev: OPT_ARG, Up: AutoOpts API
+
+7.6.14 OPT_NO_XLAT_CFG_NAMES - option name xlation
+--------------------------------------------------
+
+Invoking this macro will disable the translation of option names only
+while processing configuration files and environment variables. This
+must be invoked before the first call to `optionProcess'.. You need
+not invoke this if your option definition file contains the attribute
+assignment, "`no-xlate = opt-cfg;'".
+
+
+File: autogen.info, Node: OPT_NO_XLAT_OPT_NAMES, Next: OPT_VALUE_name, Prev: OPT_NO_XLAT_CFG_NAMES, Up: AutoOpts API
+
+7.6.15 OPT_NO_XLAT_OPT_NAMES - option name xlation
+--------------------------------------------------
+
+Invoking this macro will completely disable the translation of option
+names. This must be invoked before the first call to `optionProcess'.
+You need not invoke this if your option definition file contains the
+attribute assignment, "`no-xlate = opt;'".
+
+
+File: autogen.info, Node: OPT_VALUE_name, Next: OPT_XLAT_CFG_NAMES, Prev: OPT_NO_XLAT_OPT_NAMES, Up: AutoOpts API
+
+7.6.16 OPT_VALUE_name - Option Argument Value
+---------------------------------------------
+
+This macro gets emitted only for options that take numeric, keyword or
+set membership arguments. The macro yields a word-sized integer
+containing the enumeration, bit set or numeric value for the option
+argument.
+
+ int opt_val = OPT_VALUE_name;
+
+
+File: autogen.info, Node: OPT_XLAT_CFG_NAMES, Next: OPT_XLAT_OPT_NAMES, Prev: OPT_VALUE_name, Up: AutoOpts API
+
+7.6.17 OPT_XLAT_CFG_NAMES - option name xlation
+-----------------------------------------------
+
+If `ENABLE_NLS' is defined and `no-xlate' has been not set to the value
+_anything_, this macro will cause the translation of option names to
+happen before starting the processing of configuration files and
+environment variables. This will change the recognition of options
+within the `$PROGRAMNAME' environment variable, but will not alter the
+names used for setting options via `$PROGRAMNAME_name' environment
+variables.
+
+ This must be invoked before the first call to `optionProcess'. You
+might need to use this macro if your option definition file contains
+the attribute assignment, "`no-xlate = opt;'" or "`no-xlate =
+opt-cfg;'", and you have determined in some way that you wish to
+override that.
+
+
+File: autogen.info, Node: OPT_XLAT_OPT_NAMES, Next: RESTART_OPT, Prev: OPT_XLAT_CFG_NAMES, Up: AutoOpts API
+
+7.6.18 OPT_XLAT_OPT_NAMES - option name xlation
+-----------------------------------------------
+
+If `ENABLE_NLS' is defined and `no-xlate' has been not set to the value
+_anything_, translate the option names before processing the command
+line options. Long option names may thus be localized. (If the names
+were translated before configuration processing, they will not be
+re-translated.)
+
+ This must be invoked before the first call to `optionProcess'. You
+might need to use this macro if your option definition file contains
+the attribute assignment, "`no-xlate = opt;'" and you have determined
+in some way that you wish to override that.
+
+
+File: autogen.info, Node: RESTART_OPT, Next: SET_OPT_name, Prev: OPT_XLAT_OPT_NAMES, Up: AutoOpts API
+
+7.6.19 RESTART_OPT( n ) - Resume Option Processing
+--------------------------------------------------
+
+If option processing has stopped (either because of an error or
+something was encountered that looked like a program argument), it can
+be resumed by providing this macro with the index `n' of the next
+option to process and calling `optionProcess()' again.
+
+
+File: autogen.info, Node: SET_OPT_name, Next: STACKCT_OPT, Prev: RESTART_OPT, Up: AutoOpts API
+
+7.6.20 SET_OPT_name - Force an option to be set
+-----------------------------------------------
+
+This macro gets emitted only when the given option has the `settable'
+attribute specified.
+
+ The form of the macro will actually depend on whether the option is
+equivalenced to another, has an option argument and/or has an assigned
+handler procedure. If the option has an argument, then this macro will
+too. Beware that the argument is not reallocated, so the value must not
+be on the stack or deallocated in any other way for as long as the value
+might get referenced.
+
+ If you have supplied at least one `homerc' file (*note program
+attributes::), this macro will be emitted for the `--save-opts' option.
+
+ SET_OPT_SAVE_OPTS( "filename" );
+
+*Note automatic options::, for a discussion of the implications of using
+this particular example.
+
+
+File: autogen.info, Node: STACKCT_OPT, Next: STACKLST_OPT, Prev: SET_OPT_name, Up: AutoOpts API
+
+7.6.21 STACKCT_OPT( <NAME> ) - Stacked Arg Count
+------------------------------------------------
+
+When the option handling attribute is specified as `stack_arg', this
+macro may be used to determine how many of them actually got stacked.
+
+ Do not use this on options that have not been stacked or has not been
+specified (the `stack_arg' attribute must have been specified, and
+`HAVE_OPT(<NAME>)' must yield TRUE). Otherwise, you will likely seg
+fault.
+
+ if (HAVE_OPT( NAME )) {
+ int ct = STACKCT_OPT( NAME );
+ char** pp = STACKLST_OPT( NAME );
+
+ do {
+ char* p = *pp++;
+ do-things-with-p;
+ } while (--ct > 0);
+ }
+
+
+File: autogen.info, Node: STACKLST_OPT, Next: START_OPT, Prev: STACKCT_OPT, Up: AutoOpts API
+
+7.6.22 STACKLST_OPT( <NAME> ) - Argument Stack
+----------------------------------------------
+
+The address of the list of pointers to the option arguments. The
+pointers are ordered by the order in which they were encountered in the
+option presets and command line processing.
+
+ Do not use this on options that have not been stacked or has not been
+specified (the `stack_arg' attribute must have been specified, and
+`HAVE_OPT(<OPTION>)' must yield TRUE). Otherwise, you will likely seg
+fault.
+
+ if (HAVE_OPT( NAME )) {
+ int ct = STACKCT_OPT( NAME );
+ char** pp = STACKLST_OPT( NAME );
+
+ do {
+ char* p = *pp++;
+ do-things-with-p;
+ } while (--ct > 0);
+ }
+
+
+File: autogen.info, Node: START_OPT, Next: STATE_OPT, Prev: STACKLST_OPT, Up: AutoOpts API
+
+7.6.23 START_OPT - Restart Option Processing
+--------------------------------------------
+
+This is just a shortcut for RESTART_OPT(1) (*Note RESTART_OPT::.)
+
+
+File: autogen.info, Node: STATE_OPT, Next: USAGE, Prev: START_OPT, Up: AutoOpts API
+
+7.6.24 STATE_OPT( <NAME> ) - Option State
+-----------------------------------------
+
+If you need to know if an option was set because of presetting actions
+(configuration file processing or environment variables), versus a
+command line entry versus one of the SET/DISABLE macros, then use this
+macro. It will yield one of four values: `OPTST_INIT', `OPTST_SET',
+`OPTST_PRESET' or `OPTST_DEFINED'. It is used thus:
+
+ switch (STATE_OPT( NAME )) {
+ case OPTST_INIT:
+ not-preset, set or on the command line. (unless CLEAR-ed)
+
+ case OPTST_SET:
+ option set via the SET_OPT_NAME() macro.
+
+ case OPTST_PRESET:
+ option set via an configuration file or environment variable
+
+ case OPTST_DEFINED:
+ option set via a command line option.
+
+ default:
+ cannot happen :)
+ }
+
+
+File: autogen.info, Node: USAGE, Next: VALUE_OPT_name, Prev: STATE_OPT, Up: AutoOpts API
+
+7.6.25 USAGE( exit-code ) - Usage invocation macro
+--------------------------------------------------
+
+This macro invokes the procedure registered to display the usage text.
+Normally, this will be `optionUsage' from the AutoOpts library, but you
+may select another procedure by specifying `usage = "proc_name"'
+program attribute. This procedure must take two arguments first, a
+pointer to the option descriptor, and second the exit code. The macro
+supplies the option descriptor automatically. This routine is expected
+to call `exit(3)' with the provided exit code.
+
+ The `optionUsage' routine also behaves differently depending on the
+exit code:
+
+`EXIT_SUCCESS (the value zero)'
+ It is assumed that full usage help has been requested.
+ Consequently, more information is provided than when displaying
+ usage and exiting with a non-zero exit code. Output will be sent
+ to `stdout' and the program will exit with a zero status code.
+
+`EX_USAGE (64)'
+ The abbreviated usage will be printed to `stdout' and the program
+ will exit with a zero status code. "EX_USAGE" may or may not be
+ 64. If your system provides "/usr/include/sysexits.h" that has a
+ different value, then that value will be used.
+
+`any other value'
+ The abbreviated usage will be printed to stderr and the program
+ will exit with the provided status code.
+
+
+File: autogen.info, Node: VALUE_OPT_name, Next: VERSION, Prev: USAGE, Up: AutoOpts API
+
+7.6.26 VALUE_OPT_name - Option Flag Value
+-----------------------------------------
+
+This is a #define for the flag character used to specify an option on
+the command line. If `value' was not specified for the option, then it
+is a unique number associated with the option. `option value' refers
+to this value, `option argument' refers to the (optional) argument to
+the option.
+
+ switch (WHICH_OPT_OTHER_OPT) {
+ case VALUE_OPT_NAME:
+ this-option-was-really-opt-name;
+ case VALUE_OPT_OTHER_OPT:
+ this-option-was-really-other-opt;
+ }
+
+
+File: autogen.info, Node: VERSION, Next: WHICH_IDX_name, Prev: VALUE_OPT_name, Up: AutoOpts API
+
+7.6.27 VERSION - Version and Full Version
+-----------------------------------------
+
+If the `version' attribute is defined for the program, then a
+stringified version will be #defined as PROGRAM_VERSION and
+PROGRAM_FULL_VERSION. PROGRAM_FULL_VERSION is used for printing the
+program version in response to the version option. The version option
+is automatically supplied in response to this attribute, too.
+
+ You may access PROGRAM_VERSION via `programOptions.pzFullVersion'.
+
+
+File: autogen.info, Node: WHICH_IDX_name, Next: WHICH_OPT_name, Prev: VERSION, Up: AutoOpts API
+
+7.6.28 WHICH_IDX_name - Which Equivalenced Index
+------------------------------------------------
+
+This macro gets emitted only for equivalenced-to options. It is used to
+obtain the index for the one of the several equivalence class members
+set the equivalenced-to option.
+
+ switch (WHICH_IDX_OTHER_OPT) {
+ case INDEX_OPT_NAME:
+ this-option-was-really-opt-name;
+ case INDEX_OPT_OTHER_OPT:
+ this-option-was-really-other-opt;
+ }
+
+
+File: autogen.info, Node: WHICH_OPT_name, Next: teOptIndex, Prev: WHICH_IDX_name, Up: AutoOpts API
+
+7.6.29 WHICH_OPT_name - Which Equivalenced Option
+-------------------------------------------------
+
+This macro gets emitted only for equivalenced-to options. It is used to
+obtain the value code for the one of the several equivalence class
+members set the equivalenced-to option.
+
+ switch (WHICH_OPT_OTHER_OPT) {
+ case VALUE_OPT_NAME:
+ this-option-was-really-opt-name;
+ case VALUE_OPT_OTHER_OPT:
+ this-option-was-really-other-opt;
+ }
+
+
+File: autogen.info, Node: teOptIndex, Next: OPTIONS_STRUCT_VERSION, Prev: WHICH_OPT_name, Up: AutoOpts API
+
+7.6.30 teOptIndex - Option Index and Enumeration
+------------------------------------------------
+
+This enum defines the complete set of options, both user specified and
+automatically provided. This can be used, for example, to distinguish
+which of the equivalenced options was actually used.
+
+ switch (pOptDesc->optActualIndex) {
+ case INDEX_OPT_FIRST:
+ stuff;
+ case INDEX_OPT_DIFFERENT:
+ different-stuff;
+ default:
+ unknown-things;
+ }
+
+
+File: autogen.info, Node: OPTIONS_STRUCT_VERSION, Next: libopts procedures, Prev: teOptIndex, Up: AutoOpts API
+
+7.6.31 OPTIONS_STRUCT_VERSION - active version
+----------------------------------------------
+
+You will not actually need to reference this value, but you need to be
+aware that it is there. It is the first value in the option descriptor
+that you pass to `optionProcess'. It contains a magic number and
+version information. Normally, you should be able to work with a more
+recent option library than the one you compiled with. However, if the
+library is changed incompatibly, then the library will detect the out of
+date magic marker, explain the difficulty and exit. You will then need
+to rebuild and recompile your option definitions. This has rarely been
+necessary.
+
+
+File: autogen.info, Node: libopts procedures, Prev: OPTIONS_STRUCT_VERSION, Up: AutoOpts API
+
+7.6.32 libopts External Procedures
+----------------------------------
+
+These are the routines that libopts users may call directly from their
+code. There are several other routines that can be called by code
+generated by the libopts option templates, but they are not to be
+called from any other user code. The `options.h' header is fairly
+clear about this, too.
+
+* Menu:
+
+* libopts-ao_string_tokenize:: ao_string_tokenize
+* libopts-configFileLoad:: configFileLoad
+* libopts-optionFileLoad:: optionFileLoad
+* libopts-optionFindNextValue:: optionFindNextValue
+* libopts-optionFindValue:: optionFindValue
+* libopts-optionFree:: optionFree
+* libopts-optionGetValue:: optionGetValue
+* libopts-optionLoadLine:: optionLoadLine
+* libopts-optionNextValue:: optionNextValue
+* libopts-optionOnlyUsage:: optionOnlyUsage
+* libopts-optionProcess:: optionProcess
+* libopts-optionRestore:: optionRestore
+* libopts-optionSaveFile:: optionSaveFile
+* libopts-optionSaveState:: optionSaveState
+* libopts-optionUnloadNested:: optionUnloadNested
+* libopts-optionVersion:: optionVersion
+* libopts-pathfind:: pathfind
+* libopts-strequate:: strequate
+* libopts-streqvcmp:: streqvcmp
+* libopts-streqvmap:: streqvmap
+* libopts-strneqvcmp:: strneqvcmp
+* libopts-strtransform:: strtransform
+
+ This subsection was automatically generated by AutoGen using
+extracted information and the aginfo3.tpl template.
+
+
+File: autogen.info, Node: libopts-ao_string_tokenize, Next: libopts-configFileLoad, Up: libopts procedures
+
+7.6.32.1 ao_string_tokenize
+...........................
+
+tokenize an input string
+
+Usage:
+ token_list_t* res = ao_string_tokenize( string );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ string `char const*' string to be tokenized
+ returns token_list_t* pointer to a structure that lists each
+ token
+
+ This function will convert one input string into a list of strings.
+The list of strings is derived by separating the input based on white
+space separation. However, if the input contains either single or
+double quote characters, then the text after that character up to a
+matching quote will become the string in the list.
+
+ The returned pointer should be deallocated with `free(3C)' when are
+done using the data. The data are placed in a single block of
+allocated memory. Do not deallocate individual token/strings.
+
+ The structure pointed to will contain at least these two fields:
+`tkn_ct'
+ The number of tokens found in the input string.
+
+`tok_list'
+ An array of `tkn_ct + 1' pointers to substring tokens, with the
+ last pointer set to NULL.
+
+ There are two types of quoted strings: single quoted (`'') and
+double quoted (`"'). Singly quoted strings are fairly raw in that
+escape characters (`\\') are simply another character, except when
+preceding the following characters:
+ `\\' double backslashes reduce to one
+ `'' incorporates the single quote into the string
+ `\n' suppresses both the backslash and newline character
+
+ Double quote strings are formed according to the rules of string
+constants in ANSI-C programs.
+
+ NULL is returned and `errno' will be set to indicate the problem:
+ * `EINVAL' - There was an unterminated quoted string.
+
+ * `ENOENT' - The input string was empty.
+
+ * `ENOMEM' - There is not enough memory.
+
+
+File: autogen.info, Node: libopts-configFileLoad, Next: libopts-optionFileLoad, Prev: libopts-ao_string_tokenize, Up: libopts procedures
+
+7.6.32.2 configFileLoad
+.......................
+
+parse a configuration file
+
+Usage:
+ const tOptionValue* res = configFileLoad( pzFile );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ pzFile `char const*' the file to load
+ returns const An allocated, compound value structure
+ tOptionValue*
+
+ This routine will load a named configuration file and parse the text
+as a hierarchically valued option. The option descriptor created from
+an option definition file is not used via this interface. The returned
+value is "named" with the input file name and is of type
+"`OPARG_TYPE_HIERARCHY'". It may be used in calls to
+`optionGetValue()', `optionNextValue()' and `optionUnloadNested()'.
+
+ If the file cannot be loaded or processed, `NULL' is returned and
+ERRNO is set. It may be set by a call to either `open(2)' `mmap(2)' or
+other file system calls, or it may be:
+ * `ENOENT' - the file was not found.
+
+ * `ENOMSG' - the file was empty.
+
+ * `EINVAL' - the file contents are invalid - not properly formed.
+
+ * `ENOMEM' - not enough memory to allocate the needed structures.
+
+
+File: autogen.info, Node: libopts-optionFileLoad, Next: libopts-optionFindNextValue, Prev: libopts-configFileLoad, Up: libopts procedures
+
+7.6.32.3 optionFileLoad
+.......................
+
+Load the locatable config files, in order
+
+Usage:
+ int res = optionFileLoad( pOpts, pzProg );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ pOpts `tOptions*' program options descriptor
+ pzProg `char const*' program name
+ returns int 0 -> SUCCESS, -1 -> FAILURE
+
+ This function looks in all the specified directories for a
+configuration file ("rc" file or "ini" file) and processes any found
+twice. The first time through, they are processed in reverse order
+(last file first). At that time, only "immediate action" configurables
+are processed. For example, if the last named file specifies not
+processing any more configuration files, then no more configuration
+files will be processed. Such an option in the *first* named directory
+will have no effect.
+
+ Once the immediate action configurables have been handled, then the
+directories are handled in normal, forward order. In that way, later
+config files can override the settings of earlier config files.
+
+ See the AutoOpts documentation for a thorough discussion of the
+config file format.
+
+ Configuration files not found or not decipherable are simply ignored.
+
+ Returns the value, "-1" if the program options descriptor is out of
+date or indecipherable. Otherwise, the value "0" will always be
+returned.
+
+
+File: autogen.info, Node: libopts-optionFindNextValue, Next: libopts-optionFindValue, Prev: libopts-optionFileLoad, Up: libopts procedures
+
+7.6.32.4 optionFindNextValue
+............................
+
+find a hierarcicaly valued option instance
+
+Usage:
+ const tOptionValue* res = optionFindNextValue( pOptDesc, pPrevVal, name, value );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ pOptDesc `const an option with a nested arg type
+ tOptDesc*'
+ pPrevVal `const the last entry
+ tOptionValue*'
+ name `char const*' name of value to find
+ value `char const*' the matching value
+ returns const a compound value structure
+ tOptionValue*
+
+ This routine will find the next entry in a nested value option or
+configurable. It will search through the list and return the next entry
+that matches the criteria.
+
+ The returned result is NULL and errno is set:
+ * `EINVAL' - the `pOptValue' does not point to a valid hierarchical
+ option value.
+
+ * `ENOENT' - no entry matched the given name.
+
+
+File: autogen.info, Node: libopts-optionFindValue, Next: libopts-optionFree, Prev: libopts-optionFindNextValue, Up: libopts procedures
+
+7.6.32.5 optionFindValue
+........................
+
+find a hierarcicaly valued option instance
+
+Usage:
+ const tOptionValue* res = optionFindValue( pOptDesc, name, value );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ pOptDesc `const an option with a nested arg type
+ tOptDesc*'
+ name `char const*' name of value to find
+ value `char const*' the matching value
+ returns const a compound value structure
+ tOptionValue*
+
+ This routine will find an entry in a nested value option or
+configurable. It will search through the list and return a matching
+entry.
+
+ The returned result is NULL and errno is set:
+ * `EINVAL' - the `pOptValue' does not point to a valid hierarchical
+ option value.
+
+ * `ENOENT' - no entry matched the given name.
+
+
+File: autogen.info, Node: libopts-optionFree, Next: libopts-optionGetValue, Prev: libopts-optionFindValue, Up: libopts procedures
+
+7.6.32.6 optionFree
+...................
+
+free allocated option processing memory
+
+Usage:
+ optionFree( pOpts );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ pOpts `tOptions*' program options descriptor
+
+ AutoOpts sometimes allocates memory and puts pointers to it in the
+option state structures. This routine deallocates all such memory.
+
+ As long as memory has not been corrupted, this routine is always
+successful.
+
+
+File: autogen.info, Node: libopts-optionGetValue, Next: libopts-optionLoadLine, Prev: libopts-optionFree, Up: libopts procedures
+
+7.6.32.7 optionGetValue
+.......................
+
+get a specific value from a hierarcical list
+
+Usage:
+ const tOptionValue* res = optionGetValue( pOptValue, valueName );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ pOptValue `const a hierarchcal value
+ tOptionValue*'
+ valueName `char const*' name of value to get
+ returns const a compound value structure
+ tOptionValue*
+
+ This routine will find an entry in a nested value option or
+configurable. If "valueName" is NULL, then the first entry is
+returned. Otherwise, the first entry with a name that exactly matches
+the argument will be returned. If there is no matching value, NULL is
+returned and errno is set to ENOENT. If the provided option value is
+not a hierarchical value, NULL is also returned and errno is set to
+EINVAL.
+
+ The returned result is NULL and errno is set:
+ * `EINVAL' - the `pOptValue' does not point to a valid hierarchical
+ option value.
+
+ * `ENOENT' - no entry matched the given name.
+
+
+File: autogen.info, Node: libopts-optionLoadLine, Next: libopts-optionNextValue, Prev: libopts-optionGetValue, Up: libopts procedures
+
+7.6.32.8 optionLoadLine
+.......................
+
+process a string for an option name and value
+
+Usage:
+ optionLoadLine( opts, line );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ opts `tOptions*' program options descriptor
+ line `char const*' NUL-terminated text
+
+ This is a client program callable routine for setting options from,
+for example, the contents of a file that they read in. Only one option
+may appear in the text. It will be treated as a normal (non-preset)
+option.
+
+ When passed a pointer to the option struct and a string, it will find
+the option named by the first token on the string and set the option
+argument to the remainder of the string. The caller must NUL terminate
+the string. The caller need not skip over any introductory hyphens.
+Any embedded new lines will be included in the option argument. If the
+input looks like one or more quoted strings, then the input will be
+"cooked". The "cooking" is identical to the string formation used in
+AutoGen definition files (*note basic expression::), except that you
+may not use backquotes.
+
+ Invalid options are silently ignored. Invalid option arguments will
+cause a warning to print, but the function should return.
+
+
+File: autogen.info, Node: libopts-optionNextValue, Next: libopts-optionOnlyUsage, Prev: libopts-optionLoadLine, Up: libopts procedures
+
+7.6.32.9 optionNextValue
+........................
+
+get the next value from a hierarchical list
+
+Usage:
+ const tOptionValue* res = optionNextValue( pOptValue, pOldValue );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ pOptValue `const a hierarchcal list value
+ tOptionValue*'
+ pOldValue `const a value from this list
+ tOptionValue*'
+ returns const a compound value structure
+ tOptionValue*
+
+ This routine will return the next entry after the entry passed in.
+At the end of the list, NULL will be returned. If the entry is not
+found on the list, NULL will be returned and "ERRNO" will be set to
+EINVAL. The "POLDVALUE" must have been gotten from a prior call to this
+routine or to "`opitonGetValue()'".
+
+ The returned result is NULL and errno is set:
+ * `EINVAL' - the `pOptValue' does not point to a valid hierarchical
+ option value or `pOldValue' does not point to a member of that
+ option value.
+
+ * `ENOENT' - the supplied `pOldValue' pointed to the last entry.
+
+
+File: autogen.info, Node: libopts-optionOnlyUsage, Next: libopts-optionProcess, Prev: libopts-optionNextValue, Up: libopts procedures
+
+7.6.32.10 optionOnlyUsage
+.........................
+
+Print usage text for just the options
+
+Usage:
+ optionOnlyUsage( pOpts, ex_code );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ pOpts `tOptions*' program options descriptor
+ ex_code `int' exit code for calling exit(3)
+
+ This routine will print only the usage for each option. This
+function may be used when the emitted usage must incorporate
+information not available to AutoOpts.
+
+
+File: autogen.info, Node: libopts-optionProcess, Next: libopts-optionRestore, Prev: libopts-optionOnlyUsage, Up: libopts procedures
+
+7.6.32.11 optionProcess
+.......................
+
+this is the main option processing routine
+
+Usage:
+ int res = optionProcess( pOpts, argc, argv );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ pOpts `tOptions*' program options descriptor
+ argc `int' program arg count
+ argv `char**' program arg vector
+ returns int the count of the arguments processed
+
+ This is the main entry point for processing options. It is intended
+that this procedure be called once at the beginning of the execution of
+a program. Depending on options selected earlier, it is sometimes
+necessary to stop and restart option processing, or to select completely
+different sets of options. This can be done easily, but you generally
+do not want to do this.
+
+ The number of arguments processed always includes the program name.
+If one of the arguments is "-", then it is counted and the processing
+stops. If an error was encountered and errors are to be tolerated, then
+the returned value is the index of the argument causing the error. A
+hyphen by itself ("-") will also cause processing to stop and will
+_not_ be counted among the processed arguments. A hyphen by itself is
+treated as an operand. Encountering an operand stops option processing.
+
+ Errors will cause diagnostics to be printed. `exit(3)' may or may
+not be called. It depends upon whether or not the options were
+generated with the "allow-errors" attribute, or if the ERRSKIP_OPTERR
+or ERRSTOP_OPTERR macros were invoked.
+
+
+File: autogen.info, Node: libopts-optionRestore, Next: libopts-optionSaveFile, Prev: libopts-optionProcess, Up: libopts procedures
+
+7.6.32.12 optionRestore
+.......................
+
+restore option state from memory copy
+
+Usage:
+ optionRestore( pOpts );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ pOpts `tOptions*' program options descriptor
+
+ Copy back the option state from saved memory. The allocated memory
+is left intact, so this routine can be called repeatedly without having
+to call optionSaveState again. If you are restoring a state that was
+saved before the first call to optionProcess(3AO), then you may change
+the contents of the argc/argv parameters to optionProcess.
+
+ If you have not called `optionSaveState' before, a diagnostic is
+printed to `stderr' and exit is called.
+
+
+File: autogen.info, Node: libopts-optionSaveFile, Next: libopts-optionSaveState, Prev: libopts-optionRestore, Up: libopts procedures
+
+7.6.32.13 optionSaveFile
+........................
+
+saves the option state to a file
+
+Usage:
+ optionSaveFile( pOpts );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ pOpts `tOptions*' program options descriptor
+
+ This routine will save the state of option processing to a file.
+The name of that file can be specified with the argument to the
+`--save-opts' option, or by appending the `rcfile' attribute to the last
+`homerc' attribute. If no `rcfile' attribute was specified, it will
+default to `.programnamerc'. If you wish to specify another file, you
+should invoke the `SET_OPT_SAVE_OPTS(filename)' macro.
+
+ The recommend usage is as follows:
+ optionProcess(&progOptions, argc, argv);
+ if (i_want_a_non_standard_place_for_this)
+ SET_OPT_SAVE_OPTS("myfilename");
+ optionSaveFile(&progOptions);
+
+ If no `homerc' file was specified, this routine will silently return
+and do nothing. If the output file cannot be created or updated, a
+message will be printed to `stderr' and the routine will return.
+
+
+File: autogen.info, Node: libopts-optionSaveState, Next: libopts-optionUnloadNested, Prev: libopts-optionSaveFile, Up: libopts procedures
+
+7.6.32.14 optionSaveState
+.........................
+
+saves the option state to memory
+
+Usage:
+ optionSaveState( pOpts );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ pOpts `tOptions*' program options descriptor
+
+ This routine will allocate enough memory to save the current option
+processing state. If this routine has been called before, that memory
+will be reused. You may only save one copy of the option state. This
+routine may be called before optionProcess(3AO). If you do call it
+before the first call to optionProcess, then you may also change the
+contents of argc/argv after you call optionRestore(3AO)
+
+ In fact, more strongly put: it is safest to only use this function
+before having processed any options. In particular, the saving and
+restoring of stacked string arguments and hierarchical values is
+disabled. The values are not saved.
+
+ If it fails to allocate the memory, it will print a message to
+stderr and exit. Otherwise, it will always succeed.
+
+
+File: autogen.info, Node: libopts-optionUnloadNested, Next: libopts-optionVersion, Prev: libopts-optionSaveState, Up: libopts procedures
+
+7.6.32.15 optionUnloadNested
+............................
+
+Deallocate the memory for a nested value
+
+Usage:
+ optionUnloadNested( pOptVal );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ pOptVal `tOptionValue the hierarchical value
+ const *'
+
+ A nested value needs to be deallocated. The pointer passed in should
+have been gotten from a call to `configFileLoad()' (See *note
+libopts-configFileLoad::).
+
+
+File: autogen.info, Node: libopts-optionVersion, Next: libopts-pathfind, Prev: libopts-optionUnloadNested, Up: libopts procedures
+
+7.6.32.16 optionVersion
+.......................
+
+return the compiled AutoOpts version number
+
+Usage:
+ char const* res = optionVersion();
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ returns char const* the version string in constant memory
+
+ Returns the full version string compiled into the library. The
+returned string cannot be modified.
+
+
+File: autogen.info, Node: libopts-pathfind, Next: libopts-strequate, Prev: libopts-optionVersion, Up: libopts procedures
+
+7.6.32.17 pathfind
+..................
+
+fild a file in a list of directories
+
+Usage:
+ char* res = pathfind( path, file, mode );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ path `char const*' colon separated list of search
+ directories
+ file `char const*' the name of the file to look for
+ mode `char const*' the mode bits that must be set to match
+ returns char* the path to the located file
+
+ pathfind looks for a a file with name "FILE" and "MODE" access along
+colon delimited "PATH", and returns the full pathname as a string, or
+NULL if not found. If "FILE" contains a slash, then it is treated as a
+relative or absolute path and "PATH" is ignored.
+
+ *NOTE*: this function is compiled into `libopts' only if it is not
+natively supplied.
+
+ The "MODE" argument is a string of option letters chosen from the
+list below:
+ Letter Meaning
+ r readable
+ w writable
+ x executable
+ f normal file (NOT IMPLEMENTED)
+ b block special (NOT IMPLEMENTED)
+ c character special (NOT IMPLEMENTED)
+ d directory (NOT IMPLEMENTED)
+ p FIFO (pipe) (NOT IMPLEMENTED)
+ u set user ID bit (NOT IMPLEMENTED)
+ g set group ID bit (NOT IMPLEMENTED)
+ k sticky bit (NOT IMPLEMENTED)
+ s size nonzero (NOT IMPLEMENTED)
+
+ returns NULL if the file is not found.
+
+
+File: autogen.info, Node: libopts-strequate, Next: libopts-streqvcmp, Prev: libopts-pathfind, Up: libopts procedures
+
+7.6.32.18 strequate
+...................
+
+map a list of characters to the same value
+
+Usage:
+ strequate( ch_list );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ ch_list `char const*' characters to equivalence
+
+ Each character in the input string get mapped to the first character
+in the string. This function name is mapped to option_strequate so as
+to not conflict with the POSIX name space.
+
+ none.
+
+
+File: autogen.info, Node: libopts-streqvcmp, Next: libopts-streqvmap, Prev: libopts-strequate, Up: libopts procedures
+
+7.6.32.19 streqvcmp
+...................
+
+compare two strings with an equivalence mapping
+
+Usage:
+ int res = streqvcmp( str1, str2 );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ str1 `char const*' first string
+ str2 `char const*' second string
+ returns int the difference between two differing
+ characters
+
+ Using a character mapping, two strings are compared for
+"equivalence". Each input character is mapped to a comparison
+character and the mapped-to characters are compared for the two NUL
+terminated input strings. This function name is mapped to
+option_streqvcmp so as to not conflict with the POSIX name space.
+
+ none checked. Caller responsible for seg faults.
+
+
+File: autogen.info, Node: libopts-streqvmap, Next: libopts-strneqvcmp, Prev: libopts-streqvcmp, Up: libopts procedures
+
+7.6.32.20 streqvmap
+...................
+
+Set the character mappings for the streqv functions
+
+Usage:
+ streqvmap( From, To, ct );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ From `char' Input character
+ To `char' Mapped-to character
+ ct `int' compare length
+
+ Set the character mapping. If the count (`ct') is set to zero, then
+the map is cleared by setting all entries in the map to their index
+value. Otherwise, the "`From'" character is mapped to the "`To'"
+character. If `ct' is greater than 1, then `From' and `To' are
+incremented and the process repeated until `ct' entries have been set.
+For example,
+ streqvmap('a', 'A', 26);
+ will alter the mapping so that all English lower case letters will
+map to upper case.
+
+ This function name is mapped to option_streqvmap so as to not
+conflict with the POSIX name space.
+
+ none.
+
+
+File: autogen.info, Node: libopts-strneqvcmp, Next: libopts-strtransform, Prev: libopts-streqvmap, Up: libopts procedures
+
+7.6.32.21 strneqvcmp
+....................
+
+compare two strings with an equivalence mapping
+
+Usage:
+ int res = strneqvcmp( str1, str2, ct );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ str1 `char const*' first string
+ str2 `char const*' second string
+ ct `int' compare length
+ returns int the difference between two differing
+ characters
+
+ Using a character mapping, two strings are compared for
+"equivalence". Each input character is mapped to a comparison
+character and the mapped-to characters are compared for the two NUL
+terminated input strings. The comparison is limited to `ct' bytes.
+This function name is mapped to option_strneqvcmp so as to not conflict
+with the POSIX name space.
+
+ none checked. Caller responsible for seg faults.
+
+
+File: autogen.info, Node: libopts-strtransform, Prev: libopts-strneqvcmp, Up: libopts procedures
+
+7.6.32.22 strtransform
+......................
+
+convert a string into its mapped-to value
+
+Usage:
+ strtransform( dest, src );
+ Where the arguments are:
+ Name Type Description
+ ---- ---- ------------
+ dest `char*' output string
+ src `char const*' input string
+
+ Each character in the input string is mapped and the mapped-to
+character is put into the output. This function name is mapped to
+option_strtransform so as to not conflict with the POSIX name space.
+
+ The source and destination may be the same.
+
+ none.
+
+
+File: autogen.info, Node: Multi-Threading, Next: option descriptor, Prev: AutoOpts API, Up: AutoOpts
+
+7.7 Multi-Threading
+===================
+
+AutoOpts was designed to configure a program for running. This
+generally happens before much real work has been started.
+Consequently, it is expected to be run before multi-threaded
+applications have started multiple threads. However, this is not
+always the case. Some applications may need to reset and reload their
+running configuration, and some may use `SET_OPT_xxx()' macros during
+processing. If you need to dynamically change your option
+configuration in your multi-threaded application, it is your
+responsibility to prevent all threads from accessing the option
+configuration state, except the one altering the configuration.
+
+ The various accessor macros (`HAVE_OPT()', etc.) do not modify state
+and are safe to use in a multi-threaded application. It is safe as long
+as no other thread is concurrently modifying state, of course.
+
+
+File: autogen.info, Node: option descriptor, Next: Using AutoOpts, Prev: Multi-Threading, Up: AutoOpts
+
+7.8 Option Descriptor File
+==========================
+
+This is the module that is to be compiled and linked with your program.
+It contains internal data and procedures subject to change. Basically,
+it contains a single global data structure containing all the
+information provided in the option definitions, plus a number of static
+strings and any callout procedures that are specified or required. You
+should never have need for looking at this, except, perhaps, to examine
+the code generated for implementing the `flag-code' construct.
+
+
+File: autogen.info, Node: Using AutoOpts, Next: Presetting Options, Prev: option descriptor, Up: AutoOpts
+
+7.9 Using AutoOpts
+==================
+
+There are actually several levels of "using" autoopts. Which you
+choose depends upon how you plan to distribute (or not) your
+application.
+
+* Menu:
+
+* local use:: local-only use
+* binary not installed:: binary distro, AutoOpts not installed
+* binary pre-installed:: binary distro, AutoOpts pre-installed
+* source pre-installed:: source distro, AutoOpts pre-installed
+* source not installed:: source distro, AutoOpts not installed
+
+
+File: autogen.info, Node: local use, Next: binary not installed, Up: Using AutoOpts
+
+7.9.1 local-only use
+--------------------
+
+To use AutoOpts in your application where you do not have to worry
+about distribution issues, your issues are simple and few.
+
+ * Create a file `myopts.def', according to the documentation above.
+ It is probably easiest to start with the example in *note Quick
+ Start:: and edit it into the form you need.
+
+ * Run AutoGen to create the option interface file (`myopts.h') and
+ the option descriptor code (`myopts.c'):
+
+ autogen myopts.def
+
+ * In all your source files where you need to refer to option state,
+ `#include "myopts.h"'.
+
+ * In your main routine, code something along the lines of:
+
+ #define ARGC_MIN some-lower-limit
+ #define ARGC_MAX some-upper-limit
+ main( int argc, char** argv )
+ {
+ {
+ int arg_ct = optionProcess( &myprogOptions, argc, argv );
+ argc -= arg_ct;
+ if ((argc < ARGC_MIN) || (argc > ARGC_MAX)) {
+ fprintf( stderr, "%s ERROR: remaining args (%d) "
+ "out of range\n", myprogOptions.pzProgName,
+ argc );
+
+ USAGE( EXIT_FAILURE );
+ }
+ argv += arg_ct;
+ }
+ if (HAVE_OPT(OPTN_NAME))
+ respond_to_optn_name();
+ ...
+ }
+
+ * Compile `myopts.c' and link your program with the following
+ additional arguments:
+
+ `autoopts-config cflags ldflags` myopts.c
+
+
+File: autogen.info, Node: binary not installed, Next: binary pre-installed, Prev: local use, Up: Using AutoOpts
+
+7.9.2 binary distro, AutoOpts not installed
+-------------------------------------------
+
+If you will be distributing (or copying) your project to a system that
+does not have AutoOpts installed, you will need to statically link the
+AutoOpts library, "libopts" into your program. Get the link information
+with "`static-libs'" instead of "`ldflags'":
+
+ `autoopts-config static-libs`
+
+
+File: autogen.info, Node: binary pre-installed, Next: source pre-installed, Prev: binary not installed, Up: Using AutoOpts
+
+7.9.3 binary distro, AutoOpts pre-installed
+-------------------------------------------
+
+If you will be distributing (or copying) your project to a system that
+does have AutoOpts (or only "libopts") installed, you will still need
+to ensure that the library is findable at program load time, or you
+will still have to statically link. The former can be accomplished by
+linking your project with `--rpath' or by setting the `LD_LIBRARY_PATH'
+appropriately. Otherwise, *Note binary not installed::.
+
+
+File: autogen.info, Node: source pre-installed, Next: source not installed, Prev: binary pre-installed, Up: Using AutoOpts
+
+7.9.4 source distro, AutoOpts pre-installed
+-------------------------------------------
+
+If you will be distributing your project to a system that will build
+your product but it may not be pre-installed with AutoOpts, you will
+need to do some configuration checking before you start the build.
+Assuming you are willing to fail the build if AutoOpts has not been
+installed, you will still need to do a little work.
+
+ AutoOpts is distributed with a configuration check M4 script,
+`autoopts.m4'. It will add an `autoconf' macro named,
+`AG_PATH_AUTOOPTS'. Add this to your `configure.ac' script and use the
+following substitution values:
+
+`AUTOGEN'
+ the name of the autogen executable
+
+`AUTOGEN_TPLIB'
+ the directory where AutoGen template library is stored
+
+`AUTOOPTS_CFLAGS'
+ the compile time options needed to find the AutoOpts headers
+
+`AUTOOPTS_LIBS'
+ the link options required to access the `libopts' library
+
+
+File: autogen.info, Node: source not installed, Prev: source pre-installed, Up: Using AutoOpts
+
+7.9.5 source distro, AutoOpts not installed
+-------------------------------------------
+
+If you will be distributing your project to a system that will build
+your product but it may not be pre-installed with AutoOpts, you may
+wish to incorporate the sources for `libopts' in your project. To do
+this, I recommend reading the tear-off libopts library `README' that
+you can find in the `pkg/libopts' directory. You can also examine an
+example package (blocksort) that incorporates this tear off library in
+the autogen distribution directory. There is also a web page that
+describes what you need to do:
+ `http://autogen.sourceforge.net/blocksort.html'
+
+ Alternatively, you can pull the `libopts' library sources into a
+build directory and build it for installation along with your package.
+This can be done approximately as follows:
+ tar -xzvf `autoopts-config libsrc`
+ cd libopts-*
+ ./bootstrap
+ configure
+ make
+ make install
+ That will install the library, but not the headers or anything else.
+
+
+File: autogen.info, Node: Presetting Options, Next: Config File Format, Prev: Using AutoOpts, Up: AutoOpts
+
+7.10 Configuring your program
+=============================
+
+AutoOpts supports the notion of "presetting" the value or state of an
+option. The values may be obtained either from environment variables
+or from configuration files (`rc' or `ini' files). In order to take
+advantage of this, the AutoOpts client program must specify these
+features in the option descriptor file (*note program attributes::)
+with the `rcfile' or `environrc' attributes.
+
+* Menu:
+
+* loading rcfile:: configuration file presets
+* saving rcfile:: Saving the presets into a configuration file
+* sample rcfile:: Creating a sample configuration file
+* environrc:: environment variable presets
+* config example:: Config file only example
+
+ It is also possible to configure your program without using the
+command line option parsing code. This is done by using only the
+following four functions from the `libopts' library:
+
+`configFileLoad'
+ (*note libopts-configFileLoad::) will parse the contents of a
+ config file and return a pointer to a structure representing the
+ hierarchical value. The values are sorted alphabetically by the
+ value name and all entries with the same name will retain their
+ original order. Insertion sort is used.
+
+`optionGetValue'
+ (*note libopts-optionGetValue::) will find the first value within
+ the hierarchy with a name that matches the name passed in.
+
+`optionNextValue'
+ (*note libopts-optionNextValue::) will return the next value that
+ follows the value passed in as an argument. If you wish to get all
+ the values for a particular name, you must take note when the name
+ changes.
+
+`optionUnloadNested'
+ (*note libopts-optionUnloadNested::). The pointer passed in must
+ be of type, `OPARG_TYPE_HIERARCHY' (see the autoopts/options.h
+ header file). `configFileLoad' will return a `tOptionValue'
+ pointer of that type. This function will release all the
+ associated memory. `AutoOpts' generated code uses this function
+ for its own needs. Client code should only call this function
+ with pointers gotten from `configFileLoad'.
+
+
+File: autogen.info, Node: loading rcfile, Next: saving rcfile, Up: Presetting Options
+
+7.10.1 configuration file presets
+---------------------------------
+
+Configuration files are enabled by specifying the program attribute
+`homerc' (*note program attributes::). Any option not marked with the
+"no-preset" attribute may appear in a configuration file. The files
+loaded are selected both by the `homerc' entries and, optionally, via a
+command line option. The first component of the `homerc' entry may be
+an environment variable such as `$HOME', or it may also be `$$' (*two*
+dollar sign characters) to specify the directory of the executable.
+For example:
+
+ homerc = "$$/../share/autogen";
+
+will cause the AutoOpts library to look in the normal autogen datadir
+relative to the current installation directory for autogen.
+
+ The configuration files are processed in the order they are
+specified by the `homerc' attribute, so that each new file will
+normally override the settings of the previous files. This may be
+overridden by marking some options for `immediate action' (*note
+Immediate Action::). Any such options are acted upon in *reverse*
+order. The disabled `load-opts' (`--no-load-opts') option, for
+example, is an immediate action option. Its presence in the last
+`homerc' file will prevent the processing of any prior `homerc' files
+because its effect is immediate.
+
+ Configuration file processing can be completely suppressed by
+specifying `--no-load-opts' on the command line, or
+`PROGRAM_LOAD_OPTS=no' in the environment (if `environrc' has been
+specified).
+
+ See the "Configuration File Format" section (*note Config File
+Format::) for details on the format of the file.
+
+
+File: autogen.info, Node: saving rcfile, Next: sample rcfile, Prev: loading rcfile, Up: Presetting Options
+
+7.10.2 Saving the presets into a configuration file
+---------------------------------------------------
+
+When configuration files are enabled for an application, the user is
+also provided with an automatically supplied `--save-opts' option. All
+of the known option state will be written to either the specified
+output file or, if it is not specified, then to the last specified
+`homerc' file.
+
+
+File: autogen.info, Node: sample rcfile, Next: environrc, Prev: saving rcfile, Up: Presetting Options
+
+7.10.3 Creating a sample configuration file
+-------------------------------------------
+
+AutoOpts is shipped with a template named, `rc-sample.tpl'. If your
+option definition file specifies the `homerc' attribute, then you may
+invoke `autogen' thus:
+
+ autogen -Trc-sample <your-option-def-file>
+
+ This will, by default, produce a sample file named,
+`sample-<prog-name>rc'. It will be named differently if you specify
+your configuration (rc) file name with the `rcfile' attribute. In that
+case, the output file will be named, `sample-<rcfile-name>'. It will
+contain all of the program options not marked as `no-preset'. It will
+also include the text from the `doc' attribute.
+
+Doing so with getdefs' option definitions yields this sample-getdefsrc
+file. I tend to be wordy in my `doc' attributes:
+
+ # getdefs sample configuration file
+ ## This source file is copyrighted and licensed under the following terms:
+ #
+ # Copyright (C) 1999-2012 Bruce Korb, all rights reserved.
+ # This is free software. It is licensed for use, modification and
+ # redistribution under the terms of the
+ # GNU General Public License, version 3 or later
+ # <http://gnu.org/licenses/gpl.html>
+ #
+ # getdefs is free software: you can redistribute it and/or modify it
+ # under the terms of the GNU General Public License as published by the
+ # Free Software Foundation, either version 3 of the License, or
+ # (at your option) any later version.
+ #
+ # getdefs is distributed in the hope that it will be useful, but
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ # See the GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License along
+ # with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ # defs_to_get -- Regexp to look for after the "/*="
+ #
+ #
+ #
+ #
+ # If you want definitions only from a particular category, or even
+ # with names matching particular patterns, then specify this regular
+ # expression for the text that must follow the @code{/*=}.
+ # Example:
+ #
+ #defs_to_get reg-ex
+
+ # subblock -- subblock definition names
+ #
+ #
+ #
+ #
+ # This option is used to create shorthand entries for nested definitions.
+ # For example, with:
+ # @table @r
+ # @item using subblock thus
+ # @code{--subblock=arg=argname,type,null}
+ # @item and defining an @code{arg} thus
+ # @code{arg: this, char *}
+ # @item will then expand to:
+ # @code{arg = @{ argname = this; type = "char *"; @};}
+ # @end table
+ # The "this, char *" string is separated at the commas, with the
+ # white space removed. You may use characters other than commas by
+ # starting the value string with a punctuation character other than
+ # a single or double quote character. You may also omit intermediate
+ # values by placing the commas next to each other with no intervening
+ # white space. For example, "+mumble++yes+" will expand to:
+ # @*
+ # @code{arg = @{ argname = mumble; null = "yes"; @};}.
+ # Example:
+ #
+ #subblock sub-def
+
+ # listattr -- attribute with list of values
+ #
+ #
+ #
+ #
+ # This option is used to create shorthand entries for definitions
+ # that generally appear several times. That is, they tend to be
+ # a list of values. For example, with:
+ # @*
+ # @code{listattr=foo} defined, the text:
+ # @*
+ # @code{foo: this, is, a, multi-list} will then expand to:
+ # @*
+ # @code{foo = 'this', 'is', 'a', 'multi-list';}
+ # @*
+ # The texts are separated by the commas, with the
+ # white space removed. You may use characters other than commas by
+ # starting the value string with a punctuation character other than
+ # a single or double quote character.
+ # Example:
+ #
+ #listattr def
+
+ # ordering -- Alphabetize or use named file
+ #
+ #
+ #
+ #
+ # By default, ordering is alphabetical by the entry name. Use,
+ # @code{no-ordering} if order is unimportant. Use @code{ordering}
+ # with no argument to order without case sensitivity. Use
+ # @code{ordering=<file-name>} if chronological order is important.
+ # getdefs will maintain the text content of @code{file-name}.
+ # @code{file-name} need not exist.
+ # Example:
+ #
+ #ordering file-name
+
+ # first_index -- The first index to apply to groups
+ #
+ # This configuration value takes an integer number as its argument.
+ #
+ #
+ # By default, the first occurrence of a named definition will have an
+ # index of zero. Sometimes, that needs to be a reserved value. Provide
+ # this option to specify a different starting point.
+ # Example:
+ #
+ #first_index 0
+
+ # filelist -- Insert source file names into defs
+ #
+ #
+ #
+ #
+ # Inserts the name of each input file into the output definitions.
+ # If no argument is supplied, the format will be:
+ # @example
+ # infile = '%s';
+ # @end example
+ # If an argument is supplied, that string will be used for the entry
+ # name instead of @var{infile}.
+ # Example:
+ #
+ #filelist file
+
+ # assign -- Global assignments
+ #
+ #
+ #
+ #
+ # The argument to each copy of this option will be inserted into
+ # the output definitions, with only a semicolon attached.
+ # Example:
+ #
+ #assign ag-def
+
+ # common_assign -- Assignments common to all blocks
+ #
+ #
+ #
+ #
+ # The argument to each copy of this option will be inserted into
+ # each output definition, with only a semicolon attached.
+ # Example:
+ #
+ #common_assign ag-def
+
+ # copy -- File(s) to copy into definitions
+ #
+ #
+ #
+ #
+ # The content of each file named by these options will be inserted into
+ # the output definitions.
+ # Example:
+ #
+ #copy file
+
+ # srcfile -- Insert source file name into each def
+ #
+ #
+ #
+ #
+ # Inserts the name of the input file where a definition was found
+ # into the output definition.
+ # If no argument is supplied, the format will be:
+ # @example
+ # srcfile = '%s';
+ # @end example
+ # If an argument is supplied, that string will be used for the entry
+ # name instead of @var{srcfile}.
+ # Example:
+ #
+ #srcfile file
+
+ # linenum -- Insert source line number into each def
+ #
+ #
+ #
+ #
+ # Inserts the line number in the input file where a definition
+ # was found into the output definition.
+ # If no argument is supplied, the format will be:
+ # @example
+ # linenum = '%s';
+ # @end example
+ # If an argument is supplied, that string will be used for the entry
+ # name instead of @var{linenum}.
+ # Example:
+ #
+ #linenum def-name
+
+ # input -- Input file to search for defs
+ #
+ #
+ #
+ #
+ # All files that are to be searched for definitions must be named on
+ # the command line or read from @code{stdin}. If there is only one
+ # @code{input} option and it is the string, "-", then the input file
+ # list is read from @code{stdin}. If a command line argument is not
+ # an option name and does not contain an assignment operator
+ # (@code{=}), then it defaults to being an input file name.
+ # At least one input file must be specified.
+ # Example:
+ #
+ #input src-file
+
+ # output -- Output file to open
+ #
+ #
+ #
+ #
+ # If you are not sending the output to an AutoGen process,
+ # you may name an output file instead.
+ # Example:
+ #
+ #output file
+
+ # autogen -- Invoke AutoGen with defs
+ #
+ #
+ #
+ #
+ # This is the default output mode. Specifying @code{no-autogen} is
+ # equivalent to @code{output=-}. If you supply an argument to this
+ # option, that program will be started as if it were AutoGen and
+ # its standard in will be set to the output definitions of this program.
+ # Example:
+ #
+ #autogen ag-cmd
+
+ # template -- Template Name
+ #
+ #
+ #
+ #
+ # Specifies the template name to be used for generating the final output.
+ # Example:
+ #
+ #template file
+
+ # agarg -- AutoGen Argument
+ #
+ #
+ #
+ #
+ # This is a pass-through argument. It allows you to specify any
+ # arbitrary argument to be passed to AutoGen.
+ # Example:
+ #
+ #agarg ag-opt
+
+ # base_name -- Base name for output file(s)
+ #
+ #
+ #
+ #
+ # When output is going to AutoGen, a base name must either be supplied
+ # or derived. If this option is not supplied, then it is taken from
+ # the @code{template} option. If that is not provided either, then
+ # it is set to the base name of the current directory.
+ # Example:
+ #
+ #base_name name
+
+
+File: autogen.info, Node: environrc, Next: config example, Prev: sample rcfile, Up: Presetting Options
+
+7.10.4 environment variable presets
+-----------------------------------
+
+If the AutoOpts client program specifies `environrc' in its option
+descriptor file, then environment variables will be used for presetting
+option state. Variables will be looked for that are named,
+`PROGRAM_OPTNAME' and `PROGRAM'. `PROGRAM' is the upper cased `C-name'
+of the program, and `OPTNAME' is the upper cased `C-name' of a specific
+option. (The `C-name's are the regular names with all special
+characters converted to underscores (`_').)
+
+ Option specific environment variables are processed after (and thus
+take precedence over) the contents of the `PROGRAM' environment
+variable. The option argument string for these options takes on the
+string value gotten from the environment. Consequently, you can only
+have one instance of the `OPTNAME'.
+
+ If a particular option may be disabled, then its disabled state is
+indicated by setting the `PROGRAM_OPTNAME' value to the disablement
+prefix. So, for example, if the disablement prefix were `dont', then
+you can disable the `optname' option by setting the `PROGRAM_OPTNAME''
+environment variable to `dont'. *Note Common Attributes::.
+
+ The `PROGRAM' environment string is tokenized and parsed much like a
+command line. Doubly quoted strings have backslash escapes processed
+the same way they are processed in C program constant strings. Singly
+quoted strings are "pretty raw" in that backslashes are honored before
+other backslashes, apostrophes, newlines and cr/newline pairs. The
+options must be introduced with hyphens in the same way as the command
+line.
+
+ Note that not all options may be preset. Options that are specified
+with the `no-preset' attribute and the `--help', `--more-help', and
+`--save-opts' auto-supported options may not be preset.
+
+
+File: autogen.info, Node: config example, Prev: environrc, Up: Presetting Options
+
+7.10.5 Config file only example
+-------------------------------
+
+If for some reason it is difficult or unworkable to integrate
+configuration file processing with command line option parsing, the
+`libopts' (*note libopts procedures::) library can still be used to
+process configuration files. Below is a "Hello, World!" greeting
+program that tries to load a configuration file `hello.conf' to see if
+it should use an alternate greeting or to personalize the salutation.
+ #include <config.h>
+ #include <sys/types.h>
+ #include <stdio.h>
+ #include <pwd.h>
+ #include <string.h>
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+ #include <autoopts/options.h>
+ int main(int argc, char ** argv) {
+ char const * greeting = "Hello";
+ char const * greeted = "World";
+ tOptionValue const * pOV = configFileLoad("hello.conf");
+
+ if (pOV != NULL) {
+ const tOptionValue* pGetV = optionGetValue(pOV, "greeting");
+
+ if ( (pGetV != NULL)
+ && (pGetV->valType == OPARG_TYPE_STRING))
+ greeting = strdup(pGetV->v.strVal);
+
+ pGetV = optionGetValue(pOV, "personalize");
+ if (pGetV != NULL) {
+ struct passwd * pwe = getpwuid(getuid());
+ if (pwe != NULL)
+ greeted = strdup(pwe->pw_gecos);
+ }
+
+ optionUnloadNested(pOV); /* deallocate config data */
+ }
+ printf("%s, %s!\n", greeting, greeted);
+ return 0;
+ }
+
+With that text in a file named "hello.c", this short script:
+
+ cc -o hello hello.c `autoopts-config cflags ldflags`
+ ./hello
+ echo 'greeting Buzz off' > hello.conf
+ ./hello
+ echo personalize > hello.conf
+ ./hello
+
+will produce the following output:
+
+ Hello, World!
+ Buzz off, World!
+ Hello, Bruce Korb!
+
+
+File: autogen.info, Node: Config File Format, Next: shell options, Prev: Presetting Options, Up: AutoOpts
+
+7.11 Configuration File Format
+==============================
+
+The configuration file is designed to associate names and values, much
+like an AutoGen Definition File (*note Definitions File::).
+Unfortunately, the file formats are different. Specifically, AutoGen
+Definitions provide for simpler methods for the precise control of a
+value string and provides for dynamically computed content.
+Configuration files have some established traditions in their layout.
+So, they are different, even though they do both allow for a single
+name to be associated with multiple values and they both allow for
+hierarchical values.
+
+* Menu:
+
+* config name/string-value:: assigning a string value to a configurable
+* config integer-values:: integer values
+* config nested-values:: hierarchical values
+* config directives:: configuration file directives
+* config comments:: comments in the configuration file
+
+
+File: autogen.info, Node: config name/string-value, Next: config integer-values, Up: Config File Format
+
+7.11.1 assigning a string value to a configurable
+-------------------------------------------------
+
+The basic syntax is a name followed by a value on a single line. They
+are separated from each other by either white space, a colon (`:') or an
+equal sign (`='). The colon or equal sign may optionally be surrounded
+by additional white space. If more than one value line is needed, a
+backslash (`\') may be used to continue the value. The backslash (but
+not the newline) will be erased. Leading and trailing white space is
+always stripped from the value.
+
+ Fundamentally, it looks like this:
+
+ name value for that name
+ name = another \
+ multi-line value \
+ for that name.
+ name: a *third* value for ``name''
+
+ If you need more control over the content of the value, you may
+enclose the value in XML style brackets:
+ <name>value </name>
+ Within these brackets you need not (must not) continue the value
+data with backslashes. You may also select the string formation rules
+to use, just add the attribute after the name, thus: `<name keep>'.
+
+`keep'
+ This mode will keep all text between the brackets and not strip any
+ white space.
+
+`uncooked'
+ This mode strips leading and trailing white space, but not do any
+ quote processing. This is the default and need not be specified.
+
+`cooked'
+ The text is trimmed of leading and trailing white space and XML
+ encodings are processed. These encodings are slightly expanded
+ over the XML specification. They are specified with an ampersand
+ followed by a value name or numeric value and then a semicolon:
+
+ `amp'
+ `lt'
+ `gt'
+ `quot'
+ `apos'
+ `#dd'
+ `#xHH'
+ These are all per fairly standad HTML and/or XML encodings.
+ Additionally:
+
+ `bs'
+ The ASCII back space character.
+
+ `ff'
+ The ASCII form feed character.
+
+ `ht'
+ The ASCII horizontal (normal) tab character.
+
+ `cr'
+ The ASCII carriage return character.
+
+ `vt'
+ The ASCII vertical tab character.
+
+ `bel'
+ The ASCII alarm bell character.
+
+ `nl'
+ The ASCII new line character.
+
+ `space'
+ The ASCII space character. Normally not necessary, but if
+ you want to preserve leading or trailing space characters,
+ then use this.
+
+ And here is an example of an XML-styled value:
+
+ <name cooked>
+ This is&nl;&ht;another multi-line
+ &ht;string example.
+ </name>
+
+ The string value associated with "name" will be exactly the text
+enclosed in quotes with the encoded characters "cooked" as you would
+expect (three text lines with the last line not ending with a newline,
+but ending with a period).
+
+
+File: autogen.info, Node: config integer-values, Next: config nested-values, Prev: config name/string-value, Up: Config File Format
+
+7.11.2 integer values
+---------------------
+
+A name can be specified as having an integer value. To do this, you
+must use the XML-ish format and specify a "type" attribute for the name:
+
+ <name type=integer> 1234 </name>
+
+ Boolean, enumeration and set membership types will be added as time
+allows. "type=string" is also supported, but also is the default.
+
+
+File: autogen.info, Node: config nested-values, Next: config directives, Prev: config integer-values, Up: Config File Format
+
+7.11.3 hierarchical values
+--------------------------
+
+In order to specify a hierarchical value, you *must* use XML-styled
+formatting, specifying a type that is shorter and easier to spell:
+
+ <structured-name type=nested>
+ [[....]]
+ </structured-name>
+
+The ellipsis may be filled with any legal configuration file name/value
+assignments.
+
+
+File: autogen.info, Node: config directives, Next: config comments, Prev: config nested-values, Up: Config File Format
+
+7.11.4 configuration file directives
+------------------------------------
+
+The `<?' marker indicates an XML directive. There is only one
+directive supported: program sectioning, though two syntaxes are
+supported.
+
+ If, for example, you have a collection of programs that work closely
+together and, likely, have a common set of options, these programs may
+use a single, sectioned, configuration file. The file may be sectioned
+in either of two ways. The two ways may not be intermixed in a single
+configuration file. All text before the first segmentation line is
+processed, then only the segment that applies:
+
+`<?auto-options ...>'
+ The `...' ellipsis may contain AutoOpts option processing options.
+ Currently, that consists of one or both of:
+
+ `gnu'
+ `autoopts'
+ to indicate GNU-standard or AutoOpts-standard layout of usage
+ and version information, and/or
+
+ `misuse-usage'
+ `no-misuse-usage'
+ to indicate whether the available options should be listed
+ when an invalid option appears on the command line.
+ Anything else will be silently ignored.
+
+`<?program prog-name>'
+ The `<?' marker indicates an XML directive. The file is
+ partitioned by these lines and the options are processed for the
+ `prog-name' program only before the first `<?program' directive
+ and the program section with a matching program name.
+
+`[PROG_NAME]'
+ This is basically an alias for `<?program prog-name>', except that
+ the program name must be upper cased and segmented only with
+ underscores.
+
+Segmentation does not apply if the config file is being parsed with the
+`configFileLoad(3AutoOpts)' function.
+
+
+File: autogen.info, Node: config comments, Prev: config directives, Up: Config File Format
+
+7.11.5 comments in the configuration file
+-----------------------------------------
+
+Comments are lines beginning with a hash mark (`#'), XML-style comments
+(`<!-- arbitrary text -->'), and unrecognized XML directives.
+
+ # this is a comment
+ <!-- this is also
+ a comment -->
+ <?this is
+ a bad comment ;->
+
+
+File: autogen.info, Node: shell options, Next: AutoInfo, Prev: Config File Format, Up: AutoOpts
+
+7.12 AutoOpts for Shell Scripts
+===============================
+
+AutoOpts may be used with shell scripts either by automatically
+creating a complete program that will process command line options and
+pass back the results to the invoking shell by issuing shell variable
+assignment commands, or it may be used to generate portable shell code
+that can be inserted into your script.
+
+ The functionality of these features, of course, is somewhat
+constrained compared with the normal program facilities. Specifically,
+you cannot invoke callout procedures with either of these methods.
+Additionally, if you generate a shell script to do the parsing:
+
+ 1. You cannot obtain options from configuration files.
+
+ 2. You cannot obtain options from environment variables.
+
+ 3. You cannot save the option state to an option file.
+
+ 4. Option conflict/requirement verification is disabled.
+
+ Both of these methods are enabled by running AutoGen on the
+definitions file with the additional main procedure attribute:
+
+ main = { main-type = shell-process; };
+ or:
+ main = { main-type = shell-parser; };
+
+ If you do not supply a `proc-to-call', it will default to
+`optionPutShell'. That will produce a program that will process the
+options and generate shell text for the invoking shell to interpret
+(*note binary-parser::). If you supply the name, `optionParseShell',
+then you will have a program that will generate a shell script that can
+parse the options (*note script-parser::). If you supply a different
+procedure name, you will have to provide that routine and it may do
+whatever you like.
+
+* Menu:
+
+* binary-parser:: Parsing with an Executable
+* script-parser:: Parsing with a Portable Script
+
+
+File: autogen.info, Node: binary-parser, Next: script-parser, Up: shell options
+
+7.12.1 Parsing with an Executable
+---------------------------------
+
+The following commands are approximately all that is needed to build a
+shell script command line option parser from an option definition file:
+
+ autogen -L <opt-template-dir> test-errors.def
+ cc -o test-errors -L <opt-lib-dir> -I <opt-include-dir> \
+ -DTEST_PROGRAM_OPTS test-errors.c -lopts
+
+ The resulting program can then be used within your shell script as
+follows:
+
+ eval `./test-errors "$@"`
+ if [ -z "${OPTION_CT}" ] ; then exit 1 ; fi
+ test ${OPTION_CT} -gt 0 && shift ${OPTION_CT}
+
+ Here is the usage output example from AutoOpts error handling tests.
+The option definition has argument reordering enabled:
+
+ test_errors - Test AutoOpts for errors
+ USAGE: errors [ -<flag> [<val>] | --<name>[{=| }<val>] ]... arg ...
+ Flg Arg Option-Name Description
+ -o no option The option option descrip
+ -s Str second The second option descrip
+ - may appear up to 10 times
+ -i --- ignored we have dumped this
+ -X no another Another option descrip
+ - may appear up to 5 times
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+ Options are specified by doubled hyphens and their name or by a single
+ hyphen and the flag character.
+ Operands and options may be intermixed. They will be reordered.
+
+ The following option preset mechanisms are supported:
+ - reading file errorsRC
+ Packaged by Bruce (2012-08-11)
+ Report test_errors bugs to bkorb@gnu.org
+
+ Using the invocation,
+ test-errors operand1 -s first operand2 -X -- -s operand3
+ you get the following output for your shell script to evaluate:
+
+ OPTION_CT=4
+ export OPTION_CT
+ TEST_ERRORS_SECOND='first'
+ export TEST_ERRORS_SECOND
+ TEST_ERRORS_ANOTHER=1 # 0x1
+ export TEST_ERRORS_ANOTHER
+ set -- 'operand1' 'operand2' '-s' 'operand3'
+ OPTION_CT=0
+
+
+File: autogen.info, Node: script-parser, Prev: binary-parser, Up: shell options
+
+7.12.2 Parsing with a Portable Script
+-------------------------------------
+
+If you had used `test-main = optionParseShell' instead, then you can,
+at this point, merely run the program and it will write the parsing
+script to standard out. You may also provide this program with command
+line options to specify the shell script file to create or edit, and you
+may specify the shell program to use on the first shell script line.
+That program's usage text would look something like the following and
+the script parser itself would be very verbose:
+
+ genshellopt - Generate Shell Option Processing Script - Ver. 1
+ USAGE: genshellopt [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
+ Flg Arg Option-Name Description
+ -o Str script Output Script File
+ -s Str shell Shell name (follows "#!" magic)
+ - disabled as --no-shell
+ - enabled by default
+ -v opt version Output version information and exit
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+ Options are specified by doubled hyphens and their name or by a single
+ hyphen and the flag character.
+
+ Note that ``shell'' is only useful if the output file does not already
+ exist. If it does, then the shell name and optional first argument will be
+ extracted from the script file.
+
+ If the script file already exists and contains Automated Option Processing
+ text, the second line of the file through the ending tag will be replaced
+ by the newly generated text. The first ``#!'' line will be regenerated.
+ Packaged by Bruce (2012-08-11)
+ Report genshellopt bugs to bkorb@gnu.org
+
+ = = = = = = = =
+
+ This incarnation of genshell will produce
+ a shell script to parse the options for getdefs:
+
+ getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
+ USAGE: getdefs [ <option-name>[{=| }<val>] ]...
+ Arg Option-Name Description
+ Str defs-to-get Regexp to look for after the "/*="
+ Str subblock subblock definition names
+ Str listattr attribute with list of values
+ opt ordering Alphabetize or use named file
+ Num first-index The first index to apply to groups
+ opt filelist Insert source file names into defs
+ Str assign Global assignments
+ Str common-assign Assignments common to all blocks
+ Str copy File(s) to copy into definitions
+ opt srcfile Insert source file name into each def
+ opt linenum Insert source line number into each def
+ Str input Input file to search for defs
+ Str output Output file to open
+ opt autogen Invoke AutoGen with defs
+ Str template Template Name
+ Str agarg AutoGen Argument
+ Str base-name Base name for output file(s)
+ opt version Output version information and exit
+ no help Display extended usage information and exit
+ no more-help Extended usage information passed thru pager
+ opt save-opts Save the option state to a config file
+ Str load-opts Load options from a config file
+
+ All arguments are named options.
+
+ If no ``input'' argument is provided or is set to simply "-", and if
+ ``stdin'' is not a ``tty'', then the list of input files will be read from
+ ``stdin''.
+ Packaged by Bruce (2012-08-11)
+ Report getdefs bugs to bkorb@gnu.org
+
+Resulting in the following script:
+ #! /bin/sh
+ # # # # # # # # # # -- do not modify this marker --
+ #
+ # DO NOT EDIT THIS SECTION OF /old-home/bkorb/ag/ag/doc/ag-texi-30133.d/.ag-eFukQW/genshellopt.sh
+ #
+ # From here to the next `-- do not modify this marker --',
+ # the text has been generated Saturday August 11, 2012 at 09:42:46 AM PDT
+ # From the GETDEFS option definitions
+ #
+ GETDEFS_LONGUSAGE_TEXT='getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
+ USAGE: getdefs [ <option-name>[{=| }<val>] ]...
+
+ Specify which definitions are of interest and what to say about them:
+
+ Arg Option-Name Description
+ Str defs-to-get Regexp to look for after the "/*="
+ Str subblock subblock definition names
+ - may appear multiple times
+ Str listattr attribute with list of values
+ - may appear multiple times
+
+ specify how to number the definitions:
+
+ Arg Option-Name Description
+ opt ordering Alphabetize or use named file
+ - disabled as --no-ordering
+ - enabled by default
+ Num first-index The first index to apply to groups
+
+ Definition insertion options:
+
+ Arg Option-Name Description
+ opt filelist Insert source file names into defs
+ Str assign Global assignments
+ - may appear multiple times
+ Str common-assign Assignments common to all blocks
+ - may appear multiple times
+ Str copy File(s) to copy into definitions
+ - may appear multiple times
+ opt srcfile Insert source file name into each def
+ opt linenum Insert source line number into each def
+
+ specify which files to search for markers:
+
+ Arg Option-Name Description
+ Str input Input file to search for defs
+ - may appear multiple times
+ - default option for unnamed options
+
+ Definition output disposition options::
+
+ Arg Option-Name Description
+ Str output Output file to open
+ - an alternate for autogen
+ opt autogen Invoke AutoGen with defs
+ - disabled as --no-autogen
+ - enabled by default
+ Str template Template Name
+ Str agarg AutoGen Argument
+ - prohibits these options:
+ output
+ - may appear multiple times
+ Str base-name Base name for output file(s)
+ - prohibits these options:
+ output
+
+ version, usage and configuration options:
+
+ Arg Option-Name Description
+ opt version Output version information and exit
+ no help Display extended usage information and exit
+ no more-help Extended usage information passed thru pager
+ opt save-opts Save the option state to a config file
+ Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+ All arguments are named options.
+
+ If no ``input'\'''\'' argument is provided or is set to simply "-", and if
+ ``stdin'\'''\'' is not a ``tty'\'''\'', then the list of input files will be read from
+ ``stdin'\'''\''.
+
+ The following option preset mechanisms are supported:
+ - reading file /dev/null
+
+ This program extracts AutoGen definitions from a list of source files.
+ Definitions are delimited by ``/*=<entry-type> <entry-name>\n'\'''\'' and
+ ``=*/\n'\'''\''.
+ Packaged by Bruce (2012-08-11)
+ Report getdefs bugs to bkorb@gnu.org'
+
+ GETDEFS_USAGE_TEXT='getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
+ USAGE: getdefs [ <option-name>[{=| }<val>] ]...
+ Arg Option-Name Description
+ Str defs-to-get Regexp to look for after the "/*="
+ Str subblock subblock definition names
+ Str listattr attribute with list of values
+ opt ordering Alphabetize or use named file
+ Num first-index The first index to apply to groups
+ opt filelist Insert source file names into defs
+ Str assign Global assignments
+ Str common-assign Assignments common to all blocks
+ Str copy File(s) to copy into definitions
+ opt srcfile Insert source file name into each def
+ opt linenum Insert source line number into each def
+ Str input Input file to search for defs
+ Str output Output file to open
+ opt autogen Invoke AutoGen with defs
+ Str template Template Name
+ Str agarg AutoGen Argument
+ Str base-name Base name for output file(s)
+ opt version Output version information and exit
+ no help Display extended usage information and exit
+ no more-help Extended usage information passed thru pager
+ opt save-opts Save the option state to a config file
+ Str load-opts Load options from a config file
+
+ All arguments are named options.
+
+ If no ``input'\'''\'' argument is provided or is set to simply "-", and if
+ ``stdin'\'''\'' is not a ``tty'\'''\'', then the list of input files will be read from
+ ``stdin'\'''\''.
+ Packaged by Bruce (2012-08-11)
+ Report getdefs bugs to bkorb@gnu.org'
+
+
+ GETDEFS_DEFS_TO_GET=${GETDEFS_DEFS_TO_GET}
+ GETDEFS_DEFS_TO_GET_set=false
+ export GETDEFS_DEFS_TO_GET
+
+ if test -z "${GETDEFS_SUBBLOCK}"
+ then
+ GETDEFS_SUBBLOCK_CT=0
+ else
+ GETDEFS_SUBBLOCK_CT=1
+ GETDEFS_SUBBLOCK_1=${GETDEFS_SUBBLOCK}
+ fi
+ export GETDEFS_SUBBLOCK_CT
+ if test -z "${GETDEFS_LISTATTR}"
+ then
+ GETDEFS_LISTATTR_CT=0
+ else
+ GETDEFS_LISTATTR_CT=1
+ GETDEFS_LISTATTR_1=${GETDEFS_LISTATTR}
+ fi
+ export GETDEFS_LISTATTR_CT
+ GETDEFS_ORDERING=${GETDEFS_ORDERING}
+ GETDEFS_ORDERING_set=false
+ export GETDEFS_ORDERING
+
+ GETDEFS_FIRST_INDEX=${GETDEFS_FIRST_INDEX-'0'}
+ GETDEFS_FIRST_INDEX_set=false
+ export GETDEFS_FIRST_INDEX
+ GETDEFS_FILELIST=${GETDEFS_FILELIST}
+ GETDEFS_FILELIST_set=false
+ export GETDEFS_FILELIST
+
+ if test -z "${GETDEFS_ASSIGN}"
+ then
+ GETDEFS_ASSIGN_CT=0
+ else
+ GETDEFS_ASSIGN_CT=1
+ GETDEFS_ASSIGN_1=${GETDEFS_ASSIGN}
+ fi
+ export GETDEFS_ASSIGN_CT
+ if test -z "${GETDEFS_COMMON_ASSIGN}"
+ then
+ GETDEFS_COMMON_ASSIGN_CT=0
+ else
+ GETDEFS_COMMON_ASSIGN_CT=1
+ GETDEFS_COMMON_ASSIGN_1=${GETDEFS_COMMON_ASSIGN}
+ fi
+ export GETDEFS_COMMON_ASSIGN_CT
+ if test -z "${GETDEFS_COPY}"
+ then
+ GETDEFS_COPY_CT=0
+ else
+ GETDEFS_COPY_CT=1
+ GETDEFS_COPY_1=${GETDEFS_COPY}
+ fi
+ export GETDEFS_COPY_CT
+ GETDEFS_SRCFILE=${GETDEFS_SRCFILE}
+ GETDEFS_SRCFILE_set=false
+ export GETDEFS_SRCFILE
+
+ GETDEFS_LINENUM=${GETDEFS_LINENUM}
+ GETDEFS_LINENUM_set=false
+ export GETDEFS_LINENUM
+
+ if test -z "${GETDEFS_INPUT}"
+ then
+ GETDEFS_INPUT_CT=0
+ else
+ GETDEFS_INPUT_CT=1
+ GETDEFS_INPUT_1=${GETDEFS_INPUT}
+ fi
+ export GETDEFS_INPUT_CT
+ GETDEFS_OUTPUT=${GETDEFS_OUTPUT}
+ GETDEFS_OUTPUT_set=false
+ export GETDEFS_OUTPUT
+
+ GETDEFS_AUTOGEN=${GETDEFS_AUTOGEN}
+ GETDEFS_AUTOGEN_set=false
+ export GETDEFS_AUTOGEN
+
+ GETDEFS_TEMPLATE=${GETDEFS_TEMPLATE}
+ GETDEFS_TEMPLATE_set=false
+ export GETDEFS_TEMPLATE
+
+ if test -z "${GETDEFS_AGARG}"
+ then
+ GETDEFS_AGARG_CT=0
+ else
+ GETDEFS_AGARG_CT=1
+ GETDEFS_AGARG_1=${GETDEFS_AGARG}
+ fi
+ export GETDEFS_AGARG_CT
+ GETDEFS_BASE_NAME=${GETDEFS_BASE_NAME}
+ GETDEFS_BASE_NAME_set=false
+ export GETDEFS_BASE_NAME
+
+ OPT_ARG=$1
+ while [ $# -gt 0 ]
+ do
+ OPT_ELEMENT=''
+ OPT_ARG_VAL=''
+ OPT_ARG=${1}
+ OPT_CODE=`echo "X${OPT_ARG}"|sed 's/^X-*//'`
+ shift
+ OPT_ARG=$1
+ case "${OPT_CODE}" in *=* )
+ OPT_ARG_VAL=`echo "${OPT_CODE}"|sed 's/^[^=]*=//'`
+ OPT_CODE=`echo "${OPT_CODE}"|sed 's/=.*$//'` ;; esac
+ case "${OPT_CODE}" in
+ 'de' | \
+ 'def' | \
+ 'defs' | \
+ 'defs-' | \
+ 'defs-t' | \
+ 'defs-to' | \
+ 'defs-to-' | \
+ 'defs-to-g' | \
+ 'defs-to-ge' | \
+ 'defs-to-get' )
+ if [ -n "${GETDEFS_DEFS_TO_GET}" ] && ${GETDEFS_DEFS_TO_GET_set} ; then
+ echo Error: duplicate DEFS_TO_GET option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_DEFS_TO_GET_set=true
+ OPT_NAME='DEFS_TO_GET'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'su' | \
+ 'sub' | \
+ 'subb' | \
+ 'subbl' | \
+ 'subblo' | \
+ 'subbloc' | \
+ 'subblock' )
+ GETDEFS_SUBBLOCK_CT=`expr ${GETDEFS_SUBBLOCK_CT} + 1`
+ OPT_ELEMENT="_${GETDEFS_SUBBLOCK_CT}"
+ OPT_NAME='SUBBLOCK'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'lis' | \
+ 'list' | \
+ 'lista' | \
+ 'listat' | \
+ 'listatt' | \
+ 'listattr' )
+ GETDEFS_LISTATTR_CT=`expr ${GETDEFS_LISTATTR_CT} + 1`
+ OPT_ELEMENT="_${GETDEFS_LISTATTR_CT}"
+ OPT_NAME='LISTATTR'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'or' | \
+ 'ord' | \
+ 'orde' | \
+ 'order' | \
+ 'orderi' | \
+ 'orderin' | \
+ 'ordering' )
+ if [ -n "${GETDEFS_ORDERING}" ] && ${GETDEFS_ORDERING_set} ; then
+ echo Error: duplicate ORDERING option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_ORDERING_set=true
+ OPT_NAME='ORDERING'
+ eval GETDEFS_ORDERING${OPT_ELEMENT}=true
+ export GETDEFS_ORDERING${OPT_ELEMENT}
+ OPT_ARG_NEEDED=OK
+ ;;
+
+ 'no-o' | \
+ 'no-or' | \
+ 'no-ord' | \
+ 'no-orde' | \
+ 'no-order' | \
+ 'no-orderi' | \
+ 'no-orderin' | \
+ 'no-ordering' )
+ if [ -n "${GETDEFS_ORDERING}" ] && ${GETDEFS_ORDERING_set} ; then
+ echo 'Error: duplicate ORDERING option' >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_ORDERING_set=true
+ GETDEFS_ORDERING='no'
+ export GETDEFS_ORDERING
+ OPT_NAME='ORDERING'
+ OPT_ARG_NEEDED=NO
+ ;;
+
+ 'fir' | \
+ 'firs' | \
+ 'first' | \
+ 'first-' | \
+ 'first-i' | \
+ 'first-in' | \
+ 'first-ind' | \
+ 'first-inde' | \
+ 'first-index' )
+ if [ -n "${GETDEFS_FIRST_INDEX}" ] && ${GETDEFS_FIRST_INDEX_set} ; then
+ echo Error: duplicate FIRST_INDEX option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_FIRST_INDEX_set=true
+ OPT_NAME='FIRST_INDEX'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'fil' | \
+ 'file' | \
+ 'filel' | \
+ 'fileli' | \
+ 'filelis' | \
+ 'filelist' )
+ if [ -n "${GETDEFS_FILELIST}" ] && ${GETDEFS_FILELIST_set} ; then
+ echo Error: duplicate FILELIST option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_FILELIST_set=true
+ OPT_NAME='FILELIST'
+ eval GETDEFS_FILELIST${OPT_ELEMENT}=true
+ export GETDEFS_FILELIST${OPT_ELEMENT}
+ OPT_ARG_NEEDED=OK
+ ;;
+
+ 'as' | \
+ 'ass' | \
+ 'assi' | \
+ 'assig' | \
+ 'assign' )
+ GETDEFS_ASSIGN_CT=`expr ${GETDEFS_ASSIGN_CT} + 1`
+ OPT_ELEMENT="_${GETDEFS_ASSIGN_CT}"
+ OPT_NAME='ASSIGN'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'com' | \
+ 'comm' | \
+ 'commo' | \
+ 'common' | \
+ 'common-' | \
+ 'common-a' | \
+ 'common-as' | \
+ 'common-ass' | \
+ 'common-assi' | \
+ 'common-assig' | \
+ 'common-assign' )
+ GETDEFS_COMMON_ASSIGN_CT=`expr ${GETDEFS_COMMON_ASSIGN_CT} + 1`
+ OPT_ELEMENT="_${GETDEFS_COMMON_ASSIGN_CT}"
+ OPT_NAME='COMMON_ASSIGN'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'cop' | \
+ 'copy' )
+ GETDEFS_COPY_CT=`expr ${GETDEFS_COPY_CT} + 1`
+ OPT_ELEMENT="_${GETDEFS_COPY_CT}"
+ OPT_NAME='COPY'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'sr' | \
+ 'src' | \
+ 'srcf' | \
+ 'srcfi' | \
+ 'srcfil' | \
+ 'srcfile' )
+ if [ -n "${GETDEFS_SRCFILE}" ] && ${GETDEFS_SRCFILE_set} ; then
+ echo Error: duplicate SRCFILE option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_SRCFILE_set=true
+ OPT_NAME='SRCFILE'
+ eval GETDEFS_SRCFILE${OPT_ELEMENT}=true
+ export GETDEFS_SRCFILE${OPT_ELEMENT}
+ OPT_ARG_NEEDED=OK
+ ;;
+
+ 'lin' | \
+ 'line' | \
+ 'linen' | \
+ 'linenu' | \
+ 'linenum' )
+ if [ -n "${GETDEFS_LINENUM}" ] && ${GETDEFS_LINENUM_set} ; then
+ echo Error: duplicate LINENUM option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_LINENUM_set=true
+ OPT_NAME='LINENUM'
+ eval GETDEFS_LINENUM${OPT_ELEMENT}=true
+ export GETDEFS_LINENUM${OPT_ELEMENT}
+ OPT_ARG_NEEDED=OK
+ ;;
+
+ 'in' | \
+ 'inp' | \
+ 'inpu' | \
+ 'input' )
+ GETDEFS_INPUT_CT=`expr ${GETDEFS_INPUT_CT} + 1`
+ OPT_ELEMENT="_${GETDEFS_INPUT_CT}"
+ OPT_NAME='INPUT'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'ou' | \
+ 'out' | \
+ 'outp' | \
+ 'outpu' | \
+ 'output' )
+ if [ -n "${GETDEFS_OUTPUT}" ] && ${GETDEFS_OUTPUT_set} ; then
+ echo Error: duplicate OUTPUT option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_OUTPUT_set=true
+ OPT_NAME='OUTPUT'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'au' | \
+ 'aut' | \
+ 'auto' | \
+ 'autog' | \
+ 'autoge' | \
+ 'autogen' )
+ if [ -n "${GETDEFS_AUTOGEN}" ] && ${GETDEFS_AUTOGEN_set} ; then
+ echo Error: duplicate AUTOGEN option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_AUTOGEN_set=true
+ OPT_NAME='AUTOGEN'
+ eval GETDEFS_AUTOGEN${OPT_ELEMENT}=true
+ export GETDEFS_AUTOGEN${OPT_ELEMENT}
+ OPT_ARG_NEEDED=OK
+ ;;
+
+ 'no-a' | \
+ 'no-au' | \
+ 'no-aut' | \
+ 'no-auto' | \
+ 'no-autog' | \
+ 'no-autoge' | \
+ 'no-autogen' )
+ if [ -n "${GETDEFS_AUTOGEN}" ] && ${GETDEFS_AUTOGEN_set} ; then
+ echo 'Error: duplicate AUTOGEN option' >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_AUTOGEN_set=true
+ GETDEFS_AUTOGEN='no'
+ export GETDEFS_AUTOGEN
+ OPT_NAME='AUTOGEN'
+ OPT_ARG_NEEDED=NO
+ ;;
+
+ 'te' | \
+ 'tem' | \
+ 'temp' | \
+ 'templ' | \
+ 'templa' | \
+ 'templat' | \
+ 'template' )
+ if [ -n "${GETDEFS_TEMPLATE}" ] && ${GETDEFS_TEMPLATE_set} ; then
+ echo Error: duplicate TEMPLATE option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_TEMPLATE_set=true
+ OPT_NAME='TEMPLATE'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'ag' | \
+ 'aga' | \
+ 'agar' | \
+ 'agarg' )
+ GETDEFS_AGARG_CT=`expr ${GETDEFS_AGARG_CT} + 1`
+ OPT_ELEMENT="_${GETDEFS_AGARG_CT}"
+ OPT_NAME='AGARG'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'ba' | \
+ 'bas' | \
+ 'base' | \
+ 'base-' | \
+ 'base-n' | \
+ 'base-na' | \
+ 'base-nam' | \
+ 'base-name' )
+ if [ -n "${GETDEFS_BASE_NAME}" ] && ${GETDEFS_BASE_NAME_set} ; then
+ echo Error: duplicate BASE_NAME option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1 ; fi
+ GETDEFS_BASE_NAME_set=true
+ OPT_NAME='BASE_NAME'
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 've' | \
+ 'ver' | \
+ 'vers' | \
+ 'versi' | \
+ 'versio' | \
+ 'version' )
+ echo "$GETDEFS_LONGUSAGE_TEXT"
+ exit 0
+ ;;
+
+ 'he' | \
+ 'hel' | \
+ 'help' )
+ echo "$GETDEFS_LONGUSAGE_TEXT"
+ exit 0
+ ;;
+
+ 'mo' | \
+ 'mor' | \
+ 'more' | \
+ 'more-' | \
+ 'more-h' | \
+ 'more-he' | \
+ 'more-hel' | \
+ 'more-help' )
+ echo "$GETDEFS_LONGUSAGE_TEXT" | ${PAGER-more}
+ exit 0
+ ;;
+
+ 'sa' | \
+ 'sav' | \
+ 'save' | \
+ 'save-' | \
+ 'save-o' | \
+ 'save-op' | \
+ 'save-opt' | \
+ 'save-opts' )
+ echo 'Warning: Cannot save options files' >&2
+ OPT_ARG_NEEDED=OK
+ ;;
+
+ 'lo' | \
+ 'loa' | \
+ 'load' | \
+ 'load-' | \
+ 'load-o' | \
+ 'load-op' | \
+ 'load-opt' | \
+ 'load-opts' )
+ echo 'Warning: Cannot load options files' >&2
+ OPT_ARG_NEEDED=YES
+ ;;
+
+ 'no-l' | \
+ 'no-lo' | \
+ 'no-loa' | \
+ 'no-load' | \
+ 'no-load-' | \
+ 'no-load-o' | \
+ 'no-load-op' | \
+ 'no-load-opt' | \
+ 'no-load-opts' )
+ echo 'Warning: Cannot suppress the loading of options files' >&2
+ OPT_ARG_NEEDED=NO
+ ;;
+
+ * )
+ echo Unknown option: "${OPT_CODE}" >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1
+ ;;
+ esac
+
+ case "${OPT_ARG_NEEDED}" in
+ NO )
+ OPT_ARG_VAL=''
+ ;;
+ YES )
+ if [ -z "${OPT_ARG_VAL}" ]
+ then
+ if [ $# -eq 0 ]
+ then
+ echo No argument provided for ${OPT_NAME} option >&2
+ echo "$GETDEFS_USAGE_TEXT"
+ exit 1
+ fi
+ OPT_ARG_VAL=${OPT_ARG}
+ shift
+ OPT_ARG=$1
+ fi
+ ;;
+ OK )
+ if [ -z "${OPT_ARG_VAL}" ] && [ $# -gt 0 ]
+ then
+ case "${OPT_ARG}" in -* ) ;; * )
+ OPT_ARG_VAL=${OPT_ARG}
+ shift
+ OPT_ARG=$1 ;; esac
+ fi
+ ;;
+ esac
+ if [ -n "${OPT_ARG_VAL}" ]
+ then
+ eval GETDEFS_${OPT_NAME}${OPT_ELEMENT}="'${OPT_ARG_VAL}'"
+ export GETDEFS_${OPT_NAME}${OPT_ELEMENT}
+ fi
+ done
+ unset OPT_PROCESS || :
+ unset OPT_ELEMENT || :
+ unset OPT_ARG || :
+ unset OPT_ARG_NEEDED || :
+ unset OPT_NAME || :
+ unset OPT_CODE || :
+ unset OPT_ARG_VAL || :
+
+ # # # # # # # # # #
+ #
+ # END OF AUTOMATED OPTION PROCESSING
+ #
+ # # # # # # # # # # -- do not modify this marker --
+
+ env | grep '^GETDEFS_'
+
+
+File: autogen.info, Node: AutoInfo, Next: AutoMan pages, Prev: shell options, Up: AutoOpts
+
+7.13 Automated Info Docs
+========================
+
+AutoOpts provides two templates for producing `.texi' documentation.
+`agtexi-cmd.tpl' for the invoking section, and `aginfo3.tpl' for
+describing exported library functions and macros.
+
+ For both types of documents, the documentation level is selected by
+passing a `-DLEVEL=<level-name>' argument to AutoGen when you build the
+document. (See the example invocation below.)
+
+ Two files will be produced, a `.texi' file and a `.menu' file. You
+should include the text in the `.menu' file in a `@menu' list, either
+with `@include'-ing it or just copying text. The `.texi' file should
+be `@include'-ed where the invoking section belongs in your document.
+
+ The `.texi' file will contain an introductory paragraph, a menu and
+a subordinate section for the invocation usage and for each documented
+option. The introductory paragraph is normally the boiler plate text,
+along the lines of:
+
+ This chapter documents the @file{AutoOpts} generated usage text
+ and option meanings for the @file{your-program} program.
+
+or:
+
+ These are the publicly exported procedures from the libname library.
+ Any other functions mentioned in the header file are for the private use
+ of the library.
+
+* Menu:
+
+* command-info:: ``invoking'' info docs
+* library-info:: library info docs
+
+
+File: autogen.info, Node: command-info, Next: library-info, Up: AutoInfo
+
+7.13.1 "invoking" info docs
+---------------------------
+
+Using the option definitions for an AutoOpt client program, the
+`agtexi-cmd.tpl' template will produce texinfo text that documents the
+invocation of your program. The text emitted is designed to be included
+in the full texinfo document for your product. It is not a stand-alone
+document. The usage text for the *note autogen usage::, *note getdefs
+usage:: and *note columns usage:: programs, are included in this
+document and are all generated using this template.
+
+ If your program's option definitions include a `prog-info-descrip'
+section, then that text will replace the boilerplate introductory
+paragraph.
+
+These files are produced by invoking the following command:
+
+ autogen -L ${prefix}/share/autogen -Tagtexi-cmd.tpl \
+ -DLEVEL=section your-opts.def
+
+Where `${prefix}' is the AutoGen installation prefix and
+`your-opts.def' is the name of your product's option definition file.
+
+
+File: autogen.info, Node: library-info, Prev: command-info, Up: AutoInfo
+
+7.13.2 library info docs
+------------------------
+
+The `texinfo' doc for libraries is derived from mostly the same
+information as is used for producing man pages *Note man3::. The main
+difference is that there is only one output file and the individual
+functions are referenced from a `.texi' menu. There is also a small
+difference in the global attributes used:
+
+ lib_description A description of the library. This text
+ appears before the menu. If not provided, the
+ standard boilerplate version will be inserted.
+
+ see_also The `SEE ALSO' functionality is not supported
+ for the `texinfo' documentation, so any
+ `see_also' attribute will be ignored.
+
+These files are produced by invoking the following commands:
+
+ getdefs linenum srcfile template=aginfo3.tpl output=libexport.def \
+ <source-file-list>
+
+ autogen -L ${prefix}/share/autogen -DLEVEL=section libexport.def
+
+Where `${prefix}' is the AutoGen installation prefix and
+`libexport.def' is some name that suits you.
+
+ An example of this can be seen in this document, *Note libopts
+procedures::.
+
+
+File: autogen.info, Node: AutoMan pages, Next: getopt_long, Prev: AutoInfo, Up: AutoOpts
+
+7.14 Automated Man Pages
+========================
+
+AutoOpts provides two templates for producing man pages. The command
+(`man1') pages are derived from the options definition file, and the
+library (`man3') pages are derived from stylized comments (*note
+getdefs Invocation::).
+
+* Menu:
+
+* man1:: command line man pages
+* man3:: library man pages
+
+
+File: autogen.info, Node: man1, Next: man3, Up: AutoMan pages
+
+7.14.1 command line man pages
+-----------------------------
+
+Using the option definitions for an AutoOpts client program, the
+`agman-cmd.tpl' template will produce an nroff document suitable for
+use as a `man(1)' page document for a command line command. The
+description section of the document is either the `prog-man-descrip'
+text, if present, or the `detail' text.
+
+ Each option in the option definitions file is fully documented in
+its usage. This includes all the information documented above for each
+option (*note option attributes::), plus the `doc' attribute is
+appended. Since the `doc' text is presumed to be designed for
+`texinfo' documentation, `sed' is used to convert some constructs from
+`texi' to `nroff'-for-`man'-pages. Specifically,
+
+ convert @code, @var and @samp into \fB...\fP phrases
+ convert @file into \fI...\fP phrases
+ Remove the '@' prefix from curly braces
+ Indent example regions
+ Delete the example commands
+ Replace `end example' command with ".br"
+ Replace the `@*' command with ".br"
+
+This document is produced by invoking the following command:
+
+ autogen -L ${prefix}/share/autogen -Tagman-cmd.tpl options.def
+
+Where `${prefix}' is the AutoGen installation prefix and `options.def'
+is the name of your product's option definition file. I do not use
+this very much, so any feedback or improvements would be greatly
+appreciated.
+
+
+File: autogen.info, Node: man3, Prev: man1, Up: AutoMan pages
+
+7.14.2 library man pages
+------------------------
+
+Two global definitions are required, and then one library man page is
+produced for each `export_func' definition that is found. It is
+generally convenient to place these definitions as `getdefs' comments
+(*note getdefs Invocation::) near the procedure definition, but they
+may also be a separate AutoGen definitions file (*note Definitions
+File::). Each function will be cross referenced with their sister
+functions in a `SEE ALSO' section. A global `see_also' definition will
+be appended to this cross referencing text.
+
+The two global definitions required are:
+
+ library This is the name of your library, without the `lib'
+ prefix. The AutoOpts library is named
+ `libopts.so...', so the `library' attribute would have
+ the value `opts'.
+
+ header Generally, using a library with a compiled program
+ entails `#include'-ing a header file. Name that
+ header with this attribute. In the case of AutoOpts,
+ it is generated and will vary based on the name of the
+ option definition file. Consequently, `your-opts.h' is
+ specified.
+
+The `export_func' definition should contain the following attributes:
+
+ name The name of the procedure the library user may call.
+ what A brief sentence describing what the procedure does.
+ doc A detailed description of what the procedure does. It
+ may ramble on for as long as necessary to properly
+ describe it.
+ err A short description of how errors are handled.
+ ret_type The data type returned by the procedure. Omit this
+ for `void' procedures.
+ ret_desc Describe what the returned value is, if needed.
+ private If specified, the function will *not* be documented.
+ This is used, for example, to produce external
+ declarations for functions that are not available for
+ public use, but are used in the generated text.
+
+ arg This is a compound attribute that contains:
+
+ arg_type The data type of the argument.
+ arg_name A short name for it.
+ arg_desc A brief description.
+
+As a `getdefs' comment, this would appear something like this:
+
+ /*=--subblock=arg=arg_type,arg_name,arg_desc =*/
+ /*=*
+ * library: opts
+ * header: your-opts.h
+ =*/
+ /*=export_func optionProcess
+ *
+ * what: this is the main option processing routine
+ * arg: + tOptions* + pOpts + program options descriptor +
+ * arg: + int + argc + program arg count +
+ * arg: + char** + argv + program arg vector +
+ * ret_type: int
+ * ret_desc: the count of the arguments processed
+ *
+ * doc: This is what it does.
+ * err: When it can't, it does this.
+ =*/
+
+Note the `subblock' and `library' comments. `subblock' is an embedded
+`getdefs' option (*note getdefs subblock::) that tells it how to parse
+the `arg' attribute. The `library' and `header' entries are global
+definitions that apply to all the documented functions.
+
+
+File: autogen.info, Node: getopt_long, Next: i18n, Prev: AutoMan pages, Up: AutoOpts
+
+7.15 Using getopt(3C)
+=====================
+
+There is a template named, `getopt.tpl' that is distributed with
+AutoOpts. Using that template instead of `options.tpl' will produce
+completely independent source code that will parse command line
+options. It will utilize either the standard `getopt(3C)' or the GNU
+`getopt_long(3GNU)' function to drive the parsing. Which is used is
+selected by the presence or absence of the `long-opts' program
+attribute. It will save you from being dependent upon the `libopts'
+library and it produces code ready for internationalization. However,
+it also carries with it some limitations on the use of AutoOpts
+features and some requirements on the build environment.
+
+* Menu:
+
+* getopt limitations:: getopt feature limitations
+* getopt building:: getopt build requirements
+
+
+File: autogen.info, Node: getopt limitations, Next: getopt building, Up: getopt_long
+
+7.15.1 getopt feature limitations
+---------------------------------
+
+This list of limitations is relative to the full list of AutoOpts
+supported features, *Note Features::.
+
+ 1. You cannot automatically take advantage of environment variable
+ options or automated parsing of configuration files ("rc" or "ini"
+ files). Consequently, the resulting code does not support
+ `--load-opts' or `--save-opts' options automatically.
+
+ 2. You cannot use set membership, enumerated, range checked or stacked
+ argument type options. In fact, you cannot use anything that
+ depends upon the `libopts' library. You are constrained to
+ options that take "`string'" arguments, though you may handle the
+ option argument with a callback procedure.
+
+ 3. Special disablement and/or enablement prefixes are not recognized.
+
+ 4. Generated `main()' procedures will not work.
+
+ 5. Option coordination with external libraries will not work.
+
+ 6. Every option must be "settable" because the emitted code depends
+ upon the `SET_OPT_XXX' macros having been defined. Specify this
+ as a global (program) attribute.
+
+ 7. You must specify a main procedure of type "main". The
+ `getopt.tpl' template depends upon being able to compile the
+ traditional .c file into a program and get it to emit the usage
+ text.
+
+ 8. For the same reason, the traditional option parsing table code
+ must be emitted before the `getopt.tpl' template gets expanded.
+
+ 9. The usage text is, therefore, statically defined.
+
+
+File: autogen.info, Node: getopt building, Prev: getopt limitations, Up: getopt_long
+
+7.15.2 getopt build requirements
+--------------------------------
+
+You must supply some compile and link options via environment variables.
+
+`srcdir'
+ In case the option definition file lives in a different directory.
+
+`CFLAGS'
+ Any special flags required to compile. The flags from
+ `autoopts-config cflags' will be included automatically. Since
+ the creation of the option parsing code includes creating a program
+ that prints out help text, if it is necessary to include files from
+ various directories to compile that program, you will need to
+ specify those directories with "-Idirpath" text in the `CFLAGS'.
+ Some experimentation may be necessary in that case.
+
+ *NOTE*: the "-Idirpath" text is only needed if your option callback
+ functions include code that require additional "#include"
+ directives.
+
+`LDFLAGS'
+ Any special flags required to link. The flags from
+ `autoopts-config ldflags' will be included automatically. This is
+ required only if additional link flags for the help text emission
+ program might be needed.
+
+`CC'
+ This is needed only if "`cc'" cannot be found in `$PATH' (or it is
+ not the one you want).
+
+ To use this, set the exported environment variables and specify
+"getopt" as the default template in your option definitions file (*note
+Identification::). You will have four new files. Assuming your
+definitions were in a file named `myprog-opts.def' and your program
+name was specified as `progname', the resulting files would be created:
+`myprog-opts.h', `myprog-opts.c', `getopt-progname.h' and
+`getopt-progname.c'. You must compile and link both `.c' files into
+your program. If there are link failures, then you are using AutoOpts
+features that require the `libopts' library. You must remove these
+features, *Note getopt limitations::.
+
+ These generated files depend upon configure defines to work
+correctly. Therefore, you must specify a `config-header' attribute
+(*note programming attributes::) and ensure it has `#defines' for
+either `HAVE_STDINT_H' or `HAVE_INTTYPES_H'; either `HAVE_SYS_LIMITS_H'
+or `HAVE_LIMITS_H'; and `HAVE_SYSEXITS_H', if the `sysexits.h' header
+is available. The required header files for these defines are,
+respectively, the `/usr/include' files named:
+ * stdint.h
+
+ * inttypes.h
+
+ * sys/limits.h
+
+ * limits.h
+
+ * sysexits.h
+
+The following header files must also exist on the build platform:
+ * sys/types.h
+
+ * stdio.h
+
+ * string.h
+
+ * unistd.h - or, for getopt_long:
+
+ * getopt.h
+
+
+File: autogen.info, Node: i18n, Next: Naming Conflicts, Prev: getopt_long, Up: AutoOpts
+
+7.16 Internationalizing AutoOpts
+================================
+
+The generated code for AutoOpts will enable and disable the translation
+of AutoOpts run time messages. If `ENABLE_NLS' is defined at compile
+time and `no-xlate' has been not set to the value _anything_, then the
+`_()' macro may be used to specify a translation function. If
+undefined, it will default to `gettext(3GNU)'. This define will also
+enable a callback function that `optionProcess' invokes at the
+beginning of option processing. The AutoOpts `libopts' library will
+always check for this _compiled with NLS_ flag, so `libopts' does not
+need to be specially compiled. The strings returned by the translation
+function will be `strdup(3)-ed' and kept. They will not be
+re-translated, even if the locale changes, but they will also not be
+dependent upon reused or unmappable memory.
+
+ To internationalize option processing, you should first
+internationalize your program. Then, the option processing strings can
+be added to your translation text by processing the AutoOpts-generated
+`my-opts.c' file and adding the distributed `po/usage-txt.pot' file.
+(Also by extracting the strings yourself from the `usage-txt.h' file.)
+When you call `optionProcess', all of the user visible AutoOpts strings
+will be passed through the localization procedure established with the
+`_()' preprocessing macro.
+
+ All of this is _dis_-abled if you specify the global attribute
+`no-xlate' to _anything_.
+
+
+File: autogen.info, Node: Naming Conflicts, Next: All Attribute Names, Prev: i18n, Up: AutoOpts
+
+7.17 Naming Conflicts
+=====================
+
+AutoOpts generates a header file that contains many C preprocessing
+macros and several external names. For the most part, they begin with
+either `opt_' or `option', or else they end with `_opt'. If this
+happens to conflict with other macros you are using, or if you are
+compiling multiple option sets in the same compilation unit, the
+conflicts can be avoided. You may specify an external name `prefix'
+(*note program attributes::) for all of the names generated for each
+set of option definitions.
+
+ Among these macros, several take an option name as a macro argument.
+Sometimes, this will inconveniently conflict. For example, if you
+specify an option named, `debug', the emitted code will presume that
+`DEBUG' is not a preprocessing name. Or also, if you are building on a
+Windows platform, you may find that MicroSoft has usurped a number of
+user space names in its header files. Consequently, you will get a
+preprocessing error if you use, for example, `HAVE_OPT(DEBUG)' or
+`HAVE_OPT(INTERNAL)' (*note HAVE_OPT::) in your code. You may trigger
+an obvious warning for such conflicts by specifying the
+`guard-option-names' attribute (*note program attributes::). That
+emitted code will also `#undef'-ine the conflicting name.
+
+
+File: autogen.info, Node: All Attribute Names, Next: Option Define Names, Prev: Naming Conflicts, Up: AutoOpts
+
+7.18 All Attribute Names
+========================
+
+This is the list of all the option attributes used in the various
+option processing templates. There are several flavors of attributes,
+and these are not distinguished here.
+
+ * Valid, current attributes that you are encouraged to use.
+
+ * Internally generated attributes that you cannot use at all. I
+ need to prefix these with a distinguished prefix. e.g. "ao-"
+
+ * Valid attributes, but are deprecated. Alternates should be
+ documented.
+
+ This list is derived by running many example option definitions
+through the option generation and man page templates and noting which
+attributes are actually used. There may be a few that are used but not
+exercised in my testing. If so, I need to ferret those out and test
+them, too.
+
+ aliases allow-errors arg-default
+ arg-optional arg-range arg-type
+ argument call-proc code
+ config-header copyright default
+ deprecated descrip detail
+ disable documentation eaddr
+ enable enabled environrc
+ equivalence exit-name explain
+ export extract-code field
+ file-fail-code flag flag-code
+ flag-proc flags-cant flags-must
+ full-usage gnu-usage guard-option-names
+ help-value homerc ifdef
+ ifndef immed-disable immediate
+ include lib-name library
+ long-opts main main-text
+ main-type max min
+ more-help-value must-set name
+ no-command no-libopts no-misuse-usage
+ no-preset no-xlate nomem-fail-code
+ omitted-usage package prefix
+ prefix-enum preserve-case prog-name
+ prog-title reorder-args resettable
+ scaled settable short-usage
+ stack-arg std-value test-main
+ translators unstack-arg usage
+ usage-message usage-opt usage-type
+ val-name val-upname value
+ version
+
+
+File: autogen.info, Node: Option Define Names, Prev: All Attribute Names, Up: AutoOpts
+
+7.19 Option Definition Name Index
+=================================
+
+
+* Menu:
+
+* allow-errors: presentation attributes.
+ (line 9)
+* arg-default: arg-default. (line 6)
+* arg-name: documentation attributes.
+ (line 12)
+* arg-optional: arg-optional. (line 6)
+* arg-range: arg-type number. (line 21)
+* arg-type: Option Arguments. (line 23)
+* argument: program attributes. (line 22)
+* author: information attributes.
+ (line 29)
+* before-guile-boot: main guile. (line 9)
+* call-proc: Option Argument Handling.
+ (line 63)
+* comment-char: main for-each. (line 127)
+* config-header <1>: programming attributes.
+ (line 10)
+* config-header: program attributes. (line 33)
+* copyright: information attributes.
+ (line 10)
+* date: information attributes.
+ (line 13)
+* default: opt-attr default option.
+ (line 6)
+* deprecated: Common Attributes. (line 29)
+* descrip: Required Attributes. (line 36)
+* detail <1>: documentation attributes.
+ (line 164)
+* detail: information attributes.
+ (line 44)
+* die-code: programming attributes.
+ (line 43)
+* disable: Common Attributes. (line 34)
+* disable-load: config attributes. (line 13)
+* disable-save: config attributes. (line 13)
+* doc: documentation attributes.
+ (line 18)
+* doc-section: documentation attributes.
+ (line 37)
+* documentation <1>: opt-attr documentation.
+ (line 17)
+* documentation: lib and program. (line 17)
+* eaddr: information attributes.
+ (line 32)
+* enable: Common Attributes. (line 47)
+* enabled: Common Attributes. (line 51)
+* environrc: config attributes. (line 17)
+* equivalence: opt-attr equivalence.
+ (line 6)
+* exit-desc: programming attributes.
+ (line 16)
+* exit-name: programming attributes.
+ (line 16)
+* explain: information attributes.
+ (line 48)
+* export: programming attributes.
+ (line 54)
+* extra-code: arg-keyword. (line 15)
+* extract-code: Option Argument Handling.
+ (line 52)
+* file-exists: arg-type file name. (line 13)
+* file-mode: arg-type file name. (line 29)
+* flag-code: Option Argument Handling.
+ (line 27)
+* flag-proc: Option Argument Handling.
+ (line 70)
+* full-usage: usage attributes. (line 10)
+* gnu-usage <1>: information attributes.
+ (line 87)
+* gnu-usage: usage attributes. (line 39)
+* guard-option-names: programming attributes.
+ (line 62)
+* guile-main: main guile. (line 15)
+* handler-proc: main for-each. (line 20)
+* handler-type: main for-each. (line 45)
+* help-value: automatic options. (line 18)
+* homerc: config attributes. (line 26)
+* ifdef: Common Attributes. (line 58)
+* ifndef: Common Attributes. (line 58)
+* immed-disable: Immediate Action. (line 31)
+* immediate: Immediate Action. (line 24)
+* include: programming attributes.
+ (line 93)
+* keyword: arg-keyword. (line 6)
+* lib-name: lib and program. (line 27)
+* library: lib and program. (line 7)
+* load-opts-value: automatic options. (line 15)
+* long-opts: presentation attributes.
+ (line 15)
+* main: Generated main. (line 8)
+* main-fini: main for-each. (line 123)
+* main-init: main for-each. (line 119)
+* main-type: Generated main. (line 12)
+* max: Common Attributes. (line 14)
+* min: Common Attributes. (line 20)
+* more-help-value: automatic options. (line 15)
+* must-set: Common Attributes. (line 25)
+* MYHANDLER-code: main for-each. (line 95)
+* name: Required Attributes. (line 9)
+* no-command: Common Attributes. (line 94)
+* no-libopts: programming attributes.
+ (line 97)
+* no-misuse-usage: usage attributes. (line 53)
+* no-preset: opt-attr no-preset. (line 6)
+* no-xlate: presentation attributes.
+ (line 38)
+* omitted-usage: Common Attributes. (line 58)
+* open-file: arg-type file name. (line 23)
+* option-code: main main. (line 7)
+* option-info: documentation attributes.
+ (line 33)
+* opts-ptr: information attributes.
+ (line 66)
+* owner: information attributes.
+ (line 15)
+* package: information attributes.
+ (line 51)
+* prefix: programming attributes.
+ (line 104)
+* prefix-enum: arg-type keyword. (line 38)
+* preserve-case: information attributes.
+ (line 57)
+* prog-desc: information attributes.
+ (line 66)
+* prog-group: usage attributes. (line 61)
+* prog-info-descrip: documentation attributes.
+ (line 160)
+* prog-man-descrip: documentation attributes.
+ (line 160)
+* prog-name: program attributes. (line 15)
+* prog-title: program attributes. (line 19)
+* rcfile: config attributes. (line 58)
+* reorder-args <1>: information attributes.
+ (line 96)
+* reorder-args: presentation attributes.
+ (line 56)
+* reset-value: automatic options. (line 15)
+* resettable: presentation attributes.
+ (line 73)
+* save-opts-value: automatic options. (line 19)
+* scaled: arg-type number. (line 15)
+* settable: opt-attr settable. (line 6)
+* short-usage: usage attributes. (line 34)
+* stack-arg: Option Argument Handling.
+ (line 74)
+* text: information attributes.
+ (line 26)
+* translators: opt-attr translators.
+ (line 6)
+* type: information attributes.
+ (line 17)
+* unstack-arg: Option Argument Handling.
+ (line 87)
+* usage <1>: information attributes.
+ (line 79)
+* usage: usage attributes. (line 69)
+* usage-message: programming attributes.
+ (line 33)
+* usage-opt <1>: usage attributes. (line 47)
+* usage-opt: Features. (line 57)
+* usage-value: automatic options. (line 15)
+* value: Common Attributes. (line 10)
+* vendor-opt: config attributes. (line 63)
+* version: usage attributes. (line 86)
+* version-proc: automatic options. (line 23)
+* version-value: automatic options. (line 15)
+
+
+File: autogen.info, Node: Add-Ons, Next: Future, Prev: AutoOpts, Up: Top
+
+8 Add-on packages for AutoGen
+*****************************
+
+This chapter includes several programs that either work closely with
+AutoGen (extracting definitions or providing special formatting
+functions), or leverage off of AutoGen technology. There is also a
+formatting library that helps make AutoGen possible.
+
+ AutoOpts ought to appear in this list as well, but since it is the
+primary reason why many people would even look into AutoGen at all, I
+decided to leave it in the list of chapters.
+
+* Menu:
+
+* AutoFSM:: Automated Finite State Machine.
+* AutoXDR:: Combined RPC Marshalling.
+* AutoEvents:: Automated Event Management.
+* columns Invocation:: Invoking columns.
+* getdefs Invocation:: Invoking getdefs.
+* xml2ag Invocation:: Invoking xml2ag.
+* snprintfv:: The extensible format printing library.
+
+
+File: autogen.info, Node: AutoFSM, Next: AutoXDR, Up: Add-Ons
+
+8.1 Automated Finite State Machine
+==================================
+
+The templates to generate a finite state machine in C or C++ is included
+with AutoGen. The documentation is not. The documentation is in HTML
+format for viewing (http://www.gnu.org/software/autogen/autofsm.html),
+or you can download FSM (http://download.sourceforge.net/autogen/).
+
+
+File: autogen.info, Node: AutoXDR, Next: AutoEvents, Prev: AutoFSM, Up: Add-Ons
+
+8.2 Combined RPC Marshalling
+============================
+
+The templates and NFSv4 definitions are not included with AutoGen in
+any way. The folks that designed NFSv4 noticed that much time and
+bandwidth was wasted sending queries and responses when many of them
+could be bundled. The protocol bundles the data, but there is no
+support for it in rpcgen. That means you have to write your own code
+to do that. Until now. Download this and you will have a large,
+complex example of how to use `AutoXDR' for generating the marshaling
+and unmarshaling of combined RPC calls. There is a brief example on
+the web (http://www.gnu.org/software/autogen/xdr/index.html), but you
+should download AutoXDR (http://download.sourceforge.net/autogen/).
+
+
+File: autogen.info, Node: AutoEvents, Next: columns Invocation, Prev: AutoXDR, Up: Add-Ons
+
+8.3 Automated Event Management
+==============================
+
+Large software development projects invariably have a need to manage
+the distribution and display of state information and state changes.
+In other words, they need to manage their software events. Generally,
+each such project invents its own way of accomplishing this and then
+struggles to get all of its components to play the same way. It is a
+difficult process and not always completely successful. This project
+helps with that.
+
+ AutoEvents completely separates the tasks of supplying the data
+needed for a particular event from the methods used to manage the
+distribution and display of that event. Consequently, the programmer
+writing the code no longer has to worry about that part of the problem.
+Likewise the persons responsible for designing the event management and
+distribution no longer have to worry about getting programmers to write
+conforming code.
+
+ This is a work in progress. See my web page
+(http://www.gnu.org/software/autogen/autoevents.html) on the subject,
+if you are interested. I have some useful things put together, but it
+is not ready to call a product.
+
+
+File: autogen.info, Node: columns Invocation, Next: getdefs Invocation, Prev: AutoEvents, Up: Add-Ons
+
+8.4 Invoking columns
+====================
+
+This program was designed for the purpose of generating compact,
+columnized tables. It will read a list of text items from standard in
+or a specified input file and produce a columnized listing of all the
+non-blank lines. Leading white space on each line is preserved, but
+trailing white space is stripped. Methods of applying per-entry and
+per-line embellishments are provided. See the formatting and
+separation arguments below.
+
+ This program is used by AutoGen to help clean up and organize its
+output.
+
+ See `autogen/agen5/fsm.tpl' and the generated output `pseudo-fsm.h'.
+
+ This function was not implemented as an expression function because
+either it would have to be many expression functions, or a provision
+would have to be added to provide options to expression functions.
+Maybe not a bad idea, but it is not being implemented at the moment.
+
+ A side benefit is that you can use it outside of `autogen' to
+columnize input, a la the `ls' command.
+
+ This section was generated by *AutoGen*, using the `agtexi-cmd'
+template and the option descriptions for the `columns' program. This
+software is released under the GNU General Public License, version 3 or
+later.
+
+* Menu:
+
+* columns usage:: columns help/usage (`--help')
+* columns dimensions:: dimensions options
+* columns treatment:: treatment options
+* columns ordering:: ordering options
+* columns input-text:: input-text options
+* columns config:: presetting/configuring columns
+* columns exit status:: exit status
+* columns See Also:: See Also
+
+
+File: autogen.info, Node: columns usage, Next: columns dimensions, Up: columns Invocation
+
+8.4.1 columns help/usage (`--help')
+-----------------------------------
+
+This is the automatically generated usage text for columns.
+
+ The text printed is the same whether selected with the `help' option
+(`--help') or the `more-help' option (`--more-help'). `more-help' will
+print the usage text by passing it through a pager program.
+`more-help' is disabled on platforms without a working `fork(2)'
+function. The `PAGER' environment variable is used to select the
+program, defaulting to `more'. Both will exit with a status code of 0.
+
+columns (GNU AutoGen) - Columnize Input Text - Ver. 1.2
+USAGE: columns [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
+
+Specify the output dimensions:
+
+ Flg Arg Option-Name Description
+ -W Num width Maximum Line Width
+ - It must be in the range:
+ 16 to 4095
+ -c Num columns Desired number of columns
+ - It must be in the range:
+ 1 to 2048
+ -w Num col-width Set width of each column
+ - It must be in the range:
+ 1 to 2048
+ Num tab-width tab width
+
+Specify how to lay out the text:
+
+ Flg Arg Option-Name Description
+ Num spread maximum spread added to column width
+ - It must be in the range:
+ 1 to 1024
+ no fill Fill lines with input
+ - prohibits these options:
+ spread
+ col-width
+ by-columns
+ -I Str indent Line prefix or indentation
+ Str first-indent First line prefix
+ - requires these options:
+ indent
+ -f Str format Formatting string for each input
+ -S Str separation Separation string - follows all but last
+ Str line-separation string at end of all lines but last
+ Str ending string at end of last line
+
+Specify the ordering of the entries:
+
+ Flg Arg Option-Name Description
+ no by-columns Print entries in column order
+ -s opt sort Sort input text
+
+Redirecting stdin to an alternate file:
+
+ Flg Arg Option-Name Description
+ -i Str input Input file (if not stdin)
+
+version, usage and configuration options:
+
+ Flg Arg Option-Name Description
+ -v opt version Output version information and exit
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+The following option preset mechanisms are supported:
+ - reading file ./.columnsrc
+ - reading file $HOME/.columnsrc
+ - examining environment variables named COLUMNS_*
+Packaged by Bruce (2012-08-11)
+Report columns bugs to bkorb@gnu.org
+
+
+File: autogen.info, Node: columns dimensions, Next: columns treatment, Prev: columns usage, Up: columns Invocation
+
+8.4.2 dimensions options
+------------------------
+
+Specify the output dimensions.
+
+width option (-W).
+..................
+
+This is the "maximum line width" option. This option takes an argument
+number `num'. This option specifies the full width of the output line,
+including any start-of-line indentation. The output will fill each
+line as completely as possible, unless the column width has been
+explicitly specified. If the maximum width is less than the length of
+the widest input, you will get a single column of output.
+
+columns option (-c).
+....................
+
+This is the "desired number of columns" option. This option takes an
+argument number `count'. Use this option to specify exactly how many
+columns to produce. If that many columns will not fit within
+LINE_WIDTH, then the count will be reduced to the number that fit.
+
+col-width option (-w).
+......................
+
+This is the "set width of each column" option. This option takes an
+argument number `num'. Use this option to specify exactly how many
+characters are to be allocated for each column. If it is narrower than
+the widest entry, it will be over-ridden with the required width.
+
+tab-width option.
+.................
+
+This is the "tab width" option. This option takes an argument number
+`num'. If an indentation string contains tabs, then this value is used
+to compute the ending column of the prefix string.
+
+
+File: autogen.info, Node: columns treatment, Next: columns ordering, Prev: columns dimensions, Up: columns Invocation
+
+8.4.3 treatment options
+-----------------------
+
+Specify how to lay out the text.
+
+spread option.
+..............
+
+This is the "maximum spread added to column width" option. This option
+takes an argument number `num'. Use this option to specify exactly how
+many characters may be added to each column. It allows you to prevent
+columns from becoming too far apart. Without this option, `columns'
+will attempt to widen columns to fill the full width.
+
+fill option.
+............
+
+This is the "fill lines with input" option.
+
+This option has some usage constraints. It:
+ * must not appear in combination with any of the following options:
+ spread, col_width, by_columns.
+
+ Instead of columnizing the input text, fill the output lines with
+the input lines. Blank lines on input will cause a blank line in the
+output, unless the output is sorted. With sorted output, blank lines
+are ignored.
+
+indent option (-I).
+...................
+
+This is the "line prefix or indentation" option. This option takes an
+argument string `l-pfx'. If a number, then this many spaces will be
+inserted at the start of every line. Otherwise, it is a line prefix
+that will be inserted at the start of every line.
+
+first-indent option.
+....................
+
+This is the "first line prefix" option. This option takes an argument
+string `l-pfx'.
+
+This option has some usage constraints. It:
+ * must appear in combination with the following options: indent.
+
+ If a number, then this many spaces will be inserted at the start of
+the first line. Otherwise, it is a line prefix that will be inserted
+at the start of that line. If its length exceeds "indent", then it
+will be emitted on a line by itself, suffixed by any line separation
+string. For example:
+
+ $ columns --first='#define TABLE' -c 2 -I4 --line=' \' <<_EOF_
+ one
+ two
+ three
+ four
+ _EOF_
+ #define TABLE \
+ one two \
+ three four
+
+format option (-f).
+...................
+
+This is the "formatting string for each input" option. This option
+takes an argument string `fmt-str'. If you need to reformat each input
+text, the argument to this option is interpreted as an `sprintf(3)'
+format that is used to produce each output entry.
+
+separation option (-S).
+.......................
+
+This is the "separation string - follows all but last" option. This
+option takes an argument string `sep-str'. Use this option if, for
+example, you wish a comma to appear after each entry except the last.
+
+line-separation option.
+.......................
+
+This is the "string at end of all lines but last" option. This option
+takes an argument string `sep-str'. Use this option if, for example,
+you wish a backslash to appear at the end of every line, except the
+last.
+
+ending option.
+..............
+
+This is the "string at end of last line" option. This option takes an
+argument string `end-str'. This option puts the specified string at
+the end of the output.
+
+
+File: autogen.info, Node: columns ordering, Next: columns input-text, Prev: columns treatment, Up: columns Invocation
+
+8.4.4 ordering options
+----------------------
+
+Specify the ordering of the entries.
+
+by-columns option.
+..................
+
+This is the "print entries in column order" option. Normally, the
+entries are printed out in order by rows and then columns. This option
+will cause the entries to be ordered within columns. The final column,
+instead of the final row, may be shorter than the others.
+
+sort option (-s).
+.................
+
+This is the "sort input text" option. This option takes an optional
+argument string `key-pat'. Causes the input text to be sorted. If an
+argument is supplied, it is presumed to be a pattern and the sort is
+based upon the matched text. If the pattern starts with or consists of
+an asterisk (`*'), then the sort is case insensitive.
+
+
+File: autogen.info, Node: columns input-text, Next: columns config, Prev: columns ordering, Up: columns Invocation
+
+8.4.5 input-text options
+------------------------
+
+Redirecting stdin to an alternate file.
+
+input option (-i).
+..................
+
+This is the "input file (if not stdin)" option. This option takes an
+argument string `file'. This program normally runs as a `filter',
+reading from standard input, columnizing and writing to standard out.
+This option redirects input to a file.
+
+
+File: autogen.info, Node: columns config, Next: columns exit status, Prev: columns input-text, Up: columns Invocation
+
+8.4.6 presetting/configuring columns
+------------------------------------
+
+Any option that is not marked as not presettable may be preset by
+loading values from configuration ("rc" or "ini") files, and values
+from environment variables named `COLUMNS' and `COLUMNS_<OPTION_NAME>'.
+`<OPTION_NAME>' must be one of the options listed above in upper case
+and segmented with underscores. The `COLUMNS' variable will be
+tokenized and parsed like the command line. The remaining variables
+are tested for existence and their values are treated like option
+arguments.
+
+`libopts' will search in 2 places for configuration files:
+ * $PWD
+
+ * $HOME
+ The environment variables `PWD', and `HOME' are expanded and
+replaced when `columns' runs. For any of these that are plain files,
+they are simply processed. For any that are directories, then a file
+named `.columnsrc' is searched for within that directory and processed.
+
+ Configuration files may be in a wide variety of formats. The basic
+format is an option name followed by a value (argument) on the same
+line. Values may be separated from the option name with a colon, equal
+sign or simply white space. Values may be continued across multiple
+lines by escaping the newline with a backslash.
+
+ Multiple programs may also share the same initialization file.
+Common options are collected at the top, followed by program specific
+segments. The segments are separated by lines like:
+ [COLUMNS]
+ or by
+ <?program columns>
+ Do not mix these styles within one configuration file.
+
+ Compound values and carefully constructed string values may also be
+specified using XML syntax:
+ <option-name>
+ <sub-opt>...&lt;...&gt;...</sub-opt>
+ </option-name>
+ yielding an `option-name.sub-opt' string value of
+ "...<...>..."
+ `AutoOpts' does not track suboptions. You simply note that it is a
+hierarchicly valued option. `AutoOpts' does provide a means for
+searching the associated name/value pair list (see: optionFindValue).
+
+ The command line options relating to configuration and/or usage help
+are:
+
+version (-v)
+............
+
+Print the program version to standard out, optionally with licensing
+information, then exit 0. The optional argument specifies how much
+licensing detail to provide. The default is to print just the version.
+The licensing infomation may be selected with an option argument. Only
+the first letter of the argument is examined:
+
+`version'
+ Only print the version. This is the default.
+
+`copyright'
+ Name the copyright usage licensing terms.
+
+`verbose'
+ Print the full copyright usage licensing terms.
+
+
+File: autogen.info, Node: columns exit status, Next: columns See Also, Prev: columns config, Up: columns Invocation
+
+8.4.7 columns exit status
+-------------------------
+
+One of the following exit values will be returned:
+`0 (EXIT_SUCCESS)'
+ Successful program execution.
+
+`1 (EXIT_FAILURE)'
+ The operation failed or the command syntax was not valid.
+
+`66 (EX_NOINPUT)'
+ A specified configuration file could not be loaded.
+
+`70 (EX_SOFTWARE)'
+ libopts had an internal operational error. Please report it to
+ autogen-users@lists.sourceforge.net. Thank you.
+
+
+File: autogen.info, Node: columns See Also, Prev: columns exit status, Up: columns Invocation
+
+8.4.8 columns See Also
+----------------------
+
+This program is documented more fully in the Columns section of the
+Add-On chapter in the `AutoGen' Info system documentation.
+
+
+File: autogen.info, Node: getdefs Invocation, Next: xml2ag Invocation, Prev: columns Invocation, Up: Add-Ons
+
+8.5 Invoking getdefs
+====================
+
+If no `input' argument is provided or is set to simply "-", and if
+`stdin' is not a `tty', then the list of input files will be read from
+`stdin'. This program extracts AutoGen definitions from a list of
+source files. Definitions are delimited by `/*=<entry-type>
+<entry-name>\n' and `=*/\n'. From that, this program creates a
+definition of the following form:
+
+ #line nnn "source-file-name"
+ entry_type = {
+ name = entry_name;
+ ...
+ };
+
+ 1. The ellipsis `...' is filled in by text found between the two
+ delimiters. Each line of text is stripped of anything before the
+ first asterisk, then leading asterisks, then any leading or
+ trailing white space.
+
+ 2. If what is left starts with what looks like a name followed by a
+ colon, then it is interpreted as a name followed by a value.
+
+ 3. If the first character of the value is either a single or double
+ quote, then you are responsible for quoting the text as it gets
+ inserted into the output definitions. So, if you want whitespace
+ at the beginnings of the lines of text, you must do something like
+ this:
+
+ * mumble:
+ * " this is some\n"
+ * " indented text."
+
+ 4. If the `<entry-name>' is followed by a comma, the word `ifdef' (or
+ `ifndef') and a name `if_name', then the above entry will be under
+ `ifdef' control.
+
+ /*=group entry_name, ifdef FOO
+ * attr: attribute value
+ =*/
+
+ Will produce the following:
+
+ #ifdef FOO
+ #line nnn "source-file-name"
+ group = {
+ name = entry_name;
+ attr = 'attribute value';
+ };
+ #endif
+
+ 5. If you use of the `subblock' option, you can specify a nested
+ value, *Note getdefs subblock::. That is, this text:
+
+ * arg: int, this, what-it-is
+
+ with the `--subblock=arg=type,name,doc' option would yield:
+
+ arg = { type = int; name = this; doc = what-it-is; };
+
+ This section was generated by *AutoGen*, using the `agtexi-cmd'
+template and the option descriptions for the `getdefs' program. This
+software is released under the GNU General Public License, version 3 or
+later.
+
+* Menu:
+
+* getdefs usage:: getdefs help/usage (`help')
+* getdefs def-selection:: def-selection options
+* getdefs enumerating:: enumerating options
+* getdefs doc-insert:: doc-insert options
+* getdefs input-files:: input-files options
+* getdefs doc-output:: doc-output options
+* getdefs config:: presetting/configuring getdefs
+* getdefs exit status:: exit status
+* getdefs See Also:: See Also
+
+
+File: autogen.info, Node: getdefs usage, Next: getdefs def-selection, Up: getdefs Invocation
+
+8.5.1 getdefs help/usage (`help')
+---------------------------------
+
+This is the automatically generated usage text for getdefs.
+
+ The text printed is the same whether selected with the `help' option
+(`help') or the `more-help' option (`more-help'). `more-help' will
+print the usage text by passing it through a pager program.
+`more-help' is disabled on platforms without a working `fork(2)'
+function. The `PAGER' environment variable is used to select the
+program, defaulting to `more'. Both will exit with a status code of 0.
+
+getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
+USAGE: getdefs [ <option-name>[{=| }<val>] ]...
+
+Specify which definitions are of interest and what to say about them:
+
+ Arg Option-Name Description
+ Str defs-to-get Regexp to look for after the "/*="
+ Str subblock subblock definition names
+ - may appear multiple times
+ Str listattr attribute with list of values
+ - may appear multiple times
+
+specify how to number the definitions:
+
+ Arg Option-Name Description
+ opt ordering Alphabetize or use named file
+ - disabled as --no-ordering
+ - enabled by default
+ Num first-index The first index to apply to groups
+
+Definition insertion options:
+
+ Arg Option-Name Description
+ opt filelist Insert source file names into defs
+ Str assign Global assignments
+ - may appear multiple times
+ Str common-assign Assignments common to all blocks
+ - may appear multiple times
+ Str copy File(s) to copy into definitions
+ - may appear multiple times
+ opt srcfile Insert source file name into each def
+ opt linenum Insert source line number into each def
+
+specify which files to search for markers:
+
+ Arg Option-Name Description
+ Str input Input file to search for defs
+ - may appear multiple times
+ - default option for unnamed options
+
+Definition output disposition options::
+
+ Arg Option-Name Description
+ Str output Output file to open
+ - an alternate for autogen
+ opt autogen Invoke AutoGen with defs
+ - disabled as --no-autogen
+ - enabled by default
+ Str template Template Name
+ Str agarg AutoGen Argument
+ - prohibits these options:
+ output
+ - may appear multiple times
+ Str base-name Base name for output file(s)
+ - prohibits these options:
+ output
+
+version, usage and configuration options:
+
+ Arg Option-Name Description
+ opt version Output version information and exit
+ no help Display extended usage information and exit
+ no more-help Extended usage information passed thru pager
+ opt save-opts Save the option state to a config file
+ Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+All arguments are named options.
+
+If no ``input'' argument is provided or is set to simply "-", and if
+``stdin'' is not a ``tty'', then the list of input files will be read from
+``stdin''.
+
+The following option preset mechanisms are supported:
+ - reading file /dev/null
+
+This program extracts AutoGen definitions from a list of source files.
+Definitions are delimited by ``/*=<entry-type> <entry-name>\n'' and
+``=*/\n''.
+Packaged by Bruce (2012-08-11)
+Report getdefs bugs to bkorb@gnu.org
+
+
+File: autogen.info, Node: getdefs def-selection, Next: getdefs enumerating, Prev: getdefs usage, Up: getdefs Invocation
+
+8.5.2 def-selection options
+---------------------------
+
+Specify which definitions are of interest and what to say about them.
+
+defs-to-get option.
+...................
+
+This is the "regexp to look for after the "/*="" option. This option
+takes an argument string `reg-ex'. If you want definitions only from a
+particular category, or even with names matching particular patterns,
+then specify this regular expression for the text that must follow the
+`/*='.
+
+subblock option.
+................
+
+This is the "subblock definition names" option. This option takes an
+argument string `sub-def'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ This option is used to create shorthand entries for nested
+definitions. For example, with:
+using subblock thus
+ `--subblock=arg=argname,type,null'
+
+and defining an `arg' thus
+ `arg: this, char *'
+
+will then expand to:
+ `arg = { argname = this; type = "char *"; };'
+ The "this, char *" string is separated at the commas, with the white
+space removed. You may use characters other than commas by starting
+the value string with a punctuation character other than a single or
+double quote character. You may also omit intermediate values by
+placing the commas next to each other with no intervening white space.
+For example, "+mumble++yes+" will expand to:
+`arg = { argname = mumble; null = "yes"; };'.
+
+listattr option.
+................
+
+This is the "attribute with list of values" option. This option takes
+an argument string `def'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ This option is used to create shorthand entries for definitions that
+generally appear several times. That is, they tend to be a list of
+values. For example, with:
+`listattr=foo' defined, the text:
+`foo: this, is, a, multi-list' will then expand to:
+`foo = 'this', 'is', 'a', 'multi-list';'
+The texts are separated by the commas, with the white space removed.
+You may use characters other than commas by starting the value string
+with a punctuation character other than a single or double quote
+character.
+
+
+File: autogen.info, Node: getdefs enumerating, Next: getdefs doc-insert, Prev: getdefs def-selection, Up: getdefs Invocation
+
+8.5.3 enumerating options
+-------------------------
+
+specify how to number the definitions.
+
+ordering option.
+................
+
+This is the "alphabetize or use named file" option. This option takes
+an optional argument string `file-name'.
+
+This option has some usage constraints. It:
+ * is enabled by default.
+
+ By default, ordering is alphabetical by the entry name. Use,
+`no-ordering' if order is unimportant. Use `ordering' with no argument
+to order without case sensitivity. Use `ordering=<file-name>' if
+chronological order is important. getdefs will maintain the text
+content of `file-name'. `file-name' need not exist.
+
+first-index option.
+...................
+
+This is the "the first index to apply to groups" option. This option
+takes an argument number `first-index'. By default, the first
+occurrence of a named definition will have an index of zero.
+Sometimes, that needs to be a reserved value. Provide this option to
+specify a different starting point.
+
+
+File: autogen.info, Node: getdefs doc-insert, Next: getdefs input-files, Prev: getdefs enumerating, Up: getdefs Invocation
+
+8.5.4 doc-insert options
+------------------------
+
+Definition insertion options.
+
+filelist option.
+................
+
+This is the "insert source file names into defs" option. This option
+takes an optional argument string `file'. Inserts the name of each
+input file into the output definitions. If no argument is supplied,
+the format will be:
+ infile = '%s';
+ If an argument is supplied, that string will be used for the entry
+name instead of INFILE.
+
+assign option.
+..............
+
+This is the "global assignments" option. This option takes an argument
+string `ag-def'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ The argument to each copy of this option will be inserted into the
+output definitions, with only a semicolon attached.
+
+common-assign option.
+.....................
+
+This is the "assignments common to all blocks" option. This option
+takes an argument string `ag-def'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ The argument to each copy of this option will be inserted into each
+output definition, with only a semicolon attached.
+
+copy option.
+............
+
+This is the "file(s) to copy into definitions" option. This option
+takes an argument string `file'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ The content of each file named by these options will be inserted into
+the output definitions.
+
+srcfile option.
+...............
+
+This is the "insert source file name into each def" option. This
+option takes an optional argument string `file'. Inserts the name of
+the input file where a definition was found into the output definition.
+If no argument is supplied, the format will be:
+ srcfile = '%s';
+ If an argument is supplied, that string will be used for the entry
+name instead of SRCFILE.
+
+linenum option.
+...............
+
+This is the "insert source line number into each def" option. This
+option takes an optional argument string `def-name'. Inserts the line
+number in the input file where a definition was found into the output
+definition. If no argument is supplied, the format will be:
+ linenum = '%s';
+ If an argument is supplied, that string will be used for the entry
+name instead of LINENUM.
+
+
+File: autogen.info, Node: getdefs input-files, Next: getdefs doc-output, Prev: getdefs doc-insert, Up: getdefs Invocation
+
+8.5.5 input-files options
+-------------------------
+
+specify which files to search for markers.
+
+input option.
+.............
+
+This is the "input file to search for defs" option. This option takes
+an argument string `src-file'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ All files that are to be searched for definitions must be named on
+the command line or read from `stdin'. If there is only one `input'
+option and it is the string, "-", then the input file list is read from
+`stdin'. If a command line argument is not an option name and does not
+contain an assignment operator (`='), then it defaults to being an
+input file name. At least one input file must be specified.
+
+
+File: autogen.info, Node: getdefs doc-output, Next: getdefs config, Prev: getdefs input-files, Up: getdefs Invocation
+
+8.5.6 doc-output options
+------------------------
+
+Definition output disposition options:.
+
+output option.
+..............
+
+This is the "output file to open" option. This option takes an
+argument string `file'.
+
+This option has some usage constraints. It:
+ * is a member of the autogen class of options.
+
+ If you are not sending the output to an AutoGen process, you may
+name an output file instead.
+
+autogen option.
+...............
+
+This is the "invoke autogen with defs" option. This option takes an
+optional argument string `ag-cmd'.
+
+This option has some usage constraints. It:
+ * is enabled by default.
+
+ * is a member of the autogen class of options.
+
+ This is the default output mode. Specifying `no-autogen' is
+equivalent to `output=-'. If you supply an argument to this option,
+that program will be started as if it were AutoGen and its standard in
+will be set to the output definitions of this program.
+
+template option.
+................
+
+This is the "template name" option. This option takes an argument
+string `file'. Specifies the template name to be used for generating
+the final output.
+
+agarg option.
+.............
+
+This is the "autogen argument" option. This option takes an argument
+string `ag-opt'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ * must not appear in combination with any of the following options:
+ output.
+
+ This is a pass-through argument. It allows you to specify any
+arbitrary argument to be passed to AutoGen.
+
+base-name option.
+.................
+
+This is the "base name for output file(s)" option. This option takes
+an argument string `name'.
+
+This option has some usage constraints. It:
+ * must not appear in combination with any of the following options:
+ output.
+
+ When output is going to AutoGen, a base name must either be supplied
+or derived. If this option is not supplied, then it is taken from the
+`template' option. If that is not provided either, then it is set to
+the base name of the current directory.
+
+
+File: autogen.info, Node: getdefs config, Next: getdefs exit status, Prev: getdefs doc-output, Up: getdefs Invocation
+
+8.5.7 presetting/configuring getdefs
+------------------------------------
+
+Any option that is not marked as not presettable may be preset by
+loading values from configuration ("rc" or "ini") files.
+
+`libopts' will search in `/dev/null' for configuration (option) data.
+If this is a plain file, it is simply processed. If it is a directory,
+then a file named `.getdefsrc' is searched for within that directory.
+
+ Configuration files may be in a wide variety of formats. The basic
+format is an option name followed by a value (argument) on the same
+line. Values may be separated from the option name with a colon, equal
+sign or simply white space. Values may be continued across multiple
+lines by escaping the newline with a backslash.
+
+ Multiple programs may also share the same initialization file.
+Common options are collected at the top, followed by program specific
+segments. The segments are separated by lines like:
+ [GETDEFS]
+ or by
+ <?program getdefs>
+ Do not mix these styles within one configuration file.
+
+ Compound values and carefully constructed string values may also be
+specified using XML syntax:
+ <option-name>
+ <sub-opt>...&lt;...&gt;...</sub-opt>
+ </option-name>
+ yielding an `option-name.sub-opt' string value of
+ "...<...>..."
+ `AutoOpts' does not track suboptions. You simply note that it is a
+hierarchicly valued option. `AutoOpts' does provide a means for
+searching the associated name/value pair list (see: optionFindValue).
+
+ The command line options relating to configuration and/or usage help
+are:
+
+version
+.......
+
+Print the program version to standard out, optionally with licensing
+information, then exit 0. The optional argument specifies how much
+licensing detail to provide. The default is to print just the version.
+The licensing infomation may be selected with an option argument. Only
+the first letter of the argument is examined:
+
+`version'
+ Only print the version. This is the default.
+
+`copyright'
+ Name the copyright usage licensing terms.
+
+`verbose'
+ Print the full copyright usage licensing terms.
+
+
+File: autogen.info, Node: getdefs exit status, Next: getdefs See Also, Prev: getdefs config, Up: getdefs Invocation
+
+8.5.8 getdefs exit status
+-------------------------
+
+One of the following exit values will be returned:
+`0 (EXIT_SUCCESS)'
+ Successful program execution.
+
+`1 (EXIT_FAILURE)'
+ The operation failed or the command syntax was not valid.
+
+`66 (EX_NOINPUT)'
+ A specified configuration file could not be loaded.
+
+`70 (EX_SOFTWARE)'
+ libopts had an internal operational error. Please report it to
+ autogen-users@lists.sourceforge.net. Thank you.
+
+
+File: autogen.info, Node: getdefs See Also, Prev: getdefs exit status, Up: getdefs Invocation
+
+8.5.9 getdefs See Also
+----------------------
+
+This program is documented more fully in the Getdefs section of the
+Add-On chapter in the `AutoGen' Info system documentation.
+
+
+File: autogen.info, Node: xml2ag Invocation, Next: snprintfv, Prev: getdefs Invocation, Up: Add-Ons
+
+8.6 Invoking xml2ag
+===================
+
+This program will convert any arbitrary XML file into equivalent
+AutoGen definitions, and invoke AutoGen. The template used will be
+derived from either:
+ * The *-override-tpl* command line option
+
+ * A top level XML attribute named, "`template'"
+ One or the other *must* be provided, or the program will exit with a
+failure message.
+
+ The _base-name_ for the output will similarly be either:
+ * The *-base-name* command line option.
+
+ * The base name of the `.xml' file.
+
+ The definitions derived from XML generally have an extra layer of
+definition. Specifically, this XML input:
+ <mumble attr="foo">
+ mumble-1
+ <grumble>
+ grumble, grumble, grumble.
+ </grumble>mumble, mumble
+ </mumble>
+ Will get converted into this:
+ mumble = {
+ grumble = {
+ text = 'grumble, grumble, grumble';
+ };
+ text = 'mumble-1';
+ text = 'mumble, mumble';
+ };
+ Please notice that some information is lost. AutoGen cannot tell
+that "grumble" used to lie between the mumble texts. Also please note
+that you cannot assign:
+ grumble = 'grumble, grumble, grumble.';
+ because if another "grumble" has an attribute or multiple texts, it
+becomes impossible to have the definitions be the same type (compound
+or text values).
+
+ This section was generated by *AutoGen*, using the `agtexi-cmd'
+template and the option descriptions for the `xml2ag' program. This
+software is released under the GNU General Public License, version 3 or
+later.
+
+* Menu:
+
+* xml2ag usage:: xml2ag help/usage (`--help')
+* xml2ag the-xml2ag-option:: the-xml2ag-option options
+* xml2ag autogen-options:: autogen-options options
+* xml2ag exit status:: exit status
+
+
+File: autogen.info, Node: xml2ag usage, Next: xml2ag the-xml2ag-option, Up: xml2ag Invocation
+
+8.6.1 xml2ag help/usage (`--help')
+----------------------------------
+
+This is the automatically generated usage text for xml2ag.
+
+ The text printed is the same whether selected with the `help' option
+(`--help') or the `more-help' option (`--more-help'). `more-help' will
+print the usage text by passing it through a pager program.
+`more-help' is disabled on platforms without a working `fork(2)'
+function. The `PAGER' environment variable is used to select the
+program, defaulting to `more'. Both will exit with a status code of 0.
+
+xml2ag (GNU AutoGen) - XML to AutoGen Definiton Converter - Ver. 5.16.2
+USAGE: xml2ag [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ <def-file> ]
+
+All other options are derived from autogen:
+
+ Flg Arg Option-Name Description
+ -O Str output Output file in lieu of AutoGen processing
+
+All other options:
+
+ Flg Arg Option-Name Description
+ -L Str templ-dirs Template search directory list
+ - may appear multiple times
+ -T Str override-tpl Override template file
+ -l Str lib-template Library template file
+ - may appear multiple times
+ Str definitions Definitions input file
+ -S Str load-scheme Scheme code file to load
+ -F Str load-functions Load scheme function library
+ Str shell name or path name of shell to use
+ -m no no-fmemopen Do not use in-mem streams
+ Str equate characters considered equivalent
+ -b Str base-name Base name for output file(s)
+ no source-time set mod times to latest source
+ no writable Allow output files to be writable
+ - disabled as --not-writable
+ Num loop-limit Limit on increment loops
+ - is scalable with a suffix: k/K/m/M/g/G/t/T
+ - It must lie in one of the ranges:
+ -1 exactly, or
+ 1 to 16777216
+ -t Num timeout Time limit for server shell
+ - It must be in the range:
+ 0 to 3600
+ KWd trace tracing level of detail
+ Str trace-out tracing output file or filter
+ no show-defs Show the definition tree
+ no used-defines Show the definitions used
+ -C no core Leave a core dump on a failure exit
+ -s Str skip-suffix Omit the file with this suffix
+ - prohibits these options:
+ select-suffix
+ - may appear multiple times
+ -o Str select-suffix specify this output suffix
+ - may appear multiple times
+ -D Str define name to add to definition list
+ - may appear multiple times
+ -U Str undefine definition list removal pattern
+ - an alternate for define
+ -M opt make-dep emit make dependency file
+ - may appear multiple times
+
+version, usage and configuration options:
+
+ Flg Arg Option-Name Description
+ -v opt version Output version information and exit
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+This program will convert any arbitrary XML file into equivalent AutoGen
+definitions, and invoke AutoGen.
+
+The valid "trace" option keywords are:
+ nothing debug-message server-shell templates block-macros
+ expressions everything
+ or an integer from 0 through 6
+
+The template will be derived from either: * the ``--override-tpl'' command
+line option * a top level XML attribute named, "template"
+
+The ``base-name'' for the output will similarly be either: * the
+``--base-name'' command line option * the base name of the .xml file
+Packaged by Bruce (2012-08-11)
+Report xml2ag bugs to bkorb@gnu.org
+
+
+File: autogen.info, Node: xml2ag the-xml2ag-option, Next: xml2ag autogen-options, Prev: xml2ag usage, Up: xml2ag Invocation
+
+8.6.2 the-xml2ag-option options
+-------------------------------
+
+All other options are derived from autogen.
+
+output option (-O).
+...................
+
+This is the "output file in lieu of autogen processing" option. This
+option takes an argument string `file'. By default, the output is
+handed to an AutoGen for processing. However, you may save the
+definitions to a file instead.
+
+
+File: autogen.info, Node: xml2ag autogen-options, Next: xml2ag exit status, Prev: xml2ag the-xml2ag-option, Up: xml2ag Invocation
+
+8.6.3 autogen-options options
+-----------------------------
+
+All other options. These options are mostly just passed throug to
+`autogen'. The one exception is `--override-tpl' which replaces the
+default template in the output definitions. It does not get passed
+through on the command line.
+
+templ-dirs option (-L).
+.......................
+
+This is the "template search directory list" option. This option takes
+an argument string `dir'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ Pass-through AutoGen argument
+
+override-tpl option (-T).
+.........................
+
+This is the "override template file" option. This option takes an
+argument string `tpl-file'. Pass-through AutoGen argument
+
+lib-template option (-l).
+.........................
+
+This is the "library template file" option. This option takes an
+argument string `tpl-file'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ Pass-through AutoGen argument
+
+definitions option.
+...................
+
+This is the "definitions input file" option. This option takes an
+argument string `file'. Pass-through AutoGen argument
+
+load-scheme option (-S).
+........................
+
+This is the "scheme code file to load" option. This option takes an
+argument string `file'. Pass-through AutoGen argument
+
+load-functions option (-F).
+...........................
+
+This is the "load scheme function library" option. This option takes
+an argument string `file'.
+
+This option has some usage constraints. It:
+ * must be compiled in by defining `HAVE_DLOPEN' during the
+ compilation.
+
+ Pass-through AutoGen argument
+
+shell option.
+.............
+
+This is the "name or path name of shell to use" option. This option
+takes an argument string `shell'. Pass-through AutoGen argument
+
+no-fmemopen option (-m).
+........................
+
+This is the "do not use in-mem streams" option. Pass-through AutoGen
+argument
+
+equate option.
+..............
+
+This is the "characters considered equivalent" option. This option
+takes an argument string `char-list'. Pass-through AutoGen argument
+
+base-name option (-b).
+......................
+
+This is the "base name for output file(s)" option. This option takes
+an argument string `name'. Pass-through AutoGen argument
+
+source-time option.
+...................
+
+This is the "set mod times to latest source" option. Pass-through
+AutoGen argument
+
+writable option.
+................
+
+This is the "allow output files to be writable" option. Pass-through
+AutoGen argument
+
+loop-limit option.
+..................
+
+This is the "limit on increment loops" option. This option takes an
+argument number `lim'. Pass-through AutoGen argument
+
+timeout option (-t).
+....................
+
+This is the "time limit for server shell" option. This option takes an
+argument number `time-lim'. Pass-through AutoGen argument
+
+trace option.
+.............
+
+This is the "tracing level of detail" option. This option takes an
+argument keyword `level'.
+
+This option has some usage constraints. It:
+ * This option takes a keyword as its argument. The argument sets an
+ enumeration value that can be tested by comparing the option value
+ macro (OPT_VALUE_TRACE). The available keywords are:
+ nothing debug-message server-shell
+ templates block-macros expressions
+ everything
+
+ or their numeric equivalent.
+
+ Pass-through AutoGen argument
+
+trace-out option.
+.................
+
+This is the "tracing output file or filter" option. This option takes
+an argument string `file'. Pass-through AutoGen argument
+
+show-defs option.
+.................
+
+This is the "show the definition tree" option. Pass-through AutoGen
+argument
+
+used-defines option.
+....................
+
+This is the "show the definitions used" option. Pass-through AutoGen
+argument
+
+core option (-C).
+.................
+
+This is the "leave a core dump on a failure exit" option.
+
+This option has some usage constraints. It:
+ * must be compiled in by defining `HAVE_SYS_RESOURCE_H' during the
+ compilation.
+
+ Many systems default to a zero sized core limit. If the system has
+the sys/resource.h header and if this option is supplied, then in the
+failure exit path, autogen will attempt to set the soft core limit to
+whatever the hard core limit is. If that does not work, then an
+administrator must raise the hard core size limit.
+
+skip-suffix option (-s).
+........................
+
+This is the "omit the file with this suffix" option. This option takes
+an argument string `suffix'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ * must not appear in combination with any of the following options:
+ select-suffix.
+
+ Pass-through AutoGen argument
+
+select-suffix option (-o).
+..........................
+
+This is the "specify this output suffix" option. This option takes an
+argument string `suffix'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ Pass-through AutoGen argument
+
+define option (-D).
+...................
+
+This is the "name to add to definition list" option. This option takes
+an argument string `value'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ Pass-through AutoGen argument
+
+undefine option (-U).
+.....................
+
+This is the "definition list removal pattern" option. This option
+takes an argument string `name-pat'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ Pass-through AutoGen argument
+
+make-dep option (-M).
+.....................
+
+This is the "emit make dependency file" option. This option takes an
+optional argument string `type'.
+
+This option has some usage constraints. It:
+ * may appear an unlimited number of times.
+
+ Pass-through AutoGen argument
+
+
+File: autogen.info, Node: xml2ag exit status, Prev: xml2ag autogen-options, Up: xml2ag Invocation
+
+8.6.4 xml2ag exit status
+------------------------
+
+One of the following exit values will be returned:
+`0 (EXIT_SUCCESS)'
+ Successful program execution.
+
+`1 (EXIT_OPTION_ERROR)'
+ The command options were misconfigured.
+
+`2 (EXIT_BAD_TEMPLATE)'
+ An error was encountered processing the template.
+
+`3 (EXIT_BAD_DEFINITIONS)'
+ The definitions could not be deciphered.
+
+`4 (EXIT_LOAD_ERROR)'
+ An error was encountered during the load phase.
+
+`5 (EXIT_SIGNAL)'
+ Program exited due to catching a signal. If your template includes
+ string formatting, a number argument to a "%s" formatting element
+ will trigger a segmentation fault. Autogen will catch the seg
+ fault signal and exit with `AUTOGEN_EXIT_SIGNAL(5)'.
+ Alternatively, AutoGen may have been interrupted with a `kill(2)'
+ signal.
+
+
+File: autogen.info, Node: snprintfv, Prev: xml2ag Invocation, Up: Add-Ons
+
+8.7 Replacement for Stdio Formatting Library
+============================================
+
+Using the `printf' formatting routines in a portable fashion has always
+been a pain, and this package has been way more pain than anyone ever
+imagined. Hopefully, with this release of snprintfv, the pain is now
+over for all time.
+
+ The issues with portable usage are these:
+
+ 1. Argument number specifiers are often either not implemented or are
+ buggy. Even GNU libc, version 1 got it wrong.
+
+ 2. ANSI/ISO "forgot" to provide a mechanism for computing argument
+ lists for vararg procedures.
+
+ 3. The argument array version of printf (`printfv()') is not
+ generally available, does not work with the native printf, and
+ does not have a working argument number specifier in the format
+ specification. (Last I knew, anyway.)
+
+ 4. You cannot fake varargs by calling `vprintf()' with an array of
+ arguments, because ANSI does not require such an implementation
+ and some vendors play funny tricks because they are allowed to.
+
+ These four issues made it impossible for AutoGen to ship without its
+own implementation of the `printf' formatting routines. Since we were
+forced to do this, we decided to make the formatting routines both
+better and more complete :-). We addressed these issues and added the
+following features to the common printf API:
+
+ 5. The formatted output can be written to
+
+ * a string allocated by the formatting function (`asprintf()').
+
+ * a file descriptor instead of a file stream (`dprintf()').
+
+ * a user specified stream (`stream_printf()').
+
+ 6. The formatting functions can be augmented with your own functions.
+ These functions are allowed to consume more than one character
+ from the format, but must commence with a unique character. For
+ example,
+
+ "%{struct stat}\n"
+
+ might be used with '{' registered to a procedure that would look
+ up "struct stat" in a symbol table and do appropriate things,
+ consuming the format string through the '}' character.
+
+ Gary V. Vaughan was generous enough to supply this implementation.
+Many thanks!!
+
+ For further details, the reader is referred to the snprintfv
+documentation. These functions are also available in the template
+processing as `sprintf' (*note SCM sprintf::), `printf' (*note SCM
+printf::), `fprintf' (*note SCM fprintf::), and `shellf' (*note SCM
+shellf::).
+
+
+File: autogen.info, Node: Future, Next: Copying This Manual, Prev: Add-Ons, Up: Top
+
+9 Some ideas for the future.
+****************************
+
+Here are some things that might happen in the distant future.
+
+ * Fix up current tools that contain miserably complex perl, shell,
+ sed, awk and m4 scripts to instead use this tool.
+
+
+File: autogen.info, Node: Copying This Manual, Next: Concept Index, Prev: Future, Up: Top
+
+Appendix A Copying This Manual
+******************************
+
+You may copy this manual under the terms of the FDL (the GNU Free
+Documentation License (http://gnu.org/licenses/fdl.texi)).
+
+ Version 1.2, November 2002
+
+ Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ 0. PREAMBLE
+
+ The purpose of this License is to make a manual, textbook, or other
+ functional and useful document "free" in the sense of freedom: to
+ assure everyone the effective freedom to copy and redistribute it,
+ with or without modifying it, either commercially or
+ noncommercially. Secondarily, this License preserves for the
+ author and publisher a way to get credit for their work, while not
+ being considered responsible for modifications made by others.
+
+ This License is a kind of "copyleft", which means that derivative
+ works of the document must themselves be free in the same sense.
+ It complements the GNU General Public License, which is a copyleft
+ license designed for free software.
+
+ We have designed this License in order to use it for manuals for
+ free software, because free software needs free documentation: a
+ free program should come with manuals providing the same freedoms
+ that the software does. But this License is not limited to
+ software manuals; it can be used for any textual work, regardless
+ of subject matter or whether it is published as a printed book.
+ We recommend this License principally for works whose purpose is
+ instruction or reference.
+
+ 1. APPLICABILITY AND DEFINITIONS
+
+ This License applies to any manual or other work, in any medium,
+ that contains a notice placed by the copyright holder saying it
+ can be distributed under the terms of this License. Such a notice
+ grants a world-wide, royalty-free license, unlimited in duration,
+ to use that work under the conditions stated herein. The
+ "Document", below, refers to any such manual or work. Any member
+ of the public is a licensee, and is addressed as "you". You
+ accept the license if you copy, modify or distribute the work in a
+ way requiring permission under copyright law.
+
+ A "Modified Version" of the Document means any work containing the
+ Document or a portion of it, either copied verbatim, or with
+ modifications and/or translated into another language.
+
+ A "Secondary Section" is a named appendix or a front-matter section
+ of the Document that deals exclusively with the relationship of the
+ publishers or authors of the Document to the Document's overall
+ subject (or to related matters) and contains nothing that could
+ fall directly within that overall subject. (Thus, if the Document
+ is in part a textbook of mathematics, a Secondary Section may not
+ explain any mathematics.) The relationship could be a matter of
+ historical connection with the subject or with related matters, or
+ of legal, commercial, philosophical, ethical or political position
+ regarding them.
+
+ The "Invariant Sections" are certain Secondary Sections whose
+ titles are designated, as being those of Invariant Sections, in
+ the notice that says that the Document is released under this
+ License. If a section does not fit the above definition of
+ Secondary then it is not allowed to be designated as Invariant.
+ The Document may contain zero Invariant Sections. If the Document
+ does not identify any Invariant Sections then there are none.
+
+ The "Cover Texts" are certain short passages of text that are
+ listed, as Front-Cover Texts or Back-Cover Texts, in the notice
+ that says that the Document is released under this License. A
+ Front-Cover Text may be at most 5 words, and a Back-Cover Text may
+ be at most 25 words.
+
+ A "Transparent" copy of the Document means a machine-readable copy,
+ represented in a format whose specification is available to the
+ general public, that is suitable for revising the document
+ straightforwardly with generic text editors or (for images
+ composed of pixels) generic paint programs or (for drawings) some
+ widely available drawing editor, and that is suitable for input to
+ text formatters or for automatic translation to a variety of
+ formats suitable for input to text formatters. A copy made in an
+ otherwise Transparent file format whose markup, or absence of
+ markup, has been arranged to thwart or discourage subsequent
+ modification by readers is not Transparent. An image format is
+ not Transparent if used for any substantial amount of text. A
+ copy that is not "Transparent" is called "Opaque".
+
+ Examples of suitable formats for Transparent copies include plain
+ ASCII without markup, Texinfo input format, LaTeX input format,
+ SGML or XML using a publicly available DTD, and
+ standard-conforming simple HTML, PostScript or PDF designed for
+ human modification. Examples of transparent image formats include
+ PNG, XCF and JPG. Opaque formats include proprietary formats that
+ can be read and edited only by proprietary word processors, SGML or
+ XML for which the DTD and/or processing tools are not generally
+ available, and the machine-generated HTML, PostScript or PDF
+ produced by some word processors for output purposes only.
+
+ The "Title Page" means, for a printed book, the title page itself,
+ plus such following pages as are needed to hold, legibly, the
+ material this License requires to appear in the title page. For
+ works in formats which do not have any title page as such, "Title
+ Page" means the text near the most prominent appearance of the
+ work's title, preceding the beginning of the body of the text.
+
+ A section "Entitled XYZ" means a named subunit of the Document
+ whose title either is precisely XYZ or contains XYZ in parentheses
+ following text that translates XYZ in another language. (Here XYZ
+ stands for a specific section name mentioned below, such as
+ "Acknowledgements", "Dedications", "Endorsements", or "History".)
+ To "Preserve the Title" of such a section when you modify the
+ Document means that it remains a section "Entitled XYZ" according
+ to this definition.
+
+ The Document may include Warranty Disclaimers next to the notice
+ which states that this License applies to the Document. These
+ Warranty Disclaimers are considered to be included by reference in
+ this License, but only as regards disclaiming warranties: any other
+ implication that these Warranty Disclaimers may have is void and
+ has no effect on the meaning of this License.
+
+ 2. VERBATIM COPYING
+
+ You may copy and distribute the Document in any medium, either
+ commercially or noncommercially, provided that this License, the
+ copyright notices, and the license notice saying this License
+ applies to the Document are reproduced in all copies, and that you
+ add no other conditions whatsoever to those of this License. You
+ may not use technical measures to obstruct or control the reading
+ or further copying of the copies you make or distribute. However,
+ you may accept compensation in exchange for copies. If you
+ distribute a large enough number of copies you must also follow
+ the conditions in section 3.
+
+ You may also lend copies, under the same conditions stated above,
+ and you may publicly display copies.
+
+ 3. COPYING IN QUANTITY
+
+ If you publish printed copies (or copies in media that commonly
+ have printed covers) of the Document, numbering more than 100, and
+ the Document's license notice requires Cover Texts, you must
+ enclose the copies in covers that carry, clearly and legibly, all
+ these Cover Texts: Front-Cover Texts on the front cover, and
+ Back-Cover Texts on the back cover. Both covers must also clearly
+ and legibly identify you as the publisher of these copies. The
+ front cover must present the full title with all words of the
+ title equally prominent and visible. You may add other material
+ on the covers in addition. Copying with changes limited to the
+ covers, as long as they preserve the title of the Document and
+ satisfy these conditions, can be treated as verbatim copying in
+ other respects.
+
+ If the required texts for either cover are too voluminous to fit
+ legibly, you should put the first ones listed (as many as fit
+ reasonably) on the actual cover, and continue the rest onto
+ adjacent pages.
+
+ If you publish or distribute Opaque copies of the Document
+ numbering more than 100, you must either include a
+ machine-readable Transparent copy along with each Opaque copy, or
+ state in or with each Opaque copy a computer-network location from
+ which the general network-using public has access to download
+ using public-standard network protocols a complete Transparent
+ copy of the Document, free of added material. If you use the
+ latter option, you must take reasonably prudent steps, when you
+ begin distribution of Opaque copies in quantity, to ensure that
+ this Transparent copy will remain thus accessible at the stated
+ location until at least one year after the last time you
+ distribute an Opaque copy (directly or through your agents or
+ retailers) of that edition to the public.
+
+ It is requested, but not required, that you contact the authors of
+ the Document well before redistributing any large number of
+ copies, to give them a chance to provide you with an updated
+ version of the Document.
+
+ 4. MODIFICATIONS
+
+ You may copy and distribute a Modified Version of the Document
+ under the conditions of sections 2 and 3 above, provided that you
+ release the Modified Version under precisely this License, with
+ the Modified Version filling the role of the Document, thus
+ licensing distribution and modification of the Modified Version to
+ whoever possesses a copy of it. In addition, you must do these
+ things in the Modified Version:
+
+ A. Use in the Title Page (and on the covers, if any) a title
+ distinct from that of the Document, and from those of
+ previous versions (which should, if there were any, be listed
+ in the History section of the Document). You may use the
+ same title as a previous version if the original publisher of
+ that version gives permission.
+
+ B. List on the Title Page, as authors, one or more persons or
+ entities responsible for authorship of the modifications in
+ the Modified Version, together with at least five of the
+ principal authors of the Document (all of its principal
+ authors, if it has fewer than five), unless they release you
+ from this requirement.
+
+ C. State on the Title page the name of the publisher of the
+ Modified Version, as the publisher.
+
+ D. Preserve all the copyright notices of the Document.
+
+ E. Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.
+
+ F. Include, immediately after the copyright notices, a license
+ notice giving the public permission to use the Modified
+ Version under the terms of this License, in the form shown in
+ the Addendum below.
+
+ G. Preserve in that license notice the full lists of Invariant
+ Sections and required Cover Texts given in the Document's
+ license notice.
+
+ H. Include an unaltered copy of this License.
+
+ I. Preserve the section Entitled "History", Preserve its Title,
+ and add to it an item stating at least the title, year, new
+ authors, and publisher of the Modified Version as given on
+ the Title Page. If there is no section Entitled "History" in
+ the Document, create one stating the title, year, authors,
+ and publisher of the Document as given on its Title Page,
+ then add an item describing the Modified Version as stated in
+ the previous sentence.
+
+ J. Preserve the network location, if any, given in the Document
+ for public access to a Transparent copy of the Document, and
+ likewise the network locations given in the Document for
+ previous versions it was based on. These may be placed in
+ the "History" section. You may omit a network location for a
+ work that was published at least four years before the
+ Document itself, or if the original publisher of the version
+ it refers to gives permission.
+
+ K. For any section Entitled "Acknowledgements" or "Dedications",
+ Preserve the Title of the section, and preserve in the
+ section all the substance and tone of each of the contributor
+ acknowledgements and/or dedications given therein.
+
+ L. Preserve all the Invariant Sections of the Document,
+ unaltered in their text and in their titles. Section numbers
+ or the equivalent are not considered part of the section
+ titles.
+
+ M. Delete any section Entitled "Endorsements". Such a section
+ may not be included in the Modified Version.
+
+ N. Do not retitle any existing section to be Entitled
+ "Endorsements" or to conflict in title with any Invariant
+ Section.
+
+ O. Preserve any Warranty Disclaimers.
+
+ If the Modified Version includes new front-matter sections or
+ appendices that qualify as Secondary Sections and contain no
+ material copied from the Document, you may at your option
+ designate some or all of these sections as invariant. To do this,
+ add their titles to the list of Invariant Sections in the Modified
+ Version's license notice. These titles must be distinct from any
+ other section titles.
+
+ You may add a section Entitled "Endorsements", provided it contains
+ nothing but endorsements of your Modified Version by various
+ parties--for example, statements of peer review or that the text
+ has been approved by an organization as the authoritative
+ definition of a standard.
+
+ You may add a passage of up to five words as a Front-Cover Text,
+ and a passage of up to 25 words as a Back-Cover Text, to the end
+ of the list of Cover Texts in the Modified Version. Only one
+ passage of Front-Cover Text and one of Back-Cover Text may be
+ added by (or through arrangements made by) any one entity. If the
+ Document already includes a cover text for the same cover,
+ previously added by you or by arrangement made by the same entity
+ you are acting on behalf of, you may not add another; but you may
+ replace the old one, on explicit permission from the previous
+ publisher that added the old one.
+
+ The author(s) and publisher(s) of the Document do not by this
+ License give permission to use their names for publicity for or to
+ assert or imply endorsement of any Modified Version.
+
+ 5. COMBINING DOCUMENTS
+
+ You may combine the Document with other documents released under
+ this License, under the terms defined in section 4 above for
+ modified versions, provided that you include in the combination
+ all of the Invariant Sections of all of the original documents,
+ unmodified, and list them all as Invariant Sections of your
+ combined work in its license notice, and that you preserve all
+ their Warranty Disclaimers.
+
+ The combined work need only contain one copy of this License, and
+ multiple identical Invariant Sections may be replaced with a single
+ copy. If there are multiple Invariant Sections with the same name
+ but different contents, make the title of each such section unique
+ by adding at the end of it, in parentheses, the name of the
+ original author or publisher of that section if known, or else a
+ unique number. Make the same adjustment to the section titles in
+ the list of Invariant Sections in the license notice of the
+ combined work.
+
+ In the combination, you must combine any sections Entitled
+ "History" in the various original documents, forming one section
+ Entitled "History"; likewise combine any sections Entitled
+ "Acknowledgements", and any sections Entitled "Dedications". You
+ must delete all sections Entitled "Endorsements."
+
+ 6. COLLECTIONS OF DOCUMENTS
+
+ You may make a collection consisting of the Document and other
+ documents released under this License, and replace the individual
+ copies of this License in the various documents with a single copy
+ that is included in the collection, provided that you follow the
+ rules of this License for verbatim copying of each of the
+ documents in all other respects.
+
+ You may extract a single document from such a collection, and
+ distribute it individually under this License, provided you insert
+ a copy of this License into the extracted document, and follow
+ this License in all other respects regarding verbatim copying of
+ that document.
+
+ 7. AGGREGATION WITH INDEPENDENT WORKS
+
+ A compilation of the Document or its derivatives with other
+ separate and independent documents or works, in or on a volume of
+ a storage or distribution medium, is called an "aggregate" if the
+ copyright resulting from the compilation is not used to limit the
+ legal rights of the compilation's users beyond what the individual
+ works permit. When the Document is included in an aggregate, this
+ License does not apply to the other works in the aggregate which
+ are not themselves derivative works of the Document.
+
+ If the Cover Text requirement of section 3 is applicable to these
+ copies of the Document, then if the Document is less than one half
+ of the entire aggregate, the Document's Cover Texts may be placed
+ on covers that bracket the Document within the aggregate, or the
+ electronic equivalent of covers if the Document is in electronic
+ form. Otherwise they must appear on printed covers that bracket
+ the whole aggregate.
+
+ 8. TRANSLATION
+
+ Translation is considered a kind of modification, so you may
+ distribute translations of the Document under the terms of section
+ 4. Replacing Invariant Sections with translations requires special
+ permission from their copyright holders, but you may include
+ translations of some or all Invariant Sections in addition to the
+ original versions of these Invariant Sections. You may include a
+ translation of this License, and all the license notices in the
+ Document, and any Warranty Disclaimers, provided that you also
+ include the original English version of this License and the
+ original versions of those notices and disclaimers. In case of a
+ disagreement between the translation and the original version of
+ this License or a notice or disclaimer, the original version will
+ prevail.
+
+ If a section in the Document is Entitled "Acknowledgements",
+ "Dedications", or "History", the requirement (section 4) to
+ Preserve its Title (section 1) will typically require changing the
+ actual title.
+
+ 9. TERMINATION
+
+ You may not copy, modify, sublicense, or distribute the Document
+ except as expressly provided for under this License. Any other
+ attempt to copy, modify, sublicense or distribute the Document is
+ void, and will automatically terminate your rights under this
+ License. However, parties who have received copies, or rights,
+ from you under this License will not have their licenses
+ terminated so long as such parties remain in full compliance.
+
+ 10. FUTURE REVISIONS OF THIS LICENSE
+
+ The Free Software Foundation may publish new, revised versions of
+ the GNU Free Documentation License from time to time. Such new
+ versions will be similar in spirit to the present version, but may
+ differ in detail to address new problems or concerns. See
+ `http://www.gnu.org/copyleft/'.
+
+ Each version of the License is given a distinguishing version
+ number. If the Document specifies that a particular numbered
+ version of this License "or any later version" applies to it, you
+ have the option of following the terms and conditions either of
+ that specified version or of any later version that has been
+ published (not as a draft) by the Free Software Foundation. If
+ the Document does not specify a version number of this License,
+ you may choose any version ever published (not as a draft) by the
+ Free Software Foundation.
+
+ADDENDUM: How to use this License for your documents
+====================================================
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and license
+notices just after the title page:
+
+ copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.2
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+
+ If you have Invariant Sections, Front-Cover Texts and Back-Cover
+Texts, replace the "with...Texts." line with this:
+
+ with the Invariant Sections being LIST THEIR TITLES, with
+ the Front-Cover Texts being LIST, and with the Back-Cover Texts
+ being LIST.
+
+ If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+ If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License, to
+permit their use in free software.
+
+
+File: autogen.info, Node: Concept Index, Next: Function Index, Prev: Copying This Manual, Up: Top
+
+Concept Index
+*************
+
+
+* Menu:
+
+* #assert: Directives. (line 31)
+* #define: Directives. (line 45)
+* #elif: Directives. (line 53)
+* #else: Directives. (line 57)
+* #endif: Directives. (line 62)
+* #endmac: Directives. (line 66)
+* #endshell: Directives. (line 70)
+* #error: Directives. (line 74)
+* #if: Directives. (line 78)
+* #ifdef: Directives. (line 82)
+* #ifndef: Directives. (line 88)
+* #include: Directives. (line 93)
+* #line: Directives. (line 99)
+* #macdef: Directives. (line 106)
+* #option: Directives. (line 111)
+* #shell: Directives. (line 126)
+* #undef: Directives. (line 132)
+* .: naming values. (line 24)
+* .def file: Definitions File. (line 6)
+* .tpl file: Template File. (line 6)
+* Alternate Definition: Alternate Definition.
+ (line 6)
+* assert directive: Directives. (line 31)
+* Augmenting AutoGen: Augmenting AutoGen. (line 6)
+* AutoEvents: AutoEvents. (line 6)
+* AutoFSM: AutoFSM. (line 6)
+* autogen: autogen Invocation. (line 6)
+* AutoGen Definition Extraction Tool: getdefs Invocation. (line 6)
+* autogen help: autogen usage. (line 6)
+* autogen-base-name: autogen out-handling.
+ (line 11)
+* autogen-core: autogen debug-tpl. (line 139)
+* autogen-define: autogen processing. (line 49)
+* autogen-definitions: autogen input-select.
+ (line 53)
+* autogen-equate: autogen input-select.
+ (line 129)
+* autogen-lib-template: autogen input-select.
+ (line 40)
+* autogen-load-functions: autogen input-select.
+ (line 82)
+* autogen-load-scheme: autogen input-select.
+ (line 71)
+* autogen-loop-limit: autogen debug-tpl. (line 13)
+* autogen-make-dep: autogen dep-track. (line 11)
+* autogen-no-fmemopen: autogen input-select.
+ (line 112)
+* autogen-override-tpl: autogen input-select.
+ (line 26)
+* autogen-select-suffix: autogen processing. (line 33)
+* autogen-shell: autogen input-select.
+ (line 96)
+* autogen-show-defs: autogen debug-tpl. (line 106)
+* autogen-skip-suffix: autogen processing. (line 13)
+* autogen-source-time: autogen out-handling.
+ (line 33)
+* autogen-templ-dirs: autogen input-select.
+ (line 12)
+* autogen-timeout: autogen debug-tpl. (line 23)
+* autogen-trace: autogen debug-tpl. (line 40)
+* autogen-trace-out: autogen debug-tpl. (line 95)
+* autogen-undefine: autogen processing. (line 83)
+* autogen-used-defines: autogen debug-tpl. (line 121)
+* autogen-writable: autogen out-handling.
+ (line 43)
+* AutoInfo: AutoInfo. (line 6)
+* AutoMan pages: AutoMan pages. (line 6)
+* automatic options: automatic options. (line 6)
+* autoopts <1>: Caveats. (line 26)
+* autoopts: AutoOpts. (line 6)
+* AutoOpts API: AutoOpts API. (line 6)
+* autoopts directives: config directives. (line 6)
+* AutoXDR: AutoXDR. (line 6)
+* backtrack: naming values. (line 25)
+* Columnize Input Text: columns Invocation. (line 6)
+* columns: columns Invocation. (line 6)
+* columns help: columns usage. (line 6)
+* columns-by-columns: columns ordering. (line 11)
+* columns-col-width: columns dimensions. (line 29)
+* columns-columns: columns dimensions. (line 21)
+* columns-ending: columns treatment. (line 90)
+* columns-fill: columns treatment. (line 20)
+* columns-first-indent: columns treatment. (line 42)
+* columns-format: columns treatment. (line 67)
+* columns-indent: columns treatment. (line 34)
+* columns-input: columns input-text. (line 11)
+* columns-line-separation: columns treatment. (line 82)
+* columns-separation: columns treatment. (line 75)
+* columns-sort: columns ordering. (line 19)
+* columns-spread: columns treatment. (line 11)
+* columns-tab-width: columns dimensions. (line 37)
+* columns-width: columns dimensions. (line 11)
+* comments: Comments. (line 6)
+* Common Option Attributes: Common Attributes. (line 6)
+* compound definitions: Definitions. (line 44)
+* concat-string: concat-string. (line 6)
+* conditional emit <1>: WHILE. (line 6)
+* conditional emit: IF. (line 6)
+* configuration file: shell options. (line 6)
+* Configuration File <1>: Config File Format. (line 6)
+* Configuration File: config example. (line 6)
+* configuration file <1>: Option Processing Data.
+ (line 42)
+* configuration file <2>: automatic options. (line 57)
+* configuration file: opt-attr no-preset. (line 6)
+* Configuration File example: config example. (line 6)
+* configuring: configuring. (line 6)
+* define directive: Directives. (line 45)
+* define macro: DEFINE. (line 6)
+* Definition Index: Index Assignments. (line 6)
+* definitions: Definitions. (line 6)
+* definitions file: Definitions File. (line 6)
+* design goals: Generalities. (line 11)
+* directives: Directives. (line 6)
+* diversion: output controls. (line 6)
+* documentation attributes: documentation attributes.
+ (line 6)
+* Dynamic Definition Text: Dynamic Text. (line 6)
+* elif directive: Directives. (line 53)
+* else directive: Directives. (line 57)
+* endif directive: Directives. (line 62)
+* endmac directive: Directives. (line 66)
+* endshell directive: Directives. (line 70)
+* environrc: environrc. (line 6)
+* error directive: Directives. (line 74)
+* example, simple AutoGen: Example Usage. (line 6)
+* example, simple AutoOpts: Quick Start. (line 6)
+* expression syntax: expression syntax. (line 6)
+* FDL, GNU Free Documentation License: Copying This Manual. (line 9)
+* features: Features. (line 6)
+* finite state machine: AutoFSM. (line 6)
+* flags-cant: Option Conflict Attributes.
+ (line 19)
+* flags-must: Option Conflict Attributes.
+ (line 15)
+* fOptState: Option Processing Data.
+ (line 30)
+* for loop: FOR. (line 6)
+* futures: Future. (line 6)
+* getdefs: getdefs Invocation. (line 6)
+* getdefs help: getdefs usage. (line 6)
+* getdefs-agarg: getdefs doc-output. (line 46)
+* getdefs-assign: getdefs doc-insert. (line 22)
+* getdefs-autogen: getdefs doc-output. (line 23)
+* getdefs-base-name: getdefs doc-output. (line 61)
+* getdefs-common-assign: getdefs doc-insert. (line 34)
+* getdefs-copy: getdefs doc-insert. (line 46)
+* getdefs-defs-to-get: getdefs def-selection.
+ (line 11)
+* getdefs-filelist: getdefs doc-insert. (line 11)
+* getdefs-first-index: getdefs enumerating. (line 26)
+* getdefs-input: getdefs input-files. (line 11)
+* getdefs-linenum: getdefs doc-insert. (line 69)
+* getdefs-listattr: getdefs def-selection.
+ (line 47)
+* getdefs-ordering: getdefs enumerating. (line 11)
+* getdefs-output: getdefs doc-output. (line 11)
+* getdefs-srcfile: getdefs doc-insert. (line 58)
+* getdefs-subblock: getdefs def-selection.
+ (line 20)
+* getdefs-template: getdefs doc-output. (line 39)
+* getopt_long: getopt_long. (line 6)
+* gnu: Caveats. (line 21)
+* here-string: here-string. (line 6)
+* identification: Identification. (line 6)
+* if directive: Directives. (line 78)
+* if test: IF. (line 6)
+* ifdef directive: Directives. (line 82)
+* ifndef directive: Directives. (line 88)
+* immediate action: Immediate Action. (line 6)
+* include directive: Directives. (line 93)
+* information attributes: information attributes.
+ (line 6)
+* Installing: installing. (line 6)
+* Internationalizing AutoOpts: i18n. (line 6)
+* Internationalizing Options: Internationalizing Options.
+ (line 6)
+* Introduction: Introduction. (line 6)
+* library attributes: library attributes. (line 6)
+* Licensing: Licensing. (line 6)
+* line directive: Directives. (line 99)
+* looping, for: FOR. (line 6)
+* m4: Testimonial. (line 42)
+* macdef directive: Directives. (line 106)
+* macro syntax: AGMacro syntax. (line 6)
+* macro, pseudo: Template File. (line 10)
+* main procedure: Generated main. (line 6)
+* misuse-usage: Caveats. (line 34)
+* named option mode: presentation attributes.
+ (line 15)
+* Naming Conflicts: Naming Conflicts. (line 6)
+* naming values: naming values. (line 6)
+* native macros: native macros. (line 6)
+* no-misuse-usage: Caveats. (line 30)
+* optActualIndex: Option Processing Data.
+ (line 17)
+* optActualValue: Option Processing Data.
+ (line 18)
+* optIndex: Option Processing Data.
+ (line 11)
+* Option Argument Handling: Option Argument Handling.
+ (line 6)
+* Option Arguments: Option Arguments. (line 6)
+* option attributes: option attributes. (line 6)
+* Option Conflict Attributes: Option Conflict Attributes.
+ (line 6)
+* Option Definitions: Option Definitions. (line 6)
+* option descriptor: option descriptor. (line 6)
+* option directive: Directives. (line 111)
+* Option Processing Data: Option Processing Data.
+ (line 6)
+* optOccCt: Option Processing Data.
+ (line 24)
+* optValue: Option Processing Data.
+ (line 12)
+* predefines: Predefines. (line 6)
+* program attributes: program attributes. (line 6)
+* pseudo macro <1>: pseudo macro. (line 6)
+* pseudo macro: Template File. (line 10)
+* pzLastArg: Option Processing Data.
+ (line 83)
+* pzProgName: Option Processing Data.
+ (line 90)
+* pzProgPath: Option Processing Data.
+ (line 94)
+* rcfile <1>: config example. (line 6)
+* rcfile: loading rcfile. (line 6)
+* Redirecting Output: output controls. (line 6)
+* remote procedure call: AutoXDR. (line 6)
+* Required Attributes: Required Attributes. (line 6)
+* RPC: AutoXDR. (line 6)
+* rpcgen: AutoXDR. (line 6)
+* sample rcfile: sample rcfile. (line 6)
+* shell directive: Directives. (line 126)
+* shell options <1>: shell options. (line 6)
+* shell options: Presetting Options. (line 6)
+* shell-generated string: shell-generated. (line 6)
+* Signal Names: signal names. (line 6)
+* simple definitions: Definitions. (line 44)
+* standard options: standard options. (line 6)
+* string, double quote: double-quote-string. (line 6)
+* string, shell output: shell-generated. (line 6)
+* string, single quote: single-quote-string. (line 6)
+* template file <1>: Template File. (line 6)
+* template file: Identification. (line 21)
+* The Automated Program Generator: autogen Invocation. (line 6)
+* undef directive: Directives. (line 132)
+* using AutoOpts: Using AutoOpts. (line 6)
+* while test: WHILE. (line 6)
+* XDR: AutoXDR. (line 6)
+* XML to AutoGen Definiton Converter: xml2ag Invocation. (line 6)
+* xml2ag: xml2ag Invocation. (line 6)
+* xml2ag help: xml2ag usage. (line 6)
+* xml2ag-base-name: xml2ag autogen-options.
+ (line 84)
+* xml2ag-core: xml2ag autogen-options.
+ (line 150)
+* xml2ag-define: xml2ag autogen-options.
+ (line 190)
+* xml2ag-definitions: xml2ag autogen-options.
+ (line 42)
+* xml2ag-equate: xml2ag autogen-options.
+ (line 78)
+* xml2ag-lib-template: xml2ag autogen-options.
+ (line 31)
+* xml2ag-load-functions: xml2ag autogen-options.
+ (line 54)
+* xml2ag-load-scheme: xml2ag autogen-options.
+ (line 48)
+* xml2ag-loop-limit: xml2ag autogen-options.
+ (line 102)
+* xml2ag-make-dep: xml2ag autogen-options.
+ (line 212)
+* xml2ag-no-fmemopen: xml2ag autogen-options.
+ (line 72)
+* xml2ag-output: xml2ag the-xml2ag-option.
+ (line 11)
+* xml2ag-override-tpl: xml2ag autogen-options.
+ (line 25)
+* xml2ag-select-suffix: xml2ag autogen-options.
+ (line 179)
+* xml2ag-shell: xml2ag autogen-options.
+ (line 66)
+* xml2ag-show-defs: xml2ag autogen-options.
+ (line 138)
+* xml2ag-skip-suffix: xml2ag autogen-options.
+ (line 165)
+* xml2ag-source-time: xml2ag autogen-options.
+ (line 90)
+* xml2ag-templ-dirs: xml2ag autogen-options.
+ (line 14)
+* xml2ag-timeout: xml2ag autogen-options.
+ (line 108)
+* xml2ag-trace: xml2ag autogen-options.
+ (line 114)
+* xml2ag-trace-out: xml2ag autogen-options.
+ (line 132)
+* xml2ag-undefine: xml2ag autogen-options.
+ (line 201)
+* xml2ag-used-defines: xml2ag autogen-options.
+ (line 144)
+* xml2ag-writable: xml2ag autogen-options.
+ (line 96)
+
+
+File: autogen.info, Node: Function Index, Prev: Concept Index, Up: Top
+
+Function Index
+**************
+
+
+* Menu:
+
+* *=: SCM *=. (line 6)
+* *=*: SCM *=*. (line 6)
+* *==: SCM *==. (line 6)
+* *==*: SCM *==*. (line 6)
+* *~: SCM *~. (line 6)
+* *~*: SCM *~*. (line 6)
+* *~~: SCM *~~. (line 6)
+* *~~*: SCM *~~*. (line 6)
+* =: SCM =. (line 6)
+* =*: SCM =*. (line 6)
+* ==: SCM ==. (line 6)
+* ==*: SCM ==*. (line 6)
+* ag-fprintf: SCM ag-fprintf. (line 6)
+* ag-function?: SCM ag-function?. (line 6)
+* agpl: SCM agpl. (line 6)
+* ao_string_tokenize: libopts-ao_string_tokenize.
+ (line 6)
+* autogen-version: SCM autogen-version. (line 6)
+* base-name: SCM base-name. (line 6)
+* BREAK: BREAK. (line 6)
+* bsd: SCM bsd. (line 6)
+* c-file-line-fmt: SCM c-file-line-fmt. (line 6)
+* c-string: SCM c-string. (line 6)
+* CASE: CASE. (line 6)
+* chdir: SCM chdir. (line 6)
+* CLEAR_OPT: CLEAR_OPT. (line 6)
+* COMMENT: COMMENT. (line 6)
+* configFileLoad: libopts-configFileLoad.
+ (line 6)
+* CONTINUE: CONTINUE. (line 6)
+* count: SCM count. (line 6)
+* COUNT_OPT: COUNT_OPT. (line 6)
+* DEBUG: DEBUG. (line 6)
+* def-file: SCM def-file. (line 6)
+* def-file-line: SCM def-file-line. (line 6)
+* DEFINE: DEFINE. (line 6)
+* DESC: DESC. (line 6)
+* DISABLE_OPT_name: DISABLE_OPT_name. (line 6)
+* dne: SCM dne. (line 6)
+* ELIF: ELIF. (line 6)
+* ELSE: ELSE. (line 6)
+* emit: SCM emit. (line 6)
+* emit-string-table: SCM emit-string-table. (line 6)
+* ENABLED_OPT: ENABLED_OPT. (line 6)
+* ENDDEF: ENDDEF. (line 6)
+* ENDFOR: ENDFOR. (line 6)
+* ENDIF: ENDIF. (line 6)
+* ENDWHILE: ENDWHILE. (line 6)
+* error: SCM error. (line 6)
+* error-source-line: SCM error-source-line. (line 6)
+* ERRSKIP_OPTERR: ERRSKIP_OPTERR. (line 6)
+* ERRSTOP_OPTERR: ERRSTOP_OPTERR. (line 6)
+* ESAC: ESAC. (line 6)
+* exist?: SCM exist?. (line 6)
+* EXPR: EXPR. (line 6)
+* extract: SCM extract. (line 6)
+* find-file: SCM find-file. (line 6)
+* first-for?: SCM first-for?. (line 6)
+* FOR: FOR. (line 6)
+* for-by: SCM for-by. (line 6)
+* for-from: SCM for-from. (line 6)
+* for-index: SCM for-index. (line 6)
+* for-sep: SCM for-sep. (line 6)
+* for-to: SCM for-to. (line 6)
+* format-arg-count: SCM format-arg-count. (line 6)
+* fprintf: SCM fprintf. (line 6)
+* get: SCM get. (line 6)
+* get-c-name: SCM get-c-name. (line 6)
+* get-down-name: SCM get-down-name. (line 6)
+* get-up-name: SCM get-up-name. (line 6)
+* gperf: SCM gperf. (line 6)
+* gperf-code: SCM gperf-code. (line 6)
+* gpl: SCM gpl. (line 6)
+* HAVE_OPT: HAVE_OPT. (line 6)
+* hide-email: SCM hide-email. (line 6)
+* high-lim: SCM high-lim. (line 6)
+* html-escape-encode: SCM html-escape-encode.
+ (line 6)
+* IF: IF. (line 6)
+* in?: SCM in?. (line 6)
+* INCLUDE: INCLUDE. (line 6)
+* INVOKE: INVOKE. (line 6)
+* ISSEL_OPT: ISSEL_OPT. (line 6)
+* ISUNUSED_OPT: ISUNUSED_OPT. (line 6)
+* join: SCM join. (line 6)
+* kr-string: SCM kr-string. (line 6)
+* last-for?: SCM last-for?. (line 6)
+* len: SCM len. (line 6)
+* lgpl: SCM lgpl. (line 6)
+* license: SCM license. (line 6)
+* license-description: SCM license-description.
+ (line 6)
+* license-full: SCM license-full. (line 6)
+* license-info: SCM license-info. (line 6)
+* license-name: SCM license-name. (line 6)
+* low-lim: SCM low-lim. (line 6)
+* make-gperf: SCM make-gperf. (line 6)
+* make-header-guard: SCM make-header-guard. (line 6)
+* make-tmp-dir: SCM make-tmp-dir. (line 6)
+* makefile-script: SCM makefile-script. (line 6)
+* match-value?: SCM match-value?. (line 6)
+* max: SCM max. (line 6)
+* min: SCM min. (line 6)
+* OPT_ARG: OPT_ARG. (line 6)
+* OPT_NO_XLAT_CFG_NAMES: OPT_NO_XLAT_CFG_NAMES. (line 6)
+* OPT_NO_XLAT_OPT_NAMES: OPT_NO_XLAT_OPT_NAMES. (line 6)
+* OPT_VALUE_name: OPT_VALUE_name. (line 6)
+* OPT_XLAT_CFG_NAMES: OPT_XLAT_CFG_NAMES. (line 6)
+* OPT_XLAT_OPT_NAMES: OPT_XLAT_OPT_NAMES. (line 6)
+* OPTION_CT: OPTION_CT. (line 6)
+* optionFileLoad: libopts-optionFileLoad.
+ (line 6)
+* optionFindNextValue: libopts-optionFindNextValue.
+ (line 6)
+* optionFindValue: libopts-optionFindValue.
+ (line 6)
+* optionFree: libopts-optionFree. (line 6)
+* optionGetValue: libopts-optionGetValue.
+ (line 6)
+* optionLoadLine: libopts-optionLoadLine.
+ (line 6)
+* optionNextValue: libopts-optionNextValue.
+ (line 6)
+* optionOnlyUsage: libopts-optionOnlyUsage.
+ (line 6)
+* optionProcess: libopts-optionProcess. (line 6)
+* optionRestore: libopts-optionRestore. (line 6)
+* optionSaveFile: libopts-optionSaveFile.
+ (line 6)
+* optionSaveState: libopts-optionSaveState.
+ (line 6)
+* optionUnloadNested: libopts-optionUnloadNested.
+ (line 6)
+* optionVersion: libopts-optionVersion. (line 6)
+* out-delete: SCM out-delete. (line 6)
+* out-depth: SCM out-depth. (line 6)
+* out-emit-suspended: SCM out-emit-suspended.
+ (line 6)
+* out-line: SCM out-line. (line 6)
+* out-move: SCM out-move. (line 6)
+* out-name: SCM out-name. (line 6)
+* out-pop: SCM out-pop. (line 6)
+* out-push-add: SCM out-push-add. (line 6)
+* out-push-new: SCM out-push-new. (line 6)
+* out-resume: SCM out-resume. (line 6)
+* out-suspend: SCM out-suspend. (line 6)
+* out-switch: SCM out-switch. (line 6)
+* output-file-next-line: SCM output-file-next-line.
+ (line 6)
+* pathfind: libopts-pathfind. (line 6)
+* prefix: SCM prefix. (line 6)
+* printf: SCM printf. (line 6)
+* raw-shell-str: SCM raw-shell-str. (line 6)
+* RESTART_OPT: RESTART_OPT. (line 6)
+* RETURN: RETURN. (line 6)
+* SELECT: SELECT. (line 6)
+* set-option: SCM set-option. (line 6)
+* set-writable: SCM set-writable. (line 6)
+* SET_OPT_name: SET_OPT_name. (line 6)
+* shell: SCM shell. (line 6)
+* shell-str: SCM shell-str. (line 6)
+* shellf: SCM shellf. (line 6)
+* sprintf: SCM sprintf. (line 6)
+* stack: SCM stack. (line 6)
+* stack-join: SCM stack-join. (line 6)
+* STACKCT_OPT: STACKCT_OPT. (line 6)
+* STACKLST_OPT: STACKLST_OPT. (line 6)
+* START_OPT: START_OPT. (line 6)
+* STATE_OPT: STATE_OPT. (line 6)
+* strequate: libopts-strequate. (line 6)
+* streqvcmp: libopts-streqvcmp. (line 6)
+* streqvmap: libopts-streqvmap. (line 6)
+* string->c-name!: SCM string->c-name!. (line 6)
+* string->camelcase: SCM string->camelcase. (line 6)
+* string-capitalize: SCM string-capitalize. (line 6)
+* string-capitalize!: SCM string-capitalize!.
+ (line 6)
+* string-contains-eqv?: SCM *=*. (line 6)
+* string-contains?: SCM *==*. (line 6)
+* string-downcase: SCM string-downcase. (line 6)
+* string-downcase!: SCM string-downcase!. (line 6)
+* string-end-eqv-match?: SCM *~. (line 6)
+* string-end-match?: SCM *~~. (line 6)
+* string-ends-eqv?: SCM *=. (line 6)
+* string-ends-with?: SCM *==. (line 6)
+* string-equals?: SCM ==. (line 6)
+* string-eqv-match?: SCM ~. (line 6)
+* string-eqv?: SCM =. (line 6)
+* string-has-eqv-match?: SCM *~*. (line 6)
+* string-has-match?: SCM *~~*. (line 6)
+* string-match?: SCM ~~. (line 6)
+* string-start-eqv-match?: SCM ~*. (line 6)
+* string-start-match?: SCM ~~*. (line 6)
+* string-starts-eqv?: SCM =*. (line 6)
+* string-starts-with?: SCM ==*. (line 6)
+* string-substitute: SCM string-substitute. (line 6)
+* string-table-add: SCM string-table-add. (line 6)
+* string-table-add-ref: SCM string-table-add-ref.
+ (line 6)
+* string-table-new: SCM string-table-new. (line 6)
+* string-table-size: SCM string-table-size. (line 6)
+* string-tr: SCM string-tr. (line 6)
+* string-tr!: SCM string-tr!. (line 6)
+* string-upcase: SCM string-upcase. (line 6)
+* string-upcase!: SCM string-upcase!. (line 6)
+* strneqvcmp: libopts-strneqvcmp. (line 6)
+* strtransform: libopts-strtransform. (line 6)
+* sub-shell-str: SCM sub-shell-str. (line 6)
+* suffix: SCM suffix. (line 6)
+* sum: SCM sum. (line 6)
+* teOptIndex: teOptIndex. (line 6)
+* time-string->number: SCM time-string->number.
+ (line 6)
+* tpl-file: SCM tpl-file. (line 6)
+* tpl-file-line: SCM tpl-file-line. (line 6)
+* tpl-file-next-line: SCM tpl-file-next-line.
+ (line 6)
+* UNKNOWN: UNKNOWN. (line 6)
+* USAGE: USAGE. (line 6)
+* VALUE_OPT_name: VALUE_OPT_name. (line 6)
+* VERSION: VERSION. (line 6)
+* version-compare: SCM version-compare. (line 6)
+* WHICH_IDX_name: WHICH_IDX_name. (line 6)
+* WHICH_OPT_name: WHICH_OPT_name. (line 6)
+* WHILE: WHILE. (line 6)
+* ~: SCM ~. (line 6)
+* ~*: SCM ~*. (line 6)
+* ~~: SCM ~~. (line 6)
+* ~~*: SCM ~~*. (line 6)
+
+
diff --git a/doc/autogen.texi b/doc/autogen.texi
new file mode 100644
index 0000000..e6f2a83
--- /dev/null
+++ b/doc/autogen.texi
@@ -0,0 +1,7 @@
+\input texinfo
+@ignore
+\internalpagesizes{46\baselineskip}{6in}{-.25in}{-.25in}{\bindingoffset}{36pt}%
+@end ignore
+@c %**start of header
+@setfilename autogen.info
+@include agdoc.texi
diff --git a/doc/fdl.texi b/doc/fdl.texi
new file mode 100644
index 0000000..cf81822
--- /dev/null
+++ b/doc/fdl.texi
@@ -0,0 +1,452 @@
+
+@node GNU Free Documentation License
+@appendixsec GNU Free Documentation License
+
+@cindex FDL, GNU Free Documentation License
+@center Version 1.2, November 2002
+
+@display
+Copyright @copyright{} 2000,2001,2002 Free Software Foundation, Inc.
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+@end display
+
+@enumerate 0
+@item
+PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document @dfn{free} in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of ``copyleft'', which means that derivative
+works of the document must themselves be free in the same sense. It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does. But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book. We recommend this License
+principally for works whose purpose is instruction or reference.
+
+@item
+APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License. Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein. The ``Document'', below,
+refers to any such manual or work. Any member of the public is a
+licensee, and is addressed as ``you''. You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A ``Modified Version'' of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A ``Secondary Section'' is a named appendix or a front-matter section
+of the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject. (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.) The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The ``Invariant Sections'' are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License. If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant. The Document may contain zero
+Invariant Sections. If the Document does not identify any Invariant
+Sections then there are none.
+
+The ``Cover Texts'' are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License. A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A ``Transparent'' copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters. A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text. A copy that is not ``Transparent'' is called ``Opaque''.
+
+Examples of suitable formats for Transparent copies include plain
+@sc{ascii} without markup, Texinfo input format, La@TeX{} input
+format, @acronym{SGML} or @acronym{XML} using a publicly available
+@acronym{DTD}, and standard-conforming simple @acronym{HTML},
+PostScript or @acronym{PDF} designed for human modification. Examples
+of transparent image formats include @acronym{PNG}, @acronym{XCF} and
+@acronym{JPG}. Opaque formats include proprietary formats that can be
+read and edited only by proprietary word processors, @acronym{SGML} or
+@acronym{XML} for which the @acronym{DTD} and/or processing tools are
+not generally available, and the machine-generated @acronym{HTML},
+PostScript or @acronym{PDF} produced by some word processors for
+output purposes only.
+
+The ``Title Page'' means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page. For works in
+formats which do not have any title page as such, ``Title Page'' means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+A section ``Entitled XYZ'' means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language. (Here XYZ stands for a
+specific section name mentioned below, such as ``Acknowledgements'',
+``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
+of such a section when you modify the Document means that it remains a
+section ``Entitled XYZ'' according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document. These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
+@item
+VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License. You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute. However, you may accept
+compensation in exchange for copies. If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
+@item
+COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover. Both covers must also clearly and legibly identify
+you as the publisher of these copies. The front cover must present
+the full title with all words of the title equally prominent and
+visible. You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
+@item
+MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it. In addition, you must do these things in the Modified Version:
+
+@enumerate A
+@item
+Use in the Title Page (and on the covers, if any) a title distinct
+from that of the Document, and from those of previous versions
+(which should, if there were any, be listed in the History section
+of the Document). You may use the same title as a previous version
+if the original publisher of that version gives permission.
+
+@item
+List on the Title Page, as authors, one or more persons or entities
+responsible for authorship of the modifications in the Modified
+Version, together with at least five of the principal authors of the
+Document (all of its principal authors, if it has fewer than five),
+unless they release you from this requirement.
+
+@item
+State on the Title page the name of the publisher of the
+Modified Version, as the publisher.
+
+@item
+Preserve all the copyright notices of the Document.
+
+@item
+Add an appropriate copyright notice for your modifications
+adjacent to the other copyright notices.
+
+@item
+Include, immediately after the copyright notices, a license notice
+giving the public permission to use the Modified Version under the
+terms of this License, in the form shown in the Addendum below.
+
+@item
+Preserve in that license notice the full lists of Invariant Sections
+and required Cover Texts given in the Document's license notice.
+
+@item
+Include an unaltered copy of this License.
+
+@item
+Preserve the section Entitled ``History'', Preserve its Title, and add
+to it an item stating at least the title, year, new authors, and
+publisher of the Modified Version as given on the Title Page. If
+there is no section Entitled ``History'' in the Document, create one
+stating the title, year, authors, and publisher of the Document as
+given on its Title Page, then add an item describing the Modified
+Version as stated in the previous sentence.
+
+@item
+Preserve the network location, if any, given in the Document for
+public access to a Transparent copy of the Document, and likewise
+the network locations given in the Document for previous versions
+it was based on. These may be placed in the ``History'' section.
+You may omit a network location for a work that was published at
+least four years before the Document itself, or if the original
+publisher of the version it refers to gives permission.
+
+@item
+For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
+the Title of the section, and preserve in the section all the
+substance and tone of each of the contributor acknowledgements and/or
+dedications given therein.
+
+@item
+Preserve all the Invariant Sections of the Document,
+unaltered in their text and in their titles. Section numbers
+or the equivalent are not considered part of the section titles.
+
+@item
+Delete any section Entitled ``Endorsements''. Such a section
+may not be included in the Modified Version.
+
+@item
+Do not retitle any existing section to be Entitled ``Endorsements'' or
+to conflict in title with any Invariant Section.
+
+@item
+Preserve any Warranty Disclaimers.
+@end enumerate
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant. To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section Entitled ``Endorsements'', provided it contains
+nothing but endorsements of your Modified Version by various
+parties---for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version. Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity. If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
+@item
+COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy. If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled ``History''
+in the various original documents, forming one section Entitled
+``History''; likewise combine any sections Entitled ``Acknowledgements'',
+and any sections Entitled ``Dedications''. You must delete all
+sections Entitled ``Endorsements.''
+
+@item
+COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+
+@item
+AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an ``aggregate'' if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
+@item
+TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections. You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers. In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled ``Acknowledgements'',
+``Dedications'', or ``History'', the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
+@item
+TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document except
+as expressly provided for under this License. Any other attempt to
+copy, modify, sublicense or distribute the Document is void, and will
+automatically terminate your rights under this License. However,
+parties who have received copies, or rights, from you under this
+License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+@item
+FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns. See
+@uref{http://www.gnu.org/copyleft/}.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License ``or any later version'' applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation. If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation.
+@end enumerate
+
+@page
+@heading ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
+@smallexample
+@group
+ copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ Permission is granted to copy, distribute and/or modify this document
+ under the terms of the GNU Free Documentation License, Version 1.2
+ or any later version published by the Free Software Foundation;
+ with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+ Texts. A copy of the license is included in the section entitled ``GNU
+ Free Documentation License''.
+@end group
+@end smallexample
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the ``with...Texts.'' line with this:
+
+@smallexample
+@group
+ with the Invariant Sections being @var{list their titles}, with
+ the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
+ being @var{list}.
+@end group
+@end smallexample
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
+
+@c Local Variables:
+@c ispell-local-pdict: "ispell-dict"
+@c End:
+
diff --git a/doc/gendocs_template b/doc/gendocs_template
new file mode 100644
index 0000000..f3a3ff6
--- /dev/null
+++ b/doc/gendocs_template
@@ -0,0 +1,89 @@
+<!--#include virtual="/server/header.html" -->
+<title>%%TITLE%% - GNU Project - Free Software Foundation (FSF)</title>
+<!--#include virtual="/server/banner.html" -->
+<h2>%%TITLE%%</h2>
+
+<address>Free Software Foundation</address>
+<address>last updated %%DATE%%</address>
+
+<p>This manual (%%PACKAGE%%) is available in the following formats:</p>
+
+<ul>
+<li><a href="%%PACKAGE%%.html">HTML
+ (%%HTML_MONO_SIZE%%K bytes)</a> - entirely on one web page.</li>
+<li><a href="html_node/index.html">HTML</a> - with one web page per
+ node.</li>
+%%IF HTML_SECTION%%
+<li><a href="html_section/index.html">HTML</a> - with one web page per
+ section.</li>
+%%ENDIF HTML_SECTION%%
+%%IF HTML_CHAPTER%%
+<li><a href="html_chapter/index.html">HTML</a> - with one web page per
+ chapter.</li>
+%%ENDIF HTML_CHAPTER%%
+<li><a href="%%PACKAGE%%.html.gz">HTML compressed
+ (%%HTML_MONO_GZ_SIZE%%K gzipped characters)</a> - entirely on
+ one web page.</li>
+<li><a href="%%PACKAGE%%.html_node.tar.gz">HTML compressed
+ (%%HTML_NODE_TGZ_SIZE%%K gzipped tar file)</a> -
+ with one web page per node.</li>
+%%IF HTML_SECTION%%
+<li><a href="%%PACKAGE%%.html_section.tar.gz">HTML compressed
+ (%%HTML_SECTION_TGZ_SIZE%%K gzipped tar file)</a> -
+ with one web page per section.</li>
+%%ENDIF HTML_SECTION%%
+%%IF HTML_CHAPTER%%
+<li><a href="%%PACKAGE%%.html_chapter.tar.gz">HTML compressed
+ (%%HTML_CHAPTER_TGZ_SIZE%%K gzipped tar file)</a> -
+ with one web page per chapter.</li>
+%%ENDIF HTML_CHAPTER%%
+<li><a href="%%PACKAGE%%.info.tar.gz">Info document
+ (%%INFO_TGZ_SIZE%%K bytes gzipped tar file)</a>.</li>
+<li><a href="%%PACKAGE%%.txt">ASCII text
+ (%%ASCII_SIZE%%K bytes)</a>.</li>
+<li><a href="%%PACKAGE%%.txt.gz">ASCII text compressed
+ (%%ASCII_GZ_SIZE%%K bytes gzipped)</a>.</li>
+<li><a href="%%PACKAGE%%.dvi.gz">TeX dvi file
+ (%%DVI_GZ_SIZE%%K bytes gzipped)</a>.</li>
+<li><a href="%%PACKAGE%%.ps.gz">PostScript file
+ (%%PS_GZ_SIZE%%K bytes gzipped)</a>.</li>
+<li><a href="%%PACKAGE%%.pdf">PDF file
+ (%%PDF_SIZE%%K bytes)</a>.</li>
+<li><a href="%%PACKAGE%%.texi.tar.gz">Texinfo source
+ (%%TEXI_TGZ_SIZE%%K bytes gzipped tar file).</a></li>
+</ul>
+
+<p>You can <a href="http://shop.fsf.org/">buy printed copies of
+some manuals</a> (among other items) from the Free Software Foundation;
+this helps support FSF activities.</p>
+
+<p>(This page generated by the <a href="%%SCRIPTURL%%">%%SCRIPTNAME%%
+script</a>.)</p>
+
+<!-- If needed, change the copyright block at the bottom. In general,
+ all pages on the GNU web server should have the section about
+ verbatim copying. Please do NOT remove this without talking
+ with the webmasters first.
+ Please make sure the copyright date is consistent with the document
+ and that it is like this: "2001, 2002", not this: "2001-2002". -->
+</div><!-- for id="content", starts in the include above -->
+<!--#include virtual="/server/footer.html" -->
+<div id="footer">
+
+<p>Please send general FSF &amp; GNU inquiries to
+<a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
+There are also <a href="/contact/">other ways to contact</a>
+the FSF.<br />
+Please send broken links and other corrections or suggestions to
+<a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.</p>
+
+<p>Copyright &copy; 2012 Free Software Foundation, Inc.</p>
+
+<p>Verbatim copying and distribution of this entire article are
+permitted worldwide, without royalty, in any medium, provided this
+notice, and the copyright notice, are preserved.</p>
+
+</div>
+</div>
+</body>
+</html>
diff --git a/doc/invoke-autogen.texi b/doc/invoke-autogen.texi
new file mode 100644
index 0000000..31c65f9
--- /dev/null
+++ b/doc/invoke-autogen.texi
@@ -0,0 +1,872 @@
+@node autogen Invocation
+@chapter Invoking autogen
+@pindex autogen
+@cindex The Automated Program Generator
+@ignore
+# -*- buffer-read-only: t -*- vi: set ro:
+#
+# DO NOT EDIT THIS FILE (invoke-autogen.texi)
+#
+# It has been AutoGen-ed August 11, 2012 at 09:41:40 AM by AutoGen 5.16.2pre7
+# From the definitions /old-home/bkorb/ag/ag/agen5/opts.def
+# and the template file agtexi-cmd.tpl
+@end ignore
+
+AutoGen creates text files from templates using external definitions.
+
+@code{AutoGen} is designed for generating program files that contain
+repetitive text with varied substitutions. The goal is to simplify the
+maintenance of programs that contain large amounts of repetitious text.
+This is especially valuable if there are several blocks of such text
+that must be kept synchronized.
+
+One common example is the problem of maintaining the code required for
+processing program options. Processing options requires a minimum of
+four different constructs be kept in proper order in different places
+in your program. You need at least: The flag character in the flag
+string, code to process the flag when it is encountered, a global
+state variable or two, and a line in the usage text.
+You will need more things besides this if you choose to implement
+long option names, configuration file processing, environment variables
+and so on.
+
+All of this can be done mechanically; with the proper templates
+and this program.
+
+
+This chapter was generated by @strong{AutoGen},
+using the @code{agtexi-cmd} template and the option descriptions for the @code{autogen} program.
+This software is released under the GNU General Public License, version 3 or later.
+
+@menu
+* autogen usage:: autogen help/usage (@option{--help})
+* autogen input-select:: input-select options
+* autogen out-handling:: out-handling options
+* autogen debug-tpl:: debug-tpl options
+* autogen processing:: processing options
+* autogen dep-track:: dep-track options
+* autogen config:: presetting/configuring autogen
+* autogen exit status:: exit status
+* autogen Examples:: Examples
+@end menu
+
+@node autogen usage
+@section autogen help/usage (@option{--help})
+@cindex autogen help
+
+This is the automatically generated usage text for autogen.
+
+The text printed is the same whether selected with the @code{help} option
+(@option{--help}) or the @code{more-help} option (@option{--more-help}). @code{more-help} will print
+the usage text by passing it through a pager program.
+@code{more-help} is disabled on platforms without a working
+@code{fork(2)} function. The @code{PAGER} environment variable is
+used to select the program, defaulting to @file{more}. Both will exit
+with a status code of 0.
+
+@exampleindent 0
+@example
+autogen (GNU AutoGen) - The Automated Program Generator - Ver. 5.16.2pre7
+USAGE: autogen [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ <def-file> ]
+
+The following options select definitions, templates and scheme functions
+to use:
+
+ Flg Arg Option-Name Description
+ -L Str templ-dirs Template search directory list
+ - may appear multiple times
+ -T Str override-tpl Override template file
+ - may not be preset
+ -l Str lib-template Library template file
+ - may appear multiple times
+ Str definitions Definitions input file
+ - disabled as --no-definitions
+ - enabled by default
+ - may not be preset
+ -S Str load-scheme Scheme code file to load
+ -F Str load-functions Load scheme function library
+ Str shell name or path name of shell to use
+ -m no no-fmemopen Do not use in-mem streams
+ Str equate characters considered equivalent
+
+The following options modify how output is handled:
+
+ Flg Arg Option-Name Description
+ -b Str base-name Base name for output file(s)
+ - may not be preset
+ no source-time set mod times to latest source
+ - disabled as --no-source-time
+ no writable Allow output files to be writable
+ - disabled as --not-writable
+
+The following options are often useful while debugging new templates:
+
+ Flg Arg Option-Name Description
+ Num loop-limit Limit on increment loops
+ - is scalable with a suffix: k/K/m/M/g/G/t/T
+ - It must lie in one of the ranges:
+ -1 exactly, or
+ 1 to 16777216
+ -t Num timeout Time limit for server shell
+ - It must be in the range:
+ 0 to 3600
+ KWd trace tracing level of detail
+ Str trace-out tracing output file or filter
+ --- show-defs This option has been disabled
+ no used-defines Show the definitions used
+ - may not be preset
+ -C no core Leave a core dump on a failure exit
+
+These options can be used to control what gets processed in the
+definitions files and template files:
+
+ Flg Arg Option-Name Description
+ -s Str skip-suffix Omit the file with this suffix
+ - prohibits these options:
+ select-suffix
+ - may not be preset
+ - may appear multiple times
+ -o Str select-suffix specify this output suffix
+ - may not be preset
+ - may appear multiple times
+ -D Str define name to add to definition list
+ - may appear multiple times
+ -U Str undefine definition list removal pattern
+ - an alternate for define
+
+This option is used to automate dependency tracking:
+
+ Flg Arg Option-Name Description
+ -M opt make-dep emit make dependency file
+ - may not be preset
+ - may appear multiple times
+
+version, usage and configuration options:
+
+ Flg Arg Option-Name Description
+ -R Str reset-option Reset an option's state
+ -v opt version Output version information and exit
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -u no usage Abbreviated usage to stdout
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+AutoGen creates text files from templates using external definitions.
+
+The following option preset mechanisms are supported:
+ - reading file $HOME
+ - reading file ./.autogenrc
+ - examining environment variables named AUTOGEN_*
+
+The valid "trace" option keywords are:
+ nothing debug-message server-shell templates block-macros
+ expressions everything
+ or an integer from 0 through 6
+
+AutoGen is a tool designed for generating program files that contain
+repetitive text with varied substitutions.
+Packaged by Bruce (2012-08-10)
+Report autogen bugs to bkorb@@gnu.org
+@end example
+@exampleindent 4
+
+@node autogen input-select
+@section input-select options
+The following options select definitions, templates and scheme functions to use.
+@subheading templ-dirs option (-L).
+@anchor{autogen templ-dirs}
+@cindex autogen-templ-dirs
+
+This is the ``template search directory list'' option.
+This option takes an argument string @file{dir}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+Add a directory to the list of directories to search when opening
+a template, either as the primary template or an included one.
+The last entry has the highest priority in the search list.
+That is to say, they are searched in reverse order.
+@subheading override-tpl option (-T).
+@anchor{autogen override-tpl}
+@cindex autogen-override-tpl
+
+This is the ``override template file'' option.
+This option takes an argument string @file{tpl-file}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+Definition files specify the standard template that is to be expanded.
+This option will override that name and expand a different template.
+@subheading lib-template option (-l).
+@anchor{autogen lib-template}
+@cindex autogen-lib-template
+
+This is the ``library template file'' option.
+This option takes an argument string @file{tpl-file}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+DEFINE macros are saved from this template file for use in processing
+the main macro file. Template text aside from the DEFINE macros is
+is ignored.
+@subheading definitions option.
+@anchor{autogen definitions}
+@cindex autogen-definitions
+
+This is the ``definitions input file'' option.
+This option takes an argument string @file{file}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+is enabled by default.
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+Use this argument to specify the input definitions file with a
+command line option. If you do not specify this option, then
+there must be a command line argument that specifies the file,
+even if only to specify stdin with a hyphen (@code{-}).
+Specify, @code{--no-definitions} when you wish to process
+a template without any active AutoGen definitions.
+@subheading load-scheme option (-S).
+@anchor{autogen load-scheme}
+@cindex autogen-load-scheme
+
+This is the ``scheme code file to load'' option.
+This option takes an argument string @file{file}.
+Use this option to pre-load Scheme scripts into the Guile
+interpreter before template processing begins.
+Please note that the AutoGen specific functions are not loaded
+until after argument processing. So, though they may be specified
+in lambda functions you define, they may not be invoked until after
+option processing is complete.
+@subheading load-functions option (-F).
+@anchor{autogen load-functions}
+@cindex autogen-load-functions
+
+This is the ``load scheme function library'' option.
+This option takes an argument string @file{file}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must be compiled in by defining @code{HAVE_DLOPEN} during the compilation.
+@end itemize
+
+This option is used to load Guile-scheme functions. The automatically
+called initialization routine @code{scm_init} must be used to register
+these routines or data.
+@subheading shell option.
+@anchor{autogen shell}
+@cindex autogen-shell
+
+This is the ``name or path name of shell to use'' option.
+This option takes an argument string @file{shell}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must be compiled in by defining @code{SHELL_ENABLED} during the compilation.
+@end itemize
+
+By default, when AutoGen is built, the configuration is probed for a
+reasonable Bourne-like shell to use for shell script processing. If
+a particular template needs an alternate shell, it must be specified
+with this option on the command line, with an environment variable
+(@code{SHELL}) or in the configuration/initialization file.
+@subheading no-fmemopen option (-m).
+@anchor{autogen no-fmemopen}
+@cindex autogen-no-fmemopen
+
+This is the ``do not use in-mem streams'' option.
+If the local C library supports "@code{fopencookie(3GNU)}", or
+"@code{funopen(3BSD)}" then AutoGen prefers to use in-memory stream
+buffer opens instead of anonymous files. This may lead to problems
+if there is a shortage of virtual memory. If, for a particular
+application, you run out of memory, then specify this option.
+This is unlikely in a modern 64-bit virtual memory environment.
+
+On platforms without these functions, the option is accepted
+but ignored. @code{fmemopen(POSIX)} is not adequate because
+its string buffer is not reallocatable. @code{open_memstream(POSIX)}
+is @i{also} not adequate because the stream is only opened for
+output. AutoGen needs a reallocatable buffer available for both
+reading and writing.
+@subheading equate option.
+@anchor{autogen equate}
+@cindex autogen-equate
+
+This is the ``characters considered equivalent'' option.
+This option takes an argument string @file{char-list}.
+This option will alter the list of characters considered equivalent.
+The default are the three characters, "_-^". (The last is conventional
+on a Tandem/HP-NonStop, and I used to do a lot of work on Tandems.)
+@node autogen out-handling
+@section out-handling options
+The following options modify how output is handled.
+@subheading base-name option (-b).
+@anchor{autogen base-name}
+@cindex autogen-base-name
+
+This is the ``base name for output file(s)'' option.
+This option takes an argument string @file{name}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+A template may specify the exact name of the output file. Normally,
+it does not. Instead, the name is composed of the base name of the
+definitions file with suffixes appended. This option will override the
+base name derived from the definitions file name. This is required if
+there is no definitions file and advisable if definitions are being
+read from stdin. If the definitions are being read from standard in,
+the base name defaults to @file{stdin}. Any leading directory components
+in the name will be silently removed. If you wish the output file to
+appear in a particular directory, it is recommended that you "cd" into
+that directory first, or use directory names in the format specification
+for the output suffix lists, @xref{pseudo macro}.
+@subheading source-time option.
+@anchor{autogen source-time}
+@cindex autogen-source-time
+
+This is the ``set mod times to latest source'' option.
+If you stamp your output files with the @code{DNE} macro output, then
+your output files will always be different, even if the content has
+not really changed. If you use this option, then the modification
+time of the output files will change only if the input files change.
+This will help reduce unneeded builds.
+@subheading writable option.
+@anchor{autogen writable}
+@cindex autogen-writable
+
+This is the ``allow output files to be writable'' option.
+This option will leave output files writable.
+Normally, output files are read-only.
+@node autogen debug-tpl
+@section debug-tpl options
+The following options are often useful while debugging new templates.
+They specify limits that prevent the template from taking overly long
+or producing more output than expected.
+@subheading loop-limit option.
+@anchor{autogen loop-limit}
+@cindex autogen-loop-limit
+
+This is the ``limit on increment loops'' option.
+This option takes an argument number @file{lim}.
+This option prevents runaway loops. For example, if you accidentally
+specify, "FOR x (for-from 1) (for-to -1) (for-by 1)", it will take a
+long time to finish. If you do have more than 256 entries in tables,
+you will need to specify a new limit with this option.
+@subheading timeout option (-t).
+@anchor{autogen timeout}
+@cindex autogen-timeout
+
+This is the ``time limit for server shell'' option.
+This option takes an argument number @file{time-lim}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must be compiled in by defining @code{SHELL_ENABLED} during the compilation.
+@end itemize
+
+AutoGen works with a shell server process. Most normal commands will
+complete in less than 10 seconds. If, however, your commands need more
+time than this, use this option.
+
+The valid range is 0 to 3600 seconds (1 hour).
+Zero will disable the server time limit.
+@subheading trace option.
+@anchor{autogen trace}
+@cindex autogen-trace
+
+This is the ``tracing level of detail'' option.
+This option takes an argument keyword @file{level}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+This option takes a keyword as its argument.
+The argument sets an enumeration value that can be tested by comparing the option value macro (OPT_VALUE_TRACE).
+The available keywords are:
+@example
+ nothing debug-message server-shell
+ templates block-macros expressions
+ everything
+@end example
+
+or their numeric equivalent.@end itemize
+
+This option will cause AutoGen to display a trace of its template
+processing. There are six levels, each level including messages from
+the previous levels:
+
+@table @samp
+@item nothing
+Does no tracing at all (default)
+
+@item debug-message
+Print messages from the "DEBUG" AutoGen macro (@pxref{DEBUG}).
+
+@item server-shell
+Traces all input and output to the server shell. This includes a shell
+"independent" initialization script about 30 lines long. Its output is
+discarded and not inserted into any template.
+
+@item templates
+Traces the invocation of @code{DEFINE}d macros and @code{INCLUDE}s
+
+@item block-macros
+Traces all block macros. The above, plus @code{IF}, @code{FOR},
+@code{CASE} and @code{WHILE}.
+
+@item expressions
+Displays the results of expression evaluations.
+
+@item everything
+Displays the invocation of every AutoGen macro, even @code{TEXT} macros
+(i.e. the text outside of macro quotes). Additionally, if you rebuild
+the ``expr.ini'' file with debugging enabled, then all calls to
+AutoGen defined scheme functions will also get logged:
+@*
+@example
+cd $@{top_builddir@}/agen5
+DEBUG_ENABLED=true bash bootstrap.dir expr.ini
+make CFLAGS='-g -DDEBUG_ENABLED=1'
+@end example
+
+Be aware that you cannot rebuild this source in this way without first
+having installed the @code{autogen} executable in your search path.
+Because of this, "expr.ini" is in the distributed source list, and
+not in the dependencies.
+@end table
+@subheading trace-out option.
+@anchor{autogen trace-out}
+@cindex autogen-trace-out
+
+This is the ``tracing output file or filter'' option.
+This option takes an argument string @file{file}.
+The output specified may be a file name, a file that is appended to,
+or, if the option argument begins with the @code{pipe} operator
+(@code{|}), a command that will receive the tracing output as standard
+in. For example, @code{--traceout='| less'} will run the trace output
+through the @code{less} program. Appending to a file is specified by
+preceeding the file name with two greater-than characters (@code{>>}).
+@subheading show-defs option.
+@anchor{autogen show-defs}
+@cindex autogen-show-defs
+
+This is the ``show the definition tree'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must be compiled in by defining @code{DEBUG_ENABLED} during the compilation.
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+This will print out the complete definition tree before processing
+the template.
+@subheading used-defines option.
+@anchor{autogen used-defines}
+@cindex autogen-used-defines
+
+This is the ``show the definitions used'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+This will print out the names of definition values searched for
+during the processing of the template, whether actually found or
+not. There may be other referenced definitions in a template in
+portions of the template not evaluated. Some of the names listed
+may be computed names and others AutoGen macro arguments. This is
+not a means for producing a definitive, all-encompassing list of all
+and only the values used from a definition file. This is intended
+as an aid to template documentation only.
+@subheading core option (-C).
+@anchor{autogen core}
+@cindex autogen-core
+
+This is the ``leave a core dump on a failure exit'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must be compiled in by defining @code{HAVE_SYS_RESOURCE_H} during the compilation.
+@end itemize
+
+Many systems default to a zero sized core limit. If the system
+has the sys/resource.h header and if this option is supplied,
+then in the failure exit path, autogen will attempt to set the
+soft core limit to whatever the hard core limit is. If that
+does not work, then an administrator must raise the hard core
+size limit.
+@node autogen processing
+@section processing options
+These options can be used to control what gets processed
+in the definitions files and template files.
+They specify which outputs and parts of outputs to produce.
+@subheading skip-suffix option (-s).
+@anchor{autogen skip-suffix}
+@cindex autogen-skip-suffix
+
+This is the ``omit the file with this suffix'' option.
+This option takes an argument string @file{suffix}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@item
+must not appear in combination with any of the following options:
+select-suffix.
+@end itemize
+
+Occasionally, it may not be desirable to produce all of the output
+files specified in the template. (For example, only the @file{.h}
+header file, but not the @file{.c} program text.) To do this
+specify @code{--skip-suffix=c} on the command line.
+@subheading select-suffix option (-o).
+@anchor{autogen select-suffix}
+@cindex autogen-select-suffix
+
+This is the ``specify this output suffix'' option.
+This option takes an argument string @file{suffix}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+If you wish to override the suffix specifications in the template,
+you can use one or more copies of this option. See the suffix
+specification in the @ref{pseudo macro} section of the info doc.
+@subheading define option (-D).
+@anchor{autogen define}
+@cindex autogen-define
+
+This is the ``name to add to definition list'' option.
+This option takes an argument string @file{value}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+The AutoGen define names are used for the following purposes:
+
+@enumerate
+@item
+Sections of the AutoGen definitions may be enabled or disabled
+by using C-style #ifdef and #ifndef directives.
+@item
+When defining a value for a name, you may specify the index
+for a particular value. That index may be a literal value,
+a define option or a value #define-d in the definitions themselves.
+@item
+The name of a file may be prefixed with @code{$NAME/}.
+The @code{$NAME} part of the name string will be replaced with
+the define-d value for @code{NAME}.
+@item
+When AutoGen is finished loading the definitions, the defined values
+are exported to the environment with, @code{putenv(3)}.
+These values can then be used in shell scripts with @code{$@{NAME@}}
+references and in templates with @code{(getenv "NAME")}.
+@item
+While processing a template, you may specify an index to retrieve
+a specific value. That index may also be a define-d value.
+@end enumerate
+
+It is entirely equivalent to place this name in the exported environment.
+Internally, that is what AutoGen actually does with this option.
+@subheading undefine option (-U).
+@anchor{autogen undefine}
+@cindex autogen-undefine
+
+This is the ``definition list removal pattern'' option.
+This option takes an argument string @file{name-pat}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+Similar to 'C', AutoGen uses @code{#ifdef/#ifndef} preprocessing
+directives. This option will cause the matching names to be
+removed from the list of defined values.
+@node autogen dep-track
+@section dep-track options
+This option is used to automate dependency tracking.
+@subheading make-dep option (-M).
+@anchor{autogen make-dep}
+@cindex autogen-make-dep
+
+This is the ``emit make dependency file'' option.
+This option takes an optional argument string @file{type}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@item
+may not be preset with environment variables or configuration (rc/ini) files.
+@end itemize
+
+
+This option behaves fairly closely to the way the @code{-M} series of
+options work with the gcc compiler, except that instead of just
+emitting the predecessor dependencies, this also emits the successor
+dependencies (output target files). By default, the output dependency
+information will be placed in @code{<base-name>.d}, but may also be
+specified with @code{-MF<file>}. The time stamp on this file will be
+manipulated so that it will be one second older than the oldest
+primary output file.
+
+The target in this dependency file will normally be the dependency
+file name, but may also be overridden with @code{-MT<targ-name>}.
+AutoGen will not alter the contents of that file, but it may create
+it and it will adjust the modification time to match the start time.
+
+@strong{NB:} these second letters are part of the option argument, so
+@code{-MF <file>} must have the space character quoted or omitted, and
+@code{-M "F <file>"} is acceptable because the @code{F} is part of the
+option argument.
+
+@code{-M} may be followed by any of the letters M, F, P, T, Q, D, or G.
+However, only F, Q, T and P are meaningful. All but F have somewhat
+different meanings. @code{-MT<name>} is interpreted as meaning
+@code{<name>} is a sentinel file that will depend on all inputs
+(templates and definition files) and all the output files will depend
+on this sentinel file. It is suitable for use as a real make target.
+Q is treated identically to T, except dollar characters ('$') are
+doubled. P causes a special clean (clobber) phoney rule to be inserted
+into the make file fragment. An empty rule is always created for
+building the list of targets.
+
+This is the recommended usage:
+@example
+ -MFwhatever-you-like.dep -MTyour-sentinel-file -MP
+@end example
+and then in your @code{Makefile}, make the @file{autogen} rule:
+@example
+ -include whatever-you-like.dep
+ clean_targets += clean-your-sentinel-file
+
+ your-sentinel-file:
+ autogen -MT$@@ -MF$*.d .....
+
+ local-clean :
+ rm -f $(clean_targets)
+@end example
+
+The modification time on the dependency file is adjusted to be one
+second before the earliest time stamp of any other output file.
+Consequently, it is suitable for use as the sentinel file testifying
+to the fact the program was successfully run. (@code{-include} is
+the GNU make way of specifying "include it if it exists". Your make
+must support that feature or your bootstrap process must create the
+file.)
+
+All of this may also be specified using the @code{DEPENDENCIES_OUTPUT}
+or @code{AUTOGEN_MAKE_DEP} environment variables. If defined,
+dependency information will be output. If defined with white space
+free text that is something other than @code{true}, @code{false},
+@code{yes}, @code{no}, @code{0} or @code{1}, then the string is taken
+to be an output file name. If it contains a string of white space
+characters, the first token is as above and the second token is taken
+to be the target (sentinel) file as @code{-MT} in the paragraphs
+above. @code{DEPENDENCIES_OUTPUT} will be ignored if there are
+multiple sequences of white space characters or if its contents are,
+specifically, @code{false}, @code{no} or @code{0}.
+
+
+@node autogen config
+@section presetting/configuring autogen
+
+Any option that is not marked as @i{not presettable} may be preset by
+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
+the options listed above in upper case and segmented with underscores.
+The @code{AUTOGEN} variable will be tokenized and parsed like
+the command line. The remaining variables are tested for existence and their
+values are treated like option arguments.
+
+
+@noindent
+@code{libopts} will search in 2 places for configuration files:
+@itemize @bullet
+@item
+$HOME
+@item
+$PWD
+@end itemize
+The environment variables @code{HOME}, and @code{PWD}
+are expanded and replaced when @file{autogen} runs.
+For any of these that are plain files, they are simply processed.
+For any that are directories, then a file named @file{.autogenrc} is searched for
+within that directory and processed.
+
+
+Configuration files may be in a wide variety of formats.
+The basic format is an option name followed by a value (argument) on the
+same line. Values may be separated from the option name with a colon,
+equal sign or simply white space. Values may be continued across multiple
+lines by escaping the newline with a backslash.
+
+Multiple programs may also share the same initialization file.
+Common options are collected at the top, followed by program specific
+segments. The segments are separated by lines like:
+@example
+[AUTOGEN]
+@end example
+@noindent
+or by
+@example
+<?program autogen>
+@end example
+@noindent
+Do not mix these styles within one configuration file.
+
+Compound values and carefully constructed string values may also be
+specified using XML syntax:
+@example
+<option-name>
+ <sub-opt>...&lt;...&gt;...</sub-opt>
+</option-name>
+@end example
+@noindent
+yielding an @code{option-name.sub-opt} string value of
+@example
+"...<...>..."
+@end example
+@code{AutoOpts} does not track suboptions. You simply note that it is a
+hierarchicly valued option. @code{AutoOpts} does provide a means for searching
+the associated name/value pair list (see: optionFindValue).
+
+The command line options relating to configuration and/or usage help are:
+
+@subheading version (-v)
+
+Print the program version to standard out, optionally with licensing
+information, then exit 0. The optional argument specifies how much licensing
+detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument. Only the
+first letter of the argument is examined:
+
+@table @samp
+@item version
+Only print the version. This is the default.
+@item copyright
+Name the copyright usage licensing terms.
+@item verbose
+Print the full copyright usage licensing terms.
+@end table
+
+@subheading usage (-u)
+
+Print abbreviated usage to standard out, then exit 0.
+
+@subheading reset-option (-R)
+
+Resets the specified option to the compiled-in initial state.
+This will undo anything that may have been set by configuration files.
+The option argument may be either the option flag character or its long name.
+
+@node autogen exit status
+@section autogen exit status
+
+One of the following exit values will be returned:
+@table @samp
+@item 0 (EXIT_SUCCESS)
+Successful program execution.
+@item 1 (EXIT_OPTION_ERROR)
+The command options were misconfigured.
+@item 2 (EXIT_BAD_TEMPLATE)
+An error was encountered processing the template.
+@item 3 (EXIT_BAD_DEFINITIONS)
+The definitions could not be deciphered.
+@item 4 (EXIT_LOAD_ERROR)
+An error was encountered during the load phase.
+@item 5 (EXIT_SIGNAL)
+Program exited due to catching a signal. If your template includes
+string formatting, a number argument to a "%s" formatting element will
+trigger a segmentation fault. Autogen will catch the seg fault signal
+and exit with @code{AUTOGEN_EXIT_SIGNAL(5)}. Alternatively, AutoGen
+may have been interrupted with a @code{kill(2)} signal.
+@item 66 (EX_NOINPUT)
+A specified configuration file could not be loaded.
+@item 70 (EX_SOFTWARE)
+libopts had an internal operational error. Please report
+it to autogen-users@@lists.sourceforge.net. Thank you.
+@end table
+@node autogen Examples
+@section autogen Examples
+Here is how the man page is produced:
+@example
+autogen -Tagman-cmd.tpl -MFman-dep -MTstamp-man opts.def
+@end example
+
+This command produced this man page from the AutoGen option definition
+file. It overrides the template specified in @file{opts.def} (normally
+@file{options.tpl}) and uses @file{agman-cmd.tpl}. It also sets the
+make file dependency output to @file{man-dep} and the sentinel file
+(time stamp file) to @file{man-stamp}. The base of the file name is
+derived from the defined @code{prog-name}.
+
+The texi invocation document is produced via:
+@example
+autogen -Tagtexi-cmd.tpl -MFtexi-dep -MTtexi-stamp opts.def
+@end example
+
diff --git a/doc/invoke-columns.texi b/doc/invoke-columns.texi
new file mode 100644
index 0000000..1166465
--- /dev/null
+++ b/doc/invoke-columns.texi
@@ -0,0 +1,418 @@
+@node columns Invocation
+@section Invoking columns
+@pindex columns
+@cindex Columnize Input Text
+@ignore
+# -*- buffer-read-only: t -*- vi: set ro:
+#
+# DO NOT EDIT THIS FILE (invoke-columns.texi)
+#
+# It has been AutoGen-ed August 11, 2012 at 09:45:26 AM by AutoGen 5.16.2
+# From the definitions ./opts.def
+# and the template file agtexi-cmd.tpl
+@end ignore
+This program was designed for the purpose of generating compact,
+columnized tables. It will read a list of text items from standard
+in or a specified input file and produce a columnized listing of
+all the non-blank lines. Leading white space on each line is
+preserved, but trailing white space is stripped. Methods of
+applying per-entry and per-line embellishments are provided.
+See the formatting and separation arguments below.
+
+This program is used by AutoGen to help clean up and organize
+its output.
+
+See @file{autogen/agen5/fsm.tpl} and the generated output
+@file{pseudo-fsm.h}.
+
+This function was not implemented as an expression function because
+either it would have to be many expression functions, or a provision
+would have to be added to provide options to expression functions.
+Maybe not a bad idea, but it is not being implemented at the moment.
+
+A side benefit is that you can use it outside of @code{autogen} to
+columnize input, a la the @code{ls} command.
+
+This section was generated by @strong{AutoGen},
+using the @code{agtexi-cmd} template and the option descriptions for the @code{columns} program.
+This software is released under the GNU General Public License, version 3 or later.
+
+@menu
+* columns usage:: columns help/usage (@option{--help})
+* columns dimensions:: dimensions options
+* columns treatment:: treatment options
+* columns ordering:: ordering options
+* columns input-text:: input-text options
+* columns config:: presetting/configuring columns
+* columns exit status:: exit status
+* columns See Also:: See Also
+@end menu
+
+@node columns usage
+@subsection columns help/usage (@option{--help})
+@cindex columns help
+
+This is the automatically generated usage text for columns.
+
+The text printed is the same whether selected with the @code{help} option
+(@option{--help}) or the @code{more-help} option (@option{--more-help}). @code{more-help} will print
+the usage text by passing it through a pager program.
+@code{more-help} is disabled on platforms without a working
+@code{fork(2)} function. The @code{PAGER} environment variable is
+used to select the program, defaulting to @file{more}. Both will exit
+with a status code of 0.
+
+@exampleindent 0
+@example
+columns (GNU AutoGen) - Columnize Input Text - Ver. 1.2
+USAGE: columns [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
+
+Specify the output dimensions:
+
+ Flg Arg Option-Name Description
+ -W Num width Maximum Line Width
+ - It must be in the range:
+ 16 to 4095
+ -c Num columns Desired number of columns
+ - It must be in the range:
+ 1 to 2048
+ -w Num col-width Set width of each column
+ - It must be in the range:
+ 1 to 2048
+ Num tab-width tab width
+
+Specify how to lay out the text:
+
+ Flg Arg Option-Name Description
+ Num spread maximum spread added to column width
+ - It must be in the range:
+ 1 to 1024
+ no fill Fill lines with input
+ - prohibits these options:
+ spread
+ col-width
+ by-columns
+ -I Str indent Line prefix or indentation
+ Str first-indent First line prefix
+ - requires these options:
+ indent
+ -f Str format Formatting string for each input
+ -S Str separation Separation string - follows all but last
+ Str line-separation string at end of all lines but last
+ Str ending string at end of last line
+
+Specify the ordering of the entries:
+
+ Flg Arg Option-Name Description
+ no by-columns Print entries in column order
+ -s opt sort Sort input text
+
+Redirecting stdin to an alternate file:
+
+ Flg Arg Option-Name Description
+ -i Str input Input file (if not stdin)
+
+version, usage and configuration options:
+
+ Flg Arg Option-Name Description
+ -v opt version Output version information and exit
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+ -> opt save-opts Save the option state to a config file
+ -< Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+The following option preset mechanisms are supported:
+ - reading file ./.columnsrc
+ - reading file $HOME/.columnsrc
+ - examining environment variables named COLUMNS_*
+Packaged by Bruce (2012-08-11)
+Report columns bugs to bkorb@@gnu.org
+@end example
+@exampleindent 4
+
+@node columns dimensions
+@subsection dimensions options
+Specify the output dimensions.
+@subsubheading width option (-W).
+@anchor{columns width}
+@cindex columns-width
+
+This is the ``maximum line width'' option.
+This option takes an argument number @file{num}.
+This option specifies the full width of the output line,
+including any start-of-line indentation. The output will fill
+each line as completely as possible, unless the column width has
+been explicitly specified. If the maximum width is less than
+the length of the widest input, you will get a single column
+of output.
+@subsubheading columns option (-c).
+@anchor{columns columns}
+@cindex columns-columns
+
+This is the ``desired number of columns'' option.
+This option takes an argument number @file{count}.
+Use this option to specify exactly how many columns to produce.
+If that many columns will not fit within @var{line_width}, then
+the count will be reduced to the number that fit.
+@subsubheading col-width option (-w).
+@anchor{columns col-width}
+@cindex columns-col-width
+
+This is the ``set width of each column'' option.
+This option takes an argument number @file{num}.
+Use this option to specify exactly how many characters are to be
+allocated for each column. If it is narrower than the widest entry,
+it will be over-ridden with the required width.
+@subsubheading tab-width option.
+@anchor{columns tab-width}
+@cindex columns-tab-width
+
+This is the ``tab width'' option.
+This option takes an argument number @file{num}.
+If an indentation string contains tabs, then this value is used to
+compute the ending column of the prefix string.
+@node columns treatment
+@subsection treatment options
+Specify how to lay out the text.
+@subsubheading spread option.
+@anchor{columns spread}
+@cindex columns-spread
+
+This is the ``maximum spread added to column width'' option.
+This option takes an argument number @file{num}.
+Use this option to specify exactly how many characters may be
+added to each column. It allows you to prevent columns from
+becoming too far apart. Without this option, @file{columns}
+will attempt to widen columns to fill the full width.
+@subsubheading fill option.
+@anchor{columns fill}
+@cindex columns-fill
+
+This is the ``fill lines with input'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must not appear in combination with any of the following options:
+spread, col_width, by_columns.
+@end itemize
+
+Instead of columnizing the input text, fill the output lines
+with the input lines. Blank lines on input will cause a
+blank line in the output, unless the output is sorted.
+With sorted output, blank lines are ignored.
+@subsubheading indent option (-I).
+@anchor{columns indent}
+@cindex columns-indent
+
+This is the ``line prefix or indentation'' option.
+This option takes an argument string @file{l-pfx}.
+If a number, then this many spaces will be inserted at the start of
+every line. Otherwise, it is a line prefix that will be inserted
+at the start of every line.
+@subsubheading first-indent option.
+@anchor{columns first-indent}
+@cindex columns-first-indent
+
+This is the ``first line prefix'' option.
+This option takes an argument string @file{l-pfx}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must appear in combination with the following options:
+indent.
+@end itemize
+
+If a number, then this many spaces will be inserted at the start of
+the first line. Otherwise, it is a line prefix that will be inserted
+at the start of that line. If its length exceeds "indent", then it
+will be emitted on a line by itself, suffixed by any line separation
+string. For example:
+
+@example
+$ columns --first='#define TABLE' -c 2 -I4 --line=' \' <<_EOF_
+one
+two
+three
+four
+_EOF_
+#define TABLE \
+ one two \
+ three four
+@end example
+@subsubheading format option (-f).
+@anchor{columns format}
+@cindex columns-format
+
+This is the ``formatting string for each input'' option.
+This option takes an argument string @file{fmt-str}.
+If you need to reformat each input text, the argument to this
+option is interpreted as an @code{sprintf(3)} format that is used
+to produce each output entry.
+@subsubheading separation option (-S).
+@anchor{columns separation}
+@cindex columns-separation
+
+This is the ``separation string - follows all but last'' option.
+This option takes an argument string @file{sep-str}.
+Use this option if, for example, you wish a comma to appear after
+each entry except the last.
+@subsubheading line-separation option.
+@anchor{columns line-separation}
+@cindex columns-line-separation
+
+This is the ``string at end of all lines but last'' option.
+This option takes an argument string @file{sep-str}.
+Use this option if, for example, you wish a backslash to appear at
+the end of every line, except the last.
+@subsubheading ending option.
+@anchor{columns ending}
+@cindex columns-ending
+
+This is the ``string at end of last line'' option.
+This option takes an argument string @file{end-str}.
+This option puts the specified string at the end of the output.
+@node columns ordering
+@subsection ordering options
+Specify the ordering of the entries.
+@subsubheading by-columns option.
+@anchor{columns by-columns}
+@cindex columns-by-columns
+
+This is the ``print entries in column order'' option.
+Normally, the entries are printed out in order by rows and then columns.
+This option will cause the entries to be ordered within columns.
+The final column, instead of the final row, may be shorter than the
+others.
+@subsubheading sort option (-s).
+@anchor{columns sort}
+@cindex columns-sort
+
+This is the ``sort input text'' option.
+This option takes an optional argument string @file{key-pat}.
+Causes the input text to be sorted. If an argument is supplied,
+it is presumed to be a pattern and the sort is based upon the
+matched text. If the pattern starts with or consists of
+an asterisk (@code{*}), then the sort is case insensitive.
+@node columns input-text
+@subsection input-text options
+Redirecting stdin to an alternate file.
+@subsubheading input option (-i).
+@anchor{columns input}
+@cindex columns-input
+
+This is the ``input file (if not stdin)'' option.
+This option takes an argument string @file{file}.
+This program normally runs as a @code{filter}, reading from standard
+input, columnizing and writing to standard out. This option redirects
+input to a file.
+
+
+@node columns config
+@subsection presetting/configuring columns
+
+Any option that is not marked as @i{not presettable} may be preset by
+loading values from configuration ("rc" or "ini") files, and values from environment variables named @code{COLUMNS} and @code{COLUMNS_<OPTION_NAME>}. @code{<OPTION_NAME>} must be one of
+the options listed above in upper case and segmented with underscores.
+The @code{COLUMNS} variable will be tokenized and parsed like
+the command line. The remaining variables are tested for existence and their
+values are treated like option arguments.
+
+
+@noindent
+@code{libopts} will search in 2 places for configuration files:
+@itemize @bullet
+@item
+$PWD
+@item
+$HOME
+@end itemize
+The environment variables @code{PWD}, and @code{HOME}
+are expanded and replaced when @file{columns} runs.
+For any of these that are plain files, they are simply processed.
+For any that are directories, then a file named @file{.columnsrc} is searched for
+within that directory and processed.
+
+
+Configuration files may be in a wide variety of formats.
+The basic format is an option name followed by a value (argument) on the
+same line. Values may be separated from the option name with a colon,
+equal sign or simply white space. Values may be continued across multiple
+lines by escaping the newline with a backslash.
+
+Multiple programs may also share the same initialization file.
+Common options are collected at the top, followed by program specific
+segments. The segments are separated by lines like:
+@example
+[COLUMNS]
+@end example
+@noindent
+or by
+@example
+<?program columns>
+@end example
+@noindent
+Do not mix these styles within one configuration file.
+
+Compound values and carefully constructed string values may also be
+specified using XML syntax:
+@example
+<option-name>
+ <sub-opt>...&lt;...&gt;...</sub-opt>
+</option-name>
+@end example
+@noindent
+yielding an @code{option-name.sub-opt} string value of
+@example
+"...<...>..."
+@end example
+@code{AutoOpts} does not track suboptions. You simply note that it is a
+hierarchicly valued option. @code{AutoOpts} does provide a means for searching
+the associated name/value pair list (see: optionFindValue).
+
+The command line options relating to configuration and/or usage help are:
+
+@subsubheading version (-v)
+
+Print the program version to standard out, optionally with licensing
+information, then exit 0. The optional argument specifies how much licensing
+detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument. Only the
+first letter of the argument is examined:
+
+@table @samp
+@item version
+Only print the version. This is the default.
+@item copyright
+Name the copyright usage licensing terms.
+@item verbose
+Print the full copyright usage licensing terms.
+@end table
+
+@node columns exit status
+@subsection columns exit status
+
+One of the following exit values will be returned:
+@table @samp
+@item 0 (EXIT_SUCCESS)
+Successful program execution.
+@item 1 (EXIT_FAILURE)
+The operation failed or the command syntax was not valid.
+@item 66 (EX_NOINPUT)
+A specified configuration file could not be loaded.
+@item 70 (EX_SOFTWARE)
+libopts had an internal operational error. Please report
+it to autogen-users@@lists.sourceforge.net. Thank you.
+@end table
+@node columns See Also
+@subsection columns See Also
+This program is documented more fully in the Columns section
+of the Add-On chapter in the @code{AutoGen} Info system documentation.
+
diff --git a/doc/invoke-getdefs.texi b/doc/invoke-getdefs.texi
new file mode 100644
index 0000000..b07257c
--- /dev/null
+++ b/doc/invoke-getdefs.texi
@@ -0,0 +1,599 @@
+@node getdefs Invocation
+@section Invoking getdefs
+@pindex getdefs
+@cindex AutoGen Definition Extraction Tool
+@ignore
+# -*- buffer-read-only: t -*- vi: set ro:
+#
+# DO NOT EDIT THIS FILE (invoke-getdefs.texi)
+#
+# It has been AutoGen-ed August 11, 2012 at 09:42:23 AM by AutoGen 5.16.2
+# From the definitions ./opts.def
+# and the template file agtexi-cmd
+@end ignore
+
+If no @code{input} argument is provided or is set to simply "-", and if
+@code{stdin} is not a @code{tty}, then the list of input files will be
+read from @code{stdin}.
+This program extracts AutoGen definitions from a list of source files.
+Definitions are delimited by @code{/*=<entry-type> <entry-name>\n} and
+@code{=*/\n}. From that, this program creates a definition of the following
+form:
+
+@example
+ #line nnn "source-file-name"
+ entry_type = @{
+ name = entry_name;
+ ...
+ @};
+@end example
+
+@enumerate
+@item
+The ellipsis @code{...} is filled in by text found between the two
+delimiters. Each line of text is stripped of anything before the first
+asterisk, then leading asterisks, then any leading or trailing white space.
+
+@item
+If what is left starts with what looks like a name followed by a colon, then
+it is interpreted as a name followed by a value.
+
+@item
+If the first character of the value is either a single or double quote, then
+you are responsible for quoting the text as it gets inserted into the output
+definitions. So, if you want whitespace at the beginnings of the lines of
+text, you must do something like this:
+
+@example
+ * mumble:
+ * " this is some\n"
+ * " indented text."
+@end example
+
+@item
+If the @code{<entry-name>} is followed by a comma, the word @code{ifdef} (or
+@code{ifndef}) and a name @code{if_name}, then the above entry will be under
+@code{ifdef} control.
+
+@example
+/*=group entry_name, ifdef FOO
+ * attr: attribute value
+=*/
+@end example
+
+Will produce the following:
+
+@example
+#ifdef FOO
+#line nnn "source-file-name"
+group = @{
+ name = entry_name;
+ attr = 'attribute value';
+@};
+#endif
+@end example
+
+@item
+If you use of the @code{subblock} option, you can specify a nested
+value, @xref{getdefs subblock}. That is, this text:
+
+@example
+ * arg: int, this, what-it-is
+@end example
+
+with the @code{--subblock=arg=type,name,doc} option would yield:
+
+@example
+arg = @{ type = int; name = this; doc = what-it-is; @};
+@end example
+@end enumerate
+
+This section was generated by @strong{AutoGen},
+using the @code{agtexi-cmd} template and the option descriptions for the @code{getdefs} program.
+This software is released under the GNU General Public License, version 3 or later.
+
+@menu
+* getdefs usage:: getdefs help/usage (@option{help})
+* getdefs def-selection:: def-selection options
+* getdefs enumerating:: enumerating options
+* getdefs doc-insert:: doc-insert options
+* getdefs input-files:: input-files options
+* getdefs doc-output:: doc-output options
+* getdefs config:: presetting/configuring getdefs
+* getdefs exit status:: exit status
+* getdefs See Also:: See Also
+@end menu
+
+@node getdefs usage
+@subsection getdefs help/usage (@option{help})
+@cindex getdefs help
+
+This is the automatically generated usage text for getdefs.
+
+The text printed is the same whether selected with the @code{help} option
+(@option{help}) or the @code{more-help} option (@option{more-help}). @code{more-help} will print
+the usage text by passing it through a pager program.
+@code{more-help} is disabled on platforms without a working
+@code{fork(2)} function. The @code{PAGER} environment variable is
+used to select the program, defaulting to @file{more}. Both will exit
+with a status code of 0.
+
+@exampleindent 0
+@example
+getdefs (GNU AutoGen) - AutoGen Definition Extraction Tool - Ver. 1.5
+USAGE: getdefs [ <option-name>[@{=| @}<val>] ]...
+
+Specify which definitions are of interest and what to say about them:
+
+ Arg Option-Name Description
+ Str defs-to-get Regexp to look for after the "/*="
+ Str subblock subblock definition names
+ - may appear multiple times
+ Str listattr attribute with list of values
+ - may appear multiple times
+
+specify how to number the definitions:
+
+ Arg Option-Name Description
+ opt ordering Alphabetize or use named file
+ - disabled as --no-ordering
+ - enabled by default
+ Num first-index The first index to apply to groups
+
+Definition insertion options:
+
+ Arg Option-Name Description
+ opt filelist Insert source file names into defs
+ Str assign Global assignments
+ - may appear multiple times
+ Str common-assign Assignments common to all blocks
+ - may appear multiple times
+ Str copy File(s) to copy into definitions
+ - may appear multiple times
+ opt srcfile Insert source file name into each def
+ opt linenum Insert source line number into each def
+
+specify which files to search for markers:
+
+ Arg Option-Name Description
+ Str input Input file to search for defs
+ - may appear multiple times
+ - default option for unnamed options
+
+Definition output disposition options::
+
+ Arg Option-Name Description
+ Str output Output file to open
+ - an alternate for autogen
+ opt autogen Invoke AutoGen with defs
+ - disabled as --no-autogen
+ - enabled by default
+ Str template Template Name
+ Str agarg AutoGen Argument
+ - prohibits these options:
+ output
+ - may appear multiple times
+ Str base-name Base name for output file(s)
+ - prohibits these options:
+ output
+
+version, usage and configuration options:
+
+ Arg Option-Name Description
+ opt version Output version information and exit
+ no help Display extended usage information and exit
+ no more-help Extended usage information passed thru pager
+ opt save-opts Save the option state to a config file
+ Str load-opts Load options from a config file
+ - disabled as --no-load-opts
+ - may appear multiple times
+
+All arguments are named options.
+
+If no ``input'' argument is provided or is set to simply "-", and if
+``stdin'' is not a ``tty'', then the list of input files will be read from
+``stdin''.
+
+The following option preset mechanisms are supported:
+ - reading file /dev/null
+
+This program extracts AutoGen definitions from a list of source files.
+Definitions are delimited by ``/*=<entry-type> <entry-name>\n'' and
+``=*/\n''.
+Packaged by Bruce (2012-08-11)
+Report getdefs bugs to bkorb@@gnu.org
+@end example
+@exampleindent 4
+
+@node getdefs def-selection
+@subsection def-selection options
+Specify which definitions are of interest and what to say about them.
+@subsubheading defs-to-get option.
+@anchor{getdefs defs-to-get}
+@cindex getdefs-defs-to-get
+
+This is the ``regexp to look for after the "/*="'' option.
+This option takes an argument string @file{reg-ex}.
+If you want definitions only from a particular category, or even
+with names matching particular patterns, then specify this regular
+expression for the text that must follow the @code{/*=}.
+@subsubheading subblock option.
+@anchor{getdefs subblock}
+@cindex getdefs-subblock
+
+This is the ``subblock definition names'' option.
+This option takes an argument string @file{sub-def}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+This option is used to create shorthand entries for nested definitions.
+For example, with:
+@table @r
+@item using subblock thus
+@code{--subblock=arg=argname,type,null}
+@item and defining an @code{arg} thus
+@code{arg: this, char *}
+@item will then expand to:
+@code{arg = @{ argname = this; type = "char *"; @};}
+@end table
+The "this, char *" string is separated at the commas, with the
+white space removed. You may use characters other than commas by
+starting the value string with a punctuation character other than
+a single or double quote character. You may also omit intermediate
+values by placing the commas next to each other with no intervening
+white space. For example, "+mumble++yes+" will expand to:
+@*
+@code{arg = @{ argname = mumble; null = "yes"; @};}.
+@subsubheading listattr option.
+@anchor{getdefs listattr}
+@cindex getdefs-listattr
+
+This is the ``attribute with list of values'' option.
+This option takes an argument string @file{def}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+This option is used to create shorthand entries for definitions
+that generally appear several times. That is, they tend to be
+a list of values. For example, with:
+@*
+@code{listattr=foo} defined, the text:
+@*
+@code{foo: this, is, a, multi-list} will then expand to:
+@*
+@code{foo = 'this', 'is', 'a', 'multi-list';}
+@*
+The texts are separated by the commas, with the
+white space removed. You may use characters other than commas by
+starting the value string with a punctuation character other than
+a single or double quote character.
+@node getdefs enumerating
+@subsection enumerating options
+specify how to number the definitions.
+@subsubheading ordering option.
+@anchor{getdefs ordering}
+@cindex getdefs-ordering
+
+This is the ``alphabetize or use named file'' option.
+This option takes an optional argument string @file{file-name}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+is enabled by default.
+@end itemize
+
+By default, ordering is alphabetical by the entry name. Use,
+@code{no-ordering} if order is unimportant. Use @code{ordering}
+with no argument to order without case sensitivity. Use
+@code{ordering=<file-name>} if chronological order is important.
+getdefs will maintain the text content of @code{file-name}.
+@code{file-name} need not exist.
+@subsubheading first-index option.
+@anchor{getdefs first-index}
+@cindex getdefs-first-index
+
+This is the ``the first index to apply to groups'' option.
+This option takes an argument number @file{first-index}.
+By default, the first occurrence of a named definition will have an
+index of zero. Sometimes, that needs to be a reserved value. Provide
+this option to specify a different starting point.
+@node getdefs doc-insert
+@subsection doc-insert options
+Definition insertion options.
+@subsubheading filelist option.
+@anchor{getdefs filelist}
+@cindex getdefs-filelist
+
+This is the ``insert source file names into defs'' option.
+This option takes an optional argument string @file{file}.
+Inserts the name of each input file into the output definitions.
+If no argument is supplied, the format will be:
+@example
+infile = '%s';
+@end example
+If an argument is supplied, that string will be used for the entry
+name instead of @var{infile}.
+@subsubheading assign option.
+@anchor{getdefs assign}
+@cindex getdefs-assign
+
+This is the ``global assignments'' option.
+This option takes an argument string @file{ag-def}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+The argument to each copy of this option will be inserted into
+the output definitions, with only a semicolon attached.
+@subsubheading common-assign option.
+@anchor{getdefs common-assign}
+@cindex getdefs-common-assign
+
+This is the ``assignments common to all blocks'' option.
+This option takes an argument string @file{ag-def}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+The argument to each copy of this option will be inserted into
+each output definition, with only a semicolon attached.
+@subsubheading copy option.
+@anchor{getdefs copy}
+@cindex getdefs-copy
+
+This is the ``file(s) to copy into definitions'' option.
+This option takes an argument string @file{file}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+The content of each file named by these options will be inserted into
+the output definitions.
+@subsubheading srcfile option.
+@anchor{getdefs srcfile}
+@cindex getdefs-srcfile
+
+This is the ``insert source file name into each def'' option.
+This option takes an optional argument string @file{file}.
+Inserts the name of the input file where a definition was found
+into the output definition.
+If no argument is supplied, the format will be:
+@example
+srcfile = '%s';
+@end example
+If an argument is supplied, that string will be used for the entry
+name instead of @var{srcfile}.
+@subsubheading linenum option.
+@anchor{getdefs linenum}
+@cindex getdefs-linenum
+
+This is the ``insert source line number into each def'' option.
+This option takes an optional argument string @file{def-name}.
+Inserts the line number in the input file where a definition
+was found into the output definition.
+If no argument is supplied, the format will be:
+@example
+linenum = '%s';
+@end example
+If an argument is supplied, that string will be used for the entry
+name instead of @var{linenum}.
+@node getdefs input-files
+@subsection input-files options
+specify which files to search for markers.
+@subsubheading input option.
+@anchor{getdefs input}
+@cindex getdefs-input
+
+This is the ``input file to search for defs'' option.
+This option takes an argument string @file{src-file}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+All files that are to be searched for definitions must be named on
+the command line or read from @code{stdin}. If there is only one
+@code{input} option and it is the string, "-", then the input file
+list is read from @code{stdin}. If a command line argument is not
+an option name and does not contain an assignment operator
+(@code{=}), then it defaults to being an input file name.
+At least one input file must be specified.
+@node getdefs doc-output
+@subsection doc-output options
+Definition output disposition options:.
+@subsubheading output option.
+@anchor{getdefs output}
+@cindex getdefs-output
+
+This is the ``output file to open'' option.
+This option takes an argument string @file{file}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+is a member of the autogen class of options.
+@end itemize
+
+If you are not sending the output to an AutoGen process,
+you may name an output file instead.
+@subsubheading autogen option.
+@anchor{getdefs autogen}
+@cindex getdefs-autogen
+
+This is the ``invoke autogen with defs'' option.
+This option takes an optional argument string @file{ag-cmd}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+is enabled by default.
+@item
+is a member of the autogen class of options.
+@end itemize
+
+This is the default output mode. Specifying @code{no-autogen} is
+equivalent to @code{output=-}. If you supply an argument to this
+option, that program will be started as if it were AutoGen and
+its standard in will be set to the output definitions of this program.
+@subsubheading template option.
+@anchor{getdefs template}
+@cindex getdefs-template
+
+This is the ``template name'' option.
+This option takes an argument string @file{file}.
+Specifies the template name to be used for generating the final output.
+@subsubheading agarg option.
+@anchor{getdefs agarg}
+@cindex getdefs-agarg
+
+This is the ``autogen argument'' option.
+This option takes an argument string @file{ag-opt}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@item
+must not appear in combination with any of the following options:
+output.
+@end itemize
+
+This is a pass-through argument. It allows you to specify any
+arbitrary argument to be passed to AutoGen.
+@subsubheading base-name option.
+@anchor{getdefs base-name}
+@cindex getdefs-base-name
+
+This is the ``base name for output file(s)'' option.
+This option takes an argument string @file{name}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must not appear in combination with any of the following options:
+output.
+@end itemize
+
+When output is going to AutoGen, a base name must either be supplied
+or derived. If this option is not supplied, then it is taken from
+the @code{template} option. If that is not provided either, then
+it is set to the base name of the current directory.
+
+
+@node getdefs config
+@subsection presetting/configuring getdefs
+
+Any option that is not marked as @i{not presettable} may be preset by
+loading values from configuration ("rc" or "ini") files.
+
+
+@noindent
+@code{libopts} will search in @file{/dev/null} for configuration (option) data.
+If this is a plain file, it is simply processed.
+If it is a directory, then a file named @file{.getdefsrc} is searched for within that directory.
+
+Configuration files may be in a wide variety of formats.
+The basic format is an option name followed by a value (argument) on the
+same line. Values may be separated from the option name with a colon,
+equal sign or simply white space. Values may be continued across multiple
+lines by escaping the newline with a backslash.
+
+Multiple programs may also share the same initialization file.
+Common options are collected at the top, followed by program specific
+segments. The segments are separated by lines like:
+@example
+[GETDEFS]
+@end example
+@noindent
+or by
+@example
+<?program getdefs>
+@end example
+@noindent
+Do not mix these styles within one configuration file.
+
+Compound values and carefully constructed string values may also be
+specified using XML syntax:
+@example
+<option-name>
+ <sub-opt>...&lt;...&gt;...</sub-opt>
+</option-name>
+@end example
+@noindent
+yielding an @code{option-name.sub-opt} string value of
+@example
+"...<...>..."
+@end example
+@code{AutoOpts} does not track suboptions. You simply note that it is a
+hierarchicly valued option. @code{AutoOpts} does provide a means for searching
+the associated name/value pair list (see: optionFindValue).
+
+The command line options relating to configuration and/or usage help are:
+
+@subsubheading version
+
+Print the program version to standard out, optionally with licensing
+information, then exit 0. The optional argument specifies how much licensing
+detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument. Only the
+first letter of the argument is examined:
+
+@table @samp
+@item version
+Only print the version. This is the default.
+@item copyright
+Name the copyright usage licensing terms.
+@item verbose
+Print the full copyright usage licensing terms.
+@end table
+
+@node getdefs exit status
+@subsection getdefs exit status
+
+One of the following exit values will be returned:
+@table @samp
+@item 0 (EXIT_SUCCESS)
+Successful program execution.
+@item 1 (EXIT_FAILURE)
+The operation failed or the command syntax was not valid.
+@item 66 (EX_NOINPUT)
+A specified configuration file could not be loaded.
+@item 70 (EX_SOFTWARE)
+libopts had an internal operational error. Please report
+it to autogen-users@@lists.sourceforge.net. Thank you.
+@end table
+@node getdefs See Also
+@subsection getdefs See Also
+This program is documented more fully in the Getdefs section
+of the Add-On chapter in the @code{AutoGen} Info system documentation.
+
diff --git a/doc/invoke-snprintfv.texi b/doc/invoke-snprintfv.texi
new file mode 100644
index 0000000..380641c
--- /dev/null
+++ b/doc/invoke-snprintfv.texi
@@ -0,0 +1,74 @@
+@node snprintfv
+@section Replacement for Stdio Formatting Library
+
+ Using the `printf' formatting routines in a portable fashion has
+always been a pain, and this package has been way more pain than anyone
+ever imagined. Hopefully, with this release of snprintfv, the pain is
+now over for all time.
+
+ The issues with portable usage are these:
+
+@enumerate
+@item
+Argument number specifiers are often either not implemented or are
+buggy. Even GNU libc, version 1 got it wrong.
+
+@item
+ANSI/ISO "forgot" to provide a mechanism for computing argument
+lists for vararg procedures.
+
+@item
+The argument array version of printf (`printfv()') is not
+generally available, does not work with the native printf, and
+does not have a working argument number specifier in the format
+specification. (Last I knew, anyway.)
+
+@item
+You cannot fake varargs by calling `vprintf()' with an array of
+arguments, because ANSI does not require such an implementation
+and some vendors play funny tricks because they are allowed to.
+@end enumerate
+
+ These four issues made it impossible for AutoGen to ship without its
+own implementation of the `printf' formatting routines. Since we were
+forced to do this, we decided to make the formatting routines both
+better and more complete :-). We addressed these issues and added the
+following features to the common printf API:
+
+@enumerate 5
+@item
+The formatted output can be written to
+
+@itemize @bullet
+@item
+a string allocated by the formatting function (`asprintf()').
+@item
+a file descriptor instead of a file stream (`dprintf()').
+@item
+a user specified stream (`stream_printf()').
+@end itemize
+
+@item
+The formatting functions can be augmented with your own functions.
+These functions are allowed to consume more than one character
+from the format, but must commence with a unique character. For
+example,
+
+@example
+"%@{struct stat@}\n"
+@end example
+
+might be used with '@{' registered to a procedure that would look
+up "struct stat" in a symbol table and do appropriate things,
+consuming the format string through the '@}' character.
+@end enumerate
+
+ Gary V. Vaughan was generous enough to supply this implementation.
+Many thanks!!
+
+ For further details, the reader is referred to the snprintfv
+documentation. These functions are also available in the template
+processing as@: `sprintf' (@pxref{SCM sprintf}), `printf'
+(@pxref{SCM printf}), `fprintf' (@pxref{SCM fprintf}), and `shellf'
+(@pxref{SCM shellf}).
+
diff --git a/doc/invoke-xml2ag.texi b/doc/invoke-xml2ag.texi
new file mode 100644
index 0000000..715f742
--- /dev/null
+++ b/doc/invoke-xml2ag.texi
@@ -0,0 +1,470 @@
+@node xml2ag Invocation
+@section Invoking xml2ag
+@pindex xml2ag
+@cindex XML to AutoGen Definiton Converter
+@ignore
+# -*- buffer-read-only: t -*- vi: set ro:
+#
+# DO NOT EDIT THIS FILE (invoke-xml2ag.texi)
+#
+# It has been AutoGen-ed August 11, 2012 at 09:42:28 AM by AutoGen 5.16.2
+# From the definitions ./xmlopts.def
+# and the template file agtexi-cmd
+@end ignore
+
+This program will convert any arbitrary XML file into equivalent
+AutoGen definitions, and invoke AutoGen.
+The template used will be derived from either:
+@itemize @bullet
+@item
+The @strong{--override-tpl} command line option
+@item
+A top level XML attribute named, "@code{template}"
+@end itemize
+@noindent
+One or the other @strong{must} be provided, or the program will
+exit with a failure message.
+
+The @emph{base-name} for the output will similarly be either:
+@itemize @bullet
+@item
+The @strong{--base-name} command line option.
+@item
+The base name of the @file{.xml} file.
+@end itemize
+
+The definitions derived from XML generally have an extra layer
+of definition. Specifically, this XML input:
+@example
+<mumble attr="foo">
+ mumble-1
+ <grumble>
+ grumble, grumble, grumble.
+</grumble>mumble, mumble
+</mumble>
+@end example
+Will get converted into this:
+@example
+mumble = @{
+ grumble = @{
+ text = 'grumble, grumble, grumble';
+ @};
+ text = 'mumble-1';
+ text = 'mumble, mumble';
+@};
+@end example
+Please notice that some information is lost. AutoGen cannot tell that
+"grumble" used to lie between the mumble texts. Also please note that
+you cannot assign:
+@example
+grumble = 'grumble, grumble, grumble.';
+@end example
+because if another "grumble" has an attribute or multiple texts,
+it becomes impossible to have the definitions be the same type
+(compound or text values).
+
+This section was generated by @strong{AutoGen},
+using the @code{agtexi-cmd} template and the option descriptions for the @code{xml2ag} program.
+This software is released under the GNU General Public License, version 3 or later.
+
+@menu
+* xml2ag usage:: xml2ag help/usage (@option{--help})
+* xml2ag the-xml2ag-option:: the-xml2ag-option options
+* xml2ag autogen-options:: autogen-options options
+* xml2ag exit status:: exit status
+@end menu
+
+@node xml2ag usage
+@subsection xml2ag help/usage (@option{--help})
+@cindex xml2ag help
+
+This is the automatically generated usage text for xml2ag.
+
+The text printed is the same whether selected with the @code{help} option
+(@option{--help}) or the @code{more-help} option (@option{--more-help}). @code{more-help} will print
+the usage text by passing it through a pager program.
+@code{more-help} is disabled on platforms without a working
+@code{fork(2)} function. The @code{PAGER} environment variable is
+used to select the program, defaulting to @file{more}. Both will exit
+with a status code of 0.
+
+@exampleindent 0
+@example
+xml2ag (GNU AutoGen) - XML to AutoGen Definiton Converter - Ver. 5.16.2
+USAGE: xml2ag [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ <def-file> ]
+
+All other options are derived from autogen:
+
+ Flg Arg Option-Name Description
+ -O Str output Output file in lieu of AutoGen processing
+
+All other options:
+
+ Flg Arg Option-Name Description
+ -L Str templ-dirs Template search directory list
+ - may appear multiple times
+ -T Str override-tpl Override template file
+ -l Str lib-template Library template file
+ - may appear multiple times
+ Str definitions Definitions input file
+ -S Str load-scheme Scheme code file to load
+ -F Str load-functions Load scheme function library
+ Str shell name or path name of shell to use
+ -m no no-fmemopen Do not use in-mem streams
+ Str equate characters considered equivalent
+ -b Str base-name Base name for output file(s)
+ no source-time set mod times to latest source
+ no writable Allow output files to be writable
+ - disabled as --not-writable
+ Num loop-limit Limit on increment loops
+ - is scalable with a suffix: k/K/m/M/g/G/t/T
+ - It must lie in one of the ranges:
+ -1 exactly, or
+ 1 to 16777216
+ -t Num timeout Time limit for server shell
+ - It must be in the range:
+ 0 to 3600
+ KWd trace tracing level of detail
+ Str trace-out tracing output file or filter
+ no show-defs Show the definition tree
+ no used-defines Show the definitions used
+ -C no core Leave a core dump on a failure exit
+ -s Str skip-suffix Omit the file with this suffix
+ - prohibits these options:
+ select-suffix
+ - may appear multiple times
+ -o Str select-suffix specify this output suffix
+ - may appear multiple times
+ -D Str define name to add to definition list
+ - may appear multiple times
+ -U Str undefine definition list removal pattern
+ - an alternate for define
+ -M opt make-dep emit make dependency file
+ - may appear multiple times
+
+version, usage and configuration options:
+
+ Flg Arg Option-Name Description
+ -v opt version Output version information and exit
+ -? no help Display extended usage information and exit
+ -! no more-help Extended usage information passed thru pager
+
+Options are specified by doubled hyphens and their name or by a single
+hyphen and the flag character.
+
+This program will convert any arbitrary XML file into equivalent AutoGen
+definitions, and invoke AutoGen.
+
+The valid "trace" option keywords are:
+ nothing debug-message server-shell templates block-macros
+ expressions everything
+ or an integer from 0 through 6
+
+The template will be derived from either: * the ``--override-tpl'' command
+line option * a top level XML attribute named, "template"
+
+The ``base-name'' for the output will similarly be either: * the
+``--base-name'' command line option * the base name of the .xml file
+Packaged by Bruce (2012-08-11)
+Report xml2ag bugs to bkorb@@gnu.org
+@end example
+@exampleindent 4
+
+@node xml2ag the-xml2ag-option
+@subsection the-xml2ag-option options
+All other options are derived from autogen.
+@subsubheading output option (-O).
+@anchor{xml2ag output}
+@cindex xml2ag-output
+
+This is the ``output file in lieu of autogen processing'' option.
+This option takes an argument string @file{file}.
+By default, the output is handed to an AutoGen for processing.
+However, you may save the definitions to a file instead.
+@node xml2ag autogen-options
+@subsection autogen-options options
+All other options.
+These options are @i{mostly} just passed throug to @code{autogen}.
+The one exception is @code{--override-tpl} which replaces the
+default template in the output definitions. It does not get passed
+through on the command line.
+@subsubheading templ-dirs option (-L).
+@anchor{xml2ag templ-dirs}
+@cindex xml2ag-templ-dirs
+
+This is the ``template search directory list'' option.
+This option takes an argument string @file{dir}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+Pass-through AutoGen argument
+@subsubheading override-tpl option (-T).
+@anchor{xml2ag override-tpl}
+@cindex xml2ag-override-tpl
+
+This is the ``override template file'' option.
+This option takes an argument string @file{tpl-file}.
+Pass-through AutoGen argument
+@subsubheading lib-template option (-l).
+@anchor{xml2ag lib-template}
+@cindex xml2ag-lib-template
+
+This is the ``library template file'' option.
+This option takes an argument string @file{tpl-file}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+Pass-through AutoGen argument
+@subsubheading definitions option.
+@anchor{xml2ag definitions}
+@cindex xml2ag-definitions
+
+This is the ``definitions input file'' option.
+This option takes an argument string @file{file}.
+Pass-through AutoGen argument
+@subsubheading load-scheme option (-S).
+@anchor{xml2ag load-scheme}
+@cindex xml2ag-load-scheme
+
+This is the ``scheme code file to load'' option.
+This option takes an argument string @file{file}.
+Pass-through AutoGen argument
+@subsubheading load-functions option (-F).
+@anchor{xml2ag load-functions}
+@cindex xml2ag-load-functions
+
+This is the ``load scheme function library'' option.
+This option takes an argument string @file{file}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must be compiled in by defining @code{HAVE_DLOPEN} during the compilation.
+@end itemize
+
+Pass-through AutoGen argument
+@subsubheading shell option.
+@anchor{xml2ag shell}
+@cindex xml2ag-shell
+
+This is the ``name or path name of shell to use'' option.
+This option takes an argument string @file{shell}.
+Pass-through AutoGen argument
+@subsubheading no-fmemopen option (-m).
+@anchor{xml2ag no-fmemopen}
+@cindex xml2ag-no-fmemopen
+
+This is the ``do not use in-mem streams'' option.
+Pass-through AutoGen argument
+@subsubheading equate option.
+@anchor{xml2ag equate}
+@cindex xml2ag-equate
+
+This is the ``characters considered equivalent'' option.
+This option takes an argument string @file{char-list}.
+Pass-through AutoGen argument
+@subsubheading base-name option (-b).
+@anchor{xml2ag base-name}
+@cindex xml2ag-base-name
+
+This is the ``base name for output file(s)'' option.
+This option takes an argument string @file{name}.
+Pass-through AutoGen argument
+@subsubheading source-time option.
+@anchor{xml2ag source-time}
+@cindex xml2ag-source-time
+
+This is the ``set mod times to latest source'' option.
+Pass-through AutoGen argument
+@subsubheading writable option.
+@anchor{xml2ag writable}
+@cindex xml2ag-writable
+
+This is the ``allow output files to be writable'' option.
+Pass-through AutoGen argument
+@subsubheading loop-limit option.
+@anchor{xml2ag loop-limit}
+@cindex xml2ag-loop-limit
+
+This is the ``limit on increment loops'' option.
+This option takes an argument number @file{lim}.
+Pass-through AutoGen argument
+@subsubheading timeout option (-t).
+@anchor{xml2ag timeout}
+@cindex xml2ag-timeout
+
+This is the ``time limit for server shell'' option.
+This option takes an argument number @file{time-lim}.
+Pass-through AutoGen argument
+@subsubheading trace option.
+@anchor{xml2ag trace}
+@cindex xml2ag-trace
+
+This is the ``tracing level of detail'' option.
+This option takes an argument keyword @file{level}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+This option takes a keyword as its argument.
+The argument sets an enumeration value that can be tested by comparing the option value macro (OPT_VALUE_TRACE).
+The available keywords are:
+@example
+ nothing debug-message server-shell
+ templates block-macros expressions
+ everything
+@end example
+
+or their numeric equivalent.@end itemize
+
+Pass-through AutoGen argument
+@subsubheading trace-out option.
+@anchor{xml2ag trace-out}
+@cindex xml2ag-trace-out
+
+This is the ``tracing output file or filter'' option.
+This option takes an argument string @file{file}.
+Pass-through AutoGen argument
+@subsubheading show-defs option.
+@anchor{xml2ag show-defs}
+@cindex xml2ag-show-defs
+
+This is the ``show the definition tree'' option.
+Pass-through AutoGen argument
+@subsubheading used-defines option.
+@anchor{xml2ag used-defines}
+@cindex xml2ag-used-defines
+
+This is the ``show the definitions used'' option.
+Pass-through AutoGen argument
+@subsubheading core option (-C).
+@anchor{xml2ag core}
+@cindex xml2ag-core
+
+This is the ``leave a core dump on a failure exit'' option.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+must be compiled in by defining @code{HAVE_SYS_RESOURCE_H} during the compilation.
+@end itemize
+
+Many systems default to a zero sized core limit. If the system
+has the sys/resource.h header and if this option is supplied,
+then in the failure exit path, autogen will attempt to set the
+soft core limit to whatever the hard core limit is. If that
+does not work, then an administrator must raise the hard core
+size limit.
+@subsubheading skip-suffix option (-s).
+@anchor{xml2ag skip-suffix}
+@cindex xml2ag-skip-suffix
+
+This is the ``omit the file with this suffix'' option.
+This option takes an argument string @file{suffix}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@item
+must not appear in combination with any of the following options:
+select-suffix.
+@end itemize
+
+Pass-through AutoGen argument
+@subsubheading select-suffix option (-o).
+@anchor{xml2ag select-suffix}
+@cindex xml2ag-select-suffix
+
+This is the ``specify this output suffix'' option.
+This option takes an argument string @file{suffix}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+Pass-through AutoGen argument
+@subsubheading define option (-D).
+@anchor{xml2ag define}
+@cindex xml2ag-define
+
+This is the ``name to add to definition list'' option.
+This option takes an argument string @file{value}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+Pass-through AutoGen argument
+@subsubheading undefine option (-U).
+@anchor{xml2ag undefine}
+@cindex xml2ag-undefine
+
+This is the ``definition list removal pattern'' option.
+This option takes an argument string @file{name-pat}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+Pass-through AutoGen argument
+@subsubheading make-dep option (-M).
+@anchor{xml2ag make-dep}
+@cindex xml2ag-make-dep
+
+This is the ``emit make dependency file'' option.
+This option takes an optional argument string @file{type}.
+
+@noindent
+This option has some usage constraints. It:
+@itemize @bullet
+@item
+may appear an unlimited number of times.
+@end itemize
+
+Pass-through AutoGen argument
+@node xml2ag exit status
+@subsection xml2ag exit status
+
+One of the following exit values will be returned:
+@table @samp
+@item 0 (EXIT_SUCCESS)
+Successful program execution.
+@item 1 (EXIT_OPTION_ERROR)
+The command options were misconfigured.
+@item 2 (EXIT_BAD_TEMPLATE)
+An error was encountered processing the template.
+@item 3 (EXIT_BAD_DEFINITIONS)
+The definitions could not be deciphered.
+@item 4 (EXIT_LOAD_ERROR)
+An error was encountered during the load phase.
+@item 5 (EXIT_SIGNAL)
+Program exited due to catching a signal. If your template includes
+string formatting, a number argument to a "%s" formatting element will
+trigger a segmentation fault. Autogen will catch the seg fault signal
+and exit with @code{AUTOGEN_EXIT_SIGNAL(5)}. Alternatively, AutoGen
+may have been interrupted with a @code{kill(2)} signal.
+@end table
diff --git a/doc/libopts.texi b/doc/libopts.texi
new file mode 100644
index 0000000..a09ac44
--- /dev/null
+++ b/doc/libopts.texi
@@ -0,0 +1,901 @@
+@node libopts procedures
+@subsection libopts External Procedures
+
+These are the routines that libopts users may call directly from their
+code. There are several other routines that can be called by code
+generated by the libopts option templates, but they are not to be
+called from any other user code. The @file{options.h} header is
+fairly clear about this, too.
+
+@menu
+* libopts-ao_string_tokenize:: ao_string_tokenize
+* libopts-configFileLoad:: configFileLoad
+* libopts-optionFileLoad:: optionFileLoad
+* libopts-optionFindNextValue:: optionFindNextValue
+* libopts-optionFindValue:: optionFindValue
+* libopts-optionFree:: optionFree
+* libopts-optionGetValue:: optionGetValue
+* libopts-optionLoadLine:: optionLoadLine
+* libopts-optionNextValue:: optionNextValue
+* libopts-optionOnlyUsage:: optionOnlyUsage
+* libopts-optionProcess:: optionProcess
+* libopts-optionRestore:: optionRestore
+* libopts-optionSaveFile:: optionSaveFile
+* libopts-optionSaveState:: optionSaveState
+* libopts-optionUnloadNested:: optionUnloadNested
+* libopts-optionVersion:: optionVersion
+* libopts-pathfind:: pathfind
+* libopts-strequate:: strequate
+* libopts-streqvcmp:: streqvcmp
+* libopts-streqvmap:: streqvmap
+* libopts-strneqvcmp:: strneqvcmp
+* libopts-strtransform:: strtransform
+@end menu
+
+This subsection was automatically generated by AutoGen
+using extracted information and the aginfo3.tpl template.
+
+@node libopts-ao_string_tokenize
+@subsubsection ao_string_tokenize
+@findex ao_string_tokenize
+
+tokenize an input string
+
+@noindent
+Usage:
+@example
+token_list_t* res = ao_string_tokenize( string );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab string @tab @code{char const*}
+@tab string to be tokenized
+@item @tab returns @tab token_list_t*
+@tab pointer to a structure that lists each token
+@end multitable
+
+This function will convert one input string into a list of strings.
+The list of strings is derived by separating the input based on
+white space separation. However, if the input contains either single
+or double quote characters, then the text after that character up to
+a matching quote will become the string in the list.
+
+The returned pointer should be deallocated with @code{free(3C)} when
+are done using the data. The data are placed in a single block of
+allocated memory. Do not deallocate individual token/strings.
+
+The structure pointed to will contain at least these two fields:
+@table @samp
+@item tkn_ct
+The number of tokens found in the input string.
+@item tok_list
+An array of @code{tkn_ct + 1} pointers to substring tokens, with
+the last pointer set to NULL.
+@end table
+
+There are two types of quoted strings: single quoted (@code{'}) and
+double quoted (@code{"}). Singly quoted strings are fairly raw in that
+escape characters (@code{\\}) are simply another character, except when
+preceding the following characters:
+@example
+@code{\\} double backslashes reduce to one
+@code{'} incorporates the single quote into the string
+@code{\n} suppresses both the backslash and newline character
+@end example
+
+Double quote strings are formed according to the rules of string
+constants in ANSI-C programs.
+
+NULL is returned and @code{errno} will be set to indicate the problem:
+@itemize @bullet
+@item
+@code{EINVAL} - There was an unterminated quoted string.
+@item
+@code{ENOENT} - The input string was empty.
+@item
+@code{ENOMEM} - There is not enough memory.
+@end itemize
+
+
+@node libopts-configFileLoad
+@subsubsection configFileLoad
+@findex configFileLoad
+
+parse a configuration file
+
+@noindent
+Usage:
+@example
+const tOptionValue* res = configFileLoad( pzFile );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pzFile @tab @code{char const*}
+@tab the file to load
+@item @tab returns @tab const tOptionValue*
+@tab An allocated, compound value structure
+@end multitable
+
+This routine will load a named configuration file and parse the
+text as a hierarchically valued option. The option descriptor
+created from an option definition file is not used via this interface.
+The returned value is "named" with the input file name and is of
+type "@code{OPARG_TYPE_HIERARCHY}". It may be used in calls to
+@code{optionGetValue()}, @code{optionNextValue()} and
+@code{optionUnloadNested()}.
+
+If the file cannot be loaded or processed, @code{NULL} is returned and
+@var{errno} is set. It may be set by a call to either @code{open(2)}
+@code{mmap(2)} or other file system calls, or it may be:
+@itemize @bullet
+@item
+@code{ENOENT} - the file was not found.
+@item
+@code{ENOMSG} - the file was empty.
+@item
+@code{EINVAL} - the file contents are invalid -- not properly formed.
+@item
+@code{ENOMEM} - not enough memory to allocate the needed structures.
+@end itemize
+
+
+@node libopts-optionFileLoad
+@subsubsection optionFileLoad
+@findex optionFileLoad
+
+Load the locatable config files, in order
+
+@noindent
+Usage:
+@example
+int res = optionFileLoad( pOpts, pzProg );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+
+@item @tab pzProg @tab @code{char const*}
+@tab program name
+@item @tab returns @tab int
+@tab 0 -> SUCCESS, -1 -> FAILURE
+@end multitable
+
+This function looks in all the specified directories for a configuration
+file ("rc" file or "ini" file) and processes any found twice. The first
+time through, they are processed in reverse order (last file first). At
+that time, only "immediate action" configurables are processed. For
+example, if the last named file specifies not processing any more
+configuration files, then no more configuration files will be processed.
+Such an option in the @strong{first} named directory will have no effect.
+
+Once the immediate action configurables have been handled, then the
+directories are handled in normal, forward order. In that way, later
+config files can override the settings of earlier config files.
+
+See the AutoOpts documentation for a thorough discussion of the
+config file format.
+
+Configuration files not found or not decipherable are simply ignored.
+
+Returns the value, "-1" if the program options descriptor
+is out of date or indecipherable. Otherwise, the value "0" will
+always be returned.
+
+
+@node libopts-optionFindNextValue
+@subsubsection optionFindNextValue
+@findex optionFindNextValue
+
+find a hierarcicaly valued option instance
+
+@noindent
+Usage:
+@example
+const tOptionValue* res = optionFindNextValue( pOptDesc, pPrevVal, name, value );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOptDesc @tab @code{const tOptDesc*}
+@tab an option with a nested arg type
+
+@item @tab pPrevVal @tab @code{const tOptionValue*}
+@tab the last entry
+
+@item @tab name @tab @code{char const*}
+@tab name of value to find
+
+@item @tab value @tab @code{char const*}
+@tab the matching value
+@item @tab returns @tab const tOptionValue*
+@tab a compound value structure
+@end multitable
+
+This routine will find the next entry in a nested value option or
+configurable. It will search through the list and return the next entry
+that matches the criteria.
+
+The returned result is NULL and errno is set:
+@itemize @bullet
+@item
+@code{EINVAL} - the @code{pOptValue} does not point to a valid
+hierarchical option value.
+@item
+@code{ENOENT} - no entry matched the given name.
+@end itemize
+
+
+@node libopts-optionFindValue
+@subsubsection optionFindValue
+@findex optionFindValue
+
+find a hierarcicaly valued option instance
+
+@noindent
+Usage:
+@example
+const tOptionValue* res = optionFindValue( pOptDesc, name, value );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOptDesc @tab @code{const tOptDesc*}
+@tab an option with a nested arg type
+
+@item @tab name @tab @code{char const*}
+@tab name of value to find
+
+@item @tab value @tab @code{char const*}
+@tab the matching value
+@item @tab returns @tab const tOptionValue*
+@tab a compound value structure
+@end multitable
+
+This routine will find an entry in a nested value option or configurable.
+It will search through the list and return a matching entry.
+
+The returned result is NULL and errno is set:
+@itemize @bullet
+@item
+@code{EINVAL} - the @code{pOptValue} does not point to a valid
+hierarchical option value.
+@item
+@code{ENOENT} - no entry matched the given name.
+@end itemize
+
+
+@node libopts-optionFree
+@subsubsection optionFree
+@findex optionFree
+
+free allocated option processing memory
+
+@noindent
+Usage:
+@example
+optionFree( pOpts );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+@end multitable
+
+AutoOpts sometimes allocates memory and puts pointers to it in the
+option state structures. This routine deallocates all such memory.
+
+As long as memory has not been corrupted,
+this routine is always successful.
+
+
+@node libopts-optionGetValue
+@subsubsection optionGetValue
+@findex optionGetValue
+
+get a specific value from a hierarcical list
+
+@noindent
+Usage:
+@example
+const tOptionValue* res = optionGetValue( pOptValue, valueName );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOptValue @tab @code{const tOptionValue*}
+@tab a hierarchcal value
+
+@item @tab valueName @tab @code{char const*}
+@tab name of value to get
+@item @tab returns @tab const tOptionValue*
+@tab a compound value structure
+@end multitable
+
+This routine will find an entry in a nested value option or configurable.
+If "valueName" is NULL, then the first entry is returned. Otherwise,
+the first entry with a name that exactly matches the argument will be
+returned. If there is no matching value, NULL is returned and errno is
+set to ENOENT. If the provided option value is not a hierarchical value,
+NULL is also returned and errno is set to EINVAL.
+
+The returned result is NULL and errno is set:
+@itemize @bullet
+@item
+@code{EINVAL} - the @code{pOptValue} does not point to a valid
+hierarchical option value.
+@item
+@code{ENOENT} - no entry matched the given name.
+@end itemize
+
+
+@node libopts-optionLoadLine
+@subsubsection optionLoadLine
+@findex optionLoadLine
+
+process a string for an option name and value
+
+@noindent
+Usage:
+@example
+optionLoadLine( opts, line );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab opts @tab @code{tOptions*}
+@tab program options descriptor
+
+@item @tab line @tab @code{char const*}
+@tab NUL-terminated text
+@end multitable
+
+This is a client program callable routine for setting options from, for
+example, the contents of a file that they read in. Only one option may
+appear in the text. It will be treated as a normal (non-preset) option.
+
+When passed a pointer to the option struct and a string, it will find
+the option named by the first token on the string and set the option
+argument to the remainder of the string. The caller must NUL terminate
+the string. The caller need not skip over any introductory hyphens.
+Any embedded new lines will be included in the option
+argument. If the input looks like one or more quoted strings, then the
+input will be "cooked". The "cooking" is identical to the string
+formation used in AutoGen definition files (@pxref{basic expression}),
+except that you may not use backquotes.
+
+Invalid options are silently ignored. Invalid option arguments
+will cause a warning to print, but the function should return.
+
+
+@node libopts-optionNextValue
+@subsubsection optionNextValue
+@findex optionNextValue
+
+get the next value from a hierarchical list
+
+@noindent
+Usage:
+@example
+const tOptionValue* res = optionNextValue( pOptValue, pOldValue );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOptValue @tab @code{const tOptionValue*}
+@tab a hierarchcal list value
+
+@item @tab pOldValue @tab @code{const tOptionValue*}
+@tab a value from this list
+@item @tab returns @tab const tOptionValue*
+@tab a compound value structure
+@end multitable
+
+This routine will return the next entry after the entry passed in. At the
+end of the list, NULL will be returned. If the entry is not found on the
+list, NULL will be returned and "@var{errno}" will be set to EINVAL.
+The "@var{pOldValue}" must have been gotten from a prior call to this
+routine or to "@code{opitonGetValue()}".
+
+The returned result is NULL and errno is set:
+@itemize @bullet
+@item
+@code{EINVAL} - the @code{pOptValue} does not point to a valid
+hierarchical option value or @code{pOldValue} does not point to a
+member of that option value.
+@item
+@code{ENOENT} - the supplied @code{pOldValue} pointed to the last entry.
+@end itemize
+
+
+@node libopts-optionOnlyUsage
+@subsubsection optionOnlyUsage
+@findex optionOnlyUsage
+
+Print usage text for just the options
+
+@noindent
+Usage:
+@example
+optionOnlyUsage( pOpts, ex_code );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+
+@item @tab ex_code @tab @code{int}
+@tab exit code for calling exit(3)
+@end multitable
+
+This routine will print only the usage for each option.
+This function may be used when the emitted usage must incorporate
+information not available to AutoOpts.
+
+
+@node libopts-optionProcess
+@subsubsection optionProcess
+@findex optionProcess
+
+this is the main option processing routine
+
+@noindent
+Usage:
+@example
+int res = optionProcess( pOpts, argc, argv );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+
+@item @tab argc @tab @code{int}
+@tab program arg count
+
+@item @tab argv @tab @code{char**}
+@tab program arg vector
+@item @tab returns @tab int
+@tab the count of the arguments processed
+@end multitable
+
+This is the main entry point for processing options. It is intended
+that this procedure be called once at the beginning of the execution of
+a program. Depending on options selected earlier, it is sometimes
+necessary to stop and restart option processing, or to select completely
+different sets of options. This can be done easily, but you generally
+do not want to do this.
+
+The number of arguments processed always includes the program name.
+If one of the arguments is "--", then it is counted and the processing
+stops. If an error was encountered and errors are to be tolerated, then
+the returned value is the index of the argument causing the error.
+A hyphen by itself ("-") will also cause processing to stop and will
+@emph{not} be counted among the processed arguments. A hyphen by itself
+is treated as an operand. Encountering an operand stops option
+processing.
+
+Errors will cause diagnostics to be printed. @code{exit(3)} may
+or may not be called. It depends upon whether or not the options
+were generated with the "allow-errors" attribute, or if the
+ERRSKIP_OPTERR or ERRSTOP_OPTERR macros were invoked.
+
+
+@node libopts-optionRestore
+@subsubsection optionRestore
+@findex optionRestore
+
+restore option state from memory copy
+
+@noindent
+Usage:
+@example
+optionRestore( pOpts );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+@end multitable
+
+Copy back the option state from saved memory.
+The allocated memory is left intact, so this routine can be
+called repeatedly without having to call optionSaveState again.
+If you are restoring a state that was saved before the first call
+to optionProcess(3AO), then you may change the contents of the
+argc/argv parameters to optionProcess.
+
+If you have not called @code{optionSaveState} before, a diagnostic is
+printed to @code{stderr} and exit is called.
+
+
+@node libopts-optionSaveFile
+@subsubsection optionSaveFile
+@findex optionSaveFile
+
+saves the option state to a file
+
+@noindent
+Usage:
+@example
+optionSaveFile( pOpts );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+@end multitable
+
+This routine will save the state of option processing to a file. The name
+of that file can be specified with the argument to the @code{--save-opts}
+option, or by appending the @code{rcfile} attribute to the last
+@code{homerc} attribute. If no @code{rcfile} attribute was specified, it
+will default to @code{.@i{programname}rc}. If you wish to specify another
+file, you should invoke the @code{SET_OPT_SAVE_OPTS(@i{filename})} macro.
+
+The recommend usage is as follows:
+@example
+optionProcess(&progOptions, argc, argv);
+if (i_want_a_non_standard_place_for_this)
+SET_OPT_SAVE_OPTS("myfilename");
+optionSaveFile(&progOptions);
+@end example
+
+If no @code{homerc} file was specified, this routine will silently return
+and do nothing. If the output file cannot be created or updated, a message
+will be printed to @code{stderr} and the routine will return.
+
+
+@node libopts-optionSaveState
+@subsubsection optionSaveState
+@findex optionSaveState
+
+saves the option state to memory
+
+@noindent
+Usage:
+@example
+optionSaveState( pOpts );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOpts @tab @code{tOptions*}
+@tab program options descriptor
+@end multitable
+
+This routine will allocate enough memory to save the current option
+processing state. If this routine has been called before, that memory
+will be reused. You may only save one copy of the option state. This
+routine may be called before optionProcess(3AO). If you do call it
+before the first call to optionProcess, then you may also change the
+contents of argc/argv after you call optionRestore(3AO)
+
+In fact, more strongly put: it is safest to only use this function
+before having processed any options. In particular, the saving and
+restoring of stacked string arguments and hierarchical values is
+disabled. The values are not saved.
+
+If it fails to allocate the memory,
+it will print a message to stderr and exit.
+Otherwise, it will always succeed.
+
+
+@node libopts-optionUnloadNested
+@subsubsection optionUnloadNested
+@findex optionUnloadNested
+
+Deallocate the memory for a nested value
+
+@noindent
+Usage:
+@example
+optionUnloadNested( pOptVal );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab pOptVal @tab @code{tOptionValue const *}
+@tab the hierarchical value
+@end multitable
+
+A nested value needs to be deallocated. The pointer passed in should
+have been gotten from a call to @code{configFileLoad()} (See
+@pxref{libopts-configFileLoad}).
+
+
+@node libopts-optionVersion
+@subsubsection optionVersion
+@findex optionVersion
+
+return the compiled AutoOpts version number
+
+@noindent
+Usage:
+@example
+char const* res = optionVersion();
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab returns @tab char const*
+@tab the version string in constant memory
+@end multitable
+
+Returns the full version string compiled into the library.
+The returned string cannot be modified.
+
+
+@node libopts-pathfind
+@subsubsection pathfind
+@findex pathfind
+
+fild a file in a list of directories
+
+@noindent
+Usage:
+@example
+char* res = pathfind( path, file, mode );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab path @tab @code{char const*}
+@tab colon separated list of search directories
+
+@item @tab file @tab @code{char const*}
+@tab the name of the file to look for
+
+@item @tab mode @tab @code{char const*}
+@tab the mode bits that must be set to match
+@item @tab returns @tab char*
+@tab the path to the located file
+@end multitable
+
+pathfind looks for a a file with name "FILE" and "MODE" access
+along colon delimited "PATH", and returns the full pathname as a
+string, or NULL if not found. If "FILE" contains a slash, then
+it is treated as a relative or absolute path and "PATH" is ignored.
+
+@strong{NOTE}: this function is compiled into @file{libopts} only if
+it is not natively supplied.
+
+The "MODE" argument is a string of option letters chosen from the
+list below:
+@example
+Letter Meaning
+r readable
+w writable
+x executable
+f normal file (NOT IMPLEMENTED)
+b block special (NOT IMPLEMENTED)
+c character special (NOT IMPLEMENTED)
+d directory (NOT IMPLEMENTED)
+p FIFO (pipe) (NOT IMPLEMENTED)
+u set user ID bit (NOT IMPLEMENTED)
+g set group ID bit (NOT IMPLEMENTED)
+k sticky bit (NOT IMPLEMENTED)
+s size nonzero (NOT IMPLEMENTED)
+@end example
+
+returns NULL if the file is not found.
+
+
+@node libopts-strequate
+@subsubsection strequate
+@findex strequate
+
+map a list of characters to the same value
+
+@noindent
+Usage:
+@example
+strequate( ch_list );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab ch_list @tab @code{char const*}
+@tab characters to equivalence
+@end multitable
+
+Each character in the input string get mapped to the first character
+in the string.
+This function name is mapped to option_strequate so as to not conflict
+with the POSIX name space.
+
+none.
+
+
+@node libopts-streqvcmp
+@subsubsection streqvcmp
+@findex streqvcmp
+
+compare two strings with an equivalence mapping
+
+@noindent
+Usage:
+@example
+int res = streqvcmp( str1, str2 );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab str1 @tab @code{char const*}
+@tab first string
+
+@item @tab str2 @tab @code{char const*}
+@tab second string
+@item @tab returns @tab int
+@tab the difference between two differing characters
+@end multitable
+
+Using a character mapping, two strings are compared for "equivalence".
+Each input character is mapped to a comparison character and the
+mapped-to characters are compared for the two NUL terminated input strings.
+This function name is mapped to option_streqvcmp so as to not conflict
+with the POSIX name space.
+
+none checked. Caller responsible for seg faults.
+
+
+@node libopts-streqvmap
+@subsubsection streqvmap
+@findex streqvmap
+
+Set the character mappings for the streqv functions
+
+@noindent
+Usage:
+@example
+streqvmap( From, To, ct );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab From @tab @code{char}
+@tab Input character
+
+@item @tab To @tab @code{char}
+@tab Mapped-to character
+
+@item @tab ct @tab @code{int}
+@tab compare length
+@end multitable
+
+Set the character mapping. If the count (@code{ct}) is set to zero, then
+the map is cleared by setting all entries in the map to their index
+value. Otherwise, the "@code{From}" character is mapped to the "@code{To}"
+character. If @code{ct} is greater than 1, then @code{From} and @code{To}
+are incremented and the process repeated until @code{ct} entries have been
+set. For example,
+@example
+streqvmap('a', 'A', 26);
+@end example
+@noindent
+will alter the mapping so that all English lower case letters
+will map to upper case.
+
+This function name is mapped to option_streqvmap so as to not conflict
+with the POSIX name space.
+
+none.
+
+
+@node libopts-strneqvcmp
+@subsubsection strneqvcmp
+@findex strneqvcmp
+
+compare two strings with an equivalence mapping
+
+@noindent
+Usage:
+@example
+int res = strneqvcmp( str1, str2, ct );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab str1 @tab @code{char const*}
+@tab first string
+
+@item @tab str2 @tab @code{char const*}
+@tab second string
+
+@item @tab ct @tab @code{int}
+@tab compare length
+@item @tab returns @tab int
+@tab the difference between two differing characters
+@end multitable
+
+Using a character mapping, two strings are compared for "equivalence".
+Each input character is mapped to a comparison character and the
+mapped-to characters are compared for the two NUL terminated input strings.
+The comparison is limited to @code{ct} bytes.
+This function name is mapped to option_strneqvcmp so as to not conflict
+with the POSIX name space.
+
+none checked. Caller responsible for seg faults.
+
+
+@node libopts-strtransform
+@subsubsection strtransform
+@findex strtransform
+
+convert a string into its mapped-to value
+
+@noindent
+Usage:
+@example
+strtransform( dest, src );
+@end example
+@noindent
+Where the arguments are:
+@multitable @columnfractions .05 .15 .20 .55
+@item @tab Name @tab Type @tab Description
+@item @tab ----- @tab ----- @tab -------------
+@item @tab dest @tab @code{char*}
+@tab output string
+
+@item @tab src @tab @code{char const*}
+@tab input string
+@end multitable
+
+Each character in the input string is mapped and the mapped-to
+character is put into the output.
+This function name is mapped to option_strtransform so as to not conflict
+with the POSIX name space.
+
+The source and destination may be the same.
+
+none.
+
diff --git a/doc/mk-agen-texi.sh b/doc/mk-agen-texi.sh
new file mode 100755
index 0000000..559ff13
--- /dev/null
+++ b/doc/mk-agen-texi.sh
@@ -0,0 +1,303 @@
+#! /bin/sh
+
+# Time-stamp: "2012-05-13 13:52:48 bkorb"
+#
+## This file is part of AutoGen.
+##
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+d=`dirname $0`
+d=`cd $d ; pwd`
+prog=${d}/`basename $0`
+parent_pid=$$
+
+die()
+{
+ exec 2>&8 1>&2 8>&-
+ echo "mk-agen-texi FAILED: $*"
+ echo
+ cat ${LOG_FILE}
+ trap : EXIT
+ echo leaving ${TMPDIR} in place
+ kill -TERM ${parent_pid}
+ exit 1
+}
+
+set_config_values()
+{
+ TMPDIR=`pwd`/ag-texi-$$.d
+ rm -rf ag-texi-*.d
+ mkdir ${TMPDIR} || die "cannot make ${TMPDIR} directory"
+ export TMPDIR
+
+ case "$-" in
+ *x* ) trap "echo 'saved tmp dir: ${TMPDIR}';chmod 777 ${TMPDIR}" EXIT
+ VERBOSE=true ;;
+ * ) trap "rm -rf ${TMPDIR}" EXIT
+ VERBOSE=false ;;
+ esac
+
+ LOG_FILE=${TMPDIR}/texi.log
+
+ exec 8>&2 2> ${LOG_FILE}
+
+ nl='
+' ht=' '
+ . ${top_builddir}/config/shdefs
+
+ test -z "${MAKE}" && MAKE=`which make`
+
+ srcdir=`cd ${srcdir} >/dev/null ; pwd`
+ INCLUDES="${DEFS} "`
+
+ for d in ${top_srcdir} ${top_builddir} \
+ ${top_builddir}/autoopts ${top_srcdir}/autoopts
+ do
+ (\cd ${d} && pwd) 2>/dev/null
+ done | \
+ sort -u | \
+ sed s/^/-I/ `
+
+ CFLAGS="${INCLUDES} "`echo ${CFLAGS} | \
+ ${SED:-sed} -e "s/-Werror[^ ${ht}]*//g;s/-Wextra//g"`
+
+ LIBS=-L`
+ test -d ${top_builddir}/autoopts/.libs \
+ && echo ${top_builddir}/autoopts/.libs \
+ || echo ${top_builddir}/autoopts
+ `" $LIBS"
+
+ export CC CFLAGS LIBS MAKE LOG_FILE TMPDIR
+}
+
+setup_exports()
+{
+ # Now auto-export variables:
+ #
+ set -a
+
+ PATH=${top_builddir}/columns:${PATH}
+ timer=`expr ${AG_TIMEOUT} '*' 5`
+ d=`find ${top_builddir}/autoopts -type f -name libopts.a -print`
+ test -f "$d" || die "Cannot locate libopts.a"
+ LIBS="$d ${LIBS}"
+
+ eval `${EGREP} '^AG_[A-Z_]*' ${top_srcdir}/VERSION`
+
+ AGsrc=${top_srcdir}/agen5
+ OPTIONS_DEF=${AGsrc}/opts.def
+ GETDEF_SRC=`${FGREP} -l '/*=' ${AGsrc}/*.[ch] ${AGsrc}/*.scm`
+
+ AGEN_TEXI=${top_builddir}/agen5/invoke-autogen.texi
+ DOC_TEXT=${top_srcdir}/doc/autogen-texi.txt
+
+ ADDON_TEXI="
+ ${top_builddir}/columns/invoke-columns.texi
+ ${top_builddir}/getdefs/invoke-getdefs.texi
+ ${top_builddir}/xml2ag/invoke-xml2ag.texi
+ ${top_srcdir}/doc/snprintfv.texi"
+
+ DOC_INCLUDES="
+ ${AGsrc}/defParse-fsm.c
+ ${AGsrc}/opts.h
+ ${top_builddir}/autoopts/libopts.texi
+ ${top_srcdir}/doc/autogen-intro.texi
+ ${AGEN_TEXI}"
+
+ DOC_TEMPLATE=${top_builddir}/doc/auto_gen.tpl
+
+ DOC_DEPENDS=`
+ echo ${DOC_TEMPLATE} ${OPTIONS_DEF} ${ADDON_MENU} ${ADDON_TEXI} \
+ ${DOC_INCLUDES} ${GETDEF_SRC} ${DOC_TEXT}`
+
+ set +a
+}
+
+# We have our executables and texi's. Collect the definitions:
+#
+run_getdefs()
+{
+ gd_cfg=${TMPDIR}/getdefs.cfg
+ exec 3> ${gd_cfg}
+ cat >&3 <<- EOCat
+ output ${TMPDIR}/${GEN_BASE}.def
+ copy ${OPTIONS_DEF}
+ srcfile
+ linenum
+ template auto_gen.tpl
+ assign ag-texi = invoke-autogen.texi
+ subblock exparg = arg_name,arg_desc,arg_optional,arg_list
+ EOCat
+
+ tf=invoke-autogen.texi
+ test -f ${tf} || ln -s ${AGEN_TEXI} ${tf}
+
+ for f in ${ADDON_TEXI}
+ do
+ tf=`basename ${f}`
+ case "$tf" in
+ invoke-* ) : ;;
+ * ) tf=invoke-$tf ;;
+ esac
+ test -f ${tf} || ln -s ${f} ${tf}
+ echo "assign addon-texi = ${tf}"
+ done >&3
+
+ for f in ${GETDEF_SRC}
+ do
+ echo "input " ${f}
+ done >&3
+ exec 3>&-
+ echo + ${GDexe} load-opt=${gd_cfg} >&8
+ ${GDexe} load-opt=${gd_cfg} || die cannot run ${GDexe}
+}
+
+sanity_check()
+{
+ # Make sure the executables are there
+ #
+ test -x ${AGexe} || (cd `dirname ${AGexe}` ; ${MAKE}) || exit 0
+ test -x ${GDexe} || (cd `dirname ${GDexe}` ; ${MAKE}) || exit 0
+ test -x ${CLexe} || (cd `dirname ${CLexe}` ; ${MAKE}) || exit 0
+ PATH="`dirname ${AGexe}`:`dirname ${CLexe}`:$PATH"
+
+ # See to it that the .texi files have been generated, too.
+ #
+ for f in ${ADDON_TEXI} ${AGEN_TEXI} \
+ ${top_builddir}/autoopts/libopts.texi
+ do
+ test -f ${f} || (
+ cd `dirname ${f}`
+ ${MAKE} `basename ${f}` >&2
+ test $? -ne 0 && die MAKE of ${f} failed.
+ )
+ done
+
+ # Make sure we have all our sources and generate the doc
+ #
+ for f in ${DOC_DEPENDS}
+ do test -f ${f} || die cannot find doc file: ${f}
+ test -f `basename $f` || ln -s $f .
+ done
+
+ cmd=${AGexe}
+ ${VERBOSE} && cmd=${cmd}" --trace=every --trace-out=>>${TMPDIR}/ag.log"
+}
+
+build_agdoc() {
+ # Validate everything:
+ #
+ set_config_values
+ setup_exports
+ sanity_check
+ run_getdefs
+
+ VERBOSE=true
+
+ env >&2
+ {
+ cat <<- _EOF_
+ timeout ${timer}
+ templ-dirs ${srcdir}
+ templ-dirs ${top_srcdir}/autoopts/tpl
+ base-name ${GEN_BASE}
+ make-dep F ${GEN_BASE}.dep
+ make-dep P
+ _EOF_
+ ${VERBOSE} && false && {
+ echo 'trace every'
+ echo "trace-out >>${TMPDIR}/ag.log"
+ }
+ } > ${TMPDIR}/ag.ini
+
+ opts="--load-opts=${TMPDIR}/ag.ini"
+ cmd=`echo "${cmd}" ${opts} ${TMPDIR}/${GEN_BASE}.def`
+ echo "${PS4:-+} " ${cmd} >&8
+
+ ${cmd} || {
+ cat ${TMPDIR}/ag.ini ${TMPDIR}/ag.log
+ die could not regenerate doc
+ } >&2
+
+ test -f ${GEN_BASE}.texi || die "MISSING: ${GEN_BASE}.texi"
+
+ exec 2>&8 8>&-
+}
+
+build_gnudocs()
+{
+ local sedcmd='/^@author @email/ {
+ s/.*{//
+ s/}.*//
+ s/@@*/@/g
+ p
+ q
+ }'
+
+ case "X$-" in
+ *x* ) local dashx=-x ;;
+ * ) local dashx= ;;
+ esac
+
+ title=`sed -n 's/^@title *//p' agdoc.texi`
+ email=--email' '`sed -n "$sedcmd" agdoc.texi`
+ opts="--texi2html ${email}"
+ PS4='>${FUNCNAME:-gd}> ' ${SHELL} ${dashx} \
+ ${top_srcdir}/config/gendocs.sh $opts autogen "$title"
+}
+
+mk_autogen_texi() {
+ tfile=autogen.texi
+ page_style=\
+'\internalpagesizes{46\baselineskip}{6in}{-.25in}{-.25in}{\bindingoffset}{36pt}%'
+
+ cat > ${tfile}$$ <<- _EOF_
+ \\input texinfo
+ @ignore
+ ${page_style}
+ @end ignore
+ @c %**start of header
+ @setfilename ${tfile%.texi}.info
+ @include ${GEN_BASE}.texi
+ _EOF_
+
+ if test -f ${tfile} && cmp -s ${tfile} ${tfile}$$
+ then rm -f ${tfile}$$
+ else mv -f ${tfile}$$ ${tfile}
+ fi
+}
+
+GEN_BASE=agdoc
+test "X$1" = X--force && {
+ rm -f agdoc.texi
+ shift
+}
+test -f agdoc.texi || build_agdoc
+mk_autogen_texi
+
+case "$1" in
+gnudocs | gnudoc ) build_gnudocs ;;
+* )
+esac
+
+exit 0
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
diff --git a/doc/snprintfv.texi b/doc/snprintfv.texi
new file mode 100644
index 0000000..380641c
--- /dev/null
+++ b/doc/snprintfv.texi
@@ -0,0 +1,74 @@
+@node snprintfv
+@section Replacement for Stdio Formatting Library
+
+ Using the `printf' formatting routines in a portable fashion has
+always been a pain, and this package has been way more pain than anyone
+ever imagined. Hopefully, with this release of snprintfv, the pain is
+now over for all time.
+
+ The issues with portable usage are these:
+
+@enumerate
+@item
+Argument number specifiers are often either not implemented or are
+buggy. Even GNU libc, version 1 got it wrong.
+
+@item
+ANSI/ISO "forgot" to provide a mechanism for computing argument
+lists for vararg procedures.
+
+@item
+The argument array version of printf (`printfv()') is not
+generally available, does not work with the native printf, and
+does not have a working argument number specifier in the format
+specification. (Last I knew, anyway.)
+
+@item
+You cannot fake varargs by calling `vprintf()' with an array of
+arguments, because ANSI does not require such an implementation
+and some vendors play funny tricks because they are allowed to.
+@end enumerate
+
+ These four issues made it impossible for AutoGen to ship without its
+own implementation of the `printf' formatting routines. Since we were
+forced to do this, we decided to make the formatting routines both
+better and more complete :-). We addressed these issues and added the
+following features to the common printf API:
+
+@enumerate 5
+@item
+The formatted output can be written to
+
+@itemize @bullet
+@item
+a string allocated by the formatting function (`asprintf()').
+@item
+a file descriptor instead of a file stream (`dprintf()').
+@item
+a user specified stream (`stream_printf()').
+@end itemize
+
+@item
+The formatting functions can be augmented with your own functions.
+These functions are allowed to consume more than one character
+from the format, but must commence with a unique character. For
+example,
+
+@example
+"%@{struct stat@}\n"
+@end example
+
+might be used with '@{' registered to a procedure that would look
+up "struct stat" in a symbol table and do appropriate things,
+consuming the format string through the '@}' character.
+@end enumerate
+
+ Gary V. Vaughan was generous enough to supply this implementation.
+Many thanks!!
+
+ For further details, the reader is referred to the snprintfv
+documentation. These functions are also available in the template
+processing as@: `sprintf' (@pxref{SCM sprintf}), `printf'
+(@pxref{SCM printf}), `fprintf' (@pxref{SCM fprintf}), and `shellf'
+(@pxref{SCM shellf}).
+
diff --git a/getdefs/Makefile.am b/getdefs/Makefile.am
new file mode 100644
index 0000000..825a127
--- /dev/null
+++ b/getdefs/Makefile.am
@@ -0,0 +1,93 @@
+## -*- Mode: Makefile -*-
+## ---------------------------------------------------------------------
+## Makefile.am -- process this file with automake to produce Makefile.in
+##
+## Time-stamp: "2012-03-04 19:21:12 bkorb"
+## Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+## ---------------------------------------------------------------------
+TARG = getdefs
+
+bin_PROGRAMS = getdefs
+gdsrcs = getdefs.h proto.h getdefs.c gdemit.c gdinit.c
+getdefs_SOURCES = proto.h
+BUILT_SOURCES = gd.c
+nodist_getdefs_SOURCES = $(BUILT_SOURCES)
+
+SUBDIRS = test
+EXTRA_DIST = opts.def $(gdsrcs)
+RUNAG = $(AGexe) -L$(top_srcdir)/autoopts/tpl \
+ -L$(top_builddir)/autoopts/tpl
+
+if AMDEP
+DEP_ARG = -MF$(DEPDIR)/opts-dep -MT$@ -MP
+INF_DEP = -b$(TARG) -MF$(DEPDIR)/info-dep -MT$@ -MP
+MAN_DEP = -b$(TARG) -MF$(DEPDIR)/man-dep -MTstamp-man -MP
+include $(DEPDIR)/opts-dep
+include $(DEPDIR)/info-dep
+include $(DEPDIR)/man-dep
+else
+DEP_ARG =
+INF_DEP =
+MAN_DEP =
+endif
+
+getdefs_LDADD = $(top_builddir)/autoopts/libopts.la
+man_MANS = $(TARG).1
+DOCFILES = $(TARG).texi $(TARG).menu $(TARG).1
+DISTCLEANFILES = $(DOCFILES) $(nodist_getdefs_SOURCES) *-stamp
+INCLUDES = @INCLIST@
+AG_ENV = top_builddir=$(top_builddir) \
+ top_srcdir=$(top_srcdir) PATH=`cd ../columns >/dev/null && pwd`:$$PATH ; \
+ export top_builddir top_srcdir PATH
+
+all : gen
+gen : $(BUILT_SOURCES) $(DOCFILES)
+
+gd.c : $(gdsrcs)
+ exec > $@ ; \
+ echo '#undef PKGDATADIR' ; \
+ echo '#define PKGDATADIR "$(pkgdatadir)"' ; \
+ echo ; echo '#define DEFINING 1' ; \
+ echo '#include "autoopts/project.h"' ; \
+ for f in opts.c $(gdsrcs) ; \
+ do echo "#include \"$$f\"" ; done
+
+$(getdefs_OBJECTS) opts.h opts.c : stamp-opts
+stamp-opts : opts.def
+ @test -x $(AGexe) || { cd ../agen5 && $(MAKE) $(AGnam) ; }
+ @test -x $(CLexe) || { cd ../columns && $(MAKE) $(CLnam) ; }
+ $(AG_ENV) ; DEPFILE=$(DEPFILE_opts) \
+ $(RUNAG) $(DEP_ARG) $(srcdir)/opts.def
+
+$(DOCFILES) : stamp-doc
+stamp-doc :
+ @test -x $(TARG)$(EXEEXT) || $(MAKE) $(TARG)$(EXEEXT)
+ @test -x $(AGexe) || { cd ../agen5 && $(MAKE) $(AGnam) ; }
+ @test -x $(CLexe) || { cd ../columns && $(MAKE) $(CLnam) ; }
+ $(AG_ENV) ; \
+ $(RUNAG) $(MAN_DEP) -Tagman-cmd $(srcdir)/opts.def ; \
+ $(RUNAG) $(INF_DEP) -Tagtexi-cmd -DLEVEL=section $(srcdir)/opts.def
+
+.NOTPARALLEL:
+
+.PHONY : local-maintainer-clean
+local-maintainer-clean : clean-stamp-opts clean-stamp-doc clean-stamp-man
+ rm -f *~
+
+# getdefs/Makefile.am ends here
diff --git a/getdefs/Makefile.in b/getdefs/Makefile.in
new file mode 100644
index 0000000..cc87383
--- /dev/null
+++ b/getdefs/Makefile.in
@@ -0,0 +1,891 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+bin_PROGRAMS = getdefs$(EXEEXT)
+subdir = getdefs
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_getdefs_OBJECTS =
+am__objects_1 = gd.$(OBJEXT)
+nodist_getdefs_OBJECTS = $(am__objects_1)
+getdefs_OBJECTS = $(am_getdefs_OBJECTS) $(nodist_getdefs_OBJECTS)
+getdefs_DEPENDENCIES = $(top_builddir)/autoopts/libopts.la
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(getdefs_SOURCES) $(nodist_getdefs_SOURCES)
+DIST_SOURCES = $(getdefs_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = @AGexe@
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = @CLexe@
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+TARG = getdefs
+gdsrcs = getdefs.h proto.h getdefs.c gdemit.c gdinit.c
+getdefs_SOURCES = proto.h
+BUILT_SOURCES = gd.c
+nodist_getdefs_SOURCES = $(BUILT_SOURCES)
+SUBDIRS = test
+EXTRA_DIST = opts.def $(gdsrcs)
+RUNAG = $(AGexe) -L$(top_srcdir)/autoopts/tpl \
+ -L$(top_builddir)/autoopts/tpl
+
+@AMDEP_FALSE@DEP_ARG =
+@AMDEP_TRUE@DEP_ARG = -MF$(DEPDIR)/opts-dep -MT$@ -MP
+@AMDEP_FALSE@INF_DEP =
+@AMDEP_TRUE@INF_DEP = -b$(TARG) -MF$(DEPDIR)/info-dep -MT$@ -MP
+@AMDEP_FALSE@MAN_DEP =
+@AMDEP_TRUE@MAN_DEP = -b$(TARG) -MF$(DEPDIR)/man-dep -MTstamp-man -MP
+getdefs_LDADD = $(top_builddir)/autoopts/libopts.la
+man_MANS = $(TARG).1
+DOCFILES = $(TARG).texi $(TARG).menu $(TARG).1
+DISTCLEANFILES = $(DOCFILES) $(nodist_getdefs_SOURCES) *-stamp
+INCLUDES = @INCLIST@
+AG_ENV = top_builddir=$(top_builddir) \
+ top_srcdir=$(top_srcdir) PATH=`cd ../columns >/dev/null && pwd`:$$PATH ; \
+ export top_builddir top_srcdir PATH
+
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu getdefs/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu getdefs/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+getdefs$(EXEEXT): $(getdefs_OBJECTS) $(getdefs_DEPENDENCIES) $(EXTRA_getdefs_DEPENDENCIES)
+ @rm -f getdefs$(EXEEXT)
+ $(LINK) $(getdefs_OBJECTS) $(getdefs_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gd.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-man1: $(man_MANS)
+ @$(NORMAL_INSTALL)
+ @list1=''; \
+ list2='$(man_MANS)'; \
+ test -n "$(man1dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.1[a-z]*$$/p'; \
+ fi; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man1dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.1[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+cscopelist-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @list='$(MANS)'; if test -n "$$list"; then \
+ list=`for p in $$list; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+ if test -n "$$list" && \
+ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+ echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \
+ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
+ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+ echo " typically 'make maintainer-clean' will remove them" >&2; \
+ exit 1; \
+ else :; fi; \
+ else :; fi
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man: install-man1
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-man
+
+uninstall-man: uninstall-man1
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
+ cscopelist-recursive ctags-recursive install install-am \
+ install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool cscopelist cscopelist-recursive \
+ ctags ctags-recursive distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-man1 install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-man uninstall-man1
+
+@AMDEP_TRUE@include $(DEPDIR)/opts-dep
+@AMDEP_TRUE@include $(DEPDIR)/info-dep
+@AMDEP_TRUE@include $(DEPDIR)/man-dep
+
+all : gen
+gen : $(BUILT_SOURCES) $(DOCFILES)
+
+gd.c : $(gdsrcs)
+ exec > $@ ; \
+ echo '#undef PKGDATADIR' ; \
+ echo '#define PKGDATADIR "$(pkgdatadir)"' ; \
+ echo ; echo '#define DEFINING 1' ; \
+ echo '#include "autoopts/project.h"' ; \
+ for f in opts.c $(gdsrcs) ; \
+ do echo "#include \"$$f\"" ; done
+
+$(getdefs_OBJECTS) opts.h opts.c : stamp-opts
+stamp-opts : opts.def
+ @test -x $(AGexe) || { cd ../agen5 && $(MAKE) $(AGnam) ; }
+ @test -x $(CLexe) || { cd ../columns && $(MAKE) $(CLnam) ; }
+ $(AG_ENV) ; DEPFILE=$(DEPFILE_opts) \
+ $(RUNAG) $(DEP_ARG) $(srcdir)/opts.def
+
+$(DOCFILES) : stamp-doc
+stamp-doc :
+ @test -x $(TARG)$(EXEEXT) || $(MAKE) $(TARG)$(EXEEXT)
+ @test -x $(AGexe) || { cd ../agen5 && $(MAKE) $(AGnam) ; }
+ @test -x $(CLexe) || { cd ../columns && $(MAKE) $(CLnam) ; }
+ $(AG_ENV) ; \
+ $(RUNAG) $(MAN_DEP) -Tagman-cmd $(srcdir)/opts.def ; \
+ $(RUNAG) $(INF_DEP) -Tagtexi-cmd -DLEVEL=section $(srcdir)/opts.def
+
+.NOTPARALLEL:
+
+.PHONY : local-maintainer-clean
+local-maintainer-clean : clean-stamp-opts clean-stamp-doc clean-stamp-man
+ rm -f *~
+
+# getdefs/Makefile.am ends here
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/getdefs/gdemit.c b/getdefs/gdemit.c
new file mode 100644
index 0000000..f6bfbbf
--- /dev/null
+++ b/getdefs/gdemit.c
@@ -0,0 +1,602 @@
+/**
+ * \file gdemit.c
+ *
+ * getdefs Copyright (c) 1999-2012 by Bruce Korb - all rights reserved
+ *
+ * Author: Bruce Korb <bkorb@gnu.org>
+ * Time-stamp: "2012-03-31 13:39:34 bkorb"
+ *
+ * This file is part of AutoGen.
+ * AutoGen copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* = = = START-STATIC-FORWARD = = = */
+static void
+compress_def(char * pz);
+
+static char *
+list_attrib(char * pzText, char * pzOut);
+
+static char *
+emit_quote(char ** ppzText, char * pzOut);
+
+static void
+next_def_entry(char ** txt_pp, char const ** def_pp);
+
+static void
+emit_attribute(char const ** def_pp, char ** out_pp);
+
+static char*
+emit_subblock(char const * pzDefList, char * pzText, char * pzOut);
+
+static char*
+subblock_str(char ** ppzText, uint_t sepChar, char * pzOut);
+/* = = = END-STATIC-FORWARD = = = */
+
+/*
+ * compress_def
+ *
+ * Compress the definition text. Each input line has some prefix
+ * stuff to ensure it is a comment as seen by the normal processor
+ * of the file. In "C", the entire block is surrounded by the
+ * '/'-'*' and '*'-'/' pairs. In shell, every line would start
+ * with a hash character ('#'). Etc. To make life easy, we require
+ * that every line be prefixed with something that matches the
+ * pattern:
+ *
+ * "^[^*]*\*+"
+ *
+ * and any line that does not is ignored. So, here we strip off
+ * that prefix before we go ahead and try to parse it.
+ */
+static void
+compress_def(char * pz)
+{
+ char * pzStrt = pz;
+ char * pzDest = pz;
+ char * pzSrc = pz;
+ int nlCt = 0;
+
+ /*
+ * Search until we find a line that contains an asterisk
+ * and is followed by something other than whitespace.
+ */
+ nlCt = 0;
+
+skip_leading_space:
+ while (isspace( *pzSrc )) {
+ if (*(pzSrc++) == '\n') {
+ nlCt++;
+ for (;;) {
+ switch (*(pzSrc++)) {
+ case '*':
+ while (*pzSrc == '*') pzSrc++;
+ goto skip_leading_space;
+
+ case NUL:
+ *pzStrt = NUL;
+ return;
+
+ case '\n':
+ nlCt++;
+ }
+ }
+ }
+ }
+
+ if (*pzSrc == NUL) {
+ *pzStrt = NUL;
+ return;
+ }
+
+ /*
+ * FOR as long as we still have more text, ...
+ */
+ for (;;) {
+ /*
+ * IF we passed over one or more newlines while looking for
+ * an asterisk, then insert one extra newline into the output
+ */
+ if (nlCt > 0) {
+ *pzDest++ = '\n';
+ nlCt = 0;
+ }
+
+ /*
+ * FOR all the data on the current input line, ...
+ */
+ for (;;) {
+ /*
+ * Move the source to destination until we find
+ * either a new-line or a NUL.
+ */
+ switch (*pzDest++ = *pzSrc++) {
+ case '\n':
+ if (*pzSrc != NUL)
+ goto lineDone;
+
+ case NUL:
+ pzDest--;
+ goto compressDone;
+
+ default:
+ ;
+ }
+ } lineDone:;
+
+ /*
+ * Trim trailing white space off the end of the line.
+ */
+ if ((pzDest[-2] == ' ') || (pzDest[-2] == '\t')) {
+ do {
+ pzDest--;
+ } while ((pzDest[-2] == ' ') || (pzDest[-2] == '\t'));
+ pzDest[-1] = '\n';
+ }
+
+ /*
+ * We found a new-line. Skip forward to an asterisk.
+ */
+ foundNewline:
+ while (*pzSrc != '*') {
+ if (*pzSrc == NUL)
+ goto compressDone;
+ if (*pzSrc == '\n')
+ nlCt++;
+ pzSrc++;
+ }
+
+ /*
+ * Skip over the asterisk we found and all the ones that follow
+ */
+ while (*pzSrc == '*') pzSrc++;
+ while (isspace( *pzSrc )) {
+ /*
+ * IF we stumble into another newline,
+ * THEN we go back to look for an asterisk.
+ */
+ if (*pzSrc == '\n')
+ goto foundNewline;
+ pzSrc++;
+ }
+ } compressDone:;
+
+ /*
+ * Trim off all the trailing white space, including newlines
+ */
+ while ((pzDest > pzStrt) && isspace( pzDest[-1] )) pzDest--;
+ *pzDest = NUL;
+}
+
+
+/*
+ * emitDefinition
+ */
+LOCAL char*
+emitDefinition(char* pzDef, char* pzOut)
+{
+ char sep_char;
+ char zEntryName[ MAXNAMELEN ];
+
+ /*
+ * Indent attribute definitions four spaces
+ */
+ {
+ char* p = zEntryName;
+ *pzOut++ = ' '; *pzOut++ = ' '; *pzOut++ = ' '; *pzOut++ = ' ';
+
+ while (AG_NAME_CHAR(*pzDef))
+ *p++ = *pzOut++ = *pzDef++;
+
+ if (p >= zEntryName + sizeof(zEntryName))
+ die("names are constrained to %d bytes\n", MAXNAMELEN);
+
+ *p = NUL;
+ }
+
+ /*
+ * Strip the prefixes from all the definition lines
+ * (viz., the "^.*\*" text, except that it is a shortest match
+ * instead of longest match). Skip the ':' before starting.
+ */
+ compress_def(++pzDef);
+
+ if (HAVE_OPT( SUBBLOCK )) {
+ int ct = STACKCT_OPT( SUBBLOCK );
+ char const ** ppz = STACKLST_OPT( SUBBLOCK );
+
+ do {
+ char const * pz = *ppz++;
+ if (strcmp(pz, zEntryName) == 0)
+ return emit_subblock(pz, pzDef, pzOut);
+ } while (--ct > 0);
+ }
+
+ if (HAVE_OPT( LISTATTR )) {
+ int ct = STACKCT_OPT( LISTATTR );
+ char const ** ppz = STACKLST_OPT( LISTATTR );
+
+ do {
+ if (strcmp(*ppz++, zEntryName) == 0)
+ return list_attrib(pzDef, pzOut);
+ } while (--ct > 0);
+ }
+
+ if (isspace(*pzDef))
+ sep_char = *pzDef++;
+ else sep_char = ' ';
+
+ switch (*pzDef) {
+ case NUL:
+ *pzOut++ = ';'; *pzOut++ = '\n';
+ break;
+
+ case '"':
+ case '\'':
+ case '{':
+ /*
+ * Quoted entries or subblocks do their own stringification
+ * sprintf is safe because we are copying strings around
+ * and *always* making the result smaller than the original
+ */
+ pzOut += sprintf(pzOut, " =%c%s;\n", sep_char, pzDef);
+ break;
+
+ default:
+ *pzOut++ = ' '; *pzOut++ = '='; *pzOut++ = sep_char;
+ *pzOut++ = '\'';
+
+ for (;;) {
+ switch (*pzOut++ = *pzDef++) {
+ case '\\':
+ *pzOut++ = '\\';
+ break;
+
+ case '\'':
+ pzOut[-1] = '\\';
+ *pzOut++ = '\'';
+ break;
+
+ case NUL:
+ goto unquotedDone;
+ }
+ } unquotedDone:;
+ pzOut[-1] = '\''; *pzOut++ = ';'; *pzOut++ = '\n';
+ break;
+ }
+ return pzOut;
+}
+
+
+/*
+ * list_attrib
+ */
+static char *
+list_attrib(char * pzText, char * pzOut)
+{
+ static char const zStart[] = " = ";
+
+ uint_t sepChar = ',';
+ int FirstAttr = 1;
+
+ strcpy(pzOut, zStart);
+ pzOut += sizeof(zStart) - 1;
+
+ /*
+ * See if there is an alternate separator character.
+ * It must be a punctuation character that is not also
+ * a quote character.
+ */
+ if (ispunct(*pzText) && (*pzText != '"') && (*pzText != '\''))
+ sepChar = (uint_t)*(pzText++);
+ while (isspace(*pzText)) pzText++;
+
+ /*
+ * Loop for as long as we have text entries
+ */
+ while (*pzText != NUL) {
+
+ if (FirstAttr)
+ FirstAttr = 0;
+ else
+ *(pzOut++) = ',';
+
+ /*
+ * If the first thing we find is the separator char,
+ * then emit the empty string.
+ */
+ if ((uint_t)*pzText == sepChar) {
+ *(pzOut++) = '\''; *(pzOut++) = '\'';
+ pzText++;
+ continue;
+ }
+
+ /*
+ * Emit whatever we have. The call will consume any trailing
+ * separator character.
+ */
+ pzOut = subblock_str(&pzText, sepChar, pzOut);
+ }
+
+ /*
+ * IF there were no definitions, THEN emit an empty one
+ */
+ if (FirstAttr)
+ pzOut -= sizeof(zStart) - 1;
+
+ *(pzOut++) = ';';
+ *(pzOut++) = '\n';
+
+ return pzOut;
+}
+
+
+/*
+ * The text is quoted, so copy it as is, ensuring that escaped
+ * characters are not used to end the quoted text.
+ */
+static char *
+emit_quote(char ** ppzText, char * pzOut)
+{
+ char* pzText = *ppzText;
+ char svch = (*pzOut++ = *pzText++);
+
+ for (;;) {
+ switch (*pzOut++ = *pzText++) {
+
+ case '\\':
+ if ((*pzOut++ = *pzText++) != NUL)
+ break;
+
+ case NUL:
+ pzText--;
+ pzOut[-1] = svch;
+ svch = NUL;
+ /* FALLTHROUGH */
+
+ case '"':
+ case '\'':
+ if (pzOut[-1] == svch)
+ goto quoteDone;
+
+ break;
+ }
+ }
+
+quoteDone:
+ *ppzText = pzText;
+ return pzOut;
+}
+
+static void
+next_def_entry(char ** txt_pp, char const ** def_pp)
+{
+ char const * p = *def_pp;
+ (*txt_pp)++;
+ for (;;) {
+ switch (*++p) {
+ case ' ': p++; /* FALLTHROUGH */
+ case NUL:
+ *def_pp = p;
+ return;
+ }
+ }
+}
+
+static void
+emit_attribute(char const ** def_pp, char ** out_pp)
+{
+ static char const pfx[] = "\n ";
+
+ char * out = *out_pp;
+ char const * def = *def_pp;
+
+ memcpy(out, pfx, sizeof(pfx) - 1);
+ out += sizeof(pfx) - 1;
+
+ for (;;) {
+ *out++ = *def++;
+ switch (*def) {
+ case ' ': def++; /* FALLTHROUGH */
+ case NUL:
+ goto leave_emit_attribute;
+ }
+ }
+
+leave_emit_attribute:
+
+ *out++ = ';';
+ *out_pp = out;
+ *def_pp = def;
+}
+
+/*
+ * emit_subblock
+ */
+static char*
+emit_subblock(char const * pzDefList, char * pzText, char * pzOut)
+{
+ static char const zStart[] = " = {";
+ static char const zEnd[] = "\n };\n";
+
+ uint_t sepChar = ',';
+ int FirstAttr = 1;
+
+ /*
+ * Advance past subblock name to the entry name list
+ */
+ pzDefList += strlen(pzDefList) + 1;
+ strcpy(pzOut, zStart);
+ pzOut += sizeof(zStart) - 1;
+
+ /*
+ * See if there is an alternate separator character.
+ * It must be a punctuation character that is not also
+ * a quote character.
+ */
+ if (ispunct(*pzText) && (*pzText != '"') && (*pzText != '\''))
+ sepChar = (uint_t)*(pzText++);
+
+ /*
+ * Loop for as long as we have text entries and subblock
+ * attribute names, ...
+ */
+ do {
+ /*
+ * IF the first character is the separator,
+ * THEN this entry is skipped.
+ */
+ if ((uint_t)*pzText == sepChar) {
+ next_def_entry(&pzText, &pzDefList);
+ continue;
+ }
+
+ /*
+ * Skip leading white space in the attribute and check for done.
+ */
+ while (isspace(*pzText)) pzText++;
+ if (*pzText == NUL) {
+ /*
+ * IF there were no definitions, THEN emit one anyway
+ */
+ if (FirstAttr)
+ emit_attribute(&pzDefList, &pzOut);
+
+ break;
+ }
+
+ /*
+ * Copy out the attribute name
+ */
+ emit_attribute(&pzDefList, &pzOut);
+ FirstAttr = 0;
+
+ /*
+ * IF there are no data for this attribute,
+ * THEN we leave the definition empty.
+ */
+ if ((uint_t)*pzText == sepChar) {
+ pzText++;
+ continue;
+ }
+
+ /*
+ * Copy out the assignment operator and emit the string
+ */
+ pzOut[-1] = ' '; *pzOut++ = '='; *pzOut++ = ' ';
+ pzOut = subblock_str(&pzText, sepChar, pzOut);
+ *pzOut++ = ';';
+
+ } while (isalpha(*pzDefList));
+
+ memcpy(pzOut, zEnd, sizeof(zEnd));
+ return pzOut + sizeof(zEnd) - 1;
+}
+
+
+/*
+ * Emit a string in a fashion that autogen will be able to
+ * correctly reconstruct it.
+ */
+static char*
+subblock_str(char ** ppzText, uint_t sepChar, char * pzOut)
+{
+ char * pzText = *ppzText;
+ char * pcComma;
+ char * pcEnd;
+
+ /*
+ * Skip leading space
+ */
+ while (isspace(*pzText)) pzText++;
+
+ /*
+ * IF the text is already quoted,
+ * THEN call the quoted text emitting routine
+ */
+ if ((*pzText == '"') || (*pzText == '\'')) {
+ pzOut = emit_quote(&pzText, pzOut);
+
+ /*
+ * Make sure we strip off trailing white space and any
+ * separation character.
+ */
+ while (isspace(*pzText)) pzText++;
+ if ((uint_t)*pzText == sepChar) {
+ pzText++;
+ while (isspace(*pzText)) pzText++;
+ }
+ *ppzText = pzText;
+ return pzOut;
+ }
+
+ /*
+ * Look for the character that separates this entry text
+ * from the entry text for the next attribute. Leave 'pcComma'
+ * pointing to the character _before_ the character where we
+ * are to resume our text scan. (i.e. at the comma, or the
+ * last character in the string)
+ */
+ pcComma = strchr(pzText, (int)sepChar);
+ if (pcComma == (char*)NULL) {
+ pcEnd = pzText + strlen(pzText);
+ pcComma = pcEnd-1;
+ } else {
+ pcEnd = pcComma;
+ }
+
+ /*
+ * Clean off trailing white space.
+ */
+ while ((pcEnd > pzText) && isspace(pcEnd[-1])) pcEnd--;
+
+ /*
+ * Copy the text, surrounded by single quotes
+ */
+ *pzOut++ = '\'';
+ {
+ char svch = *pcEnd;
+ *pcEnd = NUL;
+ for (;;) {
+ char ch = *pzText++;
+ switch (ch) {
+ case '\'':
+ *pzOut++ = '\\';
+ default:
+ *pzOut++ = ch;
+ break;
+ case NUL:
+ goto copyDone;
+ }
+ } copyDone: ;
+
+ pzText = pcComma+1;
+ *pcEnd = svch;
+ }
+
+ *pzOut++ = '\'';
+ while (isspace(*pzText)) pzText++;
+ *ppzText = pzText;
+ return pzOut;
+}
+
+/* emacs
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of getdefs/gdemit.c */
diff --git a/getdefs/gdinit.c b/getdefs/gdinit.c
new file mode 100644
index 0000000..321a582
--- /dev/null
+++ b/getdefs/gdinit.c
@@ -0,0 +1,490 @@
+/**
+ * \file gdinit.c
+ *
+ * getdefs Copyright (c) 1999-2012 by Bruce Korb - all rights reserved
+ *
+ * Author: Bruce Korb <bkorb@gnu.org>
+ * Time-stamp: "2011-12-29 10:02:47 bkorb"
+ *
+ * This file is part of AutoGen.
+ * AutoGen copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+static char const zNoList[] = "ERROR: block attr must have name list:\n\t%s\n";
+
+/* = = = START-STATIC-FORWARD = = = */
+static char*
+compressOptionText(char* pzS, char* pzE);
+
+static char*
+fixupSubblockString(char const * pzSrc);
+
+static void
+loadStdin(void);
+
+static void
+set_define_re(void);
+
+static void
+set_modtime(void);
+/* = = = END-STATIC-FORWARD = = = */
+
+LOCAL void
+die(char const * fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ fprintf(stderr, "%s error: ", getdefsOptions.pzProgName);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(EXIT_FAILURE);
+}
+
+LOCAL void
+fserr_die(char const * fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ fprintf(stderr, "%s fserr %d (%s): ", getdefsOptions.pzProgName,
+ errno, strerror(errno));
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(EXIT_FAILURE);
+}
+
+/*
+ * compressOptionText
+ */
+static char*
+compressOptionText(char* pzS, char* pzE)
+{
+ char* pzR = pzS; /* result */
+ char* pzD = pzS; /* destination */
+
+ for (;;) {
+ char ch;
+
+ if (pzS >= pzE)
+ break;
+
+ ch = (*(pzD++) = *(pzS++));
+
+ /*
+ * IF At end of line, skip to next '*'
+ */
+ if (ch == '\n') {
+ while (*pzS != '*') {
+ pzS++;
+ if (pzS >= pzE)
+ goto compressDone;
+ }
+ }
+ } compressDone:;
+
+ {
+ size_t len = (pzD - pzR);
+ pzD = malloc(len + 1);
+ if (pzD == NULL)
+ die("cannot dup %d byte string\n", (int)(pzD - pzR));
+
+ memcpy(pzD, pzR, len);
+ pzD[ len ] = NUL;
+ }
+
+ /*
+ * Blank out trailing data.
+ */
+ while (pzS < pzE) *(pzS++) = ' ';
+ return pzD;
+}
+
+
+/*
+ * fixupSubblockString
+ */
+static char*
+fixupSubblockString(char const * pzSrc)
+{
+ char * pzString;
+ char * pzDest;
+ char * pzCopy;
+
+ pzString = strdup(pzSrc);
+
+ /*
+ * Make sure we find the '=' separator
+ */
+ {
+ char * p = strchr(pzString, '=');
+ if (p == NULL)
+ die(zNoList, pzString);
+
+ /*
+ * Trim the name
+ */
+ pzDest = p++;
+ while ((pzDest > pzString) && IS_HORIZ_WHITE_CHAR(pzDest[-1])) pzDest--;
+ *(pzDest++) = NUL;
+
+ /*
+ * Make sure at least one attribute name is defined
+ */
+ while (IS_WHITESPACE_CHAR(*p)) p++;
+ if (*p == NUL)
+ die(zNoList, pzString);
+
+ pzCopy = p;
+ }
+
+ for (;;) {
+ /*
+ * Attribute names must start with an alpha
+ */
+ if (! IS_ALPHABETIC_CHAR(*pzCopy)) {
+ fprintf(stderr, "ERROR: attribute names must start "
+ "with an alphabetic character:\n\t%s\n",
+ pzString);
+ USAGE(EXIT_FAILURE);
+ }
+
+ /*
+ * Copy the name.
+ */
+ while (IS_OPTION_NAME_CHAR(*pzCopy))
+ *pzDest++ = *pzCopy++;
+
+ /*
+ * Skip over one comma (optional) and any white space.
+ * If there is a newline, it must be after the comma.
+ */
+ while (IS_HORIZ_WHITE_CHAR(*pzCopy)) pzCopy++;
+ if (*pzCopy == ',')
+ pzCopy++;
+
+ while (IS_WHITESPACE_CHAR(*pzCopy)) pzCopy++;
+ if (*pzCopy == NUL)
+ break;
+ /*
+ * The final string contains only one space between attributes
+ */
+ *pzDest++ = ' ';
+ }
+
+ *pzDest = NUL;
+
+ return pzString;
+}
+
+
+/*
+ * loadStdin
+ *
+ * The input file list is from stdin.
+ *
+ * We make some simplifying assumptions:
+ * *ALL* input lines are less than 4096 bytes. If this is not true,
+ * we may strip some white space in the middle of a line and presume
+ * a comment begins in the middle of a line or we only comment out
+ * the first 4096 bytes of a comment line. So, rather than all these
+ * problems, we just choke on it.
+ */
+static void
+loadStdin(void)
+{
+ char z[ 4096 ];
+ int ct = 0;
+ tCC** ppz = STACKLST_OPT(INPUT);
+
+ if (isatty(STDIN_FILENO)) {
+ fputs("getdefs error: no inputs were specified and stdin is a tty\n",
+ stderr);
+ USAGE(EXIT_FAILURE);
+ }
+
+ while (fgets(z, (int)sizeof(z), stdin) != NULL) {
+ char* pz = z + strlen(z);
+
+ if (pz[-1] != '\n') {
+ tSCC zErr[] =
+ "getdefs error: input line not newline terminated\n";
+ fputs(zErr, stderr);
+ exit(EXIT_FAILURE);
+ }
+
+ while ((pz > z) && isspace(pz[-1])) pz--;
+ *pz = '\0';
+ pz = z;
+ while (isspace(*pz)) pz++;
+ if ((*pz == '\0') || (*pz == '#')) continue;
+ if (access(pz, R_OK) != 0) continue;
+
+ if (ct++ == 0)
+ *ppz = strdup(z); /* replace the "-" */
+ else
+ SET_OPT_INPUT(strdup(z)); /* if 'strdup' fails, we die later */
+ }
+}
+
+
+/*
+ * processEmbeddedOptions
+ *
+ * This routine processes the text contained within "/\*==--"
+ * and "=\*\/" as a single option. If that option is the SUBBLOCK
+ * option, it will need to be massaged for use.
+ */
+LOCAL void
+processEmbeddedOptions(char* pzText)
+{
+ tSCC zStStr[] = "/*=--";
+ tSCC zEndSt[] = "=*/";
+
+ for (;;) {
+ char* pzStart = strstr(pzText, zStStr);
+ char* pzEnd;
+ int sblct = 0;
+
+ if (pzStart == NULL)
+ return;
+
+ if (HAVE_OPT(SUBBLOCK))
+ sblct = STACKCT_OPT(SUBBLOCK);
+
+ pzEnd = strstr(pzStart, zEndSt);
+ if (pzEnd == NULL)
+ return;
+
+ pzStart = compressOptionText(pzStart + sizeof(zStStr)-1, pzEnd);
+
+ optionLoadLine(&getdefsOptions, pzStart);
+
+ if (HAVE_OPT(SUBBLOCK) && (sblct != STACKCT_OPT(SUBBLOCK))) {
+ tCC** ppz = STACKLST_OPT(SUBBLOCK);
+ ppz[ sblct ] = fixupSubblockString(ppz[sblct]);
+ }
+ pzText = pzEnd + sizeof(zEndSt);
+ }
+}
+
+/**
+ * set up the regular expression we search for
+ */
+static void
+set_define_re(void)
+{
+ static char const default_pat[] =
+ "/\\*=(\\*|"
+ "([a-z][a-z0-9_]*(\\[[0-9]+\\]){0,1}|\\*)[ \t]+[a-z])";
+ static char const pat_wrapper[] = "/\\*=(%s)";
+
+ char const * def_pat;
+ bool free_pat = false;
+
+ /*
+ * Our default pattern is to accept all names following
+ * the '/' '*' '=' character sequence. We ignore case.
+ */
+ if ((! HAVE_OPT(DEFS_TO_GET)) || (*OPT_ARG(DEFS_TO_GET) == NUL)) {
+ def_pat = default_pat;
+
+ } else if (strncmp(OPT_ARG(DEFS_TO_GET), default_pat, 4) == 0) {
+ def_pat = OPT_ARG(DEFS_TO_GET);
+
+ } else {
+ char const * pz = OPT_ARG(DEFS_TO_GET);
+ size_t len = strlen((char *)pz) + 16;
+ char * bf = malloc(len);
+
+ if (bf == NULL)
+ die(zMallocErr, (int)len, "definition pattern");
+
+ /*
+ * IF a pattern has been supplied, enclose it with
+ * the '/' '*' '=' part of the pattern.
+ */
+ snprintf(bf, len, pat_wrapper, pz);
+ def_pat = bf;
+ free_pat = true;
+ }
+
+ /*
+ * Compile the regular expression that we are to search for
+ * to find each new definition in the source files.
+ */
+ {
+ char zRER[MAXNAMELEN];
+ static char const zReErr[] =
+ "Regex error %d (%s): Cannot compile reg expr:\n\t%s\n";
+
+ int rerr = regcomp(&define_re, def_pat, REG_EXTENDED | REG_ICASE);
+ if (rerr != 0) {
+ regerror(rerr, &define_re, zRER, sizeof(zRER));
+ die(zReErr, rerr, zRER, def_pat);
+ }
+
+ if (free_pat)
+ free((void *)def_pat);
+
+ rerr = regcomp(&attrib_re, zAttribRe, REG_EXTENDED | REG_ICASE);
+ if (rerr != 0) {
+ regerror(rerr, &attrib_re, zRER, sizeof(zRER));
+ die(zReErr, rerr, zRER, zAttribRe);
+ }
+ }
+}
+
+/**
+ * Make sure each of the input files is findable.
+ * Also, while we are at it, compute the output file mod time
+ * based on the mod time of the most recent file.
+ */
+static void
+set_modtime(void)
+{
+ int ct = STACKCT_OPT(INPUT);
+ char const ** ppz = STACKLST_OPT(INPUT);
+ struct stat stb;
+
+ if ((ct == 1) && (strcmp(*ppz, "-") == 0)) {
+ /*
+ * Read the list of input files from stdin.
+ */
+ loadStdin();
+ ct = STACKCT_OPT( INPUT);
+ ppz = STACKLST_OPT(INPUT);
+ }
+
+ do {
+ if (stat(*ppz++, &stb) != 0)
+ break;
+
+ if (! S_ISREG(stb.st_mode)) {
+ errno = EINVAL;
+ break;
+ }
+
+ if (++(stb.st_mtime) > modtime)
+ modtime = stb.st_mtime;
+ } while (--ct > 0);
+
+ if (ct > 0)
+ fserr_die("stat-ing %s for text file\n", ppz[-1]);
+}
+
+/**
+ * validateOptions
+ *
+ * - Sanity check the options
+ * - massage the SUBBLOCK options into something
+ * more easily used during the source text processing.
+ * - compile the regular expressions
+ * - make sure we can find all the input files and their mod times
+ * - Set up our entry ordering database (if specified)
+ * - Make sure we have valid strings for SRCFILE and LINENUM
+ * (if we are to use these things).
+ * - Initialize the user name characters array.
+ */
+LOCAL void
+validateOptions(void)
+{
+ set_define_re();
+
+ /*
+ * Prepare each sub-block entry so we can parse easily later.
+ */
+ if (HAVE_OPT(SUBBLOCK)) {
+ int ct = STACKCT_OPT( SUBBLOCK);
+ tCC** ppz = STACKLST_OPT(SUBBLOCK);
+
+ /*
+ * FOR each SUBBLOCK argument,
+ * DO condense each name list to be a list of names
+ * separated by a single space and NUL terminated.
+ */
+ do {
+ *ppz = fixupSubblockString(*ppz);
+ ppz++;
+ } while (--ct > 0);
+ }
+
+ if (! HAVE_OPT(INPUT))
+ SET_OPT_INPUT("-");
+
+ set_modtime();
+
+ /*
+ * IF the output is to have order AND it is to be based on a file,
+ * THEN load the contents of that file.
+ * IF we cannot load the file,
+ * THEN it must be new or empty. Allocate several K to start.
+ */
+ if ( HAVE_OPT(ORDERING)
+ && (OPT_ARG(ORDERING) != NULL)) {
+ tSCC zIndexPreamble[] =
+ "# -*- buffer-read-only: t -*- vi: set ro:\n"
+ "#\n# DO NOT EDIT THIS FILE - it is auto-edited by getdefs\n";
+
+ pzIndexText = loadFile(OPT_ARG(ORDERING));
+ if (pzIndexText == NULL) {
+ pzIndexText = pzEndIndex = pzIndexEOF = malloc((size_t)0x4000);
+ indexAlloc = 0x4000;
+ pzEndIndex += sprintf(pzEndIndex, "%s", zIndexPreamble);
+ } else {
+ pzEndIndex = pzIndexEOF = pzIndexText + strlen(pzIndexText);
+ indexAlloc = (pzEndIndex - pzIndexText) + 1;
+ }
+
+ /*
+ * We map the name entries to a connonical form.
+ * By default, everything is mapped to lower case already.
+ * This call will map these three characters to '_'.
+ */
+ strequate("_-^");
+ }
+
+ {
+ char const * pz = OPT_ARG(SRCFILE);
+ if ((pz == NULL) || (*pz == NUL))
+ OPT_ARG(SRCFILE) = "srcfile";
+
+ pz = OPT_ARG(LINENUM);
+ if ((pz == NULL) || (*pz == NUL))
+ OPT_ARG(LINENUM) = "linenum";
+ }
+
+ {
+ tSCC zAgNameChars[] = "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789" "_-^";
+ tSCC zUserNameChs[] = ":.$%*!~<>&@";
+ tCC* p = zAgNameChars;
+
+ while (*p)
+ zUserNameCh[(unsigned)(*p++)] = 3;
+
+ p = zUserNameChs;
+ while (*p)
+ zUserNameCh[(unsigned)(*p++)] = 1;
+ }
+}
+
+
+/* emacs
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of getdefs/gdinit.c */
diff --git a/getdefs/getdefs.c b/getdefs/getdefs.c
new file mode 100644
index 0000000..26dd5d1
--- /dev/null
+++ b/getdefs/getdefs.c
@@ -0,0 +1,1196 @@
+/**
+ * \file getdefs.c
+ *
+ * getdefs Copyright (c) 1999-2012 by Bruce Korb - all rights reserved
+ *
+ * Time-stamp: "2012-04-14 11:15:08 bkorb"
+ * Author: Bruce Korb <bkorb@gnu.org>
+ *
+ * This file is part of AutoGen.
+ * AutoGen copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+static char const zBogusDef[] = "Bogus definition:\n%s\n";
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Forward procedure pointers
+ */
+typedef int (compar_func)(const void *, const void *);
+static compar_func compar_text, compar_defname;
+
+/* START-STATIC-FORWARD */
+static char*
+assignIndex(char* pzOut, char* pzDef);
+
+static int
+awaitAutogen(void);
+
+static void
+buildDefinition(char * pzDef, char const * pzFile, int line, char * pzOut);
+
+static tSuccess
+buildPreamble(char ** ppzDef, char ** ppzOut, char const * pzFile, int line);
+
+static int
+compar_defname(const void* p1, const void* p2);
+
+static int
+compar_text(const void* p1, const void* p2);
+
+static void
+doPreamble(FILE* outFp);
+
+static void
+printEntries(FILE* fp);
+
+static void
+processFile(char const * pzFile);
+
+static void
+set_first_idx(void);
+
+static FILE*
+open_ag_file(char ** pzBase);
+
+static FILE*
+open_ag_proc_pipe(char ** pzBase);
+
+static void
+exec_autogen(char ** pzBase);
+
+static FILE*
+startAutogen(void);
+
+static void
+update_db(void);
+/* END-STATIC-FORWARD */
+
+#ifndef HAVE_STRSIGNAL
+# include "compat/strsignal.c"
+#endif
+
+#ifndef HAVE_CHMOD
+# include "compat/chmod.c"
+#endif
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * MAIN
+ */
+int
+main(int argc, char ** argv)
+{
+ FILE* outFp;
+
+ optionProcess(&getdefsOptions, argc, argv);
+ validateOptions();
+
+ outFp = startAutogen();
+
+ doPreamble(outFp);
+
+ /*
+ * Process each input file
+ */
+ {
+ int ct = STACKCT_OPT(INPUT);
+ char const ** ppz = STACKLST_OPT(INPUT);
+
+ do {
+ processFile(*ppz++);
+ } while (--ct > 0);
+ }
+
+ /*
+ * IF we don't have an ordering file, but we do have a "first index",
+ * THEN alphabetize by definition name.
+ */
+ if ((pzIndexText == NULL) && HAVE_OPT(FIRST_INDEX)) {
+ qsort((void*)papzBlocks, blkUseCt, sizeof(char*), compar_defname);
+ set_first_idx();
+ }
+
+ else if (ENABLED_OPT(ORDERING) && (blkUseCt > 1))
+ qsort((void*)papzBlocks, blkUseCt, sizeof(char*), &compar_text);
+
+ printEntries(outFp);
+#ifdef HAVE_FCHMOD
+ fchmod(fileno(outFp), S_IRUSR|S_IRGRP|S_IROTH);
+#endif
+ fclose(outFp);
+
+ /*
+ * IF output is to a file
+ * THEN set the permissions and modification times
+ */
+ if ( (WHICH_IDX_AUTOGEN == INDEX_OPT_OUTPUT)
+ && (outFp != stdout) ) {
+ struct utimbuf tbuf;
+ tbuf.actime = time((time_t*)NULL);
+ tbuf.modtime = modtime + 1;
+ utime(OPT_ARG(OUTPUT), &tbuf);
+#ifndef HAVE_CHMOD
+ chmod(OPT_ARG(OUTPUT), S_IRUSR|S_IRGRP|S_IROTH);
+#endif
+ }
+
+ /*
+ * IF we are keeping a database of indexes
+ * AND we have augmented the contents,
+ * THEN append the new entries to the file.
+ */
+ if ((pzIndexText != NULL) && (pzEndIndex != pzIndexEOF))
+ update_db();
+
+ if (agPid != -1)
+ return awaitAutogen();
+
+ return EXIT_SUCCESS;
+}
+
+
+/*
+ * assignIndex
+ */
+static char*
+assignIndex(char* pzOut, char* pzDef)
+{
+ char* pzMatch;
+ size_t len = strlen(pzDef);
+ int idx;
+
+ /*
+ * Make the source text all lower case and map
+ * '-', '^' and '_' characters to '_'.
+ */
+ strtransform(pzDef, pzDef);
+
+ /*
+ * IF there is already an entry,
+ * THEN put the index into the output.
+ */
+ pzMatch = strstr(pzIndexText, pzDef);
+ if (pzMatch != NULL) {
+ pzMatch += len;
+ while (isspace(*pzMatch)) pzMatch++;
+ while ((*pzOut++ = *pzMatch++) != ']') ;
+ return pzOut;
+ }
+
+ /*
+ * We have a new entry. Make sure we have room for it
+ * in our in-memory string
+ */
+ if (((pzEndIndex - pzIndexText) + len + 64 ) > indexAlloc) {
+ char* pz;
+ indexAlloc += 0x1FFF;
+ indexAlloc &= ~0x0FFF;
+ pz = (char*)realloc((void*)pzIndexText, indexAlloc);
+ if (pz == NULL) {
+ fputs("Realloc of index text failed\n", stderr);
+ exit(EXIT_FAILURE);
+ }
+
+ /*
+ * IF the allocation moved,
+ * THEN adjust all our pointers.
+ */
+ if (pz != pzIndexText) {
+ pzIndexEOF = pz + (pzIndexEOF - pzIndexText);
+ pzEndIndex = pz + (pzEndIndex - pzIndexText);
+ pzIndexText = pz;
+ }
+ }
+
+ /*
+ * IF there are no data in our text database,
+ * THEN use default index.
+ */
+ if (pzEndIndex == pzIndexText)
+ idx = OPT_VALUE_FIRST_INDEX;
+ else do {
+ char* pz = strrchr(pzDef, ' ');
+ *pz = NUL;
+ len = strlen(pzDef);
+
+ /*
+ * Find the last entry for the current category of entries
+ */
+ pzMatch = strstr(pzIndexText, pzDef);
+ if (pzMatch == NULL) {
+ /*
+ * No entries for this category. Use default index.
+ */
+ idx = OPT_VALUE_FIRST_INDEX;
+ *pz = ' ';
+ break;
+ }
+
+ for (;;) {
+ char* pzn = strstr(pzMatch + len, pzDef);
+ if (pzn == NULL)
+ break;
+ pzMatch = pzn;
+ }
+
+ /*
+ * Skip forward to the '[' character and convert the
+ * number that follows to a long.
+ */
+ *pz = ' ';
+ pzMatch = strchr(pzMatch + len, '[');
+ idx = strtol(pzMatch+1, (char**)NULL, 0)+1;
+ } while (false);
+
+ /*
+ * Add the new entry to our text database and
+ * place a copy of the value into our output.
+ */
+ pzEndIndex += sprintf(pzEndIndex, "%-40s [%d]\n", pzDef, idx);
+ pzOut += sprintf(pzOut, "[%d]", idx);
+
+ return pzOut;
+}
+
+
+/*
+ * awaitAutogen
+ */
+static int
+awaitAutogen(void)
+{
+ int status;
+ waitpid(agPid, &status, 0);
+ if (WIFEXITED(status)) {
+ status = WEXITSTATUS(status);
+ if (status != EXIT_SUCCESS) {
+ fprintf(stderr, "ERROR: %s exited with status %d\n",
+ pzAutogen, status);
+ }
+ return status;
+ }
+
+ if (WIFSIGNALED( status )) {
+ status = WTERMSIG( status );
+ fprintf(stderr, "ERROR: %s exited due to %d signal (%s)\n",
+ pzAutogen, status, strsignal(status));
+ }
+ else
+ fprintf(stderr, "ERROR: %s exited due to unknown reason %d\n",
+ pzAutogen, status);
+
+ return EXIT_FAILURE;
+}
+
+
+/*
+ * buildDefinition
+ */
+static void
+buildDefinition(char * pzDef, char const * pzFile, int line, char * pzOut)
+{
+ static char const zSrcFile[] = " %s = '%s';\n";
+ static char const zLineNum[] = " %s = '%d';\n";
+
+ bool these_are_global_defs;
+ tSuccess preamble;
+ int re_res;
+ char* pzNextDef = NULL;
+ regmatch_t match[2];
+
+ if (*pzDef == '*') {
+ these_are_global_defs = true;
+ strcpy(pzOut, zGlobal);
+ pzOut += sizeof(zGlobal)-1;
+ pzOut += sprintf(pzOut, zLineId, line, pzFile);
+
+ pzDef = strchr(pzDef, '\n');
+ preamble = PROBLEM;
+
+ } else {
+ these_are_global_defs = false;
+ preamble = buildPreamble(&pzDef, &pzOut, pzFile, line);
+ if (FAILED(preamble)) {
+ *pzOut = NUL;
+ return;
+ }
+ }
+
+ /*
+ * FOR each attribute for this entry, ...
+ */
+ for (;;) {
+ /*
+ * Find the next attribute regular expression
+ */
+ re_res = regexec(&attrib_re, pzDef, COUNT(match), match, 0);
+ switch (re_res) {
+ case 0:
+ /*
+ * NUL-terminate the current attribute.
+ * Set the "next" pointer to the start of the next attribute name.
+ */
+ pzDef[ match[0].rm_so ] = NUL;
+ if (pzNextDef != NULL)
+ pzOut = emitDefinition(pzNextDef, pzOut);
+ pzNextDef = pzDef = pzDef + match[1].rm_so;
+ break;
+
+ case REG_NOMATCH:
+ /*
+ * No more attributes.
+ */
+ if (pzNextDef == NULL) {
+ *pzOut++ = '\n'; *pzOut++ = '#';
+ sprintf(pzOut, zNoData, pzFile, line);
+ fputs(pzOut, stderr);
+ pzOut += strlen(pzOut);
+ return;
+ }
+
+ pzOut = emitDefinition(pzNextDef, pzOut);
+ goto eachAttrDone;
+ break;
+
+ default:
+ {
+ char zRER[ MAXNAMELEN ];
+ static char const zErr[] = "error %d (%s) finding `%s' in\n%s\n\n";
+ regerror(re_res, &attrib_re, zRER, sizeof(zRER));
+ *pzOut++ = '\n';
+ *pzOut++ = '#';
+ sprintf(pzOut, zErr, re_res, zRER, zAttribRe, pzDef);
+ fprintf(stderr, "getdefs: %s", zErr);
+ return;
+ }
+ }
+ } eachAttrDone:;
+
+ if (these_are_global_defs) {
+ *pzOut = NUL;
+ return;
+ }
+
+ if (HAVE_OPT(COMMON_ASSIGN)) {
+ int ct = STACKCT_OPT(COMMON_ASSIGN);
+ char const ** ppz = STACKLST_OPT(COMMON_ASSIGN);
+ do {
+ pzOut += sprintf(pzOut, " %s;\n", *ppz++);
+ } while (--ct > 0);
+ }
+
+ if (HAVE_OPT(SRCFILE))
+ pzOut += sprintf(pzOut, zSrcFile, OPT_ARG(SRCFILE), pzFile);
+
+ if (HAVE_OPT(LINENUM))
+ pzOut += sprintf(pzOut, zLineNum, OPT_ARG(LINENUM), line);
+
+ /*
+ * IF the preamble had a problem, it is because it could not
+ * emit the final "#endif\n" directive. Do that now.
+ */
+ if (HADGLITCH(preamble))
+ strcpy(pzOut, "};\n#endif\n");
+ else strcpy(pzOut, "};\n");
+}
+
+
+/*
+ * buildPreamble
+ */
+static tSuccess
+buildPreamble(char ** ppzDef, char ** ppzOut, char const * pzFile, int line)
+{
+ char * pzDef = *ppzDef;
+ char * pzOut = *ppzOut;
+
+ char zDefText[ MAXNAMELEN ];
+ char * pzDefText = zDefText;
+ char zNameText[ MAXNAMELEN ];
+ char * pzNameText = zNameText;
+ char * pzIfText = NULL;
+
+ /*
+ * Copy out the name of the entry type
+ */
+ *pzDefText++ = '`';
+ while (isalnum(*pzDef) || (*pzDef == '_') || (*pzDef == '.')
+ || (*pzDef == '[') || (*pzDef == ']'))
+ *pzDefText++ = *pzDef++;
+
+ *pzDefText = NUL;
+
+ pzDef += strspn(pzDef, "* \t");
+
+ /*
+ * Copy out the name for this entry of the above entry type.
+ */
+ while (isalnum(*pzDef) || (*pzDef == '_'))
+ *pzNameText++ = *pzDef++;
+ *pzNameText = NUL;
+
+ if ( (zDefText[1] == NUL)
+ || (zNameText[0] == NUL) ) {
+ fprintf(stderr, zNoData, pzFile, line);
+ return FAILURE;
+ }
+
+ pzDef += strspn(pzDef, " \t");
+
+ /*
+ * IF these names are followed by a comma and an "if" clause,
+ * THEN we emit the definition with "#if..."/"#endif" around it
+ */
+ if (*pzDef == ',') {
+ pzDef += strspn(pzDef+1, " \t")+1;
+ if ((pzDef[0] == 'i') && (pzDef[1] == 'f'))
+ pzIfText = pzDef;
+ }
+
+ pzDef = strchr(pzDef, '\n');
+ if (pzDef == NULL) {
+ fprintf(stderr, zNoData, pzFile, line);
+ return FAILURE;
+ }
+
+ *pzDef = NUL;
+
+ /*
+ * Now start the output. First, the "#line" directive,
+ * then any "#ifdef..." line and finally put the
+ * entry type name into the output.
+ */
+ pzOut += sprintf(pzOut, zLineId, line, pzFile);
+ if (pzIfText != NULL)
+ pzOut += sprintf(pzOut, "#%s\n", pzIfText);
+ {
+ char* pz = zDefText+1;
+ while (*pz != NUL)
+ *pzOut++ = *pz++;
+ }
+
+ /*
+ * IF we are indexing the entries,
+ * THEN build the string by which we are indexing
+ * and insert the index into the output.
+ */
+ if (pzIndexText != NULL) {
+ sprintf(pzDefText, " %s'", zNameText);
+ pzOut = assignIndex(pzOut, zDefText);
+ }
+
+ /*
+ * Now insert the name with a consistent name string prefix
+ * that we use to locate the sort key later.
+ */
+ pzOut += sprintf(pzOut, "%s%s';\n", zNameTag, zNameText);
+ *ppzOut = pzOut;
+ *ppzDef = pzDef;
+ *pzDef = '\n'; /* restore the newline. Used in pattern match */
+
+ /*
+ * Returning "PROBLEM" means the caller must emit the "#endif\n"
+ * at the end of the definition.
+ */
+ return (pzIfText != NULL) ? PROBLEM : SUCCESS;
+}
+
+
+/*
+ * compar_defname
+ */
+static int
+compar_defname(const void* p1, const void* p2)
+{
+ char const * pzS1 = *(char const * const *)p1;
+ char const * pz1 = strstr(pzS1, zNameTag);
+ char const * pzS2 = *(char const * const *)p2;
+ char const * pz2 = strstr(pzS2, zNameTag);
+
+ if (pz1 == NULL) {
+ if (strncmp(*(char const * const *)p1, zGlobal, sizeof(zGlobal)-1) == 0)
+ return -1;
+
+ die(zBogusDef, *(char const * const *)p1);
+ }
+
+ if (pz2 == NULL) {
+ if (strncmp(*(char const * const *)p2, zGlobal, sizeof(zGlobal)-1) == 0)
+ return 1;
+
+ die(zBogusDef, *(char const * const *)p2);
+ }
+
+ /*
+ * Back up to the name of the definition
+ */
+ while ((pz1 > pzS1) && (*--pz1 != '\n')) ;
+ while ((pz2 > pzS2) && (*--pz2 != '\n')) ;
+
+ return strcmp(pz1, pz2);
+}
+
+
+/*
+ * compar_text
+ *
+ * merely returns the relative ordering of two input strings.
+ * The arguments are pointers to pointers to NUL-terminated strings.
+ * IF the definiton was mal-formed, an error message was printed
+ * earlier. When we get here, we wil fail to find the "zNameTag"
+ * string and EXIT_FAILURE.
+ */
+static int
+compar_text(const void* p1, const void* p2)
+{
+ char* pz1 = strstr(*(char const * const *)p1, zNameTag);
+ char* pe1;
+ char* pz2 = strstr(*(char const * const *)p2, zNameTag);
+ char* pe2;
+ int res;
+
+ if (pz1 == NULL) {
+ if (strncmp(*(char const * const *)p1, zGlobal, sizeof(zGlobal)-1) == 0)
+ return -1;
+
+ die(zBogusDef, *(char const * const *)p1);
+ }
+
+ if (pz2 == NULL) {
+ if (strncmp(*(char const * const *)p2, zGlobal, sizeof(zGlobal)-1) == 0)
+ return 1;
+
+ die(zBogusDef, *(char const * const *)p2);
+ }
+
+ pz1 += sizeof(zNameTag)-1;
+ pe1 = strchr(pz1, '\'');
+
+ if (pe1 == NULL)
+ die(zBogusDef, *(char const * const *)p1);
+
+ pz2 += sizeof(zNameTag)-1;
+ pe2 = strchr(pz2, '\'');
+
+ if (pe2 == NULL)
+ die(zBogusDef, *(char const * const *)p2);
+
+ *pe1 = *pe2 = NUL;
+
+ /*
+ * We know ordering is enabled because we only get called when
+ * it is enabled. If the option was also specified, then
+ * we sort without case sensitivity (and we compare '-', '_'
+ * and '^' as being equal as well). Otherwise, we do a
+ * strict string comparison.
+ */
+ if (HAVE_OPT(ORDERING))
+ res = streqvcmp(pz1, pz2);
+ else res = strcmp(pz1, pz2);
+ *pe1 = *pe2 = '\'';
+ return res;
+}
+
+
+/*
+ * doPreamble
+ */
+static void
+doPreamble(FILE* outFp)
+{
+ /*
+ * Emit the "autogen definitions xxx;" line
+ */
+ fprintf(outFp, zAgDef, OPT_ARG(TEMPLATE));
+
+ if (HAVE_OPT(FILELIST)) {
+ static char const zFmt[] = "%-12s = '%s';\n";
+ char const * pzName = OPT_ARG(FILELIST);
+
+ if ((pzName == NULL) || (*pzName == NUL))
+ pzName = "infile";
+
+ if (HAVE_OPT(INPUT)) {
+ int ct = STACKCT_OPT(INPUT);
+ char const ** ppz = STACKLST_OPT(INPUT);
+
+ do {
+ fprintf(outFp, zFmt, pzName, *ppz++);
+ } while (--ct > 0);
+ }
+
+ if (HAVE_OPT(COPY)) {
+ int ct = STACKCT_OPT(COPY);
+ char const ** ppz = STACKLST_OPT(COPY);
+
+ do {
+ fprintf(outFp, zFmt, pzName, *ppz++);
+ } while (--ct > 0);
+ }
+ fputc('\n', outFp);
+ }
+
+ /*
+ * IF there are COPY files to be included,
+ * THEN emit the '#include' directives
+ */
+ if (HAVE_OPT(COPY)) {
+ int ct = STACKCT_OPT(COPY);
+ char const ** ppz = STACKLST_OPT(COPY);
+ do {
+ fprintf(outFp, "#include %s\n", *ppz++);
+ } while (--ct > 0);
+ fputc('\n', outFp);
+ }
+
+ /*
+ * IF there are global assignments, then emit them
+ * (these do not get sorted, so we write directly now.)
+ */
+ if (HAVE_OPT(ASSIGN)) {
+ int ct = STACKCT_OPT(ASSIGN);
+ char const ** ppz = STACKLST_OPT(ASSIGN);
+ do {
+ fprintf(outFp, "%s;\n", *ppz++);
+ } while (--ct > 0);
+ fputc('\n', outFp);
+ }
+}
+
+
+/*
+ * loadFile
+ */
+LOCAL char*
+loadFile(char const * pzFname)
+{
+ FILE* fp = fopen(pzFname, "r" FOPEN_BINARY_FLAG);
+ int res;
+ char* pzText;
+ char* pzRead;
+ size_t rdsz;
+
+ if (fp == (FILE*)NULL)
+ return NULL;
+ /*
+ * Find out how much data we need to read.
+ * And make sure we are reading a regular file.
+ */
+ {
+ struct stat stb;
+ res = fstat(fileno(fp), &stb);
+ if (res != 0)
+ fserr_die("stat-ing %s\n", pzFname);
+
+ if (! S_ISREG(stb.st_mode)) {
+ fprintf(stderr, "error file %s is not a regular file\n",
+ pzFname);
+ exit(EXIT_FAILURE);
+ }
+ rdsz = stb.st_size;
+ if (rdsz < 16)
+ die("Error file %s only contains %d bytes.\n"
+ "\tit cannot contain autogen definitions\n",
+ pzFname, (int)rdsz);
+ }
+
+ /*
+ * Allocate the space we need for the ENTIRE file.
+ */
+ pzRead = pzText = (char*)malloc(rdsz + 1);
+ if (pzText == NULL)
+ die("Error: could not allocate %d bytes\n", (int)rdsz + 1);
+
+ /*
+ * Read as much as we can get until we have read the file.
+ */
+ do {
+ size_t rdct = fread((void*)pzRead, (size_t)1, rdsz, fp);
+
+ if (rdct == 0)
+ fserr_die("reading file %s\n", pzFname);
+
+ pzRead += rdct;
+ rdsz -= rdct;
+ } while (rdsz > 0);
+
+ *pzRead = NUL;
+ fclose(fp);
+ return pzText;
+}
+
+
+/*
+ * printEntries
+ */
+static void
+printEntries(FILE* fp)
+{
+ int ct = blkUseCt;
+ char** ppz = papzBlocks;
+
+ if (ct == 0)
+ exit(EXIT_FAILURE);
+
+ for (;;) {
+ char* pz = *(ppz++);
+ fputs(pz, fp);
+ free((void*)pz);
+ if (--ct <= 0)
+ break;
+ fputc('\n', fp);
+ }
+ free((void*)papzBlocks);
+}
+
+
+/*
+ * processFile
+ */
+static void
+processFile(char const * pzFile)
+{
+ char* pzText = loadFile(pzFile); /* full text */
+ char* pzScan; /* Scanning Pointer */
+ char* pzDef; /* Def block start */
+ char* pzNext; /* start next search */
+ char* pzDta; /* data value */
+ int lineNo = 1;
+ char* pzOut;
+ regmatch_t matches[MAX_SUBMATCH+1];
+
+ if (pzText == NULL)
+ fserr_die("read opening %s\n", pzFile);
+
+ processEmbeddedOptions(pzText);
+ pzNext = pzText;
+
+ while (pzScan = pzNext,
+ regexec(&define_re, pzScan, COUNT(matches), matches, 0) == 0) {
+
+ static char const zNoEnd[] =
+ "Error: definition in %s at line %d has no end\n";
+ static char const zNoSubexp[] =
+ "Warning: entry type not found on line %d in %s:\n\t%s\n";
+
+ int linesInDef = 0;
+
+ /*
+ * Make sure there is a subexpression match!!
+ */
+ if (matches[1].rm_so == -1) {
+ char* pz = NULL;
+ char ch = NUL;
+
+ pzDef = pzScan + matches[0].rm_so;
+ if (strlen(pzDef) > 30) {
+ pz = pzDef + 30;
+ ch = *pz;
+ *pz = NUL;
+ }
+
+ fprintf(stderr, zNoSubexp, lineNo, pzFile, pzDef);
+ if (pz != NULL)
+ *pz = ch;
+ continue;
+ }
+
+ pzDef = pzScan + matches[0].rm_so + sizeof("/*=") - 1;
+ pzNext = strstr(pzDef, "=*/");
+ if (pzNext == NULL)
+ die(zNoEnd, pzFile, lineNo);
+
+ *pzNext = NUL;
+ pzNext += 3;
+ /*
+ * Count the number of lines skipped to the start of the def.
+ */
+ for (;;) {
+ pzScan = strchr(pzScan, '\n');
+ if (pzScan++ == NULL)
+ break;
+ if (pzScan >= pzDef)
+ break;
+ lineNo++;
+ }
+
+ pzOut = pzDta = (char*)malloc(2 * strlen(pzDef) + 8000);
+
+ /*
+ * Count the number of lines in the definition itself.
+ * It will find and stop on the "=* /\n" line.
+ */
+ pzScan = pzDef;
+ for (;;) {
+ pzScan = strchr(pzScan, '\n');
+ if (pzScan++ == NULL)
+ break;
+ linesInDef++;
+ }
+
+ /*
+ * OK. We are done figuring out where the boundaries of the
+ * definition are and where we will resume our processing.
+ */
+ buildDefinition(pzDef, pzFile, lineNo, pzOut);
+ pzDta = (char*)realloc((void*)pzDta, strlen(pzDta) + 1);
+ lineNo += linesInDef;
+
+ if (++blkUseCt > blkAllocCt) {
+ blkAllocCt += 32;
+ papzBlocks = (char**)realloc((void*)papzBlocks,
+ blkAllocCt * sizeof(char*));
+ if (papzBlocks == (char**)NULL)
+ die("Realloc error for %d pointers\n", (int)blkAllocCt);
+ }
+ papzBlocks[ blkUseCt-1 ] = pzDta;
+ }
+
+ free((void*)pzText);
+}
+
+
+/*
+ * set_first_idx
+ *
+ * Go through all our different kinds of defines. On the first occurrence
+ * of each different name, check for an index value. If not supplied,
+ * then insert ``[OPT_VALUE_FIRST_INDEX]'' after the object name.
+ */
+static void
+set_first_idx(void)
+{
+ char zNm[ 128 ] = { NUL };
+ int nmLn = 1;
+ int ct = blkUseCt;
+ char** ppz = papzBlocks;
+
+ if (ct == 0)
+ exit(EXIT_FAILURE);
+
+ for (; --ct >= 0; ppz++) {
+ char * pzOld = *ppz;
+ int changed = (strneqvcmp(pzOld, zNm, nmLn) != 0);
+ char * pzNew;
+
+ /*
+ * IF the name still matches, then check the following character.
+ * If it is whitespace or an open bracket, then
+ * it's the old type. Continue to the next entry.
+ */
+ if (! changed) {
+ if (isspace(pzOld[ nmLn ]) || (pzOld[nmLn] == '['))
+ continue;
+ }
+
+ pzNew = zNm;
+ nmLn = 0;
+ while (isalnum(*pzOld)
+ || (*pzOld == '_') || (*pzOld == '-') || (*pzOld == '^')) {
+ nmLn++;
+ *(pzNew++) = *(pzOld++);
+ }
+ *pzNew = NUL;
+
+ /*
+ * IF the source has specified its own index, then do not
+ * supply our own new one.
+ */
+ if (*pzOld != '[') {
+ pzNew = (char*)malloc(strlen(pzOld) + nmLn + 10);
+ sprintf(pzNew, "%s[%d]%s", zNm,
+ (int)OPT_VALUE_FIRST_INDEX, pzOld);
+ free((void*)(*ppz));
+ *ppz = pzNew;
+ }
+ }
+}
+
+static FILE*
+open_ag_file(char ** pzBase)
+{
+ switch (WHICH_IDX_AUTOGEN) {
+ case INDEX_OPT_OUTPUT:
+ {
+ static char const zFileFmt[] = " * %s\n";
+ FILE* fp;
+
+ if (*pzBase != NULL)
+ free(*pzBase);
+
+ if (strcmp(OPT_ARG(OUTPUT), "-") == 0)
+ return stdout;
+
+ unlink(OPT_ARG(OUTPUT));
+ fp = fopen(OPT_ARG(OUTPUT), "w" FOPEN_BINARY_FLAG);
+ fprintf(fp, zDne, OPT_ARG(OUTPUT));
+
+ if (HAVE_OPT(INPUT)) {
+ int ct = STACKCT_OPT(INPUT);
+ char const ** ppz = STACKLST_OPT(INPUT);
+ do {
+ fprintf(fp, zFileFmt, *ppz++);
+ } while (--ct > 0);
+ }
+
+ fputs(" */\n", fp);
+ return fp;
+ }
+
+ case INDEX_OPT_AUTOGEN:
+ if (! ENABLED_OPT(AUTOGEN)) {
+ if (*pzBase != NULL)
+ free(*pzBase);
+
+ return stdout;
+ }
+
+ if ( ( OPT_ARG(AUTOGEN) != NULL)
+ && (*OPT_ARG(AUTOGEN) != NUL ))
+ pzAutogen = OPT_ARG(AUTOGEN);
+
+ break;
+ }
+
+ return NULL;
+}
+
+static FILE*
+open_ag_proc_pipe(char ** pzBase)
+{
+ FILE * agFp;
+
+ int pfd[2];
+
+ if (pipe(pfd) != 0)
+ fserr_die("creating pipe\n");
+
+ agPid = fork();
+
+ switch (agPid) {
+ case 0:
+ /*
+ * We are the child. Close the write end of the pipe
+ * and force STDIN to become the read end.
+ */
+ close(pfd[1]);
+ if (dup2(pfd[0], STDIN_FILENO) != 0)
+ fserr_die("dup pipe[0]\n");
+ break;
+
+ case -1:
+ fserr_die("on fork()\n");
+
+ default:
+ /*
+ * We are the parent. Close the read end of the pipe
+ * and get a FILE* pointer for the write file descriptor
+ */
+ close(pfd[0]);
+ agFp = fdopen(pfd[1], "w" FOPEN_BINARY_FLAG);
+ if (agFp == (FILE*)NULL)
+ fserr_die("fdopening pipe[1]\n");
+ free(*pzBase);
+ return agFp;
+ }
+
+ return NULL;
+}
+
+static void
+exec_autogen(char ** pzBase)
+{
+ char const ** paparg;
+ char const ** pparg;
+ int argCt = 5;
+
+ /*
+ * IF we don't have template search directories,
+ * THEN allocate the default arg counter of pointers and
+ * set the program name into it.
+ * ELSE insert each one into the arg list.
+ */
+ if (! HAVE_OPT(AGARG)) {
+ paparg = pparg = (char const **)malloc(argCt * sizeof(char*));
+ *pparg++ = pzAutogen;
+
+ } else {
+ int ct = STACKCT_OPT(AGARG);
+ char const ** ppz = STACKLST_OPT(AGARG);
+
+ argCt += ct;
+ paparg = pparg = (char const **)malloc(argCt * sizeof(char*));
+ *pparg++ = pzAutogen;
+
+ do {
+ *pparg++ = *ppz++;
+ } while (--ct > 0);
+ }
+
+ *pparg++ = *pzBase;
+ *pparg++ = "--";
+ *pparg++ = "-";
+ *pparg++ = NULL;
+
+#ifdef DEBUG
+ fputc('\n', stderr);
+ pparg = paparg;
+ for (;;) {
+ fputs(*pparg++, stderr);
+ if (*pparg == NULL)
+ break;
+ fputc(' ', stderr);
+ }
+ fputc('\n', stderr);
+ fputc('\n', stderr);
+#endif
+
+ execvp(pzAutogen, (char**)(void*)paparg);
+ fserr_die("exec of %s %s %s %s\n", paparg[0], paparg[1], paparg[2],
+ paparg[3]);
+}
+
+/*
+ * startAutogen
+ */
+static FILE*
+startAutogen(void)
+{
+ char* pz;
+ FILE* agFp;
+ char* pzBase = NULL;
+
+ /*
+ * Compute the base name.
+ *
+ * If an argument was specified, use that without question.
+ * IF a definition pattern is supplied, and it looks like
+ * a normal name, then use that.
+ * If neither of these work, then use the current directory name.
+ */
+ if (HAVE_OPT(BASE_NAME)) {
+ pzBase = malloc(strlen(OPT_ARG(BASE_NAME)) + 3);
+ strcpy(pzBase, "-b");
+ strcpy(pzBase+2, OPT_ARG(BASE_NAME));
+ }
+ else {
+ /*
+ * IF we have a definition name pattern,
+ * THEN copy the leading part that consists of name-like characters.
+ */
+ if (HAVE_OPT(DEFS_TO_GET)) {
+ char const * pzS = OPT_ARG(DEFS_TO_GET);
+ pzBase = malloc(strlen(pzS) + 3);
+ strcpy(pzBase, "-b");
+
+ pz = pzBase + 2;
+ while (isalnum(*pzS) || (*pzS == '_'))
+ *pz++ = *pzS++;
+ if (pz == pzBase + 2) {
+ free(pzBase);
+ pzBase = NULL;
+ }
+ else
+ *pz = NUL;
+ }
+
+ /*
+ * IF no pattern or it does not look like a name, ...
+ */
+ if (pzBase == NULL) {
+ char zSrch[ MAXPATHLEN ];
+ if (getcwd(zSrch, sizeof(zSrch)) == NULL)
+ fserr_die("on getcwd\n");
+
+ pz = strrchr(zSrch, '/');
+ if (pz == NULL)
+ pz = zSrch;
+ else pz++;
+ pzBase = malloc(strlen(pz) + 3);
+ strcpy(pzBase, "-b");
+ strcpy(pzBase+2, pz);
+ }
+ }
+
+ /*
+ * For our template name, we take the argument (if supplied).
+ * If not, then whatever we decided our base name was will also
+ * be our template name.
+ */
+ if (! HAVE_OPT(TEMPLATE))
+ SET_OPT_TEMPLATE(strdup(pzBase+2));
+
+ /*
+ * Now, what kind of output have we?
+ * If it is a file, open it up and return.
+ * If it is an alternate autogen program,
+ * then set it to whatever the argument said it was.
+ * If the option was not supplied, we default to
+ * whatever we set the "pzAutogen" pointer to above.
+ */
+ if (HAVE_OPT(AUTOGEN)) {
+ agFp = open_ag_file(&pzBase);
+ if (agFp != NULL)
+ return agFp;
+ }
+
+ agFp = open_ag_proc_pipe(&pzBase);
+ if (agFp != NULL)
+ return agFp;
+
+ exec_autogen(&pzBase);
+ return (FILE*)NULL;
+}
+
+
+/*
+ * update_db
+ */
+static void
+update_db(void)
+{
+ FILE* fp;
+
+ if (chmod(OPT_ARG(ORDERING), 0666) == 0) {
+ fp = fopen(OPT_ARG(ORDERING), "a" FOPEN_BINARY_FLAG);
+
+ } else {
+ unlink(OPT_ARG(ORDERING));
+ fp = fopen(OPT_ARG(ORDERING), "w" FOPEN_BINARY_FLAG);
+ pzIndexEOF = pzIndexText;
+ }
+
+ if (fp == (FILE*)NULL)
+ fserr_die("opening %s for write/append\n", OPT_ARG(ORDERING));
+
+ fwrite(pzIndexEOF, (size_t)(pzEndIndex - pzIndexEOF), (size_t)1, fp);
+#ifdef HAVE_FCHMOD
+ fchmod(fileno(fp), 0444);
+ fclose(fp);
+#else
+ fclose(fp);
+ chmod(OPT_ARG(ORDERING), 0444);
+#endif
+}
+
+/* emacs
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of getdefs/getdefs.c */
diff --git a/getdefs/getdefs.h b/getdefs/getdefs.h
new file mode 100644
index 0000000..890551b
--- /dev/null
+++ b/getdefs/getdefs.h
@@ -0,0 +1,120 @@
+/* -*- Mode: C -*-
+ *
+ * getdefs Copyright (c) 1999-2012 by Bruce Korb - all rights reserved
+ *
+ * Time-stamp: "2012-02-28 19:45:07 bkorb"
+ * Author: Bruce Korb <bkorb@gnu.org>
+ *
+ * This file is part of AutoGen.
+ * AutoGen copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GETDEFS_HEADER
+#define GETDEFS_HEADER
+
+#include <sys/wait.h>
+#include <utime.h>
+#include <stdarg.h>
+
+#include REGEX_HEADER
+#include "ag-char-map.h"
+#include "opts.h"
+
+#define EXPORT
+#define MAXNAMELEN 256
+#define MAX_SUBMATCH 1
+#define COUNT(a) (sizeof(a)/sizeof(a[0]))
+#define MARK_CHAR ':'
+
+#define AG_NAME_CHAR(c) (zUserNameCh[(unsigned)(c)] & 2)
+#define USER_NAME_CH(c) (zUserNameCh[(unsigned)(c)] & 1)
+char zUserNameCh[ 256 ] = { '\0' };
+
+/*
+ * Index database string pointers.
+ */
+char* pzIndexText = NULL; /* all the text */
+char* pzEndIndex = NULL; /* end of current */
+char* pzIndexEOF = NULL; /* end of file */
+size_t indexAlloc = 0; /* allocation size */
+
+/*
+ * Name of program to process output (normally ``autogen'')
+ */
+tCC* pzAutogen = "autogen";
+
+/*
+ * const global strings
+ */
+#define DEF_STRING(n,s) char const n[] = s
+DEF_STRING( zGlobal, "\n/* GLOBALDEFS */\n" );
+DEF_STRING( zLineId, "\n#line %d \"%s\"\n" );
+DEF_STRING( zMallocErr, "Error: could not allocate %d bytes for %s\n" );
+DEF_STRING( zAttribRe, "\n[^*\n]*\\*[ \t]*([a-z][a-z0-9_-]*):");
+DEF_STRING( zNameTag, " = {\n name = '" );
+DEF_STRING( zMemberLine, " member = " );
+DEF_STRING( zNoData, "error no data for definition in file %s line %d\n" );
+DEF_STRING( zAgDef, "autogen definitions %s;\n");
+DEF_STRING( zDne,
+ "/* -*- buffer-read-only: t -*- vi: set ro:\n *\n"
+ " *\n * DO NOT EDIT THIS FILE (%s)\n *\n"
+ " * It has been extracted by getdefs from the following files:\n"
+ " *\n" );
+
+/*
+ * ptr to zero (NUL) terminated definition pattern string.
+ *
+ * The pattern we look for starts with the three characters
+ * '/', '*' and '=' and is followed by two names:
+ * the name of a group and the name of the entry within the group.
+ *
+ * The patterns we accept for output may specify a particular group,
+ * certain members within certain groups or all members of all groups
+ */
+regex_t define_re;
+regex_t attrib_re;
+
+/*
+ * The output file pointer. It may be "stdout".
+ * It gets closed when we are done.
+ */
+FILE * evtFp = (FILE*)NULL;
+
+/*
+ * The output file modification time. Only used if we
+ * have specified a real file for output (not stdout).
+ */
+time_t modtime = 0;
+
+/*
+ * The array of pointers to the output blocks.
+ * We build them first, then sort them, then print them out.
+ */
+char** papzBlocks = (char**)NULL;
+size_t blkUseCt = 0;
+size_t blkAllocCt = 0;
+pid_t agPid = -1;
+
+#define LOCAL static
+#endif /* GETDEFS_HEADER */
+
+/* emacs
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of getdefs/getdefs.h */
diff --git a/getdefs/opts.def b/getdefs/opts.def
new file mode 100644
index 0000000..4909a91
--- /dev/null
+++ b/getdefs/opts.def
@@ -0,0 +1,466 @@
+/* -*- Mode: conf -*- */
+
+autogen definitions options;
+
+/*
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+copyright = {
+ date = "1999-2012";
+ type = gpl;
+ owner = "Bruce Korb";
+ eaddr = 'autogen-users@lists.sourceforge.net';
+};
+
+prog-name = "getdefs";
+prog-title = "AutoGen Definition Extraction Tool";
+package = 'GNU AutoGen';
+version = "1.5";
+homerc = /dev/null;
+explain = <<- EndExplanation
+ If no @code{input} argument is provided or is set to simply "-", and if
+ @code{stdin} is not a @code{tty}, then the list of input files will be
+ read from @code{stdin}.
+ EndExplanation;
+guard-option-names;
+
+flag = {
+ name = def-selection;
+ documentation;
+ descrip = 'Specify which definitions are of interest and '
+ 'what to say about them';
+};
+
+flag = {
+ name = "defs_to_get";
+ arg-type = string;
+ arg-name = reg-ex;
+ descrip = 'Regexp to look for after the "/*="';
+ doc = <<- _EOF_
+ If you want definitions only from a particular category, or even
+ with names matching particular patterns, then specify this regular
+ expression for the text that must follow the @code{/*=}.
+ _EOF_; // */
+};
+
+flag = {
+ name = subblock;
+ arg-type = string;
+ arg-name = sub-def;
+ max = NOLIMIT;
+ stack_arg;
+ descrip = "subblock definition names";
+ doc = <<- _EOF_
+ This option is used to create shorthand entries for nested definitions.
+ For example, with:
+ @table @r
+ @item using subblock thus
+ @code{--subblock=arg=argname,type,null}
+ @item and defining an @code{arg} thus
+ @code{arg: this, char *}
+ @item will then expand to:
+ @code{arg = @{ argname = this; type = "char *"; @};}
+ @end table
+ The "this, char *" string is separated at the commas, with the
+ white space removed. You may use characters other than commas by
+ starting the value string with a punctuation character other than
+ a single or double quote character. You may also omit intermediate
+ values by placing the commas next to each other with no intervening
+ white space. For example, "+mumble++yes+" will expand to:
+ @*
+ @code{arg = @{ argname = mumble; null = "yes"; @};}.
+ _EOF_;
+};
+
+flag = {
+ name = listattr;
+ arg-type = string;
+ arg-name = def;
+ max = NOLIMIT;
+ stack_arg;
+ descrip = "attribute with list of values";
+ doc = <<- _EOF_
+ This option is used to create shorthand entries for definitions
+ that generally appear several times. That is, they tend to be
+ a list of values. For example, with:
+ @*
+ @code{listattr=foo} defined, the text:
+ @*
+ @code{foo: this, is, a, multi-list} will then expand to:
+ @*
+ @code{foo = 'this', 'is', 'a', 'multi-list';}
+ @*
+ The texts are separated by the commas, with the
+ white space removed. You may use characters other than commas by
+ starting the value string with a punctuation character other than
+ a single or double quote character.
+ _EOF_;
+};
+
+flag = {
+ name = enumerating;
+ documentation;
+ descrip = 'specify how to number the definitions';
+};
+
+flag = {
+ name = ordering;
+ arg-type = string;
+ arg-optional;
+ arg-name = file-name;
+ disable = no;
+ enabled;
+ descrip = "Alphabetize or use named file";
+ doc = <<- _EOF_
+ By default, ordering is alphabetical by the entry name. Use,
+ @code{no-ordering} if order is unimportant. Use @code{ordering}
+ with no argument to order without case sensitivity. Use
+ @code{ordering=<file-name>} if chronological order is important.
+ getdefs will maintain the text content of @code{file-name}.
+ @code{file-name} need not exist.
+ _EOF_;
+};
+
+flag = {
+ name = first_index;
+ arg_type = number;
+ arg-default = 0;
+ arg-name = first-index;
+ descrip = "The first index to apply to groups";
+ doc = <<- _EOF_
+ By default, the first occurrence of a named definition will have an
+ index of zero. Sometimes, that needs to be a reserved value. Provide
+ this option to specify a different starting point.
+ _EOF_;
+};
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Definition Insertion Options:
+ */
+flag = {
+ name = doc_insert;
+ descrip = "Definition insertion options";
+ documentation;
+};
+
+flag = {
+ name = filelist;
+ arg-type = string;
+ arg-optional;
+ arg-name = file;
+ descrip = "Insert source file names into defs";
+ doc = <<- _EOF_
+ Inserts the name of each input file into the output definitions.
+ If no argument is supplied, the format will be:
+ @example
+ infile = '%s';
+ @end example
+ If an argument is supplied, that string will be used for the entry
+ name instead of @var{infile}.
+ _EOF_;
+};
+
+flag = {
+ name = assign;
+ arg-type = string;
+ arg-name = ag-def;
+ max = NOLIMIT;
+ stack_arg;
+ descrip = "Global assignments";
+ doc = <<- _EOF_
+ The argument to each copy of this option will be inserted into
+ the output definitions, with only a semicolon attached.
+ _EOF_;
+
+};
+
+flag = {
+ name = common_assign;
+ arg-type = string;
+ arg-name = ag-def;
+ max = NOLIMIT;
+ stack_arg;
+ descrip = "Assignments common to all blocks";
+ doc = <<- _EOF_
+ The argument to each copy of this option will be inserted into
+ each output definition, with only a semicolon attached.
+ _EOF_;
+
+};
+
+flag = {
+ name = copy;
+ arg-type = string;
+ arg-name = file;
+ max = NOLIMIT;
+ stack_arg;
+ descrip = "File(s) to copy into definitions";
+ doc = <<- _EOF_
+ The content of each file named by these options will be inserted into
+ the output definitions.
+ _EOF_;
+
+};
+
+flag = {
+ name = srcfile;
+ arg-type = string;
+ arg-optional;
+ arg-name = file;
+ descrip = "Insert source file name into each def";
+ doc = <<- _EOF_
+ Inserts the name of the input file where a definition was found
+ into the output definition.
+ If no argument is supplied, the format will be:
+ @example
+ srcfile = '%s';
+ @end example
+ If an argument is supplied, that string will be used for the entry
+ name instead of @var{srcfile}.
+ _EOF_;
+
+};
+
+flag = {
+ name = linenum;
+ arg-type = string;
+ arg-optional;
+ arg-name = def-name;
+ descrip = "Insert source line number into each def";
+ doc = <<- _EOF_
+ Inserts the line number in the input file where a definition
+ was found into the output definition.
+ If no argument is supplied, the format will be:
+ @example
+ linenum = '%s';
+ @end example
+ If an argument is supplied, that string will be used for the entry
+ name instead of @var{linenum}.
+ _EOF_;
+
+};
+
+flag = {
+ name = input-files;
+ documentation;
+ descrip = 'specify which files to search for markers';
+};
+
+flag = {
+ name = input;
+ arg-type = string;
+ arg-name = src-file;
+ max = NOLIMIT;
+ settable;
+ stack_arg;
+ default;
+ descrip = "Input file to search for defs";
+
+ doc = <<- _EOF_
+ All files that are to be searched for definitions must be named on
+ the command line or read from @code{stdin}. If there is only one
+ @code{input} option and it is the string, "-", then the input file
+ list is read from @code{stdin}. If a command line argument is not
+ an option name and does not contain an assignment operator
+ (@code{=}), then it defaults to being an input file name.
+ At least one input file must be specified.
+ _EOF_;
+};
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Definition Output Disposition Options:
+ */
+flag = {
+ name = doc_output;
+ descrip = "Definition output disposition options:";
+ documentation;
+};
+
+flag = {
+ name = output;
+ equivalence = "autogen";
+ arg-type = string;
+ arg-name = file;
+ descrip = "Output file to open";
+ doc = <<- _EOF_
+ If you are not sending the output to an AutoGen process,
+ you may name an output file instead.
+ _EOF_;
+
+};
+
+flag = {
+ name = "autogen";
+ equivalence = "autogen";
+ arg-type = string;
+ arg-optional;
+ arg-name = ag-cmd;
+ disable = "no";
+ enabled;
+ descrip = "Invoke AutoGen with defs";
+ doc = <<- _EOF_
+ This is the default output mode. Specifying @code{no-autogen} is
+ equivalent to @code{output=-}. If you supply an argument to this
+ option, that program will be started as if it were AutoGen and
+ its standard in will be set to the output definitions of this program.
+ _EOF_;
+
+};
+
+flag = {
+ name = template;
+ arg-type = string;
+ arg-name = file;
+ settable;
+ descrip = "Template Name";
+ doc =
+ "Specifies the template name to be used for generating the final output.";
+};
+
+flag = {
+ name = agarg;
+ arg-type = string;
+ arg-name = ag-opt;
+ max = NOLIMIT;
+ stack_arg;
+ descrip = "AutoGen Argument";
+ flags_cant = output;
+ doc = <<- _EOF_
+ This is a pass-through argument. It allows you to specify any
+ arbitrary argument to be passed to AutoGen.
+ _EOF_;
+
+};
+
+flag = {
+ name = base_name;
+ arg-type = string;
+ arg-name = name;
+ descrip = "Base name for output file(s)";
+ flags_cant = output;
+ doc = <<- _EOF_
+ When output is going to AutoGen, a base name must either be supplied
+ or derived. If this option is not supplied, then it is taken from
+ the @code{template} option. If that is not provided either, then
+ it is set to the base name of the current directory.
+ _EOF_;
+
+};
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Program Documentation
+ */
+
+/* * * * * MAN PAGE DESCRIPTION * * * * * * * * * * * * * * * * * * * */
+
+doc-section = {
+ ds-type = "SEE ALSO";
+ ds-format = texi;
+ ds-text = <<- _EndOfMan_
+ This program is documented more fully in the Getdefs section
+ of the Add-On chapter in the @code{AutoGen} Info system documentation.
+ _EndOfMan_;
+};
+
+/* * * * * DOC DESCRIPTION * * * * * * * * * * * * * * * * * * * */
+
+option-doc-format = texi;
+
+detail = <<- _EOF_
+ This program extracts AutoGen definitions from a list of source files.
+ Definitions are delimited by @code{/*=<entry-type> <entry-name>\n} and
+ @code{=*/\n}.
+ _EOF_;
+
+prog-descrip = <<_EOF_
+This program extracts AutoGen definitions from a list of source files.
+Definitions are delimited by @code{/*=<entry-type> <entry-name>\n} and
+@code{=*/\n}. From that, this program creates a definition of the following
+form:
+
+@example
+ #line nnn "source-file-name"
+ entry_type = @{
+ name = entry_name;
+ ...
+ @};
+@end example
+
+@enumerate
+@item
+The ellipsis @code{...} is filled in by text found between the two
+delimiters. Each line of text is stripped of anything before the first
+asterisk, then leading asterisks, then any leading or trailing white space.
+
+@item
+If what is left starts with what looks like a name followed by a colon, then
+it is interpreted as a name followed by a value.
+
+@item
+If the first character of the value is either a single or double quote, then
+you are responsible for quoting the text as it gets inserted into the output
+definitions. So, if you want whitespace at the beginnings of the lines of
+text, you must do something like this:
+
+@example
+ * mumble:
+ * " this is some\n"
+ * " indented text."
+@end example
+
+@item
+If the @code{<entry-name>} is followed by a comma, the word @code{ifdef} (or
+@code{ifndef}) and a name @code{if_name}, then the above entry will be under
+@code{ifdef} control.
+
+@example
+/*=group entry_name, ifdef FOO
+ * attr: attribute value
+=*/
+@end example
+
+Will produce the following:
+
+@example
+#ifdef FOO
+#line nnn "source-file-name"
+group = @{
+ name = entry_name;
+ attr = 'attribute value';
+@};
+#endif
+@end example
+
+@item
+If you use of the @code{subblock} option, you can specify a nested
+value, @xref{getdefs subblock}. That is, this text:
+
+@example
+ * arg: int, this, what-it-is
+@end example
+
+with the @code{--subblock=arg=type,name,doc} option would yield:
+
+@example
+arg = @{ type = int; name = this; doc = what-it-is; @};
+@end example
+@end enumerate
+_EOF_;
diff --git a/getdefs/proto.h b/getdefs/proto.h
new file mode 100644
index 0000000..ce968a2
--- /dev/null
+++ b/getdefs/proto.h
@@ -0,0 +1,46 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * Prototypes for getdefs
+ * Generated Sat Aug 11 09:41:49 PDT 2012
+ */
+#ifndef GETDEFS_PROTO_H_GUARD
+#define GETDEFS_PROTO_H_GUARD 1
+
+#ifndef LOCAL
+# define LOCAL extern
+# define REDEF_LOCAL 1
+#else
+# undef REDEF_LOCAL
+#endif
+/*
+ * Extracted from gdemit.c
+ */
+LOCAL char*
+emitDefinition(char* pzDef, char* pzOut);
+
+/*
+ * Extracted from gdinit.c
+ */
+LOCAL void
+die(char const * fmt, ...);
+
+LOCAL void
+fserr_die(char const * fmt, ...);
+
+LOCAL void
+processEmbeddedOptions(char* pzText);
+
+LOCAL void
+validateOptions(void);
+
+/*
+ * Extracted from getdefs.c
+ */
+LOCAL char*
+loadFile(char const * pzFname);
+
+#ifdef REDEF_LOCAL
+# undef LOCAL
+# define LOCAL
+#endif
+#endif /* GETDEFS_PROTO_H_GUARD */
diff --git a/getdefs/test/Makefile.am b/getdefs/test/Makefile.am
new file mode 100644
index 0000000..39b97f8
--- /dev/null
+++ b/getdefs/test/Makefile.am
@@ -0,0 +1,41 @@
+## -*- Mode: Makefile -*-
+##
+## Makefile.am -- process this file with automake to produce Makefile.in
+##
+## Author: Bruce Korb <bkorb@gnu.org>
+## Time-stamp: "2010-07-18 09:05:44 bkorb"
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+TESTS = cfg.test index.test option.test subblock.test
+EXTRA_DIST = defs $(TESTS)
+testsubdir = ./testdir
+
+TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) \
+ testsubdir=$(testsubdir) srcdir=$(srcdir) \
+ GDexe=$(GDexe) AGexe=$(AGexe) CLexe=$(CLexe)
+
+distclean-local:
+ -rm -rf $(testsubdir) FAILURES
+
+check : perm-stamp
+
+$(TESTS) : perm-stamp
+
+perm-stamp :
+ cd $(srcdir) ; chmod +x *.test
+
+# Makefile.am ends here
diff --git a/getdefs/test/Makefile.in b/getdefs/test/Makefile.in
new file mode 100644
index 0000000..9a8c02e
--- /dev/null
+++ b/getdefs/test/Makefile.in
@@ -0,0 +1,551 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = getdefs/test
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = @AGexe@
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = @CLexe@
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+TESTS = cfg.test index.test option.test subblock.test
+EXTRA_DIST = defs $(TESTS)
+testsubdir = ./testdir
+TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) \
+ testsubdir=$(testsubdir) srcdir=$(srcdir) \
+ GDexe=$(GDexe) AGexe=$(AGexe) CLexe=$(CLexe)
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu getdefs/test/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu getdefs/test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ fi; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-local
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am check check-TESTS check-am clean clean-generic \
+ clean-libtool distclean distclean-generic distclean-libtool \
+ distclean-local distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am
+
+
+distclean-local:
+ -rm -rf $(testsubdir) FAILURES
+
+check : perm-stamp
+
+$(TESTS) : perm-stamp
+
+perm-stamp :
+ cd $(srcdir) ; chmod +x *.test
+
+# Makefile.am ends here
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/getdefs/test/cfg.test b/getdefs/test/cfg.test
new file mode 100755
index 0000000..1fb6fb0
--- /dev/null
+++ b/getdefs/test/cfg.test
@@ -0,0 +1,115 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# cfg.test --- test config file processing
+#
+## Time-stamp: "2011-02-02 12:03:18 bkorb"
+## Author: Bruce Korb <bkorb@gnu.org>
+#
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if test -z "$srcdir"; then
+ srcdir=`echo "$0" | ${SED} 's,[^/]*$,,'`
+ test -z "$srcdir" && srcdir=.
+ test "$srcdir" = "$0" && srcdir=.
+ test "${VERBOSE+set}" != set && VERBOSE=1
+fi
+. $srcdir/defs
+
+# Create the files we need in the test environment
+cat > ${testname}.c <<- _EOSource_
+
+ /*=* global
+ *
+ * test: subblock
+ * doc: we want to see
+ * just what happens
+ =*/
+
+ /*=gfunc in_p
+ *
+ * exparg: test-string , string to look for
+ + arg-name + arg-desc + arg-opt + arg-list +
+ * exparg: @ string-list @ list of strings to check,, @@ list
+ *
+ * opt: 1
+ * doc:
+ * Return SCM_BOOL_T if the first argument is duplicated
+ * in the second (list) argument.
+ =*/
+ SCM
+ ag_scm_in_p( SCM obj, SCM list )
+ {
+ }
+ _EOSource_
+
+cat > ${testname}.cfg <<- _EOCfg_
+ output ${testname}.out
+ common-assign stumble = grumble
+ assign mumble = stumble ; mumble = grumble
+ template test${testname}
+ subblock exparg=arg_name,arg_desc,arg_optional,arg_list
+ _EOCfg_
+
+cat > ${testname}.test <<- _EOTestOut_
+ /* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ *
+ * DO NOT EDIT THIS FILE (cfg.out)
+ *
+ * It has been extracted by getdefs from the following files:
+ *
+ * cfg.c
+ */
+ autogen definitions testcfg;
+ mumble = stumble ; mumble = grumble;
+
+
+ /* GLOBALDEFS */
+
+ #line 2 "cfg.c"
+ test = 'subblock';
+ doc = 'we want to see
+ just what happens';
+
+
+ #line 9 "cfg.c"
+ gfunc = {
+ name = 'in_p';
+ exparg = {
+ arg_name = 'test-string';
+ arg_desc = 'string to look for';
+ };
+ exparg = {
+ arg_name = 'string-list';
+ arg_desc = 'list of strings to check,,';
+ arg_list = 'list';
+ };
+ opt = '1';
+ doc =
+ 'Return SCM_BOOL_T if the first argument is duplicated
+ in the second (list) argument.';
+ stumble = grumble;
+ };
+ _EOTestOut_
+
+set -x
+${GDexe} load=${testname}.cfg ${testname}.c || \
+ failure running ${GDexe}
+cmp -s ${testname}.test ${testname}.out || \
+ failure "`diff ${testname}.test ${testname}.out`"
+
+# cfg.test ends here
diff --git a/getdefs/test/defs b/getdefs/test/defs
new file mode 100644
index 0000000..000590b
--- /dev/null
+++ b/getdefs/test/defs
@@ -0,0 +1,86 @@
+#! /bin/echo this_file_should_be_sourced,_not_executed
+# -*- Mode: Shell-script -*-
+#
+# defs --- define the environment for autogen tests.
+#
+# Author: Bruce Korb <bkorb@gnu.org>
+# Time-stamp: "2011-02-02 12:04:19 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure srcdir is an absolute path. Supply the variable
+# if it does not exist. We want to be able to run the tests
+# stand-alone!!
+#
+srcdir=${srcdir-.}
+if test ! -d $srcdir ; then
+ echo "defs: installation error" 1>&2
+ exit 1
+fi
+
+# IF the source directory is a Unix or a DOS root directory, ...
+#
+case "$srcdir" in
+ /* | [A-Za-z]:\\*) ;;
+ *) srcdir=`\cd $srcdir && pwd` ;;
+esac
+
+lo_dir=`cd ../../autoopts && pwd`
+test -d ${lo_dir}/.libs && lo_dir=${lo_dir}/.libs
+LD_LIBRARY_PATH=${lo_dir}:${LD_LIBRARY_PATH-/dev/null}
+export LD_LIBRARY_PATH
+
+for SED in `exec 2>/dev/null;which gsed` \
+ /bin/xpg4/bin/sed \
+ `which sed` \
+ /bin/sed \
+ /usr/bin/sed
+do test -x "${SED}" && break ; done
+
+progname=`echo "$0" | ${SED} 's,^.*/,,'`
+testname=`echo "$progname" | ${SED} 's,\..*$,,'`
+testsubdir=${testsubdir-testdir}
+
+# User can set VERBOSE to prevent output redirection
+case x$VERBOSE in
+ xNO | xno | x0 | x)
+ exec > /dev/null 2>&1
+ rm -rf $testsubdir
+ ;;
+esac
+
+test -d $testsubdir || mkdir $testsubdir
+cd $testsubdir
+if test $? != 0 ; then
+ echo "Cannot make or change into $testsubdir"
+ exit 1
+fi
+
+echo "=== Running $progname"
+
+# A standard failure function
+failure()
+{
+ cd ${testsubdir}
+ test -d ../FAILURES || mkdir ../FAILURES
+ l=`echo *`
+ ( \cd ../FAILURES ; rm -f $l )
+ mv -f * ../FAILURES
+ echo "$*"
+ exit 1
+}
+# defs ends here
diff --git a/getdefs/test/index.test b/getdefs/test/index.test
new file mode 100755
index 0000000..35ad971
--- /dev/null
+++ b/getdefs/test/index.test
@@ -0,0 +1,130 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+#
+# subblock.test --- test the subblock parameter to getdefs
+#
+# Author: Bruce Korb <bkorb@gnu.org>
+# Time-stamp: "2011-02-02 12:04:37 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Common definitions
+if test -z "$srcdir"; then
+ srcdir=`echo "$0" | ${SED} 's,[^/]*$,,'`
+ test -z "$srcdir" && srcdir=.
+ test "$srcdir" = "$0" && srcdir=.
+ test "${VERBOSE+set}" != set && VERBOSE=1
+fi
+. $srcdir/defs
+
+
+# Create the files we need in the test environment
+cat > ${testname}.c <<EOF
+/*=--subblock=exparg=arg_name,arg_desc,arg_optional,arg_list=*/
+/*=--listattr=foo=*/
+
+/*=gfunc xtract
+ *
+ * what: extract text from another file
+ * general_use:
+ * exparg: file-name, name of file with text
+ * exparg: marker-fmt, format for marker text
+ * exparg: caveat, warn about changing marker, opt
+ * exparg: default, default initial text, opt
+=*/
+
+/*=gfunc[2] in_p
+ *
+ * exparg: test-string , string to look for
+ + arg-name + arg-desc + arg-opt + arg-list +
+ * exparg: @ string-list @ list of strings to check,, @@ list
+ *
+ * opt: 1
+ * doc: Return SCM_BOOL_T if the first argument is duplicated
+ * in the second (list) argument.
+ * foo: + bar ++ baz +
+=*/
+ SCM
+ag_scm_in_p( SCM obj, SCM list )
+{
+}
+EOF
+
+cat > ${testname}.test <<_EOF_
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ *
+ * DO NOT EDIT THIS FILE (index.out)
+ *
+ * It has been extracted by getdefs from the following files:
+ *
+ * index.c
+ */
+autogen definitions testdir;
+
+#line 14 "index.c"
+gfunc[2] = {
+ name = 'in_p';
+ exparg = {
+ arg_name = 'test-string';
+ arg_desc = 'string to look for';
+ };
+ exparg = {
+ arg_name = 'string-list';
+ arg_desc = 'list of strings to check,,';
+ arg_list = 'list';
+ };
+ opt = '1';
+ doc = 'Return SCM_BOOL_T if the first argument is duplicated
+in the second (list) argument.';
+ foo = 'bar','','baz';
+};
+
+
+#line 4 "index.c"
+gfunc = {
+ name = 'xtract';
+ what = 'extract text from another file';
+ general_use;
+ exparg = {
+ arg_name = 'file-name';
+ arg_desc = 'name of file with text';
+ };
+ exparg = {
+ arg_name = 'marker-fmt';
+ arg_desc = 'format for marker text';
+ };
+ exparg = {
+ arg_name = 'caveat';
+ arg_desc = 'warn about changing marker';
+ arg_optional = 'opt';
+ };
+ exparg = {
+ arg_name = 'default';
+ arg_desc = 'default initial text';
+ arg_optional = 'opt';
+ };
+};
+_EOF_
+
+set -x
+${GDexe} output=$testname.out $testname.c || \
+ failure running ${GDexe}
+cmp -s $testname.test $testname.out || \
+ failure "`diff $testname.test $testname.out`"
+
+# subblock.test ends here
diff --git a/getdefs/test/option.test b/getdefs/test/option.test
new file mode 100755
index 0000000..83c438c
--- /dev/null
+++ b/getdefs/test/option.test
@@ -0,0 +1,107 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+#
+# option.test --- test option extraction
+#
+# Author: Bruce Korb <bkorb@gnu.org>
+# Time-stamp: "2011-02-02 12:04:43 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Common definitions
+if test -z "$srcdir"; then
+ srcdir=`echo "$0" | ${SED} 's,[^/]*$,,'`
+ test -z "$srcdir" && srcdir=.
+ test "$srcdir" = "$0" && srcdir=.
+ test "${VERBOSE+set}" != set && VERBOSE=1
+fi
+. $srcdir/defs
+
+# Create the files we need in the test environment
+cat > ${testname}.c <<EOF
+
+/*=* global
+ *
+ * test: subblock
+ * doc: we want to see
+ * just what happens
+=*/
+
+/*=--subblock=exparg=arg_name,arg_desc,arg_optional,arg_list=*/
+
+/*=gfunc in_p
+ *
+ * exparg: test-string , string to look for
+ + arg-name + arg-desc + arg-opt + arg-list +
+ * exparg: @ string-list @ list of strings to check,, @@ list
+ *
+ * opt: 1
+ * doc:
+ * Return SCM_BOOL_T if the first argument is duplicated
+ * in the second (list) argument.
+=*/
+ SCM
+ag_scm_in_p( SCM obj, SCM list )
+{
+}
+EOF
+
+cat > ${testname}.test <<_EOF_
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ *
+ * DO NOT EDIT THIS FILE (option.out)
+ *
+ * It has been extracted by getdefs from the following files:
+ *
+ * option.c
+ */
+autogen definitions testdir;
+
+/* GLOBALDEFS */
+
+#line 2 "option.c"
+ test = 'subblock';
+ doc = 'we want to see
+just what happens';
+
+
+#line 11 "option.c"
+gfunc = {
+ name = 'in_p';
+ exparg = {
+ arg_name = 'test-string';
+ arg_desc = 'string to look for';
+ };
+ exparg = {
+ arg_name = 'string-list';
+ arg_desc = 'list of strings to check,,';
+ arg_list = 'list';
+ };
+ opt = '1';
+ doc =
+'Return SCM_BOOL_T if the first argument is duplicated
+in the second (list) argument.';
+};
+_EOF_
+set -x
+${GDexe} output=${testname}.out ${testname}.c || \
+ failure running ${GDexe}
+cmp -s ${testname}.test ${testname}.out || \
+ failure "`diff ${testname}.test ${testname}.out`"
+
+# option.test ends here
diff --git a/getdefs/test/subblock.test b/getdefs/test/subblock.test
new file mode 100755
index 0000000..8b1eb3c
--- /dev/null
+++ b/getdefs/test/subblock.test
@@ -0,0 +1,105 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+#
+# subblock.test --- test the subblock parameter to getdefs
+#
+# Author: Bruce Korb <bkorb@gnu.org>
+# Time-stamp: "2011-02-02 12:04:51 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Common definitions
+if test -z "$srcdir"; then
+ srcdir=`echo "$0" | ${SED} 's,[^/]*$,,'`
+ test -z "$srcdir" && srcdir=.
+ test "$srcdir" = "$0" && srcdir=.
+ test "${VERBOSE+set}" != set && VERBOSE=1
+fi
+. $srcdir/defs
+
+
+# Create the files we need in the test environment
+cat > $testname.c <<EOF
+
+/*=* global
+ *
+ * test: subblock
+ * doc: we want to see
+ * just what happens
+=*/
+
+/*=gfunc in_p
+ *
+ * exparg: test-string , string to look for
+ + arg-name + arg-desc + arg-opt + arg-list +
+ * exparg: @ string-list @ list of strings to check,, @@ list
+ *
+ * opt: 1
+ * doc: Return SCM_BOOL_T if the first argument is duplicated
+ * in the second (list) argument.
+=*/
+ SCM
+ag_scm_in_p( SCM obj, SCM list )
+{
+}
+EOF
+
+cat > $testname.test <<_EOF_
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ *
+ * DO NOT EDIT THIS FILE (subblock.out)
+ *
+ * It has been extracted by getdefs from the following files:
+ *
+ * subblock.c
+ */
+autogen definitions testdir;
+
+/* GLOBALDEFS */
+
+#line 2 "subblock.c"
+ test = 'subblock';
+ doc = 'we want to see
+just what happens';
+
+
+#line 9 "subblock.c"
+gfunc = {
+ name = 'in_p';
+ exparg = {
+ arg_name = 'test-string';
+ arg_desc = 'string to look for';
+ };
+ exparg = {
+ arg_name = 'string-list';
+ arg_desc = 'list of strings to check,,';
+ arg_list = 'list';
+ };
+ opt = '1';
+ doc = 'Return SCM_BOOL_T if the first argument is duplicated
+in the second (list) argument.';
+};
+_EOF_
+
+${GDexe} subblock=exparg=arg_name,arg_desc,arg_optional,arg_list \
+ output=$testname.out $testname.c || \
+ failure running ${GDexe}
+cmp -s $testname.test $testname.out || \
+ failure "`diff $testname.test $testname.out`"
+
+# subblock.test ends here
diff --git a/pkg/Makefile.am b/pkg/Makefile.am
new file mode 100644
index 0000000..018143d
--- /dev/null
+++ b/pkg/Makefile.am
@@ -0,0 +1,52 @@
+## -*- Mode: Makefile -*-
+## Makefile.am --- process this file with automake to produce Makefile.in
+##
+## Time-stamp: "2011-06-11 12:02:49 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+DISTCLEANFILES = autogen.lsm
+LIBOPTS_FILES = \
+ libopts/COPYING.gplv3 libopts/COPYING.lgplv3 libopts/COPYING.mbsd \
+ libopts/README libopts/libopts-add.m4 libopts/mklibsrc.sh
+
+TPL_FILES = lsm.tpl spec.tpl gnudir.tpl gnudoc.tpl
+PKG_FILES = mkpkg.linux mkpkg.sh mkpkg.sun pkg-env.in
+EXTRA_DIST = $(TPL_FILES) $(LIBOPTS_FILES) $(PKG_FILES)
+DOCENV = MAKE="$(MAKE)"
+
+all : $(DISTCLEANFILES)
+
+autogen.lsm : $(top_srcdir)/VERSION lsm.tpl
+ top_builddir=$(top_builddir) top_srcdir=$(top_srcdir) \
+ $(AGexe) -L$(top_srcdir)/autoopts -T $(srcdir)/lsm.tpl \
+ $(top_srcdir)/agen5/opts.def
+
+autogen.spec : $(top_srcdir)/VERSION spec.tpl
+ top_builddir=$(top_builddir) top_srcdir=$(top_srcdir) \
+ $(AGexe) -T $(srcdir)/spec.tpl $(top_srcdir)/agen5/opts.def
+
+package :
+ pkgtype=$(pkgtype) \
+ DESTDIR=`cd $(top_builddir) > /dev/null ; pwd`/stage-pkg \
+ $(DOCENV) $(POSIX_SHELL) $(srcdir)/mkpkg.sh
+
+pkg : package
+
+.NOTPARALLEL:
+
+## pkg/Makefile.am ends here
diff --git a/pkg/Makefile.in b/pkg/Makefile.in
new file mode 100644
index 0000000..a4ade52
--- /dev/null
+++ b/pkg/Makefile.in
@@ -0,0 +1,466 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = pkg
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/pkg-env.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = pkg-env
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = @AGexe@
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = @CLexe@
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+DISTCLEANFILES = autogen.lsm
+LIBOPTS_FILES = \
+ libopts/COPYING.gplv3 libopts/COPYING.lgplv3 libopts/COPYING.mbsd \
+ libopts/README libopts/libopts-add.m4 libopts/mklibsrc.sh
+
+TPL_FILES = lsm.tpl spec.tpl gnudir.tpl gnudoc.tpl
+PKG_FILES = mkpkg.linux mkpkg.sh mkpkg.sun pkg-env.in
+EXTRA_DIST = $(TPL_FILES) $(LIBOPTS_FILES) $(PKG_FILES)
+DOCENV = MAKE="$(MAKE)"
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pkg/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu pkg/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+pkg-env: $(top_builddir)/config.status $(srcdir)/pkg-env.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
+
+
+all : $(DISTCLEANFILES)
+
+autogen.lsm : $(top_srcdir)/VERSION lsm.tpl
+ top_builddir=$(top_builddir) top_srcdir=$(top_srcdir) \
+ $(AGexe) -L$(top_srcdir)/autoopts -T $(srcdir)/lsm.tpl \
+ $(top_srcdir)/agen5/opts.def
+
+autogen.spec : $(top_srcdir)/VERSION spec.tpl
+ top_builddir=$(top_builddir) top_srcdir=$(top_srcdir) \
+ $(AGexe) -T $(srcdir)/spec.tpl $(top_srcdir)/agen5/opts.def
+
+package :
+ pkgtype=$(pkgtype) \
+ DESTDIR=`cd $(top_builddir) > /dev/null ; pwd`/stage-pkg \
+ $(DOCENV) $(POSIX_SHELL) $(srcdir)/mkpkg.sh
+
+pkg : package
+
+.NOTPARALLEL:
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/pkg/gnudir.tpl b/pkg/gnudir.tpl
new file mode 100644
index 0000000..85ee236
--- /dev/null
+++ b/pkg/gnudir.tpl
@@ -0,0 +1,142 @@
+%%comments:
+Copyright (c) 2001-2012 by Bruce Korb - all rights reserved
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.1 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+Texts. A copy of the license is included in the file COPYING.
+
+%%name: Autogen
+
+%%short-description: Automated program and text generation
+
+%%full-description: Autogen is a tool designed for generating program
+files that contain repetitive text with varied substitutions. its
+goal is to simplify the maintenance of programs that have large
+amounts of repetitive text. This is particularly valuable
+if there are several blocks of such text that must be kept
+synchronized. The follwing programs and libraries are also included:
+
+<P>AutoOpts- This is a link library that can be redistributed with any
+project. It completely automates the process of parsing command line
+options, configuration files, environment variables, usage text, man
+pages, and the invoking section of an info doc. It currently produces
+option processing code for C, C++, Guile inner-main programs and shell
+scripts.
+
+<P>AutoFSM- Where it is possible to determine a state transition type
+(token code) largely without reference to the current state, this
+template will produce a transition table and prototype finite state
+machine. If you must know current state to determine the transition
+type, this is not useful.
+
+<P>getdefs- Extracts AutoGen definitions from stylized commentes
+embedded in source code.
+
+<P>columns- tabularizes lists for improved output appearance.
+See also ls(1).
+
+<P>AutoXDR- is an affiliated download.
+NFSv4 specifies that its remote procedure calls be batched. Using
+an enhanced XDR specification and the AutoXDR templates, AutoGen
+generates all the grunge code for marshalling and unmarshalling
+the arguments on both sides of the RPC request.
+
+%%category: software development, program build automation
+
+%%license: GPL, LGPL, BSD, public domain
+
+%%license verified by: Janet Casey <jcasey@gnu.org>
+
+%%license verified on: 2001-01-31
+
+%%maintainer: Bruce Korb <bkorb@gnu.org>
+
+%%updated: 2005-02-01
+
+%%keywords: RPC, rpcgen, NFSv4, finite state machine, FSM, Guile, M4
+
+%%interface: Command line
+
+%%programs: autogen, getdefs, columns
+
+%%libraries: AutoOpts, AutoXDR, AutoFSM
+
+%%GNU: yes
+
+%%web-page: http://www.gnu.org/software/autogen
+
+%%support:
+
+%%doc: Developer's reference manual available from
+http://www.gnu.org/manual/autogen/autogen.html
+
+%%developers: Bruce Korb <bkorb@gnu.org>, Gary V. Vaughan <gvv@technie.com>
+
+%%contributors:
+
+%%sponsors:
+
+%%source-tarball: ftp://ftp.gnu.org/pub/gnu/autogen/autogen-5.3.2.tar.gz
+
+%%source-info: http://prdownloads.sourceforge.net/autogen/
+
+%%source-template:
+
+%%debian: http://packages.debian.org/unstable/devel/autogen.html
+
+%%rpm:
+
+%%repository: cvs.AutoGen.sourceforge.net:/cvsroot/AutoGen
+
+%%related: Guile
+
+%%source-language: C, Guile, Bourne shell
+
+%%supported-languages:
+
+%%use-requirements: Guile, Bourne-like shell, POSIX environment
+
+%%build-prerequisites: Guile, ANSI C, Bourne-like shell, POSIX environment
+
+%%weak-prerequisites:
+
+%%source-prerequisites:
+
+%%version: 5.3.2 stable released 2002-02-25
+
+%%announce-list: <autogen-announce@lists.sourceforge.net>
+
+%%announce-news:
+
+%%help-list: <autogen-users@lists.sourceforge.net>
+
+%%help-news:
+
+%%irc-help-channel:
+
+%%dev-list: <autogen-devel@lists.sourceforge.net>
+
+%%dev-news:
+
+%%irc-dev-channel:
+
+%%bug-list: <autogen-users@lists.sourceforge.net>
+
+%%bug-database:
+
+%%Entry Written By: Janet Casey <jcasey@gnu.org>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pkg/gnudoc.tpl b/pkg/gnudoc.tpl
new file mode 100644
index 0000000..8925e6a
--- /dev/null
+++ b/pkg/gnudoc.tpl
@@ -0,0 +1,147 @@
+[= AutoGen5 Template -*- Mode: html -*-
+
+html =][= `
+timestamp=\`sed 's@[^"]*"@@;s@".*@@' <<- \\_EOF_
+ Time-stamp: "2011-02-18 11:22:27 bkorb"
+_EOF_
+\` ` =][=
+
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+=]
+<!--#include virtual="/server/header.html" -->
+[=(dne " == " "<!-- ")=]
+
+ *** THEREFORE *** if you make changes to this file, please
+ email the author so it will not be overwritten :-) "
+
+ -->
+<title>[= title =] - GNU Project - Free Software Foundation (FSF)</title>
+<meta http-equiv="content-type" content='text/html; charset=utf-8' />
+<meta name="generator" content="AutoGen [=(. autogen-version)=]"/>
+<!--#include virtual="/server/banner.html" -->
+<h3>[= project =] version [= version =] - Table of Contents</h3>
+
+<address>Free Software Foundation</address>
+<address>last updated [=`date '+%B %e, %Y'`=]</address>
+
+<p>The manual for the <a href="/software/[=
+ (define proj-name (string-downcase! (get "project")))
+ (define package (string-downcase! (get "package")))
+ package
+ =]">[= project =] project</a> is available in the following formats:</p>[=
+
+(define fnam "")
+(define fsiz 0)
+
+(define (compute-size dir sfx)
+ (begin
+ (set! fnam (string-append dir "/" package sfx))
+ (set! fsiz (if (access? fnam R_OK) (stat:size (stat fnam)) 0 ))
+ (shellf "fsiz='%d'
+ if test ${fsiz} -lt 4096
+ then echo ${fsiz}
+ else
+ fsiz=`expr ${fsiz} / 1024`
+ if test ${fsiz} -lt 2048
+ then echo ${fsiz}K
+ else
+ fsiz=`expr ${fsiz} / 1024`
+ echo ${fsiz}M
+ fi
+ fi" fsiz)
+) )
+
+=]
+<ul>
+ <li>formatted in <a href="html_mono/[= (. package) =].html">HTML ([=
+ (compute-size "html_mono" ".html")
+ =] characters)</a> entirely on one web page.
+ <li>formatted in <a href="html_mono/[= (. package) =].html.gz">HTML ([=
+ (compute-size "html_mono" ".html.gz")
+ =] gzipped bytes)</a> entirely on one web page.
+ <li> formatted in <a href="html_chapter/[= (. package) =]_toc.html">HTML</a>
+ with one web page per chapter.
+ <li> formatted in <a href="html_chapter/[= (. package)
+ =]_chapter_html.tar.gz">HTML ([=
+ (compute-size "html_chapter" "_chapter_html.tar.gz")
+ =] gzipped tar file)</a> with one web page per chapter.
+ <li> formatted in <a href="html_node/[= (. package) =]_toc.html">HTML</a>
+ with one web page per node.
+ <li> formatted in <a href="html_node/[= (. package)
+ =]_node_html.tar.gz">HTML ([=
+ (compute-size "html_node" "_node_html.tar.gz")
+ =] gzipped tar file)</a> with one web page per node.
+ <li>formatted as an <a href="info/[= (. package)
+ =].info.gz">Info document ([=
+ (compute-size "info" ".info.gz")
+ =] bytes gzipped tar file)</a>.
+ <li>formatted as <a href="text/[= (. package) =].txt">ASCII text ([=
+ (compute-size "text" ".txt")
+ =] characters)</a>.
+ <li>formatted as <a href="text/[= (. package) =].txt.gz">ASCII text ([=
+ (compute-size "text" ".txt.gz")
+ =] gzipped bytes)</a>.
+ <li>formatted as <a href="dvi/[= (. package) =].dvi.gz">a TeX dvi file ([=
+ (compute-size "dvi" ".dvi.gz")
+ =] gzipped bytes)</a>.
+ <li>formatted as <a href="pdf/[= (. package) =].pdf.gz">a PDF file ([=
+ (compute-size "pdf" ".pdf.gz")
+ =] gzipped bytes)</a>.
+ <li>formatted as <a href="ps/[= (. package) =].ps.gz">a PostScript file ([=
+ (compute-size "ps" ".ps.gz")
+ =] gzipped bytes)</a>.
+ <li>the original <a href="texi/[= (. package) =].texi.gz">Texinfo source ([=
+ (compute-size "texi" ".texi.gz")
+ =] gzipped bytes)</a>
+</ul>
+
+<p>(This page generated by the <a href="http://www.gnu.org/software/autogen"
+>autogen program</a> in conjunction with <a
+href="http://git.savannah.gnu.org/cgit/autogen.git/tree/pkg/gnudoc.tpl"
+>a fairly simple template</a>.)</p>
+
+<div class="copyright">
+<p>
+Return to the <a href="/home.html">GNU Project home page</a>.
+</p>
+
+<p>
+Please send FSF &amp; GNU inquiries to
+<a href="mailto:gnu@gnu.org"><em>gnu@gnu.org</em></a>.
+There are also <a href="/home.html#ContactInfo">other ways to contact</a>
+the FSF.
+<br />
+Please send broken links and other corrections (or suggestions) to
+<a href="mailto:webmasters@gnu.org"><em>webmasters@gnu.org</em></a>.
+</p>
+
+<p>
+Copyright (C) 2003, 2012[=`date +%Y`
+=] <a href="http://www.fsf.org">Free Software Foundation</a>, Inc.<br />
+Verbatim copying and distribution of this entire article is
+permitted in any medium, provided this notice is preserved.
+</p>
+
+<p>
+Updated:
+[=`echo ${timestamp}`=]
+</p>
+</div>
+
+</body>
+</html>
diff --git a/pkg/libopts/COPYING.gplv3 b/pkg/libopts/COPYING.gplv3
new file mode 100644
index 0000000..f22cdbb
--- /dev/null
+++ b/pkg/libopts/COPYING.gplv3
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ copyright (c) by Bruce Korb - all rights reserved
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> copyright (c) by Bruce Korb - all rights reserved
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/pkg/libopts/COPYING.lgplv3 b/pkg/libopts/COPYING.lgplv3
new file mode 100644
index 0000000..a1bc40d
--- /dev/null
+++ b/pkg/libopts/COPYING.lgplv3
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/pkg/libopts/COPYING.mbsd b/pkg/libopts/COPYING.mbsd
new file mode 100644
index 0000000..8a70427
--- /dev/null
+++ b/pkg/libopts/COPYING.mbsd
@@ -0,0 +1,26 @@
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ 3. The name of the author may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/pkg/libopts/README b/pkg/libopts/README
new file mode 100644
index 0000000..0d9ac64
--- /dev/null
+++ b/pkg/libopts/README
@@ -0,0 +1,122 @@
+ THIS TARBALL IS NOT A FULL DISTRIBUTION.
+
+The contents of this tarball is designed to be incorporated into
+software packages that utilize the AutoOpts option automation package
+and are intended to be installed on systems that may not have libopts
+installed. It is redistributable under the terms of either the LGPL
+(see COPYING.lgpl) or under the terms of the advertising clause free BSD
+license (see COPYING.mbsd).
+
+Usage Instructions for autoconf/automake/libtoolized projects:
+
+1. Install the unrolled tarball into your package source tree,
+ copying ``libopts.m4'' to your autoconf macro directory.
+
+ In your bootstrap (pre-configure) script, you can do this:
+
+ rm -rf libopts libopts-*
+ gunzip -c `autoopts-config libsrc` | tar -xvf -
+ mv -f libopts-*.*.* libopts
+ cp -fp libopts/m4/*.m4 m4/.
+
+ I tend to put my configure auxiliary files in "m4".
+ Whatever directory you choose, if it is not ".", then
+ be sure to tell autoconf about it with:
+
+ AC_CONFIG_AUX_DIR(m4)
+
+ This is one macro where you *MUST* remember to *NOT* quote
+ the argument. If you do, automake will get lost.
+
+2. Add an invocation of either LIBOPTS_CHECK or LIBOPTS_CHECK_NOBUILD
+ to your configure.ac file. See LIBOPTS_CHECK: below for details.
+
+3. Add the following to your top level ``Makefile.am'' file:
+
+ if NEED_LIBOPTS
+ SUBDIRS += $(LIBOPTS_DIR)
+ endif
+
+ where ``<...>'' can be whatever other files or directories you may
+ need. The SUBDIRS must be properly ordered. *PLEASE NOTE* it is
+ crucial that the SUBDIRS be set under the control of an automake
+ conditional. To work correctly, automake has to know the range of
+ possible values of SUBDIRS. It's a magical name with magical
+ properties. ``NEED_LIBOPTS'' will be correctly set by the
+ ``LIBOPTS_CHECK'' macro, above.
+
+4. Add ``$(LIBOPTS_CFLAGS)'' to relevant compiler flags and
+ ``$(LIBOPTS_LDADD)'' to relevant link options whereever
+ you need them in your build tree.
+
+5. Make sure your object files explicitly depend upon the
+ generated options header file. e.g.:
+
+ $(prog_OBJECTS) : prog-opts.h
+ prog-opts.h : prog-opts.c
+ prog-opts.c : prog-opts.def
+ autogen prog-opts.def
+
+6. *OPTIONAL* --
+ If you are creating man pages and texi documentation from
+ the program options, you will need these rules somewhere, too:
+
+ man_MANS = prog.1
+ prog.1 : prog-opts.def
+ autogen -Tagman-cmd.tpl -bprog prog-opts.def
+
+ invoke-prog.texi : prog-opts.def
+ autogen -Tagtexi-cmd.tpl prog-opts.def
+
+If your package does not utilize the auto* tools, then you
+will need to hand craft the rules for building the library.
+
+LIBOPTS_CHECK:
+
+The arguments to both macro are a relative path to the directory with
+the libopts source code. It is optional and defaults to "libopts".
+These macros work as follows:
+
+1. LIBOPTS_CHECK([libopts/rel/path/optional])
+
+ Adds two command-line options to the generated configure script,
+ --enable-local-libopts and --disable-libopts-install. AC_SUBST's
+ LIBOPTS_CFLAGS, LIBOPTS_LDADD, and LIBOPTS_DIR for use in
+ Makefile.am files. Adds Automake conditional NEED_LIBOPTS which
+ will be true when the local copy of libopts should be built. Uses
+ AC_CONFIG_FILES([$libopts-dir/Makefile]) to cause the local libopts
+ into the package build. If the optional relative path to libopts is
+ not provided, it defaults to simply "libopts".
+
+2. LIBOPTS_CHECK_NOBUILD([libopts/rel/path/optional])
+
+ This variant of LIBOPTS_CHECK is useful when multiple configure.ac
+ files in a package make use of a single libopts tearoff. In that
+ case, only one of the configure.ac files should build libopts and
+ others should simply use it. Consider this package arrangment:
+
+ all-tools/
+ configure.ac
+ common-tools/
+ configure.ac
+ libopts/
+
+ The parent package all-tools contains a subpackage common-tools
+ which can be torn off and used independently. Programs configured
+ by both configure.ac files link against the common-tools/libopts
+ tearoff, when not using the system's libopts. The top-level
+ configure.ac uses LIBOPTS_CHECK_NOBUILD([common-tools/libopts]),
+ while common-tools/configure.ac uses LIBOPTS_CHECK. The difference
+ is LIBOPTS_CHECK_NOBUILD will never build the libopts tearoff,
+ leaving that to the subpackage configure.ac's LIBOPTS_CHECK.
+ Specifically, LIBOPTS_CHECK_NOBUILD always results in the
+ NEED_LIBOPTS Automake conditional being false, and does not invoke
+ AC_CONFIG_FILES(path-to-libopts/Makefile).
+
+LICENSING:
+
+This material is Copyright (c) 1992-2012 by Bruce Korb. You are
+licensed to use this under the terms of either the GNU Lesser General
+Public License (see: COPYING.lgpl), or, at your option, the modified
+Berkeley Software Distribution License (see: COPYING.mbsd). Both of
+these files should be included with this tarball.
diff --git a/pkg/libopts/libopts-add.m4 b/pkg/libopts/libopts-add.m4
new file mode 100644
index 0000000..0459f51
--- /dev/null
+++ b/pkg/libopts/libopts-add.m4
@@ -0,0 +1,141 @@
+
+dnl @synopsis LIBOPTS_CHECK
+dnl
+dnl Time-stamp: "2012-02-25 12:54:32 bkorb"
+dnl
+dnl If autoopts-config works, add the linking information to LIBS.
+dnl Otherwise, add ``libopts-${ao_rev}'' to SUBDIRS and run all
+dnl the config tests that the library needs. Invoke the
+dnl "INVOKE_LIBOPTS_MACROS" macro iff we are building libopts.
+dnl
+dnl This file is part of AutoGen.
+dnl AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+dnl
+dnl AutoGen is free software: you can redistribute it and/or modify it
+dnl under the terms of the GNU General Public License as published by the
+dnl Free Software Foundation, either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl AutoGen is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+dnl See the GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License along
+dnl with this program. If not, see <http://www.gnu.org/licenses/>.
+dnl
+dnl Default to system libopts
+dnl
+AC_DEFUN([LIBOPTS_CHECK_COMMON],[
+ AC_REQUIRE([INVOKE_LIBOPTS_MACROS_FIRST])
+ [NEED_LIBOPTS_DIR='']
+ m4_pushdef([AO_Libopts_Dir],
+ [ifelse($1, , [libopts], [$1])])
+ AC_ARG_ENABLE([local-libopts],
+ AC_HELP_STRING([--enable-local-libopts],
+ [Use the supplied libopts tearoff code]),[
+ if test x$enableval = xyes ; then
+ AC_MSG_NOTICE([Using supplied libopts tearoff])
+ LIBOPTS_CFLAGS='-I$(top_srcdir)/AO_Libopts_Dir'
+ NEED_LIBOPTS_DIR=true
+ LIBOPTS_LDADD='$(top_builddir)/AO_Libopts_Dir/libopts.la'
+ fi])
+
+ AC_ARG_ENABLE([libopts-install],
+ AC_HELP_STRING([--enable-libopts-install],
+ [Install libopts with client installation]))
+ AM_CONDITIONAL([INSTALL_LIBOPTS],[test "X${enable_libopts_install}" = Xyes])
+
+ [if test -z "${NEED_LIBOPTS_DIR}" ; then]
+ AC_MSG_CHECKING([whether autoopts-config can be found])
+ AC_ARG_WITH([autoopts-config],
+ AC_HELP_STRING([--with-autoopts-config],
+ [specify the config-info script]),
+ [lo_cv_with_autoopts_config=${with_autoopts_config}],
+ AC_CACHE_CHECK([whether autoopts-config is specified],
+ [lo_cv_with_autoopts_config],
+ [if autoopts-config --help 2>/dev/null 1>&2
+ then lo_cv_with_autoopts_config=autoopts-config
+ elif libopts-config --help 2>/dev/null 1>&2
+ then lo_cv_with_autoopts_config=libopts-config
+ else lo_cv_with_autoopts_config=no ; fi])
+ ) # end of AC_ARG_WITH
+
+ AC_CACHE_VAL([lo_cv_test_autoopts],[
+ if test -z "${lo_cv_with_autoopts_config}" \
+ -o X"${lo_cv_with_autoopts_config}" = Xno
+ then
+ if autoopts-config --help 2>/dev/null 1>&2
+ then lo_cv_with_autoopts_config=autoopts-config
+ elif libopts-config --help 2>/dev/null 1>&2
+ then lo_cv_with_autoopts_config=libopts-config
+ else lo_cv_with_autoopts_config=false ; fi
+ fi
+ lo_cv_test_autoopts=`
+ ${lo_cv_with_autoopts_config} --libs` 2> /dev/null
+ if test $? -ne 0 -o -z "${lo_cv_test_autoopts}"
+ then lo_cv_test_autoopts=no ; fi
+ ]) # end of CACHE_VAL
+ AC_MSG_RESULT([${lo_cv_test_autoopts}])
+
+ [if test "X${lo_cv_test_autoopts}" != Xno
+ then
+ LIBOPTS_LDADD="${lo_cv_test_autoopts}"
+ LIBOPTS_CFLAGS="`${lo_cv_with_autoopts_config} --cflags`"
+ else
+ LIBOPTS_LDADD='$(top_builddir)/]AO_Libopts_Dir[/libopts.la'
+ LIBOPTS_CFLAGS='-I$(top_srcdir)/]AO_Libopts_Dir['
+ NEED_LIBOPTS_DIR=true
+ fi
+ fi # end of if test -z "${NEED_LIBOPTS_DIR}"
+ if test -n "${LIBOPTS_BUILD_BLOCKED}" ; then
+ NEED_LIBOPTS_DIR=''
+ fi]
+ AM_CONDITIONAL([NEED_LIBOPTS], [test -n "${NEED_LIBOPTS_DIR}"])
+ AC_SUBST(LIBOPTS_LDADD)
+ AC_SUBST(LIBOPTS_CFLAGS)
+ AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir)
+ m4_popdef([AO_Libopts_Dir])
+[# end of AC_DEFUN of LIBOPTS_CHECK_COMMON]
+])
+dnl
+dnl AC_CONFIG_FILES conditionalization requires using AM_COND_IF, however
+dnl AM_COND_IF is new to Automake 1.11. To use it on new Automake without
+dnl requiring same, a fallback implementation for older Automake is provided.
+dnl Note that disabling of AC_CONFIG_FILES requires Automake 1.11, this code
+dnl is correct only in terms of m4sh generated script.
+dnl
+m4_ifndef([AM_COND_IF],
+ [AC_DEFUN([AM_COND_IF], [
+ if test -z "$$1_TRUE"; then :
+ m4_n([$2])[]dnl
+ m4_ifval([$3],[
+ else
+ $3
+ ])dnl
+ fi[]dnl
+ ])dnl
+])
+dnl
+AC_DEFUN([LIBOPTS_CHECK_NOBUILD], [
+ m4_pushdef([AO_Libopts_Dir],
+ [ifelse($1, , [libopts], [$1])])
+ LIBOPTS_BUILD_BLOCKED=true
+ LIBOPTS_CHECK_COMMON(AO_Libopts_Dir)
+ m4_popdef([AO_Libopts_Dir])dnl
+# end of AC_DEFUN of LIBOPTS_CHECK_NOBUILD
+])
+dnl
+AC_DEFUN([LIBOPTS_CHECK], [
+ m4_pushdef([AO_Libopts_Dir],
+ [ifelse($1, , [libopts], [$1])])
+ LIBOPTS_BUILD_BLOCKED=''
+ LIBOPTS_CHECK_COMMON(AO_Libopts_Dir)
+ AM_COND_IF([NEED_LIBOPTS], [
+ INVOKE_LIBOPTS_MACROS
+ AC_CONFIG_FILES(AO_Libopts_Dir/Makefile)
+ ])dnl
+ m4_popdef([AO_Libopts_Dir])dnl
+# end of AC_DEFUN of LIBOPTS_CHECK
+])
+
diff --git a/pkg/libopts/mklibsrc.sh b/pkg/libopts/mklibsrc.sh
new file mode 100644
index 0000000..8cb43be
--- /dev/null
+++ b/pkg/libopts/mklibsrc.sh
@@ -0,0 +1,132 @@
+#! /bin/sh
+## -*- Mode: shell-script -*-
+## mklibsrc.sh -- make the libopts tear-off library source tarball
+##
+## Time-stamp: "2011-03-06 15:24:16 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set -e
+
+top_builddir=`cd $top_builddir ; pwd`
+top_srcdir=`cd $top_srcdir ; pwd`
+
+test -x ${top_builddir}/agen5/autogen || exit 0
+test -x ${top_builddir}/columns/columns || exit 0
+
+ao_rev=${AO_CURRENT}.${AO_REVISION}.${AO_AGE}
+tag=libopts-${ao_rev}
+
+cd ${top_builddir}/pkg
+[ ! -d ${tag} ] || rm -rf ${tag}
+mkdir ${tag} ${tag}/compat ${tag}/autoopts ${tag}/m4
+tagd=`pwd`/${tag}
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+#
+# WORKING IN SOURCE DIRECTORY
+#
+cd ${top_builddir}/autoopts
+files=`fgrep '#include' libopts.c | \
+ sed -e 's,"$,,;s,#.*",,' \
+ -e '/^compat\/compat\.h$/d' `
+
+egrep "#define HAVE_PARSE_DURATION" ${top_builddir}/config.h >/dev/null || \
+ files="${files} parse-duration.c parse-duration.h"
+
+for f in libopts.c ${files}
+do
+ test -f ${f} &&
+ cp -f ${f} ${tagd}/${f} && continue
+
+ test -f ${top_srcdir}/autoopts/${f} &&
+ cp -f ${top_srcdir}/autoopts/${f} ${tagd}/${f} && continue
+
+ test -f ${top_srcdir}/${f} &&
+ cp -f ${top_srcdir}/${f} ${tagd}/${f} && continue
+done
+
+cp -f ${top_srcdir}/pkg/libopts/COPYING.* ${tagd}/.
+
+cd ${top_srcdir}/compat
+cp windows-config.h compat.h pathfind.c snprintf.c strdup.c strchr.c \
+ ${tagd}/compat/.
+#
+# END WORK IN SOURCE DIRECTORY
+#
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+cd ${tagd}
+
+cp ${top_srcdir}/config/libopts*.m4 m4/.
+chmod u+w m4/libopts.m4
+cat ${top_srcdir}/pkg/libopts/libopts-add.m4 >> m4/libopts.m4
+test ! -f Makefile.am || rm -f Makefile.am
+
+sed s,'\${tag}',"${tag}",g ${top_srcdir}/pkg/libopts/README > README
+
+touch MakeDefs.inc
+
+vers=${AO_CURRENT}:${AO_REVISION}:${AO_AGE}
+exec 3> Makefile.am
+cat >&3 <<- EOMakefile
+ ## LIBOPTS Makefile
+ MAINTAINERCLEANFILES = Makefile.in
+ if INSTALL_LIBOPTS
+ lib_LTLIBRARIES = libopts.la
+ else
+ noinst_LTLIBRARIES = libopts.la
+ endif
+ libopts_la_SOURCES = libopts.c
+ libopts_la_CPPFLAGS = -I\$(top_srcdir)
+ libopts_la_LDFLAGS = -version-info ${AM_LDFLAGS} ${vers}
+ EXTRA_DIST = \\
+ EOMakefile
+
+find $(ls -A) -type f \
+ | egrep -v '^(libopts\.c|Makefile\.am)$' \
+ | ${CLexe} -I4 --spread=1 --line-sep=" \\" >&3
+exec 3>&-
+
+if gzip --version > /dev/null 2>&1
+then
+ gz='gzip --best'
+ sfx=tar.gz
+else
+ gz=compress
+ sfx=tar.Z
+fi
+
+cd ..
+echo ! cd `pwd`
+echo ! tar cvf ${tag}.${sfx} ${tag}
+tar cvf - ${tag} | $gz > ${top_builddir}/autoopts/${tag}.${sfx}
+rm -rf ${tag}
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+
+## end of mklibsrc.sh
diff --git a/pkg/lsm.tpl b/pkg/lsm.tpl
new file mode 100644
index 0000000..e4835bf
--- /dev/null
+++ b/pkg/lsm.tpl
@@ -0,0 +1,70 @@
+[= AutoGen5 template
+
+lsm=autogen.lsm
+
+# Time-stamp: "2010-02-24 08:37:18 bkorb"
+
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+=]
+Begin4
+Title: AutoGen
+
+Version: [=version=]
+
+Entered-date: [=`date +%Y-%m-%d`=]
+
+Description: AutoGen - [=prog_title=]
+
+ AutoGen is a tool for automatically generating
+ arbitrary text files that contain repetitive text
+ with varying substitutions. This is particularly
+ useful if you have several types of repetitive
+ text that all need to be kept in sync with each
+ other. The goal is to try to simplify the process
+ of maintaining repetitive program text.
+
+Keywords: macro, m4, preprocessor, source generator,
+ command line option parser
+
+Author: bkorb@gnu.org (Bruce Korb)
+
+Maintained-by: bkorb@gnu.org (Bruce Korb)
+
+Primary-site: sunsite.unc.edu /pub/Linux/devel
+ [= `
+cd $top_builddir
+set -- autogen*.gz
+if [ $# -gt 1 ]
+then shift \`expr $# - 1\` ; fi
+if [ ! -f $1 ]
+then ct=1151
+else ct="\`expr \\\\( \\\`wc -c < $1\\\` + 1023 \\\\) / 1024\`"
+fi
+echo ${ct}K $1
+` =]
+ 1K autogen.lsm
+
+Alternate-site: ftp://ftp.gnu.org/pub/autogen
+
+Original-site: http://autogen.sourceforge.net
+
+Platforms: gunzip, Guile and ANSI-C
+
+Copying-policy: GPL and LGPL
+
+End
diff --git a/pkg/mkpkg.linux b/pkg/mkpkg.linux
new file mode 100644
index 0000000..2d11041
--- /dev/null
+++ b/pkg/mkpkg.linux
@@ -0,0 +1,93 @@
+#! /bin/sh
+
+# Time-stamp: "2011-10-07 16:22:48 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+case "${VERBOSE}" in
+"" | f* | F* | n* | N* )
+ VERBOSE=false ;;
+*) VERBOSE=true ; set -x ;;
+esac
+export VERBOSE
+
+eval "`egrep '^AG_' ${top_srcdir}/VERSION`" > /dev/null
+
+## Set directories in case they are relative paths
+##
+builddir=`pwd`
+top_srcdir=`cd ${top_srcdir} > /dev/null ; pwd`
+srcdir=`cd ${srcdir} > /dev/null ; pwd`
+
+cd ${top_builddir}
+top_builddir=`pwd`
+
+rm -rf ./AGPKG
+mkdir AGPKG
+cd AGPKG
+HOME=`pwd`
+
+mkdir -p BUILD SOURCES SPECS RPMS SRPMS
+
+[ -f ../autogen-${AG_VERSION}.tar.gz ] || (
+ cd ..
+ ${MAKE} dist || exit 1
+) || exit 1
+
+ln ../autogen-${AG_VERSION}.tar.gz SOURCES/.
+printf "\n\nPACKAGING RPM FOR LINUX\n\n"
+
+cd ${builddir}
+AG_VERSION=`echo ${AG_VERSION} | sed 's,\.,-,g'`
+specfile=autogen-${AG_VERSION}.spec
+agargs="-L ${srcdir} -L ${top_srcdir}/autoopts"
+agargs="${agargs} -T spec.tpl -b autogen-${AG_VERSION} --writable"
+${AGexe} ${agargs} ${top_srcdir}/agen5/opts.def || exit 1
+
+cd ${HOME}
+
+echo "%_tmppath ${top_builddir}/AGPKG/BUILD
+%_topdir $PWD" > .rpmmacros
+
+cat > .rpmrc <<- _EOF_
+
+ optflags: i386 -O3 -march=i486 -mcpu=i686
+ optflags: i486 -O3 -march=i486
+ optflags: i586 -O3 -march=i586 -mcpu=i686 -fmessage-length=0
+ optflags: i686 -O3 -march=i686 -mcpu=i686
+ optflags: athlon -O3 -march=athlon
+ optflags: ia64 -O3
+ optflags: x86_64 -O3
+ optflags: amd64 -O3
+ optflags: ia32e -O3
+
+ _EOF_
+
+RPM_OPT_FLAGS=-O3 rpmbuild -ba ${builddir}/${specfile} || exit 1
+ln `find . -type f -name '*.rpm'` ${builddir}/.
+cd ${builddir}
+rm -rf ${HOME}
+${VERBOSE} || ls -l *.rpm
+:
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+## end of mkpkg.linux
diff --git a/pkg/mkpkg.sh b/pkg/mkpkg.sh
new file mode 100644
index 0000000..88d5695
--- /dev/null
+++ b/pkg/mkpkg.sh
@@ -0,0 +1,47 @@
+#! /bin/sh
+
+## mkpkg.sh -- create a native package
+## Time-stamp: "2011-10-07 16:22:09 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+test -f pkg-env && . pkg-env
+
+if test -z "${pkgtype}"
+then
+ pkgtype=`sh ${top_srcdir}/config/config.guess | \
+ sed 's,-[^-]*$,,;s,.*-,,'`
+fi
+
+if test ! -f ${srcdir}/mkpkg.${pkgtype}
+then
+ pkgtype=`uname -s | tr '[A-Z]' '[a-z]'`
+ test -f ${srcdir}/mkpkg.${pkgtype} || {
+ echo "No mkpkg script for ${pkgtype}" >&2
+ exit 1
+ }
+fi
+
+. ${srcdir}/mkpkg.${pkgtype}
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+## mkpkg.sh ends here
diff --git a/pkg/mkpkg.sun b/pkg/mkpkg.sun
new file mode 100644
index 0000000..7dc7da1
--- /dev/null
+++ b/pkg/mkpkg.sun
@@ -0,0 +1,152 @@
+#! /bin/sh
+
+# Time-stamp: "2010-02-24 08:37:12 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+case "${VERBOSE}" in
+"" | f* | F* | n* | N* )
+ VERBOSE=false ;;
+*) VERBOSE=true ; set -x ;;
+esac
+export VERBOSE
+
+set -e
+pkgsrc=`pwd`
+agdir=`cd ../agen5 > /dev/null 2>&1 ; pwd`
+
+[ ! -d ${DESTDIR} ] || rm -rf ${DESTDIR} || exit 1
+mkdir ${DESTDIR} || exit 1
+DESTDIR=`cd ${DESTDIR} > /dev/null && pwd` || exit 1
+
+cd ${top_builddir}
+${MAKE} install DESTDIR=${DESTDIR}
+
+cd ${DESTDIR}
+
+if [ ! -d reloc ]
+then
+ mkdir reloc
+ case "${prefix}" in
+ /* ) : ;;
+ * ) prefix="/${prefix}" ;;
+ esac
+ mv .${prefix}/* reloc/. || exit 1
+ p=${prefix}
+ while [ -n "$p" ]
+ do rmdir .${p}
+ p=`echo "$p" | sed 's,/[^/]*$,,'`
+ done
+fi
+
+cp -f ${top_srcdir}/COPYING ./copyright
+
+pkgdst=`pwd`
+[ -f prototype ] && rm -f prototype
+exec 4> prototype
+cat >&4 <<- EOF
+ # Prototype file for AutoGen
+ #
+ # derived by scanning the `pwd` directory
+
+ i copyright
+ i pkginfo
+ i prototype
+ i checkinstall
+ ! default 0755 root sys
+
+ # pt tp ???? obj-name
+ EOF
+
+cd reloc
+
+find * -type d | \
+while read d
+do
+ case "$d" in
+ *autogen* ) mod="0775 root sys" ;;
+ * ) mod="? ? ?" ;;
+ esac
+
+ echo " 1 d none ${d} ${mod}"
+done >&4
+
+echo "! default 0644 root sys" >&4
+
+find * -type f | \
+while read f
+do
+ if [ -x "$f" ]
+ then mod=0755
+ else mod=0644 ; fi
+ echo " 1 f none ${f} $mod root sys"
+done >&4
+
+find * -type l | \
+while read l
+do
+ f=`ls -l $l | sed 's,.* -> ,,'`
+ echo " 1 s none ${l}=${f}"
+done >&4
+
+exec 4>&-
+cd ${pkgdst}
+
+cat > checkinstall <<- EOF
+ PATH=${PATH}:${prefix}/bin
+ guile-config compile > /dev/null 2>&1 && exit 0
+ guile -c '(quit "bye")' && exit 0
+ echo "The guile library does not seem to be present."
+ echo "I have searched the PATH ${PATH}"
+ echo "If it is, please ensure it is in the search path and retry."
+ exit 1
+ EOF
+
+[ -f pkginfo.tpl ] && rm -f pkginfo.tpl
+cat > pkginfo.tpl <<- EOF
+ [= AutoGen5 Template info=pkginfo =]
+ PKG="GNUagen"
+ NAME="AutoGen - [=prog-title=]"
+ VERSION="[= version =]"
+ BASEDIR="${prefix}"
+ DESC="AutoGen - [=prog-title=]"
+ VENDOR="[= copyright.owner =] http://autogen.sf.net"
+ ARCH="sparc"
+ CATEGORY="Development"
+ EMAIL="[= copyright.eaddr =]"
+ CONTACT="[= copyright.owner =]"
+ CLASSES=none
+ PSTAMP="[= version =] `date '+%Y-%m-%d %H:%M:%S'`"
+ EOF
+
+cd ${agdir}
+${AGexe} --writable -L${pkgdst} -Tpkginfo.tpl ${top_srcdir}/agen5/opts.def
+mv -f pkginfo ${pkgdst}/.
+cd ${pkgdst}
+rm -f pkginfo.tpl
+cd ..
+rm -rf GNUagen*
+pkgmk -d. -r ${pkgdst}/reloc,${pkgdst} -f ${pkgdst}/prototype
+pkgtrans -s . GNUagen.pkg GNUagen
+gzip --best GNUagen.pkg
+rm -rf ${pkgdst}
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## End:
+## end of mkpkg.sun
diff --git a/pkg/pkg-env.in b/pkg/pkg-env.in
new file mode 100644
index 0000000..1f702a4
--- /dev/null
+++ b/pkg/pkg-env.in
@@ -0,0 +1,47 @@
+#! /bin/echo this_file_must_be_sourced,_not_executed
+
+## pkg-env.in -- create a native package
+## Time-stamp: "2010-07-16 15:21:11 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set -a
+
+prefix="@prefix@"
+builddir="@abs_builddir@"
+srcdir="@abs_srcdir@"
+top_builddir="@abs_top_builddir@"
+top_srcdir="@abs_top_srcdir@"
+PACKAGE="@PACKAGE@"
+PACKAGE_BUGREPORT="@PACKAGE_BUGREPORT@"
+PACKAGE_NAME="@PACKAGE_NAME@"
+PACKAGE_STRING="@PACKAGE_STRING@"
+PACKAGE_TARNAME="@PACKAGE_TARNAME@"
+PACKAGE_VERSION="@PACKAGE_VERSION@"
+. ${top_srcdir}/VERSION
+AGexe="@AGexe@"
+CLexe="@CLexe@"
+
+set +a
+
+## Local Variables:
+## mode: shell-script
+## indent-tabs-mode: nil
+## sh-indentation: 2
+## sh-basic-offset: 2
+## End:
+## pkg-env.in ends here
diff --git a/pkg/spec.tpl b/pkg/spec.tpl
new file mode 100644
index 0000000..1606b1e
--- /dev/null
+++ b/pkg/spec.tpl
@@ -0,0 +1,151 @@
+[= AutoGen5 Template spec =]
+[= #
+ Time-stamp: "2012-08-11 08:29:25 bkorb"
+
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+\=]
+Summary: AutoGen - [=prog-title=]
+Name: [= prog-name =]
+Version: [= version =]
+Vendor: [= copyright.owner =] http://www.gnu.org/software/autogen
+Release: [=`echo $AG_MAJOR_VERSION`=]
+License: GPL
+Group: Development/Tools
+Source: ftp://ftp.gnu.org/gnu/autogen/rel[= version =]/autogen-[= version
+ =].tar.gz
+BuildRoot: %{_tmppath}/%{name}-root
+
+%description
+AutoGen is a tool designed for generating program files that contain
+repetitive text with varied substitutions. Its goal is to simplify the
+maintenance of programs that contain large amounts of repetitious text.
+This is especially valuable if there are several blocks of such text
+that must be kept synchronized in parallel tables.
+
+Some parts are released under different licensing:
+
+libopts LGPL This is a tear-off, redistributable option processing library
+autofsm BSD This is a template for producing finite state machine programs
+
+The Copyright itself is privately held by Bruce Korb.
+Copyright (c) [= copyright.date =] by [= copyright.owner
+ =]. All rights reserved. Licensed under GPL, [=#
+ =]version 2 or later.
+%prep
+%setup -q
+chmod -R +rw *
+
+%build
+%configure
+make CFLAGS="$RPM_OPT_FLAGS"
+
+if [ `id -u` -eq 0 ] && grep -E -q '^nobody:' /etc/passwd
+then
+ echo "switching to user nobody to run 'make check'"
+ chown -R nobody .
+ su -s /bin/bash -c "umask 002; make check || touch FAIL" nobody
+ test -f FAIL && exit 1 || :
+else
+ make check
+fi
+
+%install
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf ${RPM_BUILD_ROOT}
+mkdir -p ${RPM_BUILD_ROOT}
+make install DESTDIR=${RPM_BUILD_ROOT}
+
+# IF we have a valid file list OR the build root is _the_ root,
+# THEN skip the file list generation.
+#
+if test -s autogen-filelist -o ${#RPM_BUILD_ROOT} -le 1
+then : ; else
+ ( cd ${RPM_BUILD_ROOT}
+ rm -f usr/share/info/dir
+ find . -type f -o -type l | grep -v 'usr/share/doc'
+ ) | sed -e 's@^\./@/@' \
+ -e'/usr\/share\/info/s,$,.gz,' \
+ -e'/usr\/share\/man/s,$,.gz,' \
+ | sort \
+ > autogen-filelist
+fi
+
+%post
+/sbin/ldconfig
+/sbin/install-info --info-dir=%{_infodir} %{_infodir}/autogen.info*
+
+%preun
+/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/autogen.info*
+
+%postun -p /sbin/ldconfig
+
+%clean
+rm -rf ${RPM_BUILD_ROOT}
+
+%files -f autogen-filelist
+%defattr(-,root,root)
+
+%doc[=`
+for f in AUTHORS TODO COPYING NEWS THANKS README
+do test -f ${top_builddir}/$f -o -f ${top_srcdir}/$f && printf " $f" ; done
+`=]
+
+%changelog
+[=
+
+;; Run the following script at spec creation time to insert the
+;; "regenerated" change log entry
+;;
+(out-push-new)
+
+=]
+test -z "${LOGNAME}" && {
+ LOGNAME=`logname` 2>/dev/null
+ case "${LOGNAME}" in
+ *"no login name" )
+ LOGNAME=`id | sed 's,).*,,;s,^.*(,,'` ;;
+ esac
+}
+name=`grep ^${LOGNAME}: /etc/passwd | \
+ sed 's,:/.*,,;s,.*:,,'` 2>/dev/null
+date=`date '+%a %b %e %Y'`
+domain=`dnsdomainname` 2>/dev/null
+
+echo \* ${date} ${name} \<${LOGNAME}@${domain}\> Regenerated
+[=
+
+(shell (out-pop #t))
+
+=]
+* Sun May 6 2012 Install only existing files to doc directory.
+- Omit NOTES and VERSION.
+* Fri Dec 31 2004 Bruce Korb <bkorb@gnu.org> Restored the file list
+* Wed Oct 27 2004 Ed Swierk <eswierk@users.sf.net> fixed up for Fedora
+* Tue Dec 16 2003 Richard Zidlicky <rz@linux-m68k.org> 5.5.7pre5-5
+- fix %%doc
+- add post/pre scriptlets
+- change default prefix
+* Sat Mar 15 2003 Bruce Korb <bkorb@gnu.org>
+- Rework as a template to automatically produce a properly configured RPM
+* Fri Aug 9 2002 Bruce Korb <bkorb@gnu.org>
+- Pull stuff from Thomas Steudten's version of this file[= #'
+
+## Local Variables:
+## mode: shell-script
+## minor-mode: rpm
+## indent-tabs-mode: nil
+## End:
+## end of spec.tpl =]
diff --git a/snprintfv/AUTHORS b/snprintfv/AUTHORS
new file mode 100644
index 0000000..d17456b
--- /dev/null
+++ b/snprintfv/AUTHORS
@@ -0,0 +1,8 @@
+Authors of libsnprintfv. See individual files for their licenses.
+
+Gary V. Vaughan <gary@gnu.org>:
+ Designed, implemented and maintained libsnprintfv up to the 0.98h release.
+
+Paolo Bonzini <bonzini@gnu.org> and
+Bruce Korb <bkorb@gnu.org>:
+ Are currently maintaining libsnprintfv (starting from Summer 2002).
diff --git a/snprintfv/Makefile.am b/snprintfv/Makefile.am
new file mode 100644
index 0000000..a86859a
--- /dev/null
+++ b/snprintfv/Makefile.am
@@ -0,0 +1,48 @@
+## -*- Mode: Makefile -*-
+## ---------------------------------------------------------------------
+## Makefile.am -- process this file with automake to produce Makefile.in
+## Copyright (C) 1998, 1999, 2000, 2002 Gary V. Vaughan
+## Originally by Gary V. Vaughan, 1998
+## This file is part of Snprintfv
+##
+## Snprintfv is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2 of the
+## License, or (at your option) any later version.
+##
+## Snprintfv program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program. If not, write to the Free Software
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+##
+## As a special exception to the GNU General Public License, if you
+## distribute this file as part of a program that also links with and
+## uses the libopts library from AutoGen, you may include it under
+## the same distribution terms used by the libopts library.
+
+## Code:
+
+INCLUDES = -I$(top_srcdir)
+noinst_HEADERS = mem.h filament.h stream.h printf.h compat.h
+dist_noinst_DATA = filament.stamp stream.stamp printf.stamp
+noinst_LTLIBRARIES = libsnprintfv.la
+libsnprintfv_la_LDFLAGS = -no-undefined
+CSRC = filament.c format.c printf.c mem.c stream.c custom.c
+
+nodist_libsnprintfv_la_SOURCES = snv.c
+
+# These files are the raw sources used to generate similarly named
+# header files after extracting the prototypes from the sources
+#
+EXTRA_DIST = filament.in printf.in stream.in $(CSRC)
+
+snv.c : $(CSRC)
+ for f in $(CSRC) ; do echo "#include \"$$f\"" ; done > $@
+
+.NOTPARALLEL:
+
+# Makefile.am ends here
diff --git a/snprintfv/Makefile.in b/snprintfv/Makefile.in
new file mode 100644
index 0000000..23b6acb
--- /dev/null
+++ b/snprintfv/Makefile.in
@@ -0,0 +1,590 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = snprintfv
+DIST_COMMON = README $(dist_noinst_DATA) $(noinst_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/depcomp AUTHORS THANKS
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libsnprintfv_la_LIBADD =
+nodist_libsnprintfv_la_OBJECTS = snv.lo
+libsnprintfv_la_OBJECTS = $(nodist_libsnprintfv_la_OBJECTS)
+libsnprintfv_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libsnprintfv_la_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(nodist_libsnprintfv_la_SOURCES)
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+DATA = $(dist_noinst_DATA)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = @AGexe@
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = @CLexe@
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = -I$(top_srcdir)
+noinst_HEADERS = mem.h filament.h stream.h printf.h compat.h
+dist_noinst_DATA = filament.stamp stream.stamp printf.stamp
+noinst_LTLIBRARIES = libsnprintfv.la
+libsnprintfv_la_LDFLAGS = -no-undefined
+CSRC = filament.c format.c printf.c mem.c stream.c custom.c
+nodist_libsnprintfv_la_SOURCES = snv.c
+
+# These files are the raw sources used to generate similarly named
+# header files after extracting the prototypes from the sources
+#
+EXTRA_DIST = filament.in printf.in stream.in $(CSRC)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu snprintfv/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu snprintfv/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; \
+ locs=`for p in $$list; do echo $$p; done | \
+ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+ sort -u`; \
+ test -z "$$locs" || { \
+ echo rm -f $${locs}; \
+ rm -f $${locs}; \
+ }
+libsnprintfv.la: $(libsnprintfv_la_OBJECTS) $(libsnprintfv_la_DEPENDENCIES) $(EXTRA_libsnprintfv_la_DEPENDENCIES)
+ $(libsnprintfv_la_LINK) $(libsnprintfv_la_OBJECTS) $(libsnprintfv_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snv.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES cscopelist ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am
+
+
+snv.c : $(CSRC)
+ for f in $(CSRC) ; do echo "#include \"$$f\"" ; done > $@
+
+.NOTPARALLEL:
+
+# Makefile.am ends here
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/snprintfv/README b/snprintfv/README
new file mode 100644
index 0000000..9251106
--- /dev/null
+++ b/snprintfv/README
@@ -0,0 +1,30 @@
+This is libsnprintfv, a portable, extensible reimplementation of the
+POSIX format printing API. libsnprintfv provides all the features
+which should be present in a POSIX format printing implementation,
+but which often are not, such as guaranteed return of number of
+characters printed and support for %n$ format specifiers.
+
+In addition the the POSIX features, libsnprintfv also provides some
+extensions to the API, and a GNU glibc-2 compatible printf custom
+format specifier, all of which you can use with impunity if you link
+with libsnprintfv, rather than worrying about whether the target C
+library provides the extensions. See the info manual for details of
+the API calls available, and an explanation of how to write custom
+specifier handlers.
+
+The latest version of libsnprintfv is available from the author's
+homepage: http://www.oranda.demon.co.uk.
+
+libsnprintfv is written in a very portable K&R compatible style, and
+should build anywhere that provides a reasonable C compiler and runtime.
+See the file INSTALL for instructions on how to build and install
+libsnprintfv.
+
+See the file NEWS for a description of user visible changes to
+libsnprintfv between releases.
+
+See the file TODO for a list of outstanding work.
+
+If you have any suggestions or bug reports, please send email to the
+author at <gary@gnu.org>.
+
diff --git a/snprintfv/THANKS b/snprintfv/THANKS
new file mode 100644
index 0000000..0480bbe
--- /dev/null
+++ b/snprintfv/THANKS
@@ -0,0 +1,13 @@
+libsnprintfv would not be what it is without the invaluable help of
+these people:
+
+Everybody who was kind enough to spend time testing libsnprintfv,
+use it in their packages and report bugs.
+
+The following people made especially gracious contributions of their
+time and energy in helping to track down bugs, port to new systems,
+and generally assist in the maintainership process:
+
+Bruce Korb <bkorb@gnu.org>
+Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+Robert Lipe <robertlipe@usa.net>
diff --git a/snprintfv/compat.h b/snprintfv/compat.h
new file mode 100644
index 0000000..0145b97
--- /dev/null
+++ b/snprintfv/compat.h
@@ -0,0 +1,315 @@
+/* -*- Mode: C -*-
+ * --------------------------------------------------------------------
+ * compat.h.in --- verbose but portable cpp defines for snprintfv
+ * Copyright (C) 1999 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1999
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ *
+ * Code: */
+
+#ifndef SNPRINTFV_COMPAT_H
+#define SNPRINTFV_COMPAT_H 1
+
+#define _GNU_SOURCE 1 /* for strsignal in GNU's libc */
+#define __USE_GNU 1 /* exact same thing as above */
+#define __EXTENSIONS__ 1 /* and another way to call for it */
+
+#ifdef __cplusplus
+extern "C" {
+#define SNV_END_EXTERN_C }
+#else
+#define SNV_END_EXTERN_C
+#endif /* __cplusplus */
+
+#define NO_FLOAT_PRINTING
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+
+#ifdef HAVE_ERRNO_H
+# include <errno.h>
+# ifndef errno
+ /* Some sytems #define this! */
+ extern int errno;
+# endif
+#endif
+
+#if defined( HAVE_LIMITS_H )
+# include <limits.h>
+
+#elif defined( HAVE_SYS_LIMITS_H )
+# include <sys/limits.h>
+
+#elif defined( HAVE_VALUES_H )
+# ifndef MAXINT
+# include <values.h>
+# endif /* MAXINT */
+#endif
+
+#if defined( HAVE_STRING_H )
+# include <string.h>
+
+#elif defined( HAVE_STRINGS_H )
+# include <strings.h>
+#endif
+
+#if defined( HAVE_MEMORY_H )
+# include <memory.h>
+#endif
+
+#if defined( HAVE_INTTYPES_H )
+# include <inttypes.h>
+
+#elif defined( HAVE_STDINT_H )
+# include <stdint.h>
+#endif
+
+#ifndef HAVE_UINTMAX_T
+# if defined( HAVE_LONG_LONG )
+ typedef long long intmax_t;
+ typedef unsigned long long uintmax_t;
+# else
+ typedef long intmax_t;
+ typedef unsigned long uintmax_t;
+# endif
+#endif
+
+#if defined( HAVE_STDARG_H )
+# include <stdarg.h>
+# ifndef VA_START
+# define VA_START(a, f) va_start(a, f)
+# define VA_END(a) va_end(a)
+# endif /* VA_START */
+# define SNV_USING_STDARG_H
+#elif defined( HAVE_VARARGS_H )
+# include <varargs.h>
+# ifndef VA_START
+# define VA_START(a, f) va_start(a)
+# define VA_END(a) va_end(a)
+# endif /* VA_START */
+# undef SNV_USING_STDARG_H
+#else
+# include "must-have-stdarg-or-varargs"
+#endif
+
+#if HAVE_RUNETYPE_H
+# include <runetype.h>
+#endif
+
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+
+#ifdef HAVE_WCHAR_T
+typedef wchar_t snv_wchar_t;
+#else
+typedef int snv_wchar_t;
+#endif
+
+#ifdef HAVE_WINT_T
+typedef wint_t snv_wint_t;
+#else
+typedef int snv_wint_t;
+#endif
+
+/* inline and const keywords are (mostly) handled by config.h */
+#ifdef __GNUC__
+# ifndef const
+# define const __const
+# endif
+# ifndef inline
+# define inline __inline
+# endif
+# ifndef signed
+# define signed __signed
+# endif
+#else
+# ifndef __STDC__
+# undef signed
+# define signed
+# endif
+#endif
+
+#ifdef __STDC__
+# define _SNV_STR(x) #x
+ typedef void *snv_pointer;
+ typedef const void *snv_constpointer;
+#else
+# define _SNV_STR(x) "x"
+ typedef char *snv_pointer;
+ typedef char *snv_constpointer;
+#endif
+
+#if defined(HAVE_FPUTC_UNLOCKED) && defined(HAVE_FLOCKFILE)
+# define SNV_FPUTC_UNLOCKED fputc_unlocked
+# define SNV_PUTC_UNLOCKED putc_unlocked
+# define SNV_WITH_LOCKED_FP(fp, tmp_var) \
+ for (flockfile (fp), tmp_var = 1; \
+ tmp_var--; funlockfile (fp))
+#else
+# define SNV_FPUTC_UNLOCKED fputc
+# define SNV_PUTC_UNLOCKED putc
+# define SNV_WITH_LOCKED_FP(fp, tmp_var) \
+ for (tmp_var = 1; tmp_var--; )
+#endif
+
+/*
+ * Define macros for storing integers inside pointers.
+ * Be aware that it is only safe to use these macros to store `int'
+ * values in `char*' (or `void*') words, and then extract them later.
+ * Although it will work the other way round on many common
+ * architectures, it is not portable to assume a `char*' can be
+ * stored in an `int' and extracted later without loss of the msb's
+ */
+#define SNV_POINTER_TO_LONG(p) ((long)(p))
+#define SNV_POINTER_TO_ULONG(p) ((unsigned long)(p))
+#define SNV_LONG_TO_POINTER(i) ((snv_pointer)(long)(i))
+#define SNV_ULONG_TO_POINTER(u) ((snv_pointer)(unsigned long)(u))
+
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#else
+typedef enum {
+ false = 0,
+ true = 1
+} bool;
+#endif
+
+#ifdef __CYGWIN32__
+# ifndef __CYGWIN__
+# define __CYGWIN__
+# endif
+#endif
+#ifdef __CYGWIN__
+# ifndef _WIN32
+# define _WIN32
+# endif
+#endif
+
+#ifndef PARAMS
+# define PARAMS(args) args
+#endif
+
+#undef SNV_STMT_START
+#undef SNV_STMT_END
+#if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
+# define SNV_STMT_START (void)(
+# define SNV_STMT_END )
+
+#elif (defined (sun) || defined (__sun__))
+# define SNV_STMT_START if (1)
+# define SNV_STMT_END else (void)0
+
+#else
+# define SNV_STMT_START do
+# define SNV_STMT_END while (false)
+#endif
+
+#ifdef _WIN32
+# ifdef DLL_EXPORT
+# define SNV_SCOPE extern __declspec(dllexport)
+# else
+# ifdef LIBSNPRINTFV_DLL_IMPORT
+# define SNV_SCOPE extern __declspec(dllimport)
+# endif
+# endif
+#endif
+#ifndef SNV_SCOPE
+# define SNV_SCOPE extern
+#endif
+
+#undef SNV_GNUC_PRINTF
+#undef SNV_GNUC_NORETURN
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+# define SNV_GNUC_PRINTF( args, format_idx, arg_idx ) \
+ args __attribute__((format (printf, format_idx, arg_idx)))
+# define SNV_GNUC_NORETURN \
+ __attribute__((noreturn))
+# define SNV_ASSERT_FCN " (", __PRETTY_FUNCTION__, ")"
+#else /* !__GNUC__ */
+# define SNV_GNUC_PRINTF( args, format_idx, arg_idx ) args
+# define SNV_GNUC_NORETURN
+# define SNV_ASSERT_FCN "", "", ""
+#endif /* !__GNUC__ */
+
+#define SNV_ASSERT_FMT "file %s: line %d%s%s%s: assertion \"%s\" failed.\n"
+
+#define snv_assert(expr) snv_fassert(stderr, expr)
+#define snv_fassert(stream, expr) SNV_STMT_START { \
+ if (!(expr)) { \
+ fprintf (stream, SNV_ASSERT_FMT, __FILE__, __LINE__, \
+ SNV_ASSERT_FCN, _SNV_STR(expr)); \
+ exit(EXIT_FAILURE); \
+ }; } SNV_STMT_END
+
+#define return_if_fail(expr) freturn_if_fail(stderr, expr)
+#define freturn_if_fail(expr) SNV_STMT_START { \
+ if (!(expr)) { \
+ fprintf (stream, SNV_ASSERT_FMT, __FILE__, __LINE__, \
+ SNV_ASSERT_FCN, _SNV_STR(expr)); \
+ return; \
+ }; } SNV_STMT_END
+
+#define return_val_if_fail(expr, val) freturn_val_if_fail(stderr, expr, val)
+#define freturn_val_if_fail(stream, expr, val) SNV_STMT_START { \
+ if (!(expr)) { \
+ fprintf (stream, SNV_ASSERT_FMT, __FILE__, __LINE__, \
+ SNV_ASSERT_FCN, _SNV_STR(expr)); \
+ return val; \
+ }; } SNV_STMT_END
+
+#ifndef MAX
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef MIN
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
+#ifndef ABS
+#define ABS(a) ((a) < 0 ? -(a) : (a))
+#endif
+
+typedef SNV_LONG_DOUBLE snv_long_double;
+
+#ifndef HAVE_STRTOUL
+extern unsigned long
+strtoul( const char *nptrm, char **endptr, register int base );
+#endif
+
+SNV_END_EXTERN_C
+#endif /* SNPRINTFV_COMPAT_H */
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "gnu"
+ * indent-tabs-mode: nil
+ * End:
+ * end of snprintfv/compat.h */
diff --git a/snprintfv/custom.c b/snprintfv/custom.c
new file mode 100644
index 0000000..05793ea
--- /dev/null
+++ b/snprintfv/custom.c
@@ -0,0 +1,182 @@
+/* -*- Mode: C -*- */
+
+/* custom.c --- printf clone for argv arrays
+ * Copyright (C) 2003 Gary V. Vaughan
+ * Originally by Paolo Bonzini, 2002
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+/* Code: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef WITH_DMALLOC
+# include <dmalloc.h>
+#endif
+
+#include <stddef.h>
+
+#if HAVE_RUNETYPE_H
+# include <runetype.h>
+#endif
+
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+
+#include "printf.h"
+
+
+
+/**
+ * printf_generic_info:
+ * @pinfo: the current state information for the format
+ * string parser.
+ * @n: the number of available slots in the @argtypes array
+ * @argtypes: the pointer to the first slot to be filled by the
+ * function
+ *
+ * An example implementation of a %printf_arginfo_function, which
+ * takes the basic type from the type given in the %spec_entry
+ * and adds flags depending on what was parsed (e.g. %PA_FLAG_SHORT
+ * is %pparser->is_short and so on).
+ *
+ * Return value:
+ * Always 1.
+ */
+int
+printf_generic_info (struct printf_info *const pinfo, size_t n, int *argtypes)
+{
+ int type = pinfo->type;
+
+ if (!n)
+ return 1;
+
+ if ((type & PA_TYPE_MASK) == PA_POINTER)
+ type |= PA_FLAG_UNSIGNED;
+
+ if (pinfo->is_char)
+ type = PA_CHAR;
+
+ if (pinfo->is_short)
+ type |= PA_FLAG_SHORT;
+
+ if (pinfo->is_long)
+ type |= PA_FLAG_LONG;
+
+ if (pinfo->is_long_double)
+ type |= PA_FLAG_LONG_LONG;
+
+ argtypes[0] = type;
+ return 1;
+}
+
+
+/**
+ * printf_generic:
+ * @stream: the stream (possibly a struct printfv_stream appropriately
+ * cast) on which to write output.
+ * @pinfo: the current state information for the format string parser.
+ * @args: the pointer to the first argument to be read by the handler
+ *
+ * An example implementation of a %printf_function, used to provide easy
+ * access to justification, width and precision options.
+ *
+ * Return value:
+ * The number of characters output.
+ **/
+int
+printf_generic (STREAM *stream, struct printf_info *const pinfo, union printf_arg const *args)
+{
+ int len = 0, count_or_errorcode = SNV_OK;
+ char *p = NULL;
+
+ /* Used to interface to the custom function. */
+ STREAM *out;
+ Filament *fil;
+ printf_function *user_func = (printf_function *) pinfo->extra;
+
+ return_val_if_fail (pinfo != NULL, SNV_ERROR);
+
+ /* Read these now to advance the argument pointer appropriately */
+ if (pinfo->prec == -1)
+ pinfo->prec = 0;
+
+ /* Check for valid pre-state. */
+ if (pinfo->prec <= -1)
+ {
+ PRINTF_ERROR (pinfo, "invalid flags");
+ return -1;
+ }
+
+ /* Print to a stream using a user-supplied function. */
+ fil = filnew (NULL, (size_t)0);
+ out = stream_new (fil, SNV_UNLIMITED, NULL, snv_filputc);
+ user_func (out, pinfo, args);
+ stream_delete (out);
+ len = fillen (fil);
+ p = fildelete (fil);
+
+ /* Left pad to the width if the supplied argument is less than
+ the width specifier. */
+ if (p != NULL && pinfo->prec && pinfo->prec < len)
+ len = pinfo->prec;
+
+ if ((len < pinfo->width) && !pinfo->left)
+ {
+ int padwidth = pinfo->width - len;
+ while ((count_or_errorcode >= 0) && (count_or_errorcode < padwidth))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+ }
+
+ /* Fill the buffer with as many characters from the format argument
+ * as possible without overflowing or exceeding the precision.
+ */
+ if ((count_or_errorcode >= 0) && (p != NULL))
+ {
+ int mark = count_or_errorcode;
+ while ((count_or_errorcode >= 0) && *p != '\0'
+ && ((pinfo->prec == 0) || (count_or_errorcode - mark < len)))
+ SNV_EMIT (*p++, stream, count_or_errorcode);
+ }
+
+ /* Right pad to the width if we still didn't reach the specified
+ * width and the left justify flag was set.
+ */
+ if ((count_or_errorcode < pinfo->width) && pinfo->left)
+ while ((count_or_errorcode >= 0)
+ && (count_or_errorcode < pinfo->width))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+
+ /* Return the number of characters emitted. */
+ return count_or_errorcode;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "gnu"
+ * indent-tabs-mode: nil
+ * End:
+ * end of snprintfv/custom.c */
diff --git a/snprintfv/filament.c b/snprintfv/filament.c
new file mode 100644
index 0000000..a4b138f
--- /dev/null
+++ b/snprintfv/filament.c
@@ -0,0 +1,232 @@
+/* -*- Mode: C -*- */
+
+/* filament.c --- a bit like a string, but different =)O|
+ * Copyright (C) 1999 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1999
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+/* Commentary:
+ *
+ * Try to exploit usage patterns to optimise string handling, and
+ * as a happy consequence handle NUL's embedded in strings properly.
+ *
+ * o Since finding the length of a (long) string is time consuming and
+ * requires careful coding to cache the result in local scope: We
+ * keep count of the length of a Filament all the time, so finding the
+ * length is O(1) at the expense of a little bookkeeping while
+ * manipulating the Filament contents.
+ *
+ * o Constantly resizing a block of memory to hold a string is memory
+ * efficient, but slow: Filaments are only ever expanded in size,
+ * doubling at each step to minimise the number of times the block
+ * needs to be reallocated and the contents copied (this problem is
+ * especially poignant for very large strings).
+ *
+ * o Most strings tend to be either relatively small and short-lived,
+ * or else long-lived but growing in asymptotically in size: To
+ * care for the former case, Filaments start off with a modest static
+ * buffer for the string contents to avoid any mallocations (except
+ * the initial one to get the structure!); the latter case is handled
+ * gracefully by the resizing algorithm in the previous point.
+ *
+ * o Extracting a C-style NUL terminated string from the Filament is
+ * an extremely common operation: We ensure there is always a
+ * terminating NUL character after the last character in the string
+ * so that the conversion can be performed quickly.
+ *
+ * In summary, Filaments are good where you need to do a lot of length
+ * calculations with your strings and/or gradually append more text
+ * onto existing strings. Filaments are also an easy way to get 8-bit
+ * clean strings is a more lightweight approach isn't required.
+ *
+ * They probably don't buy much if you need to do insertions and partial
+ * deletions, but optimising for that is a whole other problem!
+ */
+
+/* Code: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef WITH_DMALLOC
+# include <dmalloc.h>
+#endif
+
+#include "mem.h"
+#include "filament.h"
+
+
+
+/**
+ * filnew: constructor
+ * @init: address of the first byte to copy into the new object.
+ * @len: the number of bytes to copy into the new object.
+ *
+ * Create a new Filament object, initialised to hold a copy of the
+ * first @len bytes starting at address @init. If @init is NULL, or
+ * @len is 0 (or less), then the initialised Filament will return the
+ * empty string, "", if its value is queried.
+ *
+ * Return value:
+ * A newly created Filament object is returned.
+ **/
+Filament *
+filnew (const char *const init, size_t len)
+{
+ Filament *new;
+
+ new = snv_new (Filament, 1);
+
+ new->value = new->buffer;
+ new->length = 0;
+ new->size = FILAMENT_BUFSIZ;
+
+ return (init || len) ? filinit (new, init, len) : new;
+}
+
+/**
+ * filinit:
+ * @fil: The Filament object to initialise.
+ * @init: address of the first byte to copy into the new object.
+ * @len: the number of bytes to copy into the new object.
+ *
+ * Initialise a Filament object to hold a copy of the first @len bytes
+ * starting at address @init. If @init is NULL, or @len is 0 (or less),
+ * then the Filament will be reset to hold the empty string, "".
+ *
+ * Return value:
+ * The initialised Filament object is returned.
+ **/
+Filament *
+filinit (Filament *fil, const char *const init, size_t len)
+{
+ if (init == NULL || len < 1)
+ {
+ /* Recycle any dynamic memory assigned to the previous
+ contents of @fil, and point back into the static buffer. */
+ if (fil->value != fil->buffer)
+ snv_delete (fil->value);
+
+ fil->value = fil->buffer;
+ fil->length = 0;
+ fil->size = FILAMENT_BUFSIZ;
+ }
+ else
+ {
+ if (len < FILAMENT_BUFSIZ)
+ {
+ /* We have initialisation data which will easily fit into
+ the static buffer: recycle any memory already assigned
+ and initialise in the static buffer. */
+ if (fil->value != fil->buffer)
+ {
+ snv_delete (fil->value);
+ fil->value = fil->buffer;
+ fil->size = FILAMENT_BUFSIZ;
+ }
+ }
+ else
+ {
+ /* If we get to here then we never try to shrink the already
+ allocated dynamic buffer (if any), we just leave it in
+ place all ready to expand into later... */
+ fil_maybe_extend (fil, len, false);
+ }
+
+ snv_assert (len < fil->size);
+
+ fil->length = len;
+ memcpy (fil->value, init, len);
+ }
+
+ return fil;
+}
+
+/**
+ * fildelete: destructor
+ * @fil: The Filament object for recycling.
+ *
+ * The memory being used by @fil is recycled.
+ *
+ * Return value:
+ * The original contents of @fil are converted to a null terminated
+ * string which is returned, either to be freed itself or else used
+ * as a normal C string. The entire Filament contents are copied into
+ * this string including any embedded nulls.
+ **/
+char *
+fildelete (Filament *fil)
+{
+ char *value;
+
+ if (fil->value == fil->buffer)
+ {
+ value = memcpy (snv_new (char, 1 + fil->length),
+ fil->buffer, 1 + fil->length);
+ value[fil->length] = '\0';
+ }
+ else
+ value = filval (fil);
+
+ snv_delete (fil);
+
+ return value;
+}
+
+/**
+ * _fil_extend:
+ * @fil: The Filament object which may need more string space.
+ * @len: The length of the data to be stored in @fil.
+ * @copy: whether to copy data from the static buffer on reallocation.
+ *
+ * This function will will assign a bigger block of memory to @fil
+ * considering the space left in @fil and @len, the length required
+ * for the prospective contents.
+ */
+void
+_fil_extend (Filament *fil, size_t len, bool copy)
+{
+ /* Usually we will simply double the amount of space previously
+ allocated, but if the extra data is larger than the current
+ size it *still* won't fit, so in that case we allocate enough
+ room plus some we leave the current free space to expand into. */
+ fil->size += MAX (len, fil->size);
+
+ if (fil->value == fil->buffer)
+ {
+ fil->value = snv_new (char, fil->size);
+ if (copy)
+ memcpy (fil->value, fil->buffer, fil->length);
+ }
+ else
+ fil->value = snv_renew (char, fil->value, fil->size);
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "gnu"
+ * indent-tabs-mode: nil
+ * End:
+ * end of snprintfv/filament.c */
diff --git a/snprintfv/filament.h b/snprintfv/filament.h
new file mode 100644
index 0000000..c28be6b
--- /dev/null
+++ b/snprintfv/filament.h
@@ -0,0 +1,257 @@
+/* -*- Mode: C -*- */
+
+/* filament.h --- a bit like a string but different =)O|
+ * Copyright (C) 1998, 1999, 2000, 2002 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1998
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+/* Code: */
+
+#ifndef FILAMENT_H
+#define FILAMENT_H 1
+
+#include <snprintfv/compat.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0
+/* This brace is so that emacs can still indent properly: */ }
+#endif
+#endif /* __cplusplus */
+
+#define FILAMENT_BUFSIZ (512 - sizeof(char *) - (2 * sizeof(size_t)))
+
+/**
+ * Filament:
+ * Opaque data type used to hold 8-bit clean dynamic strings which know
+ * their own length and resize themselves to avoid buffer overruns.
+ **/
+typedef struct filament Filament;
+
+struct filament
+{
+ char *value; /* pointer to the start of the string */
+ size_t length; /* length of the string */
+ size_t size; /* total memory allocated */
+ char buffer[FILAMENT_BUFSIZ]; /* usually string == &buffer[0] */
+};
+
+/**
+ * filnew: constructor
+ * @init: address of the first byte to copy into the new object.
+ * @len: the number of bytes to copy into the new object.
+ *
+ * Create a new Filament object, initialised to hold a copy of the
+ * first @len bytes starting at address @init. If @init is NULL, or
+ * @len is 0 (or less), then the initialised Filament will return the
+ * empty string, "", if its value is queried.
+ *
+ * Return value:
+ * A newly created Filament object is returned.
+ **/
+extern Filament *
+filnew (const char *const init, size_t len);
+
+/**
+ * filinit:
+ * @fil: The Filament object to initialise.
+ * @init: address of the first byte to copy into the new object.
+ * @len: the number of bytes to copy into the new object.
+ *
+ * Initialise a Filament object to hold a copy of the first @len bytes
+ * starting at address @init. If @init is NULL, or @len is 0 (or less),
+ * then the Filament will be reset to hold the empty string, "".
+ *
+ * Return value:
+ * The initialised Filament object is returned.
+ **/
+extern Filament *
+filinit (Filament *fil, const char *const init, size_t len);
+
+/**
+ * fildelete: destructor
+ * @fil: The Filament object for recycling.
+ *
+ * The memory being used by @fil is recycled.
+ *
+ * Return value:
+ * The original contents of @fil are converted to a null terminated
+ * string which is returned, either to be freed itself or else used
+ * as a normal C string. The entire Filament contents are copied into
+ * this string including any embedded nulls.
+ **/
+extern char *
+fildelete (Filament *fil);
+
+/**
+ * _fil_extend:
+ * @fil: The Filament object which may need more string space.
+ * @len: The length of the data to be stored in @fil.
+ * @copy: whether to copy data from the static buffer on reallocation.
+ *
+ * This function will will assign a bigger block of memory to @fil
+ * considering the space left in @fil and @len, the length required
+ * for the prospective contents.
+ */
+extern void
+_fil_extend (Filament *fil, size_t len, bool copy);
+
+#line 61 "filament.in"
+
+/* Save the overhead of a function call in the great majority of cases. */
+#define fil_maybe_extend(fil, len, copy) \
+ (((len)>=(fil)->size) ? _fil_extend((fil), (len), (copy)) : (void)0)
+
+/**
+ * filval:
+ * @fil: The Filament object being queried.
+ *
+ * Return value:
+ * A pointer to the null terminated string held by the Filament
+ * object is returned. Since the @fil may contain embedded nulls, it
+ * is not entirely safe to use the strfoo() API to examine the contents
+ * of the return value.
+ **/
+SNV_INLINE char *
+filval (Filament *fil)
+{
+ /* Because we have been careful to ensure there is always at least
+ one spare byte of allocated memory, it is safe to set it here. */
+ fil->value[fil->length] = '\0';
+ return (char *) (fil->value);
+}
+
+/**
+ * fillen:
+ * @fil: The Filament object being queried.
+ *
+ * Return value:
+ * The length of @fil, including any embedded nulls, but excluding the
+ * terminating null, is returned.
+ **/
+SNV_INLINE size_t
+fillen (Filament *fil)
+{
+ return fil->length;
+}
+
+/**
+ * filelt:
+ * @fil: The Filament being queried.
+ * @n: A zero based index into @fil.
+ *
+ * This function looks for the @n'th element of @fil.
+ *
+ * Return value:
+ * If @n is an index inside the Filament @fil, then the character stored
+ * at that index cast to an int is returned, otherwise @n is outside
+ * this range and -1 is returned.
+ **/
+SNV_INLINE int
+filelt (Filament *fil, ssize_t n)
+{
+ if ((n >= 0) && (n < (ssize_t)fil->length))
+ return (int) fil->value[n];
+ else
+ return -1;
+}
+
+/**
+ * filncat:
+ * @fil: The destination Filament of the concatenation.
+ * @str: The address of the source bytes for concatenation.
+ * @n: The number of bytes to be copied from @str.
+ *
+ * @n bytes starting with the byte at address @str are destructively
+ * concatenated to @fil. If necessary, @fil is dynamically reallocated
+ * to make room for this operation.
+ *
+ * Return value:
+ * A pointer to the (not null terminated) string which is the result
+ * of this concatenation is returned.
+ **/
+SNV_INLINE char *
+filncat (Filament *fil, const char *str, size_t n)
+{
+ fil_maybe_extend (fil, n + fil->length, true);
+ memcpy (fil->value + fil->length, str, n);
+ fil->length += n;
+ return fil->value;
+}
+
+/**
+ * filcat:
+ * @fil: The destination Filament of the concatenation.
+ * @str: The address of the source bytes for concatenation.
+ *
+ * The bytes starting at address @str upto and including the first null
+ * byte encountered are destructively concatenated to @fil. If
+ * necessary @fil is dynamically reallocated to make room for this
+ * operation.
+ *
+ * Return value:
+ * A pointer to the (not null terminated) string which is the result
+ * of this concatenation is returned.
+ **/
+SNV_INLINE char *
+filcat (Filament *fil, const char *str)
+{
+ size_t length = strlen (str);
+ return filncat (fil, str, length);
+}
+
+/**
+ * filccat:
+ * @fil: The destination Filament of the concatenation.
+ * @c: The character to append to @fil.
+ *
+ * @c is destructively concatenated to @fil. If necessary, @fil is
+ * dynamically reallocated to make room for this operation. When used
+ * repeatedly this function is less efficient than %filncat,
+ * since it must check whether to extend the filament before each
+ * character is appended.
+ *
+ * Return value:
+ * A pointer to the (not null terminated) string which is the result
+ * of this concatenation is returned.
+ **/
+SNV_INLINE char *
+filccat (Filament *fil, int c)
+{
+ fil_maybe_extend (fil, 1 + fil->length, true);
+ fil->value[fil->length++] = c;
+ return fil->value;
+}
+
+#ifdef __cplusplus
+#if 0
+/* This brace is so that emacs can still indent properly: */
+{
+#endif
+}
+#endif /* __cplusplus */
+
+#endif /* FILAMENT_H */
+
+/* filament.h ends here */
diff --git a/snprintfv/filament.in b/snprintfv/filament.in
new file mode 100644
index 0000000..0fb8923
--- /dev/null
+++ b/snprintfv/filament.in
@@ -0,0 +1,197 @@
+/* -*- Mode: C -*- */
+
+/* filament.h --- a bit like a string but different =)O|
+ * Copyright (C) 1998, 1999, 2000, 2002 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1998
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+/* Code: */
+
+#ifndef FILAMENT_H
+#define FILAMENT_H 1
+
+#include <snprintfv/compat.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0
+/* This brace is so that emacs can still indent properly: */ }
+#endif
+#endif /* __cplusplus */
+
+#define FILAMENT_BUFSIZ (512 - sizeof(char *) - (2 * sizeof(size_t)))
+
+/**
+ * Filament:
+ * Opaque data type used to hold 8-bit clean dynamic strings which know
+ * their own length and resize themselves to avoid buffer overruns.
+ **/
+typedef struct filament Filament;
+
+struct filament
+{
+ char *value; /* pointer to the start of the string */
+ size_t length; /* length of the string */
+ size_t size; /* total memory allocated */
+ char buffer[FILAMENT_BUFSIZ]; /* usually string == &buffer[0] */
+};
+
+@protos filament.c
+
+/* Save the overhead of a function call in the great majority of cases. */
+#define fil_maybe_extend(fil, len, copy) \
+ (((len)>=(fil)->size) ? _fil_extend((fil), (len), (copy)) : (void)0)
+
+/**
+ * filval:
+ * @fil: The Filament object being queried.
+ *
+ * Return value:
+ * A pointer to the null terminated string held by the Filament
+ * object is returned. Since the @fil may contain embedded nulls, it
+ * is not entirely safe to use the strfoo() API to examine the contents
+ * of the return value.
+ **/
+SNV_INLINE char *
+filval (Filament *fil)
+{
+ /* Because we have been careful to ensure there is always at least
+ one spare byte of allocated memory, it is safe to set it here. */
+ fil->value[fil->length] = '\0';
+ return (char *) (fil->value);
+}
+
+/**
+ * fillen:
+ * @fil: The Filament object being queried.
+ *
+ * Return value:
+ * The length of @fil, including any embedded nulls, but excluding the
+ * terminating null, is returned.
+ **/
+SNV_INLINE size_t
+fillen (Filament *fil)
+{
+ return fil->length;
+}
+
+/**
+ * filelt:
+ * @fil: The Filament being queried.
+ * @n: A zero based index into @fil.
+ *
+ * This function looks for the @n'th element of @fil.
+ *
+ * Return value:
+ * If @n is an index inside the Filament @fil, then the character stored
+ * at that index cast to an int is returned, otherwise @n is outside
+ * this range and -1 is returned.
+ **/
+SNV_INLINE int
+filelt (Filament *fil, ssize_t n)
+{
+ if ((n >= 0) && (n < (ssize_t)fil->length))
+ return (int) fil->value[n];
+ else
+ return -1;
+}
+
+/**
+ * filncat:
+ * @fil: The destination Filament of the concatenation.
+ * @str: The address of the source bytes for concatenation.
+ * @n: The number of bytes to be copied from @str.
+ *
+ * @n bytes starting with the byte at address @str are destructively
+ * concatenated to @fil. If necessary, @fil is dynamically reallocated
+ * to make room for this operation.
+ *
+ * Return value:
+ * A pointer to the (not null terminated) string which is the result
+ * of this concatenation is returned.
+ **/
+SNV_INLINE char *
+filncat (Filament *fil, const char *str, size_t n)
+{
+ fil_maybe_extend (fil, n + fil->length, true);
+ memcpy (fil->value + fil->length, str, n);
+ fil->length += n;
+ return fil->value;
+}
+
+/**
+ * filcat:
+ * @fil: The destination Filament of the concatenation.
+ * @str: The address of the source bytes for concatenation.
+ *
+ * The bytes starting at address @str upto and including the first null
+ * byte encountered are destructively concatenated to @fil. If
+ * necessary @fil is dynamically reallocated to make room for this
+ * operation.
+ *
+ * Return value:
+ * A pointer to the (not null terminated) string which is the result
+ * of this concatenation is returned.
+ **/
+SNV_INLINE char *
+filcat (Filament *fil, const char *str)
+{
+ size_t length = strlen (str);
+ return filncat (fil, str, length);
+}
+
+/**
+ * filccat:
+ * @fil: The destination Filament of the concatenation.
+ * @c: The character to append to @fil.
+ *
+ * @c is destructively concatenated to @fil. If necessary, @fil is
+ * dynamically reallocated to make room for this operation. When used
+ * repeatedly this function is less efficient than %filncat,
+ * since it must check whether to extend the filament before each
+ * character is appended.
+ *
+ * Return value:
+ * A pointer to the (not null terminated) string which is the result
+ * of this concatenation is returned.
+ **/
+SNV_INLINE char *
+filccat (Filament *fil, int c)
+{
+ fil_maybe_extend (fil, 1 + fil->length, true);
+ fil->value[fil->length++] = c;
+ return fil->value;
+}
+
+#ifdef __cplusplus
+#if 0
+/* This brace is so that emacs can still indent properly: */
+{
+#endif
+}
+#endif /* __cplusplus */
+
+#endif /* FILAMENT_H */
+
+/* filament.h ends here */
diff --git a/snprintfv/filament.stamp b/snprintfv/filament.stamp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/snprintfv/filament.stamp
diff --git a/snprintfv/format.c b/snprintfv/format.c
new file mode 100644
index 0000000..bed8d17
--- /dev/null
+++ b/snprintfv/format.c
@@ -0,0 +1,1275 @@
+/* -*- Mode: C -*- */
+
+/* format.c --- printf clone for argv arrays
+ * Copyright (C) 1998, 1999, 2000, 2002 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1998
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+/* Code: */
+
+#include "compat.h"
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#else
+#include <sys/limits.h>
+#endif
+
+#ifdef WITH_DMALLOC
+# include <dmalloc.h>
+#endif
+
+#include <float.h>
+#include <math.h>
+#include <stddef.h>
+
+#if HAVE_RUNETYPE_H
+# include <runetype.h>
+#endif
+
+#ifdef HAVE_WCHAR_H
+# include <wchar.h>
+#endif
+
+#include "printf.h"
+
+#ifndef NO_FLOAT_PRINTING
+# ifdef HAVE_LONG_DOUBLE
+# ifndef HAVE_ISNANL
+# define isnanl(x) ((x) != (x))
+# endif
+# ifndef HAVE_ISINFL
+# define isinfl(x) isnanl ((x) - (x))
+# endif
+# ifndef HAVE_MODFL
+static snv_long_double modfl (long double x, long double *exp);
+# endif
+# ifndef HAVE_COPYSIGNL
+static snv_long_double copysignl (long double x, long double y);
+# endif
+# else
+# ifdef HAVE_ISNAN
+# define isnanl isnan
+# else
+# define isnanl(x) ((x) != (x))
+# endif
+# ifdef HAVE_ISINF
+# define isinfl isinf
+# else
+# define isinfl(x) isnanl ((x) - (x))
+# endif
+# ifdef HAVE_COPYSIGN
+# define copysignl copysign
+# else
+# define copysign(x, y) (((x) < 0.0 ^ (y) < 0.0) ? (x) * -1.0 : (x));
+# endif
+# define modfl modf
+# endif
+#endif
+
+
+static uintmax_t
+fetch_uintmax (struct printf_info *pinfo, union printf_arg const *arg)
+{
+ if (pinfo->is_long_double)
+ return (uintmax_t) arg->pa_u_long_long_int;
+
+ if (pinfo->is_long)
+ return (uintmax_t) arg->pa_u_long_int;
+
+ if (pinfo->is_short)
+ return (uintmax_t) arg->pa_u_short_int;
+
+ if (pinfo->is_char)
+ return (uintmax_t) arg->pa_char;
+
+ return (uintmax_t) arg->pa_u_int;
+}
+
+static intmax_t
+fetch_intmax (struct printf_info *pinfo, union printf_arg const *arg)
+{
+ if (pinfo->is_long_double)
+ return (intmax_t) (signed long long) arg->pa_long_long_int;
+
+ if (pinfo->is_long)
+ return (intmax_t) (signed long) arg->pa_long_int;
+
+ if (pinfo->is_short)
+ return (intmax_t) (signed short) arg->pa_short_int;
+
+ if (pinfo->is_char)
+ return (intmax_t) (signed char) arg->pa_char;
+
+ return (intmax_t) (signed int) arg->pa_int;
+}
+
+#ifndef NO_FLOAT_PRINTING
+static snv_long_double
+fetch_double (struct printf_info *pinfo, union printf_arg const *arg)
+{
+ if (pinfo->is_long_double)
+ return (snv_long_double) arg->pa_long_double;
+ else
+ return (snv_long_double) (arg->pa_double);
+}
+#endif
+
+
+#ifndef NO_FLOAT_PRINTING
+
+/* These two routines are cleaned up version of the code in libio 2.95.3
+ (actually I got it from the Attic, not from the released tarball).
+ The changes were mainly to share code between %f and %g (libio did
+ share some code between %e and %g), and to share code between the
+ %e and %f when invoked by %g. Support from infinities and NaNs comes
+ from the old snprintfv code. */
+
+typedef struct {
+ int pfs_prec;
+ int fmtch;
+ int expcnt;
+ int gformat;
+ char * scan_back_pz;
+ char * out_pz;
+ char * start_pz;
+ char * pfs_end;
+ snv_long_double fract;
+ snv_long_double integer;
+ snv_long_double tmp;
+} print_float_status_t;
+
+static char *
+print_float_round (snv_long_double fract, int *exp, char *start, char *end,
+ char ch, int *signp)
+{
+ snv_long_double tmp;
+ if (fract)
+ (void) modfl (fract * 10, &tmp);
+ else
+ tmp = ch - '0';
+
+ if (tmp > 4)
+ for (;; --end)
+ {
+ if (*end == '.')
+ --end;
+ if (end == start)
+ {
+ if (exp) /* e/E; increment exponent */
+ ++end, ++*exp;
+
+ *end = '1';
+ break;
+ }
+ if (++*end <= '9')
+ break;
+ *end = '0';
+ }
+
+ /* ``"%.3f", (double)-0.0004'' gives you a negative 0. */
+ else if (*signp == '-')
+ for (;; --end)
+ {
+ if (*end == '.')
+ --end;
+ if (*end != '0')
+ break;
+ if (end == start)
+ *signp = 0;
+ }
+ return (start);
+}
+
+static void
+fiddle_precision (print_float_status_t * pfs)
+{
+ /* %e/%f/%#g add 0's for precision, others trim 0's */
+ if (pfs->gformat && !pinfo->alt)
+ {
+ while (pfs->out_pz > pfs->start_pz && *--pfs->out_pz == '0');
+ if (*pfs->out_pz != '.')
+ ++pfs->out_pz;
+ }
+ else
+ for (; pfs->pfs_prec--; *pfs->out_pz++ = '0');
+}
+
+static void
+do_fformat (print_float_status_t * pfs)
+{
+ /* reverse integer into beginning of buffer */
+ if (pfs->expcnt)
+ for (; ++pfs->scn_bk_pz < pfs->pfs_end; *pfs->out_pz++ = *pfs->scn_bk_pz);
+ else
+ *pfs->out_pz++ = '0';
+
+ /* If precision required or alternate flag set, add in a
+ decimal point. */
+ if (pinfo->prec || pinfo->alt)
+ *pfs->out_pz++ = '.';
+
+ /* if requires more precision and some fraction left */
+ if (pfs->fract)
+ {
+ if (pfs->pfs_prec)
+ {
+ /* For %g, if no integer part, don't count initial
+ zeros as significant digits. */
+ do
+ {
+ pfs->fract = modfl (pfs->fract * 10, &pfs->tmp);
+ *pfs->out_pz++ = '0' + ((int) pfs->tmp);
+ }
+ while (!pfs->tmp && !pfs->expcnt && pfs->gformat);
+
+ while (--pfs->pfs_prec && pfs->fract)
+ {
+ pfs->fract = modfl (pfs->fract * 10, &pfs->tmp);
+ *pfs->out_pz++ = '0' + ((int) pfs->tmp);
+ }
+ }
+
+ if (pfs->fract)
+ pfs->start_pz =
+ print_float_round (pfs->fract, (int *) NULL, pfs->start_pz,
+ pfs->out_pz - 1, (char) 0, signp);
+ }
+
+ fiddle_precision (pfp);
+}
+
+static void
+do_eformat (print_float_status_t * pfs)
+{
+ if (pfs->expcnt)
+ {
+ *pfs->out_pz++ = *++pfs->scn_bk_pz;
+ if (pinfo->prec || pinfo->alt)
+ *pfs->out_pz++ = '.';
+
+ /* if requires more precision and some integer left */
+ for (; pfs->pfs_prec && ++pfs->scn_bk_pz < pfs->pfs_end; --pfs->pfs_prec)
+ *pfs->out_pz++ = *pfs->scn_bk_pz;
+
+ /* if done precision and more of the integer component,
+ round using it; adjust fract so we don'pfs->out_pz re-round
+ later. */
+ if (!pfs->pfs_prec && ++pfs->scn_bk_pz < pfs->pfs_end)
+ {
+ pfs->fract = 0;
+ pfs->start_pz = print_float_round (
+ (snv_long_double) 0, &pfs->expcnt, pfs->start_pz, pfs->out_pz - 1,
+ *pfs->scn_bk_pz, signp);
+ }
+
+ /* adjust expcnt for digit in front of decimal */
+ --pfs->expcnt;
+ }
+
+ /* until first fractional digit, decrement exponent */
+ else if (pfs->fract)
+ {
+ /* adjust expcnt for digit in front of decimal */
+ for (pfs->expcnt = -1;; --pfs->expcnt)
+ {
+ pfs->fract = modfl (pfs->fract * 10, &pfs->tmp);
+ if (pfs->tmp)
+ break;
+ }
+ *pfs->out_pz++ = '0' + ((int) pfs->tmp);
+ if (pinfo->prec || pinfo->alt)
+ *pfs->out_pz++ = '.';
+ }
+
+ else
+ {
+ *pfs->out_pz++ = '0';
+ if (pinfo->prec || pinfo->alt)
+ *pfs->out_pz++ = '.';
+ }
+
+ /* if requires more precision and some fraction left */
+ if (pfs->fract)
+ {
+ if (pfs->pfs_prec)
+ do
+ {
+ pfs->fract = modfl (pfs->fract * 10, &pfs->tmp);
+ *pfs->out_pz++ = '0' + ((int) pfs->tmp);
+ }
+ while (--pfs->pfs_prec && pfs->fract);
+
+ if (pfs->fract)
+ pfs->start_pz = print_float_round (
+ pfs->fract, &pfs->expcnt, pfs->start_pz, pfs->out_pz - 1,
+ (char) 0, signp);
+ }
+
+ fiddle_precision (pfp);
+
+ if (pfs.fmtch != 'e' && pfs.fmtch != 'E')
+ return;
+
+ {
+ char expbuf[10];
+ *pfs.out_pz++ = pfs.fmtch;
+ if (pfs.expcnt < 0)
+ {
+ pfs.expcnt = -pfs.expcnt;
+ *pfs.out_pz++ = '-';
+ }
+ else
+ *pfs.out_pz++ = '+';
+
+ pfs.scn_bk_pz = expbuf;
+ do
+ *pfs.scn_bk_pz++ = '0' + (pfs.expcnt % 10);
+ while ((pfs.expcnt /= 10) > 9);
+ *pfs.scn_bk_pz++ = '0' + pfs.expcnt;
+ while (pfs.scn_bk_pz > expbuf)
+ *pfs.out_pz++ = *--pfs.scn_bk_pz;
+ }
+}
+
+static void
+do_gformat (print_float_status_t * pfs)
+{
+ pfs->gformat = 1;
+
+ /* a precision of 0 is treated as a precision of 1. */
+ if (!pfs->pfs_prec)
+ pinfo->prec = ++pfs->pfs_prec;
+
+ /* ``The style used depends on the value converted; style e
+ will be used only if the exponent resulting from the
+ conversion is less than -4 or greater than the precision.''
+ -- ANSI X3J11 */
+ if ( (pfs->expcnt > pfs->pfs_prec)
+ || (!pfs->expcnt && pfs->fract && pfs->fract < .0001L))
+ {
+ /* g/G format counts "significant digits, not digits of
+ precision; for the e/E format, this just causes an
+ off-by-one problem, i.e. g/G considers the digit
+ before the decimal point significant and e/E doesn't
+ count it as precision. */
+ --pfs->pfs_prec;
+ pfs->fmtch -= 2; /* G->E, g->e */
+ do_eformat (pfs);
+ }
+ else
+ {
+ /* Decrement precision */
+ if (fnum != 0.0L)
+ pfs->pfs_prec -= (pfs->pfs_end - pfs->scn_bk_pz) - 1;
+ else
+ pfs->pfs_prec--;
+
+ do_fformat (pfs);
+ }
+}
+
+static int
+print_float (struct printf_info *pinfo, char *startp, char *endp, int *signp,
+ snv_long_double fnum)
+{
+ print_float_status_t pfs = {
+ .pfs_prec = pinfo->prec,
+ .pfs_end = endp,
+ .fmtch = pinfo->spec,
+ .out_pz = startp,
+ .start_pz = startp,
+ .gformat = 0
+ };
+
+ *signp = 0;
+
+ /* Do the special cases: nans, infinities, zero, and negative numbers. */
+ if (isnanl (fnum))
+ {
+ /* Not-a-numbers are printed as a simple string. */
+ *pfs.out_pz++ = pfs.fmtch < 'a' ? 'N' : 'n';
+ *pfs.out_pz++ = pfs.fmtch < 'a' ? 'A' : 'a';
+ *pfs.out_pz++ = pfs.fmtch < 'a' ? 'N' : 'n';
+ return pfs.out_pz - pfs.start_pz;
+ }
+
+ /* Zero and infinity also can have a sign in front of them. */
+ if (copysignl (1.0, fnum) < 0.0)
+ {
+ fnum = -1.0 * fnum;
+ *signp = '-';
+ }
+
+ if (isinfl (fnum))
+ {
+ /* Infinities are printed as a simple string. */
+ *pfs.out_pz++ = pfs.fmtch < 'a' ? 'I' : 'i';
+ *pfs.out_pz++ = pfs.fmtch < 'a' ? 'N' : 'n';
+ *pfs.out_pz++ = pfs.fmtch < 'a' ? 'F' : 'f';
+ goto set_signp;
+ }
+
+ pfs.expcnt = 0;
+ pfs.fract = modfl (fnum, &pfs.integer);
+
+ /* get an extra slot for rounding. */
+ *pfs.out_pz++ = '0';
+
+ /* get integer portion of number; put into the end of the buffer; the
+ .01 is added for modfl (356.0 / 10, &integer) returning .59999999... */
+ for (pfs.scn_bk_pz = pfs.pfs_end - 1;
+ pfs.scn_bk_pz >= pfs.start_pz && pfs.integer;
+ ++pfs.expcnt)
+ {
+ pfs.tmp = modfl (pfs.integer / 10, &pfs.integer);
+ *pfs.scn_bk_pz-- = '0' + ((int) ((pfs.tmp + .01L) * 10));
+ }
+
+ switch (pfs.fmtch)
+ {
+ case 'g':
+ case 'G':
+ do_gformat (&pfs);
+ break;
+
+ case 'f':
+ case 'F':
+ do_fformat (&pfs);
+ break;
+
+ case 'e':
+ case 'E':
+ do_eformat (&pfs);
+ break;
+
+ default:
+ abort ();
+ }
+
+set_signp:
+ if (!*signp)
+ {
+ if (pinfo->showsign)
+ *signp = '+';
+ else if (pinfo->space)
+ *signp = ' ';
+ }
+
+ return (pfs.out_pz - pfs.start_pz);
+}
+#endif
+
+
+static int
+printf_flag_info (struct printf_info *const pinfo, size_t n, int *argtypes)
+{
+ return_val_if_fail (pinfo != NULL, SNV_ERROR);
+ (void)n;
+ (void)argtypes;
+
+ if (!(pinfo->state & (SNV_STATE_BEGIN | SNV_STATE_FLAG)))
+ {
+ PRINTF_ERROR (pinfo, "invalid specifier");
+ return -1;
+ }
+
+ pinfo->state = SNV_STATE_FLAG;
+
+ while (pinfo->state & SNV_STATE_FLAG)
+ {
+ switch (*pinfo->format)
+ {
+ case '#':
+ pinfo->alt = true;
+ pinfo->format++;
+ break;
+
+ case '0':
+ if (!pinfo->left)
+ pinfo->pad = '0';
+ pinfo->format++;
+ break;
+
+ case '-':
+ pinfo->pad = ' ';
+ pinfo->left = true;
+ pinfo->format++;
+ break;
+
+ case ' ':
+ pinfo->space = true;
+ pinfo->format++;
+ break;
+
+ case '+':
+ pinfo->showsign = true;
+ pinfo->format++;
+ break;
+
+ case '\'':
+ pinfo->group = true;
+ pinfo->format++;
+ break;
+
+ default:
+ pinfo->state = ~(SNV_STATE_BEGIN | SNV_STATE_FLAG);
+ break;
+ }
+ }
+
+ pinfo->format--;
+
+ /* Return the number of characters emitted. */
+ return 0;
+}
+
+/* This function has considerably more freedom than the others in
+ playing with pinfo; in particular, it modifies argindex and can
+ return completely bogus values whose only purpose is to extend
+ the argtypes vector so that it has enough items for the positional
+ parameter of the width (in the *n$ case). It also expects that
+ argtypes = (base of argtypes vector) + pinfo->argindex.
+
+ This is messy, suggestion for simplifying it are gladly accepted. */
+static int
+printf_numeric_param_info (struct printf_info *const pinfo, size_t n, int *argtypes)
+{
+ const char *pEnd = NULL;
+ int found = 0, allowed_states, new_state;
+ int position = 0, skipped_args = 0;
+ long value;
+
+ return_val_if_fail (pinfo != NULL, SNV_ERROR);
+
+ /* If we are looking at a ``.'', then this is a precision parameter. */
+ if (*pinfo->format == '.')
+ {
+ pinfo->format++;
+ found |= 1;
+ }
+
+ /* First we might have a ``*''. */
+ if (*pinfo->format == '*')
+ {
+ pinfo->format++;
+ found |= 2;
+ }
+
+ /* Parse the number. */
+ for (pEnd = pinfo->format, value = 0; *pEnd >= '0' && *pEnd <= '9'; pEnd++)
+ value = value * 10 + (*pEnd - '0');
+
+ if (pEnd > pinfo->format)
+ {
+ pinfo->format = pEnd;
+ found |= 4;
+ }
+
+ if (value > INT_MAX)
+ {
+ PRINTF_ERROR (pinfo, "out of range");
+ return -1;
+ }
+
+ /* And finally a dollar sign. */
+ if (*pinfo->format == '$')
+ {
+ if (value == 0)
+ {
+ PRINTF_ERROR (pinfo, "invalid position specifier");
+ return -1;
+ }
+
+ position = value;
+ pinfo->format++;
+ found |= 8;
+ }
+
+ switch (found & 14)
+ {
+ /* We found a * specification */
+ case 2:
+ if (pinfo->args)
+ value = pinfo->args[pinfo->argindex].pa_int;
+ if (n)
+ argtypes[0] = PA_INT;
+ pinfo->argindex++;
+ skipped_args = 1;
+ found ^= 6;
+ break;
+
+ /* We found a *n$ specification */
+ case 14:
+ if (n + pinfo->argindex > (unsigned)position - 1)
+ argtypes[position - 1 - pinfo->argindex] = PA_INT;
+
+ /* Else there is not enough space, reallocate and retry please...
+ ... but we must say how much to skip. */
+ if (position >= pinfo->argindex)
+ skipped_args = position - pinfo->argindex;
+
+ if (pinfo->args)
+ value = pinfo->args[position - 1].pa_int;
+ found ^= 10;
+ break;
+ }
+
+ switch (found)
+ {
+ /* We must have read a width specification. */
+ case 4:
+ allowed_states = SNV_STATE_BEGIN | SNV_STATE_WIDTH;
+ new_state = ~(SNV_STATE_BEGIN | SNV_STATE_FLAG | SNV_STATE_WIDTH);
+
+ /* How awful... */
+ if (value < 0)
+ {
+ pinfo->pad = ' ';
+ pinfo->left = true;
+ value = -value;
+ }
+
+ pinfo->width = value;
+ break;
+
+ /* We must have read a precision specification. */
+ case 5:
+ allowed_states = SNV_STATE_PRECISION | SNV_STATE_BEGIN;
+ new_state = SNV_STATE_MODIFIER | SNV_STATE_SPECIFIER;
+ pinfo->prec = value;
+ break;
+
+ /* We must have read a position specification. */
+ case 12:
+ allowed_states = SNV_STATE_BEGIN;
+ new_state = ~SNV_STATE_BEGIN;
+ pinfo->dollar = position;
+ break;
+
+ /* We must have read something bogus. */
+ default:
+ PRINTF_ERROR (pinfo, "invalid specifier");
+ return -1;
+ }
+
+ if (!(pinfo->state & allowed_states))
+ {
+ PRINTF_ERROR (pinfo, "invalid specifier");
+ return -1;
+ }
+
+ pinfo->state = new_state;
+ pinfo->format--;
+ return skipped_args;
+}
+
+static int
+printf_modifier_info (struct printf_info *const pinfo, size_t n, int *argtypes)
+{
+ return_val_if_fail (pinfo != NULL, SNV_ERROR);
+ (void)n;
+ (void)argtypes;
+
+ /* Check for valid pre-state. */
+ if (!(pinfo->state & (SNV_STATE_BEGIN | SNV_STATE_MODIFIER)))
+ {
+ PRINTF_ERROR (pinfo, "out of range");
+ return -1;
+ }
+
+ while (pinfo->state != SNV_STATE_SPECIFIER)
+ {
+ switch (*pinfo->format)
+ {
+ case 'h':
+ if (*++pinfo->format != 'h')
+ {
+ pinfo->is_short = true;
+ break;
+ }
+
+ pinfo->is_char = true;
+ pinfo->format++;
+ break;
+
+ case 'z':
+ if (sizeof (size_t) > sizeof (char *))
+ pinfo->is_long_double = true;
+ else
+ pinfo->is_long = true;
+
+ pinfo->format++;
+ break;
+
+ case 't':
+ if (sizeof (ptrdiff_t) > sizeof (char *))
+ pinfo->is_long_double = true;
+ else
+ pinfo->is_long = true;
+
+ pinfo->format++;
+ break;
+
+ case 'l':
+ if (*++pinfo->format != 'l')
+ {
+ pinfo->is_long = true;
+ break;
+ }
+ /*FALLTHROUGH*/
+
+ case 'j':
+ case 'q':
+ case 'L':
+ pinfo->is_long_double = true;
+ pinfo->format++;
+ break;
+
+ default:
+ pinfo->state = SNV_STATE_SPECIFIER;
+ pinfo->format--;
+ break;
+ }
+ }
+
+ /* Return the number of characters emitted. */
+ return 0;
+}
+
+
+static int
+printf_char (STREAM *stream, struct printf_info *const pinfo, union printf_arg const *args)
+{
+ int count_or_errorcode = SNV_OK;
+ char ch = '\0';
+
+ return_val_if_fail (pinfo != NULL, SNV_ERROR);
+
+ /* Check for valid pre-state. */
+ if (pinfo->prec != -1
+ || pinfo->is_char || pinfo->is_short || pinfo->is_long
+ || pinfo->is_long_double || pinfo->pad == '0'
+ || pinfo->alt || pinfo->space || pinfo->showsign)
+ {
+ PRINTF_ERROR (pinfo, "invalid flags");
+ return -1;
+ }
+
+ /* Extract the correct argument from the arg vector. */
+ ch = args->pa_char;
+
+ /* Left pad to the width if the supplied argument is less than
+ the width specifier. */
+ if ((pinfo->width > 1) && !pinfo->left)
+ {
+ int padwidth = pinfo->width - 1;
+
+ while ((count_or_errorcode >= 0) && (count_or_errorcode < padwidth))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+ }
+
+ /* Emit the character argument. */
+ SNV_EMIT (ch, stream, count_or_errorcode);
+
+ /* Right pad to the width if we still didn't reach the specified
+ width and the left justify flag was set. */
+ if ((count_or_errorcode < pinfo->width) && pinfo->left)
+ while ((count_or_errorcode >= 0)
+ && (count_or_errorcode < pinfo->width))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+
+ /* Return the number of characters emitted. */
+ return count_or_errorcode;
+}
+
+#ifndef NO_FLOAT_PRINTING
+
+static int
+printf_float (STREAM *stream,
+ struct printf_info *const pinfo,
+ union printf_arg const *args)
+{
+ snv_long_double value = 0.0;
+ int sign, len, count_or_errorcode = SNV_OK;
+#ifdef HAVE_LONG_DOUBLE
+ char buffer[LDBL_MAX_10_EXP * 2 + 20], *p = buffer;
+#else
+ char buffer[DBL_MAX_10_EXP * 2 + 20], *p = buffer;
+#endif
+
+ return_val_if_fail (pinfo != NULL, SNV_ERROR);
+
+ /* Check for valid pre-state */
+ if (pinfo->prec == -1)
+ pinfo->prec = SNV_POINTER_TO_LONG (pinfo->extra);
+
+ /* Check for valid pre-state. */
+ if (pinfo->prec <= -1
+ || pinfo->is_char || pinfo->is_short || pinfo->is_long)
+ {
+ PRINTF_ERROR (pinfo, "invalid flags");
+ return -1;
+ }
+
+ /* Extract the correct argument from the arg vector. */
+ value = fetch_double (pinfo, args);
+
+ /* Convert the number into a string. */
+ len = print_float (pinfo, buffer, buffer + sizeof (buffer), &sign, value);
+ if (*buffer == '0')
+ p++, len--;
+
+ /* Compute the size of the padding. */
+ pinfo->width -= len;
+ if (sign)
+ pinfo->width--;
+
+ /* Left pad to the remaining width if the supplied argument is less
+ than the width specifier, and the padding character is ' '. */
+ if (pinfo->pad == ' ' && !pinfo->left)
+ while ((count_or_errorcode >= 0) && (pinfo->width-- > 0))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+
+ /* Display any sign character. */
+ if (count_or_errorcode >= 0 && sign)
+ SNV_EMIT (sign, stream, count_or_errorcode);
+
+ /* Left pad to the remaining width if the supplied argument is less
+ than the width specifier, and the padding character is not ' '. */
+ if (pinfo->pad != ' ' && !pinfo->left)
+ while ((count_or_errorcode >= 0) && (pinfo->width-- > 0))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+
+ /* Fill the stream buffer with as many characters from the number
+ buffer as possible without overflowing. */
+ while ((count_or_errorcode >= 0) && (len-- > 0))
+ SNV_EMIT (*p++, stream, count_or_errorcode);
+
+ /* Right pad to the width if we still didn't reach the specified
+ width and the left justify flag was set. */
+ if (pinfo->left)
+ while ((count_or_errorcode >= 0) && (pinfo->width-- > 0))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+
+ /* Return the number of characters emitted. */
+ return count_or_errorcode;
+}
+#endif
+
+static int
+printf_count (STREAM *stream, struct printf_info *const pinfo, union printf_arg const *args)
+{
+ (void)stream;
+
+ if (pinfo->is_char)
+ *(char *) (args->pa_pointer) = pinfo->count;
+
+ else if (pinfo->is_short)
+ *(short *) (args->pa_pointer) = pinfo->count;
+
+ else if (pinfo->is_long)
+ *(long *) (args->pa_pointer) = pinfo->count;
+
+ else if (pinfo->is_long_double)
+ *(intmax_t *) (args->pa_pointer) = pinfo->count;
+
+ else
+ *(int *) (args->pa_pointer) = pinfo->count;
+
+ return 0;
+}
+
+static int
+printf_integer (STREAM *stream, struct printf_info *const pinfo, union printf_arg const *args)
+{
+ static const char digits_lower[] = "0123456789abcdefghijklmnopqrstuvwxyz";
+ static const char digits_upper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ const char *digits;
+
+ unsigned base = SNV_POINTER_TO_ULONG (pinfo->extra);
+ uintmax_t value = 0L;
+ int type, count_or_errorcode = SNV_OK;
+ char buffer[256], *p, *end;
+ bool is_negative = false;
+
+ return_val_if_fail (pinfo != NULL, SNV_ERROR);
+
+ /* Check for valid pre-state. */
+ if (!(pinfo->state & (SNV_STATE_BEGIN | SNV_STATE_SPECIFIER)))
+ {
+ PRINTF_ERROR (pinfo, "out of range");
+ return -1;
+ }
+
+ /* Upper or lower-case hex conversion? */
+ digits = ((pinfo->spec >= 'a') && (pinfo->spec <= 'z'))
+ ? digits_lower : digits_upper;
+
+ if (pinfo->prec == -1)
+ pinfo->prec = 0;
+
+ /* Check for valid pre-state. */
+ if (pinfo->prec < 0)
+ {
+ PRINTF_ERROR (pinfo, "invalid precision");
+ return -1;
+ }
+
+ type = pinfo->type;
+
+ /* Extract the correct argument from the arg vector. */
+ if (type & PA_FLAG_UNSIGNED)
+ {
+ value = fetch_uintmax (pinfo, args);
+ is_negative = false;
+ pinfo->showsign = pinfo->space = false;
+ }
+ else
+ {
+ intmax_t svalue = 0L;
+ svalue = fetch_intmax (pinfo, args);
+ is_negative = (svalue < 0);
+ value = (uintmax_t) ABS (svalue);
+ }
+
+ /* Convert the number into a string. */
+ p = end = &buffer[sizeof (buffer) - 1];
+
+ if (value == 0)
+ *p-- = '0';
+
+ else
+ while (value > 0)
+ {
+ *p-- = digits[value % base];
+ value /= base;
+ }
+
+ pinfo->width -= end - p;
+ pinfo->prec -= end - p;
+
+ /* Octal numbers have a leading zero in alterate form. */
+ if (pinfo->alt && base == 8)
+ {
+ *p-- = '0';
+ --pinfo->width;
+ }
+
+ /* Left pad with zeros to make up the precision. */
+ if (pinfo->prec > 0)
+ {
+ pinfo->width -= pinfo->prec;
+ while (pinfo->prec-- > 0)
+ *p-- = '0';
+ }
+
+ /* Reserve room for leading `0x' for hexadecimal. */
+ if (pinfo->alt && base == 16)
+ pinfo->width -= 2;
+
+ /* Reserve room for a sign character. */
+ if (is_negative || pinfo->showsign || pinfo->space)
+ --pinfo->width;
+
+ /* Left pad to the remaining width if the supplied argument is less
+ * than the width specifier, and the padding character is ' '.
+ */
+ if (pinfo->pad == ' ' && !pinfo->left)
+ while ((count_or_errorcode >= 0) && (pinfo->width-- > 0))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+
+ /* Display any sign character. */
+ if (count_or_errorcode >= 0)
+ {
+ if (is_negative)
+ SNV_EMIT ('-', stream, count_or_errorcode);
+ else if (pinfo->showsign)
+ SNV_EMIT ('+', stream, count_or_errorcode);
+ else if (pinfo->space)
+ SNV_EMIT (' ', stream, count_or_errorcode);
+ }
+
+ /* Display `0x' for alternate hexadecimal specifier. */
+ if ((count_or_errorcode >= 0) && (base == 16) && pinfo->alt)
+ {
+ SNV_EMIT ('0', stream, count_or_errorcode);
+ SNV_EMIT (digits['X' - 'A' + 10], stream, count_or_errorcode);
+ }
+
+ /* Left pad to the remaining width if the supplied argument is less
+ * than the width specifier, and the padding character is not ' '.
+ */
+ if (pinfo->pad != ' ' && !pinfo->left)
+ while ((count_or_errorcode >= 0) && (pinfo->width-- > 0))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+
+ /* Fill the stream buffer with as many characters from the number
+ * buffer as possible without overflowing.
+ */
+ while ((count_or_errorcode >= 0) && (++p < &buffer[sizeof (buffer)]))
+ SNV_EMIT (*p, stream, count_or_errorcode);
+
+ /* Right pad to the width if we still didn't reach the specified
+ * width and the left justify flag was set.
+ */
+ if (pinfo->left)
+ while ((count_or_errorcode >= 0) && (pinfo->width-- > 0))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+
+ /* Return the number of characters emitted. */
+ return count_or_errorcode;
+}
+
+static int
+printf_pointer (STREAM *stream, struct printf_info *const pinfo, union printf_arg const *args)
+{
+ int count_or_errorcode = SNV_OK;
+
+ return_val_if_fail (pinfo != NULL, SNV_ERROR);
+
+ /* Read these now to advance the argument pointer appropriately */
+ if (pinfo->prec == -1)
+ pinfo->prec = 0;
+
+ /* Check for valid pre-state. */
+ if (pinfo->prec <= -1
+ || pinfo->is_char || pinfo->is_short || pinfo->is_long
+ || pinfo->is_long_double)
+ {
+ PRINTF_ERROR (pinfo, "invalid flags");
+ return -1;
+ }
+
+ /* Always print 0x. */
+ pinfo->alt = 1;
+ pinfo->is_long = sizeof(long) == sizeof (char *);
+ pinfo->is_long_double = sizeof(intmax_t) == sizeof (char *);
+
+ /* Use the standard routine for numbers for the printing call,
+ if the pointer is not NULL. */
+
+ if (args->pa_pointer != NULL)
+ return printf_integer (stream, pinfo, args);
+
+ /* Print a NULL pointer as (nil), appropriately padded. */
+ if ((pinfo->width > 5) && !pinfo->left)
+ {
+ int padwidth = pinfo->width - 5;
+ while ((count_or_errorcode >= 0) && (count_or_errorcode < padwidth))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+ }
+
+ SNV_EMIT ('(', stream, count_or_errorcode);
+ SNV_EMIT ('n', stream, count_or_errorcode);
+ SNV_EMIT ('i', stream, count_or_errorcode);
+ SNV_EMIT ('l', stream, count_or_errorcode);
+ SNV_EMIT (')', stream, count_or_errorcode);
+
+ if ((pinfo->width > 5) && pinfo->left)
+ while ((count_or_errorcode >= 0)
+ && (count_or_errorcode < pinfo->width))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+
+ return count_or_errorcode;
+}
+
+static int
+printf_string (STREAM *stream, struct printf_info *const pinfo, union printf_arg const *args)
+{
+ int len = 0, count_or_errorcode = SNV_OK;
+ const char *p = NULL;
+
+ return_val_if_fail (pinfo != NULL, SNV_ERROR);
+
+ /* Read these now to advance the argument pointer appropriately */
+ if (pinfo->prec == -1)
+ pinfo->prec = 0;
+
+ /* Check for valid pre-state. */
+ if (pinfo->prec <= -1
+ || pinfo->is_char || pinfo->is_short || pinfo->is_long
+ || pinfo->is_long_double)
+ {
+ PRINTF_ERROR (pinfo, "invalid flags");
+ return -1;
+ }
+
+ /* Extract the correct argument from the arg vector. */
+ p = args->pa_string;
+
+ /* Left pad to the width if the supplied argument is less than
+ the width specifier. */
+ if (p != NULL)
+ {
+ len = strlen (p);
+ if (pinfo->prec && pinfo->prec < len)
+ len = pinfo->prec;
+ }
+
+ if ((len < pinfo->width) && !pinfo->left)
+ {
+ int padwidth = pinfo->width - len;
+ while ((count_or_errorcode >= 0) && (count_or_errorcode < padwidth))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+ }
+
+ /* Fill the buffer with as many characters from the format argument
+ as possible without overflowing or exceeding the precision. */
+ if ((count_or_errorcode >= 0) && (p != NULL))
+ {
+ int mark = count_or_errorcode;
+ while ((count_or_errorcode >= 0) && *p != '\0'
+ && ((pinfo->prec == 0) || (count_or_errorcode - mark < len)))
+ SNV_EMIT (*p++, stream, count_or_errorcode);
+ }
+
+ /* Right pad to the width if we still didn't reach the specified
+ width and the left justify flag was set. */
+ if ((count_or_errorcode < pinfo->width) && pinfo->left)
+ while ((count_or_errorcode >= 0)
+ && (count_or_errorcode < pinfo->width))
+ SNV_EMIT (pinfo->pad, stream, count_or_errorcode);
+
+ /* Return the number of characters emitted. */
+ return count_or_errorcode;
+}
+
+
+
+/* replacements for modfl and copysignl follow. */
+
+#if !defined NO_FLOAT_PRINTING && defined HAVE_LONG_DOUBLE
+# ifndef HAVE_MODFL
+static long double modfl (long double x, long double *exp)
+{
+ /* To compute the integer part of a positive integer (in this case
+ abs(X)), sum a big enough integer to the absolute value, so that
+ the precision of the floating point number is exactly 1. Then
+ we round towards zero.
+
+ The code in the two branches is the same but it considers -x
+ if x is negative. */
+
+ long double z;
+ if (x < 0.0L)
+ {
+ z = 1.0L / LDBL_EPSILON - x - 1.0 / LDBL_EPSILON;
+ if (z + x > 0.0L)
+ z = z - 1.0L;
+
+ return (*exp = -z) + x;
+ }
+ else
+ {
+ z = 1.0L / LDBL_EPSILON + x - 1.0 / LDBL_EPSILON;
+ if (z > x)
+ z = z - 1.0L;
+
+ return x - (*exp = z);
+ }
+}
+# endif /* !HAVE_MODFL */
+
+# ifndef HAVE_COPYSIGNL
+long double
+copysignl (long double x, long double y)
+{
+# ifdef HAVE_COPYSIGN
+ return x * (long double) copysign (1.0, x * y);
+# else /* !HAVE_COPYSIGN */
+ /* If we do not have copysign, assume zero is unsigned (too risky to
+ assume we have infinities, which would allow to test with
+ (x < 0.0 && 1.0 / x < 0.0). */
+ return (x < 0.0 ^ y < 0.0) ? x * -1.0 : x;
+# endif /* !HAVE_COPYSIGN */
+}
+# endif /* !HAVE_COPYSIGNL */
+#endif /* !NO_FLOAT_PRINTING && HAVE_LONG_DOUBLE) */
+
+
+
+/* This is where the parsing of FORMAT strings is handled:
+
+ Each of these functions should inspect PPARSER for parser
+ state information; update PPARSER as necessary based on
+ the state discovered; possibly put some characters in STREAM, in
+ which case that number of characters must be returned. If the
+ handler detects that parsing (of the current specifier) is complete,
+ then it must set pinfo->state to SNV_STATE_END. The library will then
+ copy characters from the format string to STREAM until another unescaped
+ SNV_CHAR_SPEC is detected when the handlers will be called again. */
+
+spec_entry snv_default_spec_table[] = {
+ /* ch type function */
+ {' ', 0, 0, NULL, printf_flag_info, NULL},
+ {'#', 0, 0, NULL, printf_flag_info, NULL},
+ {'+', 0, 0, NULL, printf_flag_info, NULL},
+ {'-', 0, 0, NULL, printf_flag_info, NULL},
+ {'\'', 0, 0, NULL, printf_flag_info, NULL},
+ {'*', 0, PA_INT, NULL, printf_numeric_param_info, NULL},
+ {'$', 0, 0, NULL, printf_numeric_param_info, NULL},
+ {'.', 0, 0, NULL, printf_numeric_param_info, NULL},
+ {'0', 0, 0, NULL, printf_flag_info, NULL},
+ {'1', 0, 0, NULL, printf_numeric_param_info, NULL},
+ {'2', 0, 0, NULL, printf_numeric_param_info, NULL},
+ {'3', 0, 0, NULL, printf_numeric_param_info, NULL},
+ {'4', 0, 0, NULL, printf_numeric_param_info, NULL},
+ {'5', 0, 0, NULL, printf_numeric_param_info, NULL},
+ {'6', 0, 0, NULL, printf_numeric_param_info, NULL},
+ {'7', 0, 0, NULL, printf_numeric_param_info, NULL},
+ {'8', 0, 0, NULL, printf_numeric_param_info, NULL},
+ {'9', 0, 0, NULL, printf_numeric_param_info, NULL},
+ {'c', 0, PA_CHAR, printf_char, NULL, NULL},
+ {'d', 0, PA_INT, printf_integer, printf_generic_info, (snv_pointer) 10},
+#ifndef NO_FLOAT_PRINTING
+ {'e', 0, PA_DOUBLE, printf_float, printf_generic_info, (snv_pointer) 6},
+ {'E', 0, PA_DOUBLE, printf_float, printf_generic_info, (snv_pointer) 6},
+ {'f', 0, PA_DOUBLE, printf_float, printf_generic_info, (snv_pointer) 6},
+ {'F', 0, PA_DOUBLE, printf_float, printf_generic_info, (snv_pointer) 6},
+ {'g', 0, PA_DOUBLE, printf_float, printf_generic_info, (snv_pointer) 6},
+ {'G', 0, PA_DOUBLE, printf_float, printf_generic_info, (snv_pointer) 6},
+#endif
+ {'h', 0, 0, NULL, printf_modifier_info, NULL},
+ {'i', 0, PA_INT, printf_integer, printf_generic_info, (snv_pointer) 10},
+ {'j', 0, 0, NULL, printf_modifier_info, NULL},
+ {'l', 0, 0, NULL, printf_modifier_info, NULL},
+ {'L', 0, 0, NULL, printf_modifier_info, NULL},
+ {'n', 0, PA_INT | PA_FLAG_PTR, printf_count, printf_generic_info, NULL},
+ {'o', 0, PA_INT | PA_FLAG_UNSIGNED,
+ printf_integer, printf_generic_info, (snv_pointer) 8},
+ {'p', 0, PA_POINTER, printf_pointer, NULL, (snv_pointer) 16},
+ {'q', 0, 0, NULL, printf_modifier_info, NULL},
+ {'s', 0, PA_STRING, printf_string, NULL, NULL},
+ {'t', 0, 0, NULL, printf_modifier_info, NULL},
+ {'u', 0, PA_INT | PA_FLAG_UNSIGNED,
+ printf_integer, printf_generic_info, (snv_pointer) 10},
+ {'x', 0, PA_INT | PA_FLAG_UNSIGNED,
+ printf_integer, printf_generic_info, (snv_pointer) 16},
+ {'X', 0, PA_INT | PA_FLAG_UNSIGNED,
+ printf_integer, printf_generic_info, (snv_pointer) 16},
+ {'z', 0, 0, NULL, printf_modifier_info, NULL},
+ {'\0', 0, PA_LAST, NULL, NULL, NULL}
+};
+
+/* format.c ends here */
diff --git a/snprintfv/mem.c b/snprintfv/mem.c
new file mode 100644
index 0000000..553492f
--- /dev/null
+++ b/snprintfv/mem.c
@@ -0,0 +1,82 @@
+/* -*- Mode: C -*- */
+
+/* mem.c --- memory management routines
+ * Copyright (C) 2002 Gary V. Vaughan
+ * Originally by Paolo Bonzini, 2002
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+/* Code: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef HAVE_DMALLOC
+# include <dmalloc.h>
+#endif
+
+#include "mem.h"
+
+
+/* We deliberately don't prototype the malloc functions; they are cast
+ to match the function pointers we expose to avoid compiler warnings
+ from mismatched prototypes (if we find a host implementation.
+
+ Not also that if this file is compiled -DWITH_DMALLOC, the inclusion
+ in mem.h will cause the malloc references below to be redirected
+ correctly. */
+malloc_proc_t* snv_malloc = (malloc_proc_t*)malloc;
+realloc_proc_t* snv_realloc = (realloc_proc_t*)realloc;
+free_proc_t* snv_free = (free_proc_t*)free;
+
+/* Unportable memory management functions are reimplemented tout court. */
+snv_pointer
+snv_xrealloc (snv_pointer old, size_t count)
+{
+ if (count < 1)
+ {
+ snv_free (old);
+ return NULL;
+ }
+ if (!old)
+ return snv_malloc (count);
+ else
+ return snv_realloc (old, count);
+}
+
+char *
+snv_strdup (const char *str)
+{
+ size_t len = strlen (str);
+ char *result = snv_malloc (len + 1);
+ memcpy (result, str, len + 1);
+ return result;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "gnu"
+ * indent-tabs-mode: nil
+ * End:
+ * end of snprintfv/mem.c */
diff --git a/snprintfv/mem.h b/snprintfv/mem.h
new file mode 100644
index 0000000..496cf53
--- /dev/null
+++ b/snprintfv/mem.h
@@ -0,0 +1,120 @@
+/* -*- Mode: C -*- */
+
+/* mem.h --- memory handling macros
+ * Copyright (C) 1999 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1999
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+/* Code: */
+
+#ifndef SNPRINTFV_MEM_H
+#define SNPRINTFV_MEM_H 1
+
+#include <snprintfv/compat.h>
+
+#ifdef WITH_DMALLOC
+# include <dmalloc.h>
+#endif
+
+#ifdef _WIN32
+# ifdef DLL_EXPORT
+# define SNV_SCOPE extern __declspec(dllexport)
+# else
+# ifdef LIBSNPRINTFV_DLL_IMPORT
+# define SNV_SCOPE extern __declspec(dllimport)
+# endif
+# endif
+#else
+# define SNV_SCOPE extern
+#endif
+
+/* This is the API we use throughout libsnprintfv. */
+#define snv_new(type, count) \
+ ((type*)snv_malloc((size_t)sizeof(type) * (count)))
+#define snv_renew(type, ptr, count) \
+ ((type*)snv_xrealloc((ptr), (size_t)sizeof(type) * (count)))
+#define snv_delete(old) snv_free(old)
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef void* (malloc_proc_t )(size_t);
+typedef void* (realloc_proc_t)(snv_pointer, size_t);
+typedef void* (free_proc_t )(snv_pointer);
+
+/* These function pointers are exposed through the API incase a user
+ of this library needs to map our memory management routines to
+ their own (e.g. xmalloc). */
+
+/**
+ * snv_malloc:
+ * @count: The number of bytes to allocate.
+ *
+ * Allocates a fresh block of memory whose size is @count bytes.
+ *
+ * Return value:
+ * The pointer to the newly-allocated memory area.
+ */
+SNV_SCOPE malloc_proc_t *snv_malloc;
+
+/**
+ * snv_realloc:
+ * @old: The pointer to the block whose size must be changed.
+ * @count: The number of bytes to allocate.
+ *
+ * Reallocates a fresh block of memory pointed to by @old
+ * so that its size becomes @count bytes.
+ *
+ * Return value:
+ * The pointer to the newly-allocated memory area, possibly
+ * the same as @old.
+ */
+SNV_SCOPE realloc_proc_t *snv_realloc;
+
+/**
+ * snv_free:
+ * @old: The pointer to the block that must freed.
+ *
+ * Frees a block of memory pointed to by @old.
+ */
+SNV_SCOPE free_proc_t *snv_free;
+
+/* And these are reimplemented tout court because they are
+ not fully portable. */
+extern realloc_proc_t snv_xrealloc;
+extern char* snv_strdup (const char *str);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* SNPRINTFV_MEM_H */
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "gnu"
+ * indent-tabs-mode: nil
+ * End:
+ * end of snprintfv/mem.h */
diff --git a/snprintfv/printf.c b/snprintfv/printf.c
new file mode 100644
index 0000000..58927a9
--- /dev/null
+++ b/snprintfv/printf.c
@@ -0,0 +1,1568 @@
+/* -*- Mode: C -*- */
+
+/* printf.c --- printf clone for argv arrays
+ * Copyright (C) 1998, 1999, 2000, 2002 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1998
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+/* Code: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <unistd.h> /* for the write(2) call */
+
+#ifdef HAVE_ASSERT_H
+# include <assert.h>
+#else
+# define assert(_e)
+#endif
+
+#define COMPILING_PRINTF_C
+#include "printf.h"
+
+#ifdef WITH_DMALLOC
+#include <dmalloc.h>
+#endif
+
+#include "filament.h"
+#include "stream.h"
+#include "mem.h"
+
+#ifdef SNV_LIBRARY_BUILD
+# include "dl.h"
+#else
+
+# ifndef HAVE_STRTOUL
+# include "strtoul.c"
+# endif
+#endif /* SNV_LIBRARY_BUILD */
+
+#define EOS '\0'
+#define SNV_CHAR_SPEC '%'
+#define SNV_ESC_SPEC '\\'
+
+/* Functions to manage mapping of spec chars to handlers. */
+SNV_INLINE unsigned spec_hash (unsigned spec);
+SNV_INLINE void spec_init (void);
+SNV_INLINE spec_entry *spec_lookup (unsigned spec);
+static void spec_insert (spec_entry * pentry);
+static int do_printfv (STREAM *stream, const char *format,
+ union printf_arg const args[]);
+
+/* FIXME: We are assuming an ASCII character set where all the
+ printable characters are between SPACE and DEL. */
+#define ASCII_DEL (int)'\177'
+#define ASCII_SPACE (int)' '
+
+#define IS_MODIFIER(spec) (!((spec)->fmt))
+
+/* TODO: This is not thread-safe. Change the API to pass the spec_table
+ in as the first parameter to the functions which use it? */
+static spec_entry *spec_table[ASCII_DEL - ASCII_SPACE];
+
+/* TODO: This is not thread-safe as well. */
+static char *printf_last_error;
+
+SNV_INLINE unsigned
+spec_hash (unsigned spec)
+{
+ return (spec & ASCII_DEL) - ASCII_SPACE;
+}
+
+/* Register all of the functions in INIT_SPEC_TABLE. */
+static void
+spec_init (void)
+{
+ static bool is_init = false;
+
+ if (!is_init)
+ {
+ extern spec_entry snv_default_spec_table[];
+ unsigned ix;
+
+ memset (spec_table, 0, sizeof (spec_table));
+ for (ix = 0; snv_default_spec_table[ix].spec_key != EOS; ix++)
+ {
+ unsigned hash = spec_hash (snv_default_spec_table[ix].spec_key);
+ spec_table[hash] = snv_default_spec_table + ix;
+ }
+
+ is_init = true;
+ }
+}
+
+/* Insert PENTRY, a new handler, into SPEC_TABLE. */
+SNV_INLINE void
+spec_insert (spec_entry *pentry)
+{
+ unsigned hash = spec_hash (pentry->spec_key);
+ spec_init ();
+ spec_table[hash] = pentry;
+}
+
+/* Lookup and return the SPEC_TABLE entry for SPEC. */
+SNV_INLINE spec_entry *
+spec_lookup (unsigned spec)
+{
+ unsigned hash = spec_hash (spec);
+ spec_init ();
+ return spec_table[hash];
+}
+
+/**
+ * register_printf_function: printf.h
+ * @spec: the character which will trigger @func, cast to an unsigned int.
+ * @fmt: the handler function to actually print the arguments to the specifier
+ * @arg: the handler function to tell %printf about the types of the arguments
+ * to the specifier
+ *
+ * Register the pair made of @fmt and @arg, so that it is called
+ * when @spec is encountered in a format string.
+ *
+ * Return value:
+ * Returns %NULL if @func was not successfully registered, a
+ * %spec_entry with the information on the function if it was.
+ **/
+spec_entry *
+register_printf_function (unsigned spec, printf_function *fmt,
+ printf_arginfo_function *arg)
+{
+ spec_entry *new, *old;
+ old = spec_lookup (spec);
+ if (old && IS_MODIFIER (old))
+ return NULL;
+
+ if (!fmt || !spec)
+ return NULL;
+
+ new = snv_new (spec_entry, 1);
+ new->spec_key = spec;
+ new->fmt = fmt;
+ new->arg = arg;
+ new->user = NULL;
+
+ spec_insert (new);
+
+ return new;
+}
+
+static int
+call_argtype_function (
+ struct printf_info *const pinfo,
+ int **argtypes,
+ spec_entry *spec)
+{
+ int n;
+ int argindex = (pinfo->dollar && !IS_MODIFIER (spec))
+ ? pinfo->dollar - 1
+ : pinfo->argindex;
+
+ int save_argindex = pinfo->argindex;
+ int save_state = pinfo->state;
+ char const *save_format = pinfo->format;
+
+ if (!spec->arg)
+ {
+ n = 1;
+ if (pinfo->argc <= argindex)
+ {
+ /*
+ * "argtypes" points to a pointer of an array of int values.
+ * Here, we ensure that there are "argindex + 1" entries in
+ * that array.
+ */
+ *argtypes = snv_renew (int, *argtypes, argindex + 1);
+
+ /*
+ * IF there are more entries that follow the current argument
+ * index, then we will clobber all the entries that follow.
+ * The size of these entries is the size of the array elements,
+ * not the size of the pointer to the array elements.
+ */
+ if (pinfo->argc < argindex)
+ memset(*argtypes + pinfo->argc, PA_UNKNOWN,
+ (argindex - pinfo->argc) * sizeof(**argtypes));
+
+ pinfo->argc = argindex + 1;
+ }
+
+ (*argtypes) [argindex] = spec->type;
+ }
+
+ else
+ {
+ pinfo->spec = (unsigned)*(pinfo->format);
+ pinfo->extra = spec->user;
+ pinfo->type = spec->type;
+
+ if (pinfo->argc > argindex)
+ n = spec->arg(pinfo, (size_t) (pinfo->argc - argindex),
+ *argtypes + argindex);
+ else
+ n = spec->arg(pinfo, (size_t)0, NULL);
+
+ if (n < 0)
+ return n;
+ if (argindex + n > pinfo->argc)
+ {
+ int new_ct = argindex + n;
+ *argtypes = snv_renew (int, *argtypes, new_ct);
+ memset(*argtypes + pinfo->argc, PA_UNKNOWN,
+ (new_ct - pinfo->argc) * sizeof(**argtypes));
+ pinfo->argc = argindex + n;
+ /* Call again... */
+ pinfo->argindex = save_argindex;
+ pinfo->format = save_format;
+ pinfo->state = save_state;
+ pinfo->spec = (unsigned)*(pinfo->format);
+ pinfo->extra = spec->user;
+ pinfo->type = spec->type;
+ n = spec->arg(pinfo, (size_t)n, *argtypes + argindex);
+ }
+ }
+
+ if (!pinfo->dollar || !IS_MODIFIER (spec))
+ pinfo->argindex += n;
+
+ return n;
+}
+
+
+/**
+ * printf_strerror: printf.h
+ *
+ * Communicate information on the last error in a printf
+ * format string.
+ *
+ * Return value:
+ * A string describing the last error which occurred during the
+ * parsing of a printf format string. It is the responsibility
+ * of the caller to free the string.
+ */
+char *
+printf_strerror (void)
+{
+ return snv_strdup(printf_last_error);
+}
+
+/* (re)initialise the memory used by PPARSER. */
+static inline void
+parser_init (
+ struct printf_info *pinfo,
+ const char *format,
+ const union printf_arg *args)
+{
+ memset (pinfo, 0, sizeof (struct printf_info));
+ pinfo->format = format;
+ pinfo->args = args;
+}
+
+static inline struct printf_info *
+parser_reset (struct printf_info *pinfo)
+{
+ pinfo->is_long_double = pinfo->is_char = pinfo->is_short =
+ pinfo->is_long = pinfo->alt = pinfo->space = pinfo->left =
+ pinfo->showsign = pinfo->group = pinfo->wide =
+ pinfo->width = pinfo->spec = 0;
+
+ pinfo->state = SNV_STATE_BEGIN;
+ pinfo->prec = -1;
+ pinfo->dollar = 0;
+ pinfo->pad = ' ';
+
+ return pinfo;
+}
+
+
+/**
+ * printf_error: printf.h
+ * @pinfo: pointer to the current parser state.
+ * @file: file where error was detected.
+ * @line: line where error was detected.
+ * @func1: " (" if function is supplied by compiler.
+ * @func2: function where error was detected, if supplied by compiler.
+ * @func3: ")" if function is supplied by compiler.
+ * @error_message: new error message to append to @pinfo.
+ *
+ * The contents of @error_message are appended to the @pinfo internal
+ * error string, so it is safe to pass static strings or recycle the
+ * original when this function returns.
+ *
+ * Return value:
+ * The address of the full accumulated error message in @pinfo is
+ * returned.
+ **/
+char *
+printf_error (struct printf_info *pinfo, const char *file, int line,
+ const char *func1, const char *func2, const char *func3,
+ const char *error_message)
+{
+ int i;
+ char *result;
+ if (pinfo->error == NULL)
+ pinfo->error = filnew (NULL, (size_t)0);
+ else
+ filccat (pinfo->error, '\n');
+
+ /* Cannot use printf because a bug in it might trigger another
+ printf_error! */
+ result = filcat (pinfo->error, "file ");
+ filcat (pinfo->error, file);
+ filcat (pinfo->error, ": line ");
+ for (i = 10; i <= line; i *= 10);
+ for (i /= 10; i >= 1; i /= 10)
+ filccat (pinfo->error, '0' + (line / i) % 10);
+
+ filcat (pinfo->error, func1);
+ filcat (pinfo->error, func2);
+ filcat (pinfo->error, func3);
+ filcat (pinfo->error, ": ");
+ filcat (pinfo->error, error_message);
+ return result;
+}
+
+
+
+/**
+ * parse_printf_format: printf.h
+ * @format: a % delimited format string.
+ * @n: the size of the @argtypes vector
+ * @argtypes: a vector of ints, to be filled with the argument types from @format
+ *
+ * Returns information about the number and types of
+ * arguments expected by the template string @format.
+ * The argument @n specifies the number of elements in the array
+ * @argtypes. This is the maximum number of elements that
+ * the function will try to write.
+ *
+ * Return value:
+ * The total number of arguments required by @format. If this
+ * number is greater than @n, then the information returned
+ * describes only the first @n arguments. If you want information
+ * about additional arguments, allocate a bigger array and call
+ * this function again. If there is an error, then %SNV_ERROR
+ * is returned instead.
+ **/
+size_t
+parse_printf_format (const char *format, int n, int *argtypes)
+{
+ struct printf_info info;
+
+ return_val_if_fail (format != NULL, (size_t)-1);
+
+ parser_init (&info, format, NULL);
+
+ while (*info.format != EOS)
+ {
+ int ch = (int) *info.format++;
+ spec_entry *spec;
+ int status;
+ int argindex;
+
+ if (ch != SNV_CHAR_SPEC)
+ continue;
+
+ if (*info.format == SNV_CHAR_SPEC)
+ {
+ /* An escaped CHAR_SPEC: ignore it (by falling through). */
+ ++info.format;
+ continue;
+ }
+
+ /* We found the start of a format specifier! */
+ parser_reset (&info);
+ do
+ {
+ /* Until we fill the stream (or get some other
+ exception) or one of the handlers tells us
+ we have reached the end of the specifier... */
+
+ /* ...lookup the handler associated with the char
+ we are looking at in the format string... */
+ spec = spec_lookup ((unsigned)*(info.format));
+ if (spec == NULL)
+ {
+ PRINTF_ERROR (&info, "unregistered specifier");
+ goto error;
+ }
+
+ if (!IS_MODIFIER (spec) &&
+ !(info.state & (SNV_STATE_BEGIN | SNV_STATE_SPECIFIER)))
+ {
+ PRINTF_ERROR (&info, "invalid combination of flags");
+ goto error;
+ }
+
+ argindex = info.dollar && !IS_MODIFIER (spec)
+ ? info.dollar - 1 : info.argindex;
+
+ /* ...and call the relevant handler. */
+ if (spec->arg)
+ {
+ info.spec = (unsigned)*(info.format);
+ info.extra = spec->user;
+ info.type = spec->type;
+ status = (*spec->arg) (&info, (size_t) (n - argindex),
+ argtypes + argindex);
+ }
+ else
+ {
+ status = 1;
+ if (n > argindex)
+ argtypes[argindex] = spec->type;
+ }
+
+ if (status < 0)
+ goto error;
+
+ info.argc = MAX (info.argc, argindex + status);
+ if (!info.dollar || !IS_MODIFIER (spec))
+ info.argindex += status;
+
+ info.format++;
+ }
+ while (IS_MODIFIER (spec));
+
+ continue;
+
+ error:
+ /* Get here on error */
+ info.argc = -1;
+ break;
+ }
+
+ if (printf_last_error)
+ snv_delete (printf_last_error);
+
+ if (info.error)
+ printf_last_error = fildelete (info.error);
+ else
+ printf_last_error = NULL;
+
+ return info.argc;
+}
+
+static int
+do_printfv (STREAM *stream, const char *format, union printf_arg const args[])
+{
+ struct printf_info info;
+
+ /* This is the parser driver.
+
+ Here we scan through the format string and move bytes into the
+ stream and call handlers based on the parser state. */
+
+ parser_init (&info, format, args);
+
+ /* Keep going until the format string runs out! */
+ while (*info.format != EOS)
+ {
+ int ch = (int) *info.format++;
+
+ switch (ch)
+ {
+ case SNV_CHAR_SPEC:
+ if (*info.format != SNV_CHAR_SPEC)
+ {
+ /* We found the start of a format specifier! */
+ spec_entry *spec;
+ int status;
+ int argindex;
+
+ parser_reset (&info);
+ do
+ {
+ /* Until we fill the stream (or get some other
+ exception) or one of the handlers tells us
+ we have reached the end of the specifier... */
+
+ /* ...lookup the handler associated with the char
+ we are looking at in the format string... */
+ spec = spec_lookup ((unsigned)*(info.format));
+ if (spec == NULL)
+ {
+ PRINTF_ERROR (&info, "unregistered specifier");
+ goto error;
+ }
+
+ if (!IS_MODIFIER (spec) &&
+ !(info.state & (SNV_STATE_BEGIN | SNV_STATE_SPECIFIER)))
+ {
+ PRINTF_ERROR (&info, "invalid combination of flags");
+ goto error;
+ }
+
+ /* ...and call the relevant handler. */
+ info.spec = (unsigned)*(info.format);
+ info.extra = spec->user;
+ info.type = spec->type;
+
+ status = spec->arg ? (*spec->arg) (&info, (size_t)0, NULL) : 1;
+
+ if (status < 0)
+ goto error;
+
+ argindex = info.dollar && !IS_MODIFIER (spec)
+ ? info.dollar - 1 : info.argindex;
+
+ info.format++;
+ info.argc = MAX (info.argc, argindex + status);
+ if (!info.dollar && !IS_MODIFIER (spec))
+ info.argindex += status;
+ }
+ while (info.count >= 0 && IS_MODIFIER (spec));
+
+ status = (*spec->fmt) (stream, &info, args + argindex);
+
+ if (status < 0)
+ goto error;
+
+ info.count += status;
+ continue;
+ }
+
+ /* An escaped CHAR_SPEC: ignore it (by falling through). */
+ ++info.format;
+
+ /*FALLTHROUGH*/
+
+ default:
+ /* Just a character: copy it. */
+ SNV_EMIT (ch, stream, info.count);
+ continue;
+ }
+
+ error:
+ /* Get here on error */
+ info.count = -1;
+ break;
+ }
+
+ if (printf_last_error)
+ snv_delete (printf_last_error);
+
+ if (info.error)
+ printf_last_error = fildelete (info.error);
+ else
+ printf_last_error = NULL;
+
+ return info.count;
+}
+
+/**
+ * stream_printfv: printf.h
+ * @stream: an initialised stream structure.
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to @format, and write
+ * the results to @stream. If @stream is %NULL, only count the
+ * number of characters needed to output the format.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+stream_printfv (STREAM *stream, const char *format, snv_constpointer const *ap)
+{
+ union printf_arg *args;
+ struct printf_info info;
+ int count_or_errorcode;
+ int *argtypes = NULL;
+
+ return_val_if_fail (format != NULL, SNV_ERROR);
+
+ parser_init (&info, format, NULL);
+
+ /* Keep going until the format string runs out! */
+ while (*info.format != EOS)
+ {
+ int ch = (int) *info.format++;
+
+ switch (ch)
+ {
+ case SNV_CHAR_SPEC:
+ if (*info.format != SNV_CHAR_SPEC)
+ {
+ /* We found the start of a format specifier! */
+ spec_entry *spec;
+
+ parser_reset (&info);
+ do
+ {
+ /* Until we fill the stream (or get some other
+ exception) or one of the handlers tells us
+ we have reached the end of the specifier... */
+
+ /* ...lookup the handler associated with the char
+ we are looking at in the format string... */
+ spec = spec_lookup ((unsigned)*(info.format));
+ if (spec == NULL)
+ {
+ PRINTF_ERROR (&info, "unregistered specifier");
+ goto error;
+ }
+
+ if (!IS_MODIFIER (spec) &&
+ !(info.state & (SNV_STATE_BEGIN | SNV_STATE_SPECIFIER)))
+ {
+ PRINTF_ERROR (&info, "invalid combination of flags");
+ goto error;
+ }
+
+ /* ...and call the relevant handler. */
+ if (call_argtype_function (&info, &argtypes, spec) < 0)
+ goto error;
+
+ info.format++;
+ }
+ while (info.count >= 0 && IS_MODIFIER (spec));
+ continue;
+ }
+
+ /* An escaped CHAR_SPEC: ignore it (by falling through). */
+ ++info.format;
+
+ /*FALLTHROUGH*/
+
+ default: /* Just a character: ignore it. */
+ continue;
+ }
+
+ error:
+ /* Get here on error */
+ info.argc = -1;
+ break;
+ }
+
+ if (info.argc == 0)
+ {
+ args = NULL;
+ }
+ else
+ {
+ int idx;
+
+ assert(argtypes != NULL);
+ args = snv_new (union printf_arg, info.argc);
+
+ /* We scanned the format string to find the type of the arguments,
+ so we can now cast it and store it correctly. */
+ for (idx = 0; idx < info.argc; idx++)
+ {
+ int tp = argtypes[idx];
+ if ((tp & PA_TYPE_MASK) == PA_TYPE_MASK)
+ {
+ if (idx + 1 == info.argc)
+ {
+ info.argc--;
+ break;
+ }
+ continue; /* Ignore it. We allow skipping args, but the
+ * user is responsible for ensuring a void* sized
+ * spacer in the argument list.
+ */
+ }
+
+ switch (tp & ~PA_FLAG_UNSIGNED)
+ {
+ case PA_CHAR:
+ args[idx].pa_char = (char) *(const long int *)(ap + idx);
+ break;
+
+ case PA_WCHAR:
+ args[idx].pa_wchar =
+ (snv_wchar_t) *(const long int *)(ap + idx);
+ break;
+
+ case PA_INT|PA_FLAG_SHORT:
+ args[idx].pa_short_int =
+ (short int) *(const long int *)(ap + idx);
+ break;
+
+ case PA_INT:
+ args[idx].pa_int = (int) *(const long int *)(ap + idx);
+ break;
+
+ case PA_INT|PA_FLAG_LONG:
+ args[idx].pa_long_int = *(const long int *)(ap + idx);
+ break;
+
+ case PA_INT|PA_FLAG_LONG_LONG:
+ args[idx].pa_long_long_int = **(const intmax_t **)(ap + idx);
+ break;
+
+ case PA_FLOAT:
+ args[idx].pa_float = **(const float **)(ap + idx);
+ break;
+
+ case PA_DOUBLE|PA_FLAG_LONG_DOUBLE:
+#ifdef HAVE_LONG_DOUBLE
+ args[idx].pa_long_double = **(const long double **)(ap + idx);
+ break;
+#endif
+ /* else fall through */
+
+ case PA_DOUBLE:
+ args[idx].pa_double = **(const double **)(ap + idx);
+ break;
+
+ /* Note that pointer types are dereferenced just once! */
+ case PA_STRING:
+ args[idx].pa_string = *(const char **)(ap + idx);
+ break;
+
+ case PA_WSTRING:
+ args[idx].pa_wstring = *(const snv_wchar_t **)(ap + idx);
+ break;
+
+ case PA_POINTER:
+ args[idx].pa_pointer = *(snv_constpointer *)(ap + idx);
+ break;
+
+ default:
+ if (argtypes[idx] & PA_FLAG_PTR)
+ args[idx].pa_pointer = *(snv_constpointer *)(ap + idx);
+ else
+ args[idx].pa_long_double = 0.0;
+ break;
+ }
+ }
+ }
+
+ if (printf_last_error)
+ snv_delete (printf_last_error);
+
+ if (info.error)
+ printf_last_error = fildelete (info.error);
+ else
+ printf_last_error = NULL;
+
+ count_or_errorcode = do_printfv (stream, format, args);
+
+ snv_delete (argtypes);
+ if (info.argc > 0)
+ snv_delete (args);
+
+ return count_or_errorcode;
+}
+
+
+/**
+ * stream_vprintf: printf.h
+ * @stream: an initialised stream structure.
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to @stream. If @stream is %NULL, only count the
+ * number of characters needed to output the format.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+stream_vprintf (STREAM *stream, const char *format, va_list ap)
+{
+ union printf_arg *args = NULL;
+ struct printf_info info;
+ int count_or_errorcode;
+ int *argtypes = NULL;
+
+ return_val_if_fail (format != NULL, SNV_ERROR);
+
+ parser_init (&info, format, NULL);
+
+ /* Keep going until the format string runs out! */
+ while (*info.format != EOS)
+ {
+ int ch = (int) *info.format++;
+
+ switch (ch)
+ {
+ case SNV_CHAR_SPEC:
+ if (*info.format != SNV_CHAR_SPEC)
+ {
+ /* We found the start of a format specifier! */
+ spec_entry *spec;
+
+ parser_reset (&info);
+ do
+ {
+ /* Until we fill the stream (or get some other
+ exception) or one of the handlers tells us
+ we have reached the end of the specifier... */
+ /* ...lookup the handler associated with the char
+ we are looking at in the format string... */
+ spec = spec_lookup ((unsigned)*(info.format));
+ if (spec == NULL)
+ {
+ PRINTF_ERROR (&info, "unregistered specifier");
+ goto error;
+ }
+
+ if (!IS_MODIFIER (spec) &&
+ !(info.state & (SNV_STATE_BEGIN | SNV_STATE_SPECIFIER)))
+ {
+ PRINTF_ERROR (&info, "invalid combination of flags");
+ goto error;
+ }
+
+ /* ...and call the relevant handler. */
+ if (call_argtype_function (&info, &argtypes, spec) < 0)
+ goto error;
+
+ info.format++;
+ }
+ while (info.count >= 0 && IS_MODIFIER (spec));
+ continue;
+ }
+ /* An escaped CHAR_SPEC: ignore it (by falling through). */
+ ++info.format;
+
+ /*FALLTHROUGH*/
+
+ default: /* Just a character: ignore it. */
+ continue;
+ }
+
+ error:
+ /* Get here on error */
+ info.argc = -1;
+ break;
+ }
+
+ if (info.argc > 0)
+ {
+ int idx;
+
+ assert(argtypes != NULL);
+ args = snv_new (union printf_arg, info.argc);
+
+ /* Scan the format string to find the type of the argument
+ so we can cast it and store it correctly.
+
+ Note that according to the ISO C standards, standard
+ type promotion takes place on any variadic arguments as
+ they are aligned on the call stack, and so it is these
+ promoted types that we must extract with the va_arg()
+ macro, or the alignment gets all messed up.
+
+ Thanks to Robert Lipe <robertlipe@usa.net> for explaining all
+ this to me. */
+ for (idx = 0; idx < info.argc; idx++)
+ switch (argtypes[idx] & ~PA_FLAG_UNSIGNED)
+ {
+ case PA_CHAR:
+ args[idx].pa_char = va_arg (ap, int); /* Promoted. */
+ break;
+
+ case PA_WCHAR:
+ args[idx].pa_wchar = va_arg (ap, snv_wint_t); /* Promoted. */
+ break;
+
+ case PA_INT|PA_FLAG_SHORT:
+ args[idx].pa_short_int = va_arg (ap, int); /* Promoted. */
+ break;
+
+ case PA_INT:
+ args[idx].pa_int = va_arg (ap, int);
+ break;
+
+ case PA_INT|PA_FLAG_LONG:
+ args[idx].pa_long_int = va_arg (ap, long int);
+ break;
+
+ case PA_INT|PA_FLAG_LONG_LONG:
+ args[idx].pa_long_long_int = va_arg (ap, intmax_t);
+ break;
+
+ case PA_FLOAT:
+ args[idx].pa_float = va_arg (ap, double); /* Promoted. */
+ break;
+
+ case PA_DOUBLE|PA_FLAG_LONG_DOUBLE:
+ args[idx].pa_long_double = va_arg (ap, long double);
+ break;
+
+ case PA_DOUBLE:
+ args[idx].pa_double = va_arg (ap, double);
+ break;
+
+ case PA_STRING:
+ args[idx].pa_string = va_arg (ap, const char *);
+ break;
+
+ case PA_WSTRING:
+ args[idx].pa_wstring = va_arg (ap, const snv_wchar_t *);
+ break;
+
+ case PA_POINTER:
+ args[idx].pa_pointer = va_arg (ap, void *);
+ break;
+
+ default:
+ if (argtypes[idx] & PA_FLAG_PTR)
+ args[idx].pa_pointer = va_arg (ap, void *);
+ else
+ args[idx].pa_long_double = 0.0;
+ break;
+ }
+ }
+
+ if (printf_last_error)
+ snv_delete (printf_last_error);
+
+ if (info.error)
+ printf_last_error = fildelete (info.error);
+ else
+ printf_last_error = NULL;
+
+ count_or_errorcode = do_printfv (stream, format, args);
+
+ snv_delete (argtypes);
+ snv_delete (args);
+ return count_or_errorcode;
+}
+
+/**
+ * stream_printf: printf.h
+ * @stream: an initialised stream structure.
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to @stream. If @stream is %NULL, only count the
+ * number of characters needed to output the format.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+stream_printf (STREAM * stream, const char *format, ...)
+{
+ int count_or_errorcode;
+ va_list ap;
+
+ va_start (ap, format);
+ count_or_errorcode = stream_vprintf (stream, format, ap);
+ va_end (ap);
+
+ return count_or_errorcode;
+}
+
+
+/* Finally... the main API implementation: */
+
+/**
+ * snv_fdputc: printf.h
+ * @ch: A single character to be added to @stream.
+ * @stream: The stream in which to write @ch.
+ *
+ * A StreamPut function for use in putting characters
+ * into STREAMs holding a file descriptor.
+ *
+ * Return value:
+ * The value of @ch that has been put in @stream, or -1 in case of
+ * an error (errno will be set to indicate the type of error).
+ **/
+int
+snv_fdputc (int ch, STREAM *stream)
+{
+ static char buf[1] = { 0 };
+ buf[0] = (char) ch;
+ return
+ write ((int) SNV_POINTER_TO_LONG (stream_details (stream)), buf, (size_t) 1)
+ ? ch : -1;
+}
+
+/**
+ * snv_dprintf: printf.h
+ * @fd: an open file descriptor.
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to the file descriptor @fd.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_dprintf (int fd, const char *format, ...)
+{
+ int count_or_errorcode;
+ va_list ap;
+
+ va_start (ap, format);
+ count_or_errorcode = snv_vdprintf (fd, format, ap);
+ va_end (ap);
+
+ return count_or_errorcode;
+}
+
+/**
+ * snv_vdprintf: printf.h
+ * @fd: an open file descriptor.
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to the file descriptor @fd.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_vdprintf (int fd, const char *format, va_list ap)
+{
+ int result;
+ STREAM *out = stream_new (SNV_LONG_TO_POINTER (fd),
+ SNV_UNLIMITED, NULL, snv_fdputc);
+
+ result = stream_vprintf (out, format, ap);
+ stream_delete (out);
+ return result;
+}
+
+/**
+ * snv_dprintfv: printf.h
+ * @fd: an open file descriptor.
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to @format, and write
+ * the results to file descriptor @fd.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_dprintfv (int fd, const char *format, snv_constpointer const args[])
+{
+ int result;
+ STREAM *out = stream_new (SNV_LONG_TO_POINTER (fd),
+ SNV_UNLIMITED, NULL, snv_fdputc);
+
+ result = stream_printfv (out, format, args);
+ stream_delete (out);
+ return result;
+}
+
+
+/**
+ * snv_fileputc: printf.h
+ * @ch: A single character to be added to @stream.
+ * @stream: The stream in which to write @ch.
+ *
+ * A StreamPut function for use in putting characters
+ * into STREAMs holding a FILE*.
+ *
+ * Return value:
+ * The value of @ch that has been put in @stream.
+ **/
+int
+snv_fileputc (int ch, STREAM *stream)
+{
+ FILE *fp = (FILE *) stream_details (stream);
+ return putc (ch, fp);
+}
+
+static int
+snv_fileputc_unlocked (int ch, STREAM *stream)
+{
+ FILE *fp = (FILE *) stream_details (stream);
+ return SNV_PUTC_UNLOCKED (ch, fp);
+}
+
+/**
+ * snv_printf: printf.h
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to the standard output stream.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_printf (const char *format, ...)
+{
+ int count_or_errorcode;
+ va_list ap;
+
+ va_start (ap, format);
+ count_or_errorcode = snv_vprintf (format, ap);
+ va_end (ap);
+
+ return count_or_errorcode;
+}
+
+/**
+ * snv_vprintf: printf.h
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to the standard output stream.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_vprintf (const char *format, va_list ap)
+{
+ int result;
+ STREAM *out = stream_new (stdout, SNV_UNLIMITED, NULL, snv_fileputc_unlocked);
+ int tmp;
+
+ SNV_WITH_LOCKED_FP (stdout, tmp)
+ result = stream_vprintf (out, format, ap);
+
+ stream_delete (out);
+ return result;
+}
+
+/**
+ * snv_printfv: printf.h
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to the string @format,
+ * and write the result to the standard output stream.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_printfv (const char *format, snv_constpointer const args[])
+{
+ int result;
+ STREAM *out = stream_new (stdout, SNV_UNLIMITED, NULL, snv_fileputc_unlocked);
+ int tmp;
+
+ SNV_WITH_LOCKED_FP (stdout, tmp)
+ result = stream_printfv (out, format, args);
+ stream_delete (out);
+ return result;
+}
+
+/**
+ * snv_fprintf: printf.h
+ * @file: a stdio.h FILE* stream.
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to the @file stream.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_fprintf (FILE * file, const char *format, ...)
+{
+ int count_or_errorcode;
+ va_list ap;
+
+ va_start (ap, format);
+ count_or_errorcode = snv_vfprintf (file, format, ap);
+ va_end (ap);
+
+ return count_or_errorcode;
+}
+
+/**
+ * snv_vfprintf: printf.h
+ * @file: a stdio.h FILE* stream.
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to the @file stream.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_vfprintf (FILE *file, const char *format, va_list ap)
+{
+ int result;
+ STREAM *out = stream_new (file, SNV_UNLIMITED, NULL, snv_fileputc_unlocked);
+ int tmp;
+
+ SNV_WITH_LOCKED_FP (file, tmp)
+ result = stream_vprintf (out, format, ap);
+ stream_delete (out);
+ return result;
+}
+
+/**
+ * snv_fprintfv: printf.h
+ * @file: a stdio.h FILE* stream.
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to @format, and write
+ * the results to @file.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_fprintfv (FILE *file, const char *format, snv_constpointer const args[])
+{
+ int result;
+ STREAM *out = stream_new (file, SNV_UNLIMITED, NULL, snv_fileputc_unlocked);
+ int tmp;
+
+ SNV_WITH_LOCKED_FP (file, tmp)
+ result = stream_printfv (out, format, args);
+
+ stream_delete (out);
+ return result;
+}
+
+
+/**
+ * snv_bufputc: printf.h
+ * @ch: A single character to be added to @stream.
+ * @stream: The stream in which to write @ch.
+ *
+ * A StreamPut function for use in putting characters
+ * into STREAMs holding a char buffer.
+ *
+ * Return value:
+ * The value of @ch that has been put in @stream.
+ **/
+int
+snv_bufputc (int ch, STREAM * stream)
+{
+ char **ppbuffer = (char **) stream_details (stream);
+ **ppbuffer = (char) ch;
+ (*ppbuffer)++;
+ return ch;
+}
+
+/**
+ * snv_sprintf: printf.h
+ * @buffer: a preallocated char* buffer.
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to the string @buffer.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_sprintf (char buffer[], const char *format, ...)
+{
+ int count_or_errorcode;
+ va_list ap;
+
+ va_start (ap, format);
+ count_or_errorcode = snv_vsprintf (buffer, format, ap);
+ va_end (ap);
+
+ return count_or_errorcode;
+}
+
+/**
+ * snv_vsprintf: printf.h
+ * @buffer: a preallocated char* buffer.
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to the string @buffer.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_vsprintf (char buffer[], const char *format, va_list ap)
+{
+ int count_or_errorcode;
+ STREAM *out = stream_new (&buffer, SNV_UNLIMITED, NULL, snv_bufputc);
+ count_or_errorcode = stream_vprintf (out, format, ap);
+
+ /* Terminate with an EOS without incrementing the counter. */
+ stream_put (EOS, out);
+
+ stream_delete (out);
+ return count_or_errorcode;
+}
+
+/**
+ * snv_sprintfv: printf.h
+ * @buffer: a preallocated char* buffer.
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to @format, and write
+ * the results to the string @buffer.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_sprintfv (char buffer[], const char *format, snv_constpointer const args[])
+{
+ int count_or_errorcode;
+ STREAM *out = stream_new (&buffer, SNV_UNLIMITED, NULL, snv_bufputc);
+ count_or_errorcode = stream_printfv (out, format, args);
+
+ /* Terminate with an EOS without incrementing the counter. */
+ stream_put (EOS, out);
+
+ stream_delete (out);
+ return count_or_errorcode;
+}
+
+/**
+ * snv_snprintf: printf.h
+ * @buffer: a preallocated char* buffer.
+ * @limit: the maximum number of characters to write into @buffer.
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to the string @buffer, truncating the formatted string
+ * if it reaches @limit characters in length.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_snprintf (char buffer[], unsigned long limit, const char *format, ...)
+{
+ int count_or_errorcode;
+ va_list ap;
+
+ va_start (ap, format);
+ count_or_errorcode = snv_vsnprintf (buffer, limit, format, ap);
+ va_end (ap);
+
+ return count_or_errorcode;
+}
+
+/**
+ * snv_vsnprintf: printf.h
+ * @buffer: a preallocated char* buffer.
+ * @limit: the maximum number of characters to write into @buffer.
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to the string @buffer, truncating the formatted string
+ * if it reaches @limit characters in length.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_vsnprintf (char buffer[], unsigned long limit, const char *format, va_list ap)
+{
+ int count_or_errorcode;
+ STREAM *out = stream_new (&buffer, limit - 1, NULL, snv_bufputc);
+ count_or_errorcode = stream_vprintf (out, format, ap);
+ *buffer = EOS;
+
+ stream_delete (out);
+ return count_or_errorcode;
+}
+
+/**
+ * snv_snprintfv: printf.h
+ * @buffer: a preallocated char* buffer.
+ * @limit: the maximum number of characters to write into @buffer.
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to @format, and write
+ * the results to the string @buffer, truncating the formatted string
+ * if it reaches @limit characters in length.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_snprintfv (char buffer[], unsigned long limit, const char *format,
+ snv_constpointer const args[])
+{
+ int count_or_errorcode;
+ STREAM *out = stream_new (&buffer, limit - 1, NULL, snv_bufputc);
+ count_or_errorcode = stream_printfv (out, format, args);
+ *buffer = EOS;
+
+ stream_delete (out);
+ return count_or_errorcode;
+}
+
+
+/**
+ * snv_filputc: printf.h
+ * @ch: A single character to be added to @stream.
+ * @stream: The stream in which to write @ch.
+ *
+ * A StreamPut function for use in putting characters
+ * into STREAMs holding a Filament*.
+ *
+ * Return value:
+ * The value of @ch that has been put in @stream.
+ **/
+int
+snv_filputc (int ch, STREAM * stream)
+{
+ return filccat ((Filament *) stream_details (stream), ch), ch;
+}
+
+/**
+ * snv_asprintf: printf.h
+ * @result: the address of a char * variable.
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to an internally allocated buffer whose address is
+ * stored in @result (and should be freed by the caller) unless
+ * there is an error.
+ *
+ * Yes, this interface is cumbersome and totally useless. It would
+ * have been better to simply return the allocated address, but
+ * it turns out that somebody wasn't thinking much when adding
+ * asprintf to libiberty a few years ago.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_asprintf (char **result, const char *format, ...)
+{
+ int count;
+ va_list ap;
+
+ va_start (ap, format);
+ count = snv_vasprintf (result, format, ap);
+ va_end (ap);
+
+ return count;
+}
+
+/**
+ * snv_vasprintf: printf.h
+ * @result: the address of a char * variable.
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to an internally allocated buffer whose address is
+ * stored in @result (and should be freed by the caller) unless
+ * there is an error.
+ *
+ * Above moaning for asprintf applies here too.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_vasprintf (char **result, const char *format, va_list ap)
+{
+ int count_or_errorcode;
+ char *base;
+ Filament *fil = filnew (NULL, (size_t)0);
+ STREAM *out = stream_new (fil, SNV_UNLIMITED, NULL, snv_filputc);
+ count_or_errorcode = stream_vprintf (out, format, ap);
+
+ base = fildelete (fil);
+ stream_delete (out);
+
+ *result = (count_or_errorcode < 0) ? NULL : base;
+ return count_or_errorcode;
+}
+
+/**
+ * snv_asprintfv: printf.h
+ * @result: the address of a char * variable.
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to @format, and write
+ * the results to an internally allocated buffer whose address is
+ * stored in @result (and should be freed by the caller) unless
+ * there is an error.
+ *
+ * Above moaning for asprintf applies here too.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+int
+snv_asprintfv (char **result, const char *format, snv_constpointer const args[])
+{
+ int count_or_errorcode;
+ char *base;
+ Filament *fil = filnew (NULL, (size_t)0);
+ STREAM *out = stream_new (fil, SNV_UNLIMITED, NULL, snv_filputc);
+ count_or_errorcode = stream_printfv (out, format, args);
+
+ base = fildelete (fil);
+ stream_delete (out);
+
+ *result = (count_or_errorcode < 0) ? NULL : base;
+ return count_or_errorcode;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "gnu"
+ * indent-tabs-mode: nil
+ * End:
+ * end of snprintfv/printfv.c */
diff --git a/snprintfv/printf.h b/snprintfv/printf.h
new file mode 100644
index 0000000..7e53fd1
--- /dev/null
+++ b/snprintfv/printf.h
@@ -0,0 +1,846 @@
+/* -*- Mode: C -*- */
+
+/* printf.in --- printf clone for argv arrays
+ * Copyright (C) 1998, 1999, 2000, 2002 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1998
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+/* Code: */
+
+#ifndef SNPRINTFV_SNPRINTFV_H
+#define SNPRINTFV_SNPRINTFV_H 1
+
+#include <snprintfv/compat.h>
+#include <snprintfv/filament.h>
+#include <snprintfv/stream.h>
+#include <snprintfv/mem.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* The type of each element in the table of printf specifiers. */
+struct spec_entry;
+
+typedef enum
+{
+ SNV_ERROR = -1,
+ SNV_OK
+}
+snv_status;
+
+/* Basic states required by the parser. On initialisation the parser
+ will be in SNV_STATE_BEGIN, and tokens will be parsed by the registered
+ functions until the parser reached SNV_STATE_END. */
+#define SNV_STATE_BEGIN 1
+#define SNV_STATE_END 0
+
+/* States needed to support:
+ %[<number>$]<flags>[<width>|\*][.<precision>|\*]<modifiers><specifier> */
+#define SNV_STATE_FLAG (1 << 1)
+#define SNV_STATE_WIDTH (1 << 2)
+#define SNV_STATE_PRECISION (1 << 3)
+#define SNV_STATE_MODIFIER (1 << 4)
+#define SNV_STATE_SPECIFIER (1 << 5)
+
+/* First state available to the user */
+#define SNV_STATE_USER_FIRST (1 << 8)
+
+/* Mask for states available to the user */
+#define SNV_STATE_USER_MASK ~(SNV_STATE_USER_FIRST - 1)
+
+typedef struct printf_info
+{
+ int count; /* accumulated count, or SNV_ERROR */
+ int state; /* one of the defines above */
+ Filament *error; /* accumulated error details */
+
+ const char *format; /* pointer to format string */
+ int argc; /* number of arguments used by format */
+ int argindex; /* number of non-dollar arguments used so far */
+
+ int dollar; /* standard parser state, as in glibc */
+ int prec; /* from this field on, as in glibc */
+ int width;
+
+ snv_pointer extra;
+ int type;
+
+ char spec;
+ char pad;
+ unsigned is_long_double:1;
+ unsigned is_char:1;
+ unsigned is_short:1;
+ unsigned is_long:1;
+ unsigned alt:1;
+ unsigned space:1;
+ unsigned left:1;
+ unsigned showsign:1;
+ unsigned group:1;
+ unsigned wide:1;
+
+ const union printf_arg *args;
+} printf_info;
+
+/**
+ * printf_arg:
+ * @pa_char: an unsigned %char
+ * @pa_wchar: a %wchar_t
+ * @pa_short_int: a %short integer
+ * @pa_int: an %int
+ * @pa_long_int: a %long integer
+ * @pa_long_long_int: the widest signed integer type in use on the host
+ * @pa_u_short_int: an unsigned %short integer
+ * @pa_u_int: an unsigned %int
+ * @pa_u_long_int: an unsigned %long integer
+ * @pa_u_long_long_int: the widest unsigned integer type in use on the host
+ * @pa_float: a %float
+ * @pa_double: a %double
+ * @pa_long_double: a long %double, or a simple %double if it is the widest floating-point type in use on the host
+ * @pa_string: a %const pointer to %char
+ * @pa_wstring: a %const pointer to %wchar_t
+ * @pa_pointer: a generic pointer
+ *
+ * The various kinds of arguments that can be passed to printf.
+ */
+typedef union printf_arg
+{
+ unsigned char pa_char;
+ snv_wchar_t pa_wchar;
+ short int pa_short_int;
+ int pa_int;
+ long int pa_long_int;
+ intmax_t pa_long_long_int;
+ unsigned short int pa_u_short_int;
+ unsigned int pa_u_int;
+ unsigned long int pa_u_long_int;
+ uintmax_t pa_u_long_long_int;
+ float pa_float;
+ double pa_double;
+ long double pa_long_double;
+ const char *pa_string;
+ const snv_wchar_t *pa_wstring;
+ snv_constpointer pa_pointer;
+} printf_arg;
+
+/**
+ * PRINTF_ERROR:
+ * @pi: A pointer to the current state for the parser
+ * @str: The error message
+ *
+ * Append an error that will be returned by printf_strerror.
+ */
+#define PRINTF_ERROR(pi, str) \
+ printf_error(pi, __FILE__, __LINE__, SNV_ASSERT_FCN, str);
+
+typedef int printf_function (STREAM *stream, struct printf_info *pparser,
+ union printf_arg const * args);
+
+typedef int printf_arginfo_function (struct printf_info *pparser, size_t n,
+ int *argtypes);
+
+/**
+ * spec_entry:
+ * @spec: the specifier character that was matched
+ * @type: when @arg is NULL, the type of the only argument to the specifier
+ * @fmt: the handler function to actually print the arguments to the specifier
+ * @arg: the handler function to tell %printf about the types of the arguments to the specifier
+ * @user: the user data for the specifier, accessible to the handler function
+ *
+ * This is returned by register_printf_function.
+ */
+typedef struct spec_entry
+{
+ unsigned int spec_key;
+ int unused; /* for binary compatibility */
+ int type;
+ printf_function *fmt;
+ printf_arginfo_function *arg;
+ snv_pointer user;
+}
+spec_entry;
+
+/**
+ * register_callback_function: printf.h
+ * @spec: the character which will trigger the functions, cast to an unsigned int.
+ * @fmt: the handler function to actually print the arguments to the specifier
+ * @arg: the handler function to tell %printf about the types of the arguments to the specifier
+ *
+ * Register the pair made of @fmt and @arg, so that it is called
+ * when @spec is encountered in a format string. If you create
+ * a shared library with an entry point named
+ * %snv_register_printf_funcs, and put the library in the
+ * search path given by the environment library %LTDL_LIBRARY_PATH,
+ * that entry point will be called when %libsnprintfv is initialized,
+ * passing a pointer to this kind of function (actually, a pointer
+ * to %register_printf_function) to it. This functionality is only
+ * present when the library is installed, not when it is built as
+ * a convenience library.
+ *
+ * Return value:
+ * Returns %NULL if @func was not successfully registered, a
+ * %spec_entry with the information on the function if it was.
+ **/
+typedef spec_entry *register_callback_function (unsigned spec, printf_function *func, printf_arginfo_function *arginfo);
+
+/* Codes to determine basic types.
+
+ These values cover all the standard format specifications.
+ Users can add new values after PA_LAST for their own types. */
+
+enum
+{
+ PA_INT, /* int */
+ PA_CHAR, /* int, cast to char */
+ PA_WCHAR, /* wide char */
+ PA_STRING, /* const char *, a '\0'-terminated string */
+ PA_WSTRING, /* const wchar_t *, wide character string */
+ PA_POINTER, /* void * */
+ PA_FLOAT, /* float */
+ PA_DOUBLE, /* double */
+ PA_LAST,
+ PA_UNKNOWN = -1
+};
+
+/* Flag bits that can be set in a type. */
+#define PA_TYPE_MASK 0x00ff
+#define PA_FLAG_MASK ~SNV_TYPE_MASK
+
+#define PA_FLAG_LONG_LONG (1 << 8)
+#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
+#define PA_FLAG_LONG (1 << 9)
+#define PA_FLAG_SHORT (1 << 10)
+#define PA_FLAG_UNSIGNED (1 << 11)
+#define PA_FLAG_CHAR (1 << 12)
+#define PA_FLAG_PTR (1 << 13)
+
+/**
+ * SNV_EMIT:
+ * @ch: the character to be printed
+ * @stream: the stream on which to print
+ * @count: a variable to be updated with the count of printed
+ * characters
+ *
+ * Maintain the count while putting @ch in @stream, also be careful about
+ * handling %NULL stream if the handler is being called purely to count
+ * output size.
+ **/
+#define SNV_EMIT(ch, stream, count) \
+ SNV_STMT_START { \
+ if ((stream)) \
+ { \
+ if ((count) >= 0) \
+ { \
+ int m_status = stream_put((unsigned char) (ch), (stream)); \
+ (count) = m_status < 0 ? m_status : (count) + m_status; \
+ } \
+ } \
+ else \
+ { \
+ (void)(ch); \
+ (count)++; \
+ } \
+ } SNV_STMT_END
+
+#line 267 "printf.in"
+/**
+ * printf_generic_info:
+ * @pinfo: the current state information for the format
+ * string parser.
+ * @n: the number of available slots in the @argtypes array
+ * @argtypes: the pointer to the first slot to be filled by the
+ * function
+ *
+ * An example implementation of a %printf_arginfo_function, which
+ * takes the basic type from the type given in the %spec_entry
+ * and adds flags depending on what was parsed (e.g. %PA_FLAG_SHORT
+ * is %pparser->is_short and so on).
+ *
+ * Return value:
+ * Always 1.
+ */
+extern int
+printf_generic_info (struct printf_info *const pinfo, size_t n, int *argtypes);
+
+/**
+ * printf_generic:
+ * @stream: the stream (possibly a struct printfv_stream appropriately
+ * cast) on which to write output.
+ * @pinfo: the current state information for the format string parser.
+ * @args: the pointer to the first argument to be read by the handler
+ *
+ * An example implementation of a %printf_function, used to provide easy
+ * access to justification, width and precision options.
+ *
+ * Return value:
+ * The number of characters output.
+ **/
+extern int
+printf_generic (STREAM *stream, struct printf_info *const pinfo, union printf_arg const *args);
+
+#line 268 "printf.in"
+/**
+ * register_printf_function: printf.h
+ * @spec: the character which will trigger @func, cast to an unsigned int.
+ * @fmt: the handler function to actually print the arguments to the specifier
+ * @arg: the handler function to tell %printf about the types of the arguments
+ * to the specifier
+ *
+ * Register the pair made of @fmt and @arg, so that it is called
+ * when @spec is encountered in a format string.
+ *
+ * Return value:
+ * Returns %NULL if @func was not successfully registered, a
+ * %spec_entry with the information on the function if it was.
+ **/
+extern spec_entry *
+register_printf_function (unsigned spec, printf_function *fmt,
+ printf_arginfo_function *arg);
+
+/**
+ * printf_strerror: printf.h
+ *
+ * Communicate information on the last error in a printf
+ * format string.
+ *
+ * Return value:
+ * A string describing the last error which occurred during the
+ * parsing of a printf format string. It is the responsibility
+ * of the caller to free the string.
+ */
+extern char *
+printf_strerror (void);
+
+/**
+ * printf_error: printf.h
+ * @pinfo: pointer to the current parser state.
+ * @file: file where error was detected.
+ * @line: line where error was detected.
+ * @func1: " (" if function is supplied by compiler.
+ * @func2: function where error was detected, if supplied by compiler.
+ * @func3: ")" if function is supplied by compiler.
+ * @error_message: new error message to append to @pinfo.
+ *
+ * The contents of @error_message are appended to the @pinfo internal
+ * error string, so it is safe to pass static strings or recycle the
+ * original when this function returns.
+ *
+ * Return value:
+ * The address of the full accumulated error message in @pinfo is
+ * returned.
+ **/
+extern char *
+printf_error (struct printf_info *pinfo, const char *file, int line,
+ const char *func1, const char *func2, const char *func3,
+ const char *error_message);
+
+/**
+ * parse_printf_format: printf.h
+ * @format: a % delimited format string.
+ * @n: the size of the @argtypes vector
+ * @argtypes: a vector of ints, to be filled with the argument types from @format
+ *
+ * Returns information about the number and types of
+ * arguments expected by the template string @format.
+ * The argument @n specifies the number of elements in the array
+ * @argtypes. This is the maximum number of elements that
+ * the function will try to write.
+ *
+ * Return value:
+ * The total number of arguments required by @format. If this
+ * number is greater than @n, then the information returned
+ * describes only the first @n arguments. If you want information
+ * about additional arguments, allocate a bigger array and call
+ * this function again. If there is an error, then %SNV_ERROR
+ * is returned instead.
+ **/
+extern size_t
+parse_printf_format (const char *format, int n, int *argtypes);
+
+/**
+ * stream_printfv: printf.h
+ * @stream: an initialised stream structure.
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to @format, and write
+ * the results to @stream. If @stream is %NULL, only count the
+ * number of characters needed to output the format.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+stream_printfv (STREAM *stream, const char *format, snv_constpointer const *ap);
+
+/**
+ * stream_vprintf: printf.h
+ * @stream: an initialised stream structure.
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to @stream. If @stream is %NULL, only count the
+ * number of characters needed to output the format.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+stream_vprintf (STREAM *stream, const char *format, va_list ap);
+
+/**
+ * stream_printf: printf.h
+ * @stream: an initialised stream structure.
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to @stream. If @stream is %NULL, only count the
+ * number of characters needed to output the format.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+stream_printf (STREAM * stream, const char *format, ...);
+
+/**
+ * snv_fdputc: printf.h
+ * @ch: A single character to be added to @stream.
+ * @stream: The stream in which to write @ch.
+ *
+ * A StreamPut function for use in putting characters
+ * into STREAMs holding a file descriptor.
+ *
+ * Return value:
+ * The value of @ch that has been put in @stream, or -1 in case of
+ * an error (errno will be set to indicate the type of error).
+ **/
+extern int
+snv_fdputc (int ch, STREAM *stream);
+
+/**
+ * snv_dprintf: printf.h
+ * @fd: an open file descriptor.
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to the file descriptor @fd.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_dprintf (int fd, const char *format, ...);
+
+/**
+ * snv_vdprintf: printf.h
+ * @fd: an open file descriptor.
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to the file descriptor @fd.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_vdprintf (int fd, const char *format, va_list ap);
+
+/**
+ * snv_dprintfv: printf.h
+ * @fd: an open file descriptor.
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to @format, and write
+ * the results to file descriptor @fd.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_dprintfv (int fd, const char *format, snv_constpointer const args[]);
+
+/**
+ * snv_fileputc: printf.h
+ * @ch: A single character to be added to @stream.
+ * @stream: The stream in which to write @ch.
+ *
+ * A StreamPut function for use in putting characters
+ * into STREAMs holding a FILE*.
+ *
+ * Return value:
+ * The value of @ch that has been put in @stream.
+ **/
+extern int
+snv_fileputc (int ch, STREAM *stream);
+
+/**
+ * snv_printf: printf.h
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to the standard output stream.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_printf (const char *format, ...);
+
+/**
+ * snv_vprintf: printf.h
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to the standard output stream.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_vprintf (const char *format, va_list ap);
+
+/**
+ * snv_printfv: printf.h
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to the string @format,
+ * and write the result to the standard output stream.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_printfv (const char *format, snv_constpointer const args[]);
+
+/**
+ * snv_fprintf: printf.h
+ * @file: a stdio.h FILE* stream.
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to the @file stream.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_fprintf (FILE * file, const char *format, ...);
+
+/**
+ * snv_vfprintf: printf.h
+ * @file: a stdio.h FILE* stream.
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to the @file stream.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_vfprintf (FILE *file, const char *format, va_list ap);
+
+/**
+ * snv_fprintfv: printf.h
+ * @file: a stdio.h FILE* stream.
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to @format, and write
+ * the results to @file.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_fprintfv (FILE *file, const char *format, snv_constpointer const args[]);
+
+/**
+ * snv_bufputc: printf.h
+ * @ch: A single character to be added to @stream.
+ * @stream: The stream in which to write @ch.
+ *
+ * A StreamPut function for use in putting characters
+ * into STREAMs holding a char buffer.
+ *
+ * Return value:
+ * The value of @ch that has been put in @stream.
+ **/
+extern int
+snv_bufputc (int ch, STREAM * stream);
+
+/**
+ * snv_sprintf: printf.h
+ * @buffer: a preallocated char* buffer.
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to the string @buffer.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_sprintf (char buffer[], const char *format, ...);
+
+/**
+ * snv_vsprintf: printf.h
+ * @buffer: a preallocated char* buffer.
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to the string @buffer.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_vsprintf (char buffer[], const char *format, va_list ap);
+
+/**
+ * snv_sprintfv: printf.h
+ * @buffer: a preallocated char* buffer.
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to @format, and write
+ * the results to the string @buffer.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_sprintfv (char buffer[], const char *format, snv_constpointer const args[]);
+
+/**
+ * snv_snprintf: printf.h
+ * @buffer: a preallocated char* buffer.
+ * @limit: the maximum number of characters to write into @buffer.
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to the string @buffer, truncating the formatted string
+ * if it reaches @limit characters in length.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_snprintf (char buffer[], unsigned long limit, const char *format, ...);
+
+/**
+ * snv_vsnprintf: printf.h
+ * @buffer: a preallocated char* buffer.
+ * @limit: the maximum number of characters to write into @buffer.
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to the string @buffer, truncating the formatted string
+ * if it reaches @limit characters in length.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_vsnprintf (char buffer[], unsigned long limit, const char *format, va_list ap);
+
+/**
+ * snv_snprintfv: printf.h
+ * @buffer: a preallocated char* buffer.
+ * @limit: the maximum number of characters to write into @buffer.
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to @format, and write
+ * the results to the string @buffer, truncating the formatted string
+ * if it reaches @limit characters in length.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_snprintfv (char buffer[], unsigned long limit, const char *format,
+ snv_constpointer const args[]);
+
+/**
+ * snv_filputc: printf.h
+ * @ch: A single character to be added to @stream.
+ * @stream: The stream in which to write @ch.
+ *
+ * A StreamPut function for use in putting characters
+ * into STREAMs holding a Filament*.
+ *
+ * Return value:
+ * The value of @ch that has been put in @stream.
+ **/
+extern int
+snv_filputc (int ch, STREAM * stream);
+
+/**
+ * snv_asprintf: printf.h
+ * @result: the address of a char * variable.
+ * @format: a % delimited format string.
+ * @va_alist: a varargs/stdargs va_list.
+ *
+ * Format the elements of @va_alist according to @format, and write
+ * the results to an internally allocated buffer whose address is
+ * stored in @result (and should be freed by the caller) unless
+ * there is an error.
+ *
+ * Yes, this interface is cumbersome and totally useless. It would
+ * have been better to simply return the allocated address, but
+ * it turns out that somebody wasn't thinking much when adding
+ * asprintf to libiberty a few years ago.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_asprintf (char **result, const char *format, ...);
+
+/**
+ * snv_vasprintf: printf.h
+ * @result: the address of a char * variable.
+ * @format: a % delimited format string.
+ * @ap: a varargs/stdargs va_list.
+ *
+ * Format the elements of @ap according to @format, and write
+ * the results to an internally allocated buffer whose address is
+ * stored in @result (and should be freed by the caller) unless
+ * there is an error.
+ *
+ * Above moaning for asprintf applies here too.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_vasprintf (char **result, const char *format, va_list ap);
+
+/**
+ * snv_asprintfv: printf.h
+ * @result: the address of a char * variable.
+ * @format: a % delimited format string.
+ * @args: a vector of argument addresses to match @format.
+ *
+ * Format the elements of @args according to @format, and write
+ * the results to an internally allocated buffer whose address is
+ * stored in @result (and should be freed by the caller) unless
+ * there is an error.
+ *
+ * Above moaning for asprintf applies here too.
+ *
+ * Return value:
+ * The number of characters written is returned, unless there is
+ * an error, when %SNV_ERROR is returned.
+ **/
+extern int
+snv_asprintfv (char **result, const char *format, snv_constpointer const args[]);
+
+#line 269 "printf.in"
+
+/* If you don't want to use snprintfv functions for *all* of your string
+ formatting API, then define COMPILING_SNPRINTFV_C and use the snv_
+ prefix for the entry points below. */
+#ifndef COMPILING_PRINTF_C
+#undef printf
+#undef vprintf
+#undef dprintf
+#undef vdprintf
+#undef fprintf
+#undef vfprintf
+#undef sprintf
+#undef vsprintf
+#undef snprintf
+#undef vsnprintf
+#undef asprintf
+#undef vasprintf
+#undef asprintfv
+#undef dprintfv
+#undef fprintfv
+#undef sprintfv
+#undef printfv
+#undef snprintfv
+
+#define printf snv_printf
+#define vprintf snv_vprintf
+#define dprintf snv_dprintf
+#define vdprintf snv_vdprintf
+#define fprintf snv_fprintf
+#define vfprintf snv_vfprintf
+#define sprintf snv_sprintf
+#define vsprintf snv_vsprintf
+#define snprintf snv_snprintf
+#define vsnprintf snv_vsnprintf
+#define asprintf snv_asprintf
+#define vasprintf snv_vasprintf
+#define asprintfv snv_asprintfv
+#define dprintfv snv_dprintfv
+#define fprintfv snv_fprintfv
+#define sprintfv snv_sprintfv
+#define printfv snv_printfv
+#define snprintfv snv_snprintfv
+#endif /* !COMPILING_SNPRINTFV_C */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SNPRINTFV_SNPRINTFV_H */
+
+/* snprintfv.h ends here */
diff --git a/snprintfv/printf.in b/snprintfv/printf.in
new file mode 100644
index 0000000..98ba995
--- /dev/null
+++ b/snprintfv/printf.in
@@ -0,0 +1,318 @@
+/* -*- Mode: C -*- */
+
+/* printf.in --- printf clone for argv arrays
+ * Copyright (C) 1998, 1999, 2000, 2002 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1998
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+/* Code: */
+
+#ifndef SNPRINTFV_SNPRINTFV_H
+#define SNPRINTFV_SNPRINTFV_H 1
+
+#include <snprintfv/compat.h>
+#include <snprintfv/filament.h>
+#include <snprintfv/stream.h>
+#include <snprintfv/mem.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/* The type of each element in the table of printf specifiers. */
+struct spec_entry;
+
+typedef enum
+{
+ SNV_ERROR = -1,
+ SNV_OK
+}
+snv_status;
+
+/* Basic states required by the parser. On initialisation the parser
+ will be in SNV_STATE_BEGIN, and tokens will be parsed by the registered
+ functions until the parser reached SNV_STATE_END. */
+#define SNV_STATE_BEGIN 1
+#define SNV_STATE_END 0
+
+/* States needed to support:
+ %[<number>$]<flags>[<width>|\*][.<precision>|\*]<modifiers><specifier> */
+#define SNV_STATE_FLAG (1 << 1)
+#define SNV_STATE_WIDTH (1 << 2)
+#define SNV_STATE_PRECISION (1 << 3)
+#define SNV_STATE_MODIFIER (1 << 4)
+#define SNV_STATE_SPECIFIER (1 << 5)
+
+/* First state available to the user */
+#define SNV_STATE_USER_FIRST (1 << 8)
+
+/* Mask for states available to the user */
+#define SNV_STATE_USER_MASK ~(SNV_STATE_USER_FIRST - 1)
+
+typedef struct printf_info
+{
+ int count; /* accumulated count, or SNV_ERROR */
+ int state; /* one of the defines above */
+ Filament *error; /* accumulated error details */
+
+ const char *format; /* pointer to format string */
+ int argc; /* number of arguments used by format */
+ int argindex; /* number of non-dollar arguments used so far */
+
+ int dollar; /* standard parser state, as in glibc */
+ int prec; /* from this field on, as in glibc */
+ int width;
+
+ snv_pointer extra;
+ int type;
+
+ char spec;
+ char pad;
+ unsigned is_long_double:1;
+ unsigned is_char:1;
+ unsigned is_short:1;
+ unsigned is_long:1;
+ unsigned alt:1;
+ unsigned space:1;
+ unsigned left:1;
+ unsigned showsign:1;
+ unsigned group:1;
+ unsigned wide:1;
+
+ const union printf_arg *args;
+} printf_info;
+
+/**
+ * printf_arg:
+ * @pa_char: an unsigned %char
+ * @pa_wchar: a %wchar_t
+ * @pa_short_int: a %short integer
+ * @pa_int: an %int
+ * @pa_long_int: a %long integer
+ * @pa_long_long_int: the widest signed integer type in use on the host
+ * @pa_u_short_int: an unsigned %short integer
+ * @pa_u_int: an unsigned %int
+ * @pa_u_long_int: an unsigned %long integer
+ * @pa_u_long_long_int: the widest unsigned integer type in use on the host
+ * @pa_float: a %float
+ * @pa_double: a %double
+ * @pa_long_double: a long %double, or a simple %double if it is the widest floating-point type in use on the host
+ * @pa_string: a %const pointer to %char
+ * @pa_wstring: a %const pointer to %wchar_t
+ * @pa_pointer: a generic pointer
+ *
+ * The various kinds of arguments that can be passed to printf.
+ */
+typedef union printf_arg
+{
+ unsigned char pa_char;
+ snv_wchar_t pa_wchar;
+ short int pa_short_int;
+ int pa_int;
+ long int pa_long_int;
+ intmax_t pa_long_long_int;
+ unsigned short int pa_u_short_int;
+ unsigned int pa_u_int;
+ unsigned long int pa_u_long_int;
+ uintmax_t pa_u_long_long_int;
+ float pa_float;
+ double pa_double;
+ long double pa_long_double;
+ const char *pa_string;
+ const snv_wchar_t *pa_wstring;
+ snv_constpointer pa_pointer;
+} printf_arg;
+
+/**
+ * PRINTF_ERROR:
+ * @pi: A pointer to the current state for the parser
+ * @str: The error message
+ *
+ * Append an error that will be returned by printf_strerror.
+ */
+#define PRINTF_ERROR(pi, str) \
+ printf_error(pi, __FILE__, __LINE__, SNV_ASSERT_FCN, str);
+
+typedef int printf_function (STREAM *stream, struct printf_info *pparser,
+ union printf_arg const * args);
+
+typedef int printf_arginfo_function (struct printf_info *pparser, size_t n,
+ int *argtypes);
+
+/**
+ * spec_entry:
+ * @spec: the specifier character that was matched
+ * @type: when @arg is NULL, the type of the only argument to the specifier
+ * @fmt: the handler function to actually print the arguments to the specifier
+ * @arg: the handler function to tell %printf about the types of the arguments to the specifier
+ * @user: the user data for the specifier, accessible to the handler function
+ *
+ * This is returned by register_printf_function.
+ */
+typedef struct spec_entry
+{
+ unsigned int spec_key;
+ int unused; /* for binary compatibility */
+ int type;
+ printf_function *fmt;
+ printf_arginfo_function *arg;
+ snv_pointer user;
+}
+spec_entry;
+
+/**
+ * register_callback_function: printf.h
+ * @spec: the character which will trigger the functions, cast to an unsigned int.
+ * @fmt: the handler function to actually print the arguments to the specifier
+ * @arg: the handler function to tell %printf about the types of the arguments to the specifier
+ *
+ * Register the pair made of @fmt and @arg, so that it is called
+ * when @spec is encountered in a format string. If you create
+ * a shared library with an entry point named
+ * %snv_register_printf_funcs, and put the library in the
+ * search path given by the environment library %LTDL_LIBRARY_PATH,
+ * that entry point will be called when %libsnprintfv is initialized,
+ * passing a pointer to this kind of function (actually, a pointer
+ * to %register_printf_function) to it. This functionality is only
+ * present when the library is installed, not when it is built as
+ * a convenience library.
+ *
+ * Return value:
+ * Returns %NULL if @func was not successfully registered, a
+ * %spec_entry with the information on the function if it was.
+ **/
+typedef spec_entry *register_callback_function (unsigned spec, printf_function *func, printf_arginfo_function *arginfo);
+
+/* Codes to determine basic types.
+
+ These values cover all the standard format specifications.
+ Users can add new values after PA_LAST for their own types. */
+
+enum
+{
+ PA_INT, /* int */
+ PA_CHAR, /* int, cast to char */
+ PA_WCHAR, /* wide char */
+ PA_STRING, /* const char *, a '\0'-terminated string */
+ PA_WSTRING, /* const wchar_t *, wide character string */
+ PA_POINTER, /* void * */
+ PA_FLOAT, /* float */
+ PA_DOUBLE, /* double */
+ PA_LAST,
+ PA_UNKNOWN = -1
+};
+
+/* Flag bits that can be set in a type. */
+#define PA_TYPE_MASK 0x00ff
+#define PA_FLAG_MASK ~SNV_TYPE_MASK
+
+#define PA_FLAG_LONG_LONG (1 << 8)
+#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
+#define PA_FLAG_LONG (1 << 9)
+#define PA_FLAG_SHORT (1 << 10)
+#define PA_FLAG_UNSIGNED (1 << 11)
+#define PA_FLAG_CHAR (1 << 12)
+#define PA_FLAG_PTR (1 << 13)
+
+/**
+ * SNV_EMIT:
+ * @ch: the character to be printed
+ * @stream: the stream on which to print
+ * @count: a variable to be updated with the count of printed
+ * characters
+ *
+ * Maintain the count while putting @ch in @stream, also be careful about
+ * handling %NULL stream if the handler is being called purely to count
+ * output size.
+ **/
+#define SNV_EMIT(ch, stream, count) \
+ SNV_STMT_START { \
+ if ((stream)) \
+ { \
+ if ((count) >= 0) \
+ { \
+ int m_status = stream_put((unsigned char) (ch), (stream)); \
+ (count) = m_status < 0 ? m_status : (count) + m_status; \
+ } \
+ } \
+ else \
+ { \
+ (void)(ch); \
+ (count)++; \
+ } \
+ } SNV_STMT_END
+
+@protos format.c
+@protos custom.c
+@protos printf.c
+
+/* If you don't want to use snprintfv functions for *all* of your string
+ formatting API, then define COMPILING_SNPRINTFV_C and use the snv_
+ prefix for the entry points below. */
+#ifndef COMPILING_PRINTF_C
+#undef printf
+#undef vprintf
+#undef dprintf
+#undef vdprintf
+#undef fprintf
+#undef vfprintf
+#undef sprintf
+#undef vsprintf
+#undef snprintf
+#undef vsnprintf
+#undef asprintf
+#undef vasprintf
+#undef asprintfv
+#undef dprintfv
+#undef fprintfv
+#undef sprintfv
+#undef printfv
+#undef snprintfv
+
+#define printf snv_printf
+#define vprintf snv_vprintf
+#define dprintf snv_dprintf
+#define vdprintf snv_vdprintf
+#define fprintf snv_fprintf
+#define vfprintf snv_vfprintf
+#define sprintf snv_sprintf
+#define vsprintf snv_vsprintf
+#define snprintf snv_snprintf
+#define vsnprintf snv_vsnprintf
+#define asprintf snv_asprintf
+#define vasprintf snv_vasprintf
+#define asprintfv snv_asprintfv
+#define dprintfv snv_dprintfv
+#define fprintfv snv_fprintfv
+#define sprintfv snv_sprintfv
+#define printfv snv_printfv
+#define snprintfv snv_snprintfv
+#endif /* !COMPILING_SNPRINTFV_C */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SNPRINTFV_SNPRINTFV_H */
+
+/* snprintfv.h ends here */
diff --git a/snprintfv/printf.stamp b/snprintfv/printf.stamp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/snprintfv/printf.stamp
diff --git a/snprintfv/stream.c b/snprintfv/stream.c
new file mode 100644
index 0000000..a979f33
--- /dev/null
+++ b/snprintfv/stream.c
@@ -0,0 +1,226 @@
+/* -*- Mode: C -*- */
+
+/* stream.c --- customizable stream routines
+ * Copyright (C) 1998, 1999, 2000, 2002, 2003 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1998
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+/* Code: */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#ifdef WITH_DMALLOC
+# include <dmalloc.h>
+#endif
+
+#include "compat.h"
+#include "stream.h"
+#include "mem.h"
+
+struct stream
+{
+ snv_pointer stream;
+ unsigned long limit;
+
+ StreamGet get_func;
+ StreamPut put_func;
+};
+
+static int
+stream_not_readable (STREAM *stream)
+{
+ (void)stream;
+ return -1;
+}
+
+static int
+stream_not_writable (int ch, STREAM *stream)
+{
+ (void)stream;
+ (void)ch;
+ return -1;
+}
+
+/**
+ * stream_new: constructor
+ * @dets: user supplied stream details to be passed into the various funcs.
+ * @limit: the maximum number of consecutive bytes to fit in @dets.
+ * @get_func: function to get a character from @dets stream.
+ * @put_func: function to put a character in @dets stream.
+ *
+ * Allocate and initialize a new %STREAM data type. The @get_func
+ * and @put_func can be NULL if you intend to create a non-readable
+ * or non-writable stream, respectively.
+ *
+ * Return value:
+ * The address of the newly allocated and initialised stream is returned.
+ **/
+STREAM *
+stream_new (snv_pointer dets, unsigned long limit, StreamGet get_func, StreamPut put_func)
+{
+ STREAM *new = snv_new (STREAM, 1);
+
+ new->stream = dets;
+ new->limit = limit;
+
+ new->get_func = get_func ? get_func : stream_not_readable;
+ new->put_func = put_func ? put_func : stream_not_writable;
+
+ return new;
+}
+
+
+/**
+ * stream_delete: destructor
+ * @stream: The stream pending deletion
+ *
+ * The memory associated with @stream is recycled.
+
+ * Return value:
+ * The %dets supplied by the user when the stream was created are
+ * returned for handling by the calling function.
+ **/
+snv_pointer
+stream_delete (STREAM *stream)
+{
+ snv_pointer dets = stream->stream;
+ snv_delete (stream);
+ return dets;
+}
+
+/**
+ * stream_details:
+ * @stream: the stream being queried.
+ *
+ * The finalization function specified when @stream was created (if any)
+ * is called, and then the memory associated with @stream is recycled.
+ * It is the responsibility of the finalization function to recycle, or
+ * otherwise manage, any memory associated with the user supplied %dets.
+ * Return value:
+ * This function returns the stream details associated with @stream
+ * when it was originally created.
+ **/
+snv_pointer
+stream_details (STREAM *stream)
+{
+ return stream ? stream->stream : NULL;
+}
+
+/**
+ * stream_put:
+ * @ch: A single character to be placed in @stream.
+ * @stream: The stream to be written to.
+ *
+ * This function will @ch in @stream if that stream's output limit will
+ * not be exceeded.
+ *
+ * Return value:
+ * If @stream is full, return 1. Otherwise, if any other error occurs,
+ * that error code is returned unchanged. This is of course dependant
+ * on what the handler function uses to indicate an error. If the stream
+ * is not full and the stream's writing function succeeds, 1 (the number of
+ * characters emitted!) is returned.
+ **/
+int
+stream_put (int ch, STREAM *stream)
+{
+ int ch_or_errorcode;
+
+ if (!stream)
+ return -1;
+
+ if (stream->limit < 1)
+ return 1;
+
+ stream->limit -= 1;
+ ch_or_errorcode = (*stream->put_func) ((unsigned char) ch, stream);
+
+ return (ch_or_errorcode < 0) ? ch_or_errorcode : 1;
+}
+
+/**
+ * stream_puts:
+ * @s: A string to be placed in @stream.
+ * @stream: The stream to be written to.
+ *
+ * This function will @ch in @stream if that stream's output limit will
+ * not be exceeded.
+ *
+ * Return value:
+ * If any other error occurs, that error code is returned unchanged.
+ * This is of course dependant on what the handler function uses to
+ * indicate an error. If the stream becomes full, the remaining
+ * characters are not printed. If the stream's writing function
+ * always succeeds, the number of characters emitted or skipped is
+ * returned.
+ **/
+int
+stream_puts (char *s, STREAM *stream)
+{
+ int ch_or_errorcode;
+ int num;
+
+ if (!stream)
+ return -1;
+
+ for (num = 0; *s; num++, s++)
+ {
+ if (stream->limit < 1)
+ return num + strlen (s);
+
+ stream->limit -= 1;
+ ch_or_errorcode = (*stream->put_func) ((unsigned char) *s, stream);
+
+ if (ch_or_errorcode < 0)
+ return ch_or_errorcode;
+ }
+
+ return num;
+}
+
+/**
+ * stream_get:
+ * @stream: The stream to be read from.
+ *
+ * This function will try to read a single character from @stream.
+ *
+ * Return value:
+ * If an error occurs or the end of @stream is reached, -1 is returned.
+ * Under normal circumstances the value if the character read (cast to
+ * an int) is returned.
+ **/
+int
+stream_get (STREAM *stream)
+{
+ return (*stream->get_func) (stream);
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "gnu"
+ * indent-tabs-mode: nil
+ * End:
+ * end of snprintfv/stream.c */
diff --git a/snprintfv/stream.h b/snprintfv/stream.h
new file mode 100644
index 0000000..0f47855
--- /dev/null
+++ b/snprintfv/stream.h
@@ -0,0 +1,192 @@
+/* -*- Mode: C -*- */
+
+/* stream.h --- customizable stream routines
+ * Copyright (C) 1998, 1999, 2000, 2002 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1998
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+/* Code: */
+
+#ifndef STREAM_H
+#define STREAM_H 1
+
+#define STREAM_READABLE (1 << 0)
+#define STREAM_WRITABLE (1 << 1)
+
+/**
+ * SNV_UNLIMITED:
+ * Used to denote that there is no upper limit to the number of characters
+ * that can safely be written to a stream.
+ **/
+#define SNV_UNLIMITED (~0UL)
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0
+/* This brace is so that emacs can still indent properly: */ }
+#endif
+#endif /* __cplusplus */
+
+/**
+ * STREAM:
+ * Data type used to pass details of streams between functions,
+ * much like stdio's %FILE, but more flexible. A %STREAM can be uni- or
+ * bi-directional depending on how it is initialised.
+ **/
+typedef struct stream STREAM;
+
+/**
+ * StreamPut:
+ * @ch: The character to write to @stream cast to an int.
+ * @stream: The stream being written to.
+ *
+ * Type of the function to put a character in a writeable stream.
+ *
+ * Return value:
+ * The function should return the character written to the
+ * stream, cast to an int if it was written successfully, or
+ * else %EOF, if the write failed.
+ **/
+typedef int (*StreamPut) (int ch, STREAM * stream);
+
+/**
+ * StreamGet:
+ * @stream: The stream being read from.
+ *
+ * Type of the function to get a character from a readable stream.
+ *
+ * Return value:
+ * The function should return the character read from the
+ * stream, cast to an int if it was read successfully, or
+ * else %EOF, if the read failed.
+ **/
+typedef int (*StreamGet) (STREAM * stream);
+
+
+/**
+ * stream_new: constructor
+ * @dets: user supplied stream details to be passed into the various funcs.
+ * @limit: the maximum number of consecutive bytes to fit in @dets.
+ * @get_func: function to get a character from @dets stream.
+ * @put_func: function to put a character in @dets stream.
+ *
+ * Allocate and initialize a new %STREAM data type. The @get_func
+ * and @put_func can be NULL if you intend to create a non-readable
+ * or non-writable stream, respectively.
+ *
+ * Return value:
+ * The address of the newly allocated and initialised stream is returned.
+ **/
+extern STREAM *
+stream_new (snv_pointer dets, unsigned long limit, StreamGet get_func, StreamPut put_func);
+
+/**
+ * stream_delete: destructor
+ * @stream: The stream pending deletion
+ *
+ * The memory associated with @stream is recycled.
+
+ * Return value:
+ * The %dets supplied by the user when the stream was created are
+ * returned for handling by the calling function.
+ **/
+extern snv_pointer
+stream_delete (STREAM *stream);
+
+/**
+ * stream_details:
+ * @stream: the stream being queried.
+ *
+ * The finalization function specified when @stream was created (if any)
+ * is called, and then the memory associated with @stream is recycled.
+ * It is the responsibility of the finalization function to recycle, or
+ * otherwise manage, any memory associated with the user supplied %dets.
+ * Return value:
+ * This function returns the stream details associated with @stream
+ * when it was originally created.
+ **/
+extern snv_pointer
+stream_details (STREAM *stream);
+
+/**
+ * stream_put:
+ * @ch: A single character to be placed in @stream.
+ * @stream: The stream to be written to.
+ *
+ * This function will @ch in @stream if that stream's output limit will
+ * not be exceeded.
+ *
+ * Return value:
+ * If @stream is full, return 1. Otherwise, if any other error occurs,
+ * that error code is returned unchanged. This is of course dependant
+ * on what the handler function uses to indicate an error. If the stream
+ * is not full and the stream's writing function succeeds, 1 (the number of
+ * characters emitted!) is returned.
+ **/
+extern int
+stream_put (int ch, STREAM *stream);
+
+/**
+ * stream_puts:
+ * @s: A string to be placed in @stream.
+ * @stream: The stream to be written to.
+ *
+ * This function will @ch in @stream if that stream's output limit will
+ * not be exceeded.
+ *
+ * Return value:
+ * If any other error occurs, that error code is returned unchanged.
+ * This is of course dependant on what the handler function uses to
+ * indicate an error. If the stream becomes full, the remaining
+ * characters are not printed. If the stream's writing function
+ * always succeeds, the number of characters emitted or skipped is
+ * returned.
+ **/
+extern int
+stream_puts (char *s, STREAM *stream);
+
+/**
+ * stream_get:
+ * @stream: The stream to be read from.
+ *
+ * This function will try to read a single character from @stream.
+ *
+ * Return value:
+ * If an error occurs or the end of @stream is reached, -1 is returned.
+ * Under normal circumstances the value if the character read (cast to
+ * an int) is returned.
+ **/
+extern int
+stream_get (STREAM *stream);
+
+#line 88 "stream.in"
+#ifdef __cplusplus
+#if 0
+/* This brace is so that emacs can still indent properly: */
+{
+#endif
+}
+#endif /* __cplusplus */
+
+#endif /* STREAM_H */
diff --git a/snprintfv/stream.in b/snprintfv/stream.in
new file mode 100644
index 0000000..fbcf431
--- /dev/null
+++ b/snprintfv/stream.in
@@ -0,0 +1,96 @@
+/* -*- Mode: C -*- */
+
+/* stream.h --- customizable stream routines
+ * Copyright (C) 1998, 1999, 2000, 2002 Gary V. Vaughan
+ * Originally by Gary V. Vaughan, 1998
+ * This file is part of Snprintfv
+ *
+ * Snprintfv is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * Snprintfv program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * As a special exception to the GNU General Public License, if you
+ * distribute this file as part of a program that also links with and
+ * uses the libopts library from AutoGen, you may include it under
+ * the same distribution terms used by the libopts library.
+ */
+
+/* Code: */
+
+#ifndef STREAM_H
+#define STREAM_H 1
+
+#define STREAM_READABLE (1 << 0)
+#define STREAM_WRITABLE (1 << 1)
+
+/**
+ * SNV_UNLIMITED:
+ * Used to denote that there is no upper limit to the number of characters
+ * that can safely be written to a stream.
+ **/
+#define SNV_UNLIMITED (~0UL)
+
+#ifdef __cplusplus
+extern "C"
+{
+#if 0
+/* This brace is so that emacs can still indent properly: */ }
+#endif
+#endif /* __cplusplus */
+
+/**
+ * STREAM:
+ * Data type used to pass details of streams between functions,
+ * much like stdio's %FILE, but more flexible. A %STREAM can be uni- or
+ * bi-directional depending on how it is initialised.
+ **/
+typedef struct stream STREAM;
+
+/**
+ * StreamPut:
+ * @ch: The character to write to @stream cast to an int.
+ * @stream: The stream being written to.
+ *
+ * Type of the function to put a character in a writeable stream.
+ *
+ * Return value:
+ * The function should return the character written to the
+ * stream, cast to an int if it was written successfully, or
+ * else %EOF, if the write failed.
+ **/
+typedef int (*StreamPut) (int ch, STREAM * stream);
+
+/**
+ * StreamGet:
+ * @stream: The stream being read from.
+ *
+ * Type of the function to get a character from a readable stream.
+ *
+ * Return value:
+ * The function should return the character read from the
+ * stream, cast to an int if it was read successfully, or
+ * else %EOF, if the read failed.
+ **/
+typedef int (*StreamGet) (STREAM * stream);
+
+
+@protos stream.c
+#ifdef __cplusplus
+#if 0
+/* This brace is so that emacs can still indent properly: */
+{
+#endif
+}
+#endif /* __cplusplus */
+
+#endif /* STREAM_H */
diff --git a/snprintfv/stream.stamp b/snprintfv/stream.stamp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/snprintfv/stream.stamp
diff --git a/xml2ag/Makefile.am b/xml2ag/Makefile.am
new file mode 100644
index 0000000..718aeb2
--- /dev/null
+++ b/xml2ag/Makefile.am
@@ -0,0 +1,92 @@
+## -*- Mode: Makefile -*-
+## ---------------------------------------------------------------------
+## Makefile.am -- process this file with automake to produce Makefile.in
+##
+## Time-stamp: "2012-04-07 09:55:51 bkorb"
+## Last Modified: Thu Jul 29 13:42:18 1999
+## Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+TARG = xml2ag
+
+bin_PROGRAMS = xml2ag
+csrcs = xml2ag.c
+gsrcs = xmlopts.c fork.c
+BUILT_SOURCES = x.c
+nodist_xml2ag_SOURCES = $(BUILT_SOURCES)
+SUBDIRS = test
+EXTRA_DIST = xmlopts.def fork.tpl fork.c xml2ag.c
+xml2ag_LDADD = $(top_builddir)/autoopts/libopts.la $(LIBXML2_LIBS)
+man_MANS = $(TARG).1
+DOCFILES = invoke-$(TARG).texi invoke-$(TARG).menu $(TARG).1
+DISTCLEANFILES = $(DOCFILES) $(nodist_xml2ag_SOURCES) stamp-*
+INCLUDES = @INCLIST@ $(LIBXML2_CFLAGS)
+AGexe = $(top_builddir)/agen5/autogen
+CLexe = $(top_builddir)/columns/columns
+BOOTENV = top_srcdir="$(top_srcdir)" top_builddir="$(top_builddir)" \
+ PATH=`cd ../columns;pwd`:"$$PATH" CLexe="$(CLexe)"
+
+RUNAG = $(BOOTENV) $(AGexe) $(AGDEPS) \
+ -L$(top_srcdir)/autoopts/tpl -L$(top_builddir)/autoopts/tpl \
+ --definition=$(srcdir)/xmlopts.def
+
+CLEAN_RULES = \
+ clean-stamp-opts clean-stamp-texi clean-stamp-man clean-stamp-fork
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-opts.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-texi.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-man.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-fork.d@am__quote@
+@AMDEP_TRUE@clean-local : $(CLEAN_RULES)
+
+@AMDEP_TRUE@AGDEPS = -MF$(DEPDIR)/$@.d -MT$@ -MP
+@AMDEP_FALSE@AGDEPS =
+
+all : gen
+gen : $(gsrcs) $(DOCFILES)
+
+$(getdefs_OBJECTS) xmlopts.c xmlopts.h : stamp-opts
+stamp-opts : xmlopts.def $(CLexe)
+ $(RUNAG)
+
+fork.c : stamp-fork
+stamp-fork : fork.tpl xmlopts.def $(CLexe)
+ $(RUNAG) -L$(srcdir) -Tfork.tpl
+
+invoke-$(TARG).texi invoke-$(TARG).menu : stamp-texi
+stamp-texi : xmlopts.def $(TARG)$(EXEEXT) ../columns/columns$(EXEEXT)
+ $(RUNAG) -Tagtexi-cmd -DLEVEL=section
+
+$(TARG).1 : stamp-man
+stamp-man : xmlopts.def $(TARG)$(EXEEXT) ../columns/columns$(EXEEXT)
+ $(RUNAG) -Tagman-cmd
+
+$(CLexe) :
+ cd ../columns ; $(MAKE) $(CLnam)
+
+x.c : $(gsrcs) $(csrcs)
+ exec > $@ ; \
+ echo '#undef PKGDATADIR' ; \
+ echo '#define PKGDATADIR "$(pkgdatadir)"' ; \
+ echo ; echo '#define DEFINING 1' ; \
+ echo '#include "autoopts/project.h"' ; \
+ for f in $(gsrcs) $(csrcs) ; \
+ do echo "#include \"$$f\"" ; done
+
+.NOTPARALLEL:
+
+# Makefile.am ends here
diff --git a/xml2ag/Makefile.in b/xml2ag/Makefile.in
new file mode 100644
index 0000000..4aa8d08
--- /dev/null
+++ b/xml2ag/Makefile.in
@@ -0,0 +1,892 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+bin_PROGRAMS = xml2ag$(EXEEXT)
+subdir = xml2ag
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/config/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
+PROGRAMS = $(bin_PROGRAMS)
+am__objects_1 = x.$(OBJEXT)
+nodist_xml2ag_OBJECTS = $(am__objects_1)
+xml2ag_OBJECTS = $(nodist_xml2ag_OBJECTS)
+am__DEPENDENCIES_1 =
+xml2ag_DEPENDENCIES = $(top_builddir)/autoopts/libopts.la \
+ $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(nodist_xml2ag_SOURCES)
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+man1dir = $(mandir)/man1
+NROFF = nroff
+MANS = $(man_MANS)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = $(top_builddir)/agen5/autogen
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = $(top_builddir)/columns/columns
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+TARG = xml2ag
+csrcs = xml2ag.c
+gsrcs = xmlopts.c fork.c
+BUILT_SOURCES = x.c
+nodist_xml2ag_SOURCES = $(BUILT_SOURCES)
+SUBDIRS = test
+EXTRA_DIST = xmlopts.def fork.tpl fork.c xml2ag.c
+xml2ag_LDADD = $(top_builddir)/autoopts/libopts.la $(LIBXML2_LIBS)
+man_MANS = $(TARG).1
+DOCFILES = invoke-$(TARG).texi invoke-$(TARG).menu $(TARG).1
+DISTCLEANFILES = $(DOCFILES) $(nodist_xml2ag_SOURCES) stamp-*
+INCLUDES = @INCLIST@ $(LIBXML2_CFLAGS)
+BOOTENV = top_srcdir="$(top_srcdir)" top_builddir="$(top_builddir)" \
+ PATH=`cd ../columns;pwd`:"$$PATH" CLexe="$(CLexe)"
+
+RUNAG = $(BOOTENV) $(AGexe) $(AGDEPS) \
+ -L$(top_srcdir)/autoopts/tpl -L$(top_builddir)/autoopts/tpl \
+ --definition=$(srcdir)/xmlopts.def
+
+CLEAN_RULES = \
+ clean-stamp-opts clean-stamp-texi clean-stamp-man clean-stamp-fork
+
+@AMDEP_TRUE@AGDEPS = -MF$(DEPDIR)/$@.d -MT$@ -MP
+@AMDEP_FALSE@AGDEPS =
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu xml2ag/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu xml2ag/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+xml2ag$(EXEEXT): $(xml2ag_OBJECTS) $(xml2ag_DEPENDENCIES) $(EXTRA_xml2ag_DEPENDENCIES)
+ @rm -f xml2ag$(EXEEXT)
+ $(LINK) $(xml2ag_OBJECTS) $(xml2ag_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-man1: $(man_MANS)
+ @$(NORMAL_INSTALL)
+ @list1=''; \
+ list2='$(man_MANS)'; \
+ test -n "$(man1dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.1[a-z]*$$/p'; \
+ fi; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man1dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.1[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+cscopelist-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @list='$(MANS)'; if test -n "$$list"; then \
+ list=`for p in $$list; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+ if test -n "$$list" && \
+ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+ echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \
+ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
+ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+ echo " typically 'make maintainer-clean' will remove them" >&2; \
+ exit 1; \
+ else :; fi; \
+ else :; fi
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-recursive
+all-am: Makefile $(PROGRAMS) $(MANS)
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-recursive
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-man
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man: install-man1
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-man
+
+uninstall-man: uninstall-man1
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
+ cscopelist-recursive ctags-recursive install install-am \
+ install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool cscopelist cscopelist-recursive \
+ ctags ctags-recursive distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-man1 install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags tags-recursive uninstall uninstall-am \
+ uninstall-binPROGRAMS uninstall-man uninstall-man1
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-opts.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-texi.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-man.d@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-fork.d@am__quote@
+@AMDEP_TRUE@clean-local : $(CLEAN_RULES)
+
+all : gen
+gen : $(gsrcs) $(DOCFILES)
+
+$(getdefs_OBJECTS) xmlopts.c xmlopts.h : stamp-opts
+stamp-opts : xmlopts.def $(CLexe)
+ $(RUNAG)
+
+fork.c : stamp-fork
+stamp-fork : fork.tpl xmlopts.def $(CLexe)
+ $(RUNAG) -L$(srcdir) -Tfork.tpl
+
+invoke-$(TARG).texi invoke-$(TARG).menu : stamp-texi
+stamp-texi : xmlopts.def $(TARG)$(EXEEXT) ../columns/columns$(EXEEXT)
+ $(RUNAG) -Tagtexi-cmd -DLEVEL=section
+
+$(TARG).1 : stamp-man
+stamp-man : xmlopts.def $(TARG)$(EXEEXT) ../columns/columns$(EXEEXT)
+ $(RUNAG) -Tagman-cmd
+
+$(CLexe) :
+ cd ../columns ; $(MAKE) $(CLnam)
+
+x.c : $(gsrcs) $(csrcs)
+ exec > $@ ; \
+ echo '#undef PKGDATADIR' ; \
+ echo '#define PKGDATADIR "$(pkgdatadir)"' ; \
+ echo ; echo '#define DEFINING 1' ; \
+ echo '#include "autoopts/project.h"' ; \
+ for f in $(gsrcs) $(csrcs) ; \
+ do echo "#include \"$$f\"" ; done
+
+.NOTPARALLEL:
+
+# Makefile.am ends here
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xml2ag/fork.c b/xml2ag/fork.c
new file mode 100644
index 0000000..aec0d93
--- /dev/null
+++ b/xml2ag/fork.c
@@ -0,0 +1,303 @@
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * DO NOT EDIT THIS FILE (fork.c)
+ *
+ * It has been AutoGen-ed August 11, 2012 at 09:45:31 AM by AutoGen 5.16.2
+ * From the definitions ./xmlopts.def
+ * and the template file fork.tpl
+ *
+ * This module will fire up autogen and have it read definitions
+ * from its standard-in.
+ */
+
+static char const zFsError[] = "%s fs ERROR %d (%s) on %s\n";
+
+static void
+add_arg(char const * arg, int ix)
+{
+ char ** arg_vec = xml2agOptions.origArgVect;
+ int arg_ct = xml2agOptions.origArgCt;
+
+ if (ix >= (int)arg_ct) {
+ arg_ct += 5;
+ arg_vec = realloc(arg_vec, sizeof(void*) * (arg_ct+1));
+ if (arg_vec == NULL) {
+ fprintf(stderr, "No memory for %d args\n", arg_ct);
+ exit(EXIT_FAILURE);
+ }
+ xml2agOptions.origArgVect = arg_vec;
+ }
+ arg_vec[ ix ] = (void*)arg;
+}
+
+static int
+become_child(int * fd, char const* pzInput)
+{
+ if (pipe(fd) != 0) {
+ fprintf(stderr, zFsError, xml2agOptions.pzProgName,
+ errno, strerror( errno ), "pipe(2)");
+ exit(EXIT_FAILURE);
+ }
+
+ fflush(stdout);
+ fflush(stdin);
+
+ switch (fork()) {
+ case -1:
+ fprintf(stderr, zFsError, xml2agOptions.pzProgName,
+ errno, strerror( errno ), "fork(2)");
+ exit(EXIT_FAILURE);
+
+ case 0:
+ fclose(stdin);
+ if (dup2(fd[0], STDIN_FILENO) != STDIN_FILENO) {
+ fprintf(stderr, zFsError, xml2agOptions.pzProgName,
+ errno, strerror( errno ), "dup2(2) w/ STDIN_FILENO");
+ exit(EXIT_FAILURE);
+ }
+ close(fd[1]);
+ break;
+
+ default:
+ errno = 0;
+ outFp = fdopen(fd[1], "w");
+ if (outFp == NULL) {
+ fprintf(stderr, zFsError, xml2agOptions.pzProgName,
+ errno, strerror( errno ), "fdopen(2) w/ pipe[1]");
+ exit(EXIT_FAILURE);
+ }
+ close(fd[0]);
+ return 0;
+ }
+
+ if (! HAVE_OPT( BASE_NAME )) {
+ if (pzInput == NULL)
+ pzInput = "stdin";
+ else {
+ char* pz = strrchr(pzInput, '.');
+ if (pz != NULL) {
+ pzInput = pz = strdup(pzInput);
+ pz = strrchr(pz, '.');
+ *pz = '\0';
+ }
+ }
+ SET_OPT_BASE_NAME(pzInput);
+ }
+
+ return 1;
+}
+
+void
+forkAutogen(char const* pzInput)
+{
+ int fd[2];
+
+ if (! become_child(fd, pzInput))
+ return;
+
+ {
+ static char const zAg[] = "autogen";
+ char* pzArg;
+ int ix = 1;
+
+ {
+ char* pz = malloc(strlen( xml2agOptions.pzProgPath ) + 7);
+ char* p = strrchr(xml2agOptions.pzProgPath, '/');
+
+ if (p == NULL) {
+ strcpy(pz, zAg);
+ } else {
+ size_t len = (p - xml2agOptions.pzProgPath) + 1;
+ memcpy(pz, xml2agOptions.pzProgPath, len);
+ strcpy(pz + len, zAg);
+ }
+
+ add_arg(pz, 0);
+ }
+
+ if (HAVE_OPT(TEMPL_DIRS)) {
+ int optCt = STACKCT_OPT(TEMPL_DIRS);
+ char const ** ppOA = STACKLST_OPT(TEMPL_DIRS);
+ do {
+ char const * pA = *(ppOA++);
+ pzArg = malloc(14 + strlen(pA));
+ sprintf(pzArg, "--templ-dirs=%s", pA);
+ add_arg(pzArg, ix++);
+ } while (--optCt > 0);
+ }
+
+ if (HAVE_OPT(LIB_TEMPLATE)) {
+ int optCt = STACKCT_OPT(LIB_TEMPLATE);
+ char const ** ppOA = STACKLST_OPT(LIB_TEMPLATE);
+ do {
+ char const * pA = *(ppOA++);
+ pzArg = malloc(16 + strlen(pA));
+ sprintf(pzArg, "--lib-template=%s", pA);
+ add_arg(pzArg, ix++);
+ } while (--optCt > 0);
+ }
+
+ if (HAVE_OPT(DEFINITIONS)) {
+ pzArg = malloc(15 + strlen( OPT_ARG( DEFINITIONS )));
+ sprintf(pzArg, "--definitions=%s", OPT_ARG( DEFINITIONS ));
+ add_arg(pzArg, ix++);
+ }
+
+ if (HAVE_OPT(LOAD_SCHEME)) {
+ pzArg = malloc(15 + strlen( OPT_ARG( LOAD_SCHEME )));
+ sprintf(pzArg, "--load-scheme=%s", OPT_ARG( LOAD_SCHEME ));
+ add_arg(pzArg, ix++);
+ }
+
+ if (HAVE_OPT(LOAD_FUNCTIONS)) {
+ pzArg = malloc(18 + strlen( OPT_ARG( LOAD_FUNCTIONS )));
+ sprintf(pzArg, "--load-functions=%s", OPT_ARG( LOAD_FUNCTIONS ));
+ add_arg(pzArg, ix++);
+ }
+
+ if (HAVE_OPT(SHELL)) {
+ pzArg = malloc(9 + strlen( OPT_ARG( SHELL )));
+ sprintf(pzArg, "--shell=%s", OPT_ARG( SHELL ));
+ add_arg(pzArg, ix++);
+ }
+
+ if (HAVE_OPT(NO_FMEMOPEN)) {
+ add_arg("--no-fmemopen", ix++);
+ }
+
+ if (HAVE_OPT(EQUATE)) {
+ pzArg = malloc(10 + strlen( OPT_ARG( EQUATE )));
+ sprintf(pzArg, "--equate=%s", OPT_ARG( EQUATE ));
+ add_arg(pzArg, ix++);
+ }
+
+ if (HAVE_OPT(BASE_NAME)) {
+ pzArg = malloc(13 + strlen( OPT_ARG( BASE_NAME )));
+ sprintf(pzArg, "--base-name=%s", OPT_ARG( BASE_NAME ));
+ add_arg(pzArg, ix++);
+ }
+
+ if (HAVE_OPT(SOURCE_TIME)) {
+ add_arg("--source-time", ix++);
+ }
+
+ if (HAVE_OPT(WRITABLE)) {
+ add_arg("--writable", ix++);
+ }
+
+ if (HAVE_OPT(LOOP_LIMIT)) {
+ pzArg = malloc((size_t)26);
+ sprintf(pzArg, "--loop-limit=%d", (int)OPT_VALUE_LOOP_LIMIT);
+ add_arg(pzArg, ix++);
+ }
+
+ if (HAVE_OPT(TIMEOUT)) {
+ pzArg = malloc((size_t)23);
+ sprintf(pzArg, "--timeout=%d", (int)OPT_VALUE_TIMEOUT);
+ add_arg(pzArg, ix++);
+ }
+
+ if (HAVE_OPT(TRACE)) {
+ static char const * kwlist[] = {
+ "nothing", "debug-message", "server-shell",
+ "templates", "block-macros", "expressions",
+ "everything" };
+ pzArg = malloc(9 + strlen( kwlist[ OPT_VALUE_TRACE ] ));
+ sprintf(pzArg, "--trace=%s", kwlist[ OPT_VALUE_TRACE ]);
+ add_arg(pzArg, ix++);
+ }
+
+ if (HAVE_OPT(TRACE_OUT)) {
+ pzArg = malloc(13 + strlen( OPT_ARG( TRACE_OUT )));
+ sprintf(pzArg, "--trace-out=%s", OPT_ARG( TRACE_OUT ));
+ add_arg(pzArg, ix++);
+ }
+
+ if (HAVE_OPT(SHOW_DEFS)) {
+ add_arg("--show-defs", ix++);
+ }
+
+ if (HAVE_OPT(USED_DEFINES)) {
+ add_arg("--used-defines", ix++);
+ }
+
+ if (HAVE_OPT(CORE)) {
+ add_arg("--core", ix++);
+ }
+
+ if (HAVE_OPT(SKIP_SUFFIX)) {
+ int optCt = STACKCT_OPT(SKIP_SUFFIX);
+ char const ** ppOA = STACKLST_OPT(SKIP_SUFFIX);
+ do {
+ char const * pA = *(ppOA++);
+ pzArg = malloc(15 + strlen(pA));
+ sprintf(pzArg, "--skip-suffix=%s", pA);
+ add_arg(pzArg, ix++);
+ } while (--optCt > 0);
+ }
+
+ if (HAVE_OPT(SELECT_SUFFIX)) {
+ int optCt = STACKCT_OPT(SELECT_SUFFIX);
+ char const ** ppOA = STACKLST_OPT(SELECT_SUFFIX);
+ do {
+ char const * pA = *(ppOA++);
+ pzArg = malloc(17 + strlen(pA));
+ sprintf(pzArg, "--select-suffix=%s", pA);
+ add_arg(pzArg, ix++);
+ } while (--optCt > 0);
+ }
+
+ if (HAVE_OPT(DEFINE)) {
+ int optCt = STACKCT_OPT(DEFINE);
+ char const ** ppOA = STACKLST_OPT(DEFINE);
+ do {
+ char const * pA = *(ppOA++);
+ pzArg = malloc(10 + strlen(pA));
+ sprintf(pzArg, "--define=%s", pA);
+ add_arg(pzArg, ix++);
+ } while (--optCt > 0);
+ }
+
+ if (HAVE_OPT(UNDEFINE)) {
+ int optCt = STACKCT_OPT(UNDEFINE);
+ char const ** ppOA = STACKLST_OPT(UNDEFINE);
+ do {
+ char const * pA = *(ppOA++);
+ pzArg = malloc(12 + strlen(pA));
+ sprintf(pzArg, "--undefine=%s", pA);
+ add_arg(pzArg, ix++);
+ } while (--optCt > 0);
+ }
+
+ if (HAVE_OPT(MAKE_DEP)) {
+ int optCt = STACKCT_OPT(MAKE_DEP);
+ char const ** ppOA = STACKLST_OPT(MAKE_DEP);
+ do {
+ char const * pA = *(ppOA++);
+ pzArg = malloc(12 + strlen(pA));
+ sprintf(pzArg, "--make-dep=%s", pA);
+ add_arg(pzArg, ix++);
+ } while (--optCt > 0);
+ }
+
+ xml2agOptions.origArgVect[ix] = NULL;
+ execvp(xml2agOptions.origArgVect[0], xml2agOptions.origArgVect);
+
+ /*
+ * IF the first try fails, it may be because xml2ag and autogen have
+ * different paths. Try again with just plain "autogen" and let
+ * the OS search "PATH" for the program.
+ */
+ execvp(zAg, xml2agOptions.origArgVect);
+ fprintf(stderr, zFsError, xml2agOptions.pzProgName,
+ errno, strerror(errno), "execvp(2)");
+ exit(EXIT_FAILURE);
+ }
+}
+
+/*
+ * Local Variables:
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of fork.c */
diff --git a/xml2ag/fork.tpl b/xml2ag/fork.tpl
new file mode 100644
index 0000000..e882886
--- /dev/null
+++ b/xml2ag/fork.tpl
@@ -0,0 +1,223 @@
+[= AutoGen5 Template c=fork.c -*- Mode: C -*- =]
+[= # Time-stamp: "2012-04-07 09:56:01 bkorb"
+
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ =][=
+
+(define up-c-name (lambda (ag-name)
+ (string-upcase! (string->c-name! (get ag-name))) ))
+
+(dne " * " "/* ")=]
+ *
+ * This module will fire up autogen and have it read definitions
+ * from its standard-in.
+ */
+
+static char const zFsError[] = "%s fs ERROR %d (%s) on %s\n";
+
+static void
+add_arg(char const * arg, int ix)
+{
+ char ** arg_vec = xml2agOptions.origArgVect;
+ int arg_ct = xml2agOptions.origArgCt;
+
+ if (ix >= (int)arg_ct) {
+ arg_ct += 5;
+ arg_vec = realloc(arg_vec, sizeof(void*) * (arg_ct+1));
+ if (arg_vec == NULL) {
+ fprintf(stderr, "No memory for %d args\n", arg_ct);
+ exit(EXIT_FAILURE);
+ }
+ xml2agOptions.origArgVect = arg_vec;
+ }
+ arg_vec[ ix ] = (void*)arg;
+}
+
+static int
+become_child(int * fd, char const* pzInput)
+{
+ if (pipe(fd) != 0) {
+ fprintf(stderr, zFsError, xml2agOptions.pzProgName,
+ errno, strerror( errno ), "pipe(2)");
+ exit(EXIT_FAILURE);
+ }
+
+ fflush(stdout);
+ fflush(stdin);
+
+ switch (fork()) {
+ case -1:
+ fprintf(stderr, zFsError, xml2agOptions.pzProgName,
+ errno, strerror( errno ), "fork(2)");
+ exit(EXIT_FAILURE);
+
+ case 0:
+ fclose(stdin);
+ if (dup2(fd[0], STDIN_FILENO) != STDIN_FILENO) {
+ fprintf(stderr, zFsError, xml2agOptions.pzProgName,
+ errno, strerror( errno ), "dup2(2) w/ STDIN_FILENO");
+ exit(EXIT_FAILURE);
+ }
+ close(fd[1]);
+ break;
+
+ default:
+ errno = 0;
+ outFp = fdopen(fd[1], "w");
+ if (outFp == NULL) {
+ fprintf(stderr, zFsError, xml2agOptions.pzProgName,
+ errno, strerror( errno ), "fdopen(2) w/ pipe[1]");
+ exit(EXIT_FAILURE);
+ }
+ close(fd[0]);
+ return 0;
+ }
+
+ if (! HAVE_OPT( BASE_NAME )) {
+ if (pzInput == NULL)
+ pzInput = "stdin";
+ else {
+ char* pz = strrchr(pzInput, '.');
+ if (pz != NULL) {
+ pzInput = pz = strdup(pzInput);
+ pz = strrchr(pz, '.');
+ *pz = '\0';
+ }
+ }
+ SET_OPT_BASE_NAME(pzInput);
+ }
+
+ return 1;
+}
+
+void
+forkAutogen(char const* pzInput)
+{
+ int fd[2];
+
+ if (! become_child(fd, pzInput))
+ return;
+
+ {
+ static char const zAg[] = "autogen";
+ char* pzArg;
+ int ix = 1;
+
+ {
+ char* pz = malloc(strlen( xml2agOptions.pzProgPath ) + 7);
+ char* p = strrchr(xml2agOptions.pzProgPath, '/');
+
+ if (p == NULL) {
+ strcpy(pz, zAg);
+ } else {
+ size_t len = (p - xml2agOptions.pzProgPath) + 1;
+ memcpy(pz, xml2agOptions.pzProgPath, len);
+ strcpy(pz + len, zAg);
+ }
+
+ add_arg(pz, 0);
+ }[=
+
+ FOR flag =][=
+ IF (define opt-name (up-c-name "name"))
+
+ (and
+ (not (~~ opt-name "OVERRIDE_TPL|OUTPUT"))
+ (not (exist? "documentation"))
+ ) =][=
+
+ INVOKE handle-option =][=
+ ENDIF (not override) =][=
+ ENDFOR =]
+
+ xml2agOptions.origArgVect[ix] = NULL;
+ execvp(xml2agOptions.origArgVect[0], xml2agOptions.origArgVect);
+
+ /*
+ * IF the first try fails, it may be because xml2ag and autogen have
+ * different paths. Try again with just plain "autogen" and let
+ * the OS search "PATH" for the program.
+ */
+ execvp(zAg, xml2agOptions.origArgVect);
+ fprintf(stderr, zFsError, xml2agOptions.pzProgName,
+ errno, strerror(errno), "execvp(2)");
+ exit(EXIT_FAILURE);
+ }
+}
+
+/*
+ * Local Variables:
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of [= (out-name) =] */
+[=
+
+DEFINE handle-option =]
+
+ if (HAVE_OPT([=(. opt-name)=])) {[=
+
+ CASE arg-type =][=
+
+ ==* key =]
+ static char const * kwlist[] = {
+[=(shellf "${CLexe:-columns} -I16 -f'\"%%s\"' -S, --spread=2 <<_EOF_\n%s\n_EOF_"
+ (join "\n" (stack "keyword")) )=] };
+ pzArg = malloc([= (+ 4 (string-length (get "name")))
+ =] + strlen( kwlist[ OPT_VALUE_[=(. opt-name)=] ] ));
+ sprintf(pzArg, "--[=name=]=%s", kwlist[ OPT_VALUE_[=
+ (. opt-name)=] ]);
+ add_arg(pzArg, ix++);[=
+
+ ==* num =]
+ pzArg = malloc((size_t)[= (+ 16 (string-length (get "name"))) =]);
+ sprintf(pzArg, "--[=name=]=%d", (int)OPT_VALUE_[=(. opt-name)=]);
+ add_arg(pzArg, ix++);[=
+
+ ==* bool =]
+ static char z[] = "--[=name=]=false";
+ if (OPT_VALUE_[=(. opt-name)=])
+ strcpy(z + [= (+ 3 (string-length (get "name"))) =], "true");
+ add_arg(z, ix++);[=
+
+ ==* str =][=
+ IF (exist? "max") =]
+ int optCt = STACKCT_OPT([=(. opt-name)=]);
+ char const ** ppOA = STACKLST_OPT([=(. opt-name)=]);
+ do {
+ char const * pA = *(ppOA++);
+ pzArg = malloc([= (+ 4 (string-length (get "name")))
+ =] + strlen(pA));
+ sprintf(pzArg, "--[=name=]=%s", pA);
+ add_arg(pzArg, ix++);
+ } while (--optCt > 0);[=
+ ELSE !exists-max =]
+ pzArg = malloc([= (+ 4 (string-length (get "name")))
+ =] + strlen( OPT_ARG( [=(. opt-name)=] )));
+ sprintf(pzArg, "--[=name=]=%s", OPT_ARG( [=(. opt-name)=] ));
+ add_arg(pzArg, ix++);[=
+ ENDIF exists-max =][=
+
+ == "" =]
+ add_arg("--[=name=]", ix++);[=
+
+ ESAC arg-type =]
+ }[=
+
+ENDDEF handle-option
+
+\=]
diff --git a/xml2ag/test/Makefile.am b/xml2ag/test/Makefile.am
new file mode 100644
index 0000000..4674e48
--- /dev/null
+++ b/xml2ag/test/Makefile.am
@@ -0,0 +1,43 @@
+## -*- Mode: Makefile -*-
+##
+## Makefile.am -- process this file with automake to produce Makefile.in
+##
+## Author: Bruce Korb <bkorb@gnu.org>
+## Time-stamp: "2010-07-18 08:47:05 bkorb"
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+TESTS = convert.test
+EXTRA_DIST = $(TESTS)
+
+TESTS_ENVIRONMENT = \
+ X2Aexe=`\cd $(top_builddir)/xml2ag ; pwd`/xml2ag$(EXEEXT) \
+ srcdir=$(srcdir) top_srcdir=$(top_srcdir)
+
+distclean-local:
+ -rm -rf testdir FAILURES
+
+check : perm-stamp
+
+$(TESTS) : perm-stamp
+
+perm-stamp :
+ cd $(srcdir) ; chmod +x *.test
+
+# Makefile.am ends here
+
+ XML2AG=
diff --git a/xml2ag/test/Makefile.in b/xml2ag/test/Makefile.in
new file mode 100644
index 0000000..141866b
--- /dev/null
+++ b/xml2ag/test/Makefile.in
@@ -0,0 +1,551 @@
+# Makefile.in generated by automake 1.12.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = xml2ag/test
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \
+ $(top_srcdir)/config/extensions.m4 \
+ $(top_srcdir)/config/libopts.m4 \
+ $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 \
+ $(top_srcdir)/config/onceonly.m4 \
+ $(top_srcdir)/config/snprintfv.m4 \
+ $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = $(am__tty_colors_dummy)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AGEN5_TESTS = @AGEN5_TESTS@
+AG_GUILE = @AG_GUILE@
+AG_LDFLAGS = @AG_LDFLAGS@
+AG_MAJOR_VERSION = @AG_MAJOR_VERSION@
+AG_MINOR_VERSION = @AG_MINOR_VERSION@
+AG_TIMEOUT = @AG_TIMEOUT@
+AG_VERSION = @AG_VERSION@
+AG_XML2 = @AG_XML2@
+AGexe = @AGexe@
+AGnam = @AGnam@
+AMTAR = @AMTAR@
+AO_AGE = @AO_AGE@
+AO_CURRENT = @AO_CURRENT@
+AO_REVISION = @AO_REVISION@
+AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CLexe = @CLexe@
+CLnam = @CLnam@
+CONFIG_SHELL = @CONFIG_SHELL@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEBUG_ENABLED = @DEBUG_ENABLED@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DYNAMIC_AG = @DYNAMIC_AG@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC = @ENABLE_STATIC@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GDexe = @GDexe@
+GDnam = @GDnam@
+GO_AGE = @GO_AGE@
+GO_CURRENT = @GO_CURRENT@
+GO_REVISION = @GO_REVISION@
+GREP = @GREP@
+GUILE_VERSION = @GUILE_VERSION@
+INCLIST = @INCLIST@
+INCSNPRINTFV = @INCSNPRINTFV@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@
+LIBGUILE_LIBS = @LIBGUILE_LIBS@
+LIBGUILE_PATH = @LIBGUILE_PATH@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSNPRINTFV = @LIBSNPRINTFV@
+LIBTOOL = @LIBTOOL@
+LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
+LIBXML2_LIBS = @LIBXML2_LIBS@
+LIBXML2_PATH = @LIBXML2_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4_SRC = @M4_SRC@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPTS_TESTDIR = @OPTS_TESTDIR@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+POSIX_SHELL = @POSIX_SHELL@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEXI2HTML = @TEXI2HTML@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_aux_dir = @ac_aux_dir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+TESTS = convert.test
+EXTRA_DIST = $(TESTS)
+TESTS_ENVIRONMENT = \
+ X2Aexe=`\cd $(top_builddir)/xml2ag ; pwd`/xml2ag$(EXEEXT) \
+ srcdir=$(srcdir) top_srcdir=$(top_srcdir)
+
+
+# Makefile.am ends here
+XML2AG =
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu xml2ag/test/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu xml2ag/test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ fi; \
+ echo "$${col}$$dashes$${std}"; \
+ echo "$${col}$$banner$${std}"; \
+ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+ test -z "$$report" || echo "$${col}$$report$${std}"; \
+ echo "$${col}$$dashes$${std}"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-local
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: all all-am check check-TESTS check-am clean clean-generic \
+ clean-libtool distclean distclean-generic distclean-libtool \
+ distclean-local distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ uninstall uninstall-am
+
+
+distclean-local:
+ -rm -rf testdir FAILURES
+
+check : perm-stamp
+
+$(TESTS) : perm-stamp
+
+perm-stamp :
+ cd $(srcdir) ; chmod +x *.test
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/xml2ag/test/convert.test b/xml2ag/test/convert.test
new file mode 100755
index 0000000..4eadafc
--- /dev/null
+++ b/xml2ag/test/convert.test
@@ -0,0 +1,100 @@
+#! /bin/sh
+# -*- Mode: Shell-script -*-
+# ----------------------------------------------------------------------
+# convert.test --- test XML -> AutoGen conversion
+#
+## Time-stamp: "2010-07-16 15:29:12 bkorb"
+## Author: Bruce Korb <bkorb@gnu.org>
+##
+## This file is part of AutoGen.
+## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+##
+## AutoGen is free software: you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## AutoGen is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+## See the GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with this program. If not, see <http://www.gnu.org/licenses/>.
+
+case "X${VERBOSE}" in
+X | X[nNfF]* ) VERBOSE=false ;;
+* ) set -x ; VERBOSE=true ;;
+esac
+
+# A standard failure function
+failure()
+{
+ cd ${testsubdir}
+ test -d ../FAILURES || mkdir ../FAILURES
+ l=`echo *`
+ ( \cd ../FAILURES ; rm -f $l )
+ mv -f * ../FAILURES
+ echo "$*"
+ exit 1
+}
+
+srcdir=`pwd`
+testname=convert
+[ -d testdir ] || mkdir testdir
+cd testdir
+testsubdir=`pwd`
+
+${X2Aexe} -O ${testname}.out <<'_EndOfXML_'
+<?xml version="1.0"?>
+<ag_example template="sample.tpl">
+ <mumble attr="foo">
+ <grumble>
+ &lt;stumble around the 'XML'.&gt;
+ </grumble>
+ mumble-1
+ <!-- This is just a
+ /* multi-line comment */ -->
+ mumble-2
+ <grumble>
+ grumble &amp; "grumble" &amp; grumble.
+ </grumble>
+ mumble, mumble
+ </mumble>
+ <stumble upon="rough going"/>
+</ag_example>
+_EndOfXML_
+
+cat > ${testname}.samp <<'_EndOfSample_'
+/* Parsed from stdin */
+AutoGen Definitions sample.tpl;
+XML-version = '1.0';
+XML-standalone = true;
+template = 'sample.tpl';
+mumble = {
+ content = '';
+ attr = 'foo';
+ grumble = {
+ content = '';
+ text = '<stumble around the \'XML\'.>';
+ };
+ text = 'mumble-1';
+ /* This is just a
+ /* multi-line comment * / */
+ text = 'mumble-2';
+ grumble = {
+ content = '';
+ text = 'grumble & "grumble" & grumble.';
+ };
+ text = 'mumble, mumble';
+};
+stumble = {
+ content = '';
+ upon = 'rough going';
+};
+_EndOfSample_
+
+cmp -s ${testname}.samp ${testname}.out || \
+ failure "`diff ${testname}.samp ${testname}.out`"
+
+${VERBOSE} || { cd ${srcdir} ; rm -rf ${testsubdir} ; }
diff --git a/xml2ag/xml2ag.c b/xml2ag/xml2ag.c
new file mode 100644
index 0000000..331f869
--- /dev/null
+++ b/xml2ag/xml2ag.c
@@ -0,0 +1,478 @@
+
+/**
+ * \file xml2ag.c
+ *
+ * Time-stamp: "2010-08-04 20:49:34 bkorb"
+ *
+ * This is the main routine for xml2ag.
+ * xml2ag Copyright (c) 2002-2012 by Bruce Korb - all rights reserved
+ *
+ * This file is part of AutoGen.
+ * AutoGen copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+tSCC zConflict[] =
+ "the file name operand conflicts with the definitions option.\n";
+
+tSCC zTextFmt[] =
+ "text = '%s';\n";
+
+
+tSCC* typeName[] = {
+ "0 - inval",
+ "ELEMENT_NODE",
+ "ATTRIBUTE_NODE",
+ "TEXT_NODE",
+ "CDATA_SECTION_NODE",
+ "ENTITY_REF_NODE",
+ "ENTITY_NODE",
+ "PI_NODE",
+ "COMMENT_NODE",
+ "DOCUMENT_NODE",
+ "DOCUMENT_TYPE_NODE",
+ "DOCUMENT_FRAG_NODE",
+ "NOTATION_NODE",
+ "HTML_DOCUMENT_NODE",
+ "DTD_NODE",
+ "ELEMENT_DECL",
+ "ATTRIBUTE_DECL",
+ "ENTITY_DECL",
+ "NAMESPACE_DECL",
+ "XINCLUDE_START",
+ "XINCLUDE_END",
+ "DOCB_DOCUMENT_NODE" };
+
+int level = 0;
+FILE* outFp;
+
+#define CHUNK_SZ 4096
+
+/* = = = START-STATIC-FORWARD = = = */
+/* static forward declarations maintained by :mkfwd */
+static char*
+loadFile( FILE* fp, size_t* pzSize );
+
+static void
+emitIndentation( void );
+
+static char*
+trim( char const* pzSrc, size_t* pSz );
+
+static xmlNodePtr
+printHeader( xmlDocPtr pDoc );
+
+static void
+printAttrs( xmlAttrPtr pAttr );
+
+static void
+printNode( xmlNodePtr pNode );
+
+static void
+printChildren( xmlNodePtr pNode );
+/* = = = END-STATIC-FORWARD = = = */
+#define TRIM(s,psz) trim( (char const*)(s), (size_t*)(psz) )
+
+extern void forkAutogen( char const* pzInput );
+
+
+int
+main( int argc, char** argv )
+{
+ xmlDocPtr pDoc;
+ char const* pzFile = NULL;
+
+ {
+ int ct = optionProcess( &xml2agOptions, argc, argv );
+ argc -= ct;
+ argv += ct;
+
+ switch (argc) {
+ case 1:
+ if (strcmp( *argv, "-" ) != 0) {
+ if (HAVE_OPT( DEFINITIONS )) {
+ fprintf( stderr, zConflict );
+ USAGE( EXIT_FAILURE );
+ }
+ pzFile = *argv;
+ break;
+ }
+ case 0:
+ if ( HAVE_OPT( DEFINITIONS )
+ && (strcmp( OPT_ARG( DEFINITIONS ), "-" ) != 0) )
+
+ pzFile = OPT_ARG( DEFINITIONS );
+ break;
+
+ default:
+ fprintf( stderr, "only one argument allowed\n" );
+ return EXIT_FAILURE;
+ }
+ }
+
+ if (! HAVE_OPT( OUTPUT ))
+ forkAutogen( pzFile );
+ else
+ outFp = stdout;
+
+ if (pzFile != NULL) {
+ fprintf( outFp, "/* Parsing file %s */\n", pzFile );
+ pDoc = xmlParseFile( pzFile );
+ }
+ else {
+ size_t sz;
+ char* pz = loadFile( stdin, &sz );
+ pDoc = xmlParseMemory( pz, (int)sz );
+ fprintf( outFp, "/* Parsed from stdin */\n" );
+ }
+
+ {
+ static char const z_not_doc[] =
+ "/* type %d doc is not DOCUMENT or HTML_DOCUMENT */\n";
+
+ xmlNodePtr pRoot = printHeader( pDoc );
+ printAttrs( pRoot->properties );
+ switch (pDoc->type) {
+ case XML_DOCUMENT_NODE:
+ case XML_HTML_DOCUMENT_NODE:
+ printChildren( pRoot->children );
+ break;
+ default:
+ fprintf( outFp, z_not_doc, pDoc->type );
+ }
+ }
+
+ xmlCleanupParser();
+ return 0;
+}
+
+
+static char*
+loadFile( FILE* fp, size_t* pzSize )
+{
+ size_t asz = CHUNK_SZ;
+ size_t usz = 0;
+ char* mem = malloc( asz );
+
+ for (;;) {
+
+ if ((usz + CHUNK_SZ) > asz) {
+ asz += CHUNK_SZ;
+ mem = realloc( mem, asz );
+ }
+
+ if (mem == NULL) {
+ fprintf(stderr, "Cannot allocate %d byte bufer\n", (int)asz);
+ exit( EXIT_FAILURE );
+ }
+
+ {
+ size_t rdct = fread(mem + usz, (size_t)1, (size_t)CHUNK_SZ, fp);
+ usz += rdct;
+ if (rdct < CHUNK_SZ)
+ break;
+ }
+ }
+
+ *pzSize = usz;
+ return mem;
+}
+
+
+static void
+emitIndentation( void )
+{
+ int indent = level * 2;
+ while (--indent >= 0) fputc( ' ', outFp );
+}
+
+
+static char*
+trim( char const* pzSrc, size_t* pSz )
+{
+ static char zNil[1] = "";
+ static char* pzData = NULL;
+ static size_t dataLen = 0;
+ size_t strSize;
+
+ if (pzSrc == NULL) {
+ if (pSz != NULL) *pSz = 0;
+ return zNil;
+ }
+
+ /*
+ * Trim leading and trailing white space.
+ */
+ while (isspace( *pzSrc )) pzSrc++;
+
+ {
+ char const* pzEnd = pzSrc + strlen( pzSrc );
+ while ((pzEnd > pzSrc) && isspace( pzEnd[-1] )) pzEnd--;
+
+ if (pzEnd <= pzSrc) {
+ if (pSz != NULL) *pSz = 0;
+ return zNil;
+ }
+ strSize = (pzEnd - pzSrc);
+ }
+
+ /*
+ * Count the extra backslashes required and ensure our buffer is
+ * big enough to hold the newly formed string.
+ */
+ {
+ char const* pz = pzSrc;
+ for (;;) {
+ pz += strcspn( pz, "'\\" );
+ if (*(pz++) == NUL)
+ break;
+ strSize++;
+ }
+ }
+
+ if (dataLen <= strSize) {
+ size_t sz = (strSize + 0x1000) & ~0x0FFFUL;
+ if (pzData == NULL)
+ pzData = malloc( sz );
+ else pzData = realloc( pzData, sz );
+ if (pzData == NULL) {
+ fprintf( stderr, "ENOMEM allocating 0x%X bytes", (unsigned)sz );
+ exit( EXIT_FAILURE );
+ }
+ dataLen = sz;
+ }
+
+ /*
+ * Copy the data, adding backslashes in front of
+ * single quotes and backslashes.
+ */
+ {
+ char* pzDest = pzData;
+ for (;;) {
+ switch (*(pzDest++) = *(pzSrc++)) {
+ case '\'': pzDest[-1] = '\\'; *(pzDest++) = '\''; break;
+ case '\\': *(pzDest++) = '\\'; break;
+ case NUL: goto set_size;
+ }
+ if (pzDest == pzData + strSize)
+ break;
+ }
+
+ *pzDest = '\0';
+ }
+
+ set_size:
+ if (pSz != NULL) *pSz = strSize;
+ return pzData;
+}
+
+static xmlNodePtr
+printHeader( xmlDocPtr pDoc )
+{
+ tSCC zDef[] = "AutoGen Definitions %s%s;\n";
+ char const* pzSfx = ".tpl";
+
+ xmlNodePtr pRootNode = xmlDocGetRootElement( pDoc );
+ xmlChar* pTpl = NULL;
+ xmlChar* pzTpl;
+
+ if (pRootNode == NULL) {
+ fprintf( stderr, "Root node not found\n" );
+ exit( EXIT_FAILURE );
+ }
+
+ if (HAVE_OPT( OVERRIDE_TPL )) {
+ if (strchr( OPT_ARG( OVERRIDE_TPL ), '.' ) != NULL)
+ pzSfx = "";
+ pzTpl = (xmlChar*)(void*)OPT_ARG( OVERRIDE_TPL );
+ }
+ else {
+ pTpl = xmlGetProp( pRootNode, (xmlChar*)(void*)"template" );
+ if (pTpl == NULL) {
+ fprintf( stderr, "No template was specified.\n" );
+ exit( EXIT_FAILURE );
+ }
+
+ pzTpl = pTpl;
+ if (strchr( (char*)pzTpl, '.' ) != NULL)
+ pzSfx = "";
+ }
+
+ fprintf( outFp, zDef, pzTpl, pzSfx );
+ if (pTpl != NULL)
+ free( pTpl );
+
+ if (pDoc->name != NULL)
+ fprintf( outFp, "XML-name = '%s';\n", TRIM( pDoc->name, NULL ));
+
+ if (pDoc->version != NULL)
+ fprintf( outFp, "XML-version = '%s';\n", TRIM( pDoc->version, NULL ));
+
+ if (pDoc->encoding != NULL)
+ fprintf( outFp, "XML-encoding = '%s';\n", TRIM( pDoc->encoding, NULL ));
+
+ if (pDoc->URL != NULL)
+ fprintf( outFp, "XML-URL = '%s';\n", TRIM( pDoc->URL, NULL ));
+
+ if (pDoc->standalone)
+ fputs( "XML-standalone = true;\n", outFp );
+
+ return pRootNode;
+}
+
+static void
+printAttrs( xmlAttrPtr pAttr )
+{
+ while (pAttr != NULL) {
+ char* pzCont = (char*)pAttr->children->content;
+
+ emitIndentation();
+ fputs( (char*)(void*)pAttr->name, outFp );
+ fputs( " = ", outFp );
+ if (pAttr->children->children == NULL)
+ fprintf( outFp, "'%s';\n", TRIM( pzCont, NULL ));
+ else {
+ fputs( "{\n", outFp );
+ level++;
+ if (pzCont != NULL) {
+ emitIndentation();
+ fprintf( outFp, zTextFmt, TRIM( pzCont, NULL ));
+ }
+ printChildren( pAttr->children->children );
+ level--;
+ emitIndentation();
+ fputs( "};\n", outFp );
+ }
+
+ pAttr = pAttr->next;
+ }
+}
+
+
+static void
+printNode( xmlNodePtr pNode )
+{
+ switch (pNode->type) {
+ case XML_ELEMENT_NODE:
+ {
+ size_t sz;
+ char* pzTxt;
+ emitIndentation();
+ fputs( (char*)(void*)pNode->name, outFp );
+ pzTxt = TRIM( pNode->content, &sz );
+
+ if ( (pNode->properties == NULL)
+ && (pNode->children == NULL)) {
+
+ if (sz == 0)
+ fputs( ";\n", outFp );
+ else fprintf( outFp, " = '%s';\n", pzTxt );
+ break;
+ }
+
+ fputs( " = {\n", outFp );
+ level++;
+ emitIndentation();
+ fprintf( outFp, "content = '%s';\n", pzTxt );
+ printAttrs( pNode->properties );
+ printChildren( pNode->children );
+ level--;
+ emitIndentation();
+ fputs( "};\n", outFp );
+ break;
+ }
+
+ case XML_ATTRIBUTE_NODE:
+ fputs( "Misplaced attribute\n", outFp );
+ exit( EXIT_FAILURE );
+
+ case XML_TEXT_NODE:
+ {
+ size_t sz;
+ char* pzTxt = TRIM( pNode->content, &sz );
+ if (sz == 0)
+ break;
+ emitIndentation();
+ fprintf( outFp, zTextFmt, pzTxt );
+ break;
+ }
+
+ case XML_COMMENT_NODE:
+ {
+ size_t sz;
+ char* pzTxt = TRIM( pNode->content, &sz );
+ if (sz == 0)
+ break;
+
+ emitIndentation();
+ fputs( "/* ", outFp );
+ for (;;) {
+ char* pz = strstr( pzTxt, "*/" );
+ if (pz == NULL)
+ break;
+ fwrite(pzTxt, (size_t)((pz - pzTxt) + 1), (size_t)1, outFp);
+ pzTxt = pz+1;
+ fputc( ' ', outFp );
+ }
+ fprintf( outFp, "%s */\n", pzTxt );
+ break;
+ }
+
+ case XML_CDATA_SECTION_NODE:
+ case XML_ENTITY_REF_NODE:
+ case XML_ENTITY_NODE:
+ case XML_PI_NODE:
+
+ case XML_DOCUMENT_NODE:
+ case XML_HTML_DOCUMENT_NODE:
+ case XML_DOCUMENT_TYPE_NODE:
+ case XML_DOCUMENT_FRAG_NODE:
+ case XML_NOTATION_NODE:
+ case XML_DTD_NODE:
+ case XML_ELEMENT_DECL:
+ case XML_ATTRIBUTE_DECL:
+ case XML_ENTITY_DECL:
+ case XML_NAMESPACE_DECL:
+ case XML_XINCLUDE_START:
+ case XML_XINCLUDE_END:
+ emitIndentation();
+ fprintf( outFp, "/* Unsupported XML node type: %s */\n",
+ typeName[ pNode->type ]);
+ break;
+
+ default:
+ emitIndentation();
+ fprintf( outFp, "/* Unknown XML node type %d */\n", pNode->type );
+ break;
+ }
+}
+
+
+static void
+printChildren( xmlNodePtr pNode )
+{
+ while (pNode != NULL) {
+ printNode( pNode );
+ pNode = pNode->next;
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * end of xml2ag/xml2ag.c */
diff --git a/xml2ag/xmlopts.def b/xml2ag/xmlopts.def
new file mode 100644
index 0000000..242a874
--- /dev/null
+++ b/xml2ag/xmlopts.def
@@ -0,0 +1,180 @@
+/* -*- Mode: conf -*- */
+
+autogen definitions options;
+
+// Time-stamp: "2012-04-07 09:05:33 bkorb"
+
+/*
+ * This file is part of AutoGen.
+ * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
+ *
+ * AutoGen is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AutoGen is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+export = <<- EOExport
+ #include <sys/types.h>
+ #include <sys/stat.h>
+
+ #ifndef __USE_POSIX
+ # define __USE_POSIX /* for glib's pedantic needs */
+ #endif
+ #ifndef __USE_XOPEN_EXTENDED
+ # define __USE_XOPEN_EXTENDED /* ditto */
+ #endif
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <limits.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
+
+ #include <libxml/parser.h>
+ #include <libxml/tree.h>
+
+ extern FILE* outFp;
+ #ifndef NUL
+ # define NUL '\0'
+ #endif
+ extern void forkAutogen( char const* pzInput );
+ EOExport;
+
+flag = {
+ name = the-xml2ag-option;
+ documentation;
+ descrip = 'All other options are derived from autogen';
+};
+
+flag = {
+ name = output;
+ value = O;
+ arg-type = string;
+ arg-name = file;
+ descrip = "Output file in lieu of AutoGen processing";
+ doc =
+ "By default, the output is handed to an AutoGen for processing.\n"
+ "However, you may save the definitions to a file instead.";
+
+ flag_code = <<- FLAG_CODE_END
+ if (strcmp(pOptDesc->optArg.argString, "-") == 0)
+ return;
+
+ if (freopen(pOptDesc->optArg.argString, "w", stdout) == NULL) {
+ fprintf(stderr, "Error %d (%s) opening `%s' for output",
+ errno, strerror(errno), pOptDesc->optArg.argString);
+ exit(EXIT_FAILURE);
+ }
+ FLAG_CODE_END ;
+};
+
+flag = {
+ name = autogen-options;
+ documentation = <<- _EODoc_
+ These options are @i{mostly} just passed throug to @code{autogen}.
+ The one exception is @code{--override-tpl} which replaces the
+ default template in the output definitions. It does not get passed
+ through on the command line.
+ _EODoc_;
+
+ descrip = 'All other options';
+};
+
+#define XML2AG
+#option templ-dir $top_srcdir/agen5
+#option templ-dir $top_srcdir/autoopts
+#include opts.def
+
+explain = <<- END_EXPLAIN
+ This program will convert any arbitrary XML file into equivalent
+ AutoGen definitions, and invoke AutoGen.
+ END_EXPLAIN ;
+
+detail = <<- END_DETAIL
+ The template will be derived from either:
+ * the ``--override-tpl'' command line option
+ * a top level XML attribute named, "template"
+
+ The ``base-name'' for the output will similarly be either:
+ * the ``--base-name'' command line option
+ * the base name of the .xml file
+ END_DETAIL ;
+
+prog-man-descrip = <<- END_DETAIL
+ The template will be derived from either:
+ .br
+ * the \fB--override-tpl\fP command line option
+ .br
+ * a top level XML attribute named, "template"
+ .br
+ One or the other \fBmust\fP be provided, or the program will
+ exit with a failure message.
+ .sp 1
+ The ``base-name'' for the output will similarly be either:
+ .br
+ * the \fB--base-name\fP command line option
+ .br
+ * the base name of the .xml file
+ END_DETAIL ;
+
+prog-info-descrip = <<- END_DETAIL
+ The template used will be derived from either:
+ @itemize @bullet
+ @item
+ The @strong{--override-tpl} command line option
+ @item
+ A top level XML attribute named, "@code{template}"
+ @end itemize
+ @noindent
+ One or the other @strong{must} be provided, or the program will
+ exit with a failure message.
+
+ The @emph{base-name} for the output will similarly be either:
+ @itemize @bullet
+ @item
+ The @strong{--base-name} command line option.
+ @item
+ The base name of the @file{.xml} file.
+ @end itemize
+
+ The definitions derived from XML generally have an extra layer
+ of definition. Specifically, this XML input:
+ @example
+ <mumble attr="foo">
+ mumble-1
+ <grumble>
+ grumble, grumble, grumble.
+ </grumble>mumble, mumble
+ </mumble>
+ @end example
+ Will get converted into this:
+ @example
+ mumble = @{
+ grumble = @{
+ text = 'grumble, grumble, grumble';
+ @};
+ text = 'mumble-1';
+ text = 'mumble, mumble';
+ @};
+ @end example
+ Please notice that some information is lost. AutoGen cannot tell that
+ "grumble" used to lie between the mumble texts. Also please note that
+ you cannot assign:
+ @example
+ grumble = 'grumble, grumble, grumble.';
+ @end example
+ because if another "grumble" has an attribute or multiple texts,
+ it becomes impossible to have the definitions be the same type
+ (compound or text values).
+ END_DETAIL ;
+/* end of opts.def */