1 | #! /bin/sh |
---|
2 | # Install modified versions of certain ANSI-incompatible system header files |
---|
3 | # which are fixed to work correctly with ANSI C |
---|
4 | # and placed in a directory that GNU C will search. |
---|
5 | |
---|
6 | # See README-fixinc for more information. |
---|
7 | |
---|
8 | # Directory containing the original header files. |
---|
9 | # (This was named INCLUDES, but that conflicts with a name in Makefile.in.) |
---|
10 | INPUT=${2-${INPUT-/usr/include}} |
---|
11 | |
---|
12 | # Directory in which to store the results. |
---|
13 | LIB=${1?"fixincludes: output directory not specified"} |
---|
14 | |
---|
15 | # Define what target system we're fixing. |
---|
16 | if test -r ./Makefile; then |
---|
17 | target_canonical="`sed -n -e 's,^target[ ]*=[ ]*\(.*\)$,\1,p' < Makefile`" |
---|
18 | test -z "${target_canonical}" && target_canonical=unknown |
---|
19 | else |
---|
20 | target_canonical=unknown |
---|
21 | fi |
---|
22 | |
---|
23 | # Define PWDCMD as a command to use to get the working dir |
---|
24 | # in the form that we want. |
---|
25 | PWDCMD=pwd |
---|
26 | case "`pwd`" in |
---|
27 | //*) |
---|
28 | # On an Apollo, discard everything before `/usr'. |
---|
29 | PWDCMD="eval pwd | sed -e 's,.*/usr/,/usr/,'" |
---|
30 | ;; |
---|
31 | esac |
---|
32 | |
---|
33 | # Original directory. |
---|
34 | ORIGDIR=`${PWDCMD}` |
---|
35 | |
---|
36 | # Make sure it exists. |
---|
37 | if [ ! -d $LIB ]; then |
---|
38 | mkdir $LIB || exit 1 |
---|
39 | fi |
---|
40 | |
---|
41 | # Make LIB absolute only if needed to avoid problems with the amd. |
---|
42 | case $LIB in |
---|
43 | /*) |
---|
44 | ;; |
---|
45 | *) |
---|
46 | cd $LIB; LIB=`${PWDCMD}` |
---|
47 | ;; |
---|
48 | esac |
---|
49 | |
---|
50 | # Fail if no arg to specify a directory for the output. |
---|
51 | if [ x$1 = x ] |
---|
52 | then echo fixincludes: no output directory specified |
---|
53 | exit 1 |
---|
54 | fi |
---|
55 | |
---|
56 | echo Building fixed headers in ${LIB} |
---|
57 | |
---|
58 | # Determine whether this system has symbolic links. |
---|
59 | if ln -s X $LIB/ShouldNotExist 2>/dev/null; then |
---|
60 | rm -f $LIB/ShouldNotExist |
---|
61 | LINKS=true |
---|
62 | elif ln -s X /tmp/ShouldNotExist 2>/dev/null; then |
---|
63 | rm -f /tmp/ShouldNotExist |
---|
64 | LINKS=true |
---|
65 | else |
---|
66 | LINKS=false |
---|
67 | fi |
---|
68 | |
---|
69 | echo Finding directories and links to directories |
---|
70 | cd ${INPUT} |
---|
71 | # Find all directories and all symlinks that point to directories. |
---|
72 | # Put the list in $files. |
---|
73 | # Each time we find a symlink, add it to newdirs |
---|
74 | # so that we do another find within the dir the link points to. |
---|
75 | # Note that $files may have duplicates in it; |
---|
76 | # later parts of this file are supposed to ignore them. |
---|
77 | dirs="." |
---|
78 | levels=2 |
---|
79 | while [ -n "$dirs" ] && [ $levels -gt 0 ] |
---|
80 | do |
---|
81 | levels=`expr $levels - 1` |
---|
82 | newdirs= |
---|
83 | for d in $dirs |
---|
84 | do |
---|
85 | echo " Searching $INPUT/$d" |
---|
86 | |
---|
87 | # Find all directories under $d, relative to $d, excluding $d itself. |
---|
88 | # (The /. is needed after $d in case $d is a symlink.) |
---|
89 | files="$files `find $d/. -type d -print | \ |
---|
90 | sed -e '/\/\.$/d' -e 's@/./@/@g'`" |
---|
91 | # Find all links to directories. |
---|
92 | # Using `-exec test -d' in find fails on some systems, |
---|
93 | # and trying to run test via sh fails on others, |
---|
94 | # so this is the simplest alternative left. |
---|
95 | # First find all the links, then test each one. |
---|
96 | theselinks= |
---|
97 | $LINKS && \ |
---|
98 | theselinks=`find $d/. -type l -print | sed -e 's@/./@/@g'` |
---|
99 | for d1 in $theselinks --dummy-- |
---|
100 | do |
---|
101 | # If the link points to a directory, |
---|
102 | # add that dir to $newdirs |
---|
103 | if [ -d $d1 ] |
---|
104 | then |
---|
105 | files="$files $d1" |
---|
106 | if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ] |
---|
107 | then |
---|
108 | newdirs="$newdirs $d1" |
---|
109 | fi |
---|
110 | fi |
---|
111 | done |
---|
112 | done |
---|
113 | |
---|
114 | dirs="$newdirs" |
---|
115 | done |
---|
116 | |
---|
117 | dirs= |
---|
118 | echo "All directories (including links to directories):" |
---|
119 | echo $files |
---|
120 | |
---|
121 | for file in $files; do |
---|
122 | rm -rf $LIB/$file |
---|
123 | if [ ! -d $LIB/$file ] |
---|
124 | then mkdir $LIB/$file |
---|
125 | fi |
---|
126 | done |
---|
127 | mkdir $LIB/root |
---|
128 | |
---|
129 | # treetops gets an alternating list |
---|
130 | # of old directories to copy |
---|
131 | # and the new directories to copy to. |
---|
132 | treetops="${INPUT} ${LIB}" |
---|
133 | |
---|
134 | if $LINKS; then |
---|
135 | echo 'Making symbolic directory links' |
---|
136 | for file in $files; do |
---|
137 | dest=`ls -ld $file | sed -n 's/.*-> //p'` |
---|
138 | if [ "$dest" ]; then |
---|
139 | cwd=`${PWDCMD}` |
---|
140 | # In case $dest is relative, get to $file's dir first. |
---|
141 | cd ${INPUT} |
---|
142 | cd `echo ./$file | sed -n 's&[^/]*$&&p'` |
---|
143 | # Check that the target directory exists. |
---|
144 | # Redirections changed to avoid bug in sh on Ultrix. |
---|
145 | (cd $dest) > /dev/null 2>&1 |
---|
146 | if [ $? = 0 ]; then |
---|
147 | cd $dest |
---|
148 | # X gets the dir that the link actually leads to. |
---|
149 | x=`${PWDCMD}` |
---|
150 | # Canonicalize ${INPUT} now to minimize the time an |
---|
151 | # automounter has to change the result of ${PWDCMD}. |
---|
152 | cinput=`cd ${INPUT}; ${PWDCMD}` |
---|
153 | # If a link points to ., make a similar link to . |
---|
154 | if [ $x = ${cinput} ]; then |
---|
155 | echo $file '->' . ': Making link' |
---|
156 | rm -fr ${LIB}/$file > /dev/null 2>&1 |
---|
157 | ln -s . ${LIB}/$file > /dev/null 2>&1 |
---|
158 | # If link leads back into ${INPUT}, |
---|
159 | # make a similar link here. |
---|
160 | elif expr $x : "${cinput}/.*" > /dev/null; then |
---|
161 | # Y gets the actual target dir name, relative to ${INPUT}. |
---|
162 | y=`echo $x | sed -n "s&${cinput}/&&p"` |
---|
163 | # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}. |
---|
164 | dots=`echo "$file" | |
---|
165 | sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'` |
---|
166 | echo $file '->' $dots$y ': Making link' |
---|
167 | rm -fr ${LIB}/$file > /dev/null 2>&1 |
---|
168 | ln -s $dots$y ${LIB}/$file > /dev/null 2>&1 |
---|
169 | else |
---|
170 | # If the link is to a dir $target outside ${INPUT}, |
---|
171 | # repoint the link at ${INPUT}/root$target |
---|
172 | # and process $target into ${INPUT}/root$target |
---|
173 | # treat this directory as if it actually contained the files. |
---|
174 | echo $file '->' root$x ': Making link' |
---|
175 | if [ -d $LIB/root$x ] |
---|
176 | then true |
---|
177 | else |
---|
178 | dirname=root$x/ |
---|
179 | dirmade=. |
---|
180 | cd $LIB |
---|
181 | while [ x$dirname != x ]; do |
---|
182 | component=`echo $dirname | sed -e 's|/.*$||'` |
---|
183 | mkdir $component >/dev/null 2>&1 |
---|
184 | cd $component |
---|
185 | dirmade=$dirmade/$component |
---|
186 | dirname=`echo $dirname | sed -e 's|[^/]*/||'` |
---|
187 | done |
---|
188 | fi |
---|
189 | # Duplicate directory structure created in ${LIB}/$file in new |
---|
190 | # root area. |
---|
191 | for file2 in $files; do |
---|
192 | case $file2 in |
---|
193 | $file/*) |
---|
194 | dupdir=${LIB}/root$x/`echo $file2 | sed -n "s|^${file}/||p"` |
---|
195 | echo "Duplicating ${file}'s ${dupdir}" |
---|
196 | if [ -d ${dupdir} ] |
---|
197 | then true |
---|
198 | else |
---|
199 | mkdir ${dupdir} |
---|
200 | fi |
---|
201 | ;; |
---|
202 | *) |
---|
203 | ;; |
---|
204 | esac |
---|
205 | done |
---|
206 | # Get the path from ${LIB} to $file, accounting for symlinks. |
---|
207 | parent=`echo "$file" | sed -e 's@/[^/]*$@@'` |
---|
208 | libabs=`cd ${LIB}; ${PWDCMD}` |
---|
209 | file2=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"` |
---|
210 | # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}. |
---|
211 | dots=`echo "$file2" | sed -e 's@/[^/]*@../@g'` |
---|
212 | rm -fr ${LIB}/$file > /dev/null 2>&1 |
---|
213 | ln -s ${dots}root$x ${LIB}/$file > /dev/null 2>&1 |
---|
214 | treetops="$treetops $x ${LIB}/root$x" |
---|
215 | fi |
---|
216 | fi |
---|
217 | cd $cwd |
---|
218 | fi |
---|
219 | done |
---|
220 | fi |
---|
221 | |
---|
222 | required= |
---|
223 | set x $treetops |
---|
224 | shift |
---|
225 | while [ $# != 0 ]; do |
---|
226 | # $1 is an old directory to copy, and $2 is the new directory to copy to. |
---|
227 | cd ${INPUT} |
---|
228 | cd $1 |
---|
229 | # The same dir can appear more than once in treetops. |
---|
230 | # There's no need to scan it more than once. |
---|
231 | if [ -f $2/DONE ] |
---|
232 | then |
---|
233 | files= |
---|
234 | else |
---|
235 | touch $2/DONE |
---|
236 | echo Fixing directory $1 into $2 |
---|
237 | # Check .h files which are symlinks as well as those which are files. |
---|
238 | # A link to a header file will not be processed by anything but this. |
---|
239 | if $LINKS; then |
---|
240 | files=`find . -name '*.h' \( -type f -o -type l \) -print` |
---|
241 | else |
---|
242 | files=`find . -name '*.h' -type f -print` |
---|
243 | fi |
---|
244 | echo Checking header files |
---|
245 | fi |
---|
246 | # Note that BSD43_* are used on recent MIPS systems. |
---|
247 | for file in $files; do |
---|
248 | # This call to egrep is essential, since checking a file with egrep |
---|
249 | # is much faster than actually trying to fix it. |
---|
250 | # It is also essential that most files *not* match! |
---|
251 | # Thus, matching every #endif is unacceptable. |
---|
252 | # But the argument to egrep must be kept small, or many versions of egrep |
---|
253 | # won't be able to handle it. |
---|
254 | # |
---|
255 | # We use the pattern [!-.0-z{|}~] instead of [^/ ] to match a noncomment |
---|
256 | # following #else or #endif because some buggy egreps think [^/] matches |
---|
257 | # newline, and they thus think `#else ' matches `#e[ndiflse]*[ ]+[^/ ]'. |
---|
258 | # [!-.0-~] does not work properly on AIX 4.1. |
---|
259 | # |
---|
260 | # We use the pattern [^a-zA-Z0-9_][_a-ce-km-z][a-z0-9] to match an identifier |
---|
261 | # following #if or #elif that is not surrounded by __. The `a-ce-km-z' |
---|
262 | # in this pattern lacks `d' and `l'; this means we don't worry about |
---|
263 | # identifiers starting with `d' or `l'. This is OK, since none of the |
---|
264 | # identifiers below start with `d' or `l'. It also greatly improves |
---|
265 | # performance, since many files contain lines of the form `#if ... defined ...' |
---|
266 | # or `#if lint'. |
---|
267 | if egrep '//|[ _]_IO|CTRL|^#define.NULL|^#e[nl][ds][ief]*[ ]+[!-.0-z\{\|\}\~]|^#[el]*if.*[^a-zA-Z0-9_][_a-ce-km-zA-Z][a-zA-Z0-9]' $file >/dev/null; then |
---|
268 | if [ -r $file ]; then |
---|
269 | cp $file $2/$file >/dev/null 2>&1 \ |
---|
270 | || echo "Can't copy $file" |
---|
271 | chmod +w $2/$file |
---|
272 | chmod a+r $2/$file |
---|
273 | # The fixinc_eol stuff is to work around a bug in the sed |
---|
274 | # program on HP/UX 10.20. |
---|
275 | # Here is how the sed commands in braces work. |
---|
276 | # (It doesn't work to put the comments inside the sed commands.) |
---|
277 | # Surround each word with spaces, to simplify matching below. |
---|
278 | # ANSIfy each pre-ANSI machine-dependent symbol |
---|
279 | # by surrounding it with __ __. |
---|
280 | # Remove the spaces that we inserted around each word. |
---|
281 | sed -e ' |
---|
282 | :loop |
---|
283 | /\\$/ N |
---|
284 | s/\\$/\\*fixinc_eol*/ |
---|
285 | /\\$/ b loop |
---|
286 | s/\\\*fixinc_eol\*/\\/g |
---|
287 | s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1% |
---|
288 | s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1% |
---|
289 | s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1% |
---|
290 | s%^\([ ]*#[ ]*endif\)[ ]*\*[^/].*%\1% |
---|
291 | s%^\([ ]*#[ ]*endif\)[ ]*[^/* ].*%\1% |
---|
292 | /\/\/[^*]/ s|//\(.*\)$|/*\1*/| |
---|
293 | /[ ]_IO[A-Z]*[ ]*(/ s/\(_IO[A-Z]*[ ]*(\)\(.\),/\1'\''\2'\'',/ |
---|
294 | /[ ]BSD43__IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/ |
---|
295 | /#[ ]*define[ ]*[ ]_IO/ s/'\''\([cgxtf]\)'\''/\1/g |
---|
296 | /#[ ]*define[ ]*[ ]BSD43__IO/ s/'\''\([cgx]\)'\''/\1/g |
---|
297 | /#[ ]*define[ ]*[ ]DESIOC/ s/'\''\([cdgx]\)'\''/\1/g |
---|
298 | /[^A-Z0-9_]CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/ |
---|
299 | /[^A-Z0-9]_CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/ |
---|
300 | /#[ ]*define[ ]*[ ]CTRL/ s/'\''\([cgx]\)'\''/\1/g |
---|
301 | /#[ ]*define[ ]*[ ]_CTRL/ s/'\''\([cgx]\)'\''/\1/g |
---|
302 | /#[ ]*define.BSD43_CTRL/ s/'\''\([cgx]\)'\''/\1/g |
---|
303 | /#[ ]*[el]*if/{ |
---|
304 | s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g |
---|
305 | |
---|
306 | s/ bsd4\([0-9]\) / __bsd4\1__ /g |
---|
307 | s/ _*host_mips / __host_mips__ /g |
---|
308 | s/ _*i386 / __i386__ /g |
---|
309 | s/ M32 / __M32__ /g |
---|
310 | s/ is68k / __is68k__ /g |
---|
311 | s/ m68k / __m68k__ /g |
---|
312 | s/ mc680\([0-9]\)0 / __mc680\10__ /g |
---|
313 | s/ m88k / __m88k__ /g |
---|
314 | s/ _*mips / __mips__ /g |
---|
315 | s/ news\([0-9]*\) / __news\1__ /g |
---|
316 | s/ ns32000 / __ns32000__ /g |
---|
317 | s/ pdp11 / __pdp11__ /g |
---|
318 | s/ pyr / __pyr__ /g |
---|
319 | s/ sel / __sel__ /g |
---|
320 | s/ sony_news / __sony_news__ /g |
---|
321 | s/ sparc / __sparc__ /g |
---|
322 | s/ sun\([a-z0-9]*\) / __sun\1__ /g |
---|
323 | s/ tahoe / __tahoe__ /g |
---|
324 | s/ tower\([_0-9]*\) / __tower\1__ /g |
---|
325 | s/ u370 / __u370__ /g |
---|
326 | s/ u3b\([0-9]*\) / __u3b\1__ /g |
---|
327 | s/ unix / __unix__ /g |
---|
328 | s/ vax / __vax__ /g |
---|
329 | s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g |
---|
330 | s/ _*\([Rr][34]\)000 / __\1000__ /g |
---|
331 | s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g |
---|
332 | |
---|
333 | s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g |
---|
334 | } |
---|
335 | /^#define.NULL[ ]/ i\ |
---|
336 | #undef NULL |
---|
337 | ' $2/$file > $2/$file. |
---|
338 | mv $2/$file. $2/$file |
---|
339 | if cmp $file $2/$file >/dev/null 2>&1 \ |
---|
340 | || egrep 'This file is part of the GNU C Library' $2/$file >/dev/null 2>&1; then |
---|
341 | rm $2/$file |
---|
342 | else |
---|
343 | echo Fixed $file |
---|
344 | # Find any include directives that use "file". |
---|
345 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $2/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
346 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
347 | required="$required $1 $dir/$include $2/$dir/$include" |
---|
348 | done |
---|
349 | fi |
---|
350 | fi |
---|
351 | fi |
---|
352 | done |
---|
353 | shift; shift |
---|
354 | done |
---|
355 | |
---|
356 | cd ${INPUT} |
---|
357 | |
---|
358 | # Install the proper definition of the three standard types in header files |
---|
359 | # that they come from. |
---|
360 | for file in sys/types.h stdlib.h sys/stdtypes.h stddef.h memory.h unistd.h; do |
---|
361 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
362 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
363 | chmod +w ${LIB}/$file 2>/dev/null |
---|
364 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
365 | fi |
---|
366 | |
---|
367 | if [ -r ${LIB}/$file ]; then |
---|
368 | echo Fixing size_t, ptrdiff_t and wchar_t in $file |
---|
369 | sed \ |
---|
370 | -e '/^[ ]*\*[ ]*typedef unsigned int size_t;/N' \ |
---|
371 | -e 's/^\([ ]*\*[ ]*typedef unsigned int size_t;\n[ ]*\*\/\)/\1\ |
---|
372 | #ifndef __SIZE_TYPE__\ |
---|
373 | #define __SIZE_TYPE__ long unsigned int\ |
---|
374 | #endif\ |
---|
375 | typedef __SIZE_TYPE__ size_t;\ |
---|
376 | /' \ |
---|
377 | -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\ |
---|
378 | #ifndef __SIZE_TYPE__\ |
---|
379 | #define __SIZE_TYPE__ long unsigned int\ |
---|
380 | #endif |
---|
381 | ' \ |
---|
382 | -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef __SIZE_TYPE__ size_t/' \ |
---|
383 | -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/i\ |
---|
384 | #ifndef __PTRDIFF_TYPE__\ |
---|
385 | #define __PTRDIFF_TYPE__ long int\ |
---|
386 | #endif |
---|
387 | ' \ |
---|
388 | -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \ |
---|
389 | -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/i\ |
---|
390 | #ifndef __WCHAR_TYPE__\ |
---|
391 | #define __WCHAR_TYPE__ int\ |
---|
392 | #endif\ |
---|
393 | #ifndef __cplusplus |
---|
394 | ' \ |
---|
395 | -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/a\ |
---|
396 | #endif |
---|
397 | ' \ |
---|
398 | -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \ |
---|
399 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
400 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
401 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
402 | rm ${LIB}/$file |
---|
403 | else |
---|
404 | # Find any include directives that use "file". |
---|
405 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
406 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
407 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
408 | done |
---|
409 | fi |
---|
410 | fi |
---|
411 | done |
---|
412 | |
---|
413 | # Fix one other error in this file: a mismatched quote not inside a C comment. |
---|
414 | file=sundev/vuid_event.h |
---|
415 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
416 | mkdir ${LIB}/sundev 2>/dev/null |
---|
417 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
418 | chmod +w ${LIB}/$file 2>/dev/null |
---|
419 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
420 | fi |
---|
421 | |
---|
422 | if [ -r ${LIB}/$file ]; then |
---|
423 | echo Fixing $file comment |
---|
424 | sed -e "s/doesn't/does not/" ${LIB}/$file > ${LIB}/${file}.sed |
---|
425 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
426 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
427 | rm ${LIB}/$file |
---|
428 | else |
---|
429 | # Find any include directives that use "file". |
---|
430 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
431 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
432 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
433 | done |
---|
434 | fi |
---|
435 | fi |
---|
436 | |
---|
437 | # Fix these Sun OS files to avoid an invalid identifier in an #ifdef. |
---|
438 | file=sunwindow/win_cursor.h |
---|
439 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
440 | # mkdir ${LIB}/sunwindow 2>/dev/null |
---|
441 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
442 | chmod +w ${LIB}/$file 2>/dev/null |
---|
443 | fi |
---|
444 | if [ -r ${LIB}/$file ]; then |
---|
445 | echo Fixing $file |
---|
446 | sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.sed |
---|
447 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
448 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
449 | rm ${LIB}/$file |
---|
450 | else |
---|
451 | # Find any include directives that use "file". |
---|
452 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
453 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
454 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
455 | done |
---|
456 | fi |
---|
457 | fi |
---|
458 | file=sunwindow/win_lock.h |
---|
459 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
460 | # mkdir ${LIB}/sunwindow 2>/dev/null |
---|
461 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
462 | chmod +w ${LIB}/$file 2>/dev/null |
---|
463 | fi |
---|
464 | if [ -r ${LIB}/$file ]; then |
---|
465 | echo Fixing $file |
---|
466 | sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.sed |
---|
467 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
468 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
469 | rm ${LIB}/$file |
---|
470 | else |
---|
471 | # Find any include directives that use "file". |
---|
472 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
473 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
474 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
475 | done |
---|
476 | fi |
---|
477 | fi |
---|
478 | |
---|
479 | # Fix this Sun file to avoid interfering with stddef.h. |
---|
480 | file=sys/stdtypes.h |
---|
481 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
482 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
483 | chmod +w ${LIB}/$file 2>/dev/null |
---|
484 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
485 | fi |
---|
486 | |
---|
487 | if [ -r ${LIB}/$file ]; then |
---|
488 | echo Fixing $file |
---|
489 | sed -e '/[ ]size_t.*;/i\ |
---|
490 | #ifndef _GCC_SIZE_T\ |
---|
491 | #define _GCC_SIZE_T |
---|
492 | ' \ |
---|
493 | -e '/[ ]size_t.*;/a\ |
---|
494 | #endif |
---|
495 | ' \ |
---|
496 | -e '/[ ]ptrdiff_t.*;/i\ |
---|
497 | #ifndef _GCC_PTRDIFF_T\ |
---|
498 | #define _GCC_PTRDIFF_T |
---|
499 | ' \ |
---|
500 | -e '/[ ]ptrdiff_t.*;/a\ |
---|
501 | #endif |
---|
502 | ' \ |
---|
503 | -e '/[ ]wchar_t.*;/i\ |
---|
504 | #ifndef _GCC_WCHAR_T\ |
---|
505 | #define _GCC_WCHAR_T |
---|
506 | ' \ |
---|
507 | -e '/[ ]wchar_t.*;/a\ |
---|
508 | #endif |
---|
509 | ' ${LIB}/$file > ${LIB}/${file}.sed |
---|
510 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
511 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
512 | rm ${LIB}/$file |
---|
513 | else |
---|
514 | # Find any include directives that use "file". |
---|
515 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
516 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
517 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
518 | done |
---|
519 | fi |
---|
520 | fi |
---|
521 | |
---|
522 | # Fix this ARM/RISCiX file to avoid interfering with the use of __wchar_t |
---|
523 | # in cc1plus. |
---|
524 | file=stdlib.h |
---|
525 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
526 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
527 | chmod +w ${LIB}/$file 2>/dev/null |
---|
528 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
529 | fi |
---|
530 | |
---|
531 | if [ -r ${LIB}/$file ]; then |
---|
532 | echo Fixing $file |
---|
533 | sed -e "s/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \ |
---|
534 | -e "s/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \ |
---|
535 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
536 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
537 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
538 | rm ${LIB}/$file |
---|
539 | else |
---|
540 | # Find any include directives that use "file". |
---|
541 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
542 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
543 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
544 | done |
---|
545 | fi |
---|
546 | fi |
---|
547 | |
---|
548 | # Fix this ARM/RISCiX file where ___type is a Compiler hint that is specific to |
---|
549 | # the Norcroft compiler. |
---|
550 | file=X11/Intrinsic.h |
---|
551 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
552 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
553 | chmod +w ${LIB}/$file 2>/dev/null |
---|
554 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
555 | fi |
---|
556 | |
---|
557 | if [ -r ${LIB}/$file ]; then |
---|
558 | echo Fixing $file |
---|
559 | sed -e "s/___type p_type/p_type/" \ |
---|
560 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
561 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
562 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
563 | rm ${LIB}/$file |
---|
564 | else |
---|
565 | # Find any include directives that use "file". |
---|
566 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
567 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
568 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
569 | done |
---|
570 | fi |
---|
571 | fi |
---|
572 | |
---|
573 | # Fix this file to avoid interfering with stddef.h, but don't mistakenly |
---|
574 | # match ssize_t present in AIX for the ps/2, or typedefs which use (but do not |
---|
575 | # set) size_t. |
---|
576 | file=sys/types.h |
---|
577 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
578 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
579 | chmod +w ${LIB}/$file 2>/dev/null |
---|
580 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
581 | fi |
---|
582 | |
---|
583 | if [ -r ${LIB}/$file ]; then |
---|
584 | echo Fixing $file |
---|
585 | sed -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/i\ |
---|
586 | #ifndef _GCC_SIZE_T\ |
---|
587 | #define _GCC_SIZE_T |
---|
588 | ' \ |
---|
589 | -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/a\ |
---|
590 | #endif |
---|
591 | ' ${LIB}/$file > ${LIB}/${file}.sed |
---|
592 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
593 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
594 | rm ${LIB}/$file |
---|
595 | else |
---|
596 | # Find any include directives that use "file". |
---|
597 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
598 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
599 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
600 | done |
---|
601 | fi |
---|
602 | fi |
---|
603 | |
---|
604 | # Fix HP's use of ../machine/inline.h to refer to |
---|
605 | # /usr/include/machine/inline.h |
---|
606 | file=sys/spinlock.h |
---|
607 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
608 | cp $file ${LIB}/$file |
---|
609 | fi |
---|
610 | if [ -r ${LIB}/$file ] ; then |
---|
611 | echo Fixing $file |
---|
612 | sed -e 's,"../machine/inline.h",<machine/inline.h>,' \ |
---|
613 | -e 's,"../machine/psl.h",<machine/psl.h>,' \ |
---|
614 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
615 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
616 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
617 | rm ${LIB}/$file |
---|
618 | else |
---|
619 | # Find any include directives that use "file". |
---|
620 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
621 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
622 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
623 | done |
---|
624 | fi |
---|
625 | fi |
---|
626 | |
---|
627 | # Fix an error in this file: the #if says _cplusplus, not the double |
---|
628 | # underscore __cplusplus that it should be |
---|
629 | file=tinfo.h |
---|
630 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
631 | mkdir ${LIB}/rpcsvc 2>/dev/null |
---|
632 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
633 | chmod +w ${LIB}/$file 2>/dev/null |
---|
634 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
635 | fi |
---|
636 | |
---|
637 | if [ -r ${LIB}/$file ]; then |
---|
638 | echo Fixing $file, __cplusplus macro |
---|
639 | sed -e 's/[ ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.sed |
---|
640 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
641 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
642 | rm ${LIB}/$file |
---|
643 | else |
---|
644 | # Find any include directives that use "file". |
---|
645 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
646 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
647 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
648 | done |
---|
649 | fi |
---|
650 | fi |
---|
651 | |
---|
652 | # Fix an error in this file: a missing semi-colon at the end of the statsswtch |
---|
653 | # structure definition. |
---|
654 | file=rpcsvc/rstat.h |
---|
655 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
656 | mkdir ${LIB}/rpcsvc 2>/dev/null |
---|
657 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
658 | chmod +w ${LIB}/$file 2>/dev/null |
---|
659 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
660 | fi |
---|
661 | |
---|
662 | if [ -r ${LIB}/$file ]; then |
---|
663 | echo Fixing $file, definition of statsswtch |
---|
664 | sed -e 's/boottime$/boottime;/' ${LIB}/$file > ${LIB}/${file}.sed |
---|
665 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
666 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
667 | rm ${LIB}/$file |
---|
668 | else |
---|
669 | # Find any include directives that use "file". |
---|
670 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
671 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
672 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
673 | done |
---|
674 | fi |
---|
675 | fi |
---|
676 | |
---|
677 | # Fix an error in this file: a missing semi-colon at the end of the nodeent |
---|
678 | # structure definition. |
---|
679 | file=netdnet/dnetdb.h |
---|
680 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
681 | mkdir ${LIB}/netdnet 2>/dev/null |
---|
682 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
683 | chmod +w ${LIB}/$file 2>/dev/null |
---|
684 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
685 | fi |
---|
686 | |
---|
687 | if [ -r ${LIB}/$file ]; then |
---|
688 | echo Fixing $file, definition of nodeent |
---|
689 | sed -e 's/char.*na_addr *$/char *na_addr;/' ${LIB}/$file > ${LIB}/${file}.sed |
---|
690 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
691 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
692 | rm ${LIB}/$file |
---|
693 | else |
---|
694 | # Find any include directives that use "file". |
---|
695 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
696 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
697 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
698 | done |
---|
699 | fi |
---|
700 | fi |
---|
701 | |
---|
702 | # Check for bad #ifdef line (in Ultrix 4.1) |
---|
703 | file=sys/file.h |
---|
704 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
705 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
706 | chmod +w ${LIB}/$file 2>/dev/null |
---|
707 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
708 | fi |
---|
709 | |
---|
710 | if [ -r ${LIB}/$file ]; then |
---|
711 | echo Fixing $file, bad \#ifdef line |
---|
712 | sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' ${LIB}/$file > ${LIB}/${file}.sed |
---|
713 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
714 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
715 | rm ${LIB}/$file |
---|
716 | else |
---|
717 | # Find any include directives that use "file". |
---|
718 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
719 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
720 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
721 | done |
---|
722 | fi |
---|
723 | fi |
---|
724 | |
---|
725 | # Check for (...) in C++ code in HP/UX sys/file.h. |
---|
726 | file=sys/file.h |
---|
727 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
728 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
729 | chmod +w ${LIB}/$file 2>/dev/null |
---|
730 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
731 | fi |
---|
732 | |
---|
733 | if [ -r ${LIB}/$file ]; then |
---|
734 | if egrep HPUX_SOURCE ${LIB}/$file > /dev/null; then |
---|
735 | echo Fixing $file, use of '(...)' |
---|
736 | sed -e 's/(\.\.\.)/(struct file * ...)/' ${LIB}/$file > ${LIB}/${file}.sed |
---|
737 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
738 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
739 | rm ${LIB}/$file |
---|
740 | else |
---|
741 | # Find any include directives that use "file". |
---|
742 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
743 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
744 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
745 | done |
---|
746 | fi |
---|
747 | fi |
---|
748 | fi |
---|
749 | |
---|
750 | # Check for superfluous `static' (in Ultrix 4.2) |
---|
751 | # On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken. |
---|
752 | file=machine/cpu.h |
---|
753 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
754 | mkdir ${LIB}/machine 2>/dev/null |
---|
755 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
756 | chmod +w ${LIB}/$file 2>/dev/null |
---|
757 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
758 | fi |
---|
759 | |
---|
760 | if [ -r ${LIB}/$file ]; then |
---|
761 | echo Fixing $file, superfluous static and broken includes of other files. |
---|
762 | sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \ |
---|
763 | -e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \ |
---|
764 | -e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' \ |
---|
765 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
766 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
767 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
768 | rm ${LIB}/$file |
---|
769 | else |
---|
770 | # Find any include directives that use "file". |
---|
771 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
772 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
773 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
774 | done |
---|
775 | # This file has an alternative name, mips/cpu.h. Fix that name, too. |
---|
776 | if cmp machine/cpu.h mips/cpu.h > /dev/null 2>&1; then |
---|
777 | mkdir ${LIB}/mips 2>&- |
---|
778 | # Don't remove the file first, they may be the same file! |
---|
779 | ln ${LIB}/$file ${LIB}/mips/cpu.h > /dev/null 2>&1 |
---|
780 | fi |
---|
781 | fi |
---|
782 | fi |
---|
783 | |
---|
784 | # Incorrect sprintf declaration in X11/Xmu.h |
---|
785 | file=X11/Xmu.h |
---|
786 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
787 | mkdir ${LIB}/X11 2>/dev/null |
---|
788 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
789 | chmod +w ${LIB}/$file 2>/dev/null |
---|
790 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
791 | fi |
---|
792 | |
---|
793 | if [ -r ${LIB}/$file ]; then |
---|
794 | echo Fixing $file sprintf declaration |
---|
795 | sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\ |
---|
796 | extern char * sprintf();\ |
---|
797 | #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed |
---|
798 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
799 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
800 | rm ${LIB}/$file |
---|
801 | else |
---|
802 | # Find any include directives that use "file". |
---|
803 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
804 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
805 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
806 | done |
---|
807 | fi |
---|
808 | fi |
---|
809 | |
---|
810 | # Incorrect sprintf declaration in X11/Xmu/Xmu.h |
---|
811 | # (It's not clear whether the right file name is this or X11/Xmu.h.) |
---|
812 | file=X11/Xmu/Xmu.h |
---|
813 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
814 | mkdir ${LIB}/X11/Xmu 2>/dev/null |
---|
815 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
816 | chmod +w ${LIB}/$file 2>/dev/null |
---|
817 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
818 | fi |
---|
819 | |
---|
820 | if [ -r ${LIB}/$file ]; then |
---|
821 | echo Fixing $file sprintf declaration |
---|
822 | sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\ |
---|
823 | extern char * sprintf();\ |
---|
824 | #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed |
---|
825 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
826 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
827 | rm ${LIB}/$file |
---|
828 | else |
---|
829 | # Find any include directives that use "file". |
---|
830 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
831 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
832 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
833 | done |
---|
834 | fi |
---|
835 | fi |
---|
836 | |
---|
837 | # Check for missing ';' in struct |
---|
838 | file=netinet/ip.h |
---|
839 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
840 | mkdir ${LIB}/netinet 2>/dev/null |
---|
841 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
842 | chmod +w ${LIB}/$file 2>/dev/null |
---|
843 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
844 | fi |
---|
845 | |
---|
846 | if [ -r ${LIB}/$file ]; then |
---|
847 | echo Fixing $file |
---|
848 | sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.sed |
---|
849 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
850 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
851 | rm -f ${LIB}/$file |
---|
852 | else |
---|
853 | # Find any include directives that use "file". |
---|
854 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
855 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
856 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
857 | done |
---|
858 | fi |
---|
859 | fi |
---|
860 | |
---|
861 | # Fix the CAT macro in SunOS memvar.h. |
---|
862 | file=pixrect/memvar.h |
---|
863 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
864 | mkdir ${LIB}/pixrect 2>/dev/null |
---|
865 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
866 | chmod +w ${LIB}/$file 2>/dev/null |
---|
867 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
868 | fi |
---|
869 | |
---|
870 | if [ -r ${LIB}/$file ]; then |
---|
871 | echo Fixing $file |
---|
872 | sed -e '/^#define.CAT(a,b)/ i\ |
---|
873 | #ifdef __STDC__ \ |
---|
874 | #define CAT(a,b) a##b\ |
---|
875 | #else |
---|
876 | /^#define.CAT(a,b)/ a\ |
---|
877 | #endif |
---|
878 | ' ${LIB}/$file > ${LIB}/${file}.sed |
---|
879 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
880 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
881 | rm -f ${LIB}/$file |
---|
882 | else |
---|
883 | # Find any include directives that use "file". |
---|
884 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
885 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
886 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
887 | done |
---|
888 | fi |
---|
889 | fi |
---|
890 | |
---|
891 | # Check for yet more missing ';' in struct (in SunOS 4.0.x) |
---|
892 | file=rpcsvc/rusers.h |
---|
893 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
894 | mkdir ${LIB}/rpcsvc 2>/dev/null |
---|
895 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
896 | chmod +w ${LIB}/$file 2>/dev/null |
---|
897 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
898 | fi |
---|
899 | |
---|
900 | if [ -r ${LIB}/$file ]; then |
---|
901 | echo Fixing $file |
---|
902 | sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.sed |
---|
903 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
904 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
905 | rm -f ${LIB}/$file |
---|
906 | else |
---|
907 | # Find any include directives that use "file". |
---|
908 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
909 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
910 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
911 | done |
---|
912 | fi |
---|
913 | fi |
---|
914 | |
---|
915 | # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1. |
---|
916 | # Also wrap protection around size_t for m88k-sysv3 systems. |
---|
917 | file=stdlib.h |
---|
918 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
919 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
920 | chmod +w ${LIB}/$file 2>/dev/null |
---|
921 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
922 | fi |
---|
923 | |
---|
924 | if [ -r ${LIB}/$file ]; then |
---|
925 | echo Fixing $file |
---|
926 | if grep _GCC_SIZE_T ${LIB}/$file >/dev/null |
---|
927 | then size_t_pattern='<<< do not double-wrap the size_t typedef >>>' |
---|
928 | else size_t_pattern='typedef[ a-zA-Z_]*[ ]size_t[ ]*;' |
---|
929 | fi |
---|
930 | sed -e 's/int abort/void abort/g' \ |
---|
931 | -e 's/int free/void free/g' \ |
---|
932 | -e 's/char[ ]*\*[ ]*calloc/void \* calloc/g' \ |
---|
933 | -e 's/char[ ]*\*[ ]*malloc/void \* malloc/g' \ |
---|
934 | -e 's/char[ ]*\*[ ]*realloc/void \* realloc/g' \ |
---|
935 | -e 's/int[ ][ ]*exit/void exit/g' \ |
---|
936 | -e "/$size_t_pattern/"'i\ |
---|
937 | #ifndef _GCC_SIZE_T\ |
---|
938 | #define _GCC_SIZE_T |
---|
939 | ' \ |
---|
940 | -e "/$size_t_pattern/"'a\ |
---|
941 | #endif |
---|
942 | ' \ |
---|
943 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
944 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
945 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
946 | rm -f ${LIB}/$file |
---|
947 | else |
---|
948 | # Find any include directives that use "file". |
---|
949 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
950 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
951 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
952 | done |
---|
953 | fi |
---|
954 | fi |
---|
955 | |
---|
956 | # Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1. |
---|
957 | # Also fix return type of {m,re}alloc in <malloc.h> on sysV68 |
---|
958 | file=malloc.h |
---|
959 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
960 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
961 | chmod +w ${LIB}/$file 2>/dev/null |
---|
962 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
963 | fi |
---|
964 | |
---|
965 | if [ -r ${LIB}/$file ]; then |
---|
966 | echo Fixing $file |
---|
967 | sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \ |
---|
968 | -e 's/int[ ][ ]*free/void free/g' \ |
---|
969 | -e 's/char\([ ]*\*[ ]*malloc\)/void\1/g' \ |
---|
970 | -e 's/char\([ ]*\*[ ]*realloc\)/void\1/g' \ |
---|
971 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
972 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
973 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
974 | rm -f ${LIB}/$file |
---|
975 | else |
---|
976 | # Find any include directives that use "file". |
---|
977 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
978 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
979 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
980 | done |
---|
981 | fi |
---|
982 | fi |
---|
983 | |
---|
984 | # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1. |
---|
985 | file=hsfs/hsfs_spec.h |
---|
986 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
987 | mkdir ${LIB}/hsfs 2>/dev/null |
---|
988 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
989 | chmod +w ${LIB}/$file 2>/dev/null |
---|
990 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
991 | fi |
---|
992 | |
---|
993 | if [ -r ${LIB}/$file ]; then |
---|
994 | echo Fixing $file |
---|
995 | sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \ |
---|
996 | ${LIB}/$file > ${LIB}/${file}. |
---|
997 | rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file |
---|
998 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
999 | rm -f ${LIB}/$file |
---|
1000 | else |
---|
1001 | # Find any include directives that use "file". |
---|
1002 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1003 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1004 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1005 | done |
---|
1006 | fi |
---|
1007 | fi |
---|
1008 | |
---|
1009 | # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1. |
---|
1010 | file=hsfs/hsnode.h |
---|
1011 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1012 | mkdir ${LIB}/hsfs 2>/dev/null |
---|
1013 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1014 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1015 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1016 | fi |
---|
1017 | |
---|
1018 | if [ -r ${LIB}/$file ]; then |
---|
1019 | echo Fixing $file |
---|
1020 | sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \ |
---|
1021 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
1022 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1023 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1024 | rm -f ${LIB}/$file |
---|
1025 | else |
---|
1026 | # Find any include directives that use "file". |
---|
1027 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1028 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1029 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1030 | done |
---|
1031 | fi |
---|
1032 | fi |
---|
1033 | |
---|
1034 | # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1. |
---|
1035 | file=hsfs/iso_spec.h |
---|
1036 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1037 | mkdir ${LIB}/hsfs 2>/dev/null |
---|
1038 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1039 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1040 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1041 | fi |
---|
1042 | |
---|
1043 | if [ -r ${LIB}/$file ]; then |
---|
1044 | echo Fixing $file |
---|
1045 | sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \ |
---|
1046 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
1047 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1048 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1049 | rm -f ${LIB}/$file |
---|
1050 | else |
---|
1051 | # Find any include directives that use "file". |
---|
1052 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1053 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1054 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1055 | done |
---|
1056 | fi |
---|
1057 | fi |
---|
1058 | |
---|
1059 | # Incorrect #include in Sony News-OS 3.2. |
---|
1060 | file=machine/machparam.h |
---|
1061 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1062 | mkdir ${LIB}/machine 2>/dev/null |
---|
1063 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1064 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1065 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1066 | fi |
---|
1067 | |
---|
1068 | if [ -r ${LIB}/$file ]; then |
---|
1069 | echo Fixing $file, incorrect \#include |
---|
1070 | sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \ |
---|
1071 | ${LIB}/$file > ${LIB}/${file}. |
---|
1072 | rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file |
---|
1073 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1074 | rm -f ${LIB}/$file |
---|
1075 | else |
---|
1076 | # Find any include directives that use "file". |
---|
1077 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1078 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1079 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1080 | done |
---|
1081 | fi |
---|
1082 | fi |
---|
1083 | |
---|
1084 | # Multiline comment after typedef on IRIX 4.0.1. |
---|
1085 | file=sys/types.h |
---|
1086 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1087 | mkdir ${LIB}/sys 2>/dev/null |
---|
1088 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1089 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1090 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1091 | fi |
---|
1092 | |
---|
1093 | if [ -r ${LIB}/$file ]; then |
---|
1094 | echo Fixing $file, comment in the middle of \#ifdef |
---|
1095 | sed -e 's@type of the result@type of the result */@' \ |
---|
1096 | -e 's@of the sizeof@/* of the sizeof@' \ |
---|
1097 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
1098 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1099 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1100 | rm -f ${LIB}/$file |
---|
1101 | else |
---|
1102 | # Find any include directives that use "file". |
---|
1103 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1104 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1105 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1106 | done |
---|
1107 | fi |
---|
1108 | fi |
---|
1109 | |
---|
1110 | # Turning // comments into /* */ comments trashes this IRIX 4.0.1 |
---|
1111 | # header file, which embeds // comments inside multi-line /* */ |
---|
1112 | # comments. If this looks like the IRIX header file, we refix it by |
---|
1113 | # just throwing away the // comments. |
---|
1114 | file=fam.h |
---|
1115 | if [ -r ${LIB}/$file ]; then |
---|
1116 | if egrep indigo.esd ${LIB}/$file > /dev/null; then |
---|
1117 | echo Fixing $file, overeager sed script |
---|
1118 | rm ${LIB}/$file |
---|
1119 | sed -e 's|//.*$||g' $file > ${LIB}/$file |
---|
1120 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1121 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1122 | fi |
---|
1123 | fi |
---|
1124 | |
---|
1125 | # There is a similar problem with the VxWorks drv/netif/if_med.h file. |
---|
1126 | file=drv/netif/if_med.h |
---|
1127 | if [ -r ${LIB}/$file ]; then |
---|
1128 | if egrep 'Wind River' ${LIB}/$file > /dev/null; then |
---|
1129 | echo Fixing $file, overeager sed script |
---|
1130 | rm ${LIB}/$file |
---|
1131 | sed -e 's|//.*$||g' $file > ${LIB}/$file |
---|
1132 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1133 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1134 | fi |
---|
1135 | fi |
---|
1136 | |
---|
1137 | # And also with the HP-UX 10 sys/pci.h file |
---|
1138 | file=sys/pci.h |
---|
1139 | if [ -r ${LIB}/$file ]; then |
---|
1140 | if egrep 'System Private Structures' ${LIB}/$file > /dev/null; then |
---|
1141 | echo Fixing $file, overeager sed script |
---|
1142 | rm ${LIB}/$file |
---|
1143 | sed -e 's|//.*$||g' $file > ${LIB}/$file |
---|
1144 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1145 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1146 | fi |
---|
1147 | fi |
---|
1148 | |
---|
1149 | # Some IRIX header files contains the string "//" |
---|
1150 | for file in elf_abi.h elf.h; do |
---|
1151 | if [ -r ${LIB}/$file ]; then |
---|
1152 | echo Fixing $file, overeager sed script |
---|
1153 | sed -e 's|"/\*"\*/|"//"|' ${LIB}/$file > ${LIB}/${file}.sed |
---|
1154 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1155 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1156 | rm -f ${LIB}/$file |
---|
1157 | else |
---|
1158 | # Find any include directives that use "file". |
---|
1159 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1160 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1161 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1162 | done |
---|
1163 | fi |
---|
1164 | fi |
---|
1165 | done |
---|
1166 | |
---|
1167 | # IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr in prototype without |
---|
1168 | # previous definition. |
---|
1169 | file=rpc/auth.h |
---|
1170 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1171 | mkdir ${LIB}/rpc 2>/dev/null |
---|
1172 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1173 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1174 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1175 | fi |
---|
1176 | |
---|
1177 | if [ -r ${LIB}/$file ]; then |
---|
1178 | echo Fixing $file, undefined type |
---|
1179 | sed -e '/authdes_create.*struct sockaddr/i\ |
---|
1180 | struct sockaddr; |
---|
1181 | ' \ |
---|
1182 | ${LIB}/$file > ${LIB}/$file.sed |
---|
1183 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1184 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1185 | rm -f ${LIB}/$file |
---|
1186 | else |
---|
1187 | # Find any include directives that use "file". |
---|
1188 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1189 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1190 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1191 | done |
---|
1192 | fi |
---|
1193 | fi |
---|
1194 | |
---|
1195 | # IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s in prototype without previous |
---|
1196 | # definition. |
---|
1197 | file=rpc/xdr.h |
---|
1198 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1199 | mkdir ${LIB}/rpc 2>/dev/null |
---|
1200 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1201 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1202 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1203 | fi |
---|
1204 | |
---|
1205 | if [ -r ${LIB}/$file ]; then |
---|
1206 | echo Fixing $file, undefined type |
---|
1207 | sed -e '/xdrstdio_create.*struct __file_s/i\ |
---|
1208 | struct __file_s; |
---|
1209 | ' \ |
---|
1210 | ${LIB}/$file > ${LIB}/$file.sed |
---|
1211 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1212 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1213 | rm -f ${LIB}/$file |
---|
1214 | else |
---|
1215 | # Find any include directives that use "file". |
---|
1216 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1217 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1218 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1219 | done |
---|
1220 | fi |
---|
1221 | fi |
---|
1222 | |
---|
1223 | # Same problem with a file from SunOS 4.1.3 : a header file containing |
---|
1224 | # the string "//" embedded in "/**/" |
---|
1225 | file=sbusdev/audiovar.h |
---|
1226 | if [ -r ${LIB}/$file ]; then |
---|
1227 | echo Fixing $file, overeager sed script |
---|
1228 | rm ${LIB}/$file |
---|
1229 | sed -e 's|//.*$||g' $file > ${LIB}/$file |
---|
1230 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1231 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1232 | fi |
---|
1233 | |
---|
1234 | # Fix non-ANSI memcpy declaration that conflicts with gcc's builtin |
---|
1235 | # declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because |
---|
1236 | # many other systems have similar text but correct versions of the file. |
---|
1237 | # To ensure only Sun's is fixed, we grep for a likely unique string. |
---|
1238 | # Fix also on sysV68 R3V7.1 (head/memory.h\t50.1\t ) |
---|
1239 | file=memory.h |
---|
1240 | if [ -r $file ] && egrep '/\* @\(#\)(head/memory.h 50.1 |memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2 )\*/' $file > /dev/null; then |
---|
1241 | if [ ! -r ${LIB}/$file ]; then |
---|
1242 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1243 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1244 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1245 | fi |
---|
1246 | if [ -r ${LIB}/$file ]; then |
---|
1247 | echo Replacing $file |
---|
1248 | cat > ${LIB}/$file << EOF |
---|
1249 | /* This file was generated by fixincludes */ |
---|
1250 | #ifndef __memory_h__ |
---|
1251 | #define __memory_h__ |
---|
1252 | |
---|
1253 | #ifdef __STDC__ |
---|
1254 | extern void *memccpy(); |
---|
1255 | extern void *memchr(); |
---|
1256 | extern void *memcpy(); |
---|
1257 | extern void *memset(); |
---|
1258 | #else |
---|
1259 | extern char *memccpy(); |
---|
1260 | extern char *memchr(); |
---|
1261 | extern char *memcpy(); |
---|
1262 | extern char *memset(); |
---|
1263 | #endif /* __STDC__ */ |
---|
1264 | |
---|
1265 | extern int memcmp(); |
---|
1266 | |
---|
1267 | #endif /* __memory_h__ */ |
---|
1268 | EOF |
---|
1269 | fi |
---|
1270 | fi |
---|
1271 | |
---|
1272 | # Fix return type of fread and fwrite on sysV68 |
---|
1273 | file=stdio.h |
---|
1274 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1275 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1276 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1277 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1278 | fi |
---|
1279 | |
---|
1280 | if [ -r ${LIB}/$file ]; then |
---|
1281 | echo Fixing $file, fread and fwrite return type |
---|
1282 | sed -e 's/^\(extern int fclose(), fflush()\), \(fread(), fwrite()\)\(.*\)$/extern unsigned int \2;\ |
---|
1283 | \1\3/' \ |
---|
1284 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
1285 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1286 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1287 | rm -f ${LIB}/$file |
---|
1288 | else |
---|
1289 | # Find any include directives that use "file". |
---|
1290 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1291 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1292 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1293 | done |
---|
1294 | fi |
---|
1295 | fi |
---|
1296 | |
---|
1297 | # parameters not const on DECstation Ultrix V4.0 and OSF/1. |
---|
1298 | file=stdio.h |
---|
1299 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1300 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1301 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1302 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1303 | fi |
---|
1304 | |
---|
1305 | if [ -r ${LIB}/$file ]; then |
---|
1306 | echo Fixing $file, non-const arg |
---|
1307 | sed -e 's@perror( char \*__s );@perror( const char *__s );@' \ |
---|
1308 | -e 's@fputs( char \*__s,@fputs( const char *__s,@' \ |
---|
1309 | -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \ |
---|
1310 | -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \ |
---|
1311 | -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \ |
---|
1312 | -e 's@scanf( char \*__format,@scanf( const char *__format,@' \ |
---|
1313 | -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \ |
---|
1314 | -e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \ |
---|
1315 | -e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' \ |
---|
1316 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
1317 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1318 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1319 | rm -f ${LIB}/$file |
---|
1320 | else |
---|
1321 | # Find any include directives that use "file". |
---|
1322 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1323 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1324 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1325 | done |
---|
1326 | fi |
---|
1327 | fi |
---|
1328 | |
---|
1329 | # parameters conflict with C++ new on rs/6000 |
---|
1330 | for file in stdio.h unistd.h ; do |
---|
1331 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1332 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1333 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1334 | fi |
---|
1335 | |
---|
1336 | if [ -r ${LIB}/$file ]; then |
---|
1337 | echo Fixing $file, parameter name conflicts |
---|
1338 | sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \ |
---|
1339 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
1340 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1341 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1342 | rm -f ${LIB}/$file |
---|
1343 | else |
---|
1344 | # Find any include directives that use "file". |
---|
1345 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1346 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1347 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1348 | done |
---|
1349 | fi |
---|
1350 | fi |
---|
1351 | done |
---|
1352 | |
---|
1353 | # function class(double x) conflicts with C++ keyword on rs/6000 |
---|
1354 | file=math.h |
---|
1355 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1356 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1357 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1358 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1359 | fi |
---|
1360 | |
---|
1361 | if [ -r ${LIB}/$file ]; then |
---|
1362 | if grep '[^a-zA-Z_]class[(]' ${LIB}/$file >/dev/null; then |
---|
1363 | echo Fixing $file |
---|
1364 | sed -e '/class[(]/i\ |
---|
1365 | #ifndef __cplusplus |
---|
1366 | ' \ |
---|
1367 | -e '/class[(]/a\ |
---|
1368 | #endif |
---|
1369 | ' ${LIB}/$file > ${LIB}/${file}.sed |
---|
1370 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1371 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1372 | rm ${LIB}/$file |
---|
1373 | else |
---|
1374 | # Find any include directives that use "file". |
---|
1375 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1376 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1377 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1378 | done |
---|
1379 | fi |
---|
1380 | fi |
---|
1381 | fi |
---|
1382 | |
---|
1383 | # Wrong fchmod prototype on RS/6000. |
---|
1384 | file=sys/stat.h |
---|
1385 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1386 | mkdir ${LIB}/sys 2>/dev/null |
---|
1387 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1388 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1389 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1390 | fi |
---|
1391 | |
---|
1392 | if [ -r ${LIB}/$file ]; then |
---|
1393 | echo Fixing $file, fchmod prototype |
---|
1394 | sed -e 's/fchmod(char \*/fchmod(int/' \ |
---|
1395 | ${LIB}/$file > ${LIB}/$file.sed |
---|
1396 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1397 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1398 | rm -f ${LIB}/$file |
---|
1399 | else |
---|
1400 | # Find any include directives that use "file". |
---|
1401 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1402 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1403 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1404 | done |
---|
1405 | fi |
---|
1406 | fi |
---|
1407 | |
---|
1408 | # There are several name conflicts with C++ reserved words in X11 |
---|
1409 | # header files. These are fixed in some versions, so don't do the |
---|
1410 | # fixes if we find __cplusplus in the file. These were found on the |
---|
1411 | # RS/6000. |
---|
1412 | |
---|
1413 | # class in X11/ShellP.h |
---|
1414 | file=X11/ShellP.h |
---|
1415 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1416 | mkdir ${LIB}/sys 2>/dev/null |
---|
1417 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1418 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1419 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1420 | fi |
---|
1421 | |
---|
1422 | if [ -r ${LIB}/$file ]; then |
---|
1423 | if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then |
---|
1424 | true; |
---|
1425 | else |
---|
1426 | echo Fixing $file, field class |
---|
1427 | sed -e '/char [*]class;/i\ |
---|
1428 | #ifdef __cplusplus\ |
---|
1429 | char *c_class;\ |
---|
1430 | #else |
---|
1431 | ' \ |
---|
1432 | -e '/char [*]class;/a\ |
---|
1433 | #endif |
---|
1434 | ' ${LIB}/$file > ${LIB}/${file}.sed |
---|
1435 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1436 | fi |
---|
1437 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1438 | rm -f ${LIB}/$file |
---|
1439 | else |
---|
1440 | # Find any include directives that use "file". |
---|
1441 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1442 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1443 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1444 | done |
---|
1445 | fi |
---|
1446 | fi |
---|
1447 | # new in Xm/Traversal.h |
---|
1448 | file=Xm/Traversal.h |
---|
1449 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1450 | mkdir ${LIB}/sys 2>/dev/null |
---|
1451 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1452 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1453 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1454 | fi |
---|
1455 | |
---|
1456 | if [ -r ${LIB}/$file ]; then |
---|
1457 | if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then |
---|
1458 | true; |
---|
1459 | else |
---|
1460 | echo Fixing $file, uses of new |
---|
1461 | sed -e '/Widget old, new;/i\ |
---|
1462 | #ifdef __cplusplus\ |
---|
1463 | Widget old, c_new;\ |
---|
1464 | #else |
---|
1465 | ' \ |
---|
1466 | -e '/Widget old, new;/a\ |
---|
1467 | #endif |
---|
1468 | ' \ |
---|
1469 | -e 's/Widget new,/Widget c_new,/g' ${LIB}/$file > ${LIB}/${file}.sed |
---|
1470 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1471 | fi |
---|
1472 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1473 | rm -f ${LIB}/$file |
---|
1474 | else |
---|
1475 | # Find any include directives that use "file". |
---|
1476 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1477 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1478 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1479 | done |
---|
1480 | fi |
---|
1481 | fi |
---|
1482 | # class in Xm/BaseClassI.h |
---|
1483 | file=Xm/BaseClassI.h |
---|
1484 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1485 | mkdir ${LIB}/sys 2>/dev/null |
---|
1486 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1487 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1488 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1489 | fi |
---|
1490 | |
---|
1491 | if [ -r ${LIB}/$file ]; then |
---|
1492 | if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then |
---|
1493 | true; |
---|
1494 | else |
---|
1495 | echo Fixing $file, prototype parameter name |
---|
1496 | sed -e 's/ class[)]/ c_class)/g' ${LIB}/$file > ${LIB}/${file}.sed |
---|
1497 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1498 | fi |
---|
1499 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1500 | rm -f ${LIB}/$file |
---|
1501 | else |
---|
1502 | # Find any include directives that use "file". |
---|
1503 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1504 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1505 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1506 | done |
---|
1507 | fi |
---|
1508 | fi |
---|
1509 | |
---|
1510 | # NeXT 3.2 adds const prefix to some math functions. These conflict |
---|
1511 | # with the built-in functions. |
---|
1512 | file=ansi/math.h |
---|
1513 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1514 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1515 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1516 | fi |
---|
1517 | if [ -r ${LIB}/$file ]; then |
---|
1518 | echo Fixing $file |
---|
1519 | sed -e '/^extern.*double.*__const__.*sqrt(/s/__const__//' \ |
---|
1520 | -e '/^extern.*double.*__const__.*fabs(/s/__const__//' \ |
---|
1521 | -e '/^extern.*double.*__const__.*cos(/s/__const__//' \ |
---|
1522 | -e '/^extern.*double.*__const__.*sin(/s/__const__//' ${LIB}/$file > ${LIB}/${file}.sed |
---|
1523 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1524 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1525 | rm -f ${LIB}/$file |
---|
1526 | else |
---|
1527 | # Find any include directives that use "file". |
---|
1528 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1529 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1530 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1531 | done |
---|
1532 | fi |
---|
1533 | fi |
---|
1534 | |
---|
1535 | # NeXT 3.2 uses the word "template" as a parameter for some |
---|
1536 | # functions. GCC reports an invalid use of a reserved key word |
---|
1537 | # with the built-in functions. NeXT 3.2 includes the keyword |
---|
1538 | # volatile in the prototype for abort(). This conflicts with |
---|
1539 | # the built-in definition. |
---|
1540 | file=bsd/libc.h |
---|
1541 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1542 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1543 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1544 | fi |
---|
1545 | if [ -r ${LIB}/$file ]; then |
---|
1546 | echo Fixing $file |
---|
1547 | sed -e '/\(.*template\)/s/template//' \ |
---|
1548 | -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.sed |
---|
1549 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1550 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1551 | rm -f ${LIB}/$file |
---|
1552 | else |
---|
1553 | # Find any include directives that use "file". |
---|
1554 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1555 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1556 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1557 | done |
---|
1558 | fi |
---|
1559 | fi |
---|
1560 | |
---|
1561 | # NeXT 3.2 includes the keyword volatile in the abort() and |
---|
1562 | # exit() function prototypes. That conflicts with the |
---|
1563 | # built-in functions. |
---|
1564 | file=ansi/stdlib.h |
---|
1565 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1566 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1567 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1568 | fi |
---|
1569 | if [ -r ${LIB}/$file ]; then |
---|
1570 | echo Fixing $file |
---|
1571 | sed -e '/extern.*volatile.*void.*exit/s/volatile//' \ |
---|
1572 | -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.sed |
---|
1573 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1574 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1575 | rm -f ${LIB}/$file |
---|
1576 | else |
---|
1577 | # Find any include directives that use "file". |
---|
1578 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1579 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1580 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1581 | done |
---|
1582 | fi |
---|
1583 | fi |
---|
1584 | |
---|
1585 | # sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the definition |
---|
1586 | # of struct rusage, so the prototype (added by fixproto) causes havoc. |
---|
1587 | file=sys/wait.h |
---|
1588 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1589 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1590 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1591 | fi |
---|
1592 | |
---|
1593 | if [ -r ${LIB}/$file ] \ |
---|
1594 | && grep 'bos325,' ${LIB}/$file >/dev/null; then |
---|
1595 | echo Fixing $file, wait3 declaration |
---|
1596 | sed -e '/^extern pid_t wait3();$/i\ |
---|
1597 | struct rusage; |
---|
1598 | '\ |
---|
1599 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
1600 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1601 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1602 | rm -f ${LIB}/$file |
---|
1603 | else |
---|
1604 | # Find any include directives that use "file". |
---|
1605 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1606 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1607 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1608 | done |
---|
1609 | fi |
---|
1610 | fi |
---|
1611 | |
---|
1612 | # NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1. |
---|
1613 | # Note that version 3 of the NeXT system has wait.h in a different directory, |
---|
1614 | # so that this code won't do anything. But wait.h in version 3 has a |
---|
1615 | # conditional, so it doesn't need this fix. So everything is okay. |
---|
1616 | file=sys/wait.h |
---|
1617 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1618 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1619 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1620 | fi |
---|
1621 | |
---|
1622 | if [ -r ${LIB}/$file ] \ |
---|
1623 | && grep 'wait[(]union wait' ${LIB}/$file >/dev/null; then |
---|
1624 | echo Fixing $file, bad wait formal |
---|
1625 | sed -e 's@wait(union wait@wait(void@' ${LIB}/$file > ${LIB}/${file}.sed |
---|
1626 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1627 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1628 | rm -f ${LIB}/$file |
---|
1629 | else |
---|
1630 | # Find any include directives that use "file". |
---|
1631 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1632 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1633 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1634 | done |
---|
1635 | fi |
---|
1636 | fi |
---|
1637 | |
---|
1638 | # Don't use or define the name va_list in stdio.h. |
---|
1639 | # This is for ANSI and also to interoperate properly with gcc's varargs.h. |
---|
1640 | file=stdio.h |
---|
1641 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1642 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1643 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1644 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1645 | fi |
---|
1646 | |
---|
1647 | if [ -r ${LIB}/$file ]; then |
---|
1648 | echo Fixing $file, use of va_list |
---|
1649 | # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list |
---|
1650 | if egrep "__need___va_list" ${LIB}/$file >/dev/null 2>&1; then |
---|
1651 | touch ${LIB}/${file}.sed |
---|
1652 | else |
---|
1653 | (echo "#define __need___va_list" |
---|
1654 | echo "#include <stdarg.h>") > ${LIB}/${file}.sed |
---|
1655 | fi |
---|
1656 | # Use __gnuc_va_list in arg types in place of va_list. |
---|
1657 | # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the |
---|
1658 | # trailing parentheses and semicolon save all other systems from this. |
---|
1659 | # Define __va_list__ (something harmless and unused) instead of va_list. |
---|
1660 | # Don't claim to have defined va_list. |
---|
1661 | sed -e 's@ va_list @ __gnuc_va_list @' \ |
---|
1662 | -e 's@ va_list)@ __gnuc_va_list)@' \ |
---|
1663 | -e 's@ _BSD_VA_LIST_));@ __gnuc_va_list));@' \ |
---|
1664 | -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \ |
---|
1665 | -e 's@ va_list@ __va_list__@' \ |
---|
1666 | -e 's@\*va_list@*__va_list__@' \ |
---|
1667 | -e 's@ __va_list)@ __gnuc_va_list)@' \ |
---|
1668 | -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \ |
---|
1669 | -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \ |
---|
1670 | -e 's@VA_LIST@DUMMY_VA_LIST@' \ |
---|
1671 | -e 's@_Va_LIST@_VA_LIST@' \ |
---|
1672 | ${LIB}/$file >> ${LIB}/${file}.sed |
---|
1673 | |
---|
1674 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1675 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1676 | rm -f ${LIB}/$file |
---|
1677 | else |
---|
1678 | # Find any include directives that use "file". |
---|
1679 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1680 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1681 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1682 | done |
---|
1683 | fi |
---|
1684 | fi |
---|
1685 | |
---|
1686 | # Cancel out ansi_compat.h on Ultrix. Replace it with empty file. |
---|
1687 | file=ansi_compat.h |
---|
1688 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1689 | if grep -s ULTRIX $file; then |
---|
1690 | echo "/* This file intentionally left blank. */" > $LIB/$file |
---|
1691 | fi |
---|
1692 | fi |
---|
1693 | |
---|
1694 | # parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R. |
---|
1695 | # also get rid of bogus inline definitions in HP-UX 8.0 |
---|
1696 | file=math.h |
---|
1697 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1698 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1699 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1700 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1701 | fi |
---|
1702 | |
---|
1703 | if [ -r ${LIB}/$file ]; then |
---|
1704 | echo Fixing $file, non-const arg |
---|
1705 | sed -e 's@atof(\([ ]*char[ ]*\*[^)]*\))@atof(const \1)@' \ |
---|
1706 | -e 's@inline int abs(int [a-z][a-z]*) {.*}@extern "C" int abs(int);@' \ |
---|
1707 | -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \ |
---|
1708 | -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \ |
---|
1709 | -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \ |
---|
1710 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
1711 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1712 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1713 | rm -f ${LIB}/$file |
---|
1714 | else |
---|
1715 | # Find any include directives that use "file". |
---|
1716 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1717 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1718 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1719 | done |
---|
1720 | fi |
---|
1721 | fi |
---|
1722 | |
---|
1723 | # fix bogus recursive stdlib.h in NEWS-OS 4.0C |
---|
1724 | file=stdlib.h |
---|
1725 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1726 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1727 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1728 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1729 | fi |
---|
1730 | |
---|
1731 | if [ -r ${LIB}/$file ]; then |
---|
1732 | echo Fixing $file, recursive inclusion |
---|
1733 | sed -e '/^#include <stdlib.h>/i\ |
---|
1734 | #if 0 |
---|
1735 | ' \ |
---|
1736 | -e '/^#include <stdlib.h>/a\ |
---|
1737 | #endif |
---|
1738 | ' \ |
---|
1739 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
1740 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1741 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1742 | rm -f ${LIB}/$file |
---|
1743 | else |
---|
1744 | # Find any include directives that use "file". |
---|
1745 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1746 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1747 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1748 | done |
---|
1749 | fi |
---|
1750 | fi |
---|
1751 | |
---|
1752 | # Avoid nested comments on Ultrix 4.3. |
---|
1753 | file=rpc/svc.h |
---|
1754 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1755 | mkdir ${LIB}/rpc 2>/dev/null |
---|
1756 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1757 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1758 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1759 | fi |
---|
1760 | |
---|
1761 | if [ -r ${LIB}/$file ]; then |
---|
1762 | echo Fixing $file, nested comment |
---|
1763 | sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' \ |
---|
1764 | ${LIB}/$file > ${LIB}/$file.sed |
---|
1765 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1766 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1767 | rm -f ${LIB}/$file |
---|
1768 | else |
---|
1769 | # Find any include directives that use "file". |
---|
1770 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1771 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1772 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1773 | done |
---|
1774 | fi |
---|
1775 | fi |
---|
1776 | |
---|
1777 | # This file in RISC/os uses /**/ to concatenate two tokens. |
---|
1778 | file=bsd43/bsd43_.h |
---|
1779 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1780 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1781 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1782 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1783 | fi |
---|
1784 | if [ -r ${LIB}/$file ]; then |
---|
1785 | sed -e 's|/\*\*/|##|' ${LIB}/$file > ${LIB}/${file}.sed |
---|
1786 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1787 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1788 | rm -f ${LIB}/$file |
---|
1789 | else |
---|
1790 | # Find any include directives that use "file". |
---|
1791 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1792 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1793 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1794 | done |
---|
1795 | fi |
---|
1796 | fi |
---|
1797 | |
---|
1798 | file=rpc/rpc.h |
---|
1799 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1800 | mkdir ${LIB}/rpc 2>/dev/null |
---|
1801 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1802 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1803 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1804 | fi |
---|
1805 | |
---|
1806 | if [ -r ${LIB}/$file ]; then |
---|
1807 | echo Fixing $file, nested comment |
---|
1808 | sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \ |
---|
1809 | ${LIB}/$file > ${LIB}/$file.sed |
---|
1810 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1811 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1812 | rm -f ${LIB}/$file |
---|
1813 | else |
---|
1814 | # Find any include directives that use "file". |
---|
1815 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1816 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1817 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1818 | done |
---|
1819 | fi |
---|
1820 | fi |
---|
1821 | |
---|
1822 | # rpc/types.h on OSF1/2.0 is not C++ ready, even though NO_IMPLICIT_EXTERN_C |
---|
1823 | # is defined for the alpha. The problem is the declaration of malloc. |
---|
1824 | file=rpc/types.h |
---|
1825 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1826 | mkdir ${LIB}/rpc 2>/dev/null |
---|
1827 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1828 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1829 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1830 | fi |
---|
1831 | if [ -r ${LIB}/$file ]; then |
---|
1832 | if egrep '"C"' ${LIB}/$file >/dev/null 2>&1; then |
---|
1833 | true |
---|
1834 | else |
---|
1835 | echo Fixing $file |
---|
1836 | echo '#ifdef __cplusplus |
---|
1837 | extern "C" { |
---|
1838 | #endif' > ${LIB}/${file}.sed |
---|
1839 | cat ${LIB}/${file} >> ${LIB}/${file}.sed |
---|
1840 | echo '#ifdef __cplusplus |
---|
1841 | } |
---|
1842 | #endif' >> ${LIB}/${file}.sed |
---|
1843 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1844 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1845 | rm -f ${LIB}/$file |
---|
1846 | else |
---|
1847 | # Find any include directives that use "file". |
---|
1848 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1849 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1850 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1851 | done |
---|
1852 | fi |
---|
1853 | fi |
---|
1854 | fi |
---|
1855 | |
---|
1856 | # In limits.h, put #ifndefs around things that are supposed to be defined |
---|
1857 | # in float.h to avoid redefinition errors if float.h is included first. |
---|
1858 | # On HP/UX this patch does not work, because on HP/UX limits.h uses |
---|
1859 | # multi line comments and the inserted #endif winds up inside the |
---|
1860 | # comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if |
---|
1861 | # we find a #ifndef FLT_MIN we assume that all the required #ifndefs |
---|
1862 | # are there, and we do not add them ourselves. |
---|
1863 | # Also fix a nested comment problem in sys/limits.h on Motorola sysV68 R3V7.1 |
---|
1864 | for file in limits.h sys/limits.h; do |
---|
1865 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1866 | mkdir ${LIB}/sys 2>/dev/null |
---|
1867 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1868 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1869 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1870 | fi |
---|
1871 | |
---|
1872 | if [ -r ${LIB}/$file ]; then |
---|
1873 | if egrep 'ifndef[ ]+FLT_MIN' ${LIB}/$file >/dev/null; then |
---|
1874 | true |
---|
1875 | else |
---|
1876 | echo Fixing $file |
---|
1877 | sed -e '/[ ]FLT_MIN[ ]/i\ |
---|
1878 | #ifndef FLT_MIN |
---|
1879 | '\ |
---|
1880 | -e '/[ ]FLT_MIN[ ]/a\ |
---|
1881 | #endif |
---|
1882 | '\ |
---|
1883 | -e '/[ ]FLT_MAX[ ]/i\ |
---|
1884 | #ifndef FLT_MAX |
---|
1885 | '\ |
---|
1886 | -e '/[ ]FLT_MAX[ ]/a\ |
---|
1887 | #endif |
---|
1888 | '\ |
---|
1889 | -e '/[ ]FLT_DIG[ ]/i\ |
---|
1890 | #ifndef FLT_DIG |
---|
1891 | '\ |
---|
1892 | -e '/[ ]FLT_DIG[ ]/a\ |
---|
1893 | #endif |
---|
1894 | '\ |
---|
1895 | -e '/[ ]DBL_MIN[ ]/i\ |
---|
1896 | #ifndef DBL_MIN |
---|
1897 | '\ |
---|
1898 | -e '/[ ]DBL_MIN[ ]/a\ |
---|
1899 | #endif |
---|
1900 | '\ |
---|
1901 | -e '/[ ]DBL_MAX[ ]/i\ |
---|
1902 | #ifndef DBL_MAX |
---|
1903 | '\ |
---|
1904 | -e '/[ ]DBL_MAX[ ]/a\ |
---|
1905 | #endif |
---|
1906 | '\ |
---|
1907 | -e '/[ ]DBL_DIG[ ]/i\ |
---|
1908 | #ifndef DBL_DIG |
---|
1909 | '\ |
---|
1910 | -e '/[ ]DBL_DIG[ ]/a\ |
---|
1911 | #endif |
---|
1912 | '\ |
---|
1913 | -e '/^\(\/\*#define HUGE_VAL 3\.[0-9e+]* *\)\/\*/s//\1/'\ |
---|
1914 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
1915 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1916 | fi |
---|
1917 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1918 | echo Deleting ${LIB}/$file\; no fixes were needed. |
---|
1919 | rm -f ${LIB}/$file |
---|
1920 | else |
---|
1921 | # Find any include directives that use "file". |
---|
1922 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1923 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1924 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1925 | done |
---|
1926 | fi |
---|
1927 | fi |
---|
1928 | done |
---|
1929 | |
---|
1930 | # In math.h, put #ifndefs around things that might be defined in a gcc |
---|
1931 | # specific math-*.h file. |
---|
1932 | file=math.h |
---|
1933 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1934 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1935 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1936 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1937 | fi |
---|
1938 | |
---|
1939 | if [ -r ${LIB}/$file ]; then |
---|
1940 | echo Fixing $file |
---|
1941 | sed -e '/define[ ]HUGE_VAL[ ]/i\ |
---|
1942 | #ifndef HUGE_VAL |
---|
1943 | '\ |
---|
1944 | -e '/define[ ]HUGE_VAL[ ]/a\ |
---|
1945 | #endif |
---|
1946 | '\ |
---|
1947 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
1948 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1949 | |
---|
1950 | # In addition, copy the definition of DBL_MAX from float.h |
---|
1951 | # if math.h requires one. The Lynx math.h requires it. |
---|
1952 | if egrep '#define[ ]*HUGE_VAL[ ]+DBL_MAX' $file >/dev/null 2>&1; then |
---|
1953 | if egrep '#define[ ]+DBL_MAX[ ]+' $file >/dev/null 2>&1; then |
---|
1954 | true; |
---|
1955 | else |
---|
1956 | dbl_max_def=`egrep 'define[ ]+DBL_MAX[ ]+.*' float.h 2>/dev/null` |
---|
1957 | if [ "$dbl_max_def" != "" ]; then |
---|
1958 | dbl_max_def=`echo $dbl_max_def | sed 's/.*define[ ]*DBL_MAX[ ]*//'` |
---|
1959 | sed -e "/define[ ]HUGE_VAL[ ]DBL_MAX/s/DBL_MAX/$dbl_max_def/" \ |
---|
1960 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
1961 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1962 | fi |
---|
1963 | fi |
---|
1964 | fi |
---|
1965 | |
---|
1966 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1967 | echo Deleting ${LIB}/$file\; no fixes were needed. |
---|
1968 | rm -f ${LIB}/$file |
---|
1969 | else |
---|
1970 | # Find any include directives that use "file". |
---|
1971 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1972 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1973 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1974 | done |
---|
1975 | fi |
---|
1976 | fi |
---|
1977 | |
---|
1978 | # Remove erroneous parentheses in sym.h on Alpha OSF/1. |
---|
1979 | file=sym.h |
---|
1980 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
1981 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
1982 | chmod +w ${LIB}/$file 2>/dev/null |
---|
1983 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
1984 | fi |
---|
1985 | |
---|
1986 | if [ -r ${LIB}/$file ]; then |
---|
1987 | echo Fixing $file |
---|
1988 | sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \ |
---|
1989 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
1990 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
1991 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
1992 | rm -f ${LIB}/$file |
---|
1993 | else |
---|
1994 | # Find any include directives that use "file". |
---|
1995 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
1996 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
1997 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
1998 | done |
---|
1999 | fi |
---|
2000 | fi |
---|
2001 | |
---|
2002 | # Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn} |
---|
2003 | # in string.h on sysV68 |
---|
2004 | # Correct the return type for strlen in string.h on Lynx. |
---|
2005 | # Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0. |
---|
2006 | # Add missing const for strdup on OSF/1 V3.0. |
---|
2007 | # On sysV88 layout is slightly different. |
---|
2008 | file=string.h |
---|
2009 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2010 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2011 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2012 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2013 | fi |
---|
2014 | |
---|
2015 | if [ -r ${LIB}/$file ]; then |
---|
2016 | echo Fixing $file, mem{ccpy,chr,cpy,set} and str{len,spn,cspn} return value |
---|
2017 | sed -e 's/extern[ ]*int[ ]*strlen();/extern unsigned int strlen();/' \ |
---|
2018 | -e 's/extern[ ]*int[ ]*ffs[ ]*(long);/extern int ffs(int);/' \ |
---|
2019 | -e 's/strdup(char \*s1);/strdup(const char *s1);/' \ |
---|
2020 | -e '/^extern char$/N' \ |
---|
2021 | -e 's/^extern char\(\n \*memccpy(),\)$/extern void\1/'\ |
---|
2022 | -e '/^ strncmp(),$/N'\ |
---|
2023 | -e 's/^\( strncmp()\),\n\( strlen(),\)$/\1;\ |
---|
2024 | extern unsigned int\ |
---|
2025 | \2/'\ |
---|
2026 | -e '/^extern int$/N'\ |
---|
2027 | -e 's/^extern int\(\n strlen(),\)/extern size_t\1/' \ |
---|
2028 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2029 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2030 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2031 | rm -f ${LIB}/$file |
---|
2032 | else |
---|
2033 | # Find any include directives that use "file". |
---|
2034 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2035 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2036 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2037 | done |
---|
2038 | fi |
---|
2039 | fi |
---|
2040 | |
---|
2041 | # Correct the return type for strlen in strings.h in SunOS 4. |
---|
2042 | file=strings.h |
---|
2043 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2044 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2045 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2046 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2047 | fi |
---|
2048 | |
---|
2049 | if [ -r ${LIB}/$file ]; then |
---|
2050 | echo Fixing $file |
---|
2051 | sed -e 's/int[ ]*strlen();/__SIZE_TYPE__ strlen();/' \ |
---|
2052 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2053 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2054 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2055 | rm -f ${LIB}/$file |
---|
2056 | else |
---|
2057 | # Find any include directives that use "file". |
---|
2058 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2059 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2060 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2061 | done |
---|
2062 | fi |
---|
2063 | fi |
---|
2064 | |
---|
2065 | # Delete the '#define void int' line from curses.h on Lynx |
---|
2066 | file=curses.h |
---|
2067 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2068 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2069 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2070 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2071 | fi |
---|
2072 | |
---|
2073 | if [ -r ${LIB}/$file ]; then |
---|
2074 | echo Fixing $file |
---|
2075 | sed -e '/#[ ]*define[ ][ ]*void[ ]int/d' \ |
---|
2076 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2077 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2078 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2079 | rm -f ${LIB}/$file |
---|
2080 | else |
---|
2081 | # Find any include directives that use "file". |
---|
2082 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2083 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2084 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2085 | done |
---|
2086 | fi |
---|
2087 | fi |
---|
2088 | |
---|
2089 | # Fix `typedef struct term;' on hppa1.1-hp-hpux9. |
---|
2090 | file=curses.h |
---|
2091 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2092 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2093 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2094 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2095 | fi |
---|
2096 | |
---|
2097 | if [ -r ${LIB}/$file ]; then |
---|
2098 | echo Fixing $file |
---|
2099 | sed -e 's/^[ ]*typedef[ ][ ]*\(struct[ ][ ]*term[ ]*;[ ]*\)$/\1/' \ |
---|
2100 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2101 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2102 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2103 | rm -f ${LIB}/$file |
---|
2104 | else |
---|
2105 | # Find any include directives that use "file". |
---|
2106 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2107 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2108 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2109 | done |
---|
2110 | fi |
---|
2111 | fi |
---|
2112 | |
---|
2113 | # For C++, avoid any typedef or macro definition of bool, and use the |
---|
2114 | # built in type instead. |
---|
2115 | for files in curses.h; do |
---|
2116 | if [ -r $file ] && egrep bool $file >/dev/null 2>&1; then |
---|
2117 | if [ ! -r ${LIB}/$file ]; then |
---|
2118 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2119 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2120 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2121 | fi |
---|
2122 | |
---|
2123 | echo Fixing $file |
---|
2124 | sed -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/i\ |
---|
2125 | #ifndef __cplusplus |
---|
2126 | '\ |
---|
2127 | -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/a\ |
---|
2128 | #endif |
---|
2129 | '\ |
---|
2130 | -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/i\ |
---|
2131 | #ifndef __cplusplus |
---|
2132 | '\ |
---|
2133 | -e '/^typedef[ ][ ]*char[ ][ ]*bool[ ]*;/a\ |
---|
2134 | #endif |
---|
2135 | '\ |
---|
2136 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2137 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2138 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2139 | rm -f ${LIB}/$file |
---|
2140 | else |
---|
2141 | # Find any include directives that use "file". |
---|
2142 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2143 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2144 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2145 | done |
---|
2146 | fi |
---|
2147 | fi |
---|
2148 | done |
---|
2149 | |
---|
2150 | # Fix incorrect S_IF* definitions on m88k-sysv3. |
---|
2151 | file=sys/stat.h |
---|
2152 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2153 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2154 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2155 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2156 | fi |
---|
2157 | |
---|
2158 | if [ -r ${LIB}/$file ]; then |
---|
2159 | echo Fixing $file |
---|
2160 | sed -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(S_IF[A-Z][A-Z][A-Z][A-Z]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \ |
---|
2161 | -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \ |
---|
2162 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2163 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2164 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2165 | rm -f ${LIB}/$file |
---|
2166 | else |
---|
2167 | # Find any include directives that use "file". |
---|
2168 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2169 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2170 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2171 | done |
---|
2172 | fi |
---|
2173 | fi |
---|
2174 | |
---|
2175 | # Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX. |
---|
2176 | for file in stdio.h stdlib.h; do |
---|
2177 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2178 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2179 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2180 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2181 | fi |
---|
2182 | |
---|
2183 | if [ -r ${LIB}/$file ]; then |
---|
2184 | echo Fixing $file, getopt declaration |
---|
2185 | sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \ |
---|
2186 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2187 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2188 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2189 | rm -f ${LIB}/$file |
---|
2190 | else |
---|
2191 | # Find any include directives that use "file". |
---|
2192 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2193 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2194 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2195 | done |
---|
2196 | fi |
---|
2197 | fi |
---|
2198 | done |
---|
2199 | |
---|
2200 | # Fix __page_size* declarations in pthread.h AIX 4.1.[34]. |
---|
2201 | # The original ones fail if uninitialized externs are not common. |
---|
2202 | # This is the default for all ANSI standard C++ compilers. |
---|
2203 | for file in pthread.h; do |
---|
2204 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2205 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2206 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2207 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2208 | fi |
---|
2209 | |
---|
2210 | if [ -r ${LIB}/$file ]; then |
---|
2211 | echo Fixing $file, __page_size* declarations |
---|
2212 | sed -e 's/^int __page_size/extern int __page_size/' \ |
---|
2213 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2214 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2215 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2216 | rm -f ${LIB}/$file |
---|
2217 | else |
---|
2218 | # Find any include directives that use "file". |
---|
2219 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2220 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2221 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2222 | done |
---|
2223 | fi |
---|
2224 | fi |
---|
2225 | done |
---|
2226 | |
---|
2227 | # Determine if we're on Interactive Unix 2.2 or later, in which case we |
---|
2228 | # need to fix some additional files. This is the same test for ISC that |
---|
2229 | # Autoconf uses. |
---|
2230 | if test -d /etc/conf/kconfig.d \ |
---|
2231 | && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1; then |
---|
2232 | echo "Fixing ISC __STDC__ goof in several files..." |
---|
2233 | for name in stdio.h math.h ctype.h sys/limits.h sys/fcntl.h sys/dirent.h; do |
---|
2234 | echo $name |
---|
2235 | if test -r ${LIB}/$name; then |
---|
2236 | file=${LIB}/$name |
---|
2237 | else |
---|
2238 | file=${INPUT}/$name |
---|
2239 | fi |
---|
2240 | # On Interactive 2.2, certain traditional Unix definitions |
---|
2241 | # (notably getc and putc in stdio.h) are omitted if __STDC__ is |
---|
2242 | # defined, not just if _POSIX_SOURCE is defined. This makes it |
---|
2243 | # impossible to compile any nontrivial program except with -posix. |
---|
2244 | sed \ |
---|
2245 | 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \ |
---|
2246 | < $file > ${LIB}/$name. |
---|
2247 | mv ${LIB}/$name. ${LIB}/$name |
---|
2248 | done |
---|
2249 | |
---|
2250 | echo "Fixing ISC fmod declaration" |
---|
2251 | # This one's already been fixed for other things. |
---|
2252 | file=${LIB}/math.h |
---|
2253 | sed 's/fmod(double)/fmod(double, double)/' <$file >$file. |
---|
2254 | mv $file. $file |
---|
2255 | |
---|
2256 | echo "Fixing nested comments in ISC <sys/limits.h>" |
---|
2257 | file=sys/limits.h |
---|
2258 | sed '/CHILD_MAX/s,/\* Max, Max,' < ${INPUT}/$file >${LIB}/$file. |
---|
2259 | sed '/OPEN_MAX/s,/\* Max, Max,' < ${LIB}/$file. >${LIB}/$file |
---|
2260 | fi |
---|
2261 | |
---|
2262 | # These files in Sun OS 4.x use /**/ to concatenate tokens. |
---|
2263 | for file in sparc/asm_linkage.h sun3/asm_linkage.h sun3x/asm_linkage.h \ |
---|
2264 | sun4/asm_linkage.h sun4c/asm_linkage.h sun4m/asm_linkage.h \ |
---|
2265 | sun4c/debug/asm_linkage.h sun4m/debug/asm_linkage.h; |
---|
2266 | do |
---|
2267 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2268 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2269 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2270 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2271 | fi |
---|
2272 | |
---|
2273 | if [ -r ${LIB}/$file ]; then |
---|
2274 | sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.sed |
---|
2275 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2276 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2277 | rm -f ${LIB}/$file |
---|
2278 | else |
---|
2279 | # Find any include directives that use "file". |
---|
2280 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2281 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2282 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2283 | done |
---|
2284 | fi |
---|
2285 | fi |
---|
2286 | done |
---|
2287 | |
---|
2288 | # These files in ARM/RISCiX use /**/ to concatenate tokens. |
---|
2289 | for file in arm/as_support.h arm/mc_type.h arm/xcb.h dev/chardefmac.h \ |
---|
2290 | dev/ps_irq.h dev/screen.h dev/scsi.h sys/tty.h Xm.acorn/XmP.h |
---|
2291 | do |
---|
2292 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2293 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2294 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2295 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2296 | fi |
---|
2297 | |
---|
2298 | if [ -r ${LIB}/$file ]; then |
---|
2299 | sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.sed |
---|
2300 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2301 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2302 | rm -f ${LIB}/$file |
---|
2303 | else |
---|
2304 | # Find any include directives that use "file". |
---|
2305 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2306 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2307 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2308 | done |
---|
2309 | fi |
---|
2310 | fi |
---|
2311 | done |
---|
2312 | |
---|
2313 | # libm.a on m88k-motorola-sysv3 contains a stupid optimization for function |
---|
2314 | # hypot(), which returns the second argument without even looking at its value |
---|
2315 | # if the other is 0.0 |
---|
2316 | # Another drawback is that fix-header doesn't fix fabs' prototype, and I have |
---|
2317 | # no idea why. |
---|
2318 | file=math.h |
---|
2319 | if [ $target_canonical = m88k-motorola-sysv3 ]; then |
---|
2320 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2321 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2322 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2323 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2324 | fi |
---|
2325 | |
---|
2326 | if [ -r ${LIB}/$file ]; then |
---|
2327 | echo Fixing $file, fabs/hypot definition |
---|
2328 | sed \ |
---|
2329 | -e 's/extern double floor(), ceil(), fmod(), fabs();/extern double floor(), ceil(), fmod(), fabs _PARAMS((double));/' \ |
---|
2330 | -e '/^extern double hypot();$/a\ |
---|
2331 | \/* Workaround a stupid Motorola optimization if one\ |
---|
2332 | of x or y is 0.0 and the other is negative! *\/\ |
---|
2333 | #ifdef __STDC__\ |
---|
2334 | static __inline__ double fake_hypot (double x, double y)\ |
---|
2335 | #else\ |
---|
2336 | static __inline__ double fake_hypot (x, y)\ |
---|
2337 | double x, y;\ |
---|
2338 | #endif\ |
---|
2339 | {\ |
---|
2340 | return fabs (hypot (x, y));\ |
---|
2341 | }\ |
---|
2342 | #define hypot fake_hypot |
---|
2343 | ' \ |
---|
2344 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2345 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2346 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2347 | rm -f ${LIB}/$file |
---|
2348 | fi |
---|
2349 | fi |
---|
2350 | fi |
---|
2351 | |
---|
2352 | # math.h on SunOS 4 puts the declaration of matherr before the definition |
---|
2353 | # of struct exception, so the prototype (added by fixproto) causes havoc. |
---|
2354 | file=math.h |
---|
2355 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2356 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2357 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2358 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2359 | fi |
---|
2360 | |
---|
2361 | if [ -r ${LIB}/$file ]; then |
---|
2362 | echo Fixing $file, matherr declaration |
---|
2363 | sed -e '/^struct exception/,$b' \ |
---|
2364 | -e '/matherr/i\ |
---|
2365 | struct exception; |
---|
2366 | '\ |
---|
2367 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2368 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2369 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2370 | rm -f ${LIB}/$file |
---|
2371 | else |
---|
2372 | # Find any include directives that use "file". |
---|
2373 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2374 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2375 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2376 | done |
---|
2377 | fi |
---|
2378 | fi |
---|
2379 | |
---|
2380 | # assert.h and sys/mman.h on HP/UX are not C++ ready, even though |
---|
2381 | # NO_IMPLICIT_EXTERN_C is defined on HP/UX. |
---|
2382 | for file in assert.h sys/mman.h; do |
---|
2383 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2384 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2385 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2386 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2387 | fi |
---|
2388 | |
---|
2389 | if [ -r ${LIB}/$file ]; then |
---|
2390 | if egrep '"C"' ${LIB}/$file >/dev/null 2>&1 \ |
---|
2391 | || egrep '__BEGIN_DECLS' ${LIB}/$file >/dev/null 2>&1; then |
---|
2392 | true |
---|
2393 | else |
---|
2394 | echo Fixing $file |
---|
2395 | echo '#ifdef __cplusplus |
---|
2396 | extern "C" { |
---|
2397 | #endif' > ${LIB}/${file}.sed |
---|
2398 | cat ${LIB}/${file} >> ${LIB}/${file}.sed |
---|
2399 | echo '#ifdef __cplusplus |
---|
2400 | } |
---|
2401 | #endif' >> ${LIB}/${file}.sed |
---|
2402 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2403 | fi |
---|
2404 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2405 | rm -f ${LIB}/$file |
---|
2406 | else |
---|
2407 | # Find any include directives that use "file". |
---|
2408 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2409 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2410 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2411 | done |
---|
2412 | fi |
---|
2413 | fi |
---|
2414 | done |
---|
2415 | |
---|
2416 | # check for broken assert.h that needs stdio.h or stdlib.h |
---|
2417 | file=assert.h |
---|
2418 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2419 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2420 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2421 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2422 | fi |
---|
2423 | |
---|
2424 | if [ -r ${LIB}/$file ]; then |
---|
2425 | if grep 'stderr' ${LIB}/$file >/dev/null 2>/dev/null; then |
---|
2426 | if grep 'include.*stdio.h' ${LIB}/$file >/dev/null 2>/dev/null; then |
---|
2427 | true |
---|
2428 | else |
---|
2429 | echo "Fixing $file (needs stdio.h)" |
---|
2430 | echo '#include <stdio.h>' >>${LIB}/$file |
---|
2431 | fi |
---|
2432 | fi |
---|
2433 | if grep 'exit *(' ${LIB}/$file >/dev/null 2>/dev/null || |
---|
2434 | grep 'abort *(' ${LIB}/$file >/dev/null 2>/dev/null; then |
---|
2435 | if grep 'include.*stdlib.h' ${LIB}/$file >/dev/null 2>/dev/null; then |
---|
2436 | true |
---|
2437 | else |
---|
2438 | echo "Fixing $file (needs stdlib.h)" |
---|
2439 | echo '#ifdef __cplusplus |
---|
2440 | #include <stdlib.h> |
---|
2441 | #endif' >>${LIB}/$file |
---|
2442 | fi |
---|
2443 | fi |
---|
2444 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2445 | rm -f ${LIB}/$file |
---|
2446 | else |
---|
2447 | # Find any include directives that use "file". |
---|
2448 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2449 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2450 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2451 | done |
---|
2452 | fi |
---|
2453 | fi |
---|
2454 | |
---|
2455 | # Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0 |
---|
2456 | file=unistd.h |
---|
2457 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2458 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2459 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2460 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2461 | fi |
---|
2462 | |
---|
2463 | if [ -r ${LIB}/$file ]; then |
---|
2464 | echo Fixing $file, sbrk declaration |
---|
2465 | sed -e 's/char\([ ]*\*[ ]*sbrk[ ]*(\)/void\1/' \ |
---|
2466 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2467 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2468 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2469 | rm -f ${LIB}/$file |
---|
2470 | else |
---|
2471 | # Find any include directives that use "file". |
---|
2472 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2473 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2474 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2475 | done |
---|
2476 | fi |
---|
2477 | fi |
---|
2478 | |
---|
2479 | # This file on SunOS 4 has a very large macro. When the sed loop |
---|
2480 | # tries pull it in, it overflows the pattern space size of the SunOS |
---|
2481 | # sed (GNU sed does not have this problem). Since the file does not |
---|
2482 | # require fixing, we remove it from the fixed directory. |
---|
2483 | file=sundev/ipi_error.h |
---|
2484 | if [ -r ${LIB}/$file ]; then |
---|
2485 | echo "Removing incorrect fix to SunOS <sundev/ipi_error.h>" |
---|
2486 | rm -f ${LIB}/$file |
---|
2487 | fi |
---|
2488 | |
---|
2489 | # Put cpp wrappers around these include files to avoid redeclaration |
---|
2490 | # errors during multiple inclusion on m88k-tektronix-sysv3. |
---|
2491 | for file in time.h sys/time.h ; do |
---|
2492 | if egrep '#ifndef' $file >/dev/null 2>&1; then |
---|
2493 | true |
---|
2494 | else |
---|
2495 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2496 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2497 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2498 | fi |
---|
2499 | if [ -r ${LIB}/$file ]; then |
---|
2500 | echo Fixing $file, to protect against multiple inclusion. |
---|
2501 | cpp_wrapper=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'` |
---|
2502 | (echo "#ifndef __GCC_GOT_${cpp_wrapper}_" |
---|
2503 | echo "#define __GCC_GOT_${cpp_wrapper}_" |
---|
2504 | cat ${LIB}/${file} |
---|
2505 | echo '#endif /* !_GCC_GOT_'${cpp_wrapper}_' */') > ${LIB}/${file}.new |
---|
2506 | rm -f ${LIB}/$file; mv ${LIB}/${file}.new ${LIB}/$file |
---|
2507 | fi |
---|
2508 | fi |
---|
2509 | done |
---|
2510 | |
---|
2511 | # Fix fcntl prototype in fcntl.h on LynxOS. |
---|
2512 | file=fcntl.h |
---|
2513 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2514 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2515 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2516 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2517 | fi |
---|
2518 | |
---|
2519 | if [ -r ${LIB}/$file ]; then |
---|
2520 | echo Fixing $file, fcntl declaration |
---|
2521 | sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \ |
---|
2522 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2523 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2524 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2525 | rm -f ${LIB}/$file |
---|
2526 | else |
---|
2527 | # Find any include directives that use "file". |
---|
2528 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2529 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2530 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2531 | done |
---|
2532 | fi |
---|
2533 | fi |
---|
2534 | |
---|
2535 | # Fix definitions of macros used by va-i960.h in VxWorks header file. |
---|
2536 | file=arch/i960/archI960.h |
---|
2537 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2538 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2539 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2540 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2541 | fi |
---|
2542 | |
---|
2543 | if [ -r ${LIB}/$file ]; then |
---|
2544 | echo Fixing $file |
---|
2545 | sed -e 's/__vsiz/__vxvsiz/' -e 's/__vali/__vxvali/' \ |
---|
2546 | -e s'/__vpad/__vxvpad/' -e 's/__alignof__/__vxalignof__/' \ |
---|
2547 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2548 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2549 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2550 | rm -f ${LIB}/$file |
---|
2551 | else |
---|
2552 | # Find any include directives that use "file". |
---|
2553 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2554 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2555 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2556 | done |
---|
2557 | fi |
---|
2558 | fi |
---|
2559 | |
---|
2560 | # Make VxWorks header which is almost gcc ready fully gcc ready. |
---|
2561 | file=types/vxTypesBase.h |
---|
2562 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2563 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2564 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2565 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2566 | fi |
---|
2567 | |
---|
2568 | if [ -r ${LIB}/$file ]; then |
---|
2569 | echo Fixing $file |
---|
2570 | sed -e 's/#ifdef __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__/#if 1/' \ |
---|
2571 | -e '/[ ]size_t/i\ |
---|
2572 | #ifndef _GCC_SIZE_T\ |
---|
2573 | #define _GCC_SIZE_T |
---|
2574 | ' \ |
---|
2575 | -e '/[ ]size_t/a\ |
---|
2576 | #endif |
---|
2577 | ' \ |
---|
2578 | -e '/[ ]ptrdiff_t/i\ |
---|
2579 | #ifndef _GCC_PTRDIFF_T\ |
---|
2580 | #define _GCC_PTRDIFF_T |
---|
2581 | ' \ |
---|
2582 | -e '/[ ]ptrdiff_t/a\ |
---|
2583 | #endif |
---|
2584 | ' \ |
---|
2585 | -e '/[ ]wchar_t/i\ |
---|
2586 | #ifndef _GCC_WCHAR_T\ |
---|
2587 | #define _GCC_WCHAR_T |
---|
2588 | ' \ |
---|
2589 | -e '/[ ]wchar_t/a\ |
---|
2590 | #endif |
---|
2591 | ' \ |
---|
2592 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2593 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2594 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2595 | rm -f ${LIB}/$file |
---|
2596 | else |
---|
2597 | # Find any include directives that use "file". |
---|
2598 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2599 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2600 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2601 | done |
---|
2602 | fi |
---|
2603 | fi |
---|
2604 | |
---|
2605 | # Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>. |
---|
2606 | file=sys/stat.h |
---|
2607 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2608 | mkdir ${LIB}/sys 2>/dev/null |
---|
2609 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2610 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2611 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2612 | fi |
---|
2613 | |
---|
2614 | if [ -r ${LIB}/$file ]; then |
---|
2615 | if egrep '#include' ${LIB}/$file >/dev/null 2>&1; then |
---|
2616 | : |
---|
2617 | else |
---|
2618 | if egrep 'ULONG' ${LIB}/$file >/dev/null 2>&1 \ |
---|
2619 | && [ -r types/vxTypesOld.h ]; then |
---|
2620 | echo Fixing $file |
---|
2621 | sed -e '/#define[ ][ ]*__INCstath/a\ |
---|
2622 | #include <types/vxTypesOld.h> |
---|
2623 | ' \ |
---|
2624 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2625 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2626 | fi |
---|
2627 | fi |
---|
2628 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2629 | rm -f ${LIB}/$file |
---|
2630 | else |
---|
2631 | # Find any include directives that use "file". |
---|
2632 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2633 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2634 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2635 | done |
---|
2636 | fi |
---|
2637 | fi |
---|
2638 | |
---|
2639 | # Fix VxWorks <time.h> to not require including <vxTypes.h>. |
---|
2640 | file=time.h |
---|
2641 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2642 | mkdir ${LIB}/sys 2>/dev/null |
---|
2643 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2644 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2645 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2646 | fi |
---|
2647 | |
---|
2648 | if [ -r ${LIB}/$file ]; then |
---|
2649 | if egrep 'uint_t[ ][ ]*_clocks_per_sec' ${LIB}/$file >/dev/null 2>&1; then |
---|
2650 | echo Fixing $file |
---|
2651 | sed -e 's/uint_t/unsigned int/' ${LIB}/$file > ${LIB}/${file}.sed |
---|
2652 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2653 | fi |
---|
2654 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2655 | rm -f ${LIB}/$file |
---|
2656 | else |
---|
2657 | # Find any include directives that use "file". |
---|
2658 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2659 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2660 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2661 | done |
---|
2662 | fi |
---|
2663 | fi |
---|
2664 | |
---|
2665 | # Fix hpux10.20 <sys/time.h> to avoid invalid forward decl |
---|
2666 | file=sys/time.h |
---|
2667 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2668 | mkdir ${LIB}/sys 2>/dev/null |
---|
2669 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2670 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2671 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2672 | fi |
---|
2673 | |
---|
2674 | if [ -r ${LIB}/$file ]; then |
---|
2675 | if egrep '^extern struct sigevent;' ${LIB}/$file >/dev/null 2>&1; then |
---|
2676 | echo Fixing $file |
---|
2677 | sed -e 's/^extern struct sigevent;/struct sigevent;/' ${LIB}/$file > ${LIB}/${file}.sed |
---|
2678 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2679 | fi |
---|
2680 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2681 | rm -f ${LIB}/$file |
---|
2682 | else |
---|
2683 | # Find any include directives that use "file". |
---|
2684 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2685 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2686 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2687 | done |
---|
2688 | fi |
---|
2689 | fi |
---|
2690 | |
---|
2691 | # Another bad dependency in VxWorks 5.2 <time.h>. |
---|
2692 | file=time.h |
---|
2693 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2694 | mkdir ${LIB}/sys 2>/dev/null |
---|
2695 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2696 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2697 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2698 | fi |
---|
2699 | |
---|
2700 | if [ -r ${LIB}/$file ]; then |
---|
2701 | if egrep VOIDFUNCPTR ${LIB}/$file >/dev/null 2>&1; then |
---|
2702 | if [ -r vxWorks.h ]; then |
---|
2703 | echo Fixing $file |
---|
2704 | sed -e '/VOIDFUNCPTR/i\ |
---|
2705 | #ifndef __gcc_VOIDFUNCPTR_defined\ |
---|
2706 | #ifdef __cplusplus\ |
---|
2707 | typedef void (*__gcc_VOIDFUNCPTR) (...);\ |
---|
2708 | #else\ |
---|
2709 | typedef void (*__gcc_VOIDFUNCPTR) ();\ |
---|
2710 | #endif\ |
---|
2711 | #define __gcc_VOIDFUNCPTR_defined\ |
---|
2712 | #endif |
---|
2713 | ' \ |
---|
2714 | -e 's/VOIDFUNCPTR/__gcc_VOIDFUNCPTR/g' \ |
---|
2715 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2716 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2717 | fi |
---|
2718 | fi |
---|
2719 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2720 | rm -f ${LIB}/$file |
---|
2721 | else |
---|
2722 | # Find any include directives that use "file". |
---|
2723 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2724 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2725 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2726 | done |
---|
2727 | fi |
---|
2728 | fi |
---|
2729 | |
---|
2730 | # This file in A/UX 3.0.x/3.1.x contains an __asm directive for c89; gcc |
---|
2731 | # doesn't understand it. |
---|
2732 | file=sys/param.h |
---|
2733 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2734 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2735 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2736 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2737 | fi |
---|
2738 | |
---|
2739 | if [ -r ${LIB}/$file ]; then |
---|
2740 | echo "Fixing __asm directive in sys/param.h" |
---|
2741 | sed -e 's|#ifndef NOINLINE|#if !defined(NOINLINE) \&\& !defined(__GNUC__)|' \ |
---|
2742 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2743 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2744 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2745 | rm -f ${LIB}/$file |
---|
2746 | else |
---|
2747 | # Find any include directives that use "file". |
---|
2748 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2749 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2750 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2751 | done |
---|
2752 | fi |
---|
2753 | fi |
---|
2754 | |
---|
2755 | # signal.h on SunOS defines signal using (), which causes trouble when |
---|
2756 | # compiling with g++ -pedantic. |
---|
2757 | for file in signal.h sys/signal.h; do |
---|
2758 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2759 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2760 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2761 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2762 | fi |
---|
2763 | |
---|
2764 | if [ -r ${LIB}/$file ]; then |
---|
2765 | echo "Checking for bad C++ prototype in $file" |
---|
2766 | sed -e '/^void (\*signal())();$/i\ |
---|
2767 | #ifdef __cplusplus\ |
---|
2768 | void (*signal(...))(...);\ |
---|
2769 | #else |
---|
2770 | ' \ |
---|
2771 | -e '/^void (\*signal())();$/a\ |
---|
2772 | #endif |
---|
2773 | ' \ |
---|
2774 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2775 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2776 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2777 | rm -f ${LIB}/$file |
---|
2778 | else |
---|
2779 | # Find any include directives that use "file". |
---|
2780 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2781 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2782 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2783 | done |
---|
2784 | fi |
---|
2785 | fi |
---|
2786 | done |
---|
2787 | |
---|
2788 | # sys/signal.h on some versions of AIX uses volatile in the typedef of |
---|
2789 | # sig_atomic_t, which causes gcc to generate a warning about duplicate |
---|
2790 | # volatile when a sig_atomic_t variable is declared volatile, as |
---|
2791 | # required by ANSI C. |
---|
2792 | file=sys/signal.h |
---|
2793 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2794 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2795 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2796 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2797 | fi |
---|
2798 | |
---|
2799 | if [ -r ${LIB}/$file ]; then |
---|
2800 | echo "Checking for duplicate volatile in sys/signal.h" |
---|
2801 | sed -e 's/typedef volatile int sig_atomic_t/typedef int sig_atomic_t/' \ |
---|
2802 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2803 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2804 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2805 | rm -f ${LIB}/$file |
---|
2806 | else |
---|
2807 | # Find any include directives that use "file". |
---|
2808 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2809 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2810 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2811 | done |
---|
2812 | fi |
---|
2813 | fi |
---|
2814 | |
---|
2815 | # Some math.h files define struct exception, which conflicts with |
---|
2816 | # the class exception defined in the C++ file std/stdexcept.h. We |
---|
2817 | # redefine it to __math_exception. This is not a great fix, but I |
---|
2818 | # haven't been able to think of anything better. |
---|
2819 | file=math.h |
---|
2820 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2821 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2822 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2823 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2824 | fi |
---|
2825 | |
---|
2826 | if [ -r ${LIB}/$file ]; then |
---|
2827 | echo Fixing $file, exception |
---|
2828 | sed -e '/struct exception/i\ |
---|
2829 | #ifdef __cplusplus\ |
---|
2830 | #define exception __math_exception\ |
---|
2831 | #endif'\ |
---|
2832 | -e '/struct exception/a\ |
---|
2833 | #ifdef __cplusplus\ |
---|
2834 | #undef exception\ |
---|
2835 | #endif' ${LIB}/$file > ${LIB}/${file}.sed |
---|
2836 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2837 | if egrep 'matherr()' ${LIB}/$file >/dev/null 2>&1; then |
---|
2838 | sed -e '/matherr/i\ |
---|
2839 | #ifdef __cplusplus\ |
---|
2840 | #define exception __math_exception\ |
---|
2841 | #endif'\ |
---|
2842 | -e '/matherr/a\ |
---|
2843 | #ifdef __cplusplus\ |
---|
2844 | #undef exception\ |
---|
2845 | #endif' ${LIB}/$file > ${LIB}/${file}.sed |
---|
2846 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2847 | fi |
---|
2848 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2849 | rm -f ${LIB}/$file |
---|
2850 | else |
---|
2851 | # Find any include directives that use "file". |
---|
2852 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2853 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2854 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2855 | done |
---|
2856 | fi |
---|
2857 | fi |
---|
2858 | |
---|
2859 | # rpc/xdr.h on SunOS needs prototypes for its XDR->xdr_ops function pointers. |
---|
2860 | file=rpc/xdr.h |
---|
2861 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2862 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2863 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2864 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2865 | fi |
---|
2866 | |
---|
2867 | if [ -r ${LIB}/$file ]; then |
---|
2868 | echo "Checking for needed C++ prototype in $file" |
---|
2869 | sed -e 's/^\(.*\)\*\(x_.*\)();\(.*\)/\ |
---|
2870 | #ifdef __cplusplus\ |
---|
2871 | \1*\2(...);\3\ |
---|
2872 | #else\ |
---|
2873 | \1*\2();\3\ |
---|
2874 | #endif/g' \ |
---|
2875 | $LIB/$file > ${LIB}/${file}.sed |
---|
2876 | |
---|
2877 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2878 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2879 | rm -f ${LIB}/$file |
---|
2880 | else |
---|
2881 | # Find any include directives that use "file". |
---|
2882 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2883 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2884 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2885 | done |
---|
2886 | fi |
---|
2887 | fi |
---|
2888 | |
---|
2889 | # sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by |
---|
2890 | # defining regex.h types. This causes C++ library build and usage failures. |
---|
2891 | # Fixing this correctly requires checking and modifying 3 files. |
---|
2892 | for file in reg_types.h regex.h sys/lc_core.h; do |
---|
2893 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2894 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2895 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2896 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2897 | fi |
---|
2898 | done |
---|
2899 | if [ -r ${LIB}/reg_types.h ]; then |
---|
2900 | if egrep '} regex_t;' ${LIB}/reg_types.h >/dev/null 2>&1; then |
---|
2901 | if [ -r ${LIB}/sys/lc_core.h ]; then |
---|
2902 | if egrep ' regex_t ' ${LIB}/sys/lc_core.h >/dev/null 2>&1; then |
---|
2903 | if [ -r ${LIB}/regex.h ]; then |
---|
2904 | if egrep '__regex_t' ${LIB}/regex.h >/dev/null 2>&1; then |
---|
2905 | true; |
---|
2906 | else |
---|
2907 | echo Fixing reg_types.h, regex.h, sys/lc_core.h |
---|
2908 | for file in reg_types.h sys/lc_core.h; do |
---|
2909 | sed -e 's/regex_t/__regex_t/g' \ |
---|
2910 | -e 's/regoff_t/__regoff_t/g' \ |
---|
2911 | -e 's/regmatch_t/__regmatch_t/g' \ |
---|
2912 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2913 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2914 | done |
---|
2915 | sed -e '/#include <reg_types.h>/a\ |
---|
2916 | typedef __regex_t regex_t;\ |
---|
2917 | typedef __regoff_t regoff_t;\ |
---|
2918 | typedef __regmatch_t regmatch_t;\ |
---|
2919 | ' \ |
---|
2920 | ${LIB}/regex.h > ${LIB}/regex.h.sed |
---|
2921 | rm -f ${LIB}/regex.h; mv ${LIB}/regex.h.sed ${LIB}/regex.h |
---|
2922 | fi |
---|
2923 | fi |
---|
2924 | fi |
---|
2925 | fi |
---|
2926 | fi |
---|
2927 | fi |
---|
2928 | for file in reg_types.h regex.h sys/lc_core.h; do |
---|
2929 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2930 | rm -f ${LIB}/$file |
---|
2931 | else |
---|
2932 | # Find any include directives that use "file". |
---|
2933 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2934 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2935 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2936 | done |
---|
2937 | fi |
---|
2938 | done |
---|
2939 | |
---|
2940 | # AIX headers define NULL to be cast to a void pointer, which is illegal |
---|
2941 | # in ANSI C++. |
---|
2942 | for file in curses.h dbm.h locale.h stdio.h stdlib.h string.h time.h unistd.h sys/dir.h sys/param.h sys/types.h ; do |
---|
2943 | if [ -r $file ] && [ ! -r ${LIB}/$file ]; then |
---|
2944 | cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file" |
---|
2945 | chmod +w ${LIB}/$file 2>/dev/null |
---|
2946 | chmod a+r ${LIB}/$file 2>/dev/null |
---|
2947 | fi |
---|
2948 | |
---|
2949 | if [ -r ${LIB}/$file ]; then |
---|
2950 | if egrep '#.*define.*NULL.*void' ${LIB}/$file >/dev/null 2>&1; then |
---|
2951 | echo "Fixing $file, bad NULL macro" |
---|
2952 | sed -e 's/^#[ ]*define[ ]*NULL[ ]*((void[ ]*\*)0)/#define NULL 0/' \ |
---|
2953 | ${LIB}/$file > ${LIB}/${file}.sed |
---|
2954 | rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file |
---|
2955 | if cmp $file ${LIB}/$file >/dev/null 2>&1; then |
---|
2956 | rm -f ${LIB}/$file |
---|
2957 | else |
---|
2958 | # Find any include directives that use "file". |
---|
2959 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2960 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2961 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2962 | done |
---|
2963 | fi |
---|
2964 | fi |
---|
2965 | fi |
---|
2966 | done |
---|
2967 | |
---|
2968 | # HPUX 10.x sys/param.h defines MAXINT which clashes with values.h |
---|
2969 | file=sys/param.h |
---|
2970 | base=`basename $file` |
---|
2971 | if [ -r ${LIB}/$file ]; then |
---|
2972 | file_to_fix=${LIB}/$file |
---|
2973 | else |
---|
2974 | if [ -r ${INPUT}/$file ]; then |
---|
2975 | file_to_fix=${INPUT}/$file |
---|
2976 | else |
---|
2977 | file_to_fix="" |
---|
2978 | fi |
---|
2979 | fi |
---|
2980 | if [ \! -z "$file_to_fix" ]; then |
---|
2981 | echo Checking $file_to_fix |
---|
2982 | sed -e '/[ ]MAXINT[ ]/i\ |
---|
2983 | #ifndef MAXINT |
---|
2984 | '\ |
---|
2985 | -e '/[ ]MAXINT[ ]/a\ |
---|
2986 | #endif |
---|
2987 | ' $file_to_fix > /tmp/$base |
---|
2988 | if cmp $file_to_fix /tmp/$base >/dev/null 2>&1; then \ |
---|
2989 | true |
---|
2990 | else |
---|
2991 | echo Fixed $file_to_fix |
---|
2992 | rm -f ${LIB}/$file |
---|
2993 | cp /tmp/$base ${LIB}/$file |
---|
2994 | chmod a+r ${LIB}/$file |
---|
2995 | # Find any include directives that use "file". |
---|
2996 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
2997 | dir=`echo $file | sed -e s'|/[^/]*$||'` |
---|
2998 | required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include" |
---|
2999 | done |
---|
3000 | fi |
---|
3001 | rm -f /tmp/$base |
---|
3002 | fi |
---|
3003 | |
---|
3004 | |
---|
3005 | # This loop does not appear to do anything, because it uses file |
---|
3006 | # rather than $file when setting target. It also appears to be |
---|
3007 | # unnecessary, since the main loop processes symbolic links. |
---|
3008 | #if $LINKS; then |
---|
3009 | # echo 'Making internal symbolic non-directory links' |
---|
3010 | # cd ${INPUT} |
---|
3011 | # files=`find . -type l -print` |
---|
3012 | # for file in $files; do |
---|
3013 | # dest=`ls -ld $file | sed -n 's/.*-> //p'` |
---|
3014 | # if expr "$dest" : '[^/].*' > /dev/null; then |
---|
3015 | # target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"` |
---|
3016 | # if [ -f $target ]; then |
---|
3017 | # ln -s $dest ${LIB}/$file >/dev/null 2>&1 |
---|
3018 | # fi |
---|
3019 | # fi |
---|
3020 | # done |
---|
3021 | #fi |
---|
3022 | |
---|
3023 | # Make sure that any include files referenced using double quotes |
---|
3024 | # exist in the fixed directory. This comes last since otherwise |
---|
3025 | # we might end up deleting some of these files "because they don't |
---|
3026 | # need any change." |
---|
3027 | set x $required |
---|
3028 | shift |
---|
3029 | while [ $# != 0 ]; do |
---|
3030 | newreq= |
---|
3031 | while [ $# != 0 ]; do |
---|
3032 | # $1 is the directory to copy from, $2 is the unfixed file, |
---|
3033 | # $3 is the fixed file name. |
---|
3034 | cd ${INPUT} |
---|
3035 | cd $1 |
---|
3036 | if [ -r $2 ] && [ ! -r $3 ]; then |
---|
3037 | cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2" |
---|
3038 | chmod +w $3 2>/dev/null |
---|
3039 | chmod a+r $3 2>/dev/null |
---|
3040 | echo Copied $2 |
---|
3041 | for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do |
---|
3042 | dir=`echo $2 | sed -e s'|/[^/]*$||'` |
---|
3043 | dir2=`echo $3 | sed -e s'|/[^/]*$||'` |
---|
3044 | newreq="$newreq $1 $dir/$include $dir2/$include" |
---|
3045 | done |
---|
3046 | fi |
---|
3047 | shift; shift; shift |
---|
3048 | done |
---|
3049 | set x $newreq |
---|
3050 | shift |
---|
3051 | done |
---|
3052 | |
---|
3053 | echo 'Cleaning up DONE files.' |
---|
3054 | cd $LIB |
---|
3055 | find . -name DONE -exec rm -f '{}' ';' |
---|
3056 | |
---|
3057 | echo 'Removing unneeded directories:' |
---|
3058 | cd $LIB |
---|
3059 | files=`find . -type d -print | sort -r` |
---|
3060 | for file in $files; do |
---|
3061 | rmdir $LIB/$file > /dev/null 2>&1 |
---|
3062 | done |
---|
3063 | |
---|
3064 | |
---|
3065 | exit 0 |
---|