File: NOTES

package info (click to toggle)
dist 1%3A3.5-36-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,056 kB
  • ctags: 199
  • sloc: sh: 5,237; perl: 4,441; cpp: 208; makefile: 69; ansic: 4
file content (174 lines) | stat: -rw-r--r-- 6,558 bytes parent folder | download | duplicates (4)
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
This file shortly documents the built-in interpreter and other new
features from metaconfig.

The notion of "conditional unit" has been added.  In the ?MAKE:  line,
each unit whose name begins with a "+" will not be loaded in the
Configure script unless its exact value is a mandatory.  The default
value specified in ?DEF:  will be used instead.  If no ?DEF:  line is
found, then the symbol is initialized with a null default value.

In the config.h.SH file, only the necessary symbols are loaded.  Note
that the format in ?H:  line has changed.  It is no longer necessary to
write ?H:?%1:  to get a line included in config.h.  First of all, the %1
symbol is not defined any more.  Secondly, the unit's name is now %< and
it does not matter whether the name appears first in the ?MAKE:  line or
not.  Lastly, metaconfig can guess for itself whether to include a
symbol or not.

Sometimes, it is necessary to force a given value, because metaconfig is
not smart enough to guess 100% of the time.  See voidflags.U for an
example (look at the ?C: and ?H: lines and read the comments).

The Myread.U unit changed. It is now able to do variable substitutions,
and it sets the prompt correctly if there is no supplied default. Thus,
instead of the old:

	dflt=y
	rp="Question? [$dflt]"
	$echo $n "$rp $c"
	. myread

you must now write:

	dflt=y
	rp='Question?'
	. myread

and 'myread' will take care of echoing the question with the default
put in square brakets.

Likewise, question asking for filenames or pathnames may now use the Getfile.U
unit to take care of all the burden. The presetting is the same as for myread
and the answer is finally held in $ans. But the variable $fn must be set to
indicate the type of file and enable/disable some of the sanity checks. See
leading comments in Getfile.U. Here is a simple example to locate the active
file:

	dflt='~news/lib'
	fn='l~:active'
	rp='Where is the active file?'
	. getfile
	active="$ans"

The user may answer the question by using ~substitution and giving only the
directory where the active file is located (in which case getfile will try
to locate a file named 'active' in that directory). A full path may also be
given of course, if the basename of the file is not 'active'.

The units are now filtered by a built-in interpreter before getting
loaded in Configure.  That way, a Configure script can be more or less
tuned.  See d_gethname.U for a complex example.

All the interpreter commands start with a leading '@'.  Possible
commands include:

o if/elsif/else/end is the traditional conditional construct.
o define <symbol> tells metaconfig the <symbol> is to be defined.

Expressions in conditional constructs can include the &&, || and !
operator with same meaning as in the shell.  Backslash at the end of a
line stands for the continuation character.  All the symbols in the
expression stands for themselves, and their value is true if they are
defined/wanted and false otherwise.

It is possible to include shell and perl test.  All the text enclosed in
single brackets as {<text>} is expanded in a shell as

	if <text> >/dev/null 2>&1; then exit 0; else exit 1; fi

whereas text in double brackets as {{<text>}} is expanded in perl as

	if (<text> {exit 0;} else {exit 1;}

and the exit status is used in the standard way to get a boolean value
(i.e 0 is true and everything else is false).  See Oldconfig.U for an
example.

Metaconfig's interpreter has standard C operator priority, but you may
force the evaluation order with parenthesis.  A simple error recovery
attempt is made, so that you should get meaningful error messages.

The simple test ?sym:  means "keep the remaining of the line iff the
symbol is defined" and %sym:  is the same for non-definedness.

Some special symbols may be put in a unit and will get expanded,
provided the ?MAKE:  command line is 'wipe' and not 'add'.  Here are the
available symbols:

	<PACKAGENAME> is the name $package as found in .package
	<MAINTLOC> is the $maintloc variable as found in .pakcage
	<VERSION> is metaconfig's version number
	<PATCHLEVEL> is metaconfig's patchlevel
	<DATE> is the current frozen date as given by `date`

A 'wipe'ed unit is passed through the interpreter too.

It is also possible to declare a symbol obsolete. A warning message
will be issued if the symbol is used and the Glossary mentions it.
the "Obsolete" clause. The syntax is:

	?C:symbol (obsolete list):
	?S:symbol (obsolete list):

If metaconfig is used with the -o option, it will generate code to remap
those old symbols to the new ones, so the old code does not have to be changed
right away. If you do not use -o, the Obsolete file will still be generated
to warn you about obsolete symbols but no maping will be done.

The new ?W: line can be use to tie up the destiny of some symbols. The syntax
is:

	?W:shell symbols list:C symbol list

and the symbols in the shell list will be defined if one of the C symbols is.
For instance, unit d_const.U uses the following:

	?W:%<:const

so that any 'const' usage in the C code will have %< (the unit name) handled
as a wanted symbol. In particular, this has the interesting side effect of
loading the unit into Configure when the 'const' keyword is used.

This shell symbol list part may be left empty. For example unit i_time.U uses:

	?W::timezone

for its side effect: the symbol 'timezone' may now be part of the interpreter
tests to conditionally load some code into Configure when struct timezone is
used.

C symbol aliasing can be used to let metaconfig know that the symbol comment
is to be loaded in config_h.SH even when the main symbol is not used in C.
For instance, d_const.U writes:

	?C:HASCONST ~ %<:

so that the HASCONST hype is loaded iff the unit (%<) is wanted. This is why
the ?H: lines are also explicitly tied to the wanted-ness of the d_const
symbol, by writing:

	?H:?%<:#$d_const HASCONST	/**/
	?H:?%<:#ifndef HASCONST
	?H:?%<:#define const
	?H:?%<:#endif
	?H:.

because we want all those lines to appear in config_h.SH as soon as the d_const
unit is loaded into Configure.

Because of the new -s (silent) option of Configure, the important messages which
are to appear even in silent mode must be written on file descriptor #4. Others
will simply not be echoed under -s. Note that all the questions and default
answers are written on #4. You should write:

	echo " "
	echo "Checking to see if......" >&4
	.....
	echo "Yes, it does"

which will have the traditional behaviour unless -s is used, in which case only
the line

	Checking to see if.....

will echo on the terminal.