summaryrefslogtreecommitdiff
path: root/autoopts/test/vendor.test
blob: a9d0ac83e373beb740c6d8e937f8fcbcdac5973b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
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