-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_config_files
executable file
·253 lines (212 loc) · 9.5 KB
/
update_config_files
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#!/bin/sh
#-----------------------------------------------------------------------
# The following function renders a commented configuration-variable
# definition to the standard output.
#
# Inputs:
# $1 The name of the variable.
# $2 The default value to give the variable if not defined in the
# original configuration file.
# $3 The multi-line comment that should precede the variable
# definition.
#-----------------------------------------------------------------------
output_variable() {
# Write the comment.
echo "$3"
echo ' '
# If a definition for the variable exists in the original file,
# use that definition in the output file. Otherwise adopt the default
# specified in $2.
if egrep -s -e "^ *$1" $input; then
egrep -e "^ *$1" $input
else
echo " $1=\"$2\""
fi
}
# Rewrite each of the existing system configuration files, one at a
# time.
for input in `find sys_* -name '*.conf' -print`; do
# Compose a new output file name so that the input file
# doesn't get clobbered until we have had a chance to check for
# unresolved differences.
output="${input}_new"
echo ''
echo ---------------
echo Creating $output
# Discard any old reconfiguration.
rm -f $output
# Write the new configuration file. Note that the open-parenthesis on the
# next line is matched by a close-parenthesis near the end of this script.
# This is used so that standard output of all the enclosed commands can
# be redirected in one go to the output file. Without the parenthesis
# we would have to append the output of each command individually. That
# would be much slower.
(
#-----------------------------------------------------------------------
# Preserve any system-specific comments that are found at the start of
# the original configuration file.
#-----------------------------------------------------------------------
awk '{if($0 ~ /^[ \t]*#/ || $0 ~ /^[ \t]*$/) {print $0} else {exit}}' $input
# Write the configuration variable descriptions and assignments.
#-----------------------------------------------------------------------
# XINCL
#-----------------------------------------------------------------------
output_variable XINCL "" '
# Optional: Needed by XWDRIV (/xwindow and /xserve) and
# X2DRIV (/xdisp and /figdisp).
# The arguments needed by the C compiler to locate X-window include files.'
#-----------------------------------------------------------------------
# MOTIF_INCL
#-----------------------------------------------------------------------
output_variable MOTIF_INCL "$XINCL" '
# Optional: Needed by XMDRIV (/xmotif).
# The arguments needed by the C compiler to locate Motif, Xt and
# X-window include files.'
#-----------------------------------------------------------------------
# TKDRIV
#-----------------------------------------------------------------------
output_variable TK_INCL "-I/usr/local/include $XINCL" '
# Optional: Needed by TKDRIV (/xtk).
# The arguments needed by the C compiler to locate Tcl, Tk and
# X-window include files.'
#-----------------------------------------------------------------------
# RV_INCL
#-----------------------------------------------------------------------
output_variable RV_INCL "" '
# Optional: Needed by RVDRIV (/xrv).
# The arguments needed by the C compiler to locate Rivet, Tcl, Tk and
# X-window include files.'
#-----------------------------------------------------------------------
# FCOMPL
#-----------------------------------------------------------------------
output_variable FCOMPL "" '
# Mandatory.
# The FORTRAN compiler to use.'
#-----------------------------------------------------------------------
# FFLAGC
#-----------------------------------------------------------------------
output_variable FFLAGC "" '
# Mandatory.
# The FORTRAN compiler flags to use when compiling the pgplot library.
# (NB. makemake prepends -c to $FFLAGC where needed)'
#-----------------------------------------------------------------------
# FFLAGD
#-----------------------------------------------------------------------
output_variable FFLAGD "" '
# Mandatory.
# The FORTRAN compiler flags to use when compiling fortran demo programs.
# This may need to include a flag to tell the compiler not to treat
# backslash characters as C-style escape sequences'
#-----------------------------------------------------------------------
# CCOMPL
#-----------------------------------------------------------------------
output_variable CCOMPL "" '
# Mandatory.
# The C compiler to use.'
#-----------------------------------------------------------------------
# CFLAGC
#-----------------------------------------------------------------------
output_variable CFLAGC "" '
# Mandatory.
# The C compiler flags to use when compiling the pgplot library.'
#-----------------------------------------------------------------------
# CFLAGD
#-----------------------------------------------------------------------
output_variable CFLAGD "" '
# Mandatory.
# The C compiler flags to use when compiling C demo programs.'
#-----------------------------------------------------------------------
# PGBIND_FLAGS
#-----------------------------------------------------------------------
output_variable PGBIND_FLAGS "" '
# Optional: Only needed if the cpgplot library is to be compiled.
# The flags to use when running pgbind to create the C pgplot wrapper
# library. (See pgplot/cpg/pgbind.usage)'
#-----------------------------------------------------------------------
# LIBS
#-----------------------------------------------------------------------
output_variable LIBS "" '
# Mandatory.
# The library-specification flags to use when linking normal pgplot
# demo programs.'
#-----------------------------------------------------------------------
# XMDRIV
#-----------------------------------------------------------------------
output_variable MOTIF_LIBS "-lXm -lXt $LIBS" '
# Optional: Needed by XMDRIV (/xmotif).
# The library-specification flags to use when linking motif
# demo programs.'
#-----------------------------------------------------------------------
# TKDRIV
#-----------------------------------------------------------------------
output_variable TK_LIBS "-L/usr/local/lib -ltk -ltcl $LIBS -ldl" '
# Optional: Needed by TKDRIV (/xtk).
# The library-specification flags to use when linking Tk demo programs.
# Note that you may need to append version numbers to -ltk and -ltcl.'
#-----------------------------------------------------------------------
# RANLIB
#-----------------------------------------------------------------------
output_variable RANLIB ":" '
# Mandatory.
# On systems that have a ranlib utility, put "ranlib" here. On other
# systems put ":" here (Colon is the Bourne-shell do-nothing command).'
#-----------------------------------------------------------------------
# SHARED_LIB
#-----------------------------------------------------------------------
output_variable SHARED_LIB "" '
# Optional: Needed on systems that support shared libraries.
# The name to give the shared pgplot library.'
#-----------------------------------------------------------------------
# SHARED_LD
#-----------------------------------------------------------------------
output_variable SHARED_LD "" '
# Optional: Needed if SHARED_LIB is set.
# How to create a shared library from a trailing list of object files.'
#-----------------------------------------------------------------------
# SHARED_LIB_LIBS
#-----------------------------------------------------------------------
output_variable SHARED_LIB_LIBS "" '
# Optional:
# On systems such as Solaris 2.x, that allow specification of the
# libraries that a shared library needs to be linked with when a
# program that uses it is run, this variable should contain the
# library-specification flags used to specify these libraries to
# $SHARED_LD'
#-----------------------------------------------------------------------
# MCOMPL
#-----------------------------------------------------------------------
output_variable MCOMPL "" '
# Optional:
# Compiler name used on Next systems to compile objective-C files.'
#-----------------------------------------------------------------------
# MFLAGC
#-----------------------------------------------------------------------
output_variable MFLAGC "" '
# Optional:
# Compiler flags used with MCOMPL when compiling objective-C files.'
#-----------------------------------------------------------------------
# SYSDIR
#-----------------------------------------------------------------------
output_variable SYSDIR '$SYSDIR' '
# Optional: (Actually mandatory, but already defined by makemake).
# Where to look for any system-specific versions of the files in
# pgplot/sys. Before evaluating this script, makemake sets SYSDIR to
# /wherever/pgplot/sys_$OS, where $OS is the operating-system name
# given by the second command-line argument of makemake. If the
# present configuration is one of many for this OS, and it needs
# different modifications to files in pgplot/sys than the other
# configurations, then you should create a subdirectory of SYSDIR,
# place the modified files in it and change the following line to
# $SYSDIR="$SYSDIR/subdirectory_name".'
#-----------------------------------------------------------------------
# Redirect the output of the above commands to the new configuration file.
) > $output
# Check for unexpected differences between the old and new
# configuration files.
if [ `diff $input $output | egrep '^<' | wc -l` -gt 0 ]; then
echo "*** The following lines of $input were not found at the"
echo "*** equivalent locations in $output"
diff $input $output | egrep '^<'
fi
echo ---------------
done