|
|
1.1 root 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:
1.1.1.5 root 12: # Directory in which to store the results.
13: LIB=${1?"fixincludes: output directory not specified"}
1.1.1.4 root 14:
15: # Define PWDCMD as a command to use to get the working dir
16: # in the form that we want.
17: PWDCMD=pwd
18: case "`pwd`" in
19: //*)
20: # On an Apollo, discard everything before `/usr'.
21: PWDCMD="eval pwd | sed -e 's,.*/usr/,/usr/,'"
22: ;;
23: esac
1.1 root 24:
1.1.1.5 root 25: # Original directory.
26: ORIGDIR=`${PWDCMD}`
1.1 root 27:
28: # Make sure it exists.
29: if [ ! -d $LIB ]; then
30: mkdir $LIB || exit 1
31: fi
32:
1.1.1.5 root 33: # Make LIB absolute only if needed to avoid problems with the amd.
34: case $LIB in
35: /*)
36: ;;
37: *)
38: cd $LIB; LIB=`${PWDCMD}`
39: ;;
40: esac
41:
1.1 root 42: # Fail if no arg to specify a directory for the output.
43: if [ x$1 = x ]
44: then echo fixincludes: no output directory specified
45: exit 1
46: fi
47:
1.1.1.4 root 48: echo Building fixed headers in ${LIB}
1.1 root 49:
50: # Determine whether this system has symbolic links.
51: if ln -s X $LIB/ShouldNotExist 2>/dev/null; then
52: rm -f $LIB/ShouldNotExist
53: LINKS=true
1.1.1.6 root 54: elif ln -s X /tmp/ShouldNotExist 2>/dev/null; then
55: rm -f /tmp/ShouldNotExist
56: LINKS=true
1.1 root 57: else
58: LINKS=false
59: fi
60:
1.1.1.4 root 61: echo Finding directories and links to directories
1.1 root 62: cd ${INPUT}
1.1.1.2 root 63: # Find all directories and all symlinks that point to directories.
1.1.1.4 root 64: # Put the list in $files.
65: # Each time we find a symlink, add it to newdirs
66: # so that we do another find within the dir the link points to.
67: # Note that $files may have duplicates in it;
68: # later parts of this file are supposed to ignore them.
69: dirs="."
70: levels=2
71: while [ -n "$dirs" ] && [ $levels -gt 0 ]
72: do
73: levels=`expr $levels - 1`
74: newdirs=
75: for d in $dirs
76: do
77: echo " Searching $INPUT/$d"
78: if [ "$d" != . ]
79: then
80: d=$d/.
81: fi
82:
83: # Find all directories under $d, relative to $d, excluding $d itself.
84: files="$files `find $d -type d -print | \
85: sed -e '/\/\.$/d' -e '/^\.$/d'`"
86: # Find all links to directories.
87: # Using `-exec test -d' in find fails on some systems,
88: # and trying to run test via sh fails on others,
89: # so this is the simplest alternative left.
90: # First find all the links, then test each one.
91: theselinks=
92: $LINKS && \
93: theselinks=`find $d -type l -print`
94: for d1 in $theselinks --dummy--
95: do
96: # If the link points to a directory,
97: # add that dir to $newdirs
98: if [ -d $d1 ]
99: then
1.1.1.7 ! root 100: files="$files $d1"
! 101: if [ "`ls -ld $d1 | sed -n 's/.*-> //p'`" != "." ]
! 102: then
! 103: newdirs="$newdirs $d1"
! 104: fi
1.1.1.4 root 105: fi
106: done
107: done
108:
109: dirs="$newdirs"
110: done
111:
112: dirs=
113: echo "All directories (including links to directories):"
114: echo $files
115:
1.1 root 116: for file in $files; do
117: rm -rf $LIB/$file
118: if [ ! -d $LIB/$file ]
119: then mkdir $LIB/$file
120: fi
121: done
1.1.1.4 root 122: mkdir $LIB/root
1.1 root 123:
124: # treetops gets an alternating list
125: # of old directories to copy
126: # and the new directories to copy to.
127: treetops="${INPUT} ${LIB}"
128:
129: if $LINKS; then
1.1.1.4 root 130: echo 'Making symbolic directory links'
1.1 root 131: for file in $files; do
132: dest=`ls -ld $file | sed -n 's/.*-> //p'`
133: if [ "$dest" ]; then
1.1.1.4 root 134: cwd=`${PWDCMD}`
1.1 root 135: # In case $dest is relative, get to $file's dir first.
136: cd ${INPUT}
137: cd `echo ./$file | sed -n 's&[^/]*$&&p'`
138: # Check that the target directory exists.
139: # Redirections changed to avoid bug in sh on Ultrix.
140: (cd $dest) > /dev/null 2>&1
141: if [ $? = 0 ]; then
142: cd $dest
143: # X gets the dir that the link actually leads to.
1.1.1.4 root 144: x=`${PWDCMD}`
1.1.1.7 ! root 145: # Canonicalize ${INPUT} now to minimize the time an
! 146: # automounter has to change the result of ${PWDCMD}.
! 147: cinput=`cd ${INPUT}; ${PWDCMD}`
1.1.1.4 root 148: # If a link points to ., make a similar link to .
1.1.1.7 ! root 149: if [ $x = ${cinput} ]; then
1.1.1.4 root 150: echo $file '->' . ': Making link'
151: rm -fr ${LIB}/$file > /dev/null 2>&1
152: ln -s . ${LIB}/$file > /dev/null 2>&1
1.1 root 153: # If link leads back into ${INPUT},
154: # make a similar link here.
1.1.1.7 ! root 155: elif expr $x : "${cinput}/.*" > /dev/null; then
1.1 root 156: # Y gets the actual target dir name, relative to ${INPUT}.
1.1.1.7 ! root 157: y=`echo $x | sed -n "s&${cinput}/&&p"`
1.1.1.6 root 158: # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
159: dots=`echo "$file" |
160: sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
161: echo $file '->' $dots$y ': Making link'
1.1 root 162: rm -fr ${LIB}/$file > /dev/null 2>&1
1.1.1.6 root 163: ln -s $dots$y ${LIB}/$file > /dev/null 2>&1
1.1 root 164: else
1.1.1.4 root 165: # If the link is to a dir $target outside ${INPUT},
166: # repoint the link at ${INPUT}/root$target
167: # and process $target into ${INPUT}/root$target
1.1 root 168: # treat this directory as if it actually contained the files.
1.1.1.4 root 169: echo $file '->' root$x ': Making link'
170: if [ -d $LIB/root$x ]
171: then true
172: else
173: dirname=root$x/
174: dirmade=.
175: cd $LIB
176: while [ x$dirname != x ]; do
177: component=`echo $dirname | sed -e 's|/.*$||'`
178: mkdir $component >/dev/null 2>&1
179: cd $component
180: dirmade=$dirmade/$component
181: dirname=`echo $dirname | sed -e 's|[^/]*/||'`
182: done
183: fi
1.1.1.5 root 184: # Duplicate directory structure created in ${LIB}/$file in new
185: # root area.
186: for file2 in $files; do
187: case $file2 in
188: $file/./*)
189: dupdir=${LIB}/root$x/`echo $file2 | sed -n "s|^${file}/||p"`
190: echo "Duplicating ${file}'s ${dupdir}"
191: if [ -d ${dupdir} ]
192: then true
193: else
194: mkdir ${dupdir}
195: fi
196: ;;
197: *)
198: ;;
199: esac
200: done
1.1.1.7 ! root 201: # Get the path from ${LIB} to $file, accounting for symlinks.
! 202: parent=`echo "$file" | sed -e 's@/[^/]*$@@'`
! 203: libabs=`cd ${LIB}; ${PWDCMD}`
! 204: file2=`cd ${LIB}; cd $parent; ${PWDCMD} | sed -e "s@^${libabs}@@"`
1.1.1.6 root 205: # DOTS is the relative path from ${LIB}/$file's dir back to ${LIB}.
1.1.1.7 ! root 206: dots=`echo "$file2" | sed -e 's@/[^/]*@../@g'`
1.1.1.4 root 207: rm -fr ${LIB}/$file > /dev/null 2>&1
1.1.1.6 root 208: ln -s ${dots}root$x ${LIB}/$file > /dev/null 2>&1
1.1.1.4 root 209: treetops="$treetops $x ${LIB}/root$x"
1.1 root 210: fi
211: fi
212: cd $cwd
213: fi
214: done
215: fi
216:
1.1.1.6 root 217: required=
1.1.1.5 root 218: set x $treetops
219: shift
1.1 root 220: while [ $# != 0 ]; do
221: # $1 is an old directory to copy, and $2 is the new directory to copy to.
222: cd ${INPUT}
223: cd $1
1.1.1.4 root 224: # The same dir can appear more than once in treetops.
225: # There's no need to scan it more than once.
226: if [ -f $2/DONE ]
227: then
228: files=
229: else
230: touch $2/DONE
231: echo Fixing directory $1 into $2
232: # Check .h files which are symlinks as well as those which are files.
233: # A link to a header file will not be processed by anything but this.
234: if $LINKS; then
235: files=`find . -name '*.h' \( -type f -o -type l \) -print`
236: else
237: files=`find . -name '*.h' -type f -print`
238: fi
239: echo Checking header files
240: fi
1.1 root 241: # Note that BSD43_* are used on recent MIPS systems.
242: for file in $files; do
243: # This call to egrep is essential, since checking a file with egrep
244: # is much faster than actually trying to fix it.
1.1.1.2 root 245: # It is also essential that most files *not* match!
246: # Thus, matching every #endif is unacceptable.
1.1 root 247: # But the argument to egrep must be kept small, or many versions of egrep
248: # won't be able to handle it.
1.1.1.5 root 249: #
250: # We use the pattern [!-.0-~] instead of [^/ ] to match a noncomment
251: # following #else or #endif because some buggy egreps think [^/] matches
252: # newline, and they thus think `#else ' matches `#e[ndiflse]*[ ]+[^/ ]'.
253: #
254: # We use the pattern [^a-zA-Z0-9_][_a-ce-km-z][a-z0-9] to match an identifier
255: # following #if or #elif that is not surrounded by __. The `a-ce-km-z'
256: # in this pattern lacks `d' and `l'; this means we don't worry about
257: # identifiers starting with `d' or `l'. This is OK, since none of the
258: # identifiers below start with `d' or `l'. It also greatly improves
259: # performance, since many files contain lines of the form `#if ... defined ...'
260: # or `#if lint'.
1.1.1.7 ! root 261: if egrep '//|[ _]_IO|CTRL|^#define.NULL|^#e[nl][ds][ief]*[ ]+[!-.0-~]|^#[el]*if.*[^a-zA-Z0-9_][_a-ce-km-zA-Z][a-zA-Z0-9]' $file >/dev/null; then
1.1 root 262: if [ -r $file ]; then
263: cp $file $2/$file >/dev/null 2>&1 \
264: || echo "Can't copy $file"
265: chmod +w $2/$file
1.1.1.5 root 266: chmod a+r $2/$file
267: # Here is how the sed commands in braces work.
268: # (It doesn't work to put the comments inside the sed commands.)
269: # Surround each word with spaces, to simplify matching below.
270: # ANSIfy each pre-ANSI machine-dependent symbol
271: # by surrounding it with __ __.
272: # Remove the spaces that we inserted around each word.
1.1 root 273: sed -e '
274: :loop
275: /\\$/ N
276: /\\$/ b loop
1.1.1.6 root 277: s%^\([ ]*#[ ]*else\)[ ]*/[^*].*%\1%
278: s%^\([ ]*#[ ]*else\)[ ]*[^/ ].*%\1%
279: s%^\([ ]*#[ ]*endif\)[ ]*/[^*].*%\1%
280: s%^\([ ]*#[ ]*endif\)[ ]*\*[^/].*%\1%
281: s%^\([ ]*#[ ]*endif\)[ ]*[^/* ].*%\1%
1.1.1.5 root 282: /\/\/[^*]/ s|//\(.*\)$|/*\1*/|
283: /[ ]_IO[A-Z]*[ ]*(/ s/\(_IO[A-Z]*[ ]*(\)\(.\),/\1'\''\2'\'',/
1.1 root 284: /[ ]BSD43__IO[A-Z]*[ ]*(/ s/(\(.\),/('\''\1'\'',/
1.1.1.6 root 285: /#define._IO/ s/'\''\([cgxtf]\)'\''/\1/g
1.1.1.5 root 286: /#define.BSD43__IO/ s/'\''\([cgx]\)'\''/\1/g
287: /[^A-Z0-9_]CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
288: /[^A-Z0-9]_CTRL[ ]*(/ s/\([^'\'']\))/'\''\1'\'')/
1.1.1.6 root 289: /#define[ ]*[ ]CTRL/ s/'\''\([cgx]\)'\''/\1/g
290: /#define[ ]*[ ]_CTRL/ s/'\''\([cgx]\)'\''/\1/g
1.1.1.5 root 291: /#define.BSD43_CTRL/ s/'\''\([cgx]\)'\''/\1/g
292: /#[el]*if/{
293: s/[a-zA-Z0-9_][a-zA-Z0-9_]*/ & /g
294:
295: s/ bsd4\([0-9]\) / __bsd4\1__ /g
1.1.1.7 ! root 296: s/ _*host_mips / __host_mips__ /g
1.1.1.5 root 297: s/ _*i386 / __i386__ /g
1.1.1.7 ! root 298: s/ M32 / __M32__ /g
1.1.1.5 root 299: s/ is68k / __is68k__ /g
300: s/ m68k / __m68k__ /g
301: s/ mc680\([0-9]\)0 / __mc680\10__ /g
1.1.1.7 ! root 302: s/ m88k / __m88k__ /g
! 303: s/ _*mips / __mips__ /g
1.1.1.5 root 304: s/ news\([0-9]*\) / __news\1__ /g
305: s/ ns32000 / __ns32000__ /g
1.1.1.7 ! root 306: s/ pdp11 / __pdp11__ /g
1.1.1.5 root 307: s/ pyr / __pyr__ /g
308: s/ sony_news / __sony_news__ /g
309: s/ sparc / __sparc__ /g
310: s/ sun\([a-z0-9]*\) / __sun\1__ /g
1.1.1.7 ! root 311: s/ tower\([_0-9]*\) / __tower\1__ /g
! 312: s/ u370 / __u370__ /g
! 313: s/ u3b\([0-9]*\) / __u3b\1__ /g
1.1.1.5 root 314: s/ unix / __unix__ /g
315: s/ vax / __vax__ /g
1.1.1.7 ! root 316: s/ _*MIPSE\([LB]\) / __MIPSE\1__ /g
! 317: s/ _*R\([34]\)000 / __R\1000__ /g
! 318: s/ _*SYSTYPE_\([A-Z0-9]*\) / __SYSTYPE_\1__ /g
1.1.1.5 root 319:
320: s/ \([a-zA-Z0-9_][a-zA-Z0-9_]*\) /\1/g
321: }
1.1.1.3 root 322: /^#define.NULL[ ]/ i\
1.1 root 323: #undef NULL
1.1.1.5 root 324: ' $2/$file > $2/$file.
325: mv $2/$file. $2/$file
1.1.1.7 ! root 326: if cmp $file $2/$file >/dev/null 2>&1 \
! 327: || egrep 'This file is part of the GNU C Library' $2/$file >/dev/null 2>&1; then
1.1 root 328: rm $2/$file
1.1.1.5 root 329: else
330: echo Fixed $file
1.1.1.6 root 331: # Find any include directives that use "file".
332: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $2/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
333: dir=`echo $file | sed -e s'|/[^/]*$||'`
334: required="$required $1 $dir/$include $2/$dir/$include"
335: done
1.1 root 336: fi
337: fi
338: fi
339: done
340: shift; shift
341: done
342:
343: cd ${INPUT}
344:
1.1.1.7 ! root 345: # Install the proper definition of the three standard types in header files
! 346: # that they come from.
! 347: for file in sys/types.h stdlib.h sys/stdtypes.h stddef.h memory.h unistd.h; do
1.1.1.5 root 348: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
349: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
350: chmod +w ${LIB}/$file 2>/dev/null
351: chmod a+r ${LIB}/$file 2>/dev/null
352: fi
353:
354: if [ -r ${LIB}/$file ]; then
1.1.1.7 ! root 355: echo Fixing size_t, ptrdiff_t and wchar_t in $file
! 356: sed \
! 357: -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/i\
! 358: #ifndef __SIZE_TYPE__\
! 359: #define __SIZE_TYPE__ long unsigned int\
! 360: #endif
! 361: ' \
! 362: -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]size_t/typedef __SIZE_TYPE__ size_t/' \
! 363: -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/i\
! 364: #ifndef __PTRDIFF_TYPE__\
! 365: #define __PTRDIFF_TYPE__ long int\
! 366: #endif
! 367: ' \
! 368: -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]ptrdiff_t/typedef __PTRDIFF_TYPE__ ptrdiff_t/' \
! 369: -e '/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/i\
! 370: #ifndef __WCHAR_TYPE__\
! 371: #define __WCHAR_TYPE__ int\
! 372: #endif
! 373: ' \
! 374: -e 's/typedef[ ][ ]*[a-z_][ a-z_]*[ ]wchar_t/typedef __WCHAR_TYPE__ wchar_t/' \
! 375: ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.5 root 376: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
377: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
378: rm ${LIB}/$file
1.1.1.7 ! root 379: else
! 380: # Find any include directives that use "file".
! 381: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 382: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 383: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 384: done
1.1.1.5 root 385: fi
386: fi
387: done
388:
1.1 root 389: # Fix one other error in this file: a mismatched quote not inside a C comment.
390: file=sundev/vuid_event.h
1.1.1.2 root 391: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
392: mkdir ${LIB}/sundev 2>/dev/null
393: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
394: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 395: chmod a+r ${LIB}/$file 2>/dev/null
1.1 root 396: fi
397:
398: if [ -r ${LIB}/$file ]; then
399: echo Fixing $file comment
1.1.1.5 root 400: sed -e "s/doesn't/does not/" ${LIB}/$file > ${LIB}/${file}.sed
401: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
402: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
403: rm ${LIB}/$file
1.1.1.7 ! root 404: else
! 405: # Find any include directives that use "file".
! 406: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 407: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 408: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 409: done
1.1.1.5 root 410: fi
411: fi
412:
413: # Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
414: file=sunwindow/win_cursor.h
415: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
416: # mkdir ${LIB}/sunwindow 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: fi
420: if [ -r ${LIB}/$file ]; then
421: echo Fixing $file
422: sed -e "s/ecd.cursor/ecd_cursor/" ${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: rm ${LIB}/$file
1.1.1.7 ! root 426: else
! 427: # Find any include directives that use "file".
! 428: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 429: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 430: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 431: done
1.1.1.5 root 432: fi
433: fi
434: file=sunwindow/win_lock.h
435: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
436: # mkdir ${LIB}/sunwindow 2>/dev/null
437: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
438: chmod +w ${LIB}/$file 2>/dev/null
439: fi
440: if [ -r ${LIB}/$file ]; then
441: echo Fixing $file
442: sed -e "s/ecd.cursor/ecd_cursor/" ${LIB}/$file > ${LIB}/${file}.sed
443: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1 root 444: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
445: rm ${LIB}/$file
1.1.1.7 ! root 446: else
! 447: # Find any include directives that use "file".
! 448: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 449: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 450: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 451: done
1.1 root 452: fi
453: fi
454:
1.1.1.3 root 455: # Fix this Sun file to avoid interfering with stddef.h.
1.1 root 456: file=sys/stdtypes.h
1.1.1.2 root 457: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
458: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
459: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 460: chmod a+r ${LIB}/$file 2>/dev/null
1.1 root 461: fi
462:
463: if [ -r ${LIB}/$file ]; then
1.1.1.2 root 464: echo Fixing $file
1.1.1.6 root 465: sed -e '/[ ]size_t.*;/i\
1.1.1.5 root 466: #ifndef _GCC_SIZE_T\
1.1.1.7 ! root 467: #define _GCC_SIZE_T
! 468: ' \
1.1.1.6 root 469: -e '/[ ]size_t.*;/a\
1.1.1.7 ! root 470: #endif
! 471: ' \
1.1.1.6 root 472: -e '/[ ]ptrdiff_t.*;/i\
1.1.1.5 root 473: #ifndef _GCC_PTRDIFF_T\
1.1.1.7 ! root 474: #define _GCC_PTRDIFF_T
! 475: ' \
1.1.1.6 root 476: -e '/[ ]ptrdiff_t.*;/a\
1.1.1.7 ! root 477: #endif
! 478: ' \
1.1.1.6 root 479: -e '/[ ]wchar_t.*;/i\
1.1.1.5 root 480: #ifndef _GCC_WCHAR_T\
1.1.1.7 ! root 481: #define _GCC_WCHAR_T
! 482: ' \
1.1.1.6 root 483: -e '/[ ]wchar_t.*;/a\
1.1.1.7 ! root 484: #endif
! 485: ' ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.5 root 486: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1 root 487: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
488: rm ${LIB}/$file
1.1.1.7 ! root 489: else
! 490: # Find any include directives that use "file".
! 491: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 492: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 493: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 494: done
1.1 root 495: fi
496: fi
497:
1.1.1.6 root 498: # Fix this ARM/RISCiX file to avoid interfering with the use of __wchar_t
499: # in cc1plus.
500: file=stdlib.h
501: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
502: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
503: chmod +w ${LIB}/$file 2>/dev/null
504: chmod a+r ${LIB}/$file 2>/dev/null
505: fi
506:
507: if [ -r ${LIB}/$file ]; then
508: echo Fixing $file
509: sed -e "s/\(#[ ]*ifndef[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
510: -e "s/\(#[ ]*define[ ]*\)__wchar_t/\1_GCC_WCHAR_T/" \
511: ${LIB}/$file > ${LIB}/${file}.sed
512: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
513: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
514: rm ${LIB}/$file
1.1.1.7 ! root 515: else
! 516: # Find any include directives that use "file".
! 517: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 518: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 519: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 520: done
! 521: fi
! 522: fi
! 523:
! 524: # Fix this ARM/RISCiX file where ___type is a Compiler hint that is specific to
! 525: # the Norcroft compiler.
! 526: file=X11/Intrinsic.h
! 527: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 528: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 529: chmod +w ${LIB}/$file 2>/dev/null
! 530: chmod a+r ${LIB}/$file 2>/dev/null
! 531: fi
! 532:
! 533: if [ -r ${LIB}/$file ]; then
! 534: echo Fixing $file
! 535: sed -e "s/___type p_type/p_type/" \
! 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: rm ${LIB}/$file
! 540: else
! 541: # Find any include directives that use "file".
! 542: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 543: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 544: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 545: done
1.1.1.6 root 546: fi
547: fi
548:
1.1.1.4 root 549: # Fix this file to avoid interfering with stddef.h, but don't mistakenly
1.1.1.7 ! root 550: # match ssize_t present in AIX for the ps/2, or typedefs which use (but do not
! 551: # set) size_t.
1.1 root 552: file=sys/types.h
1.1.1.2 root 553: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
554: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
555: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 556: chmod a+r ${LIB}/$file 2>/dev/null
1.1 root 557: fi
558:
559: if [ -r ${LIB}/$file ]; then
1.1.1.2 root 560: echo Fixing $file
1.1.1.7 ! root 561: sed -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/i\
1.1.1.5 root 562: #ifndef _GCC_SIZE_T\
1.1.1.7 ! root 563: #define _GCC_SIZE_T
! 564: ' \
! 565: -e '/typedef[ ][ ]*[A-Za-z_][ A-Za-z_]*[ ]size_t/a\
! 566: #endif
! 567: ' ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.5 root 568: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1 root 569: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
570: rm ${LIB}/$file
1.1.1.7 ! root 571: else
! 572: # Find any include directives that use "file".
! 573: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 574: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 575: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 576: done
1.1 root 577: fi
578: fi
579:
1.1.1.6 root 580: # Fix HP's use of ../machine/inline.h to refer to
581: # /usr/include/machine/inline.h
582: file=sys/spinlock.h
583: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
584: cp $file ${LIB}/$file
585: fi
586: if [ -r ${LIB}/$file ] ; then
587: echo Fixing $file
588: sed -e 's,"../machine/inline.h",<machine/inline.h>,' \
589: -e 's,"../machine/psl.h",<machine/psl.h>,' \
590: ${LIB}/$file > ${LIB}/${file}.sed
591: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
592: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
593: rm ${LIB}/$file
1.1.1.7 ! root 594: else
! 595: # Find any include directives that use "file".
! 596: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 597: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 598: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 599: done
1.1.1.6 root 600: fi
601: fi
602:
1.1.1.4 root 603: # Fix an error in this file: the #if says _cplusplus, not the double
604: # underscore __cplusplus that it should be
605: file=tinfo.h
606: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
607: mkdir ${LIB}/rpcsvc 2>/dev/null
608: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
609: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 610: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.4 root 611: fi
612:
613: if [ -r ${LIB}/$file ]; then
614: echo Fixing $file, __cplusplus macro
615: sed -e 's/[ ]_cplusplus/ __cplusplus/' ${LIB}/$file > ${LIB}/${file}.sed
616: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
617: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
618: rm ${LIB}/$file
1.1.1.7 ! root 619: else
! 620: # Find any include directives that use "file".
! 621: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 622: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 623: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 624: done
1.1.1.4 root 625: fi
626: fi
627:
1.1 root 628: # Fix an error in this file: a missing semi-colon at the end of the statsswtch
629: # structure definition.
630: file=rpcsvc/rstat.h
1.1.1.2 root 631: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
632: mkdir ${LIB}/rpcsvc 2>/dev/null
633: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
634: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 635: chmod a+r ${LIB}/$file 2>/dev/null
1.1 root 636: fi
637:
638: if [ -r ${LIB}/$file ]; then
639: echo Fixing $file, definition of statsswtch
1.1.1.5 root 640: sed -e 's/boottime$/boottime;/' ${LIB}/$file > ${LIB}/${file}.sed
641: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1 root 642: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
643: rm ${LIB}/$file
1.1.1.7 ! root 644: else
! 645: # Find any include directives that use "file".
! 646: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 647: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 648: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 649: done
1.1 root 650: fi
651: fi
652:
653: # Fix an error in this file: a missing semi-colon at the end of the nodeent
654: # structure definition.
655: file=netdnet/dnetdb.h
1.1.1.2 root 656: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
657: mkdir ${LIB}/netdnet 2>/dev/null
658: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
659: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 660: chmod a+r ${LIB}/$file 2>/dev/null
1.1 root 661: fi
662:
663: if [ -r ${LIB}/$file ]; then
664: echo Fixing $file, definition of nodeent
1.1.1.5 root 665: sed -e 's/char.*na_addr *$/char *na_addr;/' ${LIB}/$file > ${LIB}/${file}.sed
666: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1 root 667: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
668: rm ${LIB}/$file
1.1.1.7 ! root 669: else
! 670: # Find any include directives that use "file".
! 671: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 672: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 673: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 674: done
1.1 root 675: fi
676: fi
677:
678: # Check for bad #ifdef line (in Ultrix 4.1)
679: file=sys/file.h
1.1.1.2 root 680: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
681: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
682: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 683: chmod a+r ${LIB}/$file 2>/dev/null
1.1 root 684: fi
685:
686: if [ -r ${LIB}/$file ]; then
687: echo Fixing $file, bad \#ifdef line
1.1.1.5 root 688: sed -e 's/#ifdef KERNEL/#if defined(KERNEL)/' ${LIB}/$file > ${LIB}/${file}.sed
689: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1 root 690: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
691: rm ${LIB}/$file
1.1.1.7 ! root 692: else
! 693: # Find any include directives that use "file".
! 694: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 695: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 696: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 697: done
1.1 root 698: fi
699: fi
700:
1.1.1.2 root 701: # Check for superfluous `static' (in Ultrix 4.2)
1.1.1.7 ! root 702: # On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
1.1 root 703: file=machine/cpu.h
1.1.1.2 root 704: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
705: mkdir ${LIB}/machine 2>/dev/null
706: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
707: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 708: chmod a+r ${LIB}/$file 2>/dev/null
1.1 root 709: fi
710:
711: if [ -r ${LIB}/$file ]; then
1.1.1.7 ! root 712: echo Fixing $file, superfluous static and broken includes of other files.
! 713: sed -e 's/^static struct tlb_pid_state/struct tlb_pid_state/' \
! 714: -e 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/' \
! 715: -e 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/' \
! 716: ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.5 root 717: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1 root 718: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
719: rm ${LIB}/$file
720: else
1.1.1.7 ! root 721: # Find any include directives that use "file".
! 722: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 723: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 724: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 725: done
1.1 root 726: # This file has an alternative name, mips/cpu.h. Fix that name, too.
1.1.1.6 root 727: if cmp machine/cpu.h mips/cpu.h > /dev/null 2>&1; then
1.1 root 728: mkdir ${LIB}/mips 2>&-
1.1.1.7 ! root 729: # Don't remove the file first, they may be the same file!
! 730: ln ${LIB}/$file ${LIB}/mips/cpu.h > /dev/null 2>&1
1.1 root 731: fi
732: fi
733: fi
734:
1.1.1.2 root 735: # Incorrect sprintf declaration in X11/Xmu.h
1.1 root 736: file=X11/Xmu.h
1.1.1.2 root 737: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
738: mkdir ${LIB}/X11 2>/dev/null
739: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
740: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 741: chmod a+r ${LIB}/$file 2>/dev/null
1.1 root 742: fi
743:
744: if [ -r ${LIB}/$file ]; then
745: echo Fixing $file sprintf declaration
1.1.1.5 root 746: sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
747: extern char * sprintf();\
748: #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed
749: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1 root 750: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
751: rm ${LIB}/$file
1.1.1.7 ! root 752: else
! 753: # Find any include directives that use "file".
! 754: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 755: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 756: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 757: done
1.1 root 758: fi
759: fi
760:
1.1.1.4 root 761: # Incorrect sprintf declaration in X11/Xmu/Xmu.h
762: # (It's not clear whether the right file name is this or X11/Xmu.h.)
763: file=X11/Xmu/Xmu.h
764: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
765: mkdir ${LIB}/X11/Xmu 2>/dev/null
766: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
767: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 768: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.4 root 769: fi
770:
771: if [ -r ${LIB}/$file ]; then
772: echo Fixing $file sprintf declaration
1.1.1.5 root 773: sed -e 's,^extern char \* sprintf();$,#ifndef __STDC__\
774: extern char * sprintf();\
775: #endif /* !defined __STDC__ */,' ${LIB}/$file > ${LIB}/${file}.sed
776: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1.1.4 root 777: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
778: rm ${LIB}/$file
1.1.1.7 ! root 779: else
! 780: # Find any include directives that use "file".
! 781: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 782: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 783: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 784: done
1.1.1.4 root 785: fi
786: fi
787:
1.1 root 788: # Check for missing ';' in struct
789: file=netinet/ip.h
1.1.1.2 root 790: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
791: mkdir ${LIB}/netinet 2>/dev/null
792: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
793: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 794: chmod a+r ${LIB}/$file 2>/dev/null
1.1 root 795: fi
796:
1.1.1.2 root 797: if [ -r ${LIB}/$file ]; then
798: echo Fixing $file
799: sed -e '/^struct/,/^};/s/}$/};/' ${LIB}/$file > ${LIB}/${file}.sed
800: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
801: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
802: rm -f ${LIB}/$file
1.1.1.7 ! root 803: else
! 804: # Find any include directives that use "file".
! 805: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 806: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 807: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 808: done
1.1.1.2 root 809: fi
810: fi
1.1 root 811:
1.1.1.2 root 812: # Fix the CAT macro in SunOS memvar.h.
1.1 root 813: file=pixrect/memvar.h
1.1.1.2 root 814: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
815: mkdir ${LIB}/pixrect 2>/dev/null
816: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
817: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 818: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2 root 819: fi
820:
821: if [ -r ${LIB}/$file ]; then
822: echo Fixing $file
823: sed -e '/^#define.CAT(a,b)/ i\
1.1 root 824: #ifdef __STDC__ \
825: #define CAT(a,b) a##b\
826: #else
827: /^#define.CAT(a,b)/ a\
828: #endif
1.1.1.2 root 829: ' ${LIB}/$file > ${LIB}/${file}.sed
830: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
831: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
832: rm -f ${LIB}/$file
1.1.1.7 ! root 833: else
! 834: # Find any include directives that use "file".
! 835: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 836: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 837: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 838: done
1.1 root 839: fi
840: fi
841:
842: # Check for yet more missing ';' in struct (in SunOS 4.0.x)
843: file=rpcsvc/rusers.h
1.1.1.2 root 844: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
845: mkdir ${LIB}/rpcsvc 2>/dev/null
846: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
847: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 848: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2 root 849: fi
850:
851: if [ -r ${LIB}/$file ]; then
852: echo Fixing $file
853: sed -e '/^struct/,/^};/s/_cnt$/_cnt;/' ${LIB}/$file > ${LIB}/${file}.sed
854: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
855: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
856: rm -f ${LIB}/$file
1.1.1.7 ! root 857: else
! 858: # Find any include directives that use "file".
! 859: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 860: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 861: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 862: done
1.1 root 863: fi
864: fi
865:
866: # Fix return type of exit and abort in <stdlib.h> on SunOS 4.1.
1.1.1.6 root 867: # Also wrap protection around size_t for m88k-sysv3 systems.
1.1 root 868: file=stdlib.h
1.1.1.2 root 869: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
870: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
871: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 872: chmod a+r ${LIB}/$file 2>/dev/null
1.1 root 873: fi
1.1.1.2 root 874:
875: if [ -r ${LIB}/$file ]; then
876: echo Fixing $file
877: sed -e 's/int abort/void abort/g' \
1.1.1.3 root 878: -e 's/int free/void free/g' \
879: -e 's/char \* calloc/void \* calloc/g' \
880: -e 's/char \* malloc/void \* malloc/g' \
881: -e 's/char \* realloc/void \* realloc/g' \
1.1.1.6 root 882: -e 's/int exit/void exit/g' \
883: -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/i\
884: #ifndef _GCC_SIZE_T\
1.1.1.7 ! root 885: #define _GCC_SIZE_T
! 886: ' \
1.1.1.6 root 887: -e '/typedef[ a-zA-Z_]*[ ]size_t[ ]*;/a\
1.1.1.7 ! root 888: #endif
! 889: ' \
1.1.1.6 root 890: ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.2 root 891: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
892: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1 root 893: rm -f ${LIB}/$file
1.1.1.7 ! root 894: else
! 895: # Find any include directives that use "file".
! 896: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 897: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 898: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 899: done
1.1 root 900: fi
901: fi
902:
1.1.1.3 root 903: # Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
904: file=malloc.h
905: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
906: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
907: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 908: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.3 root 909: fi
910:
911: if [ -r ${LIB}/$file ]; then
912: echo Fixing $file
913: sed -e 's/typedef[ ]char \* malloc_t/typedef void \* malloc_t/g' \
914: -e 's/int[ ][ ]*free/void free/g' \
915: ${LIB}/$file > ${LIB}/${file}.sed
916: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
917: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
918: rm -f ${LIB}/$file
1.1.1.7 ! root 919: else
! 920: # Find any include directives that use "file".
! 921: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 922: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 923: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 924: done
1.1.1.3 root 925: fi
926: fi
927:
1.1 root 928: # Fix bogus #ifdef in <hsfs/hsfs_spec.h> on SunOS 4.1.
929: file=hsfs/hsfs_spec.h
1.1.1.2 root 930: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
931: mkdir ${LIB}/hsfs 2>/dev/null
932: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
933: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 934: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2 root 935: fi
936:
1.1 root 937: if [ -r ${LIB}/$file ]; then
1.1.1.2 root 938: echo Fixing $file
939: sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
1.1.1.5 root 940: ${LIB}/$file > ${LIB}/${file}.
941: rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
1.1.1.2 root 942: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1 root 943: rm -f ${LIB}/$file
1.1.1.7 ! root 944: else
! 945: # Find any include directives that use "file".
! 946: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 947: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 948: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 949: done
1.1 root 950: fi
951: fi
952:
953: # Fix bogus #ifdef in <hsfs/hsnode.h> on SunOS 4.1.
954: file=hsfs/hsnode.h
1.1.1.2 root 955: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
956: mkdir ${LIB}/hsfs 2>/dev/null
957: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
958: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 959: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2 root 960: fi
961:
1.1 root 962: if [ -r ${LIB}/$file ]; then
1.1.1.2 root 963: echo Fixing $file
964: sed -e 's/\#ifdef __i386__ || __sun4c__/\#if __i386__ || __sun4c__/g' \
965: ${LIB}/$file > ${LIB}/${file}.sed
966: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
967: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1 root 968: rm -f ${LIB}/$file
1.1.1.7 ! root 969: else
! 970: # Find any include directives that use "file".
! 971: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 972: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 973: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 974: done
1.1 root 975: fi
976: fi
977:
978: # Fix bogus #ifdef in <hsfs/iso_spec.h> on SunOS 4.1.
979: file=hsfs/iso_spec.h
1.1.1.2 root 980: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
981: mkdir ${LIB}/hsfs 2>/dev/null
982: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
983: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 984: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2 root 985: fi
986:
1.1 root 987: if [ -r ${LIB}/$file ]; then
1.1.1.2 root 988: echo Fixing $file
989: sed -e 's/\#ifdef __i386__ || __vax__/\#if __i386__ || __vax__/g' \
990: ${LIB}/$file > ${LIB}/${file}.sed
991: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
992: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
993: rm -f ${LIB}/$file
1.1.1.7 ! root 994: else
! 995: # Find any include directives that use "file".
! 996: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 997: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 998: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 999: done
1.1.1.2 root 1000: fi
1001: fi
1002:
1003: # Incorrect #include in Sony News-OS 3.2.
1004: file=machine/machparam.h
1005: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1006: mkdir ${LIB}/machine 2>/dev/null
1007: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1008: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 1009: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2 root 1010: fi
1011:
1012: if [ -r ${LIB}/$file ]; then
1013: echo Fixing $file, incorrect \#include
1014: sed -e 's@"../machine/endian.h"@<machine/endian.h>@' \
1.1.1.5 root 1015: ${LIB}/$file > ${LIB}/${file}.
1016: rm -f ${LIB}/$file; mv ${LIB}/${file}. ${LIB}/$file
1.1.1.2 root 1017: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1018: rm -f ${LIB}/$file
1.1.1.7 ! root 1019: else
! 1020: # Find any include directives that use "file".
! 1021: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1022: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1023: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1024: done
1.1.1.2 root 1025: fi
1026: fi
1027:
1028: # Multiline comment after typedef on IRIX 4.0.1.
1029: file=sys/types.h
1030: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1031: mkdir ${LIB}/sys 2>/dev/null
1032: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1033: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 1034: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.2 root 1035: fi
1036:
1037: if [ -r ${LIB}/$file ]; then
1038: echo Fixing $file, comment in the middle of \#ifdef
1039: sed -e 's@type of the result@type of the result */@' \
1040: -e 's@of the sizeof@/* of the sizeof@' \
1041: ${LIB}/$file > ${LIB}/${file}.sed
1042: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1043: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1.1.5 root 1044: rm -f ${LIB}/$file
1.1.1.7 ! root 1045: else
! 1046: # Find any include directives that use "file".
! 1047: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1048: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1049: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1050: done
1.1.1.5 root 1051: fi
1052: fi
1053:
1054: # Turning // comments into /* */ comments trashes this IRIX 4.0.1
1055: # header file, which embeds // comments inside multi-line /* */
1056: # comments. If this looks like the IRIX header file, we refix it by
1057: # just throwing away the // comments.
1058: file=fam.h
1059: if [ -r ${LIB}/$file ]; then
1060: if egrep indigo.esd ${LIB}/$file > /dev/null; then
1061: echo Fixing $file, overeager sed script
1062: rm ${LIB}/$file
1063: sed -e 's|//.*$||g' $file > ${LIB}/$file
1064: chmod +w ${LIB}/$file 2>/dev/null
1065: chmod a+r ${LIB}/$file 2>/dev/null
1066: fi
1067: fi
1068:
1.1.1.6 root 1069: # Some IRIX header files contains the string "//"
1070: for file in elf_abi.h elf.h; do
1071: if [ -r ${LIB}/$file ]; then
1072: echo Fixing $file, overeager sed script
1073: sed -e 's|"/\*"\*/|"//"|' ${LIB}/$file > ${LIB}/${file}.sed
1074: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1075: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1076: rm -f ${LIB}/$file
1.1.1.7 ! root 1077: else
! 1078: # Find any include directives that use "file".
! 1079: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1080: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1081: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1082: done
1.1.1.6 root 1083: fi
1084: fi
1085: done
1086:
1.1.1.7 ! root 1087: # IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr in prototype without
! 1088: # previous definition.
! 1089: file=rpc/auth.h
! 1090: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 1091: mkdir ${LIB}/rpc 2>/dev/null
! 1092: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 1093: chmod +w ${LIB}/$file 2>/dev/null
! 1094: chmod a+r ${LIB}/$file 2>/dev/null
! 1095: fi
! 1096:
! 1097: if [ -r ${LIB}/$file ]; then
! 1098: echo Fixing $file, undefined type
! 1099: sed -e '/authdes_create.*struct sockaddr/i\
! 1100: struct sockaddr;
! 1101: ' \
! 1102: ${LIB}/$file > ${LIB}/$file.sed
! 1103: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1104: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 1105: rm -f ${LIB}/$file
! 1106: else
! 1107: # Find any include directives that use "file".
! 1108: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1109: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1110: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1111: done
! 1112: fi
! 1113: fi
! 1114:
! 1115: # IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s in prototype without previous
! 1116: # definition.
! 1117: file=rpc/xdr.h
! 1118: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 1119: mkdir ${LIB}/rpc 2>/dev/null
! 1120: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 1121: chmod +w ${LIB}/$file 2>/dev/null
! 1122: chmod a+r ${LIB}/$file 2>/dev/null
! 1123: fi
! 1124:
! 1125: if [ -r ${LIB}/$file ]; then
! 1126: echo Fixing $file, undefined type
! 1127: sed -e '/xdrstdio_create.*struct __file_s/i\
! 1128: struct __file_s;
! 1129: ' \
! 1130: ${LIB}/$file > ${LIB}/$file.sed
! 1131: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1132: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 1133: rm -f ${LIB}/$file
! 1134: else
! 1135: # Find any include directives that use "file".
! 1136: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1137: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1138: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1139: done
! 1140: fi
! 1141: fi
! 1142:
1.1.1.6 root 1143: # Same problem with a file from SunOS 4.1.3 : a header file containing
1144: # the string "//" embedded in "/**/"
1145: file=sbusdev/audiovar.h
1.1.1.5 root 1146: if [ -r ${LIB}/$file ]; then
1147: echo Fixing $file, overeager sed script
1.1.1.6 root 1148: rm ${LIB}/$file
1149: sed -e 's|//.*$||g' $file > ${LIB}/$file
1150: chmod +w ${LIB}/$file 2>/dev/null
1151: chmod a+r ${LIB}/$file 2>/dev/null
1.1 root 1152: fi
1153:
1.1.1.3 root 1154: # Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
1155: # declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
1156: # many other systems have similar text but correct versions of the file.
1157: # To ensure only Sun's is fixed, we grep for a likely unique string.
1158: file=memory.h
1.1.1.5 root 1159: if [ -r $file ] && egrep '/\* @\(#\)memory\.h 1\.[2-4] 8./../.. SMI; from S5R2 1\.2 \*/' $file > /dev/null; then
1160: if [ ! -r ${LIB}/$file ]; then
1.1.1.3 root 1161: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1162: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 1163: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.3 root 1164: fi
1165: if [ -r ${LIB}/$file ]; then
1166: echo Replacing $file
1167: cat > ${LIB}/$file << EOF
1168: /* This file was generated by fixincludes */
1169: #ifndef __memory_h__
1170: #define __memory_h__
1171:
1172: #ifdef __STDC__
1173: extern void *memccpy();
1174: extern void *memchr();
1175: extern void *memcpy();
1176: extern void *memset();
1177: #else
1178: extern char *memccpy();
1179: extern char *memchr();
1180: extern char *memcpy();
1181: extern char *memset();
1182: #endif /* __STDC__ */
1183:
1184: extern int memcmp();
1185:
1.1.1.5 root 1186: #endif /* __memory_h__ */
1.1.1.3 root 1187: EOF
1188: fi
1189: fi
1190:
1.1.1.7 ! root 1191: # parameters not const on DECstation Ultrix V4.0 and OSF/1.
1.1.1.3 root 1192: file=stdio.h
1193: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1194: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1195: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 1196: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.3 root 1197: fi
1198:
1199: if [ -r ${LIB}/$file ]; then
1200: echo Fixing $file, non-const arg
1201: sed -e 's@perror( char \*__s );@perror( const char *__s );@' \
1202: -e 's@fputs( char \*__s,@fputs( const char *__s,@' \
1203: -e 's@fopen( char \*__filename, char \*__type );@fopen( const char *__filename, const char *__type );@' \
1204: -e 's@fwrite( void \*__ptr,@fwrite( const void *__ptr,@' \
1205: -e 's@fscanf( FILE \*__stream, char \*__format,@fscanf( FILE *__stream, const char *__format,@' \
1206: -e 's@scanf( char \*__format,@scanf( const char *__format,@' \
1207: -e 's@sscanf( char \*__s, char \*__format,@sscanf( const char *__s, const char *__format,@' \
1.1.1.7 ! root 1208: -e 's@popen(char \*, char \*);@popen(const char *, const char *);@' \
! 1209: -e 's@tempnam(char\*,char\*);@tempnam(const char*,const char*);@' \
1.1.1.3 root 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
1.1.1.5 root 1213: rm -f ${LIB}/$file
1.1.1.7 ! root 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
1.1.1.5 root 1220: fi
1221: fi
1222:
1223: # parameters conflict with C++ new on rs/6000
1.1.1.6 root 1224: for file in stdio.h unistd.h ; do
1225: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1226: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1227: chmod +w ${LIB}/$file 2>/dev/null
1228: fi
1229:
1230: if [ -r ${LIB}/$file ]; then
1231: echo Fixing $file, parameter name conflicts
1232: sed -e 's@rename(const char \*old, const char \*new)@rename(const char *_old, const char *_new)@' \
1233: ${LIB}/$file > ${LIB}/${file}.sed
1234: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1235: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1236: rm -f ${LIB}/$file
1.1.1.7 ! root 1237: else
! 1238: # Find any include directives that use "file".
! 1239: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1240: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1241: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1242: done
1.1.1.6 root 1243: fi
1244: fi
1245: done
1246:
1247: # function class(double x) conflicts with C++ keyword on rs/6000
1248: file=math.h
1.1.1.5 root 1249: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1250: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1251: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.6 root 1252: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.5 root 1253: fi
1254:
1255: if [ -r ${LIB}/$file ]; then
1.1.1.6 root 1256: if grep 'class[(]' ${LIB}/$file >/dev/null; then
1257: echo Fixing $file
1258: sed -e '/class[(]/i\
1.1.1.7 ! root 1259: #ifndef __cplusplus
! 1260: ' \
1.1.1.6 root 1261: -e '/class[(]/a\
1.1.1.7 ! root 1262: #endif
! 1263: ' ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.6 root 1264: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1265: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1266: rm ${LIB}/$file
1.1.1.7 ! root 1267: else
! 1268: # Find any include directives that use "file".
! 1269: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1270: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1271: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1272: done
1.1.1.6 root 1273: fi
1274: fi
1275: fi
1276:
1277: # Wrong fchmod prototype on RS/6000.
1278: file=sys/stat.h
1279: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1280: mkdir ${LIB}/sys 2>/dev/null
1281: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1282: chmod +w ${LIB}/$file 2>/dev/null
1283: chmod a+r ${LIB}/$file 2>/dev/null
1284: fi
1285:
1286: if [ -r ${LIB}/$file ]; then
1287: echo Fixing $file, fchmod prototype
1288: sed -e 's/fchmod(char \*/fchmod(int/' \
1289: ${LIB}/$file > ${LIB}/$file.sed
1290: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1291: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1292: rm -f ${LIB}/$file
1.1.1.7 ! root 1293: else
! 1294: # Find any include directives that use "file".
! 1295: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1296: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1297: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1298: done
! 1299: fi
! 1300: fi
! 1301:
! 1302: # There are several name conflicts with C++ reserved words in X11
! 1303: # header files. These are fixed in some versions, so don't do the
! 1304: # fixes if we find __cplusplus in the file. These were found on the
! 1305: # RS/6000.
! 1306:
! 1307: # class in X11/ShellP.h
! 1308: file=X11/ShellP.h
! 1309: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 1310: mkdir ${LIB}/sys 2>/dev/null
! 1311: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 1312: chmod +w ${LIB}/$file 2>/dev/null
! 1313: chmod a+r ${LIB}/$file 2>/dev/null
! 1314: fi
! 1315:
! 1316: if [ -r ${LIB}/$file ]; then
! 1317: if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then
! 1318: true;
! 1319: else
! 1320: echo Fixing $file, field class
! 1321: sed -e '/char [*]class;/i\
! 1322: #ifdef __cplusplus\
! 1323: char *c_class;\
! 1324: #else
! 1325: ' \
! 1326: -e '/char [*]class;/a\
! 1327: #endif
! 1328: ' ${LIB}/$file > ${LIB}/${file}.sed
! 1329: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1330: fi
! 1331: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 1332: rm -f ${LIB}/$file
! 1333: else
! 1334: # Find any include directives that use "file".
! 1335: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1336: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1337: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1338: done
! 1339: fi
! 1340: fi
! 1341: # new in Xm/Traversal.h
! 1342: file=Xm/Traversal.h
! 1343: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 1344: mkdir ${LIB}/sys 2>/dev/null
! 1345: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 1346: chmod +w ${LIB}/$file 2>/dev/null
! 1347: chmod a+r ${LIB}/$file 2>/dev/null
! 1348: fi
! 1349:
! 1350: if [ -r ${LIB}/$file ]; then
! 1351: if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then
! 1352: true;
! 1353: else
! 1354: echo Fixing $file, uses of new
! 1355: sed -e '/Widget old, new;/i\
! 1356: #ifdef __cplusplus\
! 1357: Widget old, c_new;\
! 1358: #else
! 1359: ' \
! 1360: -e '/Widget old, new;/a\
! 1361: #endif
! 1362: ' \
! 1363: -e 's/Widget new,/Widget c_new,/g' ${LIB}/$file > ${LIB}/${file}.sed
! 1364: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1365: fi
! 1366: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 1367: rm -f ${LIB}/$file
! 1368: else
! 1369: # Find any include directives that use "file".
! 1370: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1371: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1372: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1373: done
! 1374: fi
! 1375: fi
! 1376: # class in Xm/BaseClassI.h
! 1377: file=Xm/BaseClassI.h
! 1378: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 1379: mkdir ${LIB}/sys 2>/dev/null
! 1380: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 1381: chmod +w ${LIB}/$file 2>/dev/null
! 1382: chmod a+r ${LIB}/$file 2>/dev/null
! 1383: fi
! 1384:
! 1385: if [ -r ${LIB}/$file ]; then
! 1386: if grep __cplusplus ${LIB}/$file >/dev/null 2>/dev/null; then
! 1387: true;
! 1388: else
! 1389: echo Fixing $file, prototype parameter name
! 1390: sed -e 's/ class[)]/ c_class)/g' ${LIB}/$file > ${LIB}/${file}.sed
! 1391: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1392: fi
! 1393: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 1394: rm -f ${LIB}/$file
! 1395: else
! 1396: # Find any include directives that use "file".
! 1397: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1398: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1399: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1400: done
! 1401: fi
! 1402: fi
! 1403:
! 1404: # NeXT 3.2 adds const prefix to some math functions. These conflict
! 1405: # with the built-in functions.
! 1406: file=ansi/math.h
! 1407: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 1408: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 1409: chmod +w ${LIB}/$file 2>/dev/null
! 1410: fi
! 1411: if [ -r ${LIB}/$file ]; then
! 1412: echo Fixing $file
! 1413: sed -e '/^extern.*double.*__const__.*cos(/s/__const__//' \
! 1414: -e '/^extern.*double.*__const__.*sin(/s/__const__//' ${LIB}/$file > ${LIB}/${file}.sed
! 1415: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1416: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 1417: rm -f ${LIB}/$file
! 1418: else
! 1419: # Find any include directives that use "file".
! 1420: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1421: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1422: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1423: done
! 1424: fi
! 1425: fi
! 1426:
! 1427: # NeXT 3.2 uses the word "template" as a parameter for some
! 1428: # functions. GCC reports an invalid use of a reserved key word
! 1429: # with the built-in functions. NeXT 3.2 includes the keyword
! 1430: # volatile in the prototype for abort(). This conflicts with
! 1431: # the built-in definition.
! 1432: file=bsd/libc.h
! 1433: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 1434: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 1435: chmod +w ${LIB}/$file 2>/dev/null
! 1436: fi
! 1437: if [ -r ${LIB}/$file ]; then
! 1438: echo Fixing $file
! 1439: sed -e '/\(.*template\)/s/template//' \
! 1440: -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.sed
! 1441: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1442: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 1443: rm -f ${LIB}/$file
! 1444: else
! 1445: # Find any include directives that use "file".
! 1446: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1447: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1448: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1449: done
! 1450: fi
! 1451: fi
! 1452:
! 1453: # NeXT 3.2 includes the keyword volatile in the abort() and
! 1454: # exit() function prototypes. That conflicts with the
! 1455: # built-in functions.
! 1456: file=ansi/stdlib.h
! 1457: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 1458: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 1459: chmod +w ${LIB}/$file 2>/dev/null
! 1460: fi
! 1461: if [ -r ${LIB}/$file ]; then
! 1462: echo Fixing $file
! 1463: sed -e '/extern.*volatile.*void.*exit/s/volatile//' \
! 1464: -e '/extern.*volatile.*void.*abort/s/volatile//' ${LIB}/$file > ${LIB}/${file}.sed
! 1465: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1466: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 1467: rm -f ${LIB}/$file
! 1468: else
! 1469: # Find any include directives that use "file".
! 1470: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1471: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1472: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1473: done
1.1.1.6 root 1474: fi
1475: fi
1476:
1477: # NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
1478: # Note that version 3 of the NeXT system has wait.h in a different directory,
1479: # so that this code won't do anything. But wait.h in version 3 has a
1480: # conditional, so it doesn't need this fix. So everything is okay.
1481: file=sys/wait.h
1482: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1483: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1484: chmod +w ${LIB}/$file 2>/dev/null
1485: fi
1486:
1487: if [ -r ${LIB}/$file ] \
1488: && grep 'wait[(]union wait' ${LIB}/$file >/dev/null; then
1489: echo Fixing $file, bad wait formal
1490: sed -e 's@wait(union wait@wait(void@' ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.5 root 1491: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1492: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1.1.3 root 1493: rm -f ${LIB}/$file
1.1.1.7 ! root 1494: else
! 1495: # Find any include directives that use "file".
! 1496: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1497: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1498: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1499: done
1.1.1.3 root 1500: fi
1501: fi
1502:
1.1.1.4 root 1503: # Don't use or define the name va_list in stdio.h.
1.1.1.7 ! root 1504: # This is for ANSI and also to interoperate properly with gcc's varargs.h.
1.1.1.4 root 1505: file=stdio.h
1506: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1507: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1508: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 1509: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.4 root 1510: fi
1511:
1512: if [ -r ${LIB}/$file ]; then
1513: echo Fixing $file, use of va_list
1514: # Arrange for stdio.h to use stdarg.h to define __gnuc_va_list
1.1.1.7 ! root 1515: if egrep "__need___va_list" ${LIB}/$file >/dev/null 2>&1; then
! 1516: touch ${LIB}/${file}.sed
! 1517: else
! 1518: (echo "#define __need___va_list"
! 1519: echo "#include <stdarg.h>") > ${LIB}/${file}.sed
! 1520: fi
1.1.1.4 root 1521: # Use __gnuc_va_list in arg types in place of va_list.
1.1.1.5 root 1522: # On 386BSD use __gnuc_va_list instead of _VA_LIST_. We're hoping the
1523: # trailing parentheses and semicolon save all other systems from this.
1.1.1.4 root 1524: # Define __va_list__ (something harmless and unused) instead of va_list.
1525: # Don't claim to have defined va_list.
1526: sed -e 's@ va_list @ __gnuc_va_list @' \
1.1.1.5 root 1527: -e 's@ va_list)@ __gnuc_va_list)@' \
1528: -e 's@ _VA_LIST_));@ __gnuc_va_list));@' \
1.1.1.4 root 1529: -e 's@ va_list@ __va_list__@' \
1530: -e 's@\*va_list@*__va_list__@' \
1.1.1.6 root 1531: -e 's@ __va_list)@ __gnuc_va_list)@' \
1.1.1.7 ! root 1532: -e 's@GNUC_VA_LIST@GNUC_Va_LIST@' \
1.1.1.6 root 1533: -e 's@_NEED___VA_LIST@_NEED___Va_LIST@' \
1.1.1.4 root 1534: -e 's@VA_LIST@DUMMY_VA_LIST@' \
1.1.1.7 ! root 1535: -e 's@_Va_LIST@_VA_LIST@' \
1.1.1.4 root 1536: ${LIB}/$file >> ${LIB}/${file}.sed
1537:
1538: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1539: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1540: rm -f ${LIB}/$file
1.1.1.7 ! root 1541: else
! 1542: # Find any include directives that use "file".
! 1543: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1544: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1545: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1546: done
1.1.1.4 root 1547: fi
1548: fi
1549:
1550: # Cancel out ansi_compat.h on Ultrix. Replace it with empty file.
1551: file=ansi_compat.h
1552: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1553: if grep -s ULTRIX $file; then
1554: echo "/* This file intentionally left blank. */" > $LIB/$file
1555: fi
1556: fi
1557:
1.1.1.3 root 1558: # parameter to atof not const on DECstation Ultrix V4.0.
1.1.1.4 root 1559: # also get rid of bogus inline definitions in HP-UX 8.0
1.1.1.3 root 1560: file=math.h
1561: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1562: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1563: chmod +w ${LIB}/$file 2>/dev/null
1.1.1.5 root 1564: chmod a+r ${LIB}/$file 2>/dev/null
1.1.1.3 root 1565: fi
1566:
1567: if [ -r ${LIB}/$file ]; then
1568: echo Fixing $file, non-const arg
1569: sed -e 's@atof( char \*__nptr );@atof( const char *__nptr );@' \
1.1.1.6 root 1570: -e 's@inline int abs(int [a-z][a-z]*) {.*}@@' \
1571: -e 's@inline double abs(double [a-z][a-z]*) {.*}@@' \
1572: -e 's@inline int sqr(int [a-z][a-z]*) {.*}@@' \
1573: -e 's@inline double sqr(double [a-z][a-z]*) {.*}@@' \
1.1.1.3 root 1574: ${LIB}/$file > ${LIB}/${file}.sed
1575: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1576: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1.1.5 root 1577: rm -f ${LIB}/$file
1.1.1.7 ! root 1578: else
! 1579: # Find any include directives that use "file".
! 1580: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1581: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1582: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1583: done
1.1.1.5 root 1584: fi
1585: fi
1586:
1.1.1.6 root 1587: # Avoid nested comments on Ultrix 4.3.
1588: file=rpc/svc.h
1589: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1590: mkdir ${LIB}/rpc 2>/dev/null
1591: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1592: chmod +w ${LIB}/$file 2>/dev/null
1593: chmod a+r ${LIB}/$file 2>/dev/null
1594: fi
1595:
1596: if [ -r ${LIB}/$file ]; then
1597: echo Fixing $file, nested comment
1598: sed -e 's@^\( \* int protocol; \)/\*@\1*/ /*@' \
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
1.1.1.7 ! root 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: # This file in RISC/os uses /**/ to concatenate two tokens.
! 1613: file=bsd43/bsd43_.h
! 1614: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 1615: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 1616: chmod +w ${LIB}/$file 2>/dev/null
! 1617: chmod a+r ${LIB}/$file 2>/dev/null
! 1618: fi
! 1619: if [ -r ${LIB}/$file ]; then
! 1620: sed -e 's|/\*\*/|##|' ${LIB}/$file > ${LIB}/${file}.sed
! 1621: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1622: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 1623: rm -f ${LIB}/$file
! 1624: else
! 1625: # Find any include directives that use "file".
! 1626: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1627: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1628: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1629: done
! 1630: fi
! 1631: fi
! 1632:
! 1633: file=rpc/rpc.h
! 1634: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 1635: mkdir ${LIB}/rpc 2>/dev/null
! 1636: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 1637: chmod +w ${LIB}/$file 2>/dev/null
! 1638: chmod a+r ${LIB}/$file 2>/dev/null
! 1639: fi
! 1640:
! 1641: if [ -r ${LIB}/$file ]; then
! 1642: echo Fixing $file, nested comment
! 1643: sed -e 's@^\(/\*.*rpc/auth_des.h>.*\)/\*@\1*/ /*@' \
! 1644: ${LIB}/$file > ${LIB}/$file.sed
! 1645: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1646: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 1647: rm -f ${LIB}/$file
! 1648: else
! 1649: # Find any include directives that use "file".
! 1650: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1651: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1652: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1653: done
1.1.1.6 root 1654: fi
1655: fi
1656:
1.1.1.5 root 1657: # In limits.h, put #ifndefs around things that are supposed to be defined
1658: # in float.h to avoid redefinition errors if float.h is included first.
1659: # On HP/UX this patch does not work, because on HP/UX limits.h uses
1660: # multi line comments and the inserted #endif winds up inside the
1661: # comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
1662: # we find a #ifndef FLT_MIN we assume that all the required #ifndefs
1663: # are there, and we do not add them ourselves.
1.1.1.6 root 1664: for file in limits.h sys/limits.h; do
1665: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1666: mkdir ${LIB}/sys 2>/dev/null
1667: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1668: chmod +w ${LIB}/$file 2>/dev/null
1669: chmod a+r ${LIB}/$file 2>/dev/null
1670: fi
1.1.1.5 root 1671:
1.1.1.6 root 1672: if [ -r ${LIB}/$file ]; then
1673: if egrep 'ifndef[ ]+FLT_MIN' ${LIB}/$file >/dev/null; then
1674: true
1675: else
1676: echo Fixing $file
1677: sed -e '/[ ]FLT_MIN[ ]/i\
1.1.1.7 ! root 1678: #ifndef FLT_MIN
! 1679: '\
1.1.1.6 root 1680: -e '/[ ]FLT_MIN[ ]/a\
1.1.1.7 ! root 1681: #endif
! 1682: '\
1.1.1.6 root 1683: -e '/[ ]FLT_MAX[ ]/i\
1.1.1.7 ! root 1684: #ifndef FLT_MAX
! 1685: '\
1.1.1.6 root 1686: -e '/[ ]FLT_MAX[ ]/a\
1.1.1.7 ! root 1687: #endif
! 1688: '\
1.1.1.6 root 1689: -e '/[ ]FLT_DIG[ ]/i\
1.1.1.7 ! root 1690: #ifndef FLT_DIG
! 1691: '\
1.1.1.6 root 1692: -e '/[ ]FLT_DIG[ ]/a\
1.1.1.7 ! root 1693: #endif
! 1694: '\
1.1.1.6 root 1695: -e '/[ ]DBL_MIN[ ]/i\
1.1.1.7 ! root 1696: #ifndef DBL_MIN
! 1697: '\
1.1.1.6 root 1698: -e '/[ ]DBL_MIN[ ]/a\
1.1.1.7 ! root 1699: #endif
! 1700: '\
1.1.1.6 root 1701: -e '/[ ]DBL_MAX[ ]/i\
1.1.1.7 ! root 1702: #ifndef DBL_MAX
! 1703: '\
1.1.1.6 root 1704: -e '/[ ]DBL_MAX[ ]/a\
1.1.1.7 ! root 1705: #endif
! 1706: '\
1.1.1.6 root 1707: -e '/[ ]DBL_DIG[ ]/i\
1.1.1.7 ! root 1708: #ifndef DBL_DIG
! 1709: '\
1.1.1.6 root 1710: -e '/[ ]DBL_DIG[ ]/a\
1.1.1.7 ! root 1711: #endif
! 1712: '\
1.1.1.6 root 1713: ${LIB}/$file > ${LIB}/${file}.sed
1714: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1715: fi
1716: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1717: echo Deleting ${LIB}/$file\; no fixes were needed.
1718: rm -f ${LIB}/$file
1.1.1.7 ! root 1719: else
! 1720: # Find any include directives that use "file".
! 1721: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1722: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1723: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1724: done
1.1.1.6 root 1725: fi
1.1.1.5 root 1726: fi
1.1.1.6 root 1727: done
1728:
1729: # In math.h, put #ifndefs around things that might be defined in a gcc
1730: # specific math-*.h file.
1731: file=math.h
1732: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1733: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1734: chmod +w ${LIB}/$file 2>/dev/null
1735: chmod a+r ${LIB}/$file 2>/dev/null
1736: fi
1737:
1738: if [ -r ${LIB}/$file ]; then
1739: echo Fixing $file
1740: sed -e '/define[ ]HUGE_VAL[ ]/i\
1.1.1.7 ! root 1741: #ifndef HUGE_VAL
! 1742: '\
1.1.1.6 root 1743: -e '/define[ ]HUGE_VAL[ ]/a\
1.1.1.7 ! root 1744: #endif
! 1745: '\
1.1.1.6 root 1746: ${LIB}/$file > ${LIB}/${file}.sed
1747: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1.1.7 ! root 1748:
! 1749: # In addition, copy the definition of DBL_MAX from float.h
! 1750: # if math.h requires one. The Lynx math.h requires it.
! 1751: if egrep '#define[ ]*HUGE_VAL[ ]+DBL_MAX' $file >/dev/null 2>&1; then
! 1752: if egrep '#define[ ]+DBL_MAX[ ]+' $file >/dev/null 2>&1; then
! 1753: true;
! 1754: else
! 1755: dbl_max_def=`egrep 'define[ ]+DBL_MAX[ ]+.*' float.h 2>/dev/null`
! 1756: if [ "$dbl_max_def" != "" ]; then
! 1757: dbl_max_def=`echo $dbl_max_def | sed 's/.*define[ ]*DBL_MAX[ ]*//'`
! 1758: sed -e "/define[ ]HUGE_VAL[ ]DBL_MAX/s/DBL_MAX/$dbl_max_def/" \
! 1759: ${LIB}/$file > ${LIB}/${file}.sed
! 1760: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1761: fi
! 1762: fi
! 1763: fi
! 1764:
1.1.1.5 root 1765: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1.1.1.3 root 1766: echo Deleting ${LIB}/$file\; no fixes were needed.
1767: rm -f ${LIB}/$file
1.1.1.7 ! root 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
1.1.1.3 root 1774: fi
1775: fi
1776:
1.1.1.6 root 1777: # Remove erroneous parentheses in sym.h on Alpha OSF/1.
1778: file=sym.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:
1785: if [ -r ${LIB}/$file ]; then
1786: echo Fixing $file
1787: sed -e 's/#ifndef(__mips64)/#ifndef __mips64/' \
1788: ${LIB}/$file > ${LIB}/${file}.sed
1789: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1790: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1791: rm -f ${LIB}/$file
1.1.1.7 ! root 1792: else
! 1793: # Find any include directives that use "file".
! 1794: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1795: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1796: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1797: done
! 1798: fi
! 1799: fi
! 1800:
! 1801: # Correct the return type for strlen in string.h on Lynx.
! 1802: # Correct the argument type for ffs in string.h on Alpha OSF/1 V2.0.
! 1803: # Add missing const for strdup on OSF/1 V3.0.
! 1804: file=string.h
! 1805: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 1806: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 1807: chmod +w ${LIB}/$file 2>/dev/null
! 1808: chmod a+r ${LIB}/$file 2>/dev/null
! 1809: fi
! 1810:
! 1811: if [ -r ${LIB}/$file ]; then
! 1812: echo Fixing $file
! 1813: sed -e 's/extern[ ]*int[ ]*strlen();/extern unsigned int strlen();/' \
! 1814: -e 's/extern[ ]*int[ ]*ffs[ ]*(long);/extern int ffs(int);/' \
! 1815: -e 's/strdup(char \*s1);/strdup(const char *s1);/' \
! 1816: ${LIB}/$file > ${LIB}/${file}.sed
! 1817: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1818: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 1819: rm -f ${LIB}/$file
! 1820: else
! 1821: # Find any include directives that use "file".
! 1822: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1823: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1824: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1825: done
! 1826: fi
! 1827: fi
! 1828:
! 1829: # Delete the '#define void int' line from curses.h on Lynx
! 1830: file=curses.h
! 1831: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 1832: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 1833: chmod +w ${LIB}/$file 2>/dev/null
! 1834: chmod a+r ${LIB}/$file 2>/dev/null
! 1835: fi
! 1836:
! 1837: if [ -r ${LIB}/$file ]; then
! 1838: echo Fixing $file
! 1839: sed -e '/#[ ]*define[ ][ ]*void[ ]int/d' \
! 1840: ${LIB}/$file > ${LIB}/${file}.sed
! 1841: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1842: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 1843: rm -f ${LIB}/$file
! 1844: else
! 1845: # Find any include directives that use "file".
! 1846: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1847: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1848: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1849: done
1.1.1.6 root 1850: fi
1851: fi
1852:
1.1.1.7 ! root 1853: # For C++, avoid any typedef or macro definition of bool, and use the
! 1854: # built in type instead.
! 1855: for files in curses.h; do
! 1856: if [ -r $file ] && egrep bool $file >/dev/null 2>&1; then
! 1857: if [ ! -r ${LIB}/$file ]; then
! 1858: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 1859: chmod +w ${LIB}/$file 2>/dev/null
! 1860: chmod a+r ${LIB}/$file 2>/dev/null
! 1861: fi
! 1862:
! 1863: echo Fixing $file
! 1864: sed -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/i\
! 1865: #ifndef __cplusplus'\
! 1866: -e '/^#[ ]*define[ ][ ]*bool[ ][ ]*char[ ]*$/a\
! 1867: #endif'\
! 1868: -e '/^typedef[ ][ ]*char[ ][ ]*bool;[ ]*$/i\
! 1869: #ifndef __cplusplus'\
! 1870: -e '/^typedef[ ][ ]*char[ ][ ]*bool;[ ]*$/a\
! 1871: #endif'\
! 1872: ${LIB}/$file > ${LIB}/${file}.sed
! 1873: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 1874: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 1875: rm -f ${LIB}/$file
! 1876: else
! 1877: # Find any include directives that use "file".
! 1878: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1879: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1880: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1881: done
! 1882: fi
! 1883: fi
! 1884: done
! 1885:
1.1.1.6 root 1886: # Fix incorrect S_IF* definitions on m88k-sysv3.
1887: file=sys/stat.h
1888: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1889: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1890: chmod +w ${LIB}/$file 2>/dev/null
1891: chmod a+r ${LIB}/$file 2>/dev/null
1892: fi
1893:
1894: if [ -r ${LIB}/$file ]; then
1895: echo Fixing $file
1896: 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)/' \
1897: -e 's/^\(#define[ ]*S_IS[A-Z]*(m)\)[ ]*(m[ ]*&[ ]*\(0[0-9]*\)[ ]*)/\1 (((m)\&S_IFMT)==\2)/' \
1898: ${LIB}/$file > ${LIB}/${file}.sed
1899: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1900: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1901: rm -f ${LIB}/$file
1.1.1.7 ! root 1902: else
! 1903: # Find any include directives that use "file".
! 1904: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1905: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1906: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1907: done
1.1.1.6 root 1908: fi
1909: fi
1910:
1.1.1.7 ! root 1911: # Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
1.1.1.6 root 1912: for file in stdio.h stdlib.h; do
1913: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1914: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1915: chmod +w ${LIB}/$file 2>/dev/null
1916: chmod a+r ${LIB}/$file 2>/dev/null
1917: fi
1918:
1919: if [ -r ${LIB}/$file ]; then
1920: echo Fixing $file, getopt declaration
1.1.1.7 ! root 1921: sed -e 's/getopt(int, char \*\[\],[ ]*char \*)/getopt(int, char *const[], const char *)/' \
1.1.1.6 root 1922: ${LIB}/$file > ${LIB}/${file}.sed
1923: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1924: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1925: rm -f ${LIB}/$file
1.1.1.7 ! root 1926: else
! 1927: # Find any include directives that use "file".
! 1928: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1929: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1930: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1931: done
1.1.1.6 root 1932: fi
1933: fi
1934: done
1935:
1.1.1.5 root 1936: # Determine if we're on Interactive Unix 2.2 or later, in which case we
1937: # need to fix some additional files. This is the same test for ISC that
1938: # Autoconf uses.
1939: if test -d /etc/conf/kconfig.d \
1940: && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1; then
1941: echo "Fixing ISC __STDC__ goof in several files..."
1942: for name in stdio.h math.h ctype.h sys/limits.h sys/fcntl.h sys/dirent.h; do
1943: echo $name
1944: if test -r ${LIB}/$name; then
1945: file=${LIB}/$name
1946: else
1947: file=${INPUT}/$name
1948: fi
1949: # On Interactive 2.2, certain traditional Unix definitions
1950: # (notably getc and putc in stdio.h) are omitted if __STDC__ is
1951: # defined, not just if _POSIX_SOURCE is defined. This makes it
1952: # impossible to compile any nontrivial program except with -posix.
1953: sed \
1954: 's/!defined(__STDC__) && !defined(_POSIX_SOURCE)/!defined(_POSIX_SOURCE)/' \
1955: < $file > ${LIB}/$name.
1956: mv ${LIB}/$name. ${LIB}/$name
1957: done
1958:
1959: echo "Fixing ISC fmod declaration"
1960: # This one's already been fixed for other things.
1961: file=${LIB}/math.h
1962: sed 's/fmod(double)/fmod(double, double)/' <$file >$file.
1963: mv $file. $file
1964:
1965: echo "Fixing nested comments in ISC <sys/limits.h>"
1966: file=sys/limits.h
1967: sed '/CHILD_MAX/s,/\* Max, Max,' < ${INPUT}/$file >${LIB}/$file.
1968: sed '/OPEN_MAX/s,/\* Max, Max,' < ${LIB}/$file. >${LIB}/$file
1969: fi
1970:
1.1.1.6 root 1971: # These files in Sun OS 4.x use /**/ to concatenate tokens.
1972: for file in sparc/asm_linkage.h sun3/asm_linkage.h sun3x/asm_linkage.h \
1973: sun4/asm_linkage.h sun4c/asm_linkage.h sun4m/asm_linkage.h \
1974: sun4c/debug/asm_linkage.h sun4m/debug/asm_linkage.h;
1975: do
1976: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
1977: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
1978: chmod +w ${LIB}/$file 2>/dev/null
1979: chmod a+r ${LIB}/$file 2>/dev/null
1980: fi
1981:
1982: if [ -r ${LIB}/$file ]; then
1983: sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.sed
1984: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1985: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
1986: rm -f ${LIB}/$file
1.1.1.7 ! root 1987: else
! 1988: # Find any include directives that use "file".
! 1989: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 1990: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 1991: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 1992: done
1.1.1.6 root 1993: fi
1994: fi
1995: done
1996:
1997: # These files in ARM/RISCiX use /**/ to concatenate tokens.
1998: for file in arm/as_support.h arm/mc_type.h arm/xcb.h dev/chardefmac.h \
1999: dev/ps_irq.h dev/screen.h dev/scsi.h sys/tty.h Xm.acorn/XmP.h
2000: do
2001: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
2002: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
2003: chmod +w ${LIB}/$file 2>/dev/null
2004: chmod a+r ${LIB}/$file 2>/dev/null
2005: fi
2006:
2007: if [ -r ${LIB}/$file ]; then
2008: sed -e 's|/\*\*/|##|g' ${LIB}/$file > ${LIB}/${file}.sed
1.1.1.5 root 2009: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
1.1.1.6 root 2010: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
2011: rm -f ${LIB}/$file
1.1.1.7 ! root 2012: else
! 2013: # Find any include directives that use "file".
! 2014: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 2015: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 2016: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 2017: done
1.1.1.6 root 2018: fi
1.1.1.5 root 2019: fi
2020: done
2021:
1.1.1.7 ! root 2022: # math.h on SunOS 4 puts the declaration of matherr before the definition
! 2023: # of struct exception, so the prototype (added by fixproto) causes havoc.
! 2024: file=math.h
! 2025: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 2026: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 2027: chmod +w ${LIB}/$file 2>/dev/null
! 2028: chmod a+r ${LIB}/$file 2>/dev/null
! 2029: fi
1.1 root 2030:
1.1.1.7 ! root 2031: if [ -r ${LIB}/$file ]; then
! 2032: echo Fixing $file, matherr declaration
! 2033: sed -e '/^struct exception/,$b' \
! 2034: -e '/matherr/i\
! 2035: struct exception;
! 2036: '\
! 2037: ${LIB}/$file > ${LIB}/${file}.sed
! 2038: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 2039: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 2040: rm -f ${LIB}/$file
! 2041: else
! 2042: # Find any include directives that use "file".
! 2043: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 2044: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 2045: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 2046: done
! 2047: fi
! 2048: fi
! 2049:
! 2050: # assert.h on HP/UX is not C++ ready, even though NO_IMPLICIT_EXTERN_C
! 2051: # is defined on HP/UX.
! 2052: file=assert.h
! 2053: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 2054: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 2055: chmod +w ${LIB}/$file 2>/dev/null
! 2056: chmod a+r ${LIB}/$file 2>/dev/null
! 2057: fi
! 2058:
! 2059: if [ -r ${LIB}/$file ]; then
! 2060: if egrep '"C"' ${LIB}/$file >/dev/null 2>&1 \
! 2061: || egrep '__BEGIN_DECLS' ${LIB}/$file >/dev/null 2>&1; then
! 2062: true
! 2063: else
! 2064: echo Fixing $file
! 2065: echo '#ifdef __cplusplus
! 2066: extern "C" {
! 2067: #endif' > ${LIB}/${file}.sed
! 2068: cat ${LIB}/${file} >> ${LIB}/${file}.sed
! 2069: echo '#ifdef __cplusplus
! 2070: }
! 2071: #endif' >> ${LIB}/${file}.sed
! 2072: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 2073: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 2074: rm -f ${LIB}/$file
! 2075: else
! 2076: # Find any include directives that use "file".
! 2077: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 2078: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 2079: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 2080: done
1.1 root 2081: fi
1.1.1.7 ! root 2082: fi
! 2083: fi
! 2084:
! 2085: # check for broken assert.h that needs stdio.h or stdlib.h
! 2086: file=assert.h
! 2087: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 2088: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 2089: chmod +w ${LIB}/$file 2>/dev/null
! 2090: chmod a+r ${LIB}/$file 2>/dev/null
! 2091: fi
! 2092:
! 2093: if [ -r ${LIB}/$file ]; then
! 2094: if grep 'stderr' ${LIB}/$file >/dev/null 2>/dev/null; then
! 2095: if grep 'include.*stdio.h' ${LIB}/$file >/dev/null 2>/dev/null; then
! 2096: true
! 2097: else
! 2098: echo "Fixing $file (needs stdio.h)"
! 2099: echo '#include <stdio.h>' >>${LIB}/$file
! 2100: fi
! 2101: fi
! 2102: if grep 'exit *(' ${LIB}/$file >/dev/null 2>/dev/null ||
! 2103: grep 'abort *(' ${LIB}/$file >/dev/null 2>/dev/null; then
! 2104: if grep 'include.*stdlib.h' ${LIB}/$file >/dev/null 2>/dev/null; then
! 2105: true
! 2106: else
! 2107: echo "Fixing $file (needs stdlib.h)"
! 2108: echo '#include <stdlib.h>' >>${LIB}/$file
! 2109: fi
! 2110: fi
! 2111: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 2112: rm -f ${LIB}/$file
! 2113: else
! 2114: # Find any include directives that use "file".
! 2115: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 2116: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 2117: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 2118: done
! 2119: fi
! 2120: fi
! 2121:
! 2122: # Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
! 2123: file=unistd.h
! 2124: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 2125: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 2126: chmod +w ${LIB}/$file 2>/dev/null
! 2127: chmod a+r ${LIB}/$file 2>/dev/null
! 2128: fi
! 2129:
! 2130: if [ -r ${LIB}/$file ]; then
! 2131: echo Fixing $file, sbrk declaration
! 2132: sed -e 's/char\([ ]*\*[ ]*sbrk[ ]*(\)/void\1/' \
! 2133: ${LIB}/$file > ${LIB}/${file}.sed
! 2134: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 2135: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 2136: rm -f ${LIB}/$file
! 2137: else
! 2138: # Find any include directives that use "file".
! 2139: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 2140: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 2141: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 2142: done
! 2143: fi
! 2144: fi
! 2145:
! 2146: # This file on SunOS 4 has a very large macro. When the sed loop
! 2147: # tries pull it in, it overflows the pattern space size of the SunOS
! 2148: # sed (GNU sed does not have this problem). Since the file does not
! 2149: # require fixing, we remove it from the fixed directory.
! 2150: file=sundev/ipi_error.h
! 2151: if [ -r ${LIB}/$file ]; then
! 2152: echo "Removing incorrect fix to SunOS <sundev/ipi_error.h>"
! 2153: rm -f ${LIB}/$file
! 2154: fi
! 2155:
! 2156: # Put cpp wrappers around these include files to avoid redeclaration
! 2157: # errors during multiple inclusion on m88k-tektronix-sysv3.
! 2158: for file in time.h sys/time.h ; do
! 2159: if egrep '#ifndef' $file >/dev/null 2>&1; then
! 2160: true
! 2161: else
! 2162: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 2163: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 2164: chmod +w ${LIB}/$file 2>/dev/null
! 2165: fi
! 2166: if [ -r ${LIB}/$file ]; then
! 2167: echo Fixing $file, to protect against multiple inclusion.
! 2168: cpp_wrapper=`echo $file | sed -e 's,\.,_,g' -e 's,/,_,g'`
! 2169: (echo "#ifndef __GCC_GOT_${cpp_wrapper}_"
! 2170: echo "#define __GCC_GOT_${cpp_wrapper}_"
! 2171: cat ${LIB}/${file}
! 2172: echo '#endif /* !_GCC_GOT_'${cpp_wrapper}_' */') > ${LIB}/${file}.new
! 2173: rm -f ${LIB}/$file; mv ${LIB}/${file}.new ${LIB}/$file
! 2174: fi
! 2175: fi
! 2176: done
! 2177:
! 2178: # Fix fcntl prototype in fcntl.h on LynxOS.
! 2179: file=fcntl.h
! 2180: if [ -r $file ] && [ ! -r ${LIB}/$file ]; then
! 2181: cp $file ${LIB}/$file >/dev/null 2>&1 || echo "Can't copy $file"
! 2182: chmod +w ${LIB}/$file 2>/dev/null
! 2183: chmod a+r ${LIB}/$file 2>/dev/null
! 2184: fi
! 2185:
! 2186: if [ -r ${LIB}/$file ]; then
! 2187: echo Fixing $file, fcntl declaration
! 2188: sed -e 's/\(fcntl.*(int, int, \)int)/\1...)/' \
! 2189: ${LIB}/$file > ${LIB}/${file}.sed
! 2190: rm -f ${LIB}/$file; mv ${LIB}/${file}.sed ${LIB}/$file
! 2191: if cmp $file ${LIB}/$file >/dev/null 2>&1; then
! 2192: rm -f ${LIB}/$file
! 2193: else
! 2194: # Find any include directives that use "file".
! 2195: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' ${LIB}/$file | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
! 2196: dir=`echo $file | sed -e s'|/[^/]*$||'`
! 2197: required="$required ${INPUT} $dir/$include ${LIB}/$dir/$include"
! 2198: done
! 2199: fi
1.1 root 2200: fi
2201:
1.1.1.7 ! root 2202: # This loop does not appear to do anything, because it uses file
! 2203: # rather than $file when setting target. It also appears to be
! 2204: # unnecessary, since the main loop processes symbolic links.
! 2205: #if $LINKS; then
! 2206: # echo 'Making internal symbolic non-directory links'
! 2207: # cd ${INPUT}
! 2208: # files=`find . -type l -print`
! 2209: # for file in $files; do
! 2210: # dest=`ls -ld $file | sed -n 's/.*-> //p'`
! 2211: # if expr "$dest" : '[^/].*' > /dev/null; then
! 2212: # target=${LIB}/`echo file | sed "s|[^/]*\$|$dest|"`
! 2213: # if [ -f $target ]; then
! 2214: # ln -s $dest ${LIB}/$file >/dev/null 2>&1
! 2215: # fi
! 2216: # fi
! 2217: # done
! 2218: #fi
! 2219:
1.1.1.6 root 2220: # Make sure that any include files referenced using double quotes
2221: # exist in the fixed directory. This comes last since otherwise
2222: # we might end up deleting some of these files "because they don't
2223: # need any change."
1.1.1.7 ! root 2224: set x $required
! 2225: shift
! 2226: while [ $# != 0 ]; do
1.1.1.6 root 2227: newreq=
2228: while [ $# != 0 ]; do
2229: # $1 is the directory to copy from, $2 is the unfixed file,
2230: # $3 is the fixed file name.
2231: cd ${INPUT}
2232: cd $1
2233: if [ -r $2 ] && [ ! -r $3 ]; then
2234: cp $2 $3 >/dev/null 2>&1 || echo "Can't copy $2"
2235: chmod +w $3 2>/dev/null
2236: chmod a+r $3 2>/dev/null
2237: echo Copied $2
2238: for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 | sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`; do
2239: dir=`echo $2 | sed -e s'|/[^/]*$||'`
2240: dir2=`echo $3 | sed -e s'|/[^/]*$||'`
2241: newreq="$newreq $1 $dir/$include $dir2/$include"
2242: done
2243: fi
2244: shift; shift; shift
2245: done
1.1.1.7 ! root 2246: set x $newreq
! 2247: shift
1.1.1.6 root 2248: done
2249:
1.1.1.5 root 2250: echo 'Cleaning up DONE files.'
2251: cd $LIB
1.1.1.6 root 2252: find . -name DONE -exec rm -f '{}' ';'
1.1.1.5 root 2253:
1.1.1.7 ! root 2254: echo 'Removing unneeded directories:'
! 2255: cd $LIB
! 2256: files=`find . -type d -print | sort -r`
! 2257: for file in $files; do
! 2258: rmdir $LIB/$file > /dev/null 2>&1
! 2259: done
! 2260:
1.1 root 2261: exit 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.