]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/fixincludes
*** empty log message ***
[thirdparty/gcc.git] / gcc / fixincludes
CommitLineData
c61a25b1
DM
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.)
10INPUT=${2-${INPUT-/usr/include}}
11
12# This prevents /bin/ex from failing if the current terminal type is
13# unrecognizable.
14TERM=unknown
15export TERM
16
17# Directory in which to store the results.
18LIB=${1-${LIB-/usr/local/lib/gcc-include}}
19
20# Make sure it exists.
21if [ ! -d $LIB ]; then
22 mkdir $LIB || exit 1
23fi
24
25# Make LIB absolute.
26cd $LIB; LIB=`pwd`
27
28# Fail if no arg to specify a directory for the output.
29if [ x$1 = x ]
30then echo fixincludes: no output directory specified
31exit 1
32fi
33
34echo 'Building fixincludes in ' ${LIB}
35
36# Determine whether this system has symbolic links.
37if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
38 rm -f $LIB/ShouldNotExist
39 LINKS=true
40else
41 LINKS=false
42fi
43
44echo 'Making directories:'
45cd ${INPUT}
3308e40a
RS
46# Find all directories and all symlinks that point to directories.
47files=` find . -type d -print | sed '/^.$/d'
48 $LINKS && find . -type l -exec test -d '{}' \; -print`
c61a25b1
DM
49for file in $files; do
50 rm -rf $LIB/$file
51 if [ ! -d $LIB/$file ]
52 then mkdir $LIB/$file
53 fi
54done
55
56# treetops gets an alternating list
57# of old directories to copy
58# and the new directories to copy to.
59treetops="${INPUT} ${LIB}"
60
61if $LINKS; then
62 echo 'Making internal symbolic directory links'
63 for file in $files; do
64 dest=`ls -ld $file | sed -n 's/.*-> //p'`
65 if [ "$dest" ]; then
66 cwd=`pwd`
67 # In case $dest is relative, get to $file's dir first.
68 cd ${INPUT}
69 cd `echo ./$file | sed -n 's&[^/]*$&&p'`
70 # Check that the target directory exists.
71 # Redirections changed to avoid bug in sh on Ultrix.
72 (cd $dest) > /dev/null 2>&1
73 if [ $? = 0 ]; then
74 cd $dest
75 # X gets the dir that the link actually leads to.
76 x=`pwd`
77 # If link leads back into ${INPUT},
78 # make a similar link here.
79 if expr $x : "${INPUT}/.*" > /dev/null; then
80 # Y gets the actual target dir name, relative to ${INPUT}.
81 y=`echo $x | sed -n "s&${INPUT}/&&p"`
82 echo $file '->' $y ': Making link'
83 rm -fr ${LIB}/$file > /dev/null 2>&1
84 ln -s ${LIB}/$y ${LIB}/$file > /dev/null 2>&1
85 else
86 # If the link is to outside ${INPUT},
87 # treat this directory as if it actually contained the files.
88# This line used to have $dest instead of $x.
89# $dest seemed to be wrong for links found in subdirectories
90# of ${INPUT}. Does this change break anything?
91 treetops="$treetops $x ${LIB}/$file"
92 fi
93 fi
94 cd $cwd
95 fi
96 done
97fi
98
99set - $treetops
100while [ $# != 0 ]; do
101 # $1 is an old directory to copy, and $2 is the new directory to copy to.
102 echo "Finding header files in $1:"
103 cd ${INPUT}
104 cd $1
105 files=`find . -name '*.h' -type f -print`
106 echo 'Checking header files:'
107# Note that BSD43_* are used on recent MIPS systems.
108 for file in $files; do
109# This call to egrep is essential, since checking a file with egrep
110# is much faster than actually trying to fix it.
3308e40a
RS
111# It is also essential that most files *not* match!
112# Thus, matching every #endif is unacceptable.
c61a25b1
DM
113# But the argument to egrep must be kept small, or many versions of egrep
114# won't be able to handle it.
75251fe0 115# rms: I removed `|#[el].*if.*[^/ ]' because it made egrep fail.
3308e40a 116 if egrep '[ _]_IO|CTRL|#define.NULL|#[el]*if.*([0-9]|sparc|vax|sun|pyr)' $file > /dev/null; then
c61a25b1
DM
117 echo Fixing $file
118 if [ -r $file ]; then
119 cp $file $2/$file >/dev/null 2>&1 \
120 || echo "Can't copy $file"
121 chmod +w $2/$file
75251fe0
DM
122# Following two lines removed.
123# s%^\([ ]*#[ ]*endif[ ]*\)\([^/ ].*\)$%\1/* \2 */%
124# s%^\([ ]*#[ ]*else[ ]*\)\([^/ ].*\)$%\1/* \2 */%
125
c61a25b1
DM
126 sed -e '
127 :loop
128 /\\$/ N
129 /\\$/ b loop
c61a25b1
DM
130 /[ ]_IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
131 /[ ]BSD43__IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
132 /#define._IO/ s/'\''x'\''/x/g
133 /#define.BSD43__IO/ s/'\''x'\''/x/g
134 /[^A-Z]CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
135 /#define.CTRL/ s/'\''c'\''/c/g
136 /#define._CTRL/ s/'\''c'\''/c/g
137 /#define.BSD43_CTRL/ s/'\''c'\''/c/g
138 /#[a-z]*if.*[ (]m68k/ s/\([^_]\)m68k/\1__m68k__/g
139 /#[a-z]*if.*[ (]__i386/ s/__i386/__i386__/g
140 /#[a-z]*if.*[ (]i386/ s/\([^_]\)i386/\1__i386__/g
141 /#[a-z]*if.*[ (]sparc/ s/\([^_]\)sparc/\1__sparc__/g
142 /#[a-z]*if.*[ (]mc68000/ s/\([^_]\)mc68000/\1__mc68000__/g
143 /#[a-z]*if.*[ (]vax/ s/\([^_]\)vax/\1__vax__/g
144 /#[a-z]*if.*[ (]sun/ s/\([^_]\)\(sun[a-z0-9]*\)\([^a-z0-9_]\)/\1__\2__\3/g
145 /#[a-z]*if.*[ (]sun/ s/\([^_]\)\(sun[a-z0-9]*\)$/\1__\2__/g
146 /#[a-z]*if.*[ (]ns32000/ s/\([^_]\)ns32000/\1__ns32000__/g
147 /#[a-z]*if.*[ (]pyr/ s/\([^_]\)pyr/\1__pyr__/g
148 /#[a-z]*if.*[ (]is68k/ s/\([^_]\)is68k/\1__is68k__/g
149 /#define.NULL[ ]/ i\
150 #undef NULL
151 ' $2/$file > $2/$file.sed
152 mv $2/$file.sed $2/$file
153 if cmp $file $2/$file >/dev/null 2>&1; then
154 echo Deleting $2/$file\; no fixes were needed.
155 rm $2/$file
156 fi
157 fi
158 fi
159 done
160 shift; shift
161done
162
163cd ${INPUT}
164
165# Fix one other error in this file: a mismatched quote not inside a C comment.
166file=sundev/vuid_event.h
167if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
168 mkdir ${LIB}/sundev 2>/dev/null
169 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
170 chmod +w ${LIB}/$file 2>/dev/null
171fi
172
173if [ -r ${LIB}/$file ]; then
174 echo Fixing $file comment
175 ex ${LIB}/$file <<EOF
176 g/doesn't/s/doesn't/does not/
177 wq
178EOF
179 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
180 echo Deleting ${LIB}/$file\; no fixes were needed.
181 rm ${LIB}/$file
182 fi
183fi
184
6dc42e49 185# Fix this Sun file to avoid interfering with stddef.h.
c61a25b1
DM
186file=sys/stdtypes.h
187if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
188 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
189 chmod +w ${LIB}/$file 2>/dev/null
190fi
191
192if [ -r ${LIB}/$file ]; then
193 echo Fixing $file
194 ex ${LIB}/$file <<EOF
195 /size_t.*;/
196 i
3308e40a
RS
197#ifndef _GCC_SIZE_T
198#define _GCC_SIZE_T
c61a25b1
DM
199.
200 /size_t/+1
201 i
202#endif
203.
204 /ptrdiff_t.*;/
205 i
3308e40a
RS
206#ifndef _GCC_PTRDIFF_T
207#define _GCC_PTRDIFF_T
c61a25b1
DM
208.
209 /ptrdiff_t/+1
210 i
211#endif
212.
213 /wchar_t.*;/
214 i
3308e40a
RS
215#ifndef _GCC_WCHAR_T
216#define _GCC_WCHAR_T
c61a25b1
DM
217.
218 /wchar_t/+1
219 i
220#endif
221.
222 wq
223EOF
224 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
225 echo Deleting ${LIB}/$file\; no fixes were needed.
226 rm ${LIB}/$file
227 fi
228fi
229
6dc42e49 230# Fix this file to avoid interfering with stddef.h.
c61a25b1
DM
231file=sys/types.h
232if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
233 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
234 chmod +w ${LIB}/$file 2>/dev/null
235fi
236
237if [ -r ${LIB}/$file ]; then
238 echo Fixing $file
239 ex ${LIB}/$file <<EOF
240 /size_t.*;/
241 i
3308e40a
RS
242#ifndef _GCC_SIZE_T
243#define _GCC_SIZE_T
c61a25b1
DM
244.
245 /size_t/+1
246 i
247#endif
248.
249 wq
250EOF
251 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
252 echo Deleting ${LIB}/$file\; no fixes were needed.
253 rm ${LIB}/$file
254 fi
255fi
256
257# Fix an error in this file: a missing semi-colon at the end of the statsswtch
258# structure definition.
259file=rpcsvc/rstat.h
260if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
261 mkdir ${LIB}/rpcsvc 2>/dev/null
262 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
263 chmod +w ${LIB}/$file 2>/dev/null
264fi
265
266if [ -r ${LIB}/$file ]; then
267 echo Fixing $file, definition of statsswtch
268 ex ${LIB}/$file <<EOF
269 g/boottime$/s//&;/
270 wq
271EOF
272 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
273 echo Deleting ${LIB}/$file\; no fixes were needed.
274 rm ${LIB}/$file
275 fi
276fi
277
278# Fix an error in this file: a missing semi-colon at the end of the nodeent
279# structure definition.
280file=netdnet/dnetdb.h
281if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
282 mkdir ${LIB}/netdnet 2>/dev/null
283 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
284 chmod +w ${LIB}/$file 2>/dev/null
285fi
286
287if [ -r ${LIB}/$file ]; then
288 echo Fixing $file, definition of nodeent
289 ex ${LIB}/$file <<EOF
290 g/na_addr/s//&;/
291 wq
292EOF
293 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
294 echo Deleting ${LIB}/$file\; no fixes were needed.
295 rm ${LIB}/$file
296 fi
297fi
298
299# Check for bad #ifdef line (in Ultrix 4.1)
300file=sys/file.h
301if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
302 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
303 chmod +w ${LIB}/$file 2>/dev/null
304fi
305
306if [ -r ${LIB}/$file ]; then
307 echo Fixing $file, bad \#ifdef line
308 ex ${LIB}/$file <<EOF
309 g/^#ifdef KERNEL && !defined/
310 s/#ifdef KERNEL && !defined/#if defined(KERNEL) \&\& !defined/
311 wq
312EOF
313 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
314 echo Deleting ${LIB}/$file\; no fixes were needed.
315 rm ${LIB}/$file
316 fi
317fi
318
75251fe0
DM
319# Remove nested comments created by #endifs in a comment (Ultrix 4.1)
320# Only needed if commenting out junk after #endif.
321#file=signal.h
322#if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
323# cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
324# chmod +w ${LIB}/$file 2>/dev/null
325#fi
326#
327#if [ -r ${LIB}/$file ]; then
328# echo Fixing $file, nested comments
329# sed -e 's/#endif.*/#endif/' ${LIB}/$file > ${LIB}/${file}.sed
330# rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
331# if cmp $file ${LIB}/$file >/dev/null 2>&1; then
332# echo Deleting ${LIB}/$file\; no fixes were needed.
333# rm -f ${LIB}/$file
334# fi
335#fi
336
c61a25b1
DM
337# Check for superfluous `static' (in Ultrix 4.2)
338file=machine/cpu.h
339if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
340 mkdir ${LIB}/machine 2>/dev/null
341 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
342 chmod +w ${LIB}/$file 2>/dev/null
343fi
344
345if [ -r ${LIB}/$file ]; then
346 echo Fixing $file, superfluous static
347 ex ${LIB}/$file <<EOF
348 g/^static struct tlb_pid_state/
349 s/static//
350 wq
351EOF
352 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
353 echo Deleting ${LIB}/$file\; no fixes were needed.
354 rm ${LIB}/$file
355 else
356# This file has an alternative name, mips/cpu.h. Fix that name, too.
357 if cmp machine/cpu.h mips/cpu.h > /dev/null 2>& 1; then
358 mkdir ${LIB}/mips 2>&-
359 ln ${LIB}/$file ${LIB}/mips/cpu.h
360 fi
361 fi
362fi
363
75251fe0 364# Incorrect sprintf declaration in X11/Xmu.h
c61a25b1
DM
365file=X11/Xmu.h
366if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
367 mkdir ${LIB}/X11 2>/dev/null
368 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
369 chmod +w ${LIB}/$file 2>/dev/null
370fi
371
372if [ -r ${LIB}/$file ]; then
373 echo Fixing $file sprintf declaration
374 ex ${LIB}/$file <<EOF
375 /^extern char \* sprintf();$/c
376#ifndef __STDC__
377extern char * sprintf();
378#endif /* !defined __STDC__ */
379.
380 wq
381EOF
382 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
383 echo Deleting ${LIB}/$file\; no fixes were needed.
384 rm ${LIB}/$file
385 fi
386fi
387
388# Check for missing ';' in struct
389file=netinet/ip.h
390if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
391 mkdir ${LIB}/netinet 2>/dev/null
392 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
393 chmod +w ${LIB}/$file 2>/dev/null
394fi
395
396if [ -r ${LIB}/$file ]; then
397 echo Fixing $file
398 sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.sed
399 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
400 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
401 echo Deleting ${LIB}/$file\; no fixes were needed.
402 rm -f ${LIB}/$file
403 fi
404fi
405
75251fe0 406# Fix the CAT macro in SunOS memvar.h.
c61a25b1
DM
407file=pixrect/memvar.h
408if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
409 mkdir ${LIB}/pixrect 2>/dev/null
410 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
411 chmod +w ${LIB}/$file 2>/dev/null
412fi
413
414if [ -r ${LIB}/$file ]; then
415 echo Fixing $file
416 sed -e '/^#define.CAT(a,b)/ i\
417#ifdef __STDC__ \
418#define CAT(a,b) a##b\
419#else
420/^#define.CAT(a,b)/ a\
421#endif
422' ${LIB}/$file > ${LIB}/${file}.sed
423 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
424 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
425 echo Deleting ${LIB}/$file\; no fixes were needed.
426 rm -f ${LIB}/$file
427 fi
428fi
429
430# Check for yet more missing ';' in struct (in SunOS 4.0.x)
431file=rpcsvc/rusers.h
432if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
433 mkdir ${LIB}/rpcsvc 2>/dev/null
434 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
435 chmod +w ${LIB}/$file 2>/dev/null
436fi
437
438if [ -r ${LIB}/$file ]; then
439 echo Fixing $file
440 sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.sed
441 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
442 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
443 echo Deleting ${LIB}/$file\; no fixes were needed.
444 rm -f ${LIB}/$file
445 fi
446fi
447
448# Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
449file=stdlib.h
450if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
451 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
452 chmod +w ${LIB}/$file 2>/dev/null
453fi
454
455if [ -r ${LIB}/$file ]; then
456 echo Fixing $file
457 sed -e 's/int abort/void abort/g' \
25f75d8a
RS
458 -e 's/int free/void free/g' \
459 -e 's/char \* calloc/void \* calloc/g' \
460 -e 's/char \* malloc/void \* malloc/g' \
461 -e 's/char \* realloc/void \* realloc/g' \
c61a25b1
DM
462 -e 's/int exit/void exit/g' ${LIB}/$file > ${LIB}/${file}.sed
463 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
464 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
465 echo Deleting ${LIB}/$file\; no fixes were needed.
466 rm -f ${LIB}/$file
467 fi
468fi
469
470# Fix bogus comment in <locale.h> on SunOS 4.1.
471file=locale.h
472if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
473 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
474 chmod +w ${LIB}/$file 2>/dev/null
475fi
476
477if [ -r ${LIB}/$file ]; then
478 echo Fixing $file
479 sed -e 's%#endif / \*%#endif /\* %g' ${LIB}/$file > ${LIB}/${file}.sed
480 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
481 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
482 echo Deleting ${LIB}/$file\; no fixes were needed.
483 rm -f ${LIB}/$file
484 fi
485fi
486
487# Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
488file=hsfs/hsfs_spec.h
489if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
490 mkdir ${LIB}/hsfs 2>/dev/null
491 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
492 chmod +w ${LIB}/$file 2>/dev/null
493fi
494
495if [ -r ${LIB}/$file ]; then
496 echo Fixing $file
497 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
498 ${LIB}/$file > ${LIB}/${file}.sed
499 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
500 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
501 echo Deleting ${LIB}/$file\; no fixes were needed.
502 rm -f ${LIB}/$file
503 fi
504fi
505
506# Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
507file=hsfs/hsnode.h
508if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
509 mkdir ${LIB}/hsfs 2>/dev/null
510 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
511 chmod +w ${LIB}/$file 2>/dev/null
512fi
513
514if [ -r ${LIB}/$file ]; then
515 echo Fixing $file
516 sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
517 ${LIB}/$file > ${LIB}/${file}.sed
518 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
519 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
520 echo Deleting ${LIB}/$file\; no fixes were needed.
521 rm -f ${LIB}/$file
522 fi
523fi
524
525# Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
526file=hsfs/iso_spec.h
527if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
528 mkdir ${LIB}/hsfs 2>/dev/null
529 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
530 chmod +w ${LIB}/$file 2>/dev/null
531fi
532
533if [ -r ${LIB}/$file ]; then
534 echo Fixing $file
535 sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
536 ${LIB}/$file > ${LIB}/${file}.sed
537 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
538 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
539 echo Deleting ${LIB}/$file\; no fixes were needed.
540 rm -f ${LIB}/$file
541 fi
542fi
543
75251fe0
DM
544# Incorrect #include in Sony News-OS 3.2.
545file=machine/machparam.h
546if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
547 mkdir ${LIB}/machine 2>/dev/null
548 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
549 chmod +w ${LIB}/$file 2>/dev/null
550fi
551
552if [ -r ${LIB}/$file ]; then
553 echo Fixing $file, incorrect \#include
554 sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
555 ${LIB}/$file > ${LIB}/${file}.sed
556 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
557 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
558 echo Deleting ${LIB}/$file\; no fixes were needed.
559 rm -f ${LIB}/$file
560 fi
561fi
562
563# Multiline comment after typedef on IRIX 4.0.1.
564file=sys/types.h
565if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
566 mkdir ${LIB}/sys 2>/dev/null
567 cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
568 chmod +w ${LIB}/$file 2>/dev/null
569fi
570
571if [ -r ${LIB}/$file ]; then
572 echo Fixing $file, comment in the middle of \#ifdef
573 sed -e 's@type of the result@type of the result */@' \
574 -e 's@of the sizeof@/* of the sizeof@' \
575 ${LIB}/$file > ${LIB}/${file}.sed
576 rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
577 if cmp $file ${LIB}/$file >/dev/null 2>&1; then
578 echo Deleting ${LIB}/$file\; no fixes were needed.
579 rm -f ${LIB}/$file
580 fi
581fi
582
c61a25b1
DM
583echo 'Removing unneeded directories:'
584cd $LIB
585files=`find . -type d -print | sort -r`
586for file in $files; do
587 rmdir $LIB/$file > /dev/null 2>&1
588done
589
590if $LINKS; then
591 echo 'Making internal symbolic non-directory links'
592 cd ${INPUT}
593 files=`find . -type l -print`
594 for file in $files; do
595 dest=`ls -ld $file | sed -n 's/.*-> //p'`
596 if expr "$dest" : '[^/].*' > /dev/null; then
597 target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
598 if [ -f $target ]; then
599 ln -s $dest ${LIB}/$file >/dev/null 2>&1
600 fi
601 fi
602 done
603fi
604
605exit 0